@nocobase/flow-engine 2.0.59 → 2.0.61
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/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +76 -31
- package/lib/flowContext.d.ts +6 -1
- package/lib/flowContext.js +35 -6
- package/lib/flowEngine.d.ts +4 -3
- package/lib/flowEngine.js +67 -36
- package/lib/models/flowModel.js +45 -13
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/JSBlockRunJSContext.js +4 -15
- package/lib/runjs-context/contexts/JSColumnRunJSContext.js +5 -2
- package/lib/runjs-context/contexts/JSEditableFieldRunJSContext.js +5 -8
- package/lib/runjs-context/contexts/JSFieldRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/JSItemRunJSContext.js +4 -3
- package/lib/runjs-context/contexts/base.js +464 -29
- package/lib/runjs-context/contexts/elementDoc.d.ts +11 -0
- package/lib/runjs-context/contexts/elementDoc.js +152 -0
- package/lib/utils/loadedPageCache.d.ts +21 -0
- package/lib/utils/loadedPageCache.js +125 -0
- package/package.json +4 -4
- package/src/__tests__/flowContext.test.ts +23 -0
- package/src/__tests__/flowEngine.moveModel.test.ts +81 -1
- package/src/__tests__/runjsContext.test.ts +18 -0
- package/src/__tests__/runjsContextImplementations.test.ts +9 -2
- package/src/__tests__/runjsLocales.test.ts +6 -5
- package/src/__tests__/viewScopedFlowEngine.test.ts +133 -0
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +79 -37
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +148 -1
- package/src/flowContext.ts +40 -6
- package/src/flowEngine.ts +69 -34
- package/src/models/__tests__/flowModel.test.ts +13 -0
- package/src/models/flowModel.tsx +62 -29
- package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/JSBlockRunJSContext.ts +4 -15
- package/src/runjs-context/contexts/JSColumnRunJSContext.ts +4 -2
- package/src/runjs-context/contexts/JSEditableFieldRunJSContext.ts +5 -9
- package/src/runjs-context/contexts/JSFieldRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/JSItemRunJSContext.ts +4 -3
- package/src/runjs-context/contexts/base.ts +467 -31
- package/src/runjs-context/contexts/elementDoc.ts +130 -0
- package/src/utils/loadedPageCache.ts +117 -0
|
@@ -31,6 +31,7 @@ __export(FormJSFieldItemRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(FormJSFieldItemRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _FormJSFieldItemRunJSContext = class _FormJSFieldItemRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_FormJSFieldItemRunJSContext, "FormJSFieldItemRunJSContext");
|
|
@@ -38,8 +39,8 @@ let FormJSFieldItemRunJSContext = _FormJSFieldItemRunJSContext;
|
|
|
38
39
|
FormJSFieldItemRunJSContext.define({
|
|
39
40
|
label: "FormJSFieldItem RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for form field rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for form field rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
value: `Current field value (read-only in display mode; in controlled scenarios, use setProps to modify).`,
|
|
44
45
|
record: `Current record data object (read-only).
|
|
45
46
|
Contains all field values of the parent record.`,
|
|
@@ -61,7 +62,7 @@ FormJSFieldItemRunJSContext.define(
|
|
|
61
62
|
{
|
|
62
63
|
label: "\u8868\u5355 JS \u5B57\u6BB5\u9879 RunJS \u4E0A\u4E0B\u6587",
|
|
63
64
|
properties: {
|
|
64
|
-
element: "ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668",
|
|
65
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u5355\u5B57\u6BB5\u5BB9\u5668"),
|
|
65
66
|
value: "\u5B57\u6BB5\u503C\uFF08\u5C55\u793A\u6A21\u5F0F\u4E3A\u53EA\u8BFB\uFF1B\u53D7\u63A7\u573A\u666F\u7528 setProps \u4FEE\u6539\uFF09",
|
|
66
67
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
|
|
67
68
|
formValues: {
|
|
@@ -31,6 +31,7 @@ __export(JSBlockRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSBlockRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSBlockRunJSContext = class _JSBlockRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSBlockRunJSContext, "JSBlockRunJSContext");
|
|
@@ -38,15 +39,9 @@ let JSBlockRunJSContext = _JSBlockRunJSContext;
|
|
|
38
39
|
JSBlockRunJSContext.define({
|
|
39
40
|
label: "RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
-
description: `ElementProxy instance providing a safe DOM container.
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container.
|
|
43
43
|
Supports innerHTML, append, and other DOM manipulation methods.
|
|
44
|
-
Use this to render content in the JS block
|
|
45
|
-
detail: "ElementProxy",
|
|
46
|
-
properties: {
|
|
47
|
-
innerHTML: "Set or read the HTML content of the container element."
|
|
48
|
-
}
|
|
49
|
-
},
|
|
44
|
+
Use this to render content in the JS block.`),
|
|
50
45
|
record: `Current record data object (read-only).
|
|
51
46
|
Available when the JS block is within a data block or detail view context.`,
|
|
52
47
|
value: "Current value of the field or component, if available in the current context.",
|
|
@@ -65,13 +60,7 @@ JSBlockRunJSContext.define(
|
|
|
65
60
|
{
|
|
66
61
|
label: "RunJS \u4E0A\u4E0B\u6587",
|
|
67
62
|
properties: {
|
|
68
|
-
element:
|
|
69
|
-
description: "ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
|
|
70
|
-
detail: "ElementProxy",
|
|
71
|
-
properties: {
|
|
72
|
-
innerHTML: "\u8BFB\u53D6\u6216\u8BBE\u7F6E\u5BB9\u5668\u7684 HTML \u5185\u5BB9"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
63
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B89\u5168\u7684 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),
|
|
75
64
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF0C\u7528\u4E8E\u6570\u636E\u533A\u5757/\u8BE6\u60C5\u7B49\u573A\u666F\uFF09",
|
|
76
65
|
value: "\u5F53\u524D\u503C\uFF08\u82E5\u5B58\u5728\uFF09",
|
|
77
66
|
React: "React \u5E93",
|
|
@@ -31,6 +31,7 @@ __export(JSColumnRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSColumnRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSColumnRunJSContext = class _JSColumnRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSColumnRunJSContext, "JSColumnRunJSContext");
|
|
@@ -38,7 +39,9 @@ let JSColumnRunJSContext = _JSColumnRunJSContext;
|
|
|
38
39
|
JSColumnRunJSContext.define({
|
|
39
40
|
label: "JSColumn RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(
|
|
43
|
+
"ElementProxy instance providing a safe DOM container for the current table cell. Supports innerHTML/append and basic DOM APIs."
|
|
44
|
+
),
|
|
42
45
|
record: "Current row record object (read-only).",
|
|
43
46
|
recordIndex: "Index of the current row in the page (0-based).",
|
|
44
47
|
collection: "Collection definition metadata (read-only).",
|
|
@@ -56,7 +59,7 @@ JSColumnRunJSContext.define(
|
|
|
56
59
|
{
|
|
57
60
|
label: "JS \u5217 RunJS \u4E0A\u4E0B\u6587",
|
|
58
61
|
properties: {
|
|
59
|
-
element: "ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49",
|
|
62
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u683C\u5355\u5143\u683C\u7684\u5B89\u5168 DOM \u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49"),
|
|
60
63
|
record: "\u5F53\u524D\u884C\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF09",
|
|
61
64
|
recordIndex: "\u5F53\u524D\u884C\u7D22\u5F15\uFF08\u4ECE 0 \u5F00\u59CB\uFF09",
|
|
62
65
|
collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF09",
|
|
@@ -31,6 +31,7 @@ __export(JSEditableFieldRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSEditableFieldRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSEditableFieldRunJSContext = class _JSEditableFieldRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSEditableFieldRunJSContext, "JSEditableFieldRunJSContext");
|
|
@@ -38,10 +39,9 @@ let JSEditableFieldRunJSContext = _JSEditableFieldRunJSContext;
|
|
|
38
39
|
JSEditableFieldRunJSContext.define({
|
|
39
40
|
label: "JSEditableField RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(
|
|
43
|
+
"ElementProxy instance providing a safe DOM container for field rendering. In editable mode this container is typically a <span> element."
|
|
44
|
+
),
|
|
45
45
|
value: {
|
|
46
46
|
description: "Current field value (read-only snapshot). In editable scenarios, prefer ctx.getValue()/ctx.setValue(v) for two-way binding.",
|
|
47
47
|
detail: "any",
|
|
@@ -84,10 +84,7 @@ JSEditableFieldRunJSContext.define(
|
|
|
84
84
|
{
|
|
85
85
|
label: "JS \u53EF\u7F16\u8F91\u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",
|
|
86
86
|
properties: {
|
|
87
|
-
element:
|
|
88
|
-
description: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002",
|
|
89
|
-
detail: "ElementProxy"
|
|
90
|
-
},
|
|
87
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u7684\u5B89\u5168\u5BB9\u5668\uFF08\u901A\u5E38\u4E3A <span> \u5BB9\u5668\uFF09\u3002"),
|
|
91
88
|
value: {
|
|
92
89
|
description: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\u5FEB\u7167\uFF09\u3002\u53EF\u7F16\u8F91\u573A\u666F\u5EFA\u8BAE\u4F7F\u7528 ctx.getValue()/ctx.setValue(v) \u505A\u53CC\u5411\u7ED1\u5B9A\u3002",
|
|
93
90
|
detail: "any",
|
|
@@ -31,6 +31,7 @@ __export(JSFieldRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSFieldRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSFieldRunJSContext = class _JSFieldRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSFieldRunJSContext, "JSFieldRunJSContext");
|
|
@@ -38,8 +39,8 @@ let JSFieldRunJSContext = _JSFieldRunJSContext;
|
|
|
38
39
|
JSFieldRunJSContext.define({
|
|
39
40
|
label: "JSField RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for field rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for field rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
value: `Current value of the field (read-only).
|
|
44
45
|
Contains the data value stored in this field.`,
|
|
45
46
|
record: `Current record data object (read-only).
|
|
@@ -57,7 +58,7 @@ JSFieldRunJSContext.define(
|
|
|
57
58
|
{
|
|
58
59
|
label: "JS \u5B57\u6BB5 RunJS \u4E0A\u4E0B\u6587",
|
|
59
60
|
properties: {
|
|
60
|
-
element: "ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
|
|
61
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u5B57\u6BB5\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C"),
|
|
61
62
|
value: "\u5B57\u6BB5\u5F53\u524D\u503C\uFF08\u53EA\u8BFB\uFF09",
|
|
62
63
|
record: "\u5F53\u524D\u8BB0\u5F55\u5BF9\u8C61\uFF08\u53EA\u8BFB\uFF0C\u5305\u542B\u7236\u8BB0\u5F55\u5168\u90E8\u5B57\u6BB5\u503C\uFF09",
|
|
63
64
|
collection: "\u96C6\u5408\u5B9A\u4E49\u5143\u6570\u636E\uFF08\u53EA\u8BFB\uFF0C\u63CF\u8FF0\u5B57\u6BB5\u6240\u5C5E\u96C6\u5408\u7684 Schema\uFF09"
|
|
@@ -31,6 +31,7 @@ __export(JSItemRunJSContext_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSItemRunJSContext_exports);
|
|
33
33
|
var import_flowContext = require("../../flowContext");
|
|
34
|
+
var import_elementDoc = require("./elementDoc");
|
|
34
35
|
const _JSItemRunJSContext = class _JSItemRunJSContext extends import_flowContext.FlowRunJSContext {
|
|
35
36
|
};
|
|
36
37
|
__name(_JSItemRunJSContext, "JSItemRunJSContext");
|
|
@@ -38,8 +39,8 @@ let JSItemRunJSContext = _JSItemRunJSContext;
|
|
|
38
39
|
JSItemRunJSContext.define({
|
|
39
40
|
label: "JSItem RunJS context",
|
|
40
41
|
properties: {
|
|
41
|
-
element: `ElementProxy instance providing a safe DOM container for form item rendering.
|
|
42
|
-
Supports innerHTML, append, and other DOM manipulation methods
|
|
42
|
+
element: (0, import_elementDoc.createElementPropertyDoc)(`ElementProxy instance providing a safe DOM container for form item rendering.
|
|
43
|
+
Supports innerHTML, append, and other DOM manipulation methods.`),
|
|
43
44
|
resource: `Current resource instance (read-only).
|
|
44
45
|
Provides access to the data resource associated with the current form context.`,
|
|
45
46
|
record: `Current record data object (read-only).
|
|
@@ -59,7 +60,7 @@ JSItemRunJSContext.define(
|
|
|
59
60
|
{
|
|
60
61
|
label: "JS \u8868\u5355\u9879 RunJS \u4E0A\u4E0B\u6587",
|
|
61
62
|
properties: {
|
|
62
|
-
element: "ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C",
|
|
63
|
+
element: (0, import_elementDoc.createZhCNElementPropertyDoc)("ElementProxy\uFF0C\u8868\u5355\u9879\u6E32\u67D3\u5BB9\u5668\uFF0C\u652F\u6301 innerHTML/append \u7B49 DOM \u64CD\u4F5C"),
|
|
63
64
|
resource: "\u5F53\u524D\u8D44\u6E90\uFF08\u53EA\u8BFB\uFF09",
|
|
64
65
|
record: "\u5F53\u524D\u8BB0\u5F55\uFF08\u53EA\u8BFB\uFF09",
|
|
65
66
|
formValues: {
|