@nocobase/flow-engine 2.1.0-beta.9 → 2.2.0-alpha.1
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/FlowContextProvider.d.ts +5 -1
- package/lib/FlowContextProvider.js +9 -2
- package/lib/components/FieldModelRenderer.js +2 -2
- package/lib/components/FlowModelRenderer.d.ts +3 -1
- package/lib/components/FlowModelRenderer.js +12 -6
- package/lib/components/FormItem.d.ts +6 -0
- package/lib/components/FormItem.js +11 -3
- package/lib/components/MobilePopup.js +6 -5
- package/lib/components/dnd/gridDragPlanner.d.ts +59 -2
- package/lib/components/dnd/gridDragPlanner.js +607 -19
- package/lib/components/dnd/index.d.ts +31 -2
- package/lib/components/dnd/index.js +244 -23
- package/lib/components/settings/wrappers/component/SelectWithTitle.d.ts +2 -1
- package/lib/components/settings/wrappers/component/SelectWithTitle.js +14 -12
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.d.ts +3 -0
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +152 -42
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.d.ts +23 -43
- package/lib/components/settings/wrappers/contextual/FlowsFloatContextMenu.js +352 -295
- package/lib/components/settings/wrappers/contextual/useFloatToolbarPortal.d.ts +36 -0
- package/lib/components/settings/wrappers/contextual/useFloatToolbarPortal.js +274 -0
- package/lib/components/settings/wrappers/contextual/useFloatToolbarVisibility.d.ts +30 -0
- package/lib/components/settings/wrappers/contextual/useFloatToolbarVisibility.js +315 -0
- package/lib/components/subModel/AddSubModelButton.js +12 -1
- package/lib/components/subModel/LazyDropdown.js +301 -52
- package/lib/components/subModel/index.d.ts +1 -0
- package/lib/components/subModel/index.js +19 -0
- package/lib/components/subModel/utils.d.ts +2 -1
- package/lib/components/subModel/utils.js +15 -5
- package/lib/components/variables/VariableHybridInput.d.ts +27 -0
- package/lib/components/variables/VariableHybridInput.js +499 -0
- package/lib/components/variables/index.d.ts +2 -0
- package/lib/components/variables/index.js +3 -0
- package/lib/data-source/index.d.ts +84 -0
- package/lib/data-source/index.js +269 -7
- package/lib/executor/FlowExecutor.js +6 -3
- package/lib/flow-registry/DetachedFlowRegistry.d.ts +21 -0
- package/lib/flow-registry/DetachedFlowRegistry.js +80 -0
- package/lib/flow-registry/index.d.ts +1 -0
- package/lib/flow-registry/index.js +3 -1
- package/lib/flowContext.d.ts +9 -1
- package/lib/flowContext.js +77 -6
- package/lib/flowEngine.d.ts +136 -4
- package/lib/flowEngine.js +429 -51
- package/lib/flowI18n.js +2 -1
- package/lib/flowSettings.d.ts +14 -6
- package/lib/flowSettings.js +34 -6
- package/lib/index.d.ts +2 -0
- package/lib/index.js +7 -0
- package/lib/lazy-helper.d.ts +14 -0
- package/lib/lazy-helper.js +71 -0
- package/lib/locale/en-US.json +1 -0
- package/lib/locale/index.d.ts +2 -0
- package/lib/locale/zh-CN.json +1 -0
- package/lib/models/DisplayItemModel.d.ts +1 -1
- package/lib/models/EditableItemModel.d.ts +1 -1
- package/lib/models/FilterableItemModel.d.ts +1 -1
- package/lib/models/flowModel.d.ts +13 -10
- package/lib/models/flowModel.js +126 -34
- package/lib/provider.js +38 -23
- package/lib/reactive/observer.js +46 -16
- 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/runjs-context/setup.js +1 -0
- package/lib/runjs-context/snippets/index.js +13 -2
- package/lib/runjs-context/snippets/scene/detail/set-field-style.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/detail/set-field-style.snippet.js +50 -0
- package/lib/runjs-context/snippets/scene/table/set-cell-style.snippet.d.ts +11 -0
- package/lib/runjs-context/snippets/scene/table/set-cell-style.snippet.js +54 -0
- package/lib/types.d.ts +50 -2
- package/lib/types.js +1 -0
- package/lib/utils/createCollectionContextMeta.js +6 -2
- package/lib/utils/index.d.ts +3 -2
- package/lib/utils/index.js +7 -0
- package/lib/utils/loadedPageCache.d.ts +24 -0
- package/lib/utils/loadedPageCache.js +139 -0
- package/lib/utils/parsePathnameToViewParams.d.ts +5 -1
- package/lib/utils/parsePathnameToViewParams.js +28 -4
- package/lib/utils/randomId.d.ts +39 -0
- package/lib/utils/randomId.js +45 -0
- package/lib/utils/runjsTemplateCompat.js +1 -1
- package/lib/utils/runjsValue.js +41 -11
- package/lib/utils/schema-utils.d.ts +7 -1
- package/lib/utils/schema-utils.js +19 -0
- package/lib/views/FlowView.d.ts +7 -1
- package/lib/views/FlowView.js +11 -1
- package/lib/views/PageComponent.js +8 -6
- package/lib/views/ViewNavigation.d.ts +12 -2
- package/lib/views/ViewNavigation.js +28 -9
- package/lib/views/createViewMeta.js +114 -50
- package/lib/views/inheritLayoutContext.d.ts +10 -0
- package/lib/views/inheritLayoutContext.js +50 -0
- package/lib/views/runViewBeforeClose.d.ts +10 -0
- package/lib/views/runViewBeforeClose.js +45 -0
- package/lib/views/useDialog.d.ts +2 -1
- package/lib/views/useDialog.js +12 -3
- package/lib/views/useDrawer.d.ts +2 -1
- package/lib/views/useDrawer.js +12 -3
- package/lib/views/usePage.d.ts +5 -11
- package/lib/views/usePage.js +304 -144
- package/package.json +5 -4
- package/src/FlowContextProvider.tsx +9 -1
- package/src/__tests__/createViewMeta.popup.test.ts +115 -1
- package/src/__tests__/flow-engine.test.ts +166 -0
- package/src/__tests__/flowContext.test.ts +105 -1
- package/src/__tests__/flowEngine.modelLoaders.test.ts +245 -0
- package/src/__tests__/flowEngine.moveModel.test.ts +81 -1
- package/src/__tests__/flowEngine.removeModel.test.ts +47 -3
- package/src/__tests__/flowSettings.test.ts +94 -15
- package/src/__tests__/objectVariable.test.ts +24 -0
- package/src/__tests__/provider.test.tsx +24 -2
- package/src/__tests__/renderHiddenInConfig.test.tsx +6 -6
- package/src/__tests__/runjsContext.test.ts +21 -0
- package/src/__tests__/runjsContextImplementations.test.ts +9 -2
- package/src/__tests__/runjsContextRuntime.test.ts +2 -0
- package/src/__tests__/runjsLocales.test.ts +6 -5
- package/src/__tests__/runjsSnippets.test.ts +21 -0
- package/src/__tests__/viewScopedFlowEngine.test.ts +136 -3
- package/src/components/FieldModelRenderer.tsx +2 -1
- package/src/components/FlowModelRenderer.tsx +18 -6
- package/src/components/FormItem.tsx +7 -1
- package/src/components/MobilePopup.tsx +4 -2
- package/src/components/__tests__/FlowModelRenderer.test.tsx +65 -2
- package/src/components/__tests__/FormItem.test.tsx +25 -0
- package/src/components/__tests__/dnd.test.ts +44 -0
- package/src/components/__tests__/flow-model-render-error-fallback.test.tsx +20 -10
- package/src/components/__tests__/gridDragPlanner.test.ts +472 -5
- package/src/components/dnd/__tests__/DndProvider.test.tsx +98 -0
- package/src/components/dnd/gridDragPlanner.ts +750 -17
- package/src/components/dnd/index.tsx +305 -28
- package/src/components/settings/wrappers/component/SelectWithTitle.tsx +21 -9
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +178 -48
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +487 -440
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +344 -8
- package/src/components/settings/wrappers/contextual/__tests__/FlowsFloatContextMenu.test.tsx +778 -0
- package/src/components/settings/wrappers/contextual/useFloatToolbarPortal.ts +360 -0
- package/src/components/settings/wrappers/contextual/useFloatToolbarVisibility.ts +361 -0
- package/src/components/subModel/AddSubModelButton.tsx +16 -2
- package/src/components/subModel/LazyDropdown.tsx +341 -56
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +524 -38
- package/src/components/subModel/__tests__/utils.test.ts +24 -0
- package/src/components/subModel/index.ts +1 -0
- package/src/components/subModel/utils.ts +13 -2
- package/src/components/variables/VariableHybridInput.tsx +531 -0
- package/src/components/variables/index.ts +2 -0
- package/src/data-source/__tests__/collection.test.ts +41 -2
- package/src/data-source/__tests__/index.test.ts +69 -2
- package/src/data-source/index.ts +332 -8
- package/src/executor/FlowExecutor.ts +6 -3
- package/src/executor/__tests__/flowExecutor.test.ts +57 -0
- package/src/flow-registry/DetachedFlowRegistry.ts +46 -0
- package/src/flow-registry/__tests__/detachedFlowRegistry.test.ts +47 -0
- package/src/flow-registry/index.ts +1 -0
- package/src/flowContext.ts +85 -6
- package/src/flowEngine.ts +484 -45
- package/src/flowI18n.ts +2 -1
- package/src/flowSettings.ts +40 -6
- package/src/index.ts +2 -0
- package/src/lazy-helper.tsx +57 -0
- package/src/locale/en-US.json +1 -0
- package/src/locale/zh-CN.json +1 -0
- package/src/models/DisplayItemModel.tsx +1 -1
- package/src/models/EditableItemModel.tsx +1 -1
- package/src/models/FilterableItemModel.tsx +1 -1
- package/src/models/__tests__/flowEngine.resolveUse.test.ts +0 -15
- package/src/models/__tests__/flowModel.test.ts +65 -37
- package/src/models/flowModel.tsx +184 -65
- package/src/provider.tsx +41 -25
- package/src/reactive/__tests__/observer.test.tsx +82 -0
- package/src/reactive/observer.tsx +87 -25
- 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/runjs-context/setup.ts +1 -0
- package/src/runjs-context/snippets/index.ts +12 -1
- package/src/runjs-context/snippets/scene/detail/set-field-style.snippet.ts +30 -0
- package/src/runjs-context/snippets/scene/table/set-cell-style.snippet.ts +34 -0
- package/src/types.ts +62 -0
- package/src/utils/__tests__/createCollectionContextMeta.test.ts +48 -0
- package/src/utils/__tests__/parsePathnameToViewParams.test.ts +21 -0
- package/src/utils/__tests__/runjsValue.test.ts +11 -0
- package/src/utils/__tests__/utils.test.ts +62 -0
- package/src/utils/createCollectionContextMeta.ts +6 -2
- package/src/utils/index.ts +5 -1
- package/src/utils/loadedPageCache.ts +147 -0
- package/src/utils/parsePathnameToViewParams.ts +45 -5
- package/src/utils/randomId.ts +48 -0
- package/src/utils/runjsTemplateCompat.ts +1 -1
- package/src/utils/runjsValue.ts +50 -11
- package/src/utils/schema-utils.ts +30 -1
- package/src/views/FlowView.tsx +22 -2
- package/src/views/PageComponent.tsx +7 -4
- package/src/views/ViewNavigation.ts +46 -9
- package/src/views/__tests__/FlowView.usePage.test.tsx +243 -3
- package/src/views/__tests__/ViewNavigation.test.ts +52 -0
- package/src/views/__tests__/inheritLayoutContext.test.ts +53 -0
- package/src/views/__tests__/runViewBeforeClose.test.ts +30 -0
- package/src/views/__tests__/useDialog.closeDestroy.test.tsx +12 -12
- package/src/views/createViewMeta.ts +106 -34
- package/src/views/inheritLayoutContext.ts +26 -0
- package/src/views/runViewBeforeClose.ts +19 -0
- package/src/views/useDialog.tsx +13 -3
- package/src/views/useDrawer.tsx +13 -3
- package/src/views/usePage.tsx +367 -180
package/lib/data-source/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(data_source_exports, {
|
|
|
42
42
|
CollectionManager: () => CollectionManager,
|
|
43
43
|
DataSource: () => DataSource,
|
|
44
44
|
DataSourceManager: () => DataSourceManager,
|
|
45
|
+
getCollectionFieldInterface: () => getCollectionFieldInterface,
|
|
45
46
|
isFieldInterfaceMatch: () => isFieldInterfaceMatch,
|
|
46
47
|
jioToJoiSchema: () => import_jioToJoiSchema.jioToJoiSchema
|
|
47
48
|
});
|
|
@@ -53,12 +54,59 @@ var import_sortCollectionsByInherits = require("./sortCollectionsByInherits");
|
|
|
53
54
|
const _DataSourceManager = class _DataSourceManager {
|
|
54
55
|
dataSources;
|
|
55
56
|
flowEngine;
|
|
57
|
+
requester;
|
|
58
|
+
collectionFieldInterfaceManager;
|
|
59
|
+
loaders = /* @__PURE__ */ new Map();
|
|
60
|
+
loadedKeys = /* @__PURE__ */ new Set();
|
|
61
|
+
loadingKeys = /* @__PURE__ */ new Set();
|
|
62
|
+
loadErrors = /* @__PURE__ */ new Map();
|
|
63
|
+
loadingPromise = null;
|
|
56
64
|
constructor() {
|
|
57
65
|
this.dataSources = import_reactive.observable.shallow(/* @__PURE__ */ new Map());
|
|
58
66
|
}
|
|
59
67
|
setFlowEngine(flowEngine) {
|
|
60
68
|
this.flowEngine = flowEngine;
|
|
61
69
|
}
|
|
70
|
+
setRequester(requester) {
|
|
71
|
+
this.requester = requester;
|
|
72
|
+
}
|
|
73
|
+
setCollectionFieldInterfaceManager(manager) {
|
|
74
|
+
this.collectionFieldInterfaceManager = manager;
|
|
75
|
+
}
|
|
76
|
+
addFieldInterfaces(fieldInterfaceClasses = []) {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.addFieldInterfaces) == null ? void 0 : _b.call(_a, fieldInterfaceClasses);
|
|
79
|
+
}
|
|
80
|
+
addFieldInterfaceGroups(groups) {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.addFieldInterfaceGroups) == null ? void 0 : _b.call(_a, groups);
|
|
83
|
+
}
|
|
84
|
+
addFieldInterfaceComponentOption(name, option) {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.addFieldInterfaceComponentOption) == null ? void 0 : _b.call(_a, name, option);
|
|
87
|
+
}
|
|
88
|
+
addFieldInterfaceOperator(name, operator) {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.addFieldInterfaceOperator) == null ? void 0 : _b.call(_a, name, operator);
|
|
91
|
+
}
|
|
92
|
+
registerFieldFilterOperator(operator) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.registerFieldFilterOperator) == null ? void 0 : _b.call(_a, operator);
|
|
95
|
+
}
|
|
96
|
+
registerFieldFilterOperatorGroup(name, operators = []) {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.registerFieldFilterOperatorGroup) == null ? void 0 : _b.call(_a, name, operators);
|
|
99
|
+
}
|
|
100
|
+
addFieldFilterOperatorsToGroup(name, operators = []) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
(_b = (_a = this.collectionFieldInterfaceManager) == null ? void 0 : _a.addFieldFilterOperatorsToGroup) == null ? void 0 : _b.call(_a, name, operators);
|
|
103
|
+
}
|
|
104
|
+
registerLoader(key, loader) {
|
|
105
|
+
this.loaders.set(key, loader);
|
|
106
|
+
}
|
|
107
|
+
removeLoader(key) {
|
|
108
|
+
this.loaders.delete(key);
|
|
109
|
+
}
|
|
62
110
|
addDataSource(ds) {
|
|
63
111
|
if (this.dataSources.has(ds.key)) {
|
|
64
112
|
throw new Error(`DataSource with name ${ds.key} already exists`);
|
|
@@ -75,7 +123,7 @@ const _DataSourceManager = class _DataSourceManager {
|
|
|
75
123
|
upsertDataSource(ds) {
|
|
76
124
|
var _a;
|
|
77
125
|
if (this.dataSources.has(ds.key)) {
|
|
78
|
-
(_a = this.dataSources.get(ds.key)) == null ? void 0 : _a.
|
|
126
|
+
(_a = this.dataSources.get(ds.key)) == null ? void 0 : _a.patchOptions(ds);
|
|
79
127
|
} else {
|
|
80
128
|
this.addDataSource(ds);
|
|
81
129
|
}
|
|
@@ -103,9 +151,169 @@ const _DataSourceManager = class _DataSourceManager {
|
|
|
103
151
|
if (!ds) return void 0;
|
|
104
152
|
return ds.getCollectionField(otherKeys.join("."));
|
|
105
153
|
}
|
|
154
|
+
async ensureLoaded(options = {}) {
|
|
155
|
+
const { force = false } = options;
|
|
156
|
+
const keys = this.resolveLoadKeys(options.keys);
|
|
157
|
+
const pendingKeys = force ? keys : keys.filter((key) => !this.loadedKeys.has(key));
|
|
158
|
+
if (!pendingKeys.length) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (this.loadingPromise) {
|
|
162
|
+
return this.loadingPromise;
|
|
163
|
+
}
|
|
164
|
+
this.loadingPromise = (async () => {
|
|
165
|
+
try {
|
|
166
|
+
for (const key of pendingKeys) {
|
|
167
|
+
await this.loadKey(key, { initial: !this.loadedKeys.has(key), force });
|
|
168
|
+
}
|
|
169
|
+
} finally {
|
|
170
|
+
this.loadingPromise = null;
|
|
171
|
+
}
|
|
172
|
+
})();
|
|
173
|
+
return this.loadingPromise;
|
|
174
|
+
}
|
|
175
|
+
async reload(options = {}) {
|
|
176
|
+
const keys = this.resolveLoadKeys(options.keys);
|
|
177
|
+
if (!keys.length) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (this.loadingPromise) {
|
|
181
|
+
return this.loadingPromise;
|
|
182
|
+
}
|
|
183
|
+
this.loadingPromise = (async () => {
|
|
184
|
+
try {
|
|
185
|
+
for (const key of keys) {
|
|
186
|
+
await this.loadKey(key, { initial: false, force: true });
|
|
187
|
+
}
|
|
188
|
+
} finally {
|
|
189
|
+
this.loadingPromise = null;
|
|
190
|
+
}
|
|
191
|
+
})();
|
|
192
|
+
return this.loadingPromise;
|
|
193
|
+
}
|
|
194
|
+
async reloadDataSource(key) {
|
|
195
|
+
if (this.loadingKeys.has(key) && this.loadingPromise) {
|
|
196
|
+
return this.loadingPromise;
|
|
197
|
+
}
|
|
198
|
+
if (!this.loaders.has(key) && this.loaders.has("*")) {
|
|
199
|
+
return this.reload({ keys: ["*"] });
|
|
200
|
+
}
|
|
201
|
+
return this.reload({ keys: [key] });
|
|
202
|
+
}
|
|
203
|
+
resolveLoadKeys(requestedKeys) {
|
|
204
|
+
const normalizedKeys = (requestedKeys == null ? void 0 : requestedKeys.length) ? requestedKeys : ["main"];
|
|
205
|
+
const explicitKeys = normalizedKeys.filter((key) => this.loaders.has(key));
|
|
206
|
+
if (this.loaders.has("*")) {
|
|
207
|
+
return import_lodash.default.uniq(["*", ...explicitKeys]);
|
|
208
|
+
}
|
|
209
|
+
return explicitKeys.length ? explicitKeys : normalizedKeys;
|
|
210
|
+
}
|
|
211
|
+
getApp() {
|
|
212
|
+
var _a, _b;
|
|
213
|
+
return (_b = (_a = this.flowEngine) == null ? void 0 : _a.context) == null ? void 0 : _b.app;
|
|
214
|
+
}
|
|
215
|
+
dispatchDataSourceEvent(type, detail) {
|
|
216
|
+
var _a, _b;
|
|
217
|
+
(_b = (_a = this.getApp()) == null ? void 0 : _a.eventBus) == null ? void 0 : _b.dispatchEvent(new CustomEvent(type, { detail }));
|
|
218
|
+
}
|
|
219
|
+
setDataSourceState(key, options) {
|
|
220
|
+
const dataSource = this.getDataSource(key);
|
|
221
|
+
if (!dataSource) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
dataSource.patchOptions(options);
|
|
225
|
+
}
|
|
226
|
+
applyDataSourceLoadResult(key, result) {
|
|
227
|
+
if (key === "*") {
|
|
228
|
+
const dataSources = (result == null ? void 0 : result.dataSources) || [];
|
|
229
|
+
dataSources.forEach((dataSourceOptions) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const { collections, ...dataSource2 } = dataSourceOptions;
|
|
232
|
+
this.upsertDataSource(dataSource2);
|
|
233
|
+
if (collections) {
|
|
234
|
+
(_a = this.getDataSource(dataSource2.key)) == null ? void 0 : _a.setCollections(collections, { clearFields: true });
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const dataSource = this.getDataSource(key);
|
|
240
|
+
if (!dataSource) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
dataSource.setCollections((result == null ? void 0 : result.collections) || [], { clearFields: true });
|
|
244
|
+
}
|
|
245
|
+
async loadKey(key, options) {
|
|
246
|
+
const loader = this.loaders.get(key);
|
|
247
|
+
if (!loader) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (!this.getDataSource(key) && key !== "*") {
|
|
251
|
+
this.addDataSource({ key });
|
|
252
|
+
}
|
|
253
|
+
const { initial } = options;
|
|
254
|
+
this.loadingKeys.add(key);
|
|
255
|
+
if (key !== "*") {
|
|
256
|
+
this.setDataSourceState(key, {
|
|
257
|
+
status: initial ? "loading" : "reloading",
|
|
258
|
+
errorMessage: void 0
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
this.loadErrors.set(key, null);
|
|
262
|
+
try {
|
|
263
|
+
const result = await loader({ key, manager: this }) || {};
|
|
264
|
+
this.applyDataSourceLoadResult(key, result);
|
|
265
|
+
this.loadedKeys.add(key);
|
|
266
|
+
if (key !== "*") {
|
|
267
|
+
this.setDataSourceState(key, {
|
|
268
|
+
status: "loaded",
|
|
269
|
+
errorMessage: void 0
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
this.dispatchDataSourceEvent("dataSource:loaded", { dataSourceKey: key, initial });
|
|
273
|
+
} catch (error) {
|
|
274
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
275
|
+
this.loadErrors.set(key, normalizedError);
|
|
276
|
+
if (key !== "*") {
|
|
277
|
+
this.setDataSourceState(key, {
|
|
278
|
+
status: initial ? "loading-failed" : "reloading-failed",
|
|
279
|
+
errorMessage: normalizedError.message
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
this.dispatchDataSourceEvent("dataSource:loadFailed", {
|
|
283
|
+
dataSourceKey: key,
|
|
284
|
+
initial,
|
|
285
|
+
error: normalizedError
|
|
286
|
+
});
|
|
287
|
+
throw normalizedError;
|
|
288
|
+
} finally {
|
|
289
|
+
this.loadingKeys.delete(key);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
106
292
|
};
|
|
107
293
|
__name(_DataSourceManager, "DataSourceManager");
|
|
108
294
|
let DataSourceManager = _DataSourceManager;
|
|
295
|
+
function getCollectionFieldInterface(interfaceName, ...dataSourceManagers) {
|
|
296
|
+
if (!interfaceName) {
|
|
297
|
+
return void 0;
|
|
298
|
+
}
|
|
299
|
+
for (const dataSourceManager of dataSourceManagers) {
|
|
300
|
+
const collectionFieldInterfaceManager = dataSourceManager == null ? void 0 : dataSourceManager.collectionFieldInterfaceManager;
|
|
301
|
+
const getFieldInterface = collectionFieldInterfaceManager == null ? void 0 : collectionFieldInterfaceManager.getFieldInterface;
|
|
302
|
+
if (typeof getFieldInterface === "function") {
|
|
303
|
+
return getFieldInterface.call(collectionFieldInterfaceManager, interfaceName);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return void 0;
|
|
307
|
+
}
|
|
308
|
+
__name(getCollectionFieldInterface, "getCollectionFieldInterface");
|
|
309
|
+
function shouldTranslateOptionLabel(label) {
|
|
310
|
+
return typeof label === "string" && /\{\{\s*t\s*\(/.test(label);
|
|
311
|
+
}
|
|
312
|
+
__name(shouldTranslateOptionLabel, "shouldTranslateOptionLabel");
|
|
313
|
+
function translateOptionLabel(flowEngine, label, options) {
|
|
314
|
+
return shouldTranslateOptionLabel(label) ? flowEngine.translate(label, options) : label;
|
|
315
|
+
}
|
|
316
|
+
__name(translateOptionLabel, "translateOptionLabel");
|
|
109
317
|
const _DataSource = class _DataSource {
|
|
110
318
|
dataSourceManager;
|
|
111
319
|
collectionManager;
|
|
@@ -126,6 +334,12 @@ const _DataSource = class _DataSource {
|
|
|
126
334
|
get name() {
|
|
127
335
|
return this.options.key;
|
|
128
336
|
}
|
|
337
|
+
get status() {
|
|
338
|
+
return this.options.status;
|
|
339
|
+
}
|
|
340
|
+
get errorMessage() {
|
|
341
|
+
return this.options.errorMessage;
|
|
342
|
+
}
|
|
129
343
|
setDataSourceManager(dataSourceManager) {
|
|
130
344
|
this.dataSourceManager = dataSourceManager;
|
|
131
345
|
}
|
|
@@ -156,6 +370,9 @@ const _DataSource = class _DataSource {
|
|
|
156
370
|
upsertCollections(collections, options = {}) {
|
|
157
371
|
return this.collectionManager.upsertCollections(collections, options);
|
|
158
372
|
}
|
|
373
|
+
setCollections(collections, options = {}) {
|
|
374
|
+
return this.collectionManager.setCollections(collections, options);
|
|
375
|
+
}
|
|
159
376
|
removeCollection(name) {
|
|
160
377
|
return this.collectionManager.removeCollection(name);
|
|
161
378
|
}
|
|
@@ -166,6 +383,12 @@ const _DataSource = class _DataSource {
|
|
|
166
383
|
Object.keys(this.options).forEach((key) => delete this.options[key]);
|
|
167
384
|
Object.assign(this.options, newOptions);
|
|
168
385
|
}
|
|
386
|
+
patchOptions(newOptions = {}) {
|
|
387
|
+
Object.assign(this.options, newOptions);
|
|
388
|
+
}
|
|
389
|
+
reload() {
|
|
390
|
+
return this.dataSourceManager.reloadDataSource(this.key);
|
|
391
|
+
}
|
|
169
392
|
getCollectionField(fieldPath) {
|
|
170
393
|
const [collectionName, ...otherKeys] = fieldPath.split(".");
|
|
171
394
|
const fieldName = otherKeys.join(".");
|
|
@@ -190,6 +413,10 @@ const _CollectionManager = class _CollectionManager {
|
|
|
190
413
|
collections;
|
|
191
414
|
allCollectionsInheritChain;
|
|
192
415
|
childrenCollectionsName = {};
|
|
416
|
+
resetCaches() {
|
|
417
|
+
this.childrenCollectionsName = {};
|
|
418
|
+
this.allCollectionsInheritChain = void 0;
|
|
419
|
+
}
|
|
193
420
|
get flowEngine() {
|
|
194
421
|
return this.dataSource.flowEngine;
|
|
195
422
|
}
|
|
@@ -203,9 +430,11 @@ const _CollectionManager = class _CollectionManager {
|
|
|
203
430
|
col.setDataSource(this.dataSource);
|
|
204
431
|
col.initInherits();
|
|
205
432
|
this.collections.set(col.name, col);
|
|
433
|
+
this.resetCaches();
|
|
206
434
|
}
|
|
207
435
|
removeCollection(name) {
|
|
208
436
|
this.collections.delete(name);
|
|
437
|
+
this.resetCaches();
|
|
209
438
|
}
|
|
210
439
|
updateCollection(newOptions, options = {}) {
|
|
211
440
|
const collection = this.getCollection(newOptions.name);
|
|
@@ -213,6 +442,7 @@ const _CollectionManager = class _CollectionManager {
|
|
|
213
442
|
throw new Error(`Collection ${newOptions.name} not found`);
|
|
214
443
|
}
|
|
215
444
|
collection.setOptions(newOptions, options);
|
|
445
|
+
this.resetCaches();
|
|
216
446
|
}
|
|
217
447
|
upsertCollection(options) {
|
|
218
448
|
if (this.collections.has(options.name)) {
|
|
@@ -230,6 +460,11 @@ const _CollectionManager = class _CollectionManager {
|
|
|
230
460
|
this.addCollection(collection);
|
|
231
461
|
}
|
|
232
462
|
}
|
|
463
|
+
this.resetCaches();
|
|
464
|
+
}
|
|
465
|
+
setCollections(collections, options = {}) {
|
|
466
|
+
this.clearCollections();
|
|
467
|
+
this.upsertCollections(collections, options);
|
|
233
468
|
}
|
|
234
469
|
sortCollectionsByInherits(collections) {
|
|
235
470
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -293,6 +528,7 @@ const _CollectionManager = class _CollectionManager {
|
|
|
293
528
|
}
|
|
294
529
|
clearCollections() {
|
|
295
530
|
this.collections.clear();
|
|
531
|
+
this.resetCaches();
|
|
296
532
|
}
|
|
297
533
|
getAssociation(associationName) {
|
|
298
534
|
const [collectionName, fieldName] = associationName.split(".");
|
|
@@ -461,6 +697,12 @@ const _Collection = class _Collection {
|
|
|
461
697
|
}
|
|
462
698
|
get titleCollectionField() {
|
|
463
699
|
const titleFieldName = this.options.titleField || this.filterTargetKey;
|
|
700
|
+
if (Array.isArray(titleFieldName)) {
|
|
701
|
+
if (titleFieldName.length !== 1) {
|
|
702
|
+
return void 0;
|
|
703
|
+
}
|
|
704
|
+
return this.getField(titleFieldName[0]);
|
|
705
|
+
}
|
|
464
706
|
const titleCollectionField = this.getField(titleFieldName);
|
|
465
707
|
return titleCollectionField;
|
|
466
708
|
}
|
|
@@ -487,6 +729,9 @@ const _Collection = class _Collection {
|
|
|
487
729
|
}
|
|
488
730
|
this.upsertFields(this.options.fields || []);
|
|
489
731
|
}
|
|
732
|
+
setOption(key, value) {
|
|
733
|
+
this.options[key] = value;
|
|
734
|
+
}
|
|
490
735
|
getFields() {
|
|
491
736
|
const fieldMap = /* @__PURE__ */ new Map();
|
|
492
737
|
for (const inherit of this.inherits.values()) {
|
|
@@ -711,7 +956,7 @@ const _CollectionField = class _CollectionField {
|
|
|
711
956
|
}
|
|
712
957
|
return {
|
|
713
958
|
...v,
|
|
714
|
-
label:
|
|
959
|
+
label: translateOptionLabel(this.flowEngine, v.label, { ns: "lm-collections" }),
|
|
715
960
|
value: Number(v.value)
|
|
716
961
|
};
|
|
717
962
|
});
|
|
@@ -719,7 +964,7 @@ const _CollectionField = class _CollectionField {
|
|
|
719
964
|
return options.map((v) => {
|
|
720
965
|
return {
|
|
721
966
|
...v,
|
|
722
|
-
label: this.flowEngine
|
|
967
|
+
label: translateOptionLabel(this.flowEngine, v.label, { ns: "lm-collections" })
|
|
723
968
|
};
|
|
724
969
|
});
|
|
725
970
|
}
|
|
@@ -753,7 +998,7 @@ const _CollectionField = class _CollectionField {
|
|
|
753
998
|
{
|
|
754
999
|
...import_lodash.default.omit(((_a = this.options.uiSchema) == null ? void 0 : _a["x-component-props"]) || {}, "fieldNames"),
|
|
755
1000
|
options: this.enum.length ? this.enum : void 0,
|
|
756
|
-
mode: this.
|
|
1001
|
+
mode: this.interface === "multipleSelect" ? "multiple" : void 0,
|
|
757
1002
|
multiple: target ? ["belongsToMany", "hasMany", "belongsToArray"].includes(type) : void 0,
|
|
758
1003
|
maxCount: target && !["belongsToMany", "hasMany", "belongsToArray"].includes(type) ? 1 : void 0,
|
|
759
1004
|
target,
|
|
@@ -772,7 +1017,17 @@ const _CollectionField = class _CollectionField {
|
|
|
772
1017
|
abortEarly: false
|
|
773
1018
|
});
|
|
774
1019
|
if (error) {
|
|
775
|
-
const message = error.details.map((d) =>
|
|
1020
|
+
const message = error.details.map((d) => {
|
|
1021
|
+
const translated = this.flowEngine.translate(d.type, {
|
|
1022
|
+
...d.context,
|
|
1023
|
+
ns: "data-source-main",
|
|
1024
|
+
label
|
|
1025
|
+
});
|
|
1026
|
+
if (translated && translated !== d.type) {
|
|
1027
|
+
return translated;
|
|
1028
|
+
}
|
|
1029
|
+
return d.message.replace(/"value"/g, `"${label}"`);
|
|
1030
|
+
}).join(", ");
|
|
776
1031
|
return Promise.reject(message);
|
|
777
1032
|
}
|
|
778
1033
|
return Promise.resolve();
|
|
@@ -792,8 +1047,14 @@ const _CollectionField = class _CollectionField {
|
|
|
792
1047
|
return this.targetCollection.getFields();
|
|
793
1048
|
}
|
|
794
1049
|
getInterfaceOptions() {
|
|
795
|
-
|
|
796
|
-
|
|
1050
|
+
var _a, _b, _c;
|
|
1051
|
+
const ctx = this.flowEngine.context;
|
|
1052
|
+
return getCollectionFieldInterface(
|
|
1053
|
+
this.interface,
|
|
1054
|
+
(_b = (_a = this.collection) == null ? void 0 : _a.dataSource) == null ? void 0 : _b.dataSourceManager,
|
|
1055
|
+
ctx.dataSourceManager,
|
|
1056
|
+
(_c = ctx.app) == null ? void 0 : _c.dataSourceManager
|
|
1057
|
+
);
|
|
797
1058
|
}
|
|
798
1059
|
getFilterOperators() {
|
|
799
1060
|
var _a;
|
|
@@ -858,6 +1119,7 @@ __name(isFieldInterfaceMatch, "isFieldInterfaceMatch");
|
|
|
858
1119
|
CollectionManager,
|
|
859
1120
|
DataSource,
|
|
860
1121
|
DataSourceManager,
|
|
1122
|
+
getCollectionFieldInterface,
|
|
861
1123
|
isFieldInterfaceMatch,
|
|
862
1124
|
jioToJoiSchema
|
|
863
1125
|
});
|
|
@@ -153,9 +153,6 @@ const _FlowExecutor = class _FlowExecutor {
|
|
|
153
153
|
const stepDefaultParams = await (0, import_utils.resolveDefaultParams)(step.defaultParams, runtimeCtx);
|
|
154
154
|
combinedParams = { ...stepDefaultParams };
|
|
155
155
|
} else {
|
|
156
|
-
flowContext.logger.error(
|
|
157
|
-
`BaseModel.applyFlow: Step '${stepKey}' in flow '${flowKey}' has neither 'use' nor 'handler'. Skipping.`
|
|
158
|
-
);
|
|
159
156
|
continue;
|
|
160
157
|
}
|
|
161
158
|
const modelStepParams = model.getStepParams(flowKey, stepKey);
|
|
@@ -459,6 +456,12 @@ const _FlowExecutor = class _FlowExecutor {
|
|
|
459
456
|
result,
|
|
460
457
|
...abortedByExitAll ? { aborted: true } : {}
|
|
461
458
|
});
|
|
459
|
+
if (result && typeof result === "object") {
|
|
460
|
+
Object.defineProperty(result, "__abortedByExitAll", {
|
|
461
|
+
value: abortedByExitAll,
|
|
462
|
+
configurable: true
|
|
463
|
+
});
|
|
464
|
+
}
|
|
462
465
|
return result;
|
|
463
466
|
} catch (error) {
|
|
464
467
|
try {
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { FlowDefinition } from '../FlowDefinition';
|
|
10
|
+
import { FlowDefinitionOptions } from '../types';
|
|
11
|
+
import { BaseFlowRegistry, IFlowRepository } from './BaseFlowRegistry';
|
|
12
|
+
export type FlowRegistryData = Record<string, Omit<FlowDefinitionOptions, 'key'> & {
|
|
13
|
+
key?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare class DetachedFlowRegistry extends BaseFlowRegistry {
|
|
16
|
+
constructor(flows?: FlowRegistryData);
|
|
17
|
+
saveFlow(_flow: FlowDefinition): void;
|
|
18
|
+
destroyFlow(flowKey: string): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function serializeFlowRegistry(registry: Pick<IFlowRepository, 'getFlows'>): FlowRegistryData;
|
|
21
|
+
export declare function replaceFlowRegistry(registry: Pick<IFlowRepository, 'getFlows' | 'removeFlow' | 'addFlows'>, flows: FlowRegistryData): void;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
+
var __export = (target, all) => {
|
|
18
|
+
for (var name in all)
|
|
19
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
+
for (let key of __getOwnPropNames(from))
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
+
mod
|
|
36
|
+
));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var DetachedFlowRegistry_exports = {};
|
|
39
|
+
__export(DetachedFlowRegistry_exports, {
|
|
40
|
+
DetachedFlowRegistry: () => DetachedFlowRegistry,
|
|
41
|
+
replaceFlowRegistry: () => replaceFlowRegistry,
|
|
42
|
+
serializeFlowRegistry: () => serializeFlowRegistry
|
|
43
|
+
});
|
|
44
|
+
module.exports = __toCommonJS(DetachedFlowRegistry_exports);
|
|
45
|
+
var import_lodash = __toESM(require("lodash"));
|
|
46
|
+
var import_BaseFlowRegistry = require("./BaseFlowRegistry");
|
|
47
|
+
const _DetachedFlowRegistry = class _DetachedFlowRegistry extends import_BaseFlowRegistry.BaseFlowRegistry {
|
|
48
|
+
constructor(flows = {}) {
|
|
49
|
+
super();
|
|
50
|
+
this.addFlows(import_lodash.default.cloneDeep(flows));
|
|
51
|
+
}
|
|
52
|
+
saveFlow(_flow) {
|
|
53
|
+
}
|
|
54
|
+
destroyFlow(flowKey) {
|
|
55
|
+
this.removeFlow(flowKey);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
__name(_DetachedFlowRegistry, "DetachedFlowRegistry");
|
|
59
|
+
let DetachedFlowRegistry = _DetachedFlowRegistry;
|
|
60
|
+
function serializeFlowRegistry(registry) {
|
|
61
|
+
const flows = {};
|
|
62
|
+
for (const [key, flow] of registry.getFlows()) {
|
|
63
|
+
flows[key] = import_lodash.default.cloneDeep(flow.toData());
|
|
64
|
+
}
|
|
65
|
+
return flows;
|
|
66
|
+
}
|
|
67
|
+
__name(serializeFlowRegistry, "serializeFlowRegistry");
|
|
68
|
+
function replaceFlowRegistry(registry, flows) {
|
|
69
|
+
for (const key of Array.from(registry.getFlows().keys())) {
|
|
70
|
+
registry.removeFlow(key);
|
|
71
|
+
}
|
|
72
|
+
registry.addFlows(import_lodash.default.cloneDeep(flows));
|
|
73
|
+
}
|
|
74
|
+
__name(replaceFlowRegistry, "replaceFlowRegistry");
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
DetachedFlowRegistry,
|
|
78
|
+
replaceFlowRegistry,
|
|
79
|
+
serializeFlowRegistry
|
|
80
|
+
});
|
|
@@ -26,9 +26,11 @@ module.exports = __toCommonJS(flow_registry_exports);
|
|
|
26
26
|
__reExport(flow_registry_exports, require("./BaseFlowRegistry"), module.exports);
|
|
27
27
|
__reExport(flow_registry_exports, require("./InstanceFlowRegistry"), module.exports);
|
|
28
28
|
__reExport(flow_registry_exports, require("./GlobalFlowRegistry"), module.exports);
|
|
29
|
+
__reExport(flow_registry_exports, require("./DetachedFlowRegistry"), module.exports);
|
|
29
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
31
|
0 && (module.exports = {
|
|
31
32
|
...require("./BaseFlowRegistry"),
|
|
32
33
|
...require("./InstanceFlowRegistry"),
|
|
33
|
-
...require("./GlobalFlowRegistry")
|
|
34
|
+
...require("./GlobalFlowRegistry"),
|
|
35
|
+
...require("./DetachedFlowRegistry")
|
|
34
36
|
});
|
package/lib/flowContext.d.ts
CHANGED
|
@@ -222,6 +222,10 @@ export type FlowContextGetApiInfosOptions = {
|
|
|
222
222
|
* RunJS 文档版本(默认 v1)。
|
|
223
223
|
*/
|
|
224
224
|
version?: RunJSVersion;
|
|
225
|
+
/**
|
|
226
|
+
* Include editor completion metadata. Defaults to false so API-doc callers keep the compact public shape.
|
|
227
|
+
*/
|
|
228
|
+
includeCompletion?: boolean;
|
|
225
229
|
};
|
|
226
230
|
export type FlowContextGetVarInfosOptions = {
|
|
227
231
|
/**
|
|
@@ -293,7 +297,7 @@ export declare class FlowContext {
|
|
|
293
297
|
* - 输出仅来自 RunJS doc 与 defineProperty/defineMethod 的 info
|
|
294
298
|
* - 不读取/展开 PropertyMeta(变量结构)
|
|
295
299
|
* - 不自动展开深层 properties
|
|
296
|
-
* -
|
|
300
|
+
* - 默认不返回自动补全字段(例如 completion),传入 includeCompletion=true 时返回
|
|
297
301
|
*/
|
|
298
302
|
getApiInfos(options?: FlowContextGetApiInfosOptions): Promise<Record<string, FlowContextApiInfo>>;
|
|
299
303
|
/**
|
|
@@ -325,8 +329,10 @@ export declare class FlowContext {
|
|
|
325
329
|
getPropertyOptions(key: string): PropertyOptions | undefined;
|
|
326
330
|
}
|
|
327
331
|
declare class BaseFlowEngineContext extends FlowContext {
|
|
332
|
+
t: (key: any, options?: any) => string;
|
|
328
333
|
router: Router;
|
|
329
334
|
dataSourceManager: DataSourceManager;
|
|
335
|
+
isDarkTheme: boolean;
|
|
330
336
|
requireAsync: (url: string) => Promise<any>;
|
|
331
337
|
importAsync: (url: string) => Promise<any>;
|
|
332
338
|
createJSRunner: (options?: JSRunnerOptions) => Promise<JSRunner>;
|
|
@@ -347,6 +353,7 @@ declare class BaseFlowEngineContext extends FlowContext {
|
|
|
347
353
|
runAction: (actionName: string, params?: Record<string, any>) => Promise<any> | any;
|
|
348
354
|
engine: FlowEngine;
|
|
349
355
|
api: APIClient;
|
|
356
|
+
locale: string;
|
|
350
357
|
viewer: FlowViewer;
|
|
351
358
|
view: FlowView;
|
|
352
359
|
modal: HookAPI;
|
|
@@ -420,6 +427,7 @@ export declare class FlowRuntimeContext<TModel extends FlowModel = FlowModel, TM
|
|
|
420
427
|
export type FlowSettingsContext<TModel extends FlowModel = FlowModel> = FlowRuntimeContext<TModel, 'settings'>;
|
|
421
428
|
export type RunJSDocCompletionDoc = {
|
|
422
429
|
insertText?: string;
|
|
430
|
+
requires?: Array<'element'>;
|
|
423
431
|
};
|
|
424
432
|
export type RunJSDocHiddenDoc = boolean | ((ctx: any) => boolean | Promise<boolean>);
|
|
425
433
|
export type RunJSDocHiddenOrPathsDoc = boolean | string[] | ((ctx: any) => boolean | string[] | Promise<boolean | string[]>);
|