@bigbinary/neeto-folders-frontend

中文文档
2.1.0发布于 2026/11/03UNLICENSEDTypeScriptESM + CJS近 30 天下载 7891

A repo acts as the source of truth for the new nano's structure, configs, data etc.

原始使用文档
文档目录6 节
  1. Contents
  2. Development with Host Application
  3. Engine
  4. Frontend package
  5. Instructions for development
  6. Instructions for Publishing

neeto-folders-nano

The neeto-folders-nano acts as the source of truth for the new nano's structure, configs, data etc.

Contents

  1. Development with Host Application
  2. Instructions for Publishing

Development with Host Application

Engine

Installation

  1. Add this line to your application's Gemfile:

     source "NEETO_GEM_SERVER_URL" do
       # ..existing gems
    
       gem 'neeto-folders-engine'
     end
    
  2. And then execute:

    bundle install
    
  3. Add required migrations in the db/migrate folder. Run the following commands to copy the migrations from the engine to the host application.

    rails g neeto_folders_engine:install
    bundle exec rails db:migrate
    

Usage

  1. Define the folder model in your application by extending the NeetoFoldersEngine::Folder base class. Below is the sample code in NeetoRecord that defines a RecordingFolder model by extending the NeetoFoldersEngine::Folder to manage recordings.

    class RecordingFolder < NeetoFoldersEngine::Folder
      has_many :recordings, -> { unscope(where: :deleted_at) }, foreign_key: :folder_id, dependent: :nullify
    

    NeetoFoldersEngine also expects a instance method items to be defined in the extended class. This enables the NeetoFoldersEngine to keep track of the count of items in the folder. Below is a sample code from NeetoRecord.

    def items
      recordings
    end
    
  2. Include the NeetoFoldersEngine::Folderable in the model which should belong to a folder. Order of include is important. Include Folderable after Deletable from neeto-commons-backend to allow Folderable to override the soft_delete method.

    include NeetoFoldersEngine::Folderable
    
  3. NeetoFoldersEngine also exposes a controller class NeetoFoldersEngine::FoldersController with index, show, create, update, destroy, bulk_update, bulk_destroy, and reorder actions to manage folders. The host application can extend this class to manage their folders. Make sure the routes are properly configured to direct to these actions.

    Similar to the RecordingFolder < NeetoFoldersEngine::Folder, the NeetoFoldersEngine::FoldersController base controller expects a folders method to be defined in the extended class that allows the controller to target folder instances that belongs to a particular type. Given below is sample definition in NeetoRecord which extracts recording folders that should be managed by the extended controller.

    class Api::V1::FoldersController < NeetoFoldersEngine::FoldersController
    
      private
    
        def folders
          @_folders ||= @organization.recording_folders.includes(:recordings)
        end
      end
    
    

Frontend package

Installation

  1. Add the neeto-folders-frontend package to the package.json

    yarn add @bigbinary/neeto-folders-frontend
    

Instructions for development

Check the Frontend package development guide for step-by-step instructions to develop the frontend package.

Usage

neeto-folders-frontend exports a set of components, hooks, utils and constants to be integrated in the host application.

Most of the above exports accepts a configuration object with certain properties. Given below is the structure of default config object. You can pass your own config object as argument or props to customize behaviors that suits the host product. Define this constant in a constant file and customize certain properties such as params as necessary.

{

  type: "FOLDER", // A unique type key for query keys.
  maxDepth: 2, // Maximum allowed depth for folder tree
  folderPath: "/folders/:folderId", // Path for handling URL redirections and params matching.
  invalidationKeys: [], // For invalidation purposes. Keys in this array will be invalidated along with folders.
  reorderMode: "rearrange", // If reorder pane should mount in positional `reorder` mode or simple `rearrange` mode.
// Taxonomy
  labels: {
    folder: t("common.folder"),
    folders: t("common.folders"),
    items: t("common.items"),
    items: t("common.items"),
  }
  params: {}, // Params to be passed to APIs along with other params. Can be used for sorting and similar.
  api: { // Folder CRUD methods.
    fetch: noop,
    get: noop,
    create: noop,
    update: noop,
    destroy: noop,
    bulkUpdate: noop,
    bulkDestroy: noop,
  },
  folderActions: { getMoreActions: (node) => [...], getAddActions: (node) => [...] },
  itemActions: { getMoreActions: (node) => [...], getAddActions: (node) => [...] }
}

Components

import * as components from "@bigbinary/neeto-folders-frontend/components";
  1. FoldersContext: This component renders all alerts and panes related to folders. Make sure this component is included in some part of your application.

    Props:
    • config: A config object to customize the folders behavior.

    Sample usage:

    import { FoldersContext } from "@bigbinary/neeto-folders-frontend/components";
    // ....
    <FoldersContext config={foldersConfig}>
      <ApplicationComponent>
    </FoldersContext>
    
  2. FoldersTree: This component renders the folders in tree a tree structure.

    Props:
    • config: A config object to customize the folders behavior.

    Sample usage:

    import { FoldersTree } from "@bigbinary/neeto-folders-frontend/components";
    // ....
    <FoldersTree config={foldersConfig} />;
    
  3. FoldersList: Component renders list of folders. If no folder is selected/active, renders list of root folders. If inside a selected folder, renders list of sub-folders. The active folder is identified based on the param in the URL that matches the folderPath in the config object.

    Props:
    • config: A config object to customize the folders behavior.

    • selection: An array of folder ids indicating id of selected folders for bulk selection.

    • onSelect: Callback triggered when checkbox is selected for a folder item for bulk selection.

    Sample usage:

    import { FoldersList } from "@bigbinary/neeto-folders-frontend/components";
    // ....
    <FoldersList
      config={foldersConfig}
      onSelect={onSelectFolder}
      selection={folderSelection}
    />;
    
  4. MoveToFolderPane: This component can be used in host applications to move items to a folder. Component renders current list of folders in pane with radio buttons and invokes callbacks for folder selections.

    Props:
    • isOpen: Boolean value that controls pane visibility.

    • item: An item object that is to be moved to the folder.

    • config: A config object to customize the folders behavior.

    • submitButtonProps: Pane "Submit" button overrides.

    • cancelButtonProps: Pane "Cancel" button overrides.

    • removeButtonProps: Pane "Remove from folder" button overrides. Note that the button will be hidden unless the onRemove prop is supplied.

    • onSubmit(folderId): Callback invoked with id of selected folder on submit.

    • onClose(): Callback invoked when the pane is closed.

    • onRemove(): Callback invoked when the Remove from folder button is pressed. Note that the button will be hidden unless this prop is supplied.

    • onSelect: Callback triggered when checkbox is selected for a folder item for bulk selection.

    Sample usage:

    import { MoveToFolderPane } from "@bigbinary/neeto-folders-frontend/components";
    // ....
    <MoveToFolderPane
      item={itemToMove}
      onSelect={onSelectFolder}
      selection={folderSelection}
    />;
    
  5. AddEditPane: This component can be used in host applications to add or edit folders.

    Props:
    • config: A config object to customize the folders behavior.

    • onClose(): Callback invoked when the pane is closed.

    • folderSid: It is optional. The SID of the parent folder where new folder should be created. If not provided, uses the active folder from URL.

    • setFocusField: Ref callback to set focus on the name input field when pane opens.

    Sample usage:

    import { AddEditPane } from "@bigbinary/neeto-folders-frontend/components";
    // ....
    <AddEditPane
      {...{ setFocusField, onClose }}
      config={foldersConfig}
      folderSid={selectedFolderSid}
    />;
    

Hooks

import * as hooks from "@bigbinary/neeto-folders-frontend/hooks";
  1. useFolders(config): Hook that return the data for all folders in tree structure.

    Arguments:
    • config: A config object to customize the folders behavior.
    Returns:
    • isLoading: true when data is being fetched for active folder. false otherwise.

    • folders: Data of all folders of given type in tree structure.

  2. useFolder(config): Hook that return the data related to current active folder based on URL param.

    Arguments:
    • config: A config object to customize the folders behavior.
    Returns:
    • isLoading: true when data is being fetched for active folder. false otherwise.

    • folderId: SID of the current active folder based on URL param.

    • folder: Data of the current folder if exists.

  3. useFolderActions(config): Hook that return a set of callbacks to trigger actions from host application.

    Arguments:
    • config: A config object to customize the folders behavior.
    Returns:
    • isPending: true when action is in progress. false otherwise.

    • onAdd(): Initiates the folder create action.

    • onEdit(folder): Initiates the folder edit action. Accepts folder data as argument.

    • onMove(folder): Initiates the folder edit action. Accepts folder data as argument.

    • onDelete(folder): Initiates the folders delete action. Accepts folder data as argument.

    • onReorder(): Initiates the reorder folder action. Opens the "Reorder" pane.

Utils

import * as utils from "@bigbinary/neeto-folders-frontend/utils";
  1. pathToFolder(folders, folderId):

    Arguments:
    • folders: Folders data in tree structure, returned by the useFolders hook.

    • folderId: Target folder id.

    Returns an flattened array of folders from root folder to current folder with id folderId. Useful for showing breadcrumbs and similar.

Constants

import * as constants from "@bigbinary/neeto-folders-frontend/constants";
  1. QUERY_KEYS: Use query keys to target React Query actions such as invalidations.

    • [QUERY_KEYS.FOLDERS]: Targets every query related to folders.

    • [QUERY_KEYS.FOLDERS, config.folderType]: Targets every query related to folders of particular type.

    • [QUERY_KEYS.FOLDERS, config.folderType, QUERY_KEYS.LIST]: Targets folders list.

    • [QUERY_KEYS.FOLDERS, config.folderType, QUERY_KEYS.DETAILS, folderId]: Target folder details of a folder with id folderId

Instructions for Publishing

Consult the building and releasing packages guide for details on how to publish.

版本与发布记录

@bigbinary/neeto-folders-frontend 共发布 80 个版本,首次发布于 2025/04/09;过去 12 个月发布了 43 个版本。

版本发布日期距今
2.1.0latest2026/11/035 天前
2.1.0-beta1beta2026/11/035 天前
2.0.562026/11/035 天前
2.0.552026/11/017 天前
2.0.55-beta22026/11/017 天前
2.0.55-beta12026/10/309 天前

关于 @bigbinary/neeto-folders-frontend 的常见问题

@bigbinary/neeto-folders-frontend 是什么?

A repo acts as the source of truth for the new nano's structure, configs, data etc.

如何安装 @bigbinary/neeto-folders-frontend?

在项目目录运行 npm install @bigbinary/neeto-folders-frontend,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:qs(6.16.2)、url(0.11.4)、yup(0.32.11)、antd(5.22.1)、util(^0.12.5)、ramda(0.29.0)、react(18.3.1)、buffer(^6.0.3)、formik(2.4.6)、i18next(22.5.1)、zustand(4.4.2)、dompurify(3.4.17)、js-logger(1.6.1)、react-dom(18.3.1)、classnames(2.5.1)、stream-http(3.2.0)、tailwindcss(3.4.14)、lucide-react(^0.469.0)、react-helmet(^6.1.0)、@dnd-kit/core(6.3.1)、os-browserify(0.3.0)、react-i18next(12.3.1)、vm-browserify(1.1.2)、@babel/runtime(7.29.7)、react-toastify(8.0.2)、tty-browserify(0.0.1)、path-browserify(^1.0.1)、https-browserify(1.0.0)、mixpanel-browser(^2.45.0)、react-router-dom(5.3.3)、crypto-browserify(3.12.1)、source-map-loader(4.0.1)、stream-browserify(^3.0.0)、@bigbinary/neetoui(8.8.3)、@dnd-kit/modifiers(^9.0.0)、@honeybadger-io/js(6.10.1)、@bigbinary/neeto-cist(1.0.17)、@honeybadger-io/react(6.1.25)、@tanstack/react-query(5.59.20)、@bigbinary/neeto-atoms(1.1.2)、@bigbinary/neeto-icons(1.20.89)、@bigbinary/neeto-hotkeys(1.0.9)、@bigbinary/neeto-molecules(5.9.15)、@tailwindcss/container-queries(^0.1.1)、@tanstack/react-query-devtools(5.59.20)、@bigbinary/neeto-commons-frontend(4.14.8)、@bigbinary/neeto-filters-frontend(4.6.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bigbinary/neeto-folders-frontend 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bigbinary/neeto-folders-frontend 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@bigbinary/neeto-folders-frontend 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@bigbinary/neeto-folders-frontend 可以商用吗?

@bigbinary/neeto-folders-frontend 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@bigbinary/neeto-folders-frontend 的下载量有多少?

根据 npm 官方下载统计,@bigbinary/neeto-folders-frontend 在 2026/10/08 – 2026/11/06 这 30 天内被下载 7,891 次,日均约 263 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bigbinary/neeto-folders-frontend 还在维护吗?

最新版本 2.1.0 发布于 2026/11/03(5 天前);至今共发布 80 个版本,其中过去 12 个月发布了 43 个;首次发布于 2025/04/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。