@nocobase/plugin-flow-engine 2.1.0-alpha.20 → 2.1.0-alpha.22

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.
Files changed (50) hide show
  1. package/dist/externalVersion.js +11 -10
  2. package/dist/node_modules/ses/dist/ses.cjs +1 -1
  3. package/dist/node_modules/ses/package.json +1 -1
  4. package/dist/node_modules/zod/index.cjs +1 -1
  5. package/dist/node_modules/zod/package.json +1 -1
  6. package/dist/server/flow-surfaces/action-scope.d.ts +1 -0
  7. package/dist/server/flow-surfaces/action-scope.js +4 -0
  8. package/dist/server/flow-surfaces/apply/compiler.js +1 -1
  9. package/dist/server/flow-surfaces/approval/builder.js +8 -8
  10. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +192 -29
  11. package/dist/server/flow-surfaces/blueprint/defaults.d.ts +26 -0
  12. package/dist/server/flow-surfaces/blueprint/defaults.js +133 -0
  13. package/dist/server/flow-surfaces/blueprint/index.d.ts +1 -1
  14. package/dist/server/flow-surfaces/blueprint/normalize-document.js +121 -1
  15. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +32 -0
  16. package/dist/server/flow-surfaces/builder.d.ts +2 -2
  17. package/dist/server/flow-surfaces/builder.js +148 -50
  18. package/dist/server/flow-surfaces/catalog.js +276 -34
  19. package/dist/server/flow-surfaces/compose-compiler.d.ts +2 -0
  20. package/dist/server/flow-surfaces/compose-compiler.js +5 -1
  21. package/dist/server/flow-surfaces/configure-options.js +88 -12
  22. package/dist/server/flow-surfaces/contract-guard.js +60 -69
  23. package/dist/server/flow-surfaces/default-action-popup.d.ts +11 -1
  24. package/dist/server/flow-surfaces/default-action-popup.js +72 -12
  25. package/dist/server/flow-surfaces/default-block-actions.js +8 -1
  26. package/dist/server/flow-surfaces/filter-group.d.ts +15 -0
  27. package/dist/server/flow-surfaces/filter-group.js +94 -0
  28. package/dist/server/flow-surfaces/index.js +70 -2
  29. package/dist/server/flow-surfaces/node-use-sets.js +6 -1
  30. package/dist/server/flow-surfaces/placement.js +3 -0
  31. package/dist/server/flow-surfaces/public-data-surface-default-filter.d.ts +20 -0
  32. package/dist/server/flow-surfaces/public-data-surface-default-filter.js +111 -0
  33. package/dist/server/flow-surfaces/reaction/registry.d.ts +7 -0
  34. package/dist/server/flow-surfaces/reaction/registry.js +7 -0
  35. package/dist/server/flow-surfaces/service-utils.d.ts +7 -0
  36. package/dist/server/flow-surfaces/service-utils.js +58 -9
  37. package/dist/server/flow-surfaces/service.d.ts +73 -3
  38. package/dist/server/flow-surfaces/service.js +1794 -162
  39. package/dist/server/flow-surfaces/support-matrix.d.ts +5 -2
  40. package/dist/server/flow-surfaces/support-matrix.js +16 -3
  41. package/dist/server/flow-surfaces/surface-context.js +2 -1
  42. package/dist/server/flow-surfaces/template-display.d.ts +20 -0
  43. package/dist/server/flow-surfaces/template-display.js +289 -0
  44. package/dist/server/flow-surfaces/types.d.ts +1 -0
  45. package/dist/swagger/flow-surfaces.d.ts +160 -0
  46. package/dist/swagger/flow-surfaces.examples.d.ts +117 -11
  47. package/dist/swagger/flow-surfaces.examples.js +152 -1
  48. package/dist/swagger/flow-surfaces.js +141 -21
  49. package/dist/swagger/index.d.ts +160 -0
  50. package/package.json +2 -2
@@ -0,0 +1,15 @@
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
+ export declare const FLOW_SURFACE_EMPTY_FILTER_GROUP: {
10
+ logic: string;
11
+ items: any[];
12
+ };
13
+ export declare const FLOW_SURFACE_FILTER_GROUP_EXAMPLE: string;
14
+ export declare function normalizeFlowSurfaceFilterGroupValue(value: any, errorPrefix: string): any;
15
+ export declare function assertFlowSurfaceFilterGroupShape(filter: any): void;
@@ -0,0 +1,94 @@
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 filter_group_exports = {};
38
+ __export(filter_group_exports, {
39
+ FLOW_SURFACE_EMPTY_FILTER_GROUP: () => FLOW_SURFACE_EMPTY_FILTER_GROUP,
40
+ FLOW_SURFACE_FILTER_GROUP_EXAMPLE: () => FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
41
+ assertFlowSurfaceFilterGroupShape: () => assertFlowSurfaceFilterGroupShape,
42
+ normalizeFlowSurfaceFilterGroupValue: () => normalizeFlowSurfaceFilterGroupValue
43
+ });
44
+ module.exports = __toCommonJS(filter_group_exports);
45
+ var import_utils = require("@nocobase/utils");
46
+ var import_lodash = __toESM(require("lodash"));
47
+ var import_errors = require("./errors");
48
+ const FLOW_SURFACE_EMPTY_FILTER_GROUP = {
49
+ logic: "$and",
50
+ items: []
51
+ };
52
+ const FLOW_SURFACE_FILTER_GROUP_EXAMPLE = JSON.stringify(FLOW_SURFACE_EMPTY_FILTER_GROUP);
53
+ function normalizeFlowSurfaceFilterGroupValue(value, errorPrefix) {
54
+ const normalized = value === null || import_lodash.default.isPlainObject(value) && !Object.keys(value).length ? import_lodash.default.cloneDeep(FLOW_SURFACE_EMPTY_FILTER_GROUP) : import_lodash.default.cloneDeep(value);
55
+ try {
56
+ assertFlowSurfaceFilterGroupShape(normalized);
57
+ (0, import_utils.transformFilter)(normalized);
58
+ return normalized;
59
+ } catch (error) {
60
+ const reason = error instanceof Error ? error.message : String(error);
61
+ (0, import_errors.throwBadRequest)(`${errorPrefix}: ${reason}`);
62
+ }
63
+ }
64
+ function assertFlowSurfaceFilterGroupShape(filter) {
65
+ if (!import_lodash.default.isPlainObject(filter)) {
66
+ throw new Error("Invalid filter: filter must be an object");
67
+ }
68
+ if (!("logic" in filter) || !("items" in filter)) {
69
+ throw new Error("Invalid filter: filter must have logic and items properties");
70
+ }
71
+ if (filter.logic !== "$and" && filter.logic !== "$or") {
72
+ throw new Error("Invalid filter: logic must be '$and' or '$or'");
73
+ }
74
+ if (!Array.isArray(filter.items)) {
75
+ throw new Error("Invalid filter: items must be an array");
76
+ }
77
+ filter.items.forEach((item) => {
78
+ if (import_lodash.default.isPlainObject(item) && "logic" in item && "items" in item) {
79
+ assertFlowSurfaceFilterGroupShape(item);
80
+ return;
81
+ }
82
+ if (import_lodash.default.isPlainObject(item) && typeof item.path === "string" && typeof item.operator === "string") {
83
+ return;
84
+ }
85
+ throw new Error("Invalid filter item type");
86
+ });
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ FLOW_SURFACE_EMPTY_FILTER_GROUP,
91
+ FLOW_SURFACE_FILTER_GROUP_EXAMPLE,
92
+ assertFlowSurfaceFilterGroupShape,
93
+ normalizeFlowSurfaceFilterGroupValue
94
+ });
@@ -33,6 +33,23 @@ var import_resourcer = require("@nocobase/resourcer");
33
33
  var import_constants = require("./constants");
34
34
  var import_errors = require("./errors");
35
35
  var import_service = require("./service");
36
+ const FLOW_ENGINE_LOCALE_NAMESPACE = "flow-engine";
37
+ const FLOW_SURFACE_LOCALE_FALLBACK_NAMESPACES = [
38
+ FLOW_ENGINE_LOCALE_NAMESPACE,
39
+ "@nocobase/flow-engine",
40
+ "@nocobase/plugin-flow-engine",
41
+ "client"
42
+ ];
43
+ const FLOW_SURFACE_LOCAL_TRANSLATIONS = {
44
+ "zh-CN": {
45
+ "Popup for Add New": "\u65B0\u589E\u5F39\u7A97",
46
+ "Popup for Edit": "\u7F16\u8F91\u5F39\u7A97",
47
+ "Popup for Details": "\u8BE6\u60C5\u5F39\u7A97",
48
+ "Auto generated": "\u81EA\u52A8\u751F\u6210",
49
+ 'Automatically generated popup template for collection "{{collectionLabel}}" ({{popupLabel}}).': "\u4E3A\u6570\u636E\u8868\u201C{{collectionLabel}}\u201D\u81EA\u52A8\u751F\u6210\u7684\u5F39\u7A97\u6A21\u677F\uFF08{{popupLabel}}\uFF09\u3002",
50
+ 'Automatically generated popup template for relation field "{{associationFieldLabel}}" in collection "{{sourceCollectionLabel}}", targeting "{{targetCollectionLabel}}" ({{popupLabel}}).': "\u4E3A\u6570\u636E\u8868\u201C{{sourceCollectionLabel}}\u201D\u4E2D\u7684\u5173\u7CFB\u5B57\u6BB5\u201C{{associationFieldLabel}}\u201D\u81EA\u52A8\u751F\u6210\u7684\u5F39\u7A97\u6A21\u677F\uFF0C\u76EE\u6807\u6570\u636E\u8868\u4E3A\u201C{{targetCollectionLabel}}\u201D\uFF08{{popupLabel}}\uFF09\u3002"
51
+ }
52
+ };
36
53
  function getValues(ctx) {
37
54
  var _a, _b, _c;
38
55
  return ((_b = (_a = ctx.action) == null ? void 0 : _a.params) == null ? void 0 : _b.values) ?? ((_c = ctx.action) == null ? void 0 : _c.params) ?? {};
@@ -134,6 +151,56 @@ function invokeFlowSurfaceServiceAction(service, actionName, values, options = {
134
151
  const handler = service[actionName];
135
152
  return handler.call(service, values, options);
136
153
  }
154
+ function interpolateTranslation(value, options) {
155
+ return value.replace(/\{\{\s*([^}\s]+)\s*\}\}/g, (_match, name) => {
156
+ const replacement = options == null ? void 0 : options[name];
157
+ return replacement === null || typeof replacement === "undefined" ? "" : String(replacement);
158
+ });
159
+ }
160
+ function getResourceTranslation(ctx, key, options) {
161
+ var _a, _b, _c, _d;
162
+ const locale = ((_a = ctx.getCurrentLocale) == null ? void 0 : _a.call(ctx)) || ((_b = ctx.i18n) == null ? void 0 : _b.language);
163
+ const i18n = (_c = ctx.app) == null ? void 0 : _c.i18n;
164
+ if (!locale || !i18n) {
165
+ return void 0;
166
+ }
167
+ for (const ns of FLOW_SURFACE_LOCALE_FALLBACK_NAMESPACES) {
168
+ const value = (_d = i18n.getResource) == null ? void 0 : _d.call(i18n, locale, ns, key);
169
+ if (typeof value === "string") {
170
+ return interpolateTranslation(value, options);
171
+ }
172
+ }
173
+ return void 0;
174
+ }
175
+ function getLocalTranslation(ctx, key, options) {
176
+ var _a, _b;
177
+ const locale = String(((_a = ctx.getCurrentLocale) == null ? void 0 : _a.call(ctx)) || ((_b = ctx.i18n) == null ? void 0 : _b.language) || "").trim();
178
+ const resources = FLOW_SURFACE_LOCAL_TRANSLATIONS[locale];
179
+ const value = resources == null ? void 0 : resources[key];
180
+ return typeof value === "string" ? interpolateTranslation(value, options) : void 0;
181
+ }
182
+ function getFlowSurfaceTranslate(ctx) {
183
+ var _a, _b, _c;
184
+ const translate = ((_b = (_a = ctx.i18n) == null ? void 0 : _a.t) == null ? void 0 : _b.bind(ctx.i18n)) || ((_c = ctx.t) == null ? void 0 : _c.bind(ctx));
185
+ if (typeof translate !== "function") {
186
+ return void 0;
187
+ }
188
+ return (key, options) => {
189
+ const resourceValue = getResourceTranslation(ctx, key, options);
190
+ if (typeof resourceValue === "string") {
191
+ return resourceValue;
192
+ }
193
+ const localValue = getLocalTranslation(ctx, key, options);
194
+ if (typeof localValue === "string") {
195
+ return localValue;
196
+ }
197
+ return translate(key, {
198
+ ns: [FLOW_ENGINE_LOCALE_NAMESPACE, "client"],
199
+ nsMode: "fallback",
200
+ ...options || {}
201
+ });
202
+ };
203
+ }
137
204
  function registerFlowSurfacesResource(plugin) {
138
205
  const service = new import_service.FlowSurfacesService(plugin);
139
206
  const actions = Object.fromEntries(
@@ -143,12 +210,13 @@ function registerFlowSurfacesResource(plugin) {
143
210
  await runFlowSurfaceAction(ctx, next, async () => {
144
211
  const definition = import_constants.FLOW_SURFACE_ACTION_DEFINITIONS[actionName];
145
212
  const values = definition.valueSource === "read" ? getReadValues(ctx) : getValues(ctx);
213
+ const t = getFlowSurfaceTranslate(ctx);
146
214
  if (definition.transaction) {
147
215
  return service.transaction(
148
- (transaction) => invokeFlowSurfaceServiceAction(service, actionName, values, { transaction })
216
+ (transaction) => invokeFlowSurfaceServiceAction(service, actionName, values, { transaction, t })
149
217
  );
150
218
  }
151
- return invokeFlowSurfaceServiceAction(service, actionName, values);
219
+ return invokeFlowSurfaceServiceAction(service, actionName, values, { t });
152
220
  });
153
221
  }
154
222
  ])
@@ -38,6 +38,7 @@ module.exports = __toCommonJS(node_use_sets_exports);
38
38
  var import_approval = require("./approval");
39
39
  const COLLECTION_BLOCK_USES = /* @__PURE__ */ new Set([
40
40
  "TableBlockModel",
41
+ "CalendarBlockModel",
41
42
  "CreateFormModel",
42
43
  "EditFormModel",
43
44
  "FormBlockModel",
@@ -65,7 +66,7 @@ const FIELD_WRAPPER_USES = /* @__PURE__ */ new Set([
65
66
  "TableColumnModel",
66
67
  ...import_approval.APPROVAL_FIELD_WRAPPER_USES
67
68
  ]);
68
- const CREATABLE_STANDALONE_FIELD_USES = /* @__PURE__ */ new Set(["JSColumnModel", "JSItemModel"]);
69
+ const CREATABLE_STANDALONE_FIELD_USES = /* @__PURE__ */ new Set(["JSColumnModel", "JSItemModel", "DividerItemModel"]);
69
70
  const STANDALONE_FIELD_NODE_USES = /* @__PURE__ */ new Set([...CREATABLE_STANDALONE_FIELD_USES, "FormJSFieldItemModel"]);
70
71
  const ACTION_BUTTON_USES = /* @__PURE__ */ new Set([
71
72
  "AddNewActionModel",
@@ -104,6 +105,10 @@ const ACTION_BUTTON_USES = /* @__PURE__ */ new Set([
104
105
  "JSItemActionModel",
105
106
  "FilterFormJSActionModel",
106
107
  "JSActionModel",
108
+ "CalendarTodayActionModel",
109
+ "CalendarNavActionModel",
110
+ "CalendarTitleActionModel",
111
+ "CalendarViewSelectActionModel",
107
112
  "ApplyFormSubmitModel",
108
113
  "ApplyFormSaveDraftModel",
109
114
  "ApplyFormWithdrawModel",
@@ -56,6 +56,8 @@ const FLOW_SURFACE_POPUP_HOST_USES = /* @__PURE__ */ new Set([
56
56
  "ViewActionModel",
57
57
  "EditActionModel",
58
58
  "PopupCollectionActionModel",
59
+ "CalendarQuickCreateActionModel",
60
+ "CalendarEventViewActionModel",
59
61
  "ClickableFieldModel",
60
62
  "DisplayTextFieldModel",
61
63
  "DisplayEnumFieldModel",
@@ -158,6 +160,7 @@ function isBlockContainerUse(parentUse, subKey) {
158
160
  function isActionContainerUse(parentUse) {
159
161
  return [
160
162
  "TableBlockModel",
163
+ "CalendarBlockModel",
161
164
  "TableActionsColumnModel",
162
165
  "ListBlockModel",
163
166
  "GridCardBlockModel",
@@ -0,0 +1,20 @@
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
+ export declare const FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES: Set<string>;
10
+ export declare function isFlowSurfacePublicDataSurfaceBlockType(blockType?: string): boolean;
11
+ export declare function normalizeFlowSurfacePublicBlockDefaultFilter(actionName: string, defaultFilter: any, options: {
12
+ blockType?: string;
13
+ template?: unknown;
14
+ path?: string;
15
+ }): any;
16
+ export declare function backfillFlowSurfaceDefaultFilterSetting(settings: any, defaultFilter: any): any;
17
+ export declare function backfillFlowSurfaceFilterActionDefaultFilter<T extends {
18
+ type?: string;
19
+ settings?: Record<string, any>;
20
+ }>(actions: T[], defaultFilter: any): T[];
@@ -0,0 +1,111 @@
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 public_data_surface_default_filter_exports = {};
38
+ __export(public_data_surface_default_filter_exports, {
39
+ FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES: () => FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES,
40
+ backfillFlowSurfaceDefaultFilterSetting: () => backfillFlowSurfaceDefaultFilterSetting,
41
+ backfillFlowSurfaceFilterActionDefaultFilter: () => backfillFlowSurfaceFilterActionDefaultFilter,
42
+ isFlowSurfacePublicDataSurfaceBlockType: () => isFlowSurfacePublicDataSurfaceBlockType,
43
+ normalizeFlowSurfacePublicBlockDefaultFilter: () => normalizeFlowSurfacePublicBlockDefaultFilter
44
+ });
45
+ module.exports = __toCommonJS(public_data_surface_default_filter_exports);
46
+ var import_lodash = __toESM(require("lodash"));
47
+ var import_errors = require("./errors");
48
+ var import_filter_group = require("./filter-group");
49
+ const FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES = /* @__PURE__ */ new Set(["table", "list", "gridCard"]);
50
+ function isFlowSurfacePublicDataSurfaceBlockType(blockType) {
51
+ return FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES.has(String(blockType || "").trim());
52
+ }
53
+ function normalizeFlowSurfacePublicBlockDefaultFilter(actionName, defaultFilter, options) {
54
+ if (import_lodash.default.isUndefined(defaultFilter)) {
55
+ return void 0;
56
+ }
57
+ const fieldPath = options.path ? `${options.path}.defaultFilter` : "defaultFilter";
58
+ if (!isFlowSurfacePublicDataSurfaceBlockType(options.blockType) || !import_lodash.default.isUndefined(options.template)) {
59
+ (0, import_errors.throwBadRequest)(`flowSurfaces ${actionName} ${fieldPath} is only supported on direct table/list/gridCard blocks`);
60
+ }
61
+ return (0, import_filter_group.normalizeFlowSurfaceFilterGroupValue)(
62
+ defaultFilter,
63
+ `flowSurfaces ${actionName} ${fieldPath} expects FilterGroup like ${import_filter_group.FLOW_SURFACE_FILTER_GROUP_EXAMPLE}`
64
+ );
65
+ }
66
+ function backfillFlowSurfaceDefaultFilterSetting(settings, defaultFilter) {
67
+ if (import_lodash.default.isUndefined(defaultFilter)) {
68
+ return settings;
69
+ }
70
+ if (import_lodash.default.isUndefined(settings)) {
71
+ return {
72
+ defaultFilter: import_lodash.default.cloneDeep(defaultFilter)
73
+ };
74
+ }
75
+ if (!import_lodash.default.isPlainObject(settings)) {
76
+ return settings;
77
+ }
78
+ if (Object.prototype.hasOwnProperty.call(settings, "defaultFilter")) {
79
+ return settings;
80
+ }
81
+ return {
82
+ ...import_lodash.default.cloneDeep(settings),
83
+ defaultFilter: import_lodash.default.cloneDeep(defaultFilter)
84
+ };
85
+ }
86
+ function backfillFlowSurfaceFilterActionDefaultFilter(actions, defaultFilter) {
87
+ if (import_lodash.default.isUndefined(defaultFilter)) {
88
+ return actions;
89
+ }
90
+ return actions.map((action) => {
91
+ if (String((action == null ? void 0 : action.type) || "").trim() !== "filter") {
92
+ return action;
93
+ }
94
+ const settings = backfillFlowSurfaceDefaultFilterSetting(action.settings, defaultFilter);
95
+ if (settings === action.settings) {
96
+ return action;
97
+ }
98
+ return {
99
+ ...action,
100
+ settings
101
+ };
102
+ });
103
+ }
104
+ // Annotate the CommonJS export names for ESM import in node:
105
+ 0 && (module.exports = {
106
+ FLOW_SURFACE_PUBLIC_DATA_SURFACE_BLOCK_TYPES,
107
+ backfillFlowSurfaceDefaultFilterSetting,
108
+ backfillFlowSurfaceFilterActionDefaultFilter,
109
+ isFlowSurfacePublicDataSurfaceBlockType,
110
+ normalizeFlowSurfacePublicBlockDefaultFilter
111
+ });
@@ -58,8 +58,11 @@ export declare const FLOW_SURFACE_REACTION_SUPPORTED_KINDS_BY_USE: {
58
58
  readonly ApplyTaskCardDetailsModel: readonly ["blockLinkage", "fieldLinkage"];
59
59
  readonly ApprovalTaskCardDetailsModel: readonly ["blockLinkage", "fieldLinkage"];
60
60
  readonly TableBlockModel: readonly ["blockLinkage"];
61
+ readonly CalendarBlockModel: readonly ["blockLinkage"];
61
62
  readonly ListBlockModel: readonly ["blockLinkage"];
62
63
  readonly GridCardBlockModel: readonly ["blockLinkage"];
64
+ readonly MarkdownBlockModel: readonly ["blockLinkage"];
65
+ readonly IframeBlockModel: readonly ["blockLinkage"];
63
66
  readonly MapBlockModel: readonly ["blockLinkage"];
64
67
  readonly CommentsBlockModel: readonly ["blockLinkage"];
65
68
  readonly ChartBlockModel: readonly ["blockLinkage"];
@@ -82,6 +85,10 @@ export declare const FLOW_SURFACE_REACTION_SUPPORTED_KINDS_BY_USE: {
82
85
  readonly JSItemActionModel: readonly ["actionLinkage"];
83
86
  readonly FilterFormJSActionModel: readonly ["actionLinkage"];
84
87
  readonly JSActionModel: readonly ["actionLinkage"];
88
+ readonly CalendarTodayActionModel: readonly ["actionLinkage"];
89
+ readonly CalendarNavActionModel: readonly ["actionLinkage"];
90
+ readonly CalendarTitleActionModel: readonly ["actionLinkage"];
91
+ readonly CalendarViewSelectActionModel: readonly ["actionLinkage"];
85
92
  readonly LinkActionModel: readonly ["actionLinkage"];
86
93
  readonly ExportActionModel: readonly ["actionLinkage"];
87
94
  readonly ExportAttachmentActionModel: readonly ["actionLinkage"];
@@ -88,8 +88,11 @@ const FLOW_SURFACE_REACTION_SUPPORTED_KINDS_BY_USE = {
88
88
  ApplyTaskCardDetailsModel: ["blockLinkage", "fieldLinkage"],
89
89
  ApprovalTaskCardDetailsModel: ["blockLinkage", "fieldLinkage"],
90
90
  TableBlockModel: ["blockLinkage"],
91
+ CalendarBlockModel: ["blockLinkage"],
91
92
  ListBlockModel: ["blockLinkage"],
92
93
  GridCardBlockModel: ["blockLinkage"],
94
+ MarkdownBlockModel: ["blockLinkage"],
95
+ IframeBlockModel: ["blockLinkage"],
93
96
  MapBlockModel: ["blockLinkage"],
94
97
  CommentsBlockModel: ["blockLinkage"],
95
98
  ChartBlockModel: ["blockLinkage"],
@@ -112,6 +115,10 @@ const FLOW_SURFACE_REACTION_SUPPORTED_KINDS_BY_USE = {
112
115
  JSItemActionModel: ["actionLinkage"],
113
116
  FilterFormJSActionModel: ["actionLinkage"],
114
117
  JSActionModel: ["actionLinkage"],
118
+ CalendarTodayActionModel: ["actionLinkage"],
119
+ CalendarNavActionModel: ["actionLinkage"],
120
+ CalendarTitleActionModel: ["actionLinkage"],
121
+ CalendarViewSelectActionModel: ["actionLinkage"],
115
122
  LinkActionModel: ["actionLinkage"],
116
123
  ExportActionModel: ["actionLinkage"],
117
124
  ExportAttachmentActionModel: ["actionLinkage"],
@@ -7,6 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import _ from 'lodash';
10
+ import { FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY, type FlowSurfaceApplyBlueprintPopupDefaultsMetadata } from './blueprint/defaults';
10
11
  import type { FlowSurfaceNodeSpec, FlowSurfaceNodeSubModel } from './types';
11
12
  export declare function buildDefinedPayload(payload: Record<string, any>): _.Dictionary<any>;
12
13
  export declare function normalizeFlowSurfaceComposeKey(key: any, context: string): string;
@@ -14,6 +15,11 @@ export declare function assertFlowSurfaceComposeUniqueKeys(items: Array<{
14
15
  key?: string;
15
16
  }>, context: string): void;
16
17
  export declare function normalizeChartCardSettings(cardSettings: any): any;
18
+ export declare function normalizeBlockTitleDescriptionValue(value: any): any;
19
+ export declare function normalizeBlockTitleDescription(titleDescription: any): any;
20
+ export declare function buildBlockTitleDescriptionFromSemanticChanges(changes: Record<string, any>): {
21
+ titleDescription: _.Dictionary<any>;
22
+ };
17
23
  export declare function buildChartCardSettingsFromSemanticChanges(currentCardSettings: any, changes: Record<string, any>): any;
18
24
  export declare function buildPopupTabTree(options: {
19
25
  tabUid?: string;
@@ -63,6 +69,7 @@ export type NormalizedComposeFieldSpec = {
63
69
  settings: Record<string, any>;
64
70
  popup?: Record<string, any>;
65
71
  __autoPopupForRelationField?: boolean;
72
+ [FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]?: FlowSurfaceApplyBlueprintPopupDefaultsMetadata;
66
73
  };
67
74
  export declare function normalizeComposeFieldSpec(input: any, index: number): NormalizedComposeFieldSpec;
68
75
  export declare function normalizeComposeActionSpec(input: any, index: number): {
@@ -38,6 +38,7 @@ var service_utils_exports = {};
38
38
  __export(service_utils_exports, {
39
39
  assertFlowSurfaceComposeUniqueKeys: () => assertFlowSurfaceComposeUniqueKeys,
40
40
  assertSupportedSimpleChanges: () => assertSupportedSimpleChanges,
41
+ buildBlockTitleDescriptionFromSemanticChanges: () => buildBlockTitleDescriptionFromSemanticChanges,
41
42
  buildChartCardSettingsFromSemanticChanges: () => buildChartCardSettingsFromSemanticChanges,
42
43
  buildDefaultFieldState: () => buildDefaultFieldState,
43
44
  buildDefinedPayload: () => buildDefinedPayload,
@@ -57,6 +58,8 @@ __export(service_utils_exports, {
57
58
  isFieldNodeUse: () => isFieldNodeUse,
58
59
  isMissingRequiredResourceInitValue: () => isMissingRequiredResourceInitValue,
59
60
  joinRequiredFieldPaths: () => joinRequiredFieldPaths,
61
+ normalizeBlockTitleDescription: () => normalizeBlockTitleDescription,
62
+ normalizeBlockTitleDescriptionValue: () => normalizeBlockTitleDescriptionValue,
60
63
  normalizeChartCardHeightModeForWrite: () => normalizeChartCardHeightModeForWrite,
61
64
  normalizeChartCardSettings: () => normalizeChartCardSettings,
62
65
  normalizeComposeActionSpec: () => normalizeComposeActionSpec,
@@ -77,6 +80,7 @@ module.exports = __toCommonJS(service_utils_exports);
77
80
  var import_utils = require("@nocobase/utils");
78
81
  var import_lodash = __toESM(require("lodash"));
79
82
  var import_configure_options = require("./configure-options");
83
+ var import_defaults = require("./blueprint/defaults");
80
84
  var import_errors = require("./errors");
81
85
  var import_service_helpers = require("./service-helpers");
82
86
  var import_key_registry = require("./planning/key-registry");
@@ -112,9 +116,9 @@ function normalizeChartCardSettings(cardSettings) {
112
116
  return {};
113
117
  }
114
118
  const nextCardSettings = import_lodash.default.cloneDeep(cardSettings);
115
- const title = typeof import_lodash.default.get(nextCardSettings, ["titleDescription", "title"]) === "string" ? import_lodash.default.get(nextCardSettings, ["titleDescription", "title"]).trim() : import_lodash.default.get(nextCardSettings, ["titleDescription", "title"]);
116
- if (title) {
117
- import_lodash.default.set(nextCardSettings, ["titleDescription", "title"], title);
119
+ const titleDescription = normalizeBlockTitleDescription(import_lodash.default.get(nextCardSettings, ["titleDescription"]));
120
+ if (titleDescription) {
121
+ import_lodash.default.set(nextCardSettings, ["titleDescription"], titleDescription);
118
122
  } else {
119
123
  import_lodash.default.unset(nextCardSettings, ["titleDescription"]);
120
124
  }
@@ -136,13 +140,53 @@ function normalizeChartCardSettings(cardSettings) {
136
140
  }
137
141
  return nextCardSettings;
138
142
  }
143
+ function normalizeBlockTitleDescriptionValue(value) {
144
+ if (import_lodash.default.isNull(value)) {
145
+ return "";
146
+ }
147
+ return typeof value === "string" ? value.trim() : value;
148
+ }
149
+ function normalizeBlockTitleDescription(titleDescription) {
150
+ if (!import_lodash.default.isPlainObject(titleDescription)) {
151
+ return void 0;
152
+ }
153
+ const nextTitleDescription = import_lodash.default.cloneDeep(titleDescription);
154
+ const title = normalizeBlockTitleDescriptionValue(nextTitleDescription.title);
155
+ const description = normalizeBlockTitleDescriptionValue(nextTitleDescription.description);
156
+ if (title) {
157
+ nextTitleDescription.title = title;
158
+ } else {
159
+ delete nextTitleDescription.title;
160
+ }
161
+ if (description) {
162
+ nextTitleDescription.description = description;
163
+ } else {
164
+ delete nextTitleDescription.description;
165
+ }
166
+ return Object.keys(nextTitleDescription).length ? nextTitleDescription : void 0;
167
+ }
168
+ function buildBlockTitleDescriptionFromSemanticChanges(changes) {
169
+ if (!hasDefinedValue(changes, ["title", "description"])) {
170
+ return void 0;
171
+ }
172
+ return {
173
+ titleDescription: buildDefinedPayload({
174
+ ...hasOwnDefined(changes, "title") ? { title: normalizeBlockTitleDescriptionValue(changes.title) } : {},
175
+ ...hasOwnDefined(changes, "description") ? { description: normalizeBlockTitleDescriptionValue(changes.description) } : {}
176
+ })
177
+ };
178
+ }
139
179
  function buildChartCardSettingsFromSemanticChanges(currentCardSettings, changes) {
140
180
  const nextCardSettings = import_lodash.default.cloneDeep(currentCardSettings || {});
141
- const currentTitle = typeof import_lodash.default.get(currentCardSettings, ["titleDescription", "title"]) === "string" ? import_lodash.default.get(currentCardSettings, ["titleDescription", "title"]).trim() : import_lodash.default.get(currentCardSettings, ["titleDescription", "title"]);
142
- const nextTitle = hasOwnDefined(changes, "title") ? typeof changes.title === "string" ? changes.title.trim() : changes.title : currentTitle;
143
- const shouldShowTitle = hasOwnDefined(changes, "displayTitle") ? changes.displayTitle !== false : !!nextTitle;
144
- if (nextTitle && shouldShowTitle) {
145
- import_lodash.default.set(nextCardSettings, ["titleDescription", "title"], nextTitle);
181
+ const currentTitleDescription = import_lodash.default.get(currentCardSettings, ["titleDescription"]);
182
+ const nextTitleDescription = normalizeBlockTitleDescription(
183
+ buildDefinedPayload({
184
+ title: hasOwnDefined(changes, "title") ? normalizeBlockTitleDescriptionValue(changes.title) : import_lodash.default.get(currentTitleDescription, ["title"]),
185
+ description: hasOwnDefined(changes, "description") ? normalizeBlockTitleDescriptionValue(changes.description) : import_lodash.default.get(currentTitleDescription, ["description"])
186
+ })
187
+ );
188
+ if (nextTitleDescription) {
189
+ import_lodash.default.set(nextCardSettings, ["titleDescription"], nextTitleDescription);
146
190
  } else {
147
191
  import_lodash.default.unset(nextCardSettings, ["titleDescription"]);
148
192
  }
@@ -324,6 +368,7 @@ function normalizeComposeFieldSpec(input, index) {
324
368
  }
325
369
  const rawKey = String(input.key || semanticType || (renderer === "js" ? `js:${fieldPath}` : fieldPath)).trim();
326
370
  const key = normalizeFlowSurfaceComposeKey(rawKey, `flowSurfaces compose field #${index + 1}`);
371
+ const popupDefaultsMetadata = import_lodash.default.isPlainObject(input[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]) ? input[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY] : void 0;
327
372
  return {
328
373
  index: index + 1,
329
374
  key,
@@ -334,7 +379,8 @@ function normalizeComposeFieldSpec(input, index) {
334
379
  target: typeof input.target === "string" ? String(input.target || "").trim() || void 0 : void 0,
335
380
  settings: import_lodash.default.isPlainObject(input.settings) ? input.settings : {},
336
381
  popup: import_lodash.default.isPlainObject(input.popup) ? input.popup : void 0,
337
- __autoPopupForRelationField: input.__autoPopupForRelationField === true
382
+ __autoPopupForRelationField: input.__autoPopupForRelationField === true,
383
+ ...popupDefaultsMetadata ? { [import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY]: popupDefaultsMetadata } : {}
338
384
  };
339
385
  }
340
386
  function normalizeComposeActionSpec(input, index) {
@@ -725,6 +771,7 @@ function getFieldBindingDefaultProps(containerUse, fieldUse, field) {
725
771
  0 && (module.exports = {
726
772
  assertFlowSurfaceComposeUniqueKeys,
727
773
  assertSupportedSimpleChanges,
774
+ buildBlockTitleDescriptionFromSemanticChanges,
728
775
  buildChartCardSettingsFromSemanticChanges,
729
776
  buildDefaultFieldState,
730
777
  buildDefinedPayload,
@@ -744,6 +791,8 @@ function getFieldBindingDefaultProps(containerUse, fieldUse, field) {
744
791
  isFieldNodeUse,
745
792
  isMissingRequiredResourceInitValue,
746
793
  joinRequiredFieldPaths,
794
+ normalizeBlockTitleDescription,
795
+ normalizeBlockTitleDescriptionValue,
747
796
  normalizeChartCardHeightModeForWrite,
748
797
  normalizeChartCardSettings,
749
798
  normalizeComposeActionSpec,