@nocobase/plugin-ai 2.2.0-beta.6 → 2.2.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/ai/docs/nocobase/ai-employees/workflow/nodes/knowledge/index.md +8 -0
  2. package/dist/ai/docs/nocobase/api/cli/config/delete.md +1 -0
  3. package/dist/ai/docs/nocobase/api/cli/config/index.md +4 -1
  4. package/dist/ai/docs/nocobase/api/cli/config/set.md +1 -0
  5. package/dist/ai/docs/nocobase/api/cli/env/auth.md +53 -5
  6. package/dist/ai/docs/nocobase/api/cli/self/check.md +19 -2
  7. package/dist/ai/docs/nocobase/api/cli/self/index.md +1 -1
  8. package/dist/ai/docs/nocobase/api/cli/self/update.md +17 -3
  9. package/dist/ai/docs/nocobase/development/index.md +6 -2
  10. package/dist/ai/docs/nocobase/nocobase-cli/installation/cli.md +2 -0
  11. package/dist/ai/docs/nocobase/plugin-development/client/index.md +1 -0
  12. package/dist/ai/docs/nocobase/shared-components/create-form-registry.md +38 -0
  13. package/dist/ai/docs/nocobase/shared-components/filter/collection-filter-panel.md +44 -0
  14. package/dist/ai/docs/nocobase/shared-components/filter/index.md +44 -0
  15. package/dist/ai/docs/nocobase/shared-components/form/code-scanner.md +34 -0
  16. package/dist/ai/docs/nocobase/shared-components/form/dialog-form-layout.md +45 -0
  17. package/dist/ai/docs/nocobase/shared-components/form/drawer-form-layout.md +45 -0
  18. package/dist/ai/docs/nocobase/shared-components/form/env-variable-input.md +30 -0
  19. package/dist/ai/docs/nocobase/shared-components/form/file-size-input.md +24 -0
  20. package/dist/ai/docs/nocobase/shared-components/form/json-text-area.md +28 -0
  21. package/dist/ai/docs/nocobase/shared-components/form/password-input.md +23 -0
  22. package/dist/ai/docs/nocobase/shared-components/form/remote-select.md +34 -0
  23. package/dist/ai/docs/nocobase/shared-components/form/scan-input.md +27 -0
  24. package/dist/ai/docs/nocobase/shared-components/form/typed-variable-input.md +30 -0
  25. package/dist/ai/docs/nocobase/shared-components/form/variable-input.md +35 -0
  26. package/dist/ai/docs/nocobase/shared-components/form/variable-json-text-area.md +33 -0
  27. package/dist/ai/docs/nocobase/shared-components/form/variable-text-area.md +33 -0
  28. package/dist/ai/docs/nocobase/shared-components/icon.md +21 -0
  29. package/dist/ai/docs/nocobase/shared-components/index.md +70 -0
  30. package/dist/ai/docs/nocobase/shared-components/table/index.md +39 -0
  31. package/dist/ai/docs/nocobase/shared-components/table/sort-handle.md +37 -0
  32. package/dist/ai/docs/nocobase/shared-components/table/sortable-row.md +36 -0
  33. package/dist/client/{428.5eb4f53ddbb6a3b8.js → 428.e9f38da3b0d8b498.js} +1 -1
  34. package/dist/client/580.35ba54ff91b7fe6d.js +10 -0
  35. package/dist/client/{604.de96f3ec4d471afd.js → 604.89c674f35b52b4ef.js} +1 -1
  36. package/dist/client/ai-employees/admin/mcp/schemas.d.ts +46 -18
  37. package/dist/client/index.js +3 -3
  38. package/dist/client-v2/ai-employees/flow/models/AIEmployeeButtonModel.d.ts +32 -0
  39. package/dist/client-v2/index.d.ts +1 -0
  40. package/dist/client-v2/index.js +1 -1
  41. package/dist/collections/ai-mcp-clients.js +5 -0
  42. package/dist/externalVersion.js +16 -16
  43. package/dist/locale/en-US.json +8 -3
  44. package/dist/locale/zh-CN.json +8 -3
  45. package/dist/node_modules/@langchain/xai/package.json +1 -1
  46. package/dist/node_modules/fs-extra/package.json +1 -1
  47. package/dist/node_modules/jsonrepair/package.json +1 -1
  48. package/dist/node_modules/just-bash/package.json +1 -1
  49. package/dist/node_modules/nodejs-snowflake/package.json +1 -1
  50. package/dist/node_modules/openai/package.json +1 -1
  51. package/dist/node_modules/zod/package.json +1 -1
  52. package/dist/server/ai-employees/ai-employee.js +21 -5
  53. package/dist/server/ai-employees/middleware/index.d.ts +1 -0
  54. package/dist/server/ai-employees/middleware/index.js +2 -0
  55. package/dist/server/ai-employees/middleware/tool-call-sanitizer.d.ts +16 -0
  56. package/dist/server/ai-employees/middleware/tool-call-sanitizer.js +90 -0
  57. package/dist/server/ai-employees/tool-call-sanitizer.d.ts +26 -0
  58. package/dist/server/ai-employees/tool-call-sanitizer.js +84 -0
  59. package/dist/server/ai-employees/utils.js +14 -2
  60. package/dist/server/plugin.d.ts +2 -0
  61. package/dist/server/plugin.js +30 -0
  62. package/dist/server/resource/aiConversations.js +1 -1
  63. package/dist/server/resource/aiMcpClients.js +2 -2
  64. package/dist/server/resource/aiTools.js +14 -9
  65. package/package.json +2 -2
  66. package/dist/client/580.e75f97fb883ad042.js +0 -10
@@ -64,6 +64,14 @@ The core of this example is three synchronization workflows. They process the sa
64
64
 
65
65
  `Key` is the most important field in the synchronization chain. Create, update, and delete workflows must use the same `Key` rule. The example directly uses the record ID of the `Answers` collection.
66
66
 
67
+ :::tip Text content ingestion and vectorization
68
+
69
+ When configuring a Create document or Update document node, if `Document type` is set to `Text`, the workflow first saves the text field selected in `Content` as a `.txt` document, then writes it to the target knowledge base. The knowledge base then generates segments according to the current segmentation settings, vectorizes enabled segments together with their related questions, and stores them in the vector database bound to the knowledge base.
70
+
71
+ This process runs as an asynchronous workflow node. A completed node does not mean the document can be retrieved immediately. Usually, wait until `Status` in the `Documents` list changes to `Success` before checking segments or running hit tests.
72
+
73
+ :::
74
+
67
75
  ## Operation guides
68
76
 
69
77
  - [Create document](./create-document)
@@ -33,6 +33,7 @@ nb config delete proxy.nginx-driver
33
33
  nb config delete proxy.caddy-driver
34
34
  nb config delete bin.nginx
35
35
  nb config delete bin.git
36
+ nb config delete bin.pnpm
36
37
  ```
37
38
 
38
39
  ## Related commands
@@ -10,7 +10,7 @@ Manage default CLI configuration values. The currently supported keys are mainly
10
10
 
11
11
  - CLI itself: `locale`, `update.policy`, `license.pkg-url`
12
12
  - Docker runtime: `docker.network`, `docker.container-prefix`
13
- - External executables: `bin.docker`, `bin.caddy`, `bin.git`, `bin.nginx`, `bin.yarn`
13
+ - External executables: `bin.docker`, `bin.caddy`, `bin.git`, `bin.nginx`, `bin.pnpm`, `bin.yarn`
14
14
  - Proxy generation: `proxy.nb-cli-root`, `proxy.upstream-host`, `proxy.nginx-driver`, `proxy.caddy-driver`
15
15
 
16
16
  Most projects only need a few of these keys. In practice, the most common ones are:
@@ -34,6 +34,7 @@ Most projects only need a few of these keys. In practice, the most common ones a
34
34
  | `bin.caddy` | `caddy` | Override the Caddy executable path |
35
35
  | `bin.git` | `git` | Override the Git executable path |
36
36
  | `bin.nginx` | `nginx` | Override the Nginx executable path |
37
+ | `bin.pnpm` | `pnpm` | Override the pnpm executable path |
37
38
  | `bin.yarn` | `yarn` | Override the Yarn executable path |
38
39
  | `proxy.nb-cli-root` | CLI root, usually the current user's home directory | Override the root path visible to the generated proxy config when the proxy process and CLI do not see the same filesystem root |
39
40
  | `proxy.upstream-host` | `127.0.0.1` | Override the host used when the proxy forwards traffic back to the NocoBase app |
@@ -70,12 +71,14 @@ nb config get docker.network
70
71
  nb config set docker.network nocobase
71
72
  nb config set bin.nginx /usr/sbin/nginx
72
73
  nb config set bin.git /usr/bin/git
74
+ nb config set bin.pnpm /usr/local/bin/pnpm
73
75
  nb config delete docker.container-prefix
74
76
  ```
75
77
 
76
78
  ## Notes
77
79
 
78
80
  - `bin.nginx` and `bin.caddy` only affect the `local` driver for `nb proxy nginx` and `nb proxy caddy`
81
+ - `bin.pnpm` is used when commands need to run pnpm directly, such as updating a pnpm-managed global CLI install with `nb self update`
79
82
  - `proxy.nginx-driver` and `proxy.caddy-driver` store the default driver used by each provider
80
83
  - `proxy.nb-cli-root` and `proxy.upstream-host` are advanced proxy overrides. Most CLI-managed `local` or `docker` envs can use the defaults directly
81
84
  - If you only want to switch the active proxy driver, using `nb proxy nginx use` or `nb proxy caddy use` is usually clearer than setting the config key manually
@@ -33,6 +33,7 @@ nb config set bin.docker /usr/local/bin/docker
33
33
  nb config set bin.caddy /opt/homebrew/bin/caddy
34
34
  nb config set bin.git /usr/bin/git
35
35
  nb config set bin.nginx /usr/sbin/nginx
36
+ nb config set bin.pnpm /usr/local/bin/pnpm
36
37
  nb config set proxy.nb-cli-root /workspace
37
38
  nb config set proxy.upstream-host host.docker.internal
38
39
  nb config set proxy.nginx-driver docker
@@ -1,17 +1,19 @@
1
1
  ---
2
2
  title: "nb env auth"
3
- description: "nb env auth command reference: run OAuth login for a saved NocoBase env."
4
- keywords: "nb env auth,NocoBase CLI,OAuth,login,authentication"
3
+ description: "nb env auth command reference: authenticate a saved NocoBase env with basic, token, or OAuth authentication."
4
+ keywords: "nb env auth,NocoBase CLI,basic,token,OAuth,login,authentication"
5
5
  ---
6
6
 
7
7
  # nb env auth
8
8
 
9
- Run OAuth login for a selected env. When the env name is omitted, the current env is used.
9
+ Authenticate a saved NocoBase env again, or update the authentication information saved for it. When the env name is omitted, the current env is used.
10
+
11
+ `nb env auth` supports three authentication methods: `basic`, `token`, and `oauth`. If `--auth-type` is omitted, the CLI first infers the method from the authentication options you pass. If it still cannot infer the method, it uses the authentication method already saved in the env.
10
12
 
11
13
  ## Usage
12
14
 
13
15
  ```bash
14
- nb env auth [name]
16
+ nb env auth [name] [flags]
15
17
  ```
16
18
 
17
19
  ## Parameters
@@ -19,19 +21,65 @@ nb env auth [name]
19
21
  | Parameter | Type | Description |
20
22
  | --- | --- | --- |
21
23
  | `[name]` | string | Configured environment name to sign in to; uses the current env if omitted |
24
+ | `--auth-type`, `-a` | string | Authentication method: `basic`, `token`, or `oauth` |
25
+ | `--access-token`, `-t` | string | API key or access token used with `token` authentication |
26
+ | `--username` | string | Username used with `basic` authentication; prompted in TTY when omitted |
27
+ | `--password` | string | Password used with `basic` authentication; prompted in TTY when omitted |
28
+
29
+ ## Compatibility options
30
+
31
+ | Option | Type | Description |
32
+ | --- | --- | --- |
33
+ | `--env`, `-e` | string | Environment name, equivalent to `[name]`. This hidden option is kept for compatibility with other commands; normally the positional argument is enough |
22
34
 
23
35
  ## Notes
24
36
 
25
- Internally, this command uses the PKCE flow: start a local callback server, open the browser for authorization, exchange the token, and save it to the config file.
37
+ The authentication methods work as follows:
38
+
39
+ - `basic`: sign in to NocoBase with a username and password, then save the returned access token and username
40
+ - `token`: save the API key or access token passed through `--access-token`
41
+ - `oauth`: start the browser authentication flow, then save the access token after authentication finishes
42
+
43
+ In an interactive terminal, the CLI prompts for `--auth-type`, `--username`, `--password`, or `--access-token` when needed. In non-interactive mode, `basic` authentication requires both `--username` and `--password`.
44
+
45
+ `oauth` authentication first tries Device Authorization Grant. When the OAuth server supports this flow, the command prints a verification URL and user code, then polls until the browser approval is complete. This works on remote or headless servers because it does not require a local callback listener.
46
+
47
+ If the OAuth server does not expose a device authorization endpoint, the command falls back to the PKCE loopback flow: start a local callback server, open the browser for authorization, exchange the token, and save it to the config file.
48
+
49
+ After authentication succeeds, the CLI automatically runs `nb env update <name>` to re-sync the env state.
50
+
51
+ ## Limits
52
+
53
+ - `[name]` and `--env` cannot provide different environment names at the same time
54
+ - `--access-token` cannot be used with `--username` or `--password`
55
+ - `--auth-type oauth` cannot be used with `--access-token`, `--username`, or `--password`
56
+ - `--auth-type token` cannot be used with `--username` or `--password`
57
+ - `--auth-type basic` cannot be used with `--access-token`
58
+ - `--access-token`, `--username`, and `--password` cannot be empty after they are provided
26
59
 
27
60
  ## Examples
28
61
 
29
62
  ```bash
63
+ # Authenticate the current env with the saved authentication method
30
64
  nb env auth
65
+
66
+ # Authenticate a specific env
31
67
  nb env auth prod
68
+
69
+ # Use OAuth browser login
70
+ nb env auth prod --auth-type oauth
71
+
72
+ # Sign in with username and password
73
+ nb env auth prod --auth-type basic --username admin --password secret
74
+
75
+ # Save an API key or access token
76
+ nb env auth prod --auth-type token --access-token <api-key>
32
77
  ```
33
78
 
79
+ For device authorization, follow the URL printed by the command and enter the displayed code in the browser.
80
+
34
81
  ## Related Commands
35
82
 
36
83
  - [`nb env add`](./add.md)
84
+ - [`nb env info`](./info.md)
37
85
  - [`nb env update`](./update.md)
@@ -6,7 +6,7 @@ keywords: "nb self check,NocoBase CLI,version check"
6
6
 
7
7
  # nb self check
8
8
 
9
- Check the current NocoBase CLI installation, resolve the latest version for the selected channel, and report whether automatic self-update is supported.
9
+ Check the current NocoBase CLI installation, resolve the latest version for the selected channel, and report whether self-update is supported.
10
10
 
11
11
  ## Usage
12
12
 
@@ -18,9 +18,26 @@ nb self check [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `--channel` | string | Release channel to compare with, default `auto`; options: `auto`, `latest`, `beta`, `alpha` |
21
+ | `--channel` | string | Release channel to compare with, default `auto`; options: `auto`, `latest`, `test`, `beta`, `alpha` |
22
22
  | `--json` | boolean | Output JSON |
23
23
 
24
+ ## Install Method
25
+
26
+ `nb self check` detects the current install method at runtime. It does not use the historical `self-install-methods.json` cache.
27
+
28
+ The command can report these install methods:
29
+
30
+ | Install method | Meaning |
31
+ | --- | --- |
32
+ | `npm-global` | The CLI is installed under the current `npm prefix -g`. |
33
+ | `pnpm-global` | The CLI is installed under a pnpm global `node_modules` tree. |
34
+ | `yarn-global` | The CLI is launched from `yarn global bin` or installed under `yarn global dir`. |
35
+ | `package-local` | The CLI is installed in a local project dependency tree. |
36
+ | `source` | The CLI is running from a repository checkout. |
37
+ | `unknown` | The CLI install could not be matched to a supported install method. |
38
+
39
+ Self-update is supported for `npm-global`, `pnpm-global`, and `yarn-global`. For `package-local` or `source`, update the parent project or repository checkout instead.
40
+
24
41
  ## Examples
25
42
 
26
43
  ```bash
@@ -19,7 +19,7 @@ nb self <command>
19
19
  | Command | Description |
20
20
  | --- | --- |
21
21
  | [`nb self check`](./check.md) | Check current CLI version and self-update support |
22
- | [`nb self update`](./update.md) | Update the globally npm-installed NocoBase CLI |
22
+ | [`nb self update`](./update.md) | Update the globally npm-, pnpm-, or yarn-installed NocoBase CLI |
23
23
 
24
24
  ## Examples
25
25
 
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  title: "nb self update"
3
- description: "nb self update command reference: update the globally npm-installed NocoBase CLI."
3
+ description: "nb self update command reference: update the globally npm-, pnpm-, or yarn-installed NocoBase CLI."
4
4
  keywords: "nb self update,NocoBase CLI,update,self update"
5
5
  ---
6
6
 
7
7
  # nb self update
8
8
 
9
- Update the installed NocoBase CLI when the current CLI is managed by a standard global npm installation.
9
+ Update the installed NocoBase CLI when the current CLI is managed by a standard global npm, pnpm, or yarn installation.
10
10
 
11
11
  ## Usage
12
12
 
@@ -18,12 +18,26 @@ nb self update [flags]
18
18
 
19
19
  | Parameter | Type | Description |
20
20
  | --- | --- | --- |
21
- | `--channel` | string | Release channel to update to, default `auto`; options: `auto`, `latest`, `beta`, `alpha` |
21
+ | `--channel` | string | Release channel to update to, default `auto`; options: `auto`, `latest`, `test`, `beta`, `alpha` |
22
22
  | `--yes`, `-y` | boolean | Skip update confirmation |
23
23
  | `--json` | boolean | Output JSON |
24
24
  | `--skills` | boolean | Also refresh the globally installed NocoBase AI coding skills |
25
25
  | `--verbose` | boolean | Show detailed update output |
26
26
 
27
+ ## Update Behavior
28
+
29
+ `nb self update` first detects the current install method at runtime. It does not use the historical `self-install-methods.json` cache.
30
+
31
+ When an update is available, the command uses the same package manager that manages the current global CLI install:
32
+
33
+ | Install method | Update command |
34
+ | --- | --- |
35
+ | `npm-global` | `npm install -g @nocobase/cli@<channel>` |
36
+ | `pnpm-global` | `pnpm add -g @nocobase/cli@<channel>` |
37
+ | `yarn-global` | `yarn global add @nocobase/cli@<channel>` |
38
+
39
+ Interactive confirmation defaults to yes. Use `--yes` to skip the prompt in scripts.
40
+
27
41
  ## Examples
28
42
 
29
43
  ```bash
@@ -2,8 +2,8 @@
2
2
  pageType: home
3
3
  pageName: development
4
4
  title: "NocoBase Development Guide"
5
- description: "NocoBase development guide: plugin development, FlowEngine, RunJS, block/field/action extensions, data source extensions, workflow extensions, authentication extensions."
6
- keywords: "NocoBase,development guide,plugin development,FlowEngine,RunJS,NocoBase extensions"
5
+ description: "NocoBase development guide: plugin development, shared components, FlowEngine, RunJS, block/field/action extensions, data source extensions, workflow extensions, authentication extensions."
6
+ keywords: "NocoBase,development guide,plugin development,shared components,FlowEngine,RunJS,NocoBase extensions"
7
7
  features:
8
8
  - title: Core Development
9
9
  details: Master NocoBase's underlying extension mechanism and advanced development capabilities, including the plugin system, AI assistance, FlowEngine and RunJS environment, to build a solid development foundation.
@@ -24,6 +24,10 @@ features:
24
24
  details: JavaScript execution environment for JS blocks, JS fields, and JS actions, and similar scenarios.
25
25
  link: /runjs
26
26
  showOnHome: true
27
+ - title: Shared Components
28
+ details: Reuse the built-in form, filter, table, and icon components in NocoBase client v2 when building plugin pages.
29
+ link: /shared-components
30
+ showOnHome: true
27
31
  - title: Plugin Ecosystem
28
32
  details: Extend the capabilities of existing plugins through other plugins, building a hierarchical and modular plugin ecosystem to enhance system extensibility and collaboration.
29
33
  items:
@@ -35,6 +35,8 @@ nb config set update.policy auto
35
35
  nb config set update.policy off
36
36
  ```
37
37
 
38
+ Self-update is only supported when the CLI is managed by a standard global npm, pnpm, or yarn install. If you are running from source or from a local project dependency tree, use [`nb self check`](../../api/cli/self/check.md) to see the detected install method and update that parent project instead.
39
+
38
40
  If you are going to deploy NocoBase to the server and want to open the `nb init --ui` wizard from a remote browser, it is recommended to first change the CLI's default host to the current server IP:
39
41
 
40
42
  ```bash
@@ -29,6 +29,7 @@ Specifically:
29
29
  1. **[Plugin](./plugin)**: The plugin entry class. Register routes, models, and other resources in lifecycle methods like `load()`.
30
30
  2. **[Router](./router)**: Register page routes via `router.add()` and plugin settings pages via `pluginSettingsManager`.
31
31
  3. **[Component](./component/index.md)**: Routes mount React components. Just use React + Antd by default -- no different from regular frontend development.
32
+ | Find reusable form, filter, and table components | [Shared Components](/shared-components/) |
32
33
  4. **[Context](./ctx/index.md)**: In plugins, access context via `this.context`; in components, use `useFlowContext()` to get the context. This gives you access to NocoBase capabilities -- making requests (`ctx.api`), internationalization (`ctx.t`), logging (`ctx.logger`), etc.
33
34
  5. **[FlowEngine](./flow-engine/index.md)**: If your components need to appear in the "Add Block / Field / Action" menus and support visual configuration by users, you need to wrap them with FlowModel.
34
35
 
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: "createFormRegistry"
3
+ description: "createFormRegistry: Create an internal registry for plugin extension items."
4
+ keywords: "createFormRegistry,NocoBase,client-v2"
5
+ ---
6
+
7
+ # createFormRegistry
8
+
9
+ `createFormRegistry` is used to create an internal registry for plugin extension items.
10
+
11
+ ## Basic Usage
12
+
13
+ ```ts
14
+ import { createFormRegistry, type FormRegistryEntry } from '@nocobase/client-v2';
15
+
16
+ interface StorageType extends FormRegistryEntry {
17
+ title: string;
18
+ Component: React.ComponentType;
19
+ }
20
+
21
+ const storageTypes = createFormRegistry<StorageType>('file-manager/storage-types');
22
+
23
+ storageTypes.register({ name: 'local', title: 'Local', Component: LocalStorageForm });
24
+ storageTypes.register({ name: 's3', title: 'Amazon S3', Component: S3StorageForm });
25
+
26
+ const s3 = storageTypes.get('s3');
27
+ const all = storageTypes.list();
28
+ ```
29
+
30
+ ## API
31
+
32
+ | Prop | Type | Description |
33
+ | --- | --- | --- |
34
+ | `register(entry)` | `-` | Register an entry |
35
+ | `unregister(name)` | `-` | Remove an entry |
36
+ | `get(name)` | `-` | Get an entry by name |
37
+ | `has(name)` | `-` | Check whether an entry exists |
38
+ | `list()` | `-` | Return all entries |
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: "CollectionFilterPanel"
3
+ description: "CollectionFilterPanel: Embed a Collection filter panel in a page."
4
+ keywords: "CollectionFilterPanel,NocoBase,client-v2"
5
+ ---
6
+
7
+ # CollectionFilterPanel
8
+
9
+ `CollectionFilterPanel` is used to embed a Collection filter panel in a page.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { CollectionFilterPanel, type CollectionFilterPanelRef } from '@nocobase/client-v2';
15
+
16
+ const ref = useRef<CollectionFilterPanelRef>(null);
17
+
18
+ <CollectionFilterPanel ref={ref} collection={collection} t={t} />;
19
+
20
+ const filter = ref.current?.getFilter();
21
+ ```
22
+
23
+ ## API
24
+
25
+ | Prop | Type | Description |
26
+ | --- | --- | --- |
27
+ | `collection` | `Collection | undefined` | Collection used as the field source |
28
+ | `initialValue` | `Record<string, unknown>` | Initial filter value |
29
+ | `onChange` | `(filter) => void` | Change callback |
30
+ | `t` | `(key, options?) => string` | Translation function |
31
+ | `filterableFieldNames` | `string[]` | Field allowlist |
32
+ | `nonfilterableFieldNames` | `string[]` | Field blocklist |
33
+ | `noIgnore` | `boolean` | Skip allowlist restrictions |
34
+
35
+ ## Methods
36
+
37
+ | Method | Description |
38
+ | --- | --- |
39
+ | `getFilter()` | Get the compiled filter |
40
+ | `reset()` | Clear all conditions |
41
+
42
+ ## Related Links
43
+
44
+ - [CollectionFilter](./)
@@ -0,0 +1,44 @@
1
+ ---
2
+ title: "CollectionFilter"
3
+ description: "CollectionFilter: Filter a Collection with multiple conditions."
4
+ keywords: "CollectionFilter,NocoBase,client-v2"
5
+ ---
6
+
7
+ # CollectionFilter
8
+
9
+ `CollectionFilter` is used to filter a Collection with multiple conditions.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { CollectionFilter } from '@nocobase/client-v2';
15
+
16
+ <CollectionFilter
17
+ collection={collection}
18
+ t={t}
19
+ onChange={(filter) => {
20
+ listRequest.run({ filter });
21
+ }}
22
+ />;
23
+ ```
24
+
25
+ ## API
26
+
27
+ | Prop | Type | Description |
28
+ | --- | --- | --- |
29
+ | `collection` | `Collection | undefined` | Collection used as the field source |
30
+ | `initialValue` | `Record<string, unknown>` | Initial filter value |
31
+ | `onChange` | `(filter) => void` | Change callback |
32
+ | `t` | `(key, options?) => string` | Translation function |
33
+ | `filterableFieldNames` | `string[]` | Field allowlist |
34
+ | `nonfilterableFieldNames` | `string[]` | Field blocklist |
35
+ | `noIgnore` | `boolean` | Skip allowlist restrictions |
36
+ | `buttonText` | `React.ReactNode` | Custom button text |
37
+ | `showCount` | `boolean` | Whether to show the number of conditions |
38
+ | `popoverProps` | `PopoverProps` | Props passed to Antd Popover |
39
+ | `buttonProps` | `ButtonProps` | Props passed to Antd Button |
40
+ | `popoverMinWidth` | `number` | Minimum width of the Popover content |
41
+
42
+ ## Related Links
43
+
44
+ - [CollectionFilterPanel](./collection-filter-panel)
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: "CodeScanner"
3
+ description: "CodeScanner: Control the low-level full-screen scanner."
4
+ keywords: "CodeScanner,NocoBase,client-v2"
5
+ ---
6
+
7
+ # CodeScanner
8
+
9
+ `CodeScanner` is used to control the low-level full-screen scanner.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { CodeScanner } from '@nocobase/client-v2';
15
+
16
+ <CodeScanner
17
+ visible={visible}
18
+ onClose={() => setVisible(false)}
19
+ onScanSuccess={(text) => setValue(text)}
20
+ />;
21
+ ```
22
+
23
+ ## API
24
+
25
+ | Prop | Type | Description |
26
+ | --- | --- | --- |
27
+ | `visible` | `boolean` | Whether the scanner is visible |
28
+ | `formatsToSupport` | `Html5QrcodeSupportedFormats[]` | Supported QR code or barcode formats |
29
+ | `onClose` | `() => void` | Called when the scanner closes |
30
+ | `onScanSuccess` | `(result: string) => void` | Called after a successful scan |
31
+
32
+ ## Related Links
33
+
34
+ - [ScanInput](./scan-input)
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: "DialogFormLayout"
3
+ description: "DialogFormLayout: Put a standard form in a dialog."
4
+ keywords: "DialogFormLayout,NocoBase,client-v2"
5
+ ---
6
+
7
+ # DialogFormLayout
8
+
9
+ `DialogFormLayout` is used to put a standard form in a dialog.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { DialogFormLayout } from '@nocobase/client-v2';
15
+
16
+ ctx.viewer.dialog({
17
+ closable: true,
18
+ content: () => (
19
+ <DialogFormLayout title={t('Bind verifier')} onSubmit={handleSubmit}>
20
+ <Form form={form} layout="vertical">
21
+ <Form.Item name="code" label={t('Code')}>
22
+ <Input />
23
+ </Form.Item>
24
+ </Form>
25
+ </DialogFormLayout>
26
+ ),
27
+ });
28
+ ```
29
+
30
+ ## API
31
+
32
+ | Prop | Type | Description |
33
+ | --- | --- | --- |
34
+ | `title` | `React.ReactNode` | Title content |
35
+ | `children` | `React.ReactNode` | Content rendered inside the component |
36
+ | `onCancel` | `() => void | Promise<void>` | Called before Cancel closes the view |
37
+ | `onSubmit` | `() => void | Promise<void>` | Called when Submit is clicked |
38
+ | `submitting` | `boolean` | Loading state of the submit button |
39
+ | `submitText` | `React.ReactNode` | Submit button text |
40
+ | `cancelText` | `React.ReactNode` | Cancel button text |
41
+ | `footer` | `React.ReactNode` | Replace the default footer |
42
+
43
+ ## Related Links
44
+
45
+ - [DrawerFormLayout](./drawer-form-layout)
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: "DrawerFormLayout"
3
+ description: "DrawerFormLayout: Put a standard form in a drawer."
4
+ keywords: "DrawerFormLayout,NocoBase,client-v2"
5
+ ---
6
+
7
+ # DrawerFormLayout
8
+
9
+ `DrawerFormLayout` is used to put a standard form in a drawer.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx
14
+ import { DrawerFormLayout } from '@nocobase/client-v2';
15
+
16
+ ctx.viewer.drawer({
17
+ width: '50%',
18
+ closable: true,
19
+ content: () => (
20
+ <DrawerFormLayout title={t('Add provider')} onSubmit={handleSubmit}>
21
+ <Form form={form} layout="vertical">
22
+ <Form.Item name="name" label={t('Name')} rules={[{ required: true }]}>
23
+ <Input />
24
+ </Form.Item>
25
+ </Form>
26
+ </DrawerFormLayout>
27
+ ),
28
+ });
29
+ ```
30
+
31
+ ## API
32
+
33
+ | Prop | Type | Description |
34
+ | --- | --- | --- |
35
+ | `title` | `React.ReactNode` | Title content |
36
+ | `children` | `React.ReactNode` | Content rendered inside the component |
37
+ | `onSubmit` | `() => void | Promise<void>` | Called when Submit is clicked |
38
+ | `submitting` | `boolean` | Loading state of the submit button |
39
+ | `submitText` | `React.ReactNode` | Submit button text |
40
+ | `cancelText` | `React.ReactNode` | Cancel button text |
41
+ | `footer` | `React.ReactNode` | Replace the default footer |
42
+
43
+ ## Related Links
44
+
45
+ - [DialogFormLayout](./dialog-form-layout)
@@ -0,0 +1,30 @@
1
+ ---
2
+ title: "EnvVariableInput"
3
+ description: "EnvVariableInput: Allow only `$env` is used to environment variables."
4
+ keywords: "EnvVariableInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # EnvVariableInput
8
+
9
+ `EnvVariableInput` is used to allow only `$env` environment variables.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/env-variable-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `string` | Current value |
21
+ | `onChange` | `(value: string) => void` | Change callback |
22
+ | `addonBefore` | `React.ReactNode` | Content before the input |
23
+ | `disabled` | `boolean` | Whether disabled |
24
+ | `password` | `boolean` | Mask plain non-variable values |
25
+ | `placeholder` | `string` | Placeholder text |
26
+
27
+ ## Related Links
28
+
29
+ - [VariableInput](./variable-input)
30
+ - [TypedVariableInput](./typed-variable-input)
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: "FileSizeInput"
3
+ description: "FileSizeInput: Enter a file size and store it as bytes."
4
+ keywords: "FileSizeInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # FileSizeInput
8
+
9
+ `FileSizeInput` is used to enter a file size and store it as bytes.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/file-size-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `number` | Current value |
21
+ | `onChange` | `(value: number | null) => void` | Change callback |
22
+ | `disabled` | `boolean` | Whether disabled |
23
+ | `min` | `number` | Minimum value |
24
+ | `max` | `number` | Maximum value |
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: "JsonTextArea"
3
+ description: "JsonTextArea: Edit JSON / JSON5 configuration."
4
+ keywords: "JsonTextArea,NocoBase,client-v2"
5
+ ---
6
+
7
+ # JsonTextArea
8
+
9
+ `JsonTextArea` is used to edit JSON / JSON5 configuration.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/json-text-area.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `unknown` | Current value |
21
+ | `onChange` | `(value: unknown) => void` | Change callback |
22
+ | `space` | `number` | Stringify indentation |
23
+ | `json5` | `boolean` | Whether to parse with JSON5 |
24
+ | `showError` | `boolean` | Whether to show parse errors |
25
+
26
+ ## Related Links
27
+
28
+ - [VariableJsonTextArea](./variable-json-text-area)
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: "PasswordInput"
3
+ description: "PasswordInput: Enter a password with a strength indicator."
4
+ keywords: "PasswordInput,NocoBase,client-v2"
5
+ ---
6
+
7
+ # PasswordInput
8
+
9
+ `PasswordInput` is used to enter a password with a strength indicator.
10
+
11
+ ## Basic Usage
12
+
13
+ ```tsx file="../_demos/password-input.tsx" preview
14
+ ```
15
+
16
+ ## API
17
+
18
+ | Prop | Type | Description |
19
+ | --- | --- | --- |
20
+ | `value` | `string` | Current value |
21
+ | `onChange` | `(event) => void` | Change callback |
22
+ | `disabled` | `boolean` | Whether disabled |
23
+ | `placeholder` | `string` | Placeholder text |