@nocobase/flow-engine 2.1.0-beta.9 → 2.2.0-beta.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/flowSettings.d.ts
CHANGED
|
@@ -79,12 +79,19 @@ export interface FlowSettingsOpenOptions {
|
|
|
79
79
|
/** 配置保存成功后触发的回调 */
|
|
80
80
|
onSaved?: () => void | Promise<void>;
|
|
81
81
|
}
|
|
82
|
+
export type FlowSettingsComponent = React.ComponentType<any>;
|
|
83
|
+
export type FlowSettingsComponentModule = {
|
|
84
|
+
default?: FlowSettingsComponent;
|
|
85
|
+
} | Record<string, FlowSettingsComponent>;
|
|
86
|
+
export type FlowSettingsComponentLoader = () => Promise<FlowSettingsComponentModule | FlowSettingsComponent>;
|
|
87
|
+
export type FlowSettingsComponentLoaderMap = Record<string, FlowSettingsComponentLoader>;
|
|
82
88
|
export declare class FlowSettings {
|
|
83
89
|
#private;
|
|
84
90
|
components: Record<string, any>;
|
|
85
91
|
scopes: Record<string, any>;
|
|
86
92
|
private antdComponentsLoaded;
|
|
87
93
|
enabled: boolean;
|
|
94
|
+
private engine;
|
|
88
95
|
toolbarItems: ToolbarItemConfig[];
|
|
89
96
|
constructor(engine: FlowEngine);
|
|
90
97
|
on(event: 'beforeOpen', callback: (...args: any[]) => void): void;
|
|
@@ -110,6 +117,7 @@ export declare class FlowSettings {
|
|
|
110
117
|
* flowSettings.registerComponents({ MyComponent, AnotherComponent });
|
|
111
118
|
*/
|
|
112
119
|
registerComponents(components: Record<string, any>): void;
|
|
120
|
+
registerComponentLoaders(loaders: FlowSettingsComponentLoaderMap): void;
|
|
113
121
|
/**
|
|
114
122
|
* 添加作用域到 FlowSettings 的作用域注册表中。
|
|
115
123
|
* 这些作用域可以在 flow step 的 uiSchema 中使用。
|
|
@@ -122,17 +130,17 @@ export declare class FlowSettings {
|
|
|
122
130
|
/**
|
|
123
131
|
* 启用流程设置组件的显示
|
|
124
132
|
* @example
|
|
125
|
-
* flowSettings.enable();
|
|
133
|
+
* await flowSettings.enable();
|
|
126
134
|
*/
|
|
127
|
-
enable(): void
|
|
128
|
-
forceEnable(): void
|
|
135
|
+
enable(): Promise<void>;
|
|
136
|
+
forceEnable(): Promise<void>;
|
|
129
137
|
/**
|
|
130
138
|
* 禁用流程设置组件的显示
|
|
131
139
|
* @example
|
|
132
|
-
* flowSettings.disable();
|
|
140
|
+
* await flowSettings.disable();
|
|
133
141
|
*/
|
|
134
|
-
disable(): void
|
|
135
|
-
forceDisable(): void
|
|
142
|
+
disable(): Promise<void>;
|
|
143
|
+
forceDisable(): Promise<void>;
|
|
136
144
|
/**
|
|
137
145
|
* 添加扩展工具栏项目
|
|
138
146
|
* @param {ToolbarItemConfig} config 项目配置
|
package/lib/flowSettings.js
CHANGED
|
@@ -65,6 +65,7 @@ var import_utils = require("./utils");
|
|
|
65
65
|
var import_exceptions = require("./utils/exceptions");
|
|
66
66
|
var import_useFlowStep = require("./hooks/useFlowStep");
|
|
67
67
|
var import_views = require("./views");
|
|
68
|
+
var import_lazy_helper = require("./lazy-helper");
|
|
68
69
|
var _forceEnabled, _emitter;
|
|
69
70
|
const Panel = import_antd.Collapse.Panel;
|
|
70
71
|
const _FlowSettings = class _FlowSettings {
|
|
@@ -73,10 +74,12 @@ const _FlowSettings = class _FlowSettings {
|
|
|
73
74
|
__publicField(this, "scopes", {});
|
|
74
75
|
__publicField(this, "antdComponentsLoaded", false);
|
|
75
76
|
__publicField(this, "enabled");
|
|
77
|
+
__publicField(this, "engine");
|
|
76
78
|
__privateAdd(this, _forceEnabled, false);
|
|
77
79
|
// 强制启用状态,主要用于设计模式下的强制启用
|
|
78
80
|
__publicField(this, "toolbarItems", []);
|
|
79
81
|
__privateAdd(this, _emitter, new import_emitter.Emitter());
|
|
82
|
+
this.engine = engine;
|
|
80
83
|
this.enabled = false;
|
|
81
84
|
engine.context.defineProperty("flowSettingsEnabled", {
|
|
82
85
|
get: /* @__PURE__ */ __name(() => this.enabled, "get"),
|
|
@@ -215,6 +218,29 @@ const _FlowSettings = class _FlowSettings {
|
|
|
215
218
|
this.components[name] = components[name];
|
|
216
219
|
});
|
|
217
220
|
}
|
|
221
|
+
registerComponentLoaders(loaders) {
|
|
222
|
+
Object.entries(loaders).forEach(([name, loader]) => {
|
|
223
|
+
if (this.components[name]) {
|
|
224
|
+
console.warn(`FlowSettings: Component with name '${name}' is already registered and will be overwritten.`);
|
|
225
|
+
}
|
|
226
|
+
this.components[name] = (0, import_lazy_helper.lazy)(async () => {
|
|
227
|
+
const loaded = await loader();
|
|
228
|
+
if (typeof loaded === "function") {
|
|
229
|
+
return { default: loaded };
|
|
230
|
+
}
|
|
231
|
+
if ((loaded == null ? void 0 : loaded.default) && typeof loaded.default === "function") {
|
|
232
|
+
return { default: loaded.default };
|
|
233
|
+
}
|
|
234
|
+
const namedComponent = loaded == null ? void 0 : loaded[name];
|
|
235
|
+
if (typeof namedComponent === "function") {
|
|
236
|
+
return { default: namedComponent };
|
|
237
|
+
}
|
|
238
|
+
throw new Error(
|
|
239
|
+
`FlowSettings: component loader for '${name}' must resolve to a React component or a module exporting it.`
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
}
|
|
218
244
|
/**
|
|
219
245
|
* 添加作用域到 FlowSettings 的作用域注册表中。
|
|
220
246
|
* 这些作用域可以在 flow step 的 uiSchema 中使用。
|
|
@@ -234,27 +260,29 @@ const _FlowSettings = class _FlowSettings {
|
|
|
234
260
|
/**
|
|
235
261
|
* 启用流程设置组件的显示
|
|
236
262
|
* @example
|
|
237
|
-
* flowSettings.enable();
|
|
263
|
+
* await flowSettings.enable();
|
|
238
264
|
*/
|
|
239
|
-
enable() {
|
|
265
|
+
async enable() {
|
|
266
|
+
await this.engine.preloadModelLoaders();
|
|
240
267
|
this.enabled = true;
|
|
241
268
|
}
|
|
242
|
-
forceEnable() {
|
|
269
|
+
async forceEnable() {
|
|
270
|
+
await this.engine.preloadModelLoaders();
|
|
243
271
|
__privateSet(this, _forceEnabled, true);
|
|
244
272
|
this.enabled = true;
|
|
245
273
|
}
|
|
246
274
|
/**
|
|
247
275
|
* 禁用流程设置组件的显示
|
|
248
276
|
* @example
|
|
249
|
-
* flowSettings.disable();
|
|
277
|
+
* await flowSettings.disable();
|
|
250
278
|
*/
|
|
251
|
-
disable() {
|
|
279
|
+
async disable() {
|
|
252
280
|
if (__privateGet(this, _forceEnabled)) {
|
|
253
281
|
return;
|
|
254
282
|
}
|
|
255
283
|
this.enabled = false;
|
|
256
284
|
}
|
|
257
|
-
forceDisable() {
|
|
285
|
+
async forceDisable() {
|
|
258
286
|
__privateSet(this, _forceEnabled, false);
|
|
259
287
|
this.enabled = false;
|
|
260
288
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -34,5 +34,7 @@ export { getSnippetBody, listSnippetsForContext, registerRunJSSnippet } from './
|
|
|
34
34
|
export * from './views';
|
|
35
35
|
export { DATA_SOURCE_DIRTY_EVENT, ENGINE_SCOPE_KEY, getEmitterViewActivatedVersion, VIEW_ACTIVATED_EVENT, VIEW_ACTIVATED_VERSION, VIEW_ENGINE_SCOPE, } from './views/viewEvents';
|
|
36
36
|
export * from './FlowDefinition';
|
|
37
|
+
export { DetachedFlowRegistry, replaceFlowRegistry, serializeFlowRegistry } from './flow-registry';
|
|
38
|
+
export type { FlowRegistryData } from './flow-registry';
|
|
37
39
|
export { createViewScopedEngine } from './ViewScopedFlowEngine';
|
|
38
40
|
export { createBlockScopedEngine } from './BlockScopedFlowEngine';
|
package/lib/index.js
CHANGED
|
@@ -28,6 +28,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var src_exports = {};
|
|
29
29
|
__export(src_exports, {
|
|
30
30
|
DATA_SOURCE_DIRTY_EVENT: () => import_viewEvents.DATA_SOURCE_DIRTY_EVENT,
|
|
31
|
+
DetachedFlowRegistry: () => import_flow_registry.DetachedFlowRegistry,
|
|
31
32
|
ENGINE_SCOPE_KEY: () => import_viewEvents.ENGINE_SCOPE_KEY,
|
|
32
33
|
RunJSContextRegistry: () => import_registry.RunJSContextRegistry,
|
|
33
34
|
VIEW_ACTIVATED_EVENT: () => import_viewEvents.VIEW_ACTIVATED_EVENT,
|
|
@@ -47,6 +48,8 @@ __export(src_exports, {
|
|
|
47
48
|
registerRunJSContextContribution: () => import_contributions.registerRunJSContextContribution,
|
|
48
49
|
registerRunJSLib: () => import_runjsLibs.registerRunJSLib,
|
|
49
50
|
registerRunJSSnippet: () => import_snippets.registerRunJSSnippet,
|
|
51
|
+
replaceFlowRegistry: () => import_flow_registry.replaceFlowRegistry,
|
|
52
|
+
serializeFlowRegistry: () => import_flow_registry.serializeFlowRegistry,
|
|
50
53
|
setupRunJSContexts: () => import_setup.setupRunJSContexts
|
|
51
54
|
});
|
|
52
55
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -75,11 +78,13 @@ var import_snippets = require("./runjs-context/snippets");
|
|
|
75
78
|
__reExport(src_exports, require("./views"), module.exports);
|
|
76
79
|
var import_viewEvents = require("./views/viewEvents");
|
|
77
80
|
__reExport(src_exports, require("./FlowDefinition"), module.exports);
|
|
81
|
+
var import_flow_registry = require("./flow-registry");
|
|
78
82
|
var import_ViewScopedFlowEngine = require("./ViewScopedFlowEngine");
|
|
79
83
|
var import_BlockScopedFlowEngine = require("./BlockScopedFlowEngine");
|
|
80
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
85
|
0 && (module.exports = {
|
|
82
86
|
DATA_SOURCE_DIRTY_EVENT,
|
|
87
|
+
DetachedFlowRegistry,
|
|
83
88
|
ENGINE_SCOPE_KEY,
|
|
84
89
|
RunJSContextRegistry,
|
|
85
90
|
VIEW_ACTIVATED_EVENT,
|
|
@@ -99,6 +104,8 @@ var import_BlockScopedFlowEngine = require("./BlockScopedFlowEngine");
|
|
|
99
104
|
registerRunJSContextContribution,
|
|
100
105
|
registerRunJSLib,
|
|
101
106
|
registerRunJSSnippet,
|
|
107
|
+
replaceFlowRegistry,
|
|
108
|
+
serializeFlowRegistry,
|
|
102
109
|
setupRunJSContexts,
|
|
103
110
|
...require("./types"),
|
|
104
111
|
...require("./utils"),
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
type LazyComponentType<M extends Record<string, any>, K extends keyof M> = {
|
|
10
|
+
[P in K]: M[P];
|
|
11
|
+
};
|
|
12
|
+
export declare function lazy<M extends Record<'default', any>>(factory: () => Promise<M>): M['default'];
|
|
13
|
+
export declare function lazy<M extends Record<string, any>, K extends keyof M = keyof M>(factory: () => Promise<M>, ...componentNames: K[]): LazyComponentType<M, K>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
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 lazy_helper_exports = {};
|
|
39
|
+
__export(lazy_helper_exports, {
|
|
40
|
+
lazy: () => lazy
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(lazy_helper_exports);
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
function lazy(factory, ...componentNames) {
|
|
45
|
+
if (componentNames.length === 0) {
|
|
46
|
+
const LazyComponent = (0, import_react.lazy)(
|
|
47
|
+
() => factory().then((module2) => ({
|
|
48
|
+
default: module2.default
|
|
49
|
+
}))
|
|
50
|
+
);
|
|
51
|
+
const Component = /* @__PURE__ */ __name((props) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Suspense, { fallback: null }, /* @__PURE__ */ import_react.default.createElement(LazyComponent, { ...props })), "Component");
|
|
52
|
+
return Component;
|
|
53
|
+
}
|
|
54
|
+
return componentNames.reduce(
|
|
55
|
+
(acc, name) => {
|
|
56
|
+
const LazyComponent = (0, import_react.lazy)(
|
|
57
|
+
() => factory().then((module2) => ({
|
|
58
|
+
default: module2[name]
|
|
59
|
+
}))
|
|
60
|
+
);
|
|
61
|
+
acc[name] = (props) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Suspense, { fallback: null }, /* @__PURE__ */ import_react.default.createElement(LazyComponent, { ...props }));
|
|
62
|
+
return acc;
|
|
63
|
+
},
|
|
64
|
+
{}
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
__name(lazy, "lazy");
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
lazy
|
|
71
|
+
});
|
package/lib/locale/en-US.json
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"Failed to destroy model after creation error": "Failed to destroy model after creation error",
|
|
35
35
|
"Failed to get action {{action}}": "Failed to get action {{action}}",
|
|
36
36
|
"Failed to get configurable flows for model {{model}}": "Failed to get configurable flows for model {{model}}",
|
|
37
|
+
"Attributes are unavailable before selecting a record": "Attributes are unavailable before selecting a record",
|
|
37
38
|
"Failed to import FormDialog": "Failed to import FormDialog",
|
|
38
39
|
"Failed to import FormDialog or FormStep": "Failed to import FormDialog or FormStep",
|
|
39
40
|
"Failed to import Formily components": "Failed to import Formily components",
|
package/lib/locale/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export declare const locales: {
|
|
|
43
43
|
"Failed to destroy model after creation error": string;
|
|
44
44
|
"Failed to get action {{action}}": string;
|
|
45
45
|
"Failed to get configurable flows for model {{model}}": string;
|
|
46
|
+
"Attributes are unavailable before selecting a record": string;
|
|
46
47
|
"Failed to import FormDialog": string;
|
|
47
48
|
"Failed to import FormDialog or FormStep": string;
|
|
48
49
|
"Failed to import Formily components": string;
|
|
@@ -120,6 +121,7 @@ export declare const locales: {
|
|
|
120
121
|
"Failed to destroy model after creation error": string;
|
|
121
122
|
"Failed to get action {{action}}": string;
|
|
122
123
|
"Failed to get configurable flows for model {{model}}": string;
|
|
124
|
+
"Attributes are unavailable before selecting a record": string;
|
|
123
125
|
"Failed to import FormDialog": string;
|
|
124
126
|
"Failed to import FormDialog or FormStep": string;
|
|
125
127
|
"Failed to import Formily components": string;
|
package/lib/locale/zh-CN.json
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"Failed to destroy model after creation error": "创建错误后销毁模型失败",
|
|
32
32
|
"Failed to get action {{action}}": "获取 action '{{action}}' 失败",
|
|
33
33
|
"Failed to get configurable flows for model {{model}}": "获取模型 '{{model}}' 的可配置 flows 失败",
|
|
34
|
+
"Attributes are unavailable before selecting a record": "选择记录之前,当前项属性不可用",
|
|
34
35
|
"Failed to import FormDialog": "导入 FormDialog 失败",
|
|
35
36
|
"Failed to import FormDialog or FormStep": "导入 FormDialog 或 FormStep 失败",
|
|
36
37
|
"Failed to import Formily components": "导入 Formily 组件失败",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { DefaultStructure } from '
|
|
9
|
+
import type { DefaultStructure } from '../types';
|
|
10
10
|
import { CollectionFieldModel } from './CollectionFieldModel';
|
|
11
11
|
export declare class DisplayItemModel<T extends DefaultStructure = DefaultStructure> extends CollectionFieldModel<T> {
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { DefaultStructure } from '
|
|
9
|
+
import type { DefaultStructure } from '../types';
|
|
10
10
|
import { CollectionFieldModel } from './CollectionFieldModel';
|
|
11
11
|
export declare class EditableItemModel<T extends DefaultStructure = DefaultStructure> extends CollectionFieldModel<T> {
|
|
12
12
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { DefaultStructure } from '
|
|
9
|
+
import type { DefaultStructure } from '../types';
|
|
10
10
|
import { CollectionFieldModel } from './CollectionFieldModel';
|
|
11
11
|
export declare class FilterableItemModel<T extends DefaultStructure = DefaultStructure> extends CollectionFieldModel<T> {
|
|
12
12
|
}
|
|
@@ -13,6 +13,7 @@ import { FlowContext, FlowModelContext, FlowRuntimeContext } from '../flowContex
|
|
|
13
13
|
import { FlowEngine } from '../flowEngine';
|
|
14
14
|
import type { ActionDefinition, ArrayElementType, CreateModelOptions, CreateSubModelOptions, DefaultStructure, FlowDefinitionOptions, FlowModelMeta, FlowModelOptions, ModelConstructor, ParamObject, ParentFlowModel, PersistOptions, ResolveUseResult, StepParams } from '../types';
|
|
15
15
|
import { IModelComponentProps, ReadonlyModelProps } from '../types';
|
|
16
|
+
import type { MenuProps } from 'antd';
|
|
16
17
|
import { ModelActionRegistry } from '../action-registry/ModelActionRegistry';
|
|
17
18
|
import { ModelEventRegistry } from '../event-registry/ModelEventRegistry';
|
|
18
19
|
import { GlobalFlowRegistry } from '../flow-registry/GlobalFlowRegistry';
|
|
@@ -21,19 +22,20 @@ import { FlowSettingsOpenOptions } from '../flowSettings';
|
|
|
21
22
|
import type { ScheduleOptions } from '../scheduler/ModelOperationScheduler';
|
|
22
23
|
import type { DispatchEventOptions, EventDefinition } from '../types';
|
|
23
24
|
import { ForkFlowModel } from './forkFlowModel';
|
|
24
|
-
import type { MenuProps } from 'antd';
|
|
25
25
|
type BaseMenuItem = NonNullable<MenuProps['items']>[number];
|
|
26
|
-
type
|
|
27
|
-
|
|
28
|
-
}>;
|
|
29
|
-
export type FlowModelExtraMenuItem = Omit<MenuLeafItem, 'key'> & {
|
|
26
|
+
type MenuBaseItem = Omit<Exclude<BaseMenuItem, null>, 'key' | 'children'>;
|
|
27
|
+
export type FlowModelExtraMenuItem = MenuBaseItem & {
|
|
30
28
|
key: React.Key;
|
|
31
29
|
group?: string;
|
|
32
30
|
sort?: number;
|
|
31
|
+
label?: React.ReactNode;
|
|
32
|
+
disabled?: boolean;
|
|
33
33
|
onClick?: () => void;
|
|
34
|
+
children?: FlowModelExtraMenuItem[];
|
|
34
35
|
};
|
|
35
|
-
type FlowModelExtraMenuItemInput = Omit<FlowModelExtraMenuItem, 'key'> & {
|
|
36
|
+
type FlowModelExtraMenuItemInput = Omit<FlowModelExtraMenuItem, 'key' | 'children'> & {
|
|
36
37
|
key?: React.Key;
|
|
38
|
+
children?: FlowModelExtraMenuItemInput[];
|
|
37
39
|
};
|
|
38
40
|
type ExtraMenuItemEntry = {
|
|
39
41
|
group?: string;
|
|
@@ -239,6 +241,7 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
239
241
|
* 使用 lodash debounce 避免频繁调用
|
|
240
242
|
*/
|
|
241
243
|
private _rerunLastAutoRun;
|
|
244
|
+
private resetAutoRunState;
|
|
242
245
|
/**
|
|
243
246
|
* 通用事件分发钩子:开始
|
|
244
247
|
* 子类可覆盖;beforeRender 事件可通过抛出 FlowExitException 提前终止。
|
|
@@ -297,10 +300,10 @@ export declare class FlowModel<Structure extends DefaultStructure = DefaultStruc
|
|
|
297
300
|
removeParentDelegate(): void;
|
|
298
301
|
addSubModel<T extends FlowModel>(subKey: string, options: CreateModelOptions | T): T;
|
|
299
302
|
setSubModel(subKey: string, options: CreateModelOptions | FlowModel): FlowModel<DefaultStructure>;
|
|
300
|
-
filterSubModels<K extends keyof Structure['subModels']
|
|
301
|
-
mapSubModels<K extends keyof Structure['subModels']
|
|
302
|
-
hasSubModel<K extends keyof Structure['subModels']
|
|
303
|
-
findSubModel<K extends keyof Structure['subModels']
|
|
303
|
+
filterSubModels<K extends keyof NonNullable<Structure['subModels']>, R>(subKey: K, callback: (model: ArrayElementType<NonNullable<Structure['subModels']>[K]>, index: number) => boolean): ArrayElementType<NonNullable<Structure['subModels']>[K]>[];
|
|
304
|
+
mapSubModels<K extends keyof NonNullable<Structure['subModels']>, R>(subKey: K, callback: (model: ArrayElementType<NonNullable<Structure['subModels']>[K]>, index: number) => R): R[];
|
|
305
|
+
hasSubModel<K extends keyof NonNullable<Structure['subModels']>>(subKey: K): boolean;
|
|
306
|
+
findSubModel<K extends keyof NonNullable<Structure['subModels']>, R>(subKey: K, callback: (model: ArrayElementType<NonNullable<Structure['subModels']>[K]>) => R): ArrayElementType<NonNullable<Structure['subModels']>[K]> | null;
|
|
304
307
|
createRootModel(options: any): FlowModel<DefaultStructure>;
|
|
305
308
|
/**
|
|
306
309
|
* 对指定子模型派发 beforeRender 事件(顺序执行并使用缓存)。
|