@nocobase/plugin-flow-engine 2.1.0-alpha.3 → 2.1.0-alpha.31
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 -9
- package/dist/ai/ai-employees/nathan/index.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/index.js +42 -0
- package/dist/ai/ai-employees/nathan/prompt.md +168 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/SKILLS.md +86 -0
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.js +2 -2
- package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.js +6 -4
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/patchJSCode.js +65 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/readJSCode.js +61 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.d.ts +10 -0
- package/dist/ai/ai-employees/nathan/skills/frontend-developer/tools/writeJSCode.js +65 -0
- package/dist/ai/docs/runjs/context/block-model.md +35 -35
- package/dist/ai/docs/runjs/context/collection-field.md +53 -51
- package/dist/ai/docs/runjs/context/collection.md +39 -39
- package/dist/ai/docs/runjs/context/data-source-manager.md +40 -30
- package/dist/ai/docs/runjs/context/data-source.md +52 -44
- package/dist/ai/docs/runjs/context/element.md +44 -38
- package/dist/ai/docs/runjs/context/exit-all.md +37 -35
- package/dist/ai/docs/runjs/context/exit.md +38 -35
- package/dist/ai/docs/runjs/context/filter-manager.md +36 -30
- package/dist/ai/docs/runjs/context/form.md +57 -57
- package/dist/ai/docs/runjs/context/get-model.md +22 -21
- package/dist/ai/docs/runjs/context/get-value.md +20 -19
- package/dist/ai/docs/runjs/context/get-var.md +61 -55
- package/dist/ai/docs/runjs/context/i18n.md +17 -14
- package/dist/ai/docs/runjs/context/import-async.md +333 -45
- package/dist/ai/docs/runjs/context/init-resource.md +20 -20
- package/dist/ai/docs/runjs/context/libs.md +31 -31
- package/dist/ai/docs/runjs/context/location.md +34 -31
- package/dist/ai/docs/runjs/context/logger.md +41 -40
- package/dist/ai/docs/runjs/context/make-resource.md +27 -26
- package/dist/ai/docs/runjs/context/message.md +42 -41
- package/dist/ai/docs/runjs/context/modal.md +44 -44
- package/dist/ai/docs/runjs/context/model.md +36 -33
- package/dist/ai/docs/runjs/context/notification.md +41 -40
- package/dist/ai/docs/runjs/context/off.md +14 -14
- package/dist/ai/docs/runjs/context/on.md +30 -29
- package/dist/ai/docs/runjs/context/open-view.md +40 -40
- package/dist/ai/docs/runjs/context/render.md +37 -32
- package/dist/ai/docs/runjs/context/request.md +46 -45
- package/dist/ai/docs/runjs/context/require-async.md +28 -25
- package/dist/ai/docs/runjs/context/resource.md +34 -34
- package/dist/ai/docs/runjs/context/route.md +36 -34
- package/dist/ai/docs/runjs/context/router.md +43 -31
- package/dist/ai/docs/runjs/context/set-value.md +18 -17
- package/dist/ai/docs/runjs/context/sql.md +7 -15
- package/dist/ai/docs/runjs/context/t.md +20 -17
- package/dist/ai/docs/runjs/context/view.md +49 -46
- package/dist/ai/docs/runjs/document.md +1 -0
- package/dist/ai/docs/runjs/import-modules.md +32 -32
- package/dist/ai/docs/runjs/index.md +13 -13
- package/dist/ai/docs/runjs/jsx.md +19 -19
- package/dist/ai/docs/runjs/model/form-block-model.md +1 -3
- package/dist/ai/docs/runjs/render.md +15 -15
- package/dist/ai/docs/runjs/resource/api-resource.md +53 -53
- package/dist/ai/docs/runjs/resource/multi-record-resource.md +64 -64
- package/dist/ai/docs/runjs/resource/single-record-resource.md +55 -55
- package/dist/ai/docs/runjs/resource/sql-resource.md +57 -57
- package/dist/ai/docs/runjs/window.md +5 -5
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -11
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/index.d.ts +2 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/ses/dist/ses.cjs +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/collections/flowsql.js +1 -0
- package/dist/server/flow-surfaces/action-scope.d.ts +39 -0
- package/dist/server/flow-surfaces/action-scope.js +156 -0
- package/dist/server/flow-surfaces/apply/compiler.d.ts +13 -0
- package/dist/server/flow-surfaces/apply/compiler.js +971 -0
- package/dist/server/flow-surfaces/apply/layout.d.ts +34 -0
- package/dist/server/flow-surfaces/apply/layout.js +175 -0
- package/dist/server/flow-surfaces/apply/matching.d.ts +16 -0
- package/dist/server/flow-surfaces/apply/matching.js +181 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.d.ts +84 -0
- package/dist/server/flow-surfaces/approval/blueprint-service.js +589 -0
- package/dist/server/flow-surfaces/approval/blueprint.d.ts +21 -0
- package/dist/server/flow-surfaces/approval/blueprint.js +187 -0
- package/dist/server/flow-surfaces/approval/builder.d.ts +225 -0
- package/dist/server/flow-surfaces/approval/builder.js +384 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.d.ts +33 -0
- package/dist/server/flow-surfaces/approval/catalog-specs.js +156 -0
- package/dist/server/flow-surfaces/approval/index.d.ts +14 -0
- package/dist/server/flow-surfaces/approval/index.js +40 -0
- package/dist/server/flow-surfaces/approval/runtime-config.d.ts +44 -0
- package/dist/server/flow-surfaces/approval/runtime-config.js +299 -0
- package/dist/server/flow-surfaces/approval/semantic-use.d.ts +23 -0
- package/dist/server/flow-surfaces/approval/semantic-use.js +155 -0
- package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
- package/dist/server/flow-surfaces/association-interfaces.js +39 -0
- package/dist/server/flow-surfaces/association-title-field.d.ts +20 -0
- package/dist/server/flow-surfaces/association-title-field.js +192 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.d.ts +15 -0
- package/dist/server/flow-surfaces/blueprint/compile-blocks.js +1251 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.d.ts +14 -0
- package/dist/server/flow-surfaces/blueprint/compile-plan.js +308 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.d.ts +11 -0
- package/dist/server/flow-surfaces/blueprint/compile-reaction.js +72 -0
- package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
- package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
- package/dist/server/flow-surfaces/blueprint/index.d.ts +12 -0
- package/dist/server/flow-surfaces/blueprint/index.js +44 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.d.ts +10 -0
- package/dist/server/flow-surfaces/blueprint/normalize-document.js +407 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.d.ts +25 -0
- package/dist/server/flow-surfaces/blueprint/private-utils.js +179 -0
- package/dist/server/flow-surfaces/blueprint/public-types.d.ts +201 -0
- package/dist/server/flow-surfaces/blueprint/public-types.js +24 -0
- package/dist/server/flow-surfaces/builder.d.ts +238 -0
- package/dist/server/flow-surfaces/builder.js +1261 -0
- package/dist/server/flow-surfaces/catalog-smart.d.ts +18 -0
- package/dist/server/flow-surfaces/catalog-smart.js +239 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.d.ts +15 -0
- package/dist/server/flow-surfaces/catalog-smart.projector.js +157 -0
- package/dist/server/flow-surfaces/catalog-smart.types.d.ts +99 -0
- package/dist/server/flow-surfaces/catalog-smart.types.js +24 -0
- package/dist/server/flow-surfaces/catalog.d.ts +79 -0
- package/dist/server/flow-surfaces/catalog.js +3743 -0
- package/dist/server/flow-surfaces/chart-config.d.ts +121 -0
- package/dist/server/flow-surfaces/chart-config.js +1394 -0
- package/dist/server/flow-surfaces/compose-compiler.d.ts +115 -0
- package/dist/server/flow-surfaces/compose-compiler.js +174 -0
- package/dist/server/flow-surfaces/compose-runtime.d.ts +94 -0
- package/dist/server/flow-surfaces/compose-runtime.js +376 -0
- package/dist/server/flow-surfaces/configure-options.d.ts +23 -0
- package/dist/server/flow-surfaces/configure-options.js +904 -0
- package/dist/server/flow-surfaces/constants.d.ts +351 -0
- package/dist/server/flow-surfaces/constants.js +104 -0
- package/dist/server/flow-surfaces/context.d.ts +72 -0
- package/dist/server/flow-surfaces/context.js +556 -0
- package/dist/server/flow-surfaces/contract-guard.d.ts +19 -0
- package/dist/server/flow-surfaces/contract-guard.js +410 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.d.ts +12 -0
- package/dist/server/flow-surfaces/core-field-default-bindings.js +157 -0
- package/dist/server/flow-surfaces/default-action-popup.d.ts +63 -0
- package/dist/server/flow-surfaces/default-action-popup.js +322 -0
- package/dist/server/flow-surfaces/default-block-actions.d.ts +32 -0
- package/dist/server/flow-surfaces/default-block-actions.js +210 -0
- package/dist/server/flow-surfaces/errors.d.ts +47 -0
- package/dist/server/flow-surfaces/errors.js +145 -0
- package/dist/server/flow-surfaces/executor.d.ts +23 -0
- package/dist/server/flow-surfaces/executor.js +132 -0
- package/dist/server/flow-surfaces/field-binding-registry.d.ts +24 -0
- package/dist/server/flow-surfaces/field-binding-registry.js +396 -0
- package/dist/server/flow-surfaces/field-semantics.d.ts +15 -0
- package/dist/server/flow-surfaces/field-semantics.js +84 -0
- package/dist/server/flow-surfaces/field-type-resolver.d.ts +45 -0
- package/dist/server/flow-surfaces/field-type-resolver.js +312 -0
- package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
- package/dist/server/flow-surfaces/filter-group.js +94 -0
- package/dist/server/flow-surfaces/hidden-popup-calendar.d.ts +86 -0
- package/dist/server/flow-surfaces/hidden-popup-calendar.js +554 -0
- package/dist/server/flow-surfaces/hidden-popup-contract.d.ts +116 -0
- package/dist/server/flow-surfaces/hidden-popup-contract.js +611 -0
- package/dist/server/flow-surfaces/hidden-popup-kanban.d.ts +62 -0
- package/dist/server/flow-surfaces/hidden-popup-kanban.js +651 -0
- package/dist/server/flow-surfaces/index.d.ts +11 -0
- package/dist/server/flow-surfaces/index.js +302 -0
- package/dist/server/flow-surfaces/locator.d.ts +28 -0
- package/dist/server/flow-surfaces/locator.js +240 -0
- package/dist/server/flow-surfaces/node-use-sets.d.ts +15 -0
- package/dist/server/flow-surfaces/node-use-sets.js +135 -0
- package/dist/server/flow-surfaces/payload-shape.d.ts +9 -0
- package/dist/server/flow-surfaces/payload-shape.js +61 -0
- package/dist/server/flow-surfaces/placement.d.ts +33 -0
- package/dist/server/flow-surfaces/placement.js +199 -0
- package/dist/server/flow-surfaces/planning/action-specs.d.ts +179 -0
- package/dist/server/flow-surfaces/planning/action-specs.js +190 -0
- package/dist/server/flow-surfaces/planning/compiler.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/compiler.js +376 -0
- package/dist/server/flow-surfaces/planning/context.d.ts +30 -0
- package/dist/server/flow-surfaces/planning/context.js +139 -0
- package/dist/server/flow-surfaces/planning/created-keys.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/created-keys.js +375 -0
- package/dist/server/flow-surfaces/planning/key-kind.d.ts +11 -0
- package/dist/server/flow-surfaces/planning/key-kind.js +88 -0
- package/dist/server/flow-surfaces/planning/key-persistence.d.ts +34 -0
- package/dist/server/flow-surfaces/planning/key-persistence.js +148 -0
- package/dist/server/flow-surfaces/planning/key-registry.d.ts +40 -0
- package/dist/server/flow-surfaces/planning/key-registry.js +206 -0
- package/dist/server/flow-surfaces/planning/runtime.d.ts +37 -0
- package/dist/server/flow-surfaces/planning/runtime.js +259 -0
- package/dist/server/flow-surfaces/planning/step-link.d.ts +14 -0
- package/dist/server/flow-surfaces/planning/step-link.js +104 -0
- package/dist/server/flow-surfaces/planning/types.d.ts +55 -0
- package/dist/server/flow-surfaces/planning/types.js +24 -0
- package/dist/server/flow-surfaces/public-compatibility.d.ts +28 -0
- package/dist/server/flow-surfaces/public-compatibility.js +161 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +24 -0
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +152 -0
- package/dist/server/flow-surfaces/reaction/errors.d.ts +20 -0
- package/dist/server/flow-surfaces/reaction/errors.js +69 -0
- package/dist/server/flow-surfaces/reaction/field-value.d.ts +34 -0
- package/dist/server/flow-surfaces/reaction/field-value.js +181 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.d.ts +16 -0
- package/dist/server/flow-surfaces/reaction/fingerprint.js +71 -0
- package/dist/server/flow-surfaces/reaction/linkage.d.ts +136 -0
- package/dist/server/flow-surfaces/reaction/linkage.js +882 -0
- package/dist/server/flow-surfaces/reaction/meta.d.ts +11 -0
- package/dist/server/flow-surfaces/reaction/meta.js +451 -0
- package/dist/server/flow-surfaces/reaction/registry.d.ts +156 -0
- package/dist/server/flow-surfaces/reaction/registry.js +206 -0
- package/dist/server/flow-surfaces/reaction/resolver.d.ts +22 -0
- package/dist/server/flow-surfaces/reaction/resolver.js +202 -0
- package/dist/server/flow-surfaces/reaction/types.d.ts +241 -0
- package/dist/server/flow-surfaces/reaction/types.js +24 -0
- package/dist/server/flow-surfaces/reaction/utils.d.ts +17 -0
- package/dist/server/flow-surfaces/reaction/utils.js +67 -0
- package/dist/server/flow-surfaces/reaction/value-expr.d.ts +15 -0
- package/dist/server/flow-surfaces/reaction/value-expr.js +209 -0
- package/dist/server/flow-surfaces/reference-guards.d.ts +19 -0
- package/dist/server/flow-surfaces/reference-guards.js +103 -0
- package/dist/server/flow-surfaces/route-sync.d.ts +50 -0
- package/dist/server/flow-surfaces/route-sync.js +393 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +42 -0
- package/dist/server/flow-surfaces/service-helpers.js +310 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +120 -0
- package/dist/server/flow-surfaces/service-utils.js +878 -0
- package/dist/server/flow-surfaces/service.d.ts +896 -0
- package/dist/server/flow-surfaces/service.js +16248 -0
- package/dist/server/flow-surfaces/support-matrix.d.ts +31 -0
- package/dist/server/flow-surfaces/support-matrix.js +282 -0
- package/dist/server/flow-surfaces/surface-context.d.ts +52 -0
- package/dist/server/flow-surfaces/surface-context.js +440 -0
- package/dist/server/flow-surfaces/template-compatibility.d.ts +42 -0
- package/dist/server/flow-surfaces/template-compatibility.js +189 -0
- package/dist/server/flow-surfaces/template-display.d.ts +20 -0
- package/dist/server/flow-surfaces/template-display.js +289 -0
- package/dist/server/flow-surfaces/template-service-utils.d.ts +62 -0
- package/dist/server/flow-surfaces/template-service-utils.js +281 -0
- package/dist/server/flow-surfaces/types.d.ts +288 -0
- package/dist/server/flow-surfaces/types.js +24 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +7 -2
- package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.d.ts +13 -0
- package/dist/server/migrations/20260508000000-remove-flow-model-options-runtime-uid.js +67 -0
- package/dist/server/plugin.d.ts +0 -1
- package/dist/server/plugin.js +9 -34
- package/dist/server/repository.js +0 -5
- package/dist/server/variables/resolve.d.ts +21 -0
- package/dist/server/variables/resolve.js +79 -0
- package/dist/swagger/flow-surfaces.d.ts +6106 -0
- package/dist/swagger/flow-surfaces.examples.d.ts +1577 -0
- package/dist/swagger/flow-surfaces.examples.js +1816 -0
- package/dist/swagger/flow-surfaces.js +5375 -0
- package/dist/swagger/flow-surfaces.template-action-docs.d.ts +62 -0
- package/dist/swagger/flow-surfaces.template-action-docs.js +121 -0
- package/dist/swagger/flow-surfaces.template-schemas.d.ts +239 -0
- package/dist/swagger/flow-surfaces.template-schemas.js +255 -0
- package/dist/swagger/index.d.ts +6111 -0
- package/dist/swagger/index.js +50 -0
- package/package.json +3 -3
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextApis.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextEnvs.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/getContextVars.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/nathan/skills/frontend-developer/tools}/lintAndTestJS.d.ts +0 -0
|
@@ -0,0 +1,651 @@
|
|
|
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 __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var hidden_popup_kanban_exports = {};
|
|
38
|
+
__export(hidden_popup_kanban_exports, {
|
|
39
|
+
KANBAN_BLOCK_POPUP_PROP_KEYS: () => KANBAN_BLOCK_POPUP_PROP_KEYS,
|
|
40
|
+
KANBAN_CARD_POPUP_PROP_KEYS: () => KANBAN_CARD_POPUP_PROP_KEYS,
|
|
41
|
+
KANBAN_POPUP_ACTION_KEYS: () => KANBAN_POPUP_ACTION_KEYS,
|
|
42
|
+
KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY: () => KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY,
|
|
43
|
+
buildKanbanInitialItemProps: () => buildKanbanInitialItemProps,
|
|
44
|
+
buildKanbanInitialItemStepParams: () => buildKanbanInitialItemStepParams,
|
|
45
|
+
buildKanbanInitialStepParams: () => buildKanbanInitialStepParams,
|
|
46
|
+
buildKanbanPopupOpenView: () => buildKanbanPopupOpenView,
|
|
47
|
+
ensureKanbanBlockPopupHosts: () => ensureKanbanBlockPopupHosts,
|
|
48
|
+
getKanbanBlockResourceInit: () => getKanbanBlockResourceInit,
|
|
49
|
+
getKanbanInitialPopupSettings: () => getKanbanInitialPopupSettings,
|
|
50
|
+
getKanbanInitialPopupSettingsFromProps: () => getKanbanInitialPopupSettingsFromProps,
|
|
51
|
+
getKanbanPopupActionUid: () => getKanbanPopupActionUid,
|
|
52
|
+
getKanbanPopupActionUse: () => getKanbanPopupActionUse,
|
|
53
|
+
getKanbanPopupStoredSettings: () => getKanbanPopupStoredSettings,
|
|
54
|
+
mergeKanbanPopupSettings: () => mergeKanbanPopupSettings,
|
|
55
|
+
normalizeKanbanPopupConfigureValue: () => normalizeKanbanPopupConfigureValue,
|
|
56
|
+
normalizeKanbanPopupSettings: () => normalizeKanbanPopupSettings,
|
|
57
|
+
projectKanbanBlockPopupHosts: () => projectKanbanBlockPopupHosts,
|
|
58
|
+
projectKanbanBlockPopupHostsInTree: () => projectKanbanBlockPopupHostsInTree,
|
|
59
|
+
replaceKanbanStoredPopupSettings: () => replaceKanbanStoredPopupSettings,
|
|
60
|
+
resolveKanbanInitialPopupOverride: () => resolveKanbanInitialPopupOverride,
|
|
61
|
+
stripKanbanPopupTargetSettingsForResourceChange: () => stripKanbanPopupTargetSettingsForResourceChange
|
|
62
|
+
});
|
|
63
|
+
module.exports = __toCommonJS(hidden_popup_kanban_exports);
|
|
64
|
+
var import_lodash = __toESM(require("lodash"));
|
|
65
|
+
var import_service_utils = require("./service-utils");
|
|
66
|
+
var import_hidden_popup_contract = require("./hidden-popup-contract");
|
|
67
|
+
const KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY = {
|
|
68
|
+
quickCreateAction: "-quick-create-action",
|
|
69
|
+
cardViewAction: "-card-view-action"
|
|
70
|
+
};
|
|
71
|
+
const KANBAN_POPUP_ACTION_KEYS = Object.keys(KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY);
|
|
72
|
+
const KANBAN_BLOCK_POPUP_PROP_KEYS = [
|
|
73
|
+
"popupMode",
|
|
74
|
+
"popupSize",
|
|
75
|
+
"popupTemplateUid",
|
|
76
|
+
"popupPageModelClass",
|
|
77
|
+
"popupTargetUid",
|
|
78
|
+
"quickCreatePopupSettings"
|
|
79
|
+
];
|
|
80
|
+
const KANBAN_CARD_POPUP_PROP_KEYS = [
|
|
81
|
+
"openMode",
|
|
82
|
+
"popupSize",
|
|
83
|
+
"popupTemplateUid",
|
|
84
|
+
"pageModelClass",
|
|
85
|
+
"popupTargetUid",
|
|
86
|
+
"cardPopupSettings"
|
|
87
|
+
];
|
|
88
|
+
const KANBAN_POPUP_PATCH_PATH_BY_ACTION = {
|
|
89
|
+
quickCreateAction: ["kanbanSettings", "popup"],
|
|
90
|
+
cardViewAction: ["cardSettings", "popup"]
|
|
91
|
+
};
|
|
92
|
+
function normalizeKanbanPopupSettings(actionKey, popupSettings, blockUid) {
|
|
93
|
+
const actionUid = blockUid && actionKey ? getKanbanPopupActionUid(blockUid, actionKey) : void 0;
|
|
94
|
+
return (0, import_hidden_popup_contract.normalizeHiddenPopupSettings)(popupSettings, {
|
|
95
|
+
invalidUids: [blockUid, actionUid]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function getKanbanInitialPopupSettings(actionKey, settings, blockUid) {
|
|
99
|
+
const primaryKey = actionKey === "quickCreateAction" ? "quickCreatePopup" : "cardPopup";
|
|
100
|
+
const legacyKey = actionKey === "quickCreateAction" ? "quickCreatePopupSettings" : "cardPopupSettings";
|
|
101
|
+
const popupSettings = import_lodash.default.isPlainObject(settings == null ? void 0 : settings[primaryKey]) ? settings == null ? void 0 : settings[primaryKey] : import_lodash.default.isPlainObject(settings == null ? void 0 : settings[legacyKey]) ? settings == null ? void 0 : settings[legacyKey] : void 0;
|
|
102
|
+
if (!import_lodash.default.isPlainObject(popupSettings)) {
|
|
103
|
+
return void 0;
|
|
104
|
+
}
|
|
105
|
+
const normalized = normalizeKanbanPopupSettings(actionKey, popupSettings, blockUid);
|
|
106
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
107
|
+
}
|
|
108
|
+
function getKanbanInitialPopupSettingsFromProps(actionKey, props, blockUid) {
|
|
109
|
+
if (!import_lodash.default.isPlainObject(props)) {
|
|
110
|
+
return void 0;
|
|
111
|
+
}
|
|
112
|
+
const rawSettings = actionKey === "quickCreateAction" ? (0, import_service_utils.buildDefinedPayload)({
|
|
113
|
+
mode: props.popupMode,
|
|
114
|
+
size: props.popupSize,
|
|
115
|
+
popupTemplateUid: props.popupTemplateUid,
|
|
116
|
+
pageModelClass: props.popupPageModelClass,
|
|
117
|
+
uid: props.popupTargetUid
|
|
118
|
+
}) : (0, import_service_utils.buildDefinedPayload)({
|
|
119
|
+
mode: props.cardOpenMode,
|
|
120
|
+
size: props.cardPopupSize,
|
|
121
|
+
popupTemplateUid: props.cardPopupTemplateUid,
|
|
122
|
+
pageModelClass: props.cardPopupPageModelClass,
|
|
123
|
+
uid: props.cardPopupTargetUid
|
|
124
|
+
});
|
|
125
|
+
const normalized = normalizeKanbanPopupSettings(actionKey, rawSettings, blockUid);
|
|
126
|
+
return Object.keys(normalized).length ? normalized : void 0;
|
|
127
|
+
}
|
|
128
|
+
function getKanbanPopupActionUse(actionKey) {
|
|
129
|
+
return actionKey === "quickCreateAction" ? "KanbanQuickCreateActionModel" : "KanbanCardViewActionModel";
|
|
130
|
+
}
|
|
131
|
+
function getKanbanPopupActionUid(kanbanUid, actionKey) {
|
|
132
|
+
return `${kanbanUid}${KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY[actionKey]}`;
|
|
133
|
+
}
|
|
134
|
+
function getKanbanBlockResourceInit(blockNode) {
|
|
135
|
+
const resourceInit = import_lodash.default.cloneDeep(import_lodash.default.get(blockNode, ["stepParams", "resourceSettings", "init"]) || {});
|
|
136
|
+
if (resourceInit.collectionName && !resourceInit.dataSourceKey) {
|
|
137
|
+
resourceInit.dataSourceKey = "main";
|
|
138
|
+
}
|
|
139
|
+
return resourceInit;
|
|
140
|
+
}
|
|
141
|
+
function buildKanbanInitialStepParams(input) {
|
|
142
|
+
var _a, _b, _c, _d;
|
|
143
|
+
const nextStepParams = import_lodash.default.cloneDeep(input.stepParams || {});
|
|
144
|
+
const initialQuickCreateEnabled = import_lodash.default.isBoolean((_a = input.settings) == null ? void 0 : _a.quickCreateEnabled) ? (_b = input.settings) == null ? void 0 : _b.quickCreateEnabled : import_lodash.default.isBoolean((_c = input.props) == null ? void 0 : _c.quickCreateEnabled) ? (_d = input.props) == null ? void 0 : _d.quickCreateEnabled : void 0;
|
|
145
|
+
if (import_lodash.default.isBoolean(initialQuickCreateEnabled) && !import_lodash.default.has(nextStepParams, ["kanbanSettings", "quickCreate"])) {
|
|
146
|
+
import_lodash.default.set(nextStepParams, ["kanbanSettings", "quickCreate"], {
|
|
147
|
+
quickCreateEnabled: initialQuickCreateEnabled
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const quickCreatePopup = import_lodash.default.has(nextStepParams, ["kanbanSettings", "popup"]) ? import_lodash.default.get(nextStepParams, ["kanbanSettings", "popup"]) : getKanbanInitialPopupSettings("quickCreateAction", input.settings) || getKanbanInitialPopupSettings("quickCreateAction", input.props) || getKanbanInitialPopupSettingsFromProps("quickCreateAction", input.props);
|
|
151
|
+
if (import_lodash.default.isPlainObject(quickCreatePopup)) {
|
|
152
|
+
import_lodash.default.set(nextStepParams, ["kanbanSettings", "popup"], import_lodash.default.cloneDeep(quickCreatePopup));
|
|
153
|
+
}
|
|
154
|
+
const cardPopup = import_lodash.default.has(nextStepParams, ["cardSettings", "popup"]) ? import_lodash.default.get(nextStepParams, ["cardSettings", "popup"]) : getKanbanInitialPopupSettings("cardViewAction", input.settings) || getKanbanInitialPopupSettings("cardViewAction", input.props) || getKanbanInitialPopupSettingsFromProps("cardViewAction", input.props);
|
|
155
|
+
if (import_lodash.default.isPlainObject(cardPopup)) {
|
|
156
|
+
import_lodash.default.set(nextStepParams, ["cardSettings", "popup"], import_lodash.default.cloneDeep(cardPopup));
|
|
157
|
+
}
|
|
158
|
+
return nextStepParams;
|
|
159
|
+
}
|
|
160
|
+
function buildKanbanInitialItemProps(input) {
|
|
161
|
+
var _a, _b, _c, _d;
|
|
162
|
+
const enableCardClick = import_lodash.default.isBoolean((_a = input.settings) == null ? void 0 : _a.enableCardClick) ? (_b = input.settings) == null ? void 0 : _b.enableCardClick : import_lodash.default.isBoolean((_c = input.props) == null ? void 0 : _c.enableCardClick) ? (_d = input.props) == null ? void 0 : _d.enableCardClick : void 0;
|
|
163
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
164
|
+
...import_lodash.default.isBoolean(enableCardClick) ? { enableCardClick } : {}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function buildKanbanInitialItemStepParams(input) {
|
|
168
|
+
var _a, _b, _c, _d;
|
|
169
|
+
const nextStepParams = import_lodash.default.cloneDeep(input.stepParams || {});
|
|
170
|
+
const enableCardClick = import_lodash.default.isBoolean((_a = input.settings) == null ? void 0 : _a.enableCardClick) ? (_b = input.settings) == null ? void 0 : _b.enableCardClick : import_lodash.default.isBoolean((_c = input.props) == null ? void 0 : _c.enableCardClick) ? (_d = input.props) == null ? void 0 : _d.enableCardClick : void 0;
|
|
171
|
+
if (import_lodash.default.isBoolean(enableCardClick) && !import_lodash.default.has(nextStepParams, ["cardSettings", "click"])) {
|
|
172
|
+
import_lodash.default.set(nextStepParams, ["cardSettings", "click"], {
|
|
173
|
+
enableCardClick
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const cardPopup = import_lodash.default.has(nextStepParams, ["cardSettings", "popup"]) ? import_lodash.default.get(nextStepParams, ["cardSettings", "popup"]) : getKanbanInitialPopupSettings("cardViewAction", input.settings) || getKanbanInitialPopupSettings("cardViewAction", input.props) || getKanbanInitialPopupSettingsFromProps("cardViewAction", input.props);
|
|
177
|
+
if (import_lodash.default.isPlainObject(cardPopup)) {
|
|
178
|
+
import_lodash.default.set(nextStepParams, ["cardSettings", "popup"], import_lodash.default.cloneDeep(cardPopup));
|
|
179
|
+
}
|
|
180
|
+
return nextStepParams;
|
|
181
|
+
}
|
|
182
|
+
function getKanbanPopupStoredSettings(blockNode, actionKey) {
|
|
183
|
+
var _a;
|
|
184
|
+
const itemNode = (0, import_service_utils.getSingleNodeSubModel)((_a = blockNode == null ? void 0 : blockNode.subModels) == null ? void 0 : _a.item);
|
|
185
|
+
const rawPopupSettings = (() => {
|
|
186
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
187
|
+
if (actionKey === "quickCreateAction") {
|
|
188
|
+
if (import_lodash.default.has(blockNode, ["stepParams", "kanbanSettings", "popup"])) {
|
|
189
|
+
const settings = import_lodash.default.get(blockNode, ["stepParams", "kanbanSettings", "popup"]);
|
|
190
|
+
return import_lodash.default.isPlainObject(settings) ? settings : {};
|
|
191
|
+
}
|
|
192
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
193
|
+
mode: (_a2 = blockNode == null ? void 0 : blockNode.props) == null ? void 0 : _a2.popupMode,
|
|
194
|
+
size: (_b = blockNode == null ? void 0 : blockNode.props) == null ? void 0 : _b.popupSize,
|
|
195
|
+
popupTemplateUid: (_c = blockNode == null ? void 0 : blockNode.props) == null ? void 0 : _c.popupTemplateUid,
|
|
196
|
+
pageModelClass: (_d = blockNode == null ? void 0 : blockNode.props) == null ? void 0 : _d.popupPageModelClass,
|
|
197
|
+
uid: (_e = blockNode == null ? void 0 : blockNode.props) == null ? void 0 : _e.popupTargetUid
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (import_lodash.default.has(itemNode, ["stepParams", "cardSettings", "popup"])) {
|
|
201
|
+
const settings = import_lodash.default.get(itemNode, ["stepParams", "cardSettings", "popup"]);
|
|
202
|
+
return import_lodash.default.isPlainObject(settings) ? settings : {};
|
|
203
|
+
}
|
|
204
|
+
return (0, import_service_utils.buildDefinedPayload)({
|
|
205
|
+
mode: (_f = itemNode == null ? void 0 : itemNode.props) == null ? void 0 : _f.openMode,
|
|
206
|
+
size: (_g = itemNode == null ? void 0 : itemNode.props) == null ? void 0 : _g.popupSize,
|
|
207
|
+
popupTemplateUid: (_h = itemNode == null ? void 0 : itemNode.props) == null ? void 0 : _h.popupTemplateUid,
|
|
208
|
+
pageModelClass: (_i = itemNode == null ? void 0 : itemNode.props) == null ? void 0 : _i.pageModelClass,
|
|
209
|
+
uid: (_j = itemNode == null ? void 0 : itemNode.props) == null ? void 0 : _j.popupTargetUid
|
|
210
|
+
});
|
|
211
|
+
})();
|
|
212
|
+
return normalizeKanbanPopupSettings(actionKey, rawPopupSettings, blockNode == null ? void 0 : blockNode.uid);
|
|
213
|
+
}
|
|
214
|
+
function buildKanbanPopupOpenView(input) {
|
|
215
|
+
const actionUid = getKanbanPopupActionUid(input.blockNode.uid, input.actionKey);
|
|
216
|
+
const resourceInit = input.resourceInit || getKanbanBlockResourceInit(input.blockNode);
|
|
217
|
+
return (0, import_hidden_popup_contract.buildHiddenPopupOpenView)({
|
|
218
|
+
actionUid,
|
|
219
|
+
resourceInit,
|
|
220
|
+
popupSettings: input.popupSettings ? input.popupSettings : getKanbanPopupStoredSettings(input.blockNode, input.actionKey),
|
|
221
|
+
normalizePopupSettings: (popupSettings) => normalizeKanbanPopupSettings(input.actionKey, popupSettings, input.blockNode.uid)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async function normalizeKanbanPopupConfigureValue(input) {
|
|
225
|
+
if (import_lodash.default.isUndefined(input.value)) {
|
|
226
|
+
return void 0;
|
|
227
|
+
}
|
|
228
|
+
if (import_lodash.default.isNull(input.value)) {
|
|
229
|
+
return {};
|
|
230
|
+
}
|
|
231
|
+
const actionUid = getKanbanPopupActionUid(input.blockUid, input.actionKey);
|
|
232
|
+
const normalized = await input.normalizeOpenView(input.actionName, input.value, {
|
|
233
|
+
transaction: input.transaction,
|
|
234
|
+
popupTemplateHostUid: actionUid,
|
|
235
|
+
popupActionContext: {
|
|
236
|
+
hasCurrentRecord: input.actionKey === "cardViewAction"
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
return normalizeKanbanPopupSettings(
|
|
240
|
+
input.actionKey,
|
|
241
|
+
{
|
|
242
|
+
...normalized || {},
|
|
243
|
+
...import_lodash.default.isPlainObject(input.value) && input.value.tryTemplate === false ? { tryTemplate: false } : {}
|
|
244
|
+
},
|
|
245
|
+
input.blockUid
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
function resolveKanbanInitialPopupOverride(settings, primaryKey, legacyKey) {
|
|
249
|
+
if (!import_lodash.default.isPlainObject(settings)) {
|
|
250
|
+
return void 0;
|
|
251
|
+
}
|
|
252
|
+
if (import_lodash.default.isPlainObject(settings[primaryKey])) {
|
|
253
|
+
return settings[primaryKey];
|
|
254
|
+
}
|
|
255
|
+
if (import_lodash.default.isPlainObject(settings[legacyKey])) {
|
|
256
|
+
return settings[legacyKey];
|
|
257
|
+
}
|
|
258
|
+
return void 0;
|
|
259
|
+
}
|
|
260
|
+
function mergeKanbanPopupSettings(actionKey, current, value, blockUid) {
|
|
261
|
+
if (!import_lodash.default.isPlainObject(value)) {
|
|
262
|
+
return {};
|
|
263
|
+
}
|
|
264
|
+
const currentBase = import_lodash.default.isPlainObject(current) && (0, import_hidden_popup_contract.hasExplicitHiddenPopupTargetSettings)(value) ? import_lodash.default.pick(import_lodash.default.cloneDeep(current), import_hidden_popup_contract.HIDDEN_POPUP_DISPLAY_KEYS) : current;
|
|
265
|
+
const merged = import_lodash.default.isPlainObject(currentBase) ? { ...import_lodash.default.cloneDeep(currentBase), ...import_lodash.default.cloneDeep(value) } : value;
|
|
266
|
+
return normalizeKanbanPopupSettings(actionKey, merged, blockUid);
|
|
267
|
+
}
|
|
268
|
+
function stripKanbanPopupTargetSettingsForResourceChange(actionKey, popupSettings, blockUid) {
|
|
269
|
+
return normalizeKanbanPopupSettings(
|
|
270
|
+
actionKey,
|
|
271
|
+
(0, import_hidden_popup_contract.stripHiddenPopupTargetSettings)(popupSettings, { disableTemplateAutoBind: true }),
|
|
272
|
+
blockUid
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
async function replaceKanbanStoredPopupSettings(runtime, blockNode, actionKey, popupSettings, transaction) {
|
|
276
|
+
var _a;
|
|
277
|
+
const targetNode = actionKey === "quickCreateAction" ? blockNode : (0, import_service_utils.getSingleNodeSubModel)((_a = blockNode == null ? void 0 : blockNode.subModels) == null ? void 0 : _a.item);
|
|
278
|
+
if (!(targetNode == null ? void 0 : targetNode.uid)) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const path = KANBAN_POPUP_PATCH_PATH_BY_ACTION[actionKey];
|
|
282
|
+
const nextStepParams = import_lodash.default.cloneDeep(targetNode.stepParams || {});
|
|
283
|
+
if (Object.keys(popupSettings || {}).length) {
|
|
284
|
+
import_lodash.default.set(nextStepParams, path, import_lodash.default.cloneDeep(popupSettings));
|
|
285
|
+
} else {
|
|
286
|
+
(0, import_hidden_popup_contract.unsetHiddenPopupPayloadPathAndPruneEmptyParents)(nextStepParams, path);
|
|
287
|
+
}
|
|
288
|
+
if (import_lodash.default.isEqual(nextStepParams, targetNode.stepParams || {})) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
await runtime.repository.patch(
|
|
292
|
+
{
|
|
293
|
+
uid: targetNode.uid,
|
|
294
|
+
stepParams: nextStepParams
|
|
295
|
+
},
|
|
296
|
+
{ transaction }
|
|
297
|
+
);
|
|
298
|
+
targetNode.stepParams = nextStepParams;
|
|
299
|
+
}
|
|
300
|
+
async function persistKanbanPopupSettingsFromOpenView(runtime, blockNode, actionKey, openView, popupSettings, transaction) {
|
|
301
|
+
const storedSettings = (0, import_hidden_popup_contract.buildPersistedHiddenPopupSettingsFromOpenView)({
|
|
302
|
+
openView,
|
|
303
|
+
popupSettings,
|
|
304
|
+
expectedHostUid: getKanbanPopupActionUid(blockNode.uid, actionKey),
|
|
305
|
+
normalizePopupSettings: (settings) => normalizeKanbanPopupSettings(actionKey, settings, blockNode == null ? void 0 : blockNode.uid)
|
|
306
|
+
});
|
|
307
|
+
await replaceKanbanStoredPopupSettings(runtime, blockNode, actionKey, storedSettings, transaction);
|
|
308
|
+
}
|
|
309
|
+
function mergeKanbanPopupDisplaySettings(actionKey, openView, popupSettings, fallbackOpenView, options = {}) {
|
|
310
|
+
return (0, import_hidden_popup_contract.mergeHiddenPopupDisplaySettings)({
|
|
311
|
+
openView,
|
|
312
|
+
popupSettings,
|
|
313
|
+
fallbackOpenView,
|
|
314
|
+
normalizePopupSettings: (settings) => normalizeKanbanPopupSettings(actionKey, settings),
|
|
315
|
+
preserveOpenViewDisplay: options.preserveOpenViewDisplay,
|
|
316
|
+
preserveOpenViewDisplayFallback: options.preserveOpenViewDisplayFallback
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async function buildKanbanPopupOpenViewWithTemplate(runtime, input) {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
const actionUid = getKanbanPopupActionUid(input.blockNode.uid, input.actionKey);
|
|
322
|
+
const openView = buildKanbanPopupOpenView(input);
|
|
323
|
+
return runtime.buildPopupOpenViewWithTemplate({
|
|
324
|
+
actionName: `kanban ${input.actionKey}`,
|
|
325
|
+
actionUid,
|
|
326
|
+
openView,
|
|
327
|
+
popupSettings: input.popupSettings,
|
|
328
|
+
existingHost: (0, import_service_utils.getSingleNodeSubModel)((_b = (_a = input.blockNode) == null ? void 0 : _a.subModels) == null ? void 0 : _b[input.actionKey]),
|
|
329
|
+
transaction: input.transaction,
|
|
330
|
+
hasCurrentRecord: input.actionKey === "cardViewAction",
|
|
331
|
+
normalizePopupSettings: (popupSettings) => normalizeKanbanPopupSettings(input.actionKey, popupSettings, input.blockNode.uid),
|
|
332
|
+
mergeDisplaySettings: (nextOpenView, popupSettings, fallbackOpenView) => mergeKanbanPopupDisplaySettings(input.actionKey, nextOpenView, popupSettings, fallbackOpenView)
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
async function resolveKanbanPopupOpenViewWithFallback(runtime, input) {
|
|
336
|
+
const baseOpenView = buildKanbanPopupOpenView(input);
|
|
337
|
+
const openView = await buildKanbanPopupOpenViewWithTemplate(runtime, input);
|
|
338
|
+
return mergeKanbanPopupDisplaySettings(input.actionKey, openView, input.popupSettings, baseOpenView);
|
|
339
|
+
}
|
|
340
|
+
async function ensureKanbanPopupHostDefaultContent(runtime, input) {
|
|
341
|
+
return runtime.ensurePopupHostDefaultContent({
|
|
342
|
+
actionName: `kanban ${input.actionKey}`,
|
|
343
|
+
actionUid: input.actionUid,
|
|
344
|
+
popupSettings: input.popupSettings,
|
|
345
|
+
transaction: input.transaction,
|
|
346
|
+
hasCurrentRecord: input.actionKey === "cardViewAction",
|
|
347
|
+
mergeDisplaySettings: (openView, popupSettings, fallbackOpenView) => mergeKanbanPopupDisplaySettings(input.actionKey, openView, popupSettings, fallbackOpenView)
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
async function ensureKanbanBlockPopupHosts(runtime, blockNode, transaction, popupSettingsOverrides, options = {}) {
|
|
351
|
+
var _a, _b;
|
|
352
|
+
if (!(blockNode == null ? void 0 : blockNode.uid) || blockNode.use !== "KanbanBlockModel") {
|
|
353
|
+
return blockNode;
|
|
354
|
+
}
|
|
355
|
+
const resourceInit = getKanbanBlockResourceInit(blockNode);
|
|
356
|
+
let changed = false;
|
|
357
|
+
for (const actionKey of KANBAN_POPUP_ACTION_KEYS) {
|
|
358
|
+
let existing = (0, import_service_utils.getSingleNodeSubModel)((_a = blockNode.subModels) == null ? void 0 : _a[actionKey]);
|
|
359
|
+
const expectedUid = getKanbanPopupActionUid(blockNode.uid, actionKey);
|
|
360
|
+
const expectedUse = getKanbanPopupActionUse(actionKey);
|
|
361
|
+
const popupSettingsOverride = (0, import_hidden_popup_contract.resolveHiddenPopupSettingsOverride)(popupSettingsOverrides, actionKey);
|
|
362
|
+
const popupSettings = popupSettingsOverride ?? getKanbanPopupStoredSettings(blockNode, actionKey);
|
|
363
|
+
const explicitPopupSettingsProvided = !!popupSettingsOverrides && Object.prototype.hasOwnProperty.call(popupSettingsOverrides, actionKey);
|
|
364
|
+
const seedOpenView = buildKanbanPopupOpenView({
|
|
365
|
+
blockNode,
|
|
366
|
+
actionKey,
|
|
367
|
+
resourceInit,
|
|
368
|
+
popupSettings
|
|
369
|
+
});
|
|
370
|
+
const displayFallbackOpenView = ((_b = options.displayFallbackOpenViews) == null ? void 0 : _b[actionKey]) || seedOpenView;
|
|
371
|
+
const shouldReplaceExisting = (existing == null ? void 0 : existing.uid) && existing.uid !== expectedUid;
|
|
372
|
+
if (!(existing == null ? void 0 : existing.uid) || shouldReplaceExisting || existing.use !== expectedUse) {
|
|
373
|
+
if (shouldReplaceExisting) {
|
|
374
|
+
await runtime.removeNodeTreeWithBindings(existing.uid, transaction);
|
|
375
|
+
}
|
|
376
|
+
await runtime.repository.upsertModel(
|
|
377
|
+
{
|
|
378
|
+
parentId: blockNode.uid,
|
|
379
|
+
subKey: actionKey,
|
|
380
|
+
subType: "object",
|
|
381
|
+
...(existing == null ? void 0 : existing.uid) === expectedUid ? import_lodash.default.cloneDeep(existing) : {},
|
|
382
|
+
uid: expectedUid,
|
|
383
|
+
use: expectedUse,
|
|
384
|
+
stepParams: (0, import_hidden_popup_contract.buildHiddenPopupActionStepParams)(
|
|
385
|
+
(existing == null ? void 0 : existing.uid) === expectedUid ? existing.stepParams : {},
|
|
386
|
+
seedOpenView
|
|
387
|
+
)
|
|
388
|
+
},
|
|
389
|
+
{ transaction }
|
|
390
|
+
);
|
|
391
|
+
existing = await runtime.repository.findModelById(expectedUid, {
|
|
392
|
+
transaction,
|
|
393
|
+
includeAsyncNode: true
|
|
394
|
+
});
|
|
395
|
+
if (String((seedOpenView == null ? void 0 : seedOpenView.popupTemplateUid) || "").trim()) {
|
|
396
|
+
await runtime.clearFlowTemplateUsagesForNodeTree(expectedUid, transaction);
|
|
397
|
+
await runtime.syncFlowTemplateUsagesForNodeTree(expectedUid, transaction);
|
|
398
|
+
}
|
|
399
|
+
changed = true;
|
|
400
|
+
}
|
|
401
|
+
const hasLocalPopupContent = (0, import_hidden_popup_contract.hiddenPopupHostHasLocalContent)(existing);
|
|
402
|
+
const currentOpenView = (0, import_hidden_popup_contract.resolveHiddenPopupHostOpenView)(existing);
|
|
403
|
+
const normalizedCurrentOpenView = normalizeKanbanPopupSettings(actionKey, currentOpenView, blockNode.uid);
|
|
404
|
+
const popupOpenViewTransition = await (0, import_hidden_popup_contract.resolveHiddenPopupOpenViewTransitionWithCandidate)({
|
|
405
|
+
existing,
|
|
406
|
+
expectedUid,
|
|
407
|
+
expectedUse,
|
|
408
|
+
popupSettings,
|
|
409
|
+
seedOpenView,
|
|
410
|
+
currentOpenView,
|
|
411
|
+
normalizedCurrentOpenView,
|
|
412
|
+
displayFallbackOpenView,
|
|
413
|
+
allowResourceMismatchRebuild: explicitPopupSettingsProvided,
|
|
414
|
+
mergeDisplaySettings: (openView2, popupSettings2, fallbackOpenView, mergeOptions) => mergeKanbanPopupDisplaySettings(actionKey, openView2, popupSettings2, fallbackOpenView, mergeOptions),
|
|
415
|
+
resolveCandidateOpenView: () => resolveKanbanPopupOpenViewWithFallback(runtime, {
|
|
416
|
+
blockNode,
|
|
417
|
+
actionKey,
|
|
418
|
+
resourceInit,
|
|
419
|
+
popupSettings,
|
|
420
|
+
transaction
|
|
421
|
+
})
|
|
422
|
+
});
|
|
423
|
+
const { openView } = popupOpenViewTransition;
|
|
424
|
+
const shouldUpsert = !(existing == null ? void 0 : existing.uid) || existing.use !== expectedUse || !hasLocalPopupContent && !import_lodash.default.isEqual(currentOpenView, openView) || explicitPopupSettingsProvided && !import_lodash.default.isEqual(currentOpenView, openView);
|
|
425
|
+
if (shouldUpsert) {
|
|
426
|
+
if ((existing == null ? void 0 : existing.uid) && existing.uid === expectedUid && !import_lodash.default.isEqual(currentOpenView, openView)) {
|
|
427
|
+
await runtime.reconcilePopupOpenViewTransition(expectedUid, currentOpenView, openView, transaction);
|
|
428
|
+
}
|
|
429
|
+
const shouldRefreshTemplateUsages = !import_lodash.default.isEqual(currentOpenView, openView);
|
|
430
|
+
const nextActionNode = {
|
|
431
|
+
...(existing == null ? void 0 : existing.uid) && existing.uid === expectedUid ? import_lodash.default.cloneDeep(existing) : {},
|
|
432
|
+
uid: expectedUid,
|
|
433
|
+
use: expectedUse,
|
|
434
|
+
stepParams: (0, import_hidden_popup_contract.buildHiddenPopupActionStepParams)(
|
|
435
|
+
(existing == null ? void 0 : existing.uid) === expectedUid ? existing.stepParams : {},
|
|
436
|
+
openView
|
|
437
|
+
)
|
|
438
|
+
};
|
|
439
|
+
await runtime.repository.upsertModel(
|
|
440
|
+
{
|
|
441
|
+
parentId: blockNode.uid,
|
|
442
|
+
subKey: actionKey,
|
|
443
|
+
subType: "object",
|
|
444
|
+
...nextActionNode
|
|
445
|
+
},
|
|
446
|
+
{ transaction }
|
|
447
|
+
);
|
|
448
|
+
if (shouldRefreshTemplateUsages || String((openView == null ? void 0 : openView.popupTemplateUid) || "").trim()) {
|
|
449
|
+
await runtime.clearFlowTemplateUsagesForNodeTree(expectedUid, transaction);
|
|
450
|
+
if (String((openView == null ? void 0 : openView.popupTemplateUid) || "").trim()) {
|
|
451
|
+
await runtime.syncFlowTemplateUsagesForNodeTree(expectedUid, transaction);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
changed = true;
|
|
455
|
+
}
|
|
456
|
+
const completedDefaultContent = await ensureKanbanPopupHostDefaultContent(runtime, {
|
|
457
|
+
actionKey,
|
|
458
|
+
actionUid: expectedUid,
|
|
459
|
+
popupSettings,
|
|
460
|
+
transaction
|
|
461
|
+
});
|
|
462
|
+
if (completedDefaultContent) {
|
|
463
|
+
existing = await runtime.repository.findModelById(expectedUid, {
|
|
464
|
+
transaction,
|
|
465
|
+
includeAsyncNode: true
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
const finalOpenView = completedDefaultContent ? (0, import_hidden_popup_contract.resolveHiddenPopupHostOpenView)(existing) : openView;
|
|
469
|
+
await persistKanbanPopupSettingsFromOpenView(
|
|
470
|
+
runtime,
|
|
471
|
+
blockNode,
|
|
472
|
+
actionKey,
|
|
473
|
+
finalOpenView,
|
|
474
|
+
popupSettings,
|
|
475
|
+
transaction
|
|
476
|
+
);
|
|
477
|
+
if (existing == null ? void 0 : existing.uid) {
|
|
478
|
+
blockNode.subModels = {
|
|
479
|
+
...blockNode.subModels || {},
|
|
480
|
+
[actionKey]: existing
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
changed = completedDefaultContent || changed;
|
|
484
|
+
}
|
|
485
|
+
if (!changed) {
|
|
486
|
+
return blockNode;
|
|
487
|
+
}
|
|
488
|
+
const refreshed = await runtime.repository.findModelById(blockNode.uid, {
|
|
489
|
+
transaction,
|
|
490
|
+
includeAsyncNode: true
|
|
491
|
+
});
|
|
492
|
+
if (refreshed == null ? void 0 : refreshed.uid) {
|
|
493
|
+
return refreshed;
|
|
494
|
+
}
|
|
495
|
+
return blockNode;
|
|
496
|
+
}
|
|
497
|
+
function projectKanbanBlockPopupHosts(node) {
|
|
498
|
+
var _a;
|
|
499
|
+
if (!node || typeof node !== "object") {
|
|
500
|
+
return node;
|
|
501
|
+
}
|
|
502
|
+
const current = node;
|
|
503
|
+
if (!(current == null ? void 0 : current.uid) || current.use !== "KanbanBlockModel") {
|
|
504
|
+
return node;
|
|
505
|
+
}
|
|
506
|
+
const resourceInit = getKanbanBlockResourceInit(current);
|
|
507
|
+
let nextSubModels = current.subModels;
|
|
508
|
+
let changed = false;
|
|
509
|
+
for (const actionKey of KANBAN_POPUP_ACTION_KEYS) {
|
|
510
|
+
const existing = (0, import_service_utils.getSingleNodeSubModel)((_a = current.subModels) == null ? void 0 : _a[actionKey]);
|
|
511
|
+
const expectedUid = getKanbanPopupActionUid(current.uid, actionKey);
|
|
512
|
+
const expectedUse = getKanbanPopupActionUse(actionKey);
|
|
513
|
+
const popupSettings = getKanbanPopupStoredSettings(current, actionKey);
|
|
514
|
+
const persistedOpenView = (0, import_hidden_popup_contract.resolveHiddenPopupHostOpenView)(existing);
|
|
515
|
+
const seedOpenView = buildKanbanPopupOpenView({
|
|
516
|
+
blockNode: current,
|
|
517
|
+
actionKey,
|
|
518
|
+
resourceInit,
|
|
519
|
+
popupSettings
|
|
520
|
+
});
|
|
521
|
+
const currentOpenView = (0, import_hidden_popup_contract.resolveHiddenPopupHostOpenView)(existing);
|
|
522
|
+
const normalizedCurrentOpenView = normalizeKanbanPopupSettings(actionKey, currentOpenView, current.uid);
|
|
523
|
+
const { openView } = (0, import_hidden_popup_contract.resolveHiddenPopupOpenViewTransition)({
|
|
524
|
+
existing,
|
|
525
|
+
expectedUid,
|
|
526
|
+
expectedUse,
|
|
527
|
+
popupSettings,
|
|
528
|
+
seedOpenView,
|
|
529
|
+
candidateOpenView: seedOpenView,
|
|
530
|
+
currentOpenView,
|
|
531
|
+
normalizedCurrentOpenView,
|
|
532
|
+
preservedOpenView: persistedOpenView,
|
|
533
|
+
resourceMismatchDisplayFallbackOpenView: (0, import_hidden_popup_contract.buildHiddenPopupResourceMismatchDisplayFallbackOpenView)({
|
|
534
|
+
normalizedCurrentOpenView,
|
|
535
|
+
resourceInit,
|
|
536
|
+
popupSettings,
|
|
537
|
+
stripPopupTargetSettingsForResourceChange: (popupSettings2) => stripKanbanPopupTargetSettingsForResourceChange(actionKey, popupSettings2, current.uid),
|
|
538
|
+
buildOpenView: ({ resourceInit: resourceInit2, popupSettings: popupSettings2 }) => buildKanbanPopupOpenView({
|
|
539
|
+
blockNode: current,
|
|
540
|
+
actionKey,
|
|
541
|
+
resourceInit: resourceInit2,
|
|
542
|
+
popupSettings: popupSettings2
|
|
543
|
+
})
|
|
544
|
+
}),
|
|
545
|
+
allowResourceMismatchRebuild: true,
|
|
546
|
+
mergeDisplaySettings: (openView2, popupSettings2, fallbackOpenView, mergeOptions) => mergeKanbanPopupDisplaySettings(actionKey, openView2, popupSettings2, fallbackOpenView, mergeOptions)
|
|
547
|
+
});
|
|
548
|
+
if ((existing == null ? void 0 : existing.uid) === expectedUid && existing.use === expectedUse && import_lodash.default.isEqual(currentOpenView, openView)) {
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
const nextActionNode = {
|
|
552
|
+
...(existing == null ? void 0 : existing.uid) === expectedUid ? import_lodash.default.cloneDeep(existing) : {},
|
|
553
|
+
uid: expectedUid,
|
|
554
|
+
use: expectedUse,
|
|
555
|
+
stepParams: (0, import_hidden_popup_contract.buildHiddenPopupActionStepParams)((existing == null ? void 0 : existing.uid) === expectedUid ? existing.stepParams : {}, openView)
|
|
556
|
+
};
|
|
557
|
+
if (!changed) {
|
|
558
|
+
nextSubModels = {
|
|
559
|
+
...current.subModels || {}
|
|
560
|
+
};
|
|
561
|
+
changed = true;
|
|
562
|
+
}
|
|
563
|
+
nextSubModels[actionKey] = nextActionNode;
|
|
564
|
+
}
|
|
565
|
+
if (!changed) {
|
|
566
|
+
return node;
|
|
567
|
+
}
|
|
568
|
+
return {
|
|
569
|
+
...current,
|
|
570
|
+
subModels: nextSubModels
|
|
571
|
+
};
|
|
572
|
+
}
|
|
573
|
+
function projectKanbanBlockPopupHostsInTree(node) {
|
|
574
|
+
if (!node || typeof node !== "object") {
|
|
575
|
+
return node;
|
|
576
|
+
}
|
|
577
|
+
let current = projectKanbanBlockPopupHosts(node);
|
|
578
|
+
let nextSubModels = current == null ? void 0 : current.subModels;
|
|
579
|
+
let changed = current !== node;
|
|
580
|
+
if (!nextSubModels || typeof nextSubModels !== "object") {
|
|
581
|
+
return current;
|
|
582
|
+
}
|
|
583
|
+
for (const [subKey, value] of Object.entries(nextSubModels)) {
|
|
584
|
+
if (Array.isArray(value)) {
|
|
585
|
+
const nextItems = [];
|
|
586
|
+
let itemsChanged = false;
|
|
587
|
+
for (const item of value) {
|
|
588
|
+
const nextItem = projectKanbanBlockPopupHostsInTree(item);
|
|
589
|
+
nextItems.push(nextItem);
|
|
590
|
+
itemsChanged = itemsChanged || nextItem !== item;
|
|
591
|
+
}
|
|
592
|
+
if (!itemsChanged) {
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (!changed) {
|
|
596
|
+
current = {
|
|
597
|
+
...current,
|
|
598
|
+
subModels: {
|
|
599
|
+
...nextSubModels
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
nextSubModels = current.subModels;
|
|
603
|
+
changed = true;
|
|
604
|
+
}
|
|
605
|
+
nextSubModels[subKey] = nextItems;
|
|
606
|
+
continue;
|
|
607
|
+
}
|
|
608
|
+
const nextValue = projectKanbanBlockPopupHostsInTree(value);
|
|
609
|
+
if (nextValue === value) {
|
|
610
|
+
continue;
|
|
611
|
+
}
|
|
612
|
+
if (!changed) {
|
|
613
|
+
current = {
|
|
614
|
+
...current,
|
|
615
|
+
subModels: {
|
|
616
|
+
...nextSubModels
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
nextSubModels = current.subModels;
|
|
620
|
+
changed = true;
|
|
621
|
+
}
|
|
622
|
+
nextSubModels[subKey] = nextValue;
|
|
623
|
+
}
|
|
624
|
+
return current;
|
|
625
|
+
}
|
|
626
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
627
|
+
0 && (module.exports = {
|
|
628
|
+
KANBAN_BLOCK_POPUP_PROP_KEYS,
|
|
629
|
+
KANBAN_CARD_POPUP_PROP_KEYS,
|
|
630
|
+
KANBAN_POPUP_ACTION_KEYS,
|
|
631
|
+
KANBAN_POPUP_ACTION_UID_SUFFIX_BY_KEY,
|
|
632
|
+
buildKanbanInitialItemProps,
|
|
633
|
+
buildKanbanInitialItemStepParams,
|
|
634
|
+
buildKanbanInitialStepParams,
|
|
635
|
+
buildKanbanPopupOpenView,
|
|
636
|
+
ensureKanbanBlockPopupHosts,
|
|
637
|
+
getKanbanBlockResourceInit,
|
|
638
|
+
getKanbanInitialPopupSettings,
|
|
639
|
+
getKanbanInitialPopupSettingsFromProps,
|
|
640
|
+
getKanbanPopupActionUid,
|
|
641
|
+
getKanbanPopupActionUse,
|
|
642
|
+
getKanbanPopupStoredSettings,
|
|
643
|
+
mergeKanbanPopupSettings,
|
|
644
|
+
normalizeKanbanPopupConfigureValue,
|
|
645
|
+
normalizeKanbanPopupSettings,
|
|
646
|
+
projectKanbanBlockPopupHosts,
|
|
647
|
+
projectKanbanBlockPopupHostsInTree,
|
|
648
|
+
replaceKanbanStoredPopupSettings,
|
|
649
|
+
resolveKanbanInitialPopupOverride,
|
|
650
|
+
stripKanbanPopupTargetSettingsForResourceChange
|
|
651
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { Plugin } from '@nocobase/server';
|
|
10
|
+
import { FlowSurfacesService } from './service';
|
|
11
|
+
export declare function registerFlowSurfacesResource(plugin: Plugin): FlowSurfacesService;
|