@nocobase/plugin-flow-engine 2.1.0-beta.2 → 2.1.0-beta.21
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.
- package/LICENSE +201 -661
- package/README.md +79 -9
- package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/index.js +41 -0
- package/dist/ai/ai-employees/nathan/prompt.md +132 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +69 -0
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +2 -2
- package/dist/ai/docs/runjs/context/block-model.md +35 -35
- package/dist/ai/docs/runjs/context/collection-field.md +53 -51
- package/dist/ai/docs/runjs/context/collection.md +39 -39
- package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
- package/dist/ai/docs/runjs/context/data-source.md +52 -44
- package/dist/ai/docs/runjs/context/element.md +44 -38
- package/dist/ai/docs/runjs/context/exit-all.md +37 -35
- package/dist/ai/docs/runjs/context/exit.md +38 -35
- package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
- package/dist/ai/docs/runjs/context/form.md +57 -57
- package/dist/ai/docs/runjs/context/get-model.md +22 -21
- package/dist/ai/docs/runjs/context/get-value.md +20 -19
- package/dist/ai/docs/runjs/context/get-var.md +61 -55
- package/dist/ai/docs/runjs/context/i18n.md +17 -14
- package/dist/ai/docs/runjs/context/import-async.md +333 -45
- package/dist/ai/docs/runjs/context/init-resource.md +20 -20
- package/dist/ai/docs/runjs/context/libs.md +31 -31
- package/dist/ai/docs/runjs/context/location.md +34 -31
- package/dist/ai/docs/runjs/context/logger.md +41 -40
- package/dist/ai/docs/runjs/context/make-resource.md +27 -26
- package/dist/ai/docs/runjs/context/message.md +42 -41
- package/dist/ai/docs/runjs/context/modal.md +44 -44
- package/dist/ai/docs/runjs/context/model.md +36 -33
- package/dist/ai/docs/runjs/context/notification.md +41 -40
- package/dist/ai/docs/runjs/context/off.md +14 -14
- package/dist/ai/docs/runjs/context/on.md +30 -29
- package/dist/ai/docs/runjs/context/open-view.md +40 -40
- package/dist/ai/docs/runjs/context/render.md +37 -32
- package/dist/ai/docs/runjs/context/request.md +46 -45
- package/dist/ai/docs/runjs/context/require-async.md +28 -25
- package/dist/ai/docs/runjs/context/resource.md +34 -34
- package/dist/ai/docs/runjs/context/route.md +36 -34
- package/dist/ai/docs/runjs/context/router.md +43 -31
- package/dist/ai/docs/runjs/context/set-value.md +18 -17
- package/dist/ai/docs/runjs/context/sql.md +7 -15
- package/dist/ai/docs/runjs/context/t.md +20 -17
- package/dist/ai/docs/runjs/context/view.md +49 -46
- package/dist/ai/docs/runjs/document.md +1 -0
- package/dist/ai/docs/runjs/import-modules.md +32 -32
- package/dist/ai/docs/runjs/index.md +13 -13
- package/dist/ai/docs/runjs/jsx.md +19 -19
- package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
- package/dist/ai/docs/runjs/render.md +15 -15
- package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
- package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
- package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
- package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
- package/dist/ai/docs/runjs/window.md +5 -5
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -11
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/ses/dist/ses.cjs +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/collections/flowsql.js +1 -0
- package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
- package/dist/server/flow-surfaces/action-scope.js +156 -0
- package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
- package/dist/server/flow-surfaces/apply/compiler.js +971 -0
- package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
- package/dist/server/flow-surfaces/apply/layout.js +175 -0
- package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
- package/dist/server/flow-surfaces/apply/matching.js +181 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
- package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
- package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
- package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
- package/dist/server/flow-surfaces/approval/builder.js +384 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
- package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
- package/dist/server/flow-surfaces/approval/index.js +40 -0
- package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
- package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
- package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
- package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
- package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
- package/dist/server/flow-surfaces/association-interfaces.js +39 -0
- package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +192 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1074 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +13 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
- package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
- package/dist/server/flow-surfaces/blueprint/index.js +44 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +416 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.js +182 -0
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +237 -0
- package/dist/server/flow-surfaces/builder.js +1129 -0
- package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
- package/dist/server/flow-surfaces/catalog-smart.js +239 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
- package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
- package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
- package/dist/server/flow-surfaces/catalog.d.ts +79 -0
- package/dist/server/flow-surfaces/catalog.js +3693 -0
- package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
- package/dist/server/flow-surfaces/chart-config.js +1394 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +116 -0
- package/dist/server/flow-surfaces/compose-compiler.js +175 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +93 -0
- package/dist/server/flow-surfaces/compose-runtime.js +375 -0
- package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
- package/dist/server/flow-surfaces/configure-options.js +893 -0
- package/dist/server/flow-surfaces/constants.d.ts +351 -0
- package/dist/server/flow-surfaces/constants.js +104 -0
- package/dist/server/flow-surfaces/context.d.ts +72 -0
- package/dist/server/flow-surfaces/context.js +556 -0
- package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
- package/dist/server/flow-surfaces/contract-guard.js +402 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
- package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
- package/dist/server/flow-surfaces/default-action-popup.js +322 -0
- package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
- package/dist/server/flow-surfaces/default-block-actions.js +209 -0
- package/dist/server/flow-surfaces/errors.d.ts +47 -0
- package/dist/server/flow-surfaces/errors.js +145 -0
- package/dist/server/flow-surfaces/executor.d.ts +23 -0
- package/dist/server/flow-surfaces/executor.js +132 -0
- package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +84 -0
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +46 -0
- package/dist/server/flow-surfaces/field-type-resolver.js +322 -0
- package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
- package/dist/server/flow-surfaces/filter-group.js +94 -0
- package/dist/server/flow-surfaces/index.d.ts +11 -0
- package/dist/server/flow-surfaces/index.js +302 -0
- package/dist/server/flow-surfaces/locator.d.ts +28 -0
- package/dist/server/flow-surfaces/locator.js +240 -0
- package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
- package/dist/server/flow-surfaces/node-use-sets.js +135 -0
- package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
- package/dist/server/flow-surfaces/payload-shape.js +61 -0
- package/dist/server/flow-surfaces/placement.d.ts +33 -0
- package/dist/server/flow-surfaces/placement.js +198 -0
- package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
- package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
- package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/compiler.js +376 -0
- package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
- package/dist/server/flow-surfaces/planning/context.js +139 -0
- package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
- package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
- package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
- package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
- package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
- package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/runtime.js +259 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
- package/dist/server/flow-surfaces/planning/step-link.js +104 -0
- package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
- package/dist/server/flow-surfaces/planning/types.js +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
- package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
- package/dist/server/flow-surfaces/reaction/errors.js +69 -0
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
- package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
- package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
- package/dist/server/flow-surfaces/reaction/meta.js +451 -0
- package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
- package/dist/server/flow-surfaces/reaction/registry.js +206 -0
- package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
- package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
- package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
- package/dist/server/flow-surfaces/reaction/types.js +24 -0
- package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
- package/dist/server/flow-surfaces/reaction/utils.js +67 -0
- package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
- package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
- package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
- package/dist/server/flow-surfaces/reference-guards.js +103 -0
- package/dist/server/flow-surfaces/route-sync.d.ts +47 -0
- package/dist/server/flow-surfaces/route-sync.js +392 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
- package/dist/server/flow-surfaces/service-helpers.js +310 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
- package/dist/server/flow-surfaces/service-utils.js +863 -0
- package/dist/server/flow-surfaces/service.d.ts +830 -0
- package/dist/server/flow-surfaces/service.js +15043 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +282 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +440 -0
- package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
- package/dist/server/flow-surfaces/template-compatibility.js +189 -0
- package/dist/server/flow-surfaces/template-display.d.ts +20 -0
- package/dist/server/flow-surfaces/template-display.js +289 -0
- package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
- package/dist/server/flow-surfaces/template-service-utils.js +281 -0
- package/dist/server/flow-surfaces/types.d.ts +288 -0
- package/dist/server/flow-surfaces/types.js +24 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +7 -2
- package/dist/server/plugin.d.ts +0 -1
- package/dist/server/plugin.js +9 -34
- package/dist/server/repository.js +0 -5
- package/dist/server/variables/resolve.d.ts +21 -0
- package/dist/server/variables/resolve.js +79 -0
- package/dist/swagger/flow-surfaces.d.ts +6135 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
- package/dist/swagger/flow-surfaces.examples.js +1816 -0
- package/dist/swagger/flow-surfaces.js +5384 -0
- package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
- package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
- package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
- package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
- package/dist/swagger/index.d.ts +6140 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +3 -3
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,11 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@nocobase/ai").AIEmployeeOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var nathan_exports = {};
|
|
28
|
+
__export(nathan_exports, {
|
|
29
|
+
default: () => nathan_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(nathan_exports);
|
|
32
|
+
var import_ai = require("@nocobase/ai");
|
|
33
|
+
var nathan_default = (0, import_ai.defineAIEmployee)({
|
|
34
|
+
username: "nathan",
|
|
35
|
+
description: "AI employee for coding",
|
|
36
|
+
avatar: "nocobase-002-male",
|
|
37
|
+
nickname: "Nathan",
|
|
38
|
+
position: "Frontend code engineer",
|
|
39
|
+
bio: "An frontend engineer specializing in JavaScript, HTML, and CSS.",
|
|
40
|
+
greeting: "Hello, I\u2019m Nathan, your frontend code engineer. I\u2019ll generate high-quality JavaScript / HTML / CSS code for you. What would you like me to build today?"
|
|
41
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
You are an AI coding assistant for NocoBase RunJS.
|
|
2
|
+
|
|
3
|
+
RunJS is used in:
|
|
4
|
+
|
|
5
|
+
- JS Block
|
|
6
|
+
- JS Field
|
|
7
|
+
- JS Item
|
|
8
|
+
- JS Action
|
|
9
|
+
- Event Flow
|
|
10
|
+
- Linkage Rules
|
|
11
|
+
|
|
12
|
+
Runtime:
|
|
13
|
+
|
|
14
|
+
- Sandboxed environment
|
|
15
|
+
- Access via \`ctx\`
|
|
16
|
+
- Supports top-level await (PREFER whenever possible)
|
|
17
|
+
- JSX → ctx.libs.React.createElement
|
|
18
|
+
- Dynamic ESM via ctx.importAsync()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Core Rule (Strict)
|
|
22
|
+
|
|
23
|
+
Never guess.
|
|
24
|
+
|
|
25
|
+
You must NOT assume:
|
|
26
|
+
|
|
27
|
+
- ctx APIs
|
|
28
|
+
- context variables
|
|
29
|
+
- collections / fields / schema
|
|
30
|
+
- runtime behavior
|
|
31
|
+
- React / Antd exposure
|
|
32
|
+
- browser globals (window, document, location, history, navigator)
|
|
33
|
+
|
|
34
|
+
All of the above MUST be verified via tools or NocoBase docs.
|
|
35
|
+
|
|
36
|
+
If not confirmed → ask user.
|
|
37
|
+
|
|
38
|
+
# Mandatory Workflow (Every Task)
|
|
39
|
+
|
|
40
|
+
Follow this exact order. Do NOT skip ahead to coding.
|
|
41
|
+
|
|
42
|
+
1. Runtime inspection first
|
|
43
|
+
- Use `frontend-developer` skill guidance.
|
|
44
|
+
- Call:
|
|
45
|
+
- `getContextEnvs`
|
|
46
|
+
- `getContextVars`
|
|
47
|
+
- `getContextApis`
|
|
48
|
+
- Goal: confirm what the current runtime exposes.
|
|
49
|
+
- This step does NOT replace documentation lookup.
|
|
50
|
+
|
|
51
|
+
2. Documentation lookup before writing any code
|
|
52
|
+
- Use `document-search` skill guidance.
|
|
53
|
+
- You MUST call:
|
|
54
|
+
- `searchDocs`
|
|
55
|
+
- `readDocEntry`
|
|
56
|
+
- Always search docs before coding when the task involves any of the following:
|
|
57
|
+
- RunJS / workflow / JS Block / JS Field / JS Item / JS Action / Event Flow / Linkage Rules
|
|
58
|
+
- `ctx` APIs, runtime constraints, rendering, routing, requests, imports, React, Antd
|
|
59
|
+
- any NocoBase-specific feature, component, schema, collection behavior, or API usage
|
|
60
|
+
- Do not rely on memory, prior experience, or "common NocoBase patterns" as a substitute for this step.
|
|
61
|
+
- Minimum requirement:
|
|
62
|
+
- search for the relevant module / keywords
|
|
63
|
+
- read the most relevant matching entry or entries
|
|
64
|
+
- extract the concrete constraints or APIs you will rely on
|
|
65
|
+
- Only after this step may you decide how to implement the solution.
|
|
66
|
+
|
|
67
|
+
3. Data inspection when data model is involved
|
|
68
|
+
- Use `data-metadata` skill guidance.
|
|
69
|
+
- If the task touches collections, fields, relations, filtering, querying, or record structure, call:
|
|
70
|
+
- `getDatasources`
|
|
71
|
+
- `getCollectionNames`
|
|
72
|
+
- `getCollectionMetadata`
|
|
73
|
+
- `searchFieldMetadata`
|
|
74
|
+
- Do not invent collection names, field names, relation paths, or schema details.
|
|
75
|
+
|
|
76
|
+
4. Resolve uncertainty before coding
|
|
77
|
+
- If runtime inspection, docs, or metadata still leave a gap, stop and use `suggestions` or ask the user.
|
|
78
|
+
- If a required fact is unverified, you must not start writing code yet.
|
|
79
|
+
|
|
80
|
+
5. Write code only after steps 1-4 are complete
|
|
81
|
+
- `frontend-developer` is the implementation skill, not the starting shortcut.
|
|
82
|
+
- Never use `frontend-developer` alone as justification to begin coding.
|
|
83
|
+
- The code must be based on verified runtime context, verified documentation, and verified metadata when applicable.
|
|
84
|
+
|
|
85
|
+
6. Validate before output (REQUIRED)
|
|
86
|
+
- `lintAndTestJS` must pass before output.
|
|
87
|
+
- If validation fails, fix the code and validate again.
|
|
88
|
+
|
|
89
|
+
# Coding Rules
|
|
90
|
+
|
|
91
|
+
- Single file
|
|
92
|
+
- Prefer top-level await
|
|
93
|
+
- No import / require
|
|
94
|
+
- Libraries ONLY via ctx.importAsync()
|
|
95
|
+
- HTTP ONLY via ctx.request()
|
|
96
|
+
- Only call ctx.render when UI is required
|
|
97
|
+
- JSX uses ctx.libs.React by default
|
|
98
|
+
- When rendering UI, PREFER Ant Design components via ctx.libs.antd to match NocoBase style
|
|
99
|
+
- Inline styles only
|
|
100
|
+
|
|
101
|
+
Forbidden:
|
|
102
|
+
|
|
103
|
+
- fetch
|
|
104
|
+
- XMLHttpRequest
|
|
105
|
+
- localStorage
|
|
106
|
+
- eval
|
|
107
|
+
- new Function
|
|
108
|
+
- Direct document / window access unless explicitly documented
|
|
109
|
+
|
|
110
|
+
# i18n
|
|
111
|
+
|
|
112
|
+
All user-facing strings MUST use: \`ctx.t(...)\`
|
|
113
|
+
|
|
114
|
+
# Security
|
|
115
|
+
|
|
116
|
+
Never inject unsanitized user input into DOM.
|
|
117
|
+
|
|
118
|
+
# Output Rules
|
|
119
|
+
|
|
120
|
+
- Markdown
|
|
121
|
+
- Exactly ONE complete code block at end
|
|
122
|
+
- No partial snippets
|
|
123
|
+
- Brief explanation after code
|
|
124
|
+
|
|
125
|
+
# Standard
|
|
126
|
+
|
|
127
|
+
Senior NocoBase engineer mindset:
|
|
128
|
+
Tool-driven, deterministic, production-minded.
|
|
129
|
+
|
|
130
|
+
If unsure: search.
|
|
131
|
+
If still unsure: ask.
|
|
132
|
+
Never guess.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-developer
|
|
3
|
+
description: Assists with writing, validating, and testing JavaScript code snippets for NocoBase workflows and frontend blocks.
|
|
4
|
+
introduction:
|
|
5
|
+
title: '{{t("ai.skills.frontendDeveloper.title", { ns: "@nocobase/plugin-ai" })}}'
|
|
6
|
+
about: '{{t("ai.skills.frontendDeveloper.about", { ns: "@nocobase/plugin-ai" })}}'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a professional frontend developer assistant for NocoBase.
|
|
10
|
+
|
|
11
|
+
You help users write, validate, and test JavaScript code for workflows, including:
|
|
12
|
+
- Workflow nodes (e.g., Custom JS, Calculation, Conditional branches)
|
|
13
|
+
- Frontend blocks and pages
|
|
14
|
+
|
|
15
|
+
# Primary Workflow
|
|
16
|
+
|
|
17
|
+
When helping users with JavaScript code, follow this process:
|
|
18
|
+
|
|
19
|
+
1. **Understand the Context**
|
|
20
|
+
- Use `getContextVars` to understand what variables are available in the current context
|
|
21
|
+
- Use `getContextApis` to see what API methods can be used
|
|
22
|
+
- Use `getContextEnvs` to understand the current page/block/flow model metadata
|
|
23
|
+
|
|
24
|
+
2. **Write the Code**
|
|
25
|
+
- Write clean, correct JavaScript/JSX code based on the user's requirements
|
|
26
|
+
- Ensure the code follows best practices for NocoBase workflows
|
|
27
|
+
|
|
28
|
+
3. **Validate the Code**
|
|
29
|
+
- Use `lintAndTestJS` to lint and test the code before final output
|
|
30
|
+
- Fix any errors reported by the linting tool
|
|
31
|
+
- Do not output final code unless it passes validation
|
|
32
|
+
|
|
33
|
+
4. **Submit the Code**
|
|
34
|
+
- Once validated, provide the final code to the user
|
|
35
|
+
- Explain how the code works and what it does
|
|
36
|
+
|
|
37
|
+
# Available Tools
|
|
38
|
+
|
|
39
|
+
- `getContextVars`: Retrieves available variables from the current context. Variables are references only — you must explicitly resolve values via `await ctx.getVar(path)`. Supports dot-notation for progressive drilling (e.g., `ctx.popup.record.id`).
|
|
40
|
+
- `getContextApis`: Returns available API methods from the context that can be used in the code.
|
|
41
|
+
- `getContextEnvs`: Returns metadata about the current page, block, or flow model.
|
|
42
|
+
- `lintAndTestJS`: Lints, performs sandbox checks, and trial-runs JavaScript/JSX code. Returns success/failure with diagnostics. **Always call this tool before outputting final code to verify it works.**
|
|
43
|
+
|
|
44
|
+
# Code Writing Guidelines
|
|
45
|
+
|
|
46
|
+
## Variable Access
|
|
47
|
+
|
|
48
|
+
- Always use `await ctx.getVar(path)` to get actual values
|
|
49
|
+
- Use dot-notation for nested paths: `await ctx.getVar('ctx.popup.record.id')`
|
|
50
|
+
- Prefer specific paths instead of fetching entire objects when possible
|
|
51
|
+
|
|
52
|
+
## Return Values
|
|
53
|
+
|
|
54
|
+
- For Custom JS nodes, use `return` to output data to the next node
|
|
55
|
+
- Return values are passed as input to subsequent nodes in the workflow
|
|
56
|
+
- Example: `return { result: calculatedValue };`
|
|
57
|
+
|
|
58
|
+
## Error Handling
|
|
59
|
+
|
|
60
|
+
- Wrap code in try-catch blocks when appropriate
|
|
61
|
+
- Return error information in a consistent format
|
|
62
|
+
- Example: `return { error: 'Error message', details: ... };`
|
|
63
|
+
|
|
64
|
+
## Best Practices
|
|
65
|
+
|
|
66
|
+
- Keep code concise and readable
|
|
67
|
+
- Use meaningful variable names
|
|
68
|
+
- Add comments for complex logic
|
|
69
|
+
- Test code with the lint tool before final submission
|
package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js
RENAMED
|
@@ -44,9 +44,9 @@ var getContextApis_default = (0, import_ai.defineTools)({
|
|
|
44
44
|
description: "Get available API methods from context",
|
|
45
45
|
schema: import_zod.z.object({})
|
|
46
46
|
},
|
|
47
|
-
invoke: async (ctx, _args,
|
|
47
|
+
invoke: async (ctx, _args, runtime) => {
|
|
48
48
|
const { toolCallResults } = ctx.action.params.values || {};
|
|
49
|
-
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id ===
|
|
49
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
50
50
|
if (toolCallResults && result) {
|
|
51
51
|
return {
|
|
52
52
|
status: "success",
|
package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js
RENAMED
|
@@ -44,9 +44,9 @@ var getContextEnvs_default = (0, import_ai.defineTools)({
|
|
|
44
44
|
description: "Get current page/block/flow model metadata from context",
|
|
45
45
|
schema: import_zod.z.object({})
|
|
46
46
|
},
|
|
47
|
-
invoke: async (ctx, _args,
|
|
47
|
+
invoke: async (ctx, _args, runtime) => {
|
|
48
48
|
const { toolCallResults } = ctx.action.params.values || {};
|
|
49
|
-
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id ===
|
|
49
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
50
50
|
if (toolCallResults && result) {
|
|
51
51
|
return {
|
|
52
52
|
status: "success",
|
package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js
RENAMED
|
@@ -60,9 +60,9 @@ instead of fetching the entire object, e.g.
|
|
|
60
60
|
)
|
|
61
61
|
})
|
|
62
62
|
},
|
|
63
|
-
invoke: async (ctx, _args,
|
|
63
|
+
invoke: async (ctx, _args, runtime) => {
|
|
64
64
|
const { toolCallResults } = ctx.action.params.values || {};
|
|
65
|
-
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id ===
|
|
65
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
66
66
|
if (toolCallResults && result) {
|
|
67
67
|
return {
|
|
68
68
|
status: "success",
|
package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js
RENAMED
|
@@ -46,9 +46,9 @@ var lintAndTestJS_default = (0, import_ai.defineTools)({
|
|
|
46
46
|
code: import_zod.z.string().describe("The JavaScript/JSX code to preview and validate")
|
|
47
47
|
})
|
|
48
48
|
},
|
|
49
|
-
invoke: async (ctx, _args,
|
|
49
|
+
invoke: async (ctx, _args, runtime) => {
|
|
50
50
|
const { toolCallResults } = ctx.action.params.values || {};
|
|
51
|
-
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id ===
|
|
51
|
+
const { result } = (toolCallResults == null ? void 0 : toolCallResults.find((item) => item.id === runtime.toolCallId)) ?? {};
|
|
52
52
|
if (toolCallResults && result) {
|
|
53
53
|
return {
|
|
54
54
|
status: result.status ?? "error",
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
# ctx.blockModel
|
|
2
2
|
|
|
3
|
-
The parent block model (BlockModel instance)
|
|
3
|
+
The parent block model (BlockModel instance) where the current JS Field / JS Block is located. In scenarios such as JSField, JSItem, and JSColumn, `ctx.blockModel` points to the form block or table block carrying the current JS logic. In a standalone JSBlock, it may be `null` or the same as `ctx.model`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Scenarios
|
|
6
6
|
|
|
7
7
|
| Scenario | Description |
|
|
8
|
-
|
|
9
|
-
| **JSField** | Access
|
|
10
|
-
| **JSItem** | Access parent table/form block
|
|
11
|
-
| **JSColumn** | Access
|
|
12
|
-
| **Form
|
|
8
|
+
|------|------|
|
|
9
|
+
| **JSField** | Access the `form`, `collection`, and `resource` of the parent form block within a form field to implement linkage or validation. |
|
|
10
|
+
| **JSItem** | Access the resource and collection information of the parent table/form block within a sub-table item. |
|
|
11
|
+
| **JSColumn** | Access the `resource` (e.g., `getSelectedRows`) and `collection` of the parent table block within a table column. |
|
|
12
|
+
| **Form Actions / FlowEngine** | Access `form` for pre-submission validation, `resource` for refreshing, etc. |
|
|
13
13
|
|
|
14
|
-
> Note: `ctx.blockModel` is only available in RunJS contexts
|
|
14
|
+
> Note: `ctx.blockModel` is only available in RunJS contexts where a parent block exists. In standalone JSBlocks (without a parent form/table), it may be `null`. It is recommended to perform a null check before use.
|
|
15
15
|
|
|
16
|
-
## Type
|
|
16
|
+
## Type Definition
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
19
|
blockModel: BlockModel | FormBlockModel | TableBlockModel | CollectionBlockModel | DataBlockModel | null;
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
The
|
|
22
|
+
The specific type depends on the parent block type: form blocks are mostly `FormBlockModel` or `EditFormModel`, while table blocks are mostly `TableBlockModel`.
|
|
23
23
|
|
|
24
24
|
## Common Properties
|
|
25
25
|
|
|
26
26
|
| Property | Type | Description |
|
|
27
|
-
|
|
28
|
-
| `uid` | `string` |
|
|
29
|
-
| `collection` | `Collection` |
|
|
30
|
-
| `resource` | `Resource` |
|
|
31
|
-
| `form` | `FormInstance` | Form
|
|
32
|
-
| `emitter` | `EventEmitter` | Event emitter
|
|
27
|
+
|------|------|------|
|
|
28
|
+
| `uid` | `string` | Unique identifier of the block model. |
|
|
29
|
+
| `collection` | `Collection` | The collection bound to the current block. |
|
|
30
|
+
| `resource` | `Resource` | The resource instance used by the block (`SingleRecordResource` / `MultiRecordResource`, etc.). |
|
|
31
|
+
| `form` | `FormInstance` | Form Block: Ant Design Form instance, supporting `getFieldsValue`, `validateFields`, `setFieldsValue`, etc. |
|
|
32
|
+
| `emitter` | `EventEmitter` | Event emitter, used to listen for `formValuesChange`, `onFieldReset`, etc. |
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## Relationship with ctx.model and ctx.form
|
|
35
35
|
|
|
36
|
-
|
|
|
37
|
-
|
|
38
|
-
| **Parent block of current JS** | `ctx.blockModel` |
|
|
39
|
-
| **Read/
|
|
40
|
-
| **Model
|
|
36
|
+
| Requirement | Recommended Usage |
|
|
37
|
+
|------|----------|
|
|
38
|
+
| **Parent block of the current JS** | `ctx.blockModel` |
|
|
39
|
+
| **Read/Write form fields** | `ctx.form` (equivalent to `ctx.blockModel?.form`, more convenient in form blocks) |
|
|
40
|
+
| **Model of the current execution context** | `ctx.model` (Field model in JSField, Block model in JSBlock) |
|
|
41
41
|
|
|
42
|
-
In JSField, `ctx.model` is the field model and `ctx.blockModel` is the form
|
|
42
|
+
In a JSField, `ctx.model` is the field model, and `ctx.blockModel` is the form or table block carrying that field; `ctx.form` is typically `ctx.blockModel.form`.
|
|
43
43
|
|
|
44
44
|
## Examples
|
|
45
45
|
|
|
46
|
-
### Table:
|
|
46
|
+
### Table: Get selected rows and process
|
|
47
47
|
|
|
48
48
|
```ts
|
|
49
49
|
const rows = ctx.blockModel?.resource?.getSelectedRows?.() || [];
|
|
@@ -53,7 +53,7 @@ if (rows.length === 0) {
|
|
|
53
53
|
}
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
### Form:
|
|
56
|
+
### Form Scenario: Validate and Refresh
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
59
|
if (ctx.blockModel?.form) {
|
|
@@ -62,15 +62,15 @@ if (ctx.blockModel?.form) {
|
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
### Listen
|
|
65
|
+
### Listen for Form Changes
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
68
|
ctx.blockModel?.emitter?.on?.('formValuesChange', (payload) => {
|
|
69
|
-
//
|
|
69
|
+
// Implement linkage or re-rendering based on the latest form values
|
|
70
70
|
});
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
### Trigger
|
|
73
|
+
### Trigger Block Re-render
|
|
74
74
|
|
|
75
75
|
```ts
|
|
76
76
|
ctx.blockModel?.rerender?.();
|
|
@@ -78,13 +78,13 @@ ctx.blockModel?.rerender?.();
|
|
|
78
78
|
|
|
79
79
|
## Notes
|
|
80
80
|
|
|
81
|
-
- In a **standalone JSBlock** (
|
|
82
|
-
- In **JSField / JSItem / JSColumn**, `ctx.blockModel`
|
|
83
|
-
- `resource` exists
|
|
81
|
+
- In a **standalone JSBlock** (without a parent form or table block), `ctx.blockModel` may be `null`. It is recommended to use optional chaining when accessing its properties: `ctx.blockModel?.resource?.refresh?.()`.
|
|
82
|
+
- In **JSField / JSItem / JSColumn**, `ctx.blockModel` refers to the form or table block carrying the current field. In a **JSBlock**, it may be itself or an upper-level block, depending on the actual hierarchy.
|
|
83
|
+
- `resource` only exists in data blocks; `form` only exists in form blocks. Table blocks typically do not have a `form`.
|
|
84
84
|
|
|
85
85
|
## Related
|
|
86
86
|
|
|
87
|
-
- [ctx.model](./model.md): model
|
|
88
|
-
- [ctx.form](./form.md):
|
|
89
|
-
- [ctx.resource](./resource.md):
|
|
90
|
-
- [ctx.getModel()](./get-model.md):
|
|
87
|
+
- [ctx.model](./model.md): The model of the current execution context.
|
|
88
|
+
- [ctx.form](./form.md): Form instance, commonly used in form blocks.
|
|
89
|
+
- [ctx.resource](./resource.md): Resource instance (equivalent to `ctx.blockModel?.resource`, use directly if available).
|
|
90
|
+
- [ctx.getModel()](./get-model.md): Get other block models by UID.
|