@nocobase/flow-engine 2.1.0-alpha.1 → 2.1.0-alpha.3
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/BlockScopedFlowEngine.js +0 -1
- package/lib/FlowDefinition.d.ts +2 -0
- package/lib/JSRunner.d.ts +6 -0
- package/lib/JSRunner.js +32 -2
- package/lib/ViewScopedFlowEngine.js +3 -0
- package/lib/acl/Acl.js +13 -3
- package/lib/components/FlowContextSelector.js +155 -10
- package/lib/components/dnd/gridDragPlanner.d.ts +1 -0
- package/lib/components/dnd/gridDragPlanner.js +53 -1
- package/lib/components/settings/wrappers/component/SwitchWithTitle.js +2 -1
- package/lib/components/settings/wrappers/contextual/DefaultSettingsIcon.js +76 -15
- package/lib/components/settings/wrappers/contextual/FlowsContextMenu.js +24 -4
- package/lib/components/settings/wrappers/contextual/StepSettingsDialog.js +5 -1
- package/lib/components/variables/VariableInput.js +9 -4
- package/lib/components/variables/VariableTag.js +46 -39
- package/lib/components/variables/utils.d.ts +7 -0
- package/lib/components/variables/utils.js +42 -2
- package/lib/data-source/index.d.ts +7 -27
- package/lib/data-source/index.js +84 -51
- package/lib/executor/FlowExecutor.d.ts +2 -1
- package/lib/executor/FlowExecutor.js +163 -22
- package/lib/flowContext.d.ts +230 -7
- package/lib/flowContext.js +2267 -148
- package/lib/flowEngine.d.ts +21 -0
- package/lib/flowEngine.js +55 -13
- package/lib/flowI18n.js +6 -4
- package/lib/flowSettings.js +17 -11
- package/lib/index.d.ts +7 -1
- package/lib/index.js +21 -0
- package/lib/locale/en-US.json +9 -2
- package/lib/locale/index.d.ts +14 -0
- package/lib/locale/zh-CN.json +8 -1
- package/lib/models/CollectionFieldModel.d.ts +1 -0
- package/lib/models/CollectionFieldModel.js +3 -2
- package/lib/models/flowModel.d.ts +7 -0
- package/lib/models/flowModel.js +66 -1
- package/lib/provider.js +7 -6
- package/lib/resources/baseRecordResource.d.ts +5 -0
- package/lib/resources/baseRecordResource.js +24 -0
- package/lib/resources/multiRecordResource.d.ts +1 -0
- package/lib/resources/multiRecordResource.js +11 -4
- package/lib/resources/singleRecordResource.js +2 -0
- package/lib/resources/sqlResource.d.ts +4 -3
- package/lib/resources/sqlResource.js +8 -3
- package/lib/runjs-context/contexts/FormJSFieldItemRunJSContext.js +12 -2
- package/lib/runjs-context/contexts/JSBlockRunJSContext.js +2 -2
- package/lib/runjs-context/contexts/JSEditableFieldRunJSContext.d.ts +16 -0
- package/lib/runjs-context/contexts/JSEditableFieldRunJSContext.js +125 -0
- package/lib/runjs-context/contexts/JSItemRunJSContext.js +12 -2
- package/lib/runjs-context/contexts/base.js +706 -41
- package/lib/runjs-context/contributions.d.ts +33 -0
- package/lib/runjs-context/contributions.js +88 -0
- package/lib/runjs-context/helpers.js +12 -1
- package/lib/runjs-context/setup.js +6 -0
- package/lib/runjs-context/snippets/global/api-request.snippet.js +3 -3
- package/lib/runjs-context/snippets/global/import-esm.snippet.js +2 -3
- package/lib/runjs-context/snippets/global/query-selector.snippet.js +8 -3
- package/lib/runjs-context/snippets/global/require-amd.snippet.js +1 -1
- package/lib/runjs-context/snippets/index.d.ts +11 -1
- package/lib/runjs-context/snippets/index.js +61 -40
- package/lib/runjs-context/snippets/scene/block/add-event-listener.snippet.js +10 -7
- package/lib/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.js +3 -3
- package/lib/runjs-context/snippets/scene/block/chartjs-bar.snippet.js +2 -2
- package/lib/runjs-context/snippets/scene/block/echarts-init.snippet.js +2 -2
- package/lib/runjs-context/snippets/scene/block/render-iframe.snippet.js +2 -2
- package/lib/runjs-context/snippets/scene/block/render-react.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/block/render-statistics.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/block/render-timeline.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/block/resource-example.snippet.js +5 -5
- package/lib/runjs-context/snippets/scene/block/three-users-orbit.snippet.js +6 -6
- package/lib/runjs-context/snippets/scene/block/vue-component.snippet.js +3 -4
- package/lib/runjs-context/snippets/scene/detail/color-by-value.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.js +20 -3
- package/lib/runjs-context/snippets/scene/detail/format-number.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/detail/innerHTML-value.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/detail/percentage-bar.snippet.js +3 -3
- package/lib/runjs-context/snippets/scene/detail/relative-time.snippet.js +3 -3
- package/lib/runjs-context/snippets/scene/detail/status-tag.snippet.js +2 -2
- package/lib/runjs-context/snippets/scene/form/cascade-select.snippet.js +1 -1
- package/lib/runjs-context/snippets/scene/form/render-basic.snippet.js +2 -2
- package/lib/runjs-context/snippets/scene/table/cell-open-dialog.snippet.js +6 -3
- package/lib/runjs-context/snippets/scene/table/concat-fields.snippet.js +3 -1
- package/lib/runjsLibs.d.ts +28 -0
- package/lib/runjsLibs.js +532 -0
- package/lib/scheduler/ModelOperationScheduler.d.ts +2 -0
- package/lib/scheduler/ModelOperationScheduler.js +25 -21
- package/lib/types.d.ts +27 -0
- package/lib/utils/associationObjectVariable.d.ts +2 -2
- package/lib/utils/createCollectionContextMeta.js +1 -0
- package/lib/utils/createEphemeralContext.js +2 -2
- package/lib/utils/dateVariable.d.ts +16 -0
- package/lib/utils/dateVariable.js +380 -0
- package/lib/utils/exceptions.d.ts +7 -0
- package/lib/utils/exceptions.js +10 -0
- package/lib/utils/index.d.ts +8 -3
- package/lib/utils/index.js +45 -0
- package/lib/utils/params-resolvers.js +16 -9
- package/lib/utils/resolveModuleUrl.d.ts +58 -0
- package/lib/utils/resolveModuleUrl.js +65 -0
- package/lib/utils/resolveRunJSObjectValues.d.ts +16 -0
- package/lib/utils/resolveRunJSObjectValues.js +61 -0
- package/lib/utils/runjsModuleLoader.d.ts +58 -0
- package/lib/utils/runjsModuleLoader.js +422 -0
- package/lib/utils/runjsTemplateCompat.d.ts +35 -0
- package/lib/utils/runjsTemplateCompat.js +743 -0
- package/lib/utils/runjsValue.d.ts +29 -0
- package/lib/utils/runjsValue.js +275 -0
- package/lib/utils/safeGlobals.d.ts +18 -8
- package/lib/utils/safeGlobals.js +164 -17
- package/lib/utils/schema-utils.d.ts +10 -0
- package/lib/utils/schema-utils.js +61 -0
- package/lib/views/createViewMeta.d.ts +0 -7
- package/lib/views/createViewMeta.js +19 -70
- package/lib/views/index.d.ts +1 -2
- package/lib/views/index.js +4 -3
- package/lib/views/useDialog.js +8 -3
- package/lib/views/useDrawer.js +7 -2
- package/lib/views/usePage.d.ts +4 -0
- package/lib/views/usePage.js +43 -6
- package/lib/views/usePopover.js +4 -1
- package/lib/views/viewEvents.d.ts +17 -0
- package/lib/views/viewEvents.js +90 -0
- package/package.json +4 -4
- package/src/BlockScopedFlowEngine.ts +2 -5
- package/src/JSRunner.ts +44 -2
- package/src/ViewScopedFlowEngine.ts +4 -0
- package/src/__tests__/JSRunner.test.ts +64 -0
- package/src/__tests__/createViewMeta.popup.test.ts +62 -1
- package/src/__tests__/flowContext.test.ts +693 -1
- package/src/__tests__/flowEngine.dataSourceDirty.test.ts +63 -0
- package/src/__tests__/flowModel.openView.navigation.test.ts +28 -0
- package/src/__tests__/flowRunJSContextDefine.test.ts +63 -0
- package/src/__tests__/flowRuntimeContext.test.ts +2 -1
- package/src/__tests__/flowSettings.open.test.tsx +123 -19
- package/src/__tests__/provider.test.tsx +0 -5
- package/src/__tests__/runjsContext.test.ts +10 -7
- package/src/__tests__/runjsContextImplementations.test.ts +34 -3
- package/src/__tests__/runjsContextRuntime.test.ts +3 -3
- package/src/__tests__/runjsContributions.test.ts +89 -0
- package/src/__tests__/runjsExternalLibs.test.ts +242 -0
- package/src/__tests__/runjsLibsLazyLoading.test.ts +44 -0
- package/src/__tests__/runjsLocales.test.ts +4 -1
- package/src/__tests__/runjsPreprocessDefault.test.ts +49 -0
- package/src/__tests__/runjsRuntimeFeatures.test.ts +166 -0
- package/src/__tests__/runjsSnippets.test.ts +40 -3
- package/src/acl/Acl.tsx +3 -3
- package/src/components/FlowContextSelector.tsx +208 -12
- package/src/components/__tests__/gridDragPlanner.test.ts +141 -1
- package/src/components/dnd/gridDragPlanner.ts +60 -0
- package/src/components/settings/wrappers/component/SwitchWithTitle.tsx +2 -1
- package/src/components/settings/wrappers/component/__tests__/InlineControls.test.tsx +74 -0
- package/src/components/settings/wrappers/contextual/DefaultSettingsIcon.tsx +109 -16
- package/src/components/settings/wrappers/contextual/FlowsContextMenu.tsx +41 -7
- package/src/components/settings/wrappers/contextual/StepSettingsDialog.tsx +13 -2
- package/src/components/settings/wrappers/contextual/__tests__/DefaultSettingsIcon.test.tsx +157 -5
- package/src/components/variables/VariableInput.tsx +12 -4
- package/src/components/variables/VariableTag.tsx +54 -45
- package/src/components/variables/__tests__/FlowContextSelector.test.tsx +260 -3
- package/src/components/variables/__tests__/VariableTag.test.tsx +50 -0
- package/src/components/variables/__tests__/utils.test.ts +81 -3
- package/src/components/variables/utils.ts +67 -6
- package/src/data-source/index.ts +88 -110
- package/src/executor/FlowExecutor.ts +200 -23
- package/src/executor/__tests__/flowExecutor.test.ts +66 -0
- package/src/flowContext.ts +2986 -211
- package/src/flowEngine.ts +58 -13
- package/src/flowI18n.ts +7 -5
- package/src/flowSettings.ts +18 -12
- package/src/index.ts +14 -1
- package/src/locale/en-US.json +9 -2
- package/src/locale/zh-CN.json +8 -1
- package/src/models/CollectionFieldModel.tsx +3 -1
- package/src/models/__tests__/dispatchEvent.when.test.ts +554 -0
- package/src/models/__tests__/flowModel.clone.test.ts +416 -0
- package/src/models/__tests__/flowModel.test.ts +20 -4
- package/src/models/flowModel.tsx +94 -1
- package/src/provider.tsx +9 -7
- package/src/resources/__tests__/multiRecordResource.test.ts +44 -0
- package/src/resources/__tests__/sqlResource.test.ts +60 -0
- package/src/resources/baseRecordResource.ts +31 -0
- package/src/resources/multiRecordResource.ts +11 -4
- package/src/resources/singleRecordResource.ts +3 -0
- package/src/resources/sqlResource.ts +11 -6
- package/src/runjs-context/contexts/FormJSFieldItemRunJSContext.ts +10 -0
- package/src/runjs-context/contexts/JSBlockRunJSContext.ts +6 -2
- package/src/runjs-context/contexts/JSEditableFieldRunJSContext.ts +106 -0
- package/src/runjs-context/contexts/JSItemRunJSContext.ts +10 -0
- package/src/runjs-context/contexts/base.ts +715 -44
- package/src/runjs-context/contributions.ts +88 -0
- package/src/runjs-context/helpers.ts +11 -1
- package/src/runjs-context/setup.ts +6 -0
- package/src/runjs-context/snippets/global/api-request.snippet.ts +3 -3
- package/src/runjs-context/snippets/global/import-esm.snippet.ts +2 -3
- package/src/runjs-context/snippets/global/query-selector.snippet.ts +8 -3
- package/src/runjs-context/snippets/global/require-amd.snippet.ts +1 -1
- package/src/runjs-context/snippets/index.ts +75 -41
- package/src/runjs-context/snippets/scene/block/add-event-listener.snippet.ts +11 -13
- package/src/runjs-context/snippets/scene/block/api-fetch-render-list.snippet.ts +3 -3
- package/src/runjs-context/snippets/scene/block/chartjs-bar.snippet.ts +2 -2
- package/src/runjs-context/snippets/scene/block/echarts-init.snippet.ts +2 -2
- package/src/runjs-context/snippets/scene/block/render-iframe.snippet.ts +2 -2
- package/src/runjs-context/snippets/scene/block/render-react.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/block/render-statistics.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/block/render-timeline.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/block/resource-example.snippet.ts +6 -11
- package/src/runjs-context/snippets/scene/block/three-users-orbit.snippet.ts +6 -6
- package/src/runjs-context/snippets/scene/block/vue-component.snippet.ts +3 -4
- package/src/runjs-context/snippets/scene/detail/color-by-value.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/detail/copy-to-clipboard.snippet.ts +20 -3
- package/src/runjs-context/snippets/scene/detail/format-number.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/detail/innerHTML-value.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/detail/percentage-bar.snippet.ts +3 -3
- package/src/runjs-context/snippets/scene/detail/relative-time.snippet.ts +3 -3
- package/src/runjs-context/snippets/scene/detail/status-tag.snippet.ts +2 -2
- package/src/runjs-context/snippets/scene/form/cascade-select.snippet.ts +1 -1
- package/src/runjs-context/snippets/scene/form/render-basic.snippet.ts +3 -8
- package/src/runjs-context/snippets/scene/table/cell-open-dialog.snippet.ts +6 -3
- package/src/runjs-context/snippets/scene/table/concat-fields.snippet.ts +3 -1
- package/src/runjsLibs.ts +622 -0
- package/src/scheduler/ModelOperationScheduler.ts +27 -21
- package/src/types.ts +38 -1
- package/src/utils/__tests__/dateVariable.test.ts +101 -0
- package/src/utils/__tests__/params-resolvers.test.ts +40 -0
- package/src/utils/__tests__/runjsRequireAsyncAutoWhitelist.test.ts +38 -0
- package/src/utils/__tests__/runjsTemplateCompat.test.ts +159 -0
- package/src/utils/__tests__/runjsValue.test.ts +44 -0
- package/src/utils/__tests__/safeGlobals.test.ts +57 -2
- package/src/utils/__tests__/utils.test.ts +95 -0
- package/src/utils/associationObjectVariable.ts +2 -2
- package/src/utils/createCollectionContextMeta.ts +1 -0
- package/src/utils/createEphemeralContext.ts +5 -4
- package/src/utils/dateVariable.ts +397 -0
- package/src/utils/exceptions.ts +11 -0
- package/src/utils/index.ts +37 -3
- package/src/utils/params-resolvers.ts +23 -9
- package/src/utils/resolveModuleUrl.ts +91 -0
- package/src/utils/resolveRunJSObjectValues.ts +46 -0
- package/src/utils/runjsModuleLoader.ts +553 -0
- package/src/utils/runjsTemplateCompat.ts +828 -0
- package/src/utils/runjsValue.ts +287 -0
- package/src/utils/safeGlobals.ts +188 -17
- package/src/utils/schema-utils.ts +79 -0
- package/src/views/__tests__/FlowView.usePage.test.tsx +54 -1
- package/src/views/__tests__/useDialog.closeDestroy.test.tsx +35 -8
- package/src/views/__tests__/viewEvents.resolveOpenerEngine.test.ts +28 -0
- package/src/views/createViewMeta.ts +22 -75
- package/src/views/index.tsx +1 -2
- package/src/views/useDialog.tsx +9 -2
- package/src/views/useDrawer.tsx +8 -1
- package/src/views/usePage.tsx +51 -5
- package/src/views/usePopover.tsx +4 -1
- package/src/views/viewEvents.ts +55 -0
|
@@ -37,7 +37,6 @@ function createBlockScopedEngine(parent) {
|
|
|
37
37
|
local.setModelRepository(parent.modelRepository);
|
|
38
38
|
}
|
|
39
39
|
local.context.addDelegate(parent.context);
|
|
40
|
-
const originalUnlink = local.unlinkFromStack.bind(local);
|
|
41
40
|
local.unlinkFromStack = function() {
|
|
42
41
|
const prev = local._previousEngine;
|
|
43
42
|
const next = local._nextEngine;
|
package/lib/FlowDefinition.d.ts
CHANGED
|
@@ -419,6 +419,8 @@ export declare class FlowStep {
|
|
|
419
419
|
scene?: import("./types").ActionScene | import("./types").ActionScene[];
|
|
420
420
|
paramsRequired?: boolean;
|
|
421
421
|
hideInSettings?: boolean | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => boolean | Promise<boolean>);
|
|
422
|
+
disabledInSettings?: boolean | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => boolean | Promise<boolean>);
|
|
423
|
+
disabledReasonInSettings?: string | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => string | Promise<string>);
|
|
422
424
|
defineProperties?: Record<string, import("./flowContext").PropertyOptions> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, import("./flowContext").PropertyOptions> | Promise<Record<string, import("./flowContext").PropertyOptions>>);
|
|
423
425
|
defineMethods?: Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any> | ((ctx: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>) => Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any> | Promise<Record<string, (this: import("./flowContext").FlowRuntimeContext<import(".").FlowModel<import("./types").DefaultStructure>, any>, ...args: any[]) => any>>);
|
|
424
426
|
};
|
package/lib/JSRunner.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export interface JSRunnerOptions {
|
|
|
11
11
|
timeoutMs?: number;
|
|
12
12
|
globals?: Record<string, any>;
|
|
13
13
|
version?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Enable RunJS template compatibility preprocessing for `{{ ... }}`.
|
|
16
|
+
* When enabled via `ctx.runjs(code, vars, { preprocessTemplates: true })` (default),
|
|
17
|
+
* the code will be rewritten to call `ctx.resolveJsonTemplate(...)` at runtime.
|
|
18
|
+
*/
|
|
19
|
+
preprocessTemplates?: boolean;
|
|
14
20
|
}
|
|
15
21
|
export declare class JSRunner {
|
|
16
22
|
private globals;
|
package/lib/JSRunner.js
CHANGED
|
@@ -31,10 +31,12 @@ __export(JSRunner_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(JSRunner_exports);
|
|
33
33
|
var import_ses = require("ses");
|
|
34
|
+
var import_exceptions = require("./utils/exceptions");
|
|
34
35
|
const _JSRunner = class _JSRunner {
|
|
35
36
|
globals;
|
|
36
37
|
timeoutMs;
|
|
37
38
|
constructor(options = {}) {
|
|
39
|
+
var _a, _b;
|
|
38
40
|
const bindWindowFn = /* @__PURE__ */ __name((key) => {
|
|
39
41
|
if (typeof window !== "undefined" && typeof window[key] === "function") {
|
|
40
42
|
return window[key].bind(window);
|
|
@@ -42,13 +44,34 @@ const _JSRunner = class _JSRunner {
|
|
|
42
44
|
const fn = globalThis[key];
|
|
43
45
|
return typeof fn === "function" ? fn.bind(globalThis) : fn;
|
|
44
46
|
}, "bindWindowFn");
|
|
47
|
+
const providedGlobals = options.globals || {};
|
|
48
|
+
const liftedGlobals = {};
|
|
49
|
+
if (!Object.prototype.hasOwnProperty.call(providedGlobals, "Blob")) {
|
|
50
|
+
try {
|
|
51
|
+
const blobCtor = (_a = providedGlobals.window) == null ? void 0 : _a.Blob;
|
|
52
|
+
if (typeof blobCtor !== "undefined") {
|
|
53
|
+
liftedGlobals.Blob = blobCtor;
|
|
54
|
+
}
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (!Object.prototype.hasOwnProperty.call(providedGlobals, "URL")) {
|
|
59
|
+
try {
|
|
60
|
+
const urlCtor = (_b = providedGlobals.window) == null ? void 0 : _b.URL;
|
|
61
|
+
if (typeof urlCtor !== "undefined") {
|
|
62
|
+
liftedGlobals.URL = urlCtor;
|
|
63
|
+
}
|
|
64
|
+
} catch {
|
|
65
|
+
}
|
|
66
|
+
}
|
|
45
67
|
this.globals = {
|
|
46
68
|
console,
|
|
47
69
|
setTimeout: bindWindowFn("setTimeout"),
|
|
48
70
|
clearTimeout: bindWindowFn("clearTimeout"),
|
|
49
71
|
setInterval: bindWindowFn("setInterval"),
|
|
50
72
|
clearInterval: bindWindowFn("clearInterval"),
|
|
51
|
-
...
|
|
73
|
+
...liftedGlobals,
|
|
74
|
+
...providedGlobals
|
|
52
75
|
};
|
|
53
76
|
this.timeoutMs = options.timeoutMs ?? 5e3;
|
|
54
77
|
}
|
|
@@ -62,7 +85,8 @@ const _JSRunner = class _JSRunner {
|
|
|
62
85
|
* 异步运行代码,带错误处理和超时机制
|
|
63
86
|
*/
|
|
64
87
|
async run(code) {
|
|
65
|
-
|
|
88
|
+
const search = typeof location !== "undefined" ? location.search : void 0;
|
|
89
|
+
if (typeof search === "string" && search.includes("skipRunJs=true")) {
|
|
66
90
|
return { success: true, value: null };
|
|
67
91
|
}
|
|
68
92
|
const wrapped = `(async () => {
|
|
@@ -81,6 +105,12 @@ const _JSRunner = class _JSRunner {
|
|
|
81
105
|
const result = await Promise.race([task, timeoutPromise]);
|
|
82
106
|
return { success: true, value: result };
|
|
83
107
|
} catch (err) {
|
|
108
|
+
if (err instanceof import_exceptions.FlowExitException) {
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
if (err instanceof import_exceptions.FlowExitAllException) {
|
|
112
|
+
throw err;
|
|
113
|
+
}
|
|
84
114
|
console.error(err);
|
|
85
115
|
return {
|
|
86
116
|
success: false,
|
|
@@ -31,8 +31,10 @@ __export(ViewScopedFlowEngine_exports, {
|
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(ViewScopedFlowEngine_exports);
|
|
33
33
|
var import_flowEngine = require("./flowEngine");
|
|
34
|
+
var import_viewEvents = require("./views/viewEvents");
|
|
34
35
|
function createViewScopedEngine(parent) {
|
|
35
36
|
const local = new import_flowEngine.FlowEngine();
|
|
37
|
+
Object.defineProperty(local, import_viewEvents.ENGINE_SCOPE_KEY, { value: import_viewEvents.VIEW_ENGINE_SCOPE, configurable: true });
|
|
36
38
|
if (parent.modelRepository) {
|
|
37
39
|
local.setModelRepository(parent.modelRepository);
|
|
38
40
|
}
|
|
@@ -48,6 +50,7 @@ function createViewScopedEngine(parent) {
|
|
|
48
50
|
"_applyFlowCache",
|
|
49
51
|
"executor",
|
|
50
52
|
"context",
|
|
53
|
+
import_viewEvents.ENGINE_SCOPE_KEY,
|
|
51
54
|
"previousEngine",
|
|
52
55
|
"nextEngine",
|
|
53
56
|
// 调度器与事件总线局部化
|
package/lib/acl/Acl.js
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
var __create = Object.create;
|
|
10
11
|
var __defProp = Object.defineProperty;
|
|
11
12
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
13
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
13
15
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
16
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
15
17
|
var __export = (target, all) => {
|
|
@@ -24,13 +26,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
24
26
|
}
|
|
25
27
|
return to;
|
|
26
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
|
+
));
|
|
27
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
38
|
var Acl_exports = {};
|
|
29
39
|
__export(Acl_exports, {
|
|
30
40
|
ACL: () => ACL
|
|
31
41
|
});
|
|
32
42
|
module.exports = __toCommonJS(Acl_exports);
|
|
33
|
-
var import_lodash = require("lodash");
|
|
43
|
+
var import_lodash = __toESM(require("lodash"));
|
|
34
44
|
const _ACL = class _ACL {
|
|
35
45
|
constructor(flowEngine) {
|
|
36
46
|
this.flowEngine = flowEngine;
|
|
@@ -43,10 +53,10 @@ const _ACL = class _ACL {
|
|
|
43
53
|
// 记录上一次用于鉴权的 token,用于识别登录态变更
|
|
44
54
|
lastToken = null;
|
|
45
55
|
setData(data) {
|
|
46
|
-
this.data = data;
|
|
56
|
+
this.data = import_lodash.default.cloneDeep(data);
|
|
47
57
|
}
|
|
48
58
|
setMeta(data) {
|
|
49
|
-
this.meta = data;
|
|
59
|
+
this.meta = import_lodash.default.cloneDeep(data);
|
|
50
60
|
}
|
|
51
61
|
async load() {
|
|
52
62
|
var _a, _b, _c, _d;
|
|
@@ -57,6 +57,35 @@ const cascaderPopupAutoHeightClassName = import_css.css`
|
|
|
57
57
|
max-height: 50vh;
|
|
58
58
|
}
|
|
59
59
|
`;
|
|
60
|
+
const normalizePath = /* @__PURE__ */ __name((path) => {
|
|
61
|
+
if (!Array.isArray(path)) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
return path.map((segment) => String(segment));
|
|
65
|
+
}, "normalizePath");
|
|
66
|
+
const getSelectedPathInfo = /* @__PURE__ */ __name((path, options) => {
|
|
67
|
+
var _a;
|
|
68
|
+
if (!Array.isArray(path) || path.length === 0) {
|
|
69
|
+
return { text: "", meta: void 0 };
|
|
70
|
+
}
|
|
71
|
+
const labels = [];
|
|
72
|
+
let currentOptions = options;
|
|
73
|
+
let selectedMeta;
|
|
74
|
+
for (const segment of path) {
|
|
75
|
+
const matchedOption = currentOptions.find((item) => String(item.value) === String(segment));
|
|
76
|
+
if (!matchedOption) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
const label = typeof ((_a = matchedOption.meta) == null ? void 0 : _a.title) === "string" ? matchedOption.meta.title : typeof matchedOption.label === "string" ? matchedOption.label : String(matchedOption.value);
|
|
80
|
+
labels.push(label);
|
|
81
|
+
selectedMeta = matchedOption.meta;
|
|
82
|
+
currentOptions = Array.isArray(matchedOption.children) ? matchedOption.children : [];
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
text: labels.join(" / "),
|
|
86
|
+
meta: selectedMeta
|
|
87
|
+
};
|
|
88
|
+
}, "getSelectedPathInfo");
|
|
60
89
|
const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
61
90
|
value,
|
|
62
91
|
onChange,
|
|
@@ -70,6 +99,7 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
70
99
|
ignoreFieldNames,
|
|
71
100
|
...cascaderProps
|
|
72
101
|
}) => {
|
|
102
|
+
const { token } = import_antd.theme.useToken();
|
|
73
103
|
const lastSelectedRef = (0, import_react.useRef)(null);
|
|
74
104
|
const { resolvedMetaTree, loading } = (0, import_useResolvedMetaTree.useResolvedMetaTree)(metaTree);
|
|
75
105
|
const flowCtx = (0, import_FlowContextProvider.useFlowContext)();
|
|
@@ -102,16 +132,28 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
102
132
|
[flowCtx]
|
|
103
133
|
);
|
|
104
134
|
const [updateFlag, setUpdateFlag] = (0, import_react.useState)(0);
|
|
135
|
+
const [searchText, setSearchText] = (0, import_react.useState)("");
|
|
136
|
+
const [dropdownOpen, setDropdownOpen] = (0, import_react.useState)(false);
|
|
137
|
+
const inlineFocusByPointerRef = (0, import_react.useRef)(false);
|
|
105
138
|
const triggerUpdate = (0, import_react.useCallback)(() => setUpdateFlag((prev) => prev + 1), []);
|
|
139
|
+
const isSearchEnabled = showSearch || children === null;
|
|
106
140
|
const options = (0, import_react.useMemo)(() => {
|
|
107
141
|
if (!resolvedMetaTree) return [];
|
|
142
|
+
const refreshSeq = updateFlag;
|
|
108
143
|
const base = (0, import_utils.buildContextSelectorItems)(resolvedMetaTree);
|
|
109
|
-
|
|
144
|
+
const filtered = translateOptions(base).filter((item) => {
|
|
110
145
|
var _a;
|
|
111
146
|
if (!ignoreFieldNames || ignoreFieldNames.length === 0) return true;
|
|
112
147
|
return !ignoreFieldNames.includes(((_a = item.meta) == null ? void 0 : _a.name) || "");
|
|
113
148
|
});
|
|
149
|
+
return refreshSeq >= 0 ? filtered : [];
|
|
114
150
|
}, [resolvedMetaTree, updateFlag, translateOptions, ignoreFieldNames]);
|
|
151
|
+
const displayOptions = (0, import_react.useMemo)(() => {
|
|
152
|
+
if (!isSearchEnabled || !searchText.trim()) {
|
|
153
|
+
return options;
|
|
154
|
+
}
|
|
155
|
+
return (0, import_utils.filterLoadedContextSelectorItems)(options, searchText);
|
|
156
|
+
}, [isSearchEnabled, options, searchText]);
|
|
115
157
|
const [tempSelectedPath, setTempSelectedPath] = (0, import_react.useState)([]);
|
|
116
158
|
const handleLoadData = (0, import_react.useCallback)(
|
|
117
159
|
async (selectedOptions) => {
|
|
@@ -147,18 +189,27 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
147
189
|
triggerUpdate();
|
|
148
190
|
}
|
|
149
191
|
},
|
|
150
|
-
[triggerUpdate]
|
|
192
|
+
[triggerUpdate, translateOptions]
|
|
151
193
|
);
|
|
152
194
|
const currentPath = (0, import_react.useMemo)(() => {
|
|
153
|
-
return customParseValueToPath(value);
|
|
195
|
+
return normalizePath(customParseValueToPath(value));
|
|
154
196
|
}, [value, customParseValueToPath]);
|
|
155
197
|
const effectivePath = (0, import_react.useMemo)(() => {
|
|
156
198
|
if (!currentPath || currentPath.length === 0) return currentPath;
|
|
199
|
+
if (options.length === 0) {
|
|
200
|
+
return currentPath;
|
|
201
|
+
}
|
|
157
202
|
const topValues = new Set(options.map((o) => String(o.value)));
|
|
158
203
|
const needTrim = !topValues.has(String(currentPath[0]));
|
|
159
204
|
const fixed = needTrim ? currentPath.slice(1) : currentPath;
|
|
160
205
|
return fixed;
|
|
161
206
|
}, [currentPath, options]);
|
|
207
|
+
const cascaderValue = (0, import_react.useMemo)(() => {
|
|
208
|
+
if (tempSelectedPath.length > 0) {
|
|
209
|
+
return tempSelectedPath;
|
|
210
|
+
}
|
|
211
|
+
return Array.isArray(effectivePath) ? effectivePath : void 0;
|
|
212
|
+
}, [effectivePath, tempSelectedPath]);
|
|
162
213
|
const pathToPreload = (0, import_react.useMemo)(() => {
|
|
163
214
|
const finalPath = effectivePath && effectivePath.length > 0 ? effectivePath : tempSelectedPath;
|
|
164
215
|
return Array.isArray(finalPath) ? finalPath : [];
|
|
@@ -212,22 +263,116 @@ const FlowContextSelectorComponent = /* @__PURE__ */ __name(({
|
|
|
212
263
|
const mergedPopupClassName = (0, import_react.useMemo)(() => {
|
|
213
264
|
return (0, import_css.cx)(cascaderPopupAutoHeightClassName, cascaderProps.popupClassName);
|
|
214
265
|
}, [cascaderProps.popupClassName]);
|
|
266
|
+
const cascaderSearchInputClassName = (0, import_react.useMemo)(() => {
|
|
267
|
+
return import_css.css`
|
|
268
|
+
padding: 8px;
|
|
269
|
+
border-bottom: 1px solid ${token.colorSplit};
|
|
270
|
+
`;
|
|
271
|
+
}, [token.colorSplit]);
|
|
272
|
+
const {
|
|
273
|
+
onDropdownVisibleChange: cascaderOnDropdownVisibleChange,
|
|
274
|
+
dropdownRender: cascaderDropdownRender,
|
|
275
|
+
...restCascaderProps
|
|
276
|
+
} = cascaderProps;
|
|
277
|
+
const selectedPathInfo = (0, import_react.useMemo)(() => getSelectedPathInfo(effectivePath, options), [effectivePath, options]);
|
|
278
|
+
const mergedOpen = open !== void 0 ? open : children === null ? dropdownOpen : void 0;
|
|
279
|
+
const isDropdownVisible = !!mergedOpen;
|
|
280
|
+
const handleDropdownVisibleChange = (0, import_react.useCallback)(
|
|
281
|
+
(visible) => {
|
|
282
|
+
if (open === void 0) {
|
|
283
|
+
setDropdownOpen(visible);
|
|
284
|
+
}
|
|
285
|
+
if (!visible) {
|
|
286
|
+
setSearchText("");
|
|
287
|
+
}
|
|
288
|
+
cascaderOnDropdownVisibleChange == null ? void 0 : cascaderOnDropdownVisibleChange(visible);
|
|
289
|
+
},
|
|
290
|
+
[cascaderOnDropdownVisibleChange, open]
|
|
291
|
+
);
|
|
292
|
+
const renderDropdown = (0, import_react.useCallback)(
|
|
293
|
+
(menu) => {
|
|
294
|
+
const cascaderMenuNode = cascaderDropdownRender ? cascaderDropdownRender(menu) : menu;
|
|
295
|
+
const cascaderMenu = import_react.default.isValidElement(cascaderMenuNode) ? cascaderMenuNode : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, cascaderMenuNode);
|
|
296
|
+
if (!isSearchEnabled || children === null) {
|
|
297
|
+
return cascaderMenu;
|
|
298
|
+
}
|
|
299
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: cascaderSearchInputClassName }, /* @__PURE__ */ import_react.default.createElement(
|
|
300
|
+
import_antd.Input,
|
|
301
|
+
{
|
|
302
|
+
allowClear: true,
|
|
303
|
+
size: "small",
|
|
304
|
+
value: searchText,
|
|
305
|
+
placeholder: flowCtx.t("Search"),
|
|
306
|
+
onChange: (e) => setSearchText(e.target.value),
|
|
307
|
+
onKeyDown: (e) => e.stopPropagation()
|
|
308
|
+
}
|
|
309
|
+
)), cascaderMenu);
|
|
310
|
+
},
|
|
311
|
+
[cascaderDropdownRender, cascaderSearchInputClassName, children, flowCtx, isSearchEnabled, searchText]
|
|
312
|
+
);
|
|
313
|
+
const inlinePlaceholder = typeof restCascaderProps.placeholder === "string" ? restCascaderProps.placeholder : flowCtx.t("Search");
|
|
314
|
+
const hasSelectedPath = Array.isArray(effectivePath) && effectivePath.length > 0;
|
|
315
|
+
const handleInlineInputFocus = (0, import_react.useCallback)(() => {
|
|
316
|
+
if (open === void 0 && !inlineFocusByPointerRef.current) {
|
|
317
|
+
setDropdownOpen(true);
|
|
318
|
+
}
|
|
319
|
+
}, [open]);
|
|
320
|
+
const markInlineFocusByPointer = (0, import_react.useCallback)(() => {
|
|
321
|
+
inlineFocusByPointerRef.current = true;
|
|
322
|
+
}, []);
|
|
323
|
+
const resetInlineFocusByPointer = (0, import_react.useCallback)(() => {
|
|
324
|
+
inlineFocusByPointerRef.current = false;
|
|
325
|
+
}, []);
|
|
326
|
+
const handleInlineInputChange = (0, import_react.useCallback)(
|
|
327
|
+
(event) => {
|
|
328
|
+
const nextValue = event.target.value;
|
|
329
|
+
if (!isDropdownVisible && nextValue === "" && hasSelectedPath) {
|
|
330
|
+
setTempSelectedPath([]);
|
|
331
|
+
onChange == null ? void 0 : onChange("", void 0);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
if (open === void 0 && !isDropdownVisible) {
|
|
335
|
+
setDropdownOpen(true);
|
|
336
|
+
}
|
|
337
|
+
setSearchText(nextValue);
|
|
338
|
+
},
|
|
339
|
+
[hasSelectedPath, isDropdownVisible, onChange, open]
|
|
340
|
+
);
|
|
341
|
+
const inlinePathText = Array.isArray(effectivePath) ? effectivePath.join(" / ") : "";
|
|
342
|
+
const inlineInputValue = isDropdownVisible ? searchText : selectedPathInfo.text || inlinePathText;
|
|
215
343
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
216
344
|
import_antd.Cascader,
|
|
217
345
|
{
|
|
218
|
-
...
|
|
219
|
-
options,
|
|
220
|
-
value:
|
|
346
|
+
...restCascaderProps,
|
|
347
|
+
options: displayOptions,
|
|
348
|
+
value: cascaderValue,
|
|
221
349
|
onChange: handleChange,
|
|
222
350
|
loadData: handleLoadData,
|
|
223
351
|
loading,
|
|
224
352
|
changeOnSelect: !onlyLeafSelectable,
|
|
225
353
|
expandTrigger: "click",
|
|
226
|
-
open,
|
|
227
|
-
showSearch:
|
|
228
|
-
popupClassName: mergedPopupClassName
|
|
354
|
+
open: mergedOpen,
|
|
355
|
+
showSearch: false,
|
|
356
|
+
popupClassName: mergedPopupClassName,
|
|
357
|
+
dropdownRender: renderDropdown,
|
|
358
|
+
onDropdownVisibleChange: handleDropdownVisibleChange
|
|
229
359
|
},
|
|
230
|
-
children === null ?
|
|
360
|
+
children === null ? /* @__PURE__ */ import_react.default.createElement(
|
|
361
|
+
import_antd.Input,
|
|
362
|
+
{
|
|
363
|
+
allowClear: true,
|
|
364
|
+
value: inlineInputValue,
|
|
365
|
+
placeholder: inlinePlaceholder,
|
|
366
|
+
onMouseDown: markInlineFocusByPointer,
|
|
367
|
+
onMouseUp: resetInlineFocusByPointer,
|
|
368
|
+
onMouseLeave: resetInlineFocusByPointer,
|
|
369
|
+
onFocus: handleInlineInputFocus,
|
|
370
|
+
onBlur: resetInlineFocusByPointer,
|
|
371
|
+
onChange: handleInlineInputChange,
|
|
372
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
373
|
+
disabled: restCascaderProps.disabled
|
|
374
|
+
}
|
|
375
|
+
) : children || defaultChildren
|
|
231
376
|
);
|
|
232
377
|
}, "FlowContextSelectorComponent");
|
|
233
378
|
const FlowContextSelector = import_react.default.memo(FlowContextSelectorComponent);
|
|
@@ -59,6 +59,43 @@ const COLUMN_EDGE_MAX_WIDTH = 28;
|
|
|
59
59
|
const COLUMN_EDGE_WIDTH_RATIO = 0.2;
|
|
60
60
|
const COLUMN_INSERT_THICKNESS_RATIO = 0.5;
|
|
61
61
|
const ROW_GAP_HEIGHT_RATIO = 0.33;
|
|
62
|
+
const deriveRowOrder = /* @__PURE__ */ __name((rows, provided) => {
|
|
63
|
+
const order = [];
|
|
64
|
+
const used = /* @__PURE__ */ new Set();
|
|
65
|
+
(provided || Object.keys(rows)).forEach((rowId) => {
|
|
66
|
+
if (rows[rowId] && !used.has(rowId)) {
|
|
67
|
+
order.push(rowId);
|
|
68
|
+
used.add(rowId);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
Object.keys(rows).forEach((rowId) => {
|
|
72
|
+
if (!used.has(rowId)) {
|
|
73
|
+
order.push(rowId);
|
|
74
|
+
used.add(rowId);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return order;
|
|
78
|
+
}, "deriveRowOrder");
|
|
79
|
+
const normalizeRowsWithOrder = /* @__PURE__ */ __name((rows, order) => {
|
|
80
|
+
const next = {};
|
|
81
|
+
order.forEach((rowId) => {
|
|
82
|
+
if (rows[rowId]) {
|
|
83
|
+
next[rowId] = rows[rowId];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.keys(rows).forEach((rowId) => {
|
|
87
|
+
if (!next[rowId]) {
|
|
88
|
+
next[rowId] = rows[rowId];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return next;
|
|
92
|
+
}, "normalizeRowsWithOrder");
|
|
93
|
+
const ensureRowOrder = /* @__PURE__ */ __name((layout) => {
|
|
94
|
+
const order = deriveRowOrder(layout.rows, layout.rowOrder);
|
|
95
|
+
layout.rowOrder = order;
|
|
96
|
+
layout.rows = normalizeRowsWithOrder(layout.rows, order);
|
|
97
|
+
return order;
|
|
98
|
+
}, "ensureRowOrder");
|
|
62
99
|
const toRect = /* @__PURE__ */ __name((domRect) => ({
|
|
63
100
|
top: domRect.top,
|
|
64
101
|
left: domRect.left,
|
|
@@ -330,9 +367,11 @@ const removeItemFromLayout = /* @__PURE__ */ __name((layout, uidValue) => {
|
|
|
330
367
|
if (columns.length === 0) {
|
|
331
368
|
delete layout.rows[rowId];
|
|
332
369
|
delete layout.sizes[rowId];
|
|
370
|
+
ensureRowOrder(layout);
|
|
333
371
|
return;
|
|
334
372
|
}
|
|
335
373
|
normalizeRowSizes(rowId, layout);
|
|
374
|
+
ensureRowOrder(layout);
|
|
336
375
|
}, "removeItemFromLayout");
|
|
337
376
|
const toIntSizes = /* @__PURE__ */ __name((weights, count) => {
|
|
338
377
|
if (count === 0) {
|
|
@@ -420,8 +459,10 @@ const simulateLayoutForSlot = /* @__PURE__ */ __name(({
|
|
|
420
459
|
}) => {
|
|
421
460
|
const cloned = {
|
|
422
461
|
rows: import_lodash.default.cloneDeep(layout.rows),
|
|
423
|
-
sizes: import_lodash.default.cloneDeep(layout.sizes)
|
|
462
|
+
sizes: import_lodash.default.cloneDeep(layout.sizes),
|
|
463
|
+
rowOrder: layout.rowOrder ? [...layout.rowOrder] : void 0
|
|
424
464
|
};
|
|
465
|
+
ensureRowOrder(cloned);
|
|
425
466
|
removeItemFromLayout(cloned, sourceUid);
|
|
426
467
|
const createRowId = generateRowId ?? import_shared.uid;
|
|
427
468
|
switch (slot.type) {
|
|
@@ -464,8 +505,15 @@ const simulateLayoutForSlot = /* @__PURE__ */ __name(({
|
|
|
464
505
|
case "row-gap": {
|
|
465
506
|
const newRowId = createRowId();
|
|
466
507
|
const rowPosition = slot.position === "above" ? "before" : "after";
|
|
508
|
+
const currentOrder = deriveRowOrder(cloned.rows, cloned.rowOrder);
|
|
467
509
|
cloned.rows = insertRow(cloned.rows, slot.targetRowId, newRowId, rowPosition, [[sourceUid]]);
|
|
468
510
|
cloned.sizes[newRowId] = [DEFAULT_GRID_COLUMNS];
|
|
511
|
+
const targetIndex = currentOrder.indexOf(slot.targetRowId);
|
|
512
|
+
const insertIndex = targetIndex === -1 ? currentOrder.length : rowPosition === "before" ? targetIndex : targetIndex + 1;
|
|
513
|
+
const nextOrder = [...currentOrder];
|
|
514
|
+
nextOrder.splice(insertIndex, 0, newRowId);
|
|
515
|
+
cloned.rowOrder = nextOrder;
|
|
516
|
+
cloned.rows = normalizeRowsWithOrder(cloned.rows, nextOrder);
|
|
469
517
|
break;
|
|
470
518
|
}
|
|
471
519
|
case "empty-row": {
|
|
@@ -475,11 +523,15 @@ const simulateLayoutForSlot = /* @__PURE__ */ __name(({
|
|
|
475
523
|
[newRowId]: [[sourceUid]]
|
|
476
524
|
};
|
|
477
525
|
cloned.sizes[newRowId] = [DEFAULT_GRID_COLUMNS];
|
|
526
|
+
const currentOrder = deriveRowOrder(cloned.rows, cloned.rowOrder);
|
|
527
|
+
cloned.rowOrder = [...currentOrder.filter((id) => id !== newRowId), newRowId];
|
|
528
|
+
cloned.rows = normalizeRowsWithOrder(cloned.rows, cloned.rowOrder);
|
|
478
529
|
break;
|
|
479
530
|
}
|
|
480
531
|
default:
|
|
481
532
|
break;
|
|
482
533
|
}
|
|
534
|
+
ensureRowOrder(cloned);
|
|
483
535
|
return cloned;
|
|
484
536
|
}, "simulateLayoutForSlot");
|
|
485
537
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -73,7 +73,8 @@ const SwitchWithTitle = (0, import_reactive.observer)(
|
|
|
73
73
|
setChecked(val);
|
|
74
74
|
onChange == null ? void 0 : onChange({ [itemKey]: val });
|
|
75
75
|
}, "handleChange");
|
|
76
|
-
const handleWrapperClick = /* @__PURE__ */ __name(() => {
|
|
76
|
+
const handleWrapperClick = /* @__PURE__ */ __name((e) => {
|
|
77
|
+
e.stopPropagation();
|
|
77
78
|
if (disabled) return;
|
|
78
79
|
handleChange(!checked);
|
|
79
80
|
}, "handleWrapperClick");
|