@nocobase/flow-engine 2.1.0-alpha.3 → 2.1.0-alpha.30
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 -10
- package/lib/JSRunner.d.ts +10 -1
- package/lib/JSRunner.js +50 -5
- package/lib/ViewScopedFlowEngine.js +5 -1
- 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/MobilePopup.js +6 -5
- package/lib/components/dnd/gridDragPlanner.d.ts +59 -2
- package/lib/components/dnd/gridDragPlanner.js +601 -21
- package/lib/components/dnd/index.d.ts +19 -1
- package/lib/components/dnd/index.js +243 -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 +68 -10
- 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/StepSettingsDialog.js +16 -2
- 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 +27 -1
- package/lib/components/subModel/index.d.ts +1 -0
- package/lib/components/subModel/index.js +19 -0
- package/lib/components/subModel/utils.d.ts +1 -1
- package/lib/components/subModel/utils.js +2 -2
- package/lib/data-source/index.d.ts +73 -0
- package/lib/data-source/index.js +211 -1
- package/lib/executor/FlowExecutor.js +31 -8
- package/lib/flowContext.d.ts +2 -0
- package/lib/flowContext.js +31 -1
- package/lib/flowEngine.d.ts +151 -1
- package/lib/flowEngine.js +389 -15
- package/lib/flowI18n.js +2 -1
- package/lib/flowSettings.d.ts +14 -6
- package/lib/flowSettings.js +34 -6
- 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 +78 -18
- package/lib/provider.js +38 -23
- package/lib/reactive/observer.js +46 -16
- package/lib/runjs-context/registry.d.ts +1 -1
- package/lib/runjs-context/setup.js +20 -12
- 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/scheduler/ModelOperationScheduler.d.ts +5 -1
- package/lib/scheduler/ModelOperationScheduler.js +3 -2
- package/lib/types.d.ts +47 -1
- package/lib/utils/createCollectionContextMeta.js +6 -2
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +4 -0
- package/lib/utils/parsePathnameToViewParams.js +1 -1
- 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/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 +20 -3
- package/lib/views/useDrawer.d.ts +2 -1
- package/lib/views/useDrawer.js +20 -3
- package/lib/views/usePage.d.ts +2 -1
- package/lib/views/usePage.js +10 -3
- package/package.json +6 -5
- package/src/JSRunner.ts +68 -4
- package/src/ViewScopedFlowEngine.ts +4 -0
- package/src/__tests__/JSRunner.test.ts +27 -1
- package/src/__tests__/flow-engine.test.ts +166 -0
- package/src/__tests__/flowContext.test.ts +65 -1
- package/src/__tests__/flowEngine.modelLoaders.test.ts +245 -0
- 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 +16 -0
- package/src/__tests__/runjsContextRuntime.test.ts +2 -0
- package/src/__tests__/runjsPreprocessDefault.test.ts +23 -0
- package/src/__tests__/runjsSnippets.test.ts +21 -0
- package/src/__tests__/viewScopedFlowEngine.test.ts +3 -3
- package/src/components/FieldModelRenderer.tsx +2 -1
- package/src/components/FlowModelRenderer.tsx +18 -6
- package/src/components/MobilePopup.tsx +4 -2
- package/src/components/__tests__/FlowModelRenderer.test.tsx +65 -2
- 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 +512 -3
- package/src/components/dnd/__tests__/DndProvider.test.tsx +98 -0
- package/src/components/dnd/gridDragPlanner.ts +743 -19
- package/src/components/dnd/index.tsx +291 -27
- package/src/components/settings/wrappers/component/SelectWithTitle.tsx +21 -9
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +88 -10
- package/src/components/settings/wrappers/contextual/FlowsFloatContextMenu.tsx +487 -440
- package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +18 -2
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +189 -3
- 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 +32 -2
- package/src/components/subModel/__tests__/AddSubModelButton.test.tsx +142 -32
- package/src/components/subModel/index.ts +1 -0
- package/src/components/subModel/utils.ts +1 -1
- package/src/data-source/__tests__/index.test.ts +34 -1
- package/src/data-source/index.ts +258 -2
- package/src/executor/FlowExecutor.ts +34 -9
- package/src/executor/__tests__/flowExecutor.test.ts +57 -0
- package/src/flowContext.ts +37 -3
- package/src/flowEngine.ts +445 -11
- package/src/flowI18n.ts +2 -1
- package/src/flowSettings.ts +40 -6
- 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__/dispatchEvent.when.test.ts +214 -0
- package/src/models/__tests__/flowModel.test.ts +19 -3
- package/src/models/flowModel.tsx +119 -33
- 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/registry.ts +1 -1
- package/src/runjs-context/setup.ts +22 -12
- 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/scheduler/ModelOperationScheduler.ts +14 -3
- package/src/types.ts +60 -0
- package/src/utils/__tests__/createCollectionContextMeta.test.ts +48 -0
- package/src/utils/__tests__/parsePathnameToViewParams.test.ts +7 -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 +2 -1
- package/src/utils/parsePathnameToViewParams.ts +2 -2
- 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 +11 -1
- package/src/views/__tests__/runViewBeforeClose.test.ts +30 -0
- package/src/views/__tests__/useDialog.closeDestroy.test.tsx +13 -12
- package/src/views/runViewBeforeClose.ts +19 -0
- package/src/views/useDialog.tsx +25 -3
- package/src/views/useDrawer.tsx +25 -3
- package/src/views/usePage.tsx +12 -3
|
@@ -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 事件(顺序执行并使用缓存)。
|
package/lib/models/flowModel.js
CHANGED
|
@@ -56,25 +56,68 @@ var import_reactive = require("@formily/reactive");
|
|
|
56
56
|
var import_lodash = __toESM(require("lodash"));
|
|
57
57
|
var import_react = __toESM(require("react"));
|
|
58
58
|
var import_secure = require("uid/secure");
|
|
59
|
-
var import_StepRequiredSettingsDialog = require("../components/settings/wrappers/contextual/StepRequiredSettingsDialog");
|
|
60
|
-
var import_StepSettingsDialog = require("../components/settings/wrappers/contextual/StepSettingsDialog");
|
|
61
59
|
var import_emitter = require("../emitter");
|
|
62
60
|
var import_InstanceFlowRegistry = require("../flow-registry/InstanceFlowRegistry");
|
|
63
61
|
var import_flowContext = require("../flowContext");
|
|
64
62
|
var import_utils = require("../utils");
|
|
65
|
-
var
|
|
63
|
+
var import_antd = require("antd");
|
|
64
|
+
var import__ = require("..");
|
|
66
65
|
var import_ModelActionRegistry = require("../action-registry/ModelActionRegistry");
|
|
67
66
|
var import_utils2 = require("../components/subModel/utils");
|
|
68
67
|
var import_ModelEventRegistry = require("../event-registry/ModelEventRegistry");
|
|
69
68
|
var import_GlobalFlowRegistry = require("../flow-registry/GlobalFlowRegistry");
|
|
70
69
|
var import_forkFlowModel = require("./forkFlowModel");
|
|
71
|
-
var import__ = require("..");
|
|
72
70
|
var _flowContext;
|
|
73
71
|
const classActionRegistries = /* @__PURE__ */ new WeakMap();
|
|
74
72
|
const classEventRegistries = /* @__PURE__ */ new WeakMap();
|
|
75
73
|
const modelMetas = /* @__PURE__ */ new WeakMap();
|
|
76
74
|
const modelGlobalRegistries = /* @__PURE__ */ new WeakMap();
|
|
77
75
|
const classMenuExtensions = /* @__PURE__ */ new WeakMap();
|
|
76
|
+
const sortExtraMenuItems = /* @__PURE__ */ __name((items) => {
|
|
77
|
+
return [...items].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
|
78
|
+
}, "sortExtraMenuItems");
|
|
79
|
+
const isFlowModelExtraMenuItem = /* @__PURE__ */ __name((item) => {
|
|
80
|
+
return item !== null;
|
|
81
|
+
}, "isFlowModelExtraMenuItem");
|
|
82
|
+
const normalizeExtraMenuItem = /* @__PURE__ */ __name((item, {
|
|
83
|
+
group,
|
|
84
|
+
sort,
|
|
85
|
+
prefix,
|
|
86
|
+
path
|
|
87
|
+
}) => {
|
|
88
|
+
if (!item) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const normalizedGroup = item.group || group;
|
|
92
|
+
const normalizedSort = typeof item.sort === "number" ? item.sort : sort;
|
|
93
|
+
const normalizedChildren = sortExtraMenuItems(
|
|
94
|
+
(item.children || []).map(
|
|
95
|
+
(child, index) => normalizeExtraMenuItem(child, {
|
|
96
|
+
group: normalizedGroup,
|
|
97
|
+
sort: normalizedSort,
|
|
98
|
+
prefix,
|
|
99
|
+
path: `${path}-${index}`
|
|
100
|
+
})
|
|
101
|
+
).filter(isFlowModelExtraMenuItem)
|
|
102
|
+
);
|
|
103
|
+
return {
|
|
104
|
+
...item,
|
|
105
|
+
key: item.key ?? `${prefix}-${normalizedGroup}-${path}`,
|
|
106
|
+
group: normalizedGroup,
|
|
107
|
+
sort: normalizedSort,
|
|
108
|
+
children: normalizedChildren.length ? normalizedChildren : void 0
|
|
109
|
+
};
|
|
110
|
+
}, "normalizeExtraMenuItem");
|
|
111
|
+
async function loadOpenStepSettingsDialog() {
|
|
112
|
+
const mod = await import("../components/settings/wrappers/contextual/StepSettingsDialog");
|
|
113
|
+
return mod.openStepSettingsDialog;
|
|
114
|
+
}
|
|
115
|
+
__name(loadOpenStepSettingsDialog, "loadOpenStepSettingsDialog");
|
|
116
|
+
async function loadOpenRequiredParamsStepFormDialog() {
|
|
117
|
+
const mod = await import("../components/settings/wrappers/contextual/StepRequiredSettingsDialog");
|
|
118
|
+
return mod.openRequiredParamsStepFormDialog;
|
|
119
|
+
}
|
|
120
|
+
__name(loadOpenRequiredParamsStepFormDialog, "loadOpenRequiredParamsStepFormDialog");
|
|
78
121
|
var ModelRenderMode = /* @__PURE__ */ ((ModelRenderMode2) => {
|
|
79
122
|
ModelRenderMode2["ReactElement"] = "reactElement";
|
|
80
123
|
ModelRenderMode2["RenderFunction"] = "renderFunction";
|
|
@@ -183,10 +226,13 @@ const _FlowModel = class _FlowModel {
|
|
|
183
226
|
if (changed.type === "set" && import_lodash.default.isEqual(changed.value, changed.oldValue)) {
|
|
184
227
|
return;
|
|
185
228
|
}
|
|
229
|
+
const hasLastAutoRun = !!this._lastAutoRunParams;
|
|
186
230
|
if (this.flowEngine) {
|
|
187
231
|
this.invalidateFlowCache("beforeRender");
|
|
188
232
|
}
|
|
189
|
-
|
|
233
|
+
if (hasLastAutoRun) {
|
|
234
|
+
this._rerunLastAutoRun();
|
|
235
|
+
}
|
|
190
236
|
this.forks.forEach((fork) => {
|
|
191
237
|
fork.rerender();
|
|
192
238
|
});
|
|
@@ -576,6 +622,7 @@ const _FlowModel = class _FlowModel {
|
|
|
576
622
|
} else {
|
|
577
623
|
this.props = { ...this.props, ...props };
|
|
578
624
|
}
|
|
625
|
+
this._options.props = { ...this.props };
|
|
579
626
|
}
|
|
580
627
|
getProps() {
|
|
581
628
|
return this.props;
|
|
@@ -674,6 +721,11 @@ const _FlowModel = class _FlowModel {
|
|
|
674
721
|
}, "isMatch");
|
|
675
722
|
return Array.from(allFlows.values()).filter(isMatch);
|
|
676
723
|
}
|
|
724
|
+
resetAutoRunState() {
|
|
725
|
+
var _a, _b;
|
|
726
|
+
(_b = (_a = this._rerunLastAutoRun) == null ? void 0 : _a.cancel) == null ? void 0 : _b.call(_a);
|
|
727
|
+
this._lastAutoRunParams = null;
|
|
728
|
+
}
|
|
677
729
|
/**
|
|
678
730
|
* 通用事件分发钩子:开始
|
|
679
731
|
* 子类可覆盖;beforeRender 事件可通过抛出 FlowExitException 提前终止。
|
|
@@ -763,6 +815,7 @@ const _FlowModel = class _FlowModel {
|
|
|
763
815
|
}));
|
|
764
816
|
return () => {
|
|
765
817
|
var _a3, _b3;
|
|
818
|
+
renderTarget.resetAutoRunState();
|
|
766
819
|
if (typeof renderTarget.onUnmount === "function") {
|
|
767
820
|
renderTarget.onUnmount();
|
|
768
821
|
}
|
|
@@ -1058,7 +1111,7 @@ const _FlowModel = class _FlowModel {
|
|
|
1058
1111
|
* @param {string} stepKey 步骤的唯一标识符
|
|
1059
1112
|
* @returns {void}
|
|
1060
1113
|
*/
|
|
1061
|
-
openStepSettingsDialog(flowKey, stepKey) {
|
|
1114
|
+
async openStepSettingsDialog(flowKey, stepKey) {
|
|
1062
1115
|
var _a;
|
|
1063
1116
|
const flow = this.getFlow(flowKey);
|
|
1064
1117
|
const step = (_a = flow == null ? void 0 : flow.steps) == null ? void 0 : _a[stepKey];
|
|
@@ -1069,7 +1122,8 @@ const _FlowModel = class _FlowModel {
|
|
|
1069
1122
|
const ctx = new import_flowContext.FlowRuntimeContext(this, flowKey, "settings");
|
|
1070
1123
|
(0, import_utils.setupRuntimeContextSteps)(ctx, flow.steps, this, flowKey);
|
|
1071
1124
|
ctx.defineProperty("currentStep", { value: step });
|
|
1072
|
-
|
|
1125
|
+
const openStepSettingsDialog = await loadOpenStepSettingsDialog();
|
|
1126
|
+
return openStepSettingsDialog({
|
|
1073
1127
|
model: this,
|
|
1074
1128
|
flowKey,
|
|
1075
1129
|
stepKey,
|
|
@@ -1084,7 +1138,8 @@ const _FlowModel = class _FlowModel {
|
|
|
1084
1138
|
* @returns {Promise<any>} 返回表单提交的值
|
|
1085
1139
|
*/
|
|
1086
1140
|
async configureRequiredSteps(dialogWidth, dialogTitle) {
|
|
1087
|
-
|
|
1141
|
+
const openRequiredParamsStepFormDialog = await loadOpenRequiredParamsStepFormDialog();
|
|
1142
|
+
return openRequiredParamsStepFormDialog({
|
|
1088
1143
|
model: this,
|
|
1089
1144
|
dialogWidth,
|
|
1090
1145
|
dialogTitle
|
|
@@ -1109,6 +1164,7 @@ const _FlowModel = class _FlowModel {
|
|
|
1109
1164
|
const data = {
|
|
1110
1165
|
uid: this.uid,
|
|
1111
1166
|
...import_lodash.default.omit(this._options, ["flowEngine"]),
|
|
1167
|
+
props: { ...this.props },
|
|
1112
1168
|
stepParams: this.stepParams,
|
|
1113
1169
|
sortIndex: this.sortIndex,
|
|
1114
1170
|
flowRegistry: {}
|
|
@@ -1221,22 +1277,26 @@ const _FlowModel = class _FlowModel {
|
|
|
1221
1277
|
seen.add(Cls);
|
|
1222
1278
|
const reg = classMenuExtensions.get(Cls);
|
|
1223
1279
|
if (reg) {
|
|
1280
|
+
let entryIndex = 0;
|
|
1224
1281
|
for (const entry of reg) {
|
|
1225
1282
|
if (entry.matcher && !entry.matcher(model)) continue;
|
|
1226
1283
|
const items = typeof entry.items === "function" ? await entry.items(model, t) : await Promise.resolve(entry.items || []);
|
|
1227
1284
|
const group = entry.group || "common-actions";
|
|
1228
1285
|
const sort = entry.sort ?? 0;
|
|
1229
1286
|
const prefix = entry.keyPrefix || Cls.name || "extra";
|
|
1230
|
-
(
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1287
|
+
sortExtraMenuItems(
|
|
1288
|
+
(items || []).map(
|
|
1289
|
+
(it, idx) => normalizeExtraMenuItem(it, {
|
|
1290
|
+
group,
|
|
1291
|
+
sort,
|
|
1292
|
+
prefix,
|
|
1293
|
+
path: `${entryIndex}-${idx}`
|
|
1294
|
+
})
|
|
1295
|
+
).filter(isFlowModelExtraMenuItem)
|
|
1296
|
+
).forEach((it) => {
|
|
1297
|
+
collected.push(it);
|
|
1239
1298
|
});
|
|
1299
|
+
entryIndex += 1;
|
|
1240
1300
|
}
|
|
1241
1301
|
}
|
|
1242
1302
|
const ParentClass = Object.getPrototypeOf(Cls);
|
|
@@ -1303,7 +1363,7 @@ const _ErrorFlowModel = class _ErrorFlowModel extends FlowModel {
|
|
|
1303
1363
|
this.errorMessage = msg;
|
|
1304
1364
|
}
|
|
1305
1365
|
render() {
|
|
1306
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
1366
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Typography.Text, { type: "danger" }, this.errorMessage);
|
|
1307
1367
|
}
|
|
1308
1368
|
};
|
|
1309
1369
|
__name(_ErrorFlowModel, "ErrorFlowModel");
|
package/lib/provider.js
CHANGED
|
@@ -67,31 +67,46 @@ const FlowEngineGlobalsContextProvider = /* @__PURE__ */ __name(({ children }) =
|
|
|
67
67
|
const engine = useFlowEngine();
|
|
68
68
|
const config = (0, import_react.useContext)(import_antd.ConfigProvider.ConfigContext);
|
|
69
69
|
const { token } = import_antd.theme.useToken();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
const isDarkTheme = import_react.default.useMemo(() => {
|
|
71
|
+
var _a2;
|
|
72
|
+
const algorithm = (_a2 = config == null ? void 0 : config.theme) == null ? void 0 : _a2.algorithm;
|
|
73
|
+
if (Array.isArray(algorithm)) {
|
|
74
|
+
return algorithm.includes(import_antd.theme.darkAlgorithm);
|
|
75
|
+
}
|
|
76
|
+
return algorithm === import_antd.theme.darkAlgorithm;
|
|
77
|
+
}, [config]);
|
|
78
|
+
engine.context.defineProperty("viewer", {
|
|
79
|
+
cache: false,
|
|
80
|
+
get: /* @__PURE__ */ __name((ctx) => new import_FlowView.FlowViewer(ctx, { drawer, embed, popover, dialog }), "get")
|
|
81
|
+
});
|
|
82
|
+
for (const item of Object.entries({
|
|
83
|
+
antdConfig: config,
|
|
84
|
+
modal,
|
|
85
|
+
message,
|
|
86
|
+
notification
|
|
87
|
+
})) {
|
|
88
|
+
const [key, value] = item;
|
|
89
|
+
if (value) {
|
|
90
|
+
engine.context.defineProperty(key, { value });
|
|
87
91
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
}
|
|
93
|
+
engine.context.defineProperty("themeToken", {
|
|
94
|
+
get: /* @__PURE__ */ __name(() => token, "get"),
|
|
95
|
+
observable: true,
|
|
96
|
+
cache: true
|
|
97
|
+
});
|
|
98
|
+
engine.context.defineProperty("isDarkTheme", {
|
|
99
|
+
get: /* @__PURE__ */ __name(() => isDarkTheme, "get"),
|
|
100
|
+
observable: true,
|
|
101
|
+
cache: true,
|
|
102
|
+
info: {
|
|
103
|
+
description: "Whether current theme algorithm is dark mode.",
|
|
104
|
+
detail: "boolean"
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
(0, import_react.useEffect)(() => {
|
|
93
108
|
engine.reactView.refresh();
|
|
94
|
-
}, [engine, drawer, modal, message, notification, config, popover, token, dialog, embed]);
|
|
109
|
+
}, [engine, drawer, modal, message, notification, config, popover, token, dialog, embed, isDarkTheme]);
|
|
95
110
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.ConfigProvider, { ...config, locale: (_a = engine.context.locales) == null ? void 0 : _a.antd, popupMatchSelectWidth: false }, children, contextHolder, popoverContextHolder, pageContextHolder, dialogContextHolder);
|
|
96
111
|
}, "FlowEngineGlobalsContextProvider");
|
|
97
112
|
const useFlowEngine = /* @__PURE__ */ __name(({ throwError = true } = {}) => {
|
package/lib/reactive/observer.js
CHANGED
|
@@ -51,8 +51,31 @@ const observer = /* @__PURE__ */ __name((Component, options) => {
|
|
|
51
51
|
const ctxRef = (0, import_react.useRef)(ctx);
|
|
52
52
|
ctxRef.current = ctx;
|
|
53
53
|
const pendingDisposerRef = (0, import_react.useRef)(null);
|
|
54
|
+
const pendingTimerRef = (0, import_react.useRef)(null);
|
|
55
|
+
const clearPendingDisposer = /* @__PURE__ */ __name(() => {
|
|
56
|
+
if (pendingDisposerRef.current) {
|
|
57
|
+
pendingDisposerRef.current();
|
|
58
|
+
pendingDisposerRef.current = null;
|
|
59
|
+
}
|
|
60
|
+
}, "clearPendingDisposer");
|
|
61
|
+
const clearPendingTimer = /* @__PURE__ */ __name(() => {
|
|
62
|
+
if (pendingTimerRef.current) {
|
|
63
|
+
clearTimeout(pendingTimerRef.current);
|
|
64
|
+
pendingTimerRef.current = null;
|
|
65
|
+
}
|
|
66
|
+
}, "clearPendingTimer");
|
|
67
|
+
const isContextActive = /* @__PURE__ */ __name(() => {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const pageActive = getPageActive(ctxRef.current);
|
|
70
|
+
const tabActive = (_b = (_a = ctxRef.current) == null ? void 0 : _a.tabActive) == null ? void 0 : _b.value;
|
|
71
|
+
return pageActive !== false && tabActive !== false;
|
|
72
|
+
}, "isContextActive");
|
|
54
73
|
(0, import_react.useEffect)(() => {
|
|
55
74
|
return () => {
|
|
75
|
+
if (pendingTimerRef.current) {
|
|
76
|
+
clearTimeout(pendingTimerRef.current);
|
|
77
|
+
pendingTimerRef.current = null;
|
|
78
|
+
}
|
|
56
79
|
if (pendingDisposerRef.current) {
|
|
57
80
|
pendingDisposerRef.current();
|
|
58
81
|
pendingDisposerRef.current = null;
|
|
@@ -62,30 +85,37 @@ const observer = /* @__PURE__ */ __name((Component, options) => {
|
|
|
62
85
|
const ObservedComponent = (0, import_react.useMemo)(
|
|
63
86
|
() => (0, import_reactive_react.observer)(Component, {
|
|
64
87
|
scheduler(updater) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
setTimeout(() => {
|
|
88
|
+
if (!isContextActive()) {
|
|
89
|
+
if (pendingTimerRef.current || pendingDisposerRef.current) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
pendingTimerRef.current = setTimeout(() => {
|
|
93
|
+
pendingTimerRef.current = null;
|
|
70
94
|
if (pendingDisposerRef.current) {
|
|
71
95
|
return;
|
|
72
96
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
97
|
+
if (isContextActive()) {
|
|
98
|
+
updater();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
pendingDisposerRef.current = (0, import_reactive.reaction)(
|
|
102
|
+
() => isContextActive(),
|
|
103
|
+
(active) => {
|
|
104
|
+
if (!active) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
clearPendingDisposer();
|
|
76
108
|
updater();
|
|
77
|
-
|
|
78
|
-
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: "FlowObserverPendingUpdate"
|
|
79
112
|
}
|
|
80
|
-
|
|
81
|
-
pendingDisposerRef.current = disposer;
|
|
113
|
+
);
|
|
82
114
|
});
|
|
83
115
|
return;
|
|
84
116
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
pendingDisposerRef.current = null;
|
|
88
|
-
}
|
|
117
|
+
clearPendingTimer();
|
|
118
|
+
clearPendingDisposer();
|
|
89
119
|
updater();
|
|
90
120
|
},
|
|
91
121
|
...options
|
|
@@ -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
|
-
export type RunJSVersion = 'v1' | (string & {});
|
|
9
|
+
export type RunJSVersion = 'v1' | 'v2' | (string & {});
|
|
10
10
|
export type RunJSContextCtor = new (delegate: any) => any;
|
|
11
11
|
export type RunJSContextMeta = {
|
|
12
12
|
scenes?: string[];
|
|
@@ -67,19 +67,27 @@ async function setupRunJSContexts() {
|
|
|
67
67
|
import("./contexts/JSRecordActionRunJSContext"),
|
|
68
68
|
import("./contexts/JSCollectionActionRunJSContext")
|
|
69
69
|
]);
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
const registerBuiltins = /* @__PURE__ */ __name((version) => {
|
|
71
|
+
import_registry.RunJSContextRegistry.register(version, "*", import_flowContext.FlowRunJSContext);
|
|
72
|
+
import_registry.RunJSContextRegistry.register(version, "JSBlockModel", JSBlockRunJSContext, { scenes: ["block"] });
|
|
73
|
+
import_registry.RunJSContextRegistry.register(version, "JSFieldModel", JSFieldRunJSContext, { scenes: ["detail"] });
|
|
74
|
+
import_registry.RunJSContextRegistry.register(version, "JSEditableFieldModel", JSEditableFieldRunJSContext, { scenes: ["form"] });
|
|
75
|
+
import_registry.RunJSContextRegistry.register(version, "JSItemModel", JSItemRunJSContext, { scenes: ["form"] });
|
|
76
|
+
import_registry.RunJSContextRegistry.register(version, "JSItemActionModel", JSItemRunJSContext, { scenes: ["table"] });
|
|
77
|
+
import_registry.RunJSContextRegistry.register(version, "JSColumnModel", JSColumnRunJSContext, { scenes: ["table"] });
|
|
78
|
+
import_registry.RunJSContextRegistry.register(version, "FormJSFieldItemModel", FormJSFieldItemRunJSContext, { scenes: ["form"] });
|
|
79
|
+
import_registry.RunJSContextRegistry.register(version, "JSRecordActionModel", JSRecordActionRunJSContext, { scenes: ["table"] });
|
|
80
|
+
import_registry.RunJSContextRegistry.register(version, "JSCollectionActionModel", JSCollectionActionRunJSContext, {
|
|
81
|
+
scenes: ["table"]
|
|
82
|
+
});
|
|
83
|
+
}, "registerBuiltins");
|
|
84
|
+
const versions = ["v1", "v2"];
|
|
85
|
+
for (const version of versions) {
|
|
86
|
+
registerBuiltins(version);
|
|
87
|
+
await (0, import_contributions.applyRunJSContextContributions)(version);
|
|
88
|
+
(0, import_contributions.markRunJSContextsSetupDone)(version);
|
|
89
|
+
}
|
|
81
90
|
done = true;
|
|
82
|
-
(0, import_contributions.markRunJSContextsSetupDone)(v1);
|
|
83
91
|
}
|
|
84
92
|
__name(setupRunJSContexts, "setupRunJSContexts");
|
|
85
93
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -81,6 +81,7 @@ const snippets = {
|
|
|
81
81
|
"scene/detail/status-tag": /* @__PURE__ */ __name(() => import("./scene/detail/status-tag.snippet"), "scene/detail/status-tag"),
|
|
82
82
|
"scene/detail/relative-time": /* @__PURE__ */ __name(() => import("./scene/detail/relative-time.snippet"), "scene/detail/relative-time"),
|
|
83
83
|
"scene/detail/percentage-bar": /* @__PURE__ */ __name(() => import("./scene/detail/percentage-bar.snippet"), "scene/detail/percentage-bar"),
|
|
84
|
+
"scene/detail/set-field-style": /* @__PURE__ */ __name(() => import("./scene/detail/set-field-style.snippet"), "scene/detail/set-field-style"),
|
|
84
85
|
// scene/form
|
|
85
86
|
"scene/form/render-basic": /* @__PURE__ */ __name(() => import("./scene/form/render-basic.snippet"), "scene/form/render-basic"),
|
|
86
87
|
"scene/form/set-field-value": /* @__PURE__ */ __name(() => import("./scene/form/set-field-value.snippet"), "scene/form/set-field-value"),
|
|
@@ -98,7 +99,8 @@ const snippets = {
|
|
|
98
99
|
"scene/table/collection-selected-count": /* @__PURE__ */ __name(() => import("./scene/table/collection-selected-count.snippet"), "scene/table/collection-selected-count"),
|
|
99
100
|
"scene/table/iterate-selected-rows": /* @__PURE__ */ __name(() => import("./scene/table/iterate-selected-rows.snippet"), "scene/table/iterate-selected-rows"),
|
|
100
101
|
"scene/table/destroy-selected": /* @__PURE__ */ __name(() => import("./scene/table/destroy-selected.snippet"), "scene/table/destroy-selected"),
|
|
101
|
-
"scene/table/export-selected-json": /* @__PURE__ */ __name(() => import("./scene/table/export-selected-json.snippet"), "scene/table/export-selected-json")
|
|
102
|
+
"scene/table/export-selected-json": /* @__PURE__ */ __name(() => import("./scene/table/export-selected-json.snippet"), "scene/table/export-selected-json"),
|
|
103
|
+
"scene/table/set-cell-style": /* @__PURE__ */ __name(() => import("./scene/table/set-cell-style.snippet"), "scene/table/set-cell-style")
|
|
102
104
|
};
|
|
103
105
|
var snippets_default = snippets;
|
|
104
106
|
function registerRunJSSnippet(ref, loader, options) {
|
|
@@ -131,10 +133,19 @@ function normalizeScenes(def, key) {
|
|
|
131
133
|
return [];
|
|
132
134
|
}
|
|
133
135
|
__name(normalizeScenes, "normalizeScenes");
|
|
136
|
+
function normalizeSceneGroup(scene) {
|
|
137
|
+
const mapping = {
|
|
138
|
+
detailFieldEvent: "detail",
|
|
139
|
+
tableFieldEvent: "table",
|
|
140
|
+
formFieldEvent: "form"
|
|
141
|
+
};
|
|
142
|
+
return mapping[scene] || scene;
|
|
143
|
+
}
|
|
144
|
+
__name(normalizeSceneGroup, "normalizeSceneGroup");
|
|
134
145
|
function computeGroups(def, key) {
|
|
135
146
|
const scenes = normalizeScenes(def, key);
|
|
136
147
|
if (scenes.length) {
|
|
137
|
-
return scenes.map((scene) => `scene/${scene}`);
|
|
148
|
+
return Array.from(new Set(scenes.map((scene) => `scene/${normalizeSceneGroup(scene)}`)));
|
|
138
149
|
}
|
|
139
150
|
const parts = key.split("/");
|
|
140
151
|
if (!parts.length) return [];
|