@nocobase/plugin-flow-engine 2.1.0-beta.20 → 2.1.0-beta.21

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 (34) hide show
  1. package/dist/externalVersion.js +10 -10
  2. package/dist/node_modules/ses/package.json +1 -1
  3. package/dist/node_modules/zod/package.json +1 -1
  4. package/dist/server/flow-surfaces/apply/compiler.js +4 -2
  5. package/dist/server/flow-surfaces/association-interfaces.d.ts +10 -0
  6. package/dist/server/flow-surfaces/association-interfaces.js +39 -0
  7. package/dist/server/flow-surfaces/blueprint/compile-blocks.js +50 -5
  8. package/dist/server/flow-surfaces/blueprint/public-types.d.ts +9 -1
  9. package/dist/server/flow-surfaces/builder.d.ts +27 -1
  10. package/dist/server/flow-surfaces/builder.js +36 -4
  11. package/dist/server/flow-surfaces/catalog.d.ts +1 -0
  12. package/dist/server/flow-surfaces/catalog.js +129 -13
  13. package/dist/server/flow-surfaces/compose-compiler.d.ts +8 -0
  14. package/dist/server/flow-surfaces/compose-compiler.js +8 -0
  15. package/dist/server/flow-surfaces/configure-options.js +39 -6
  16. package/dist/server/flow-surfaces/default-action-popup.js +2 -2
  17. package/dist/server/flow-surfaces/field-binding-registry.d.ts +1 -0
  18. package/dist/server/flow-surfaces/field-binding-registry.js +5 -0
  19. package/dist/server/flow-surfaces/field-semantics.d.ts +1 -1
  20. package/dist/server/flow-surfaces/field-semantics.js +4 -3
  21. package/dist/server/flow-surfaces/field-type-resolver.d.ts +46 -0
  22. package/dist/server/flow-surfaces/field-type-resolver.js +322 -0
  23. package/dist/server/flow-surfaces/node-use-sets.js +1 -0
  24. package/dist/server/flow-surfaces/service-utils.d.ts +13 -1
  25. package/dist/server/flow-surfaces/service-utils.js +58 -6
  26. package/dist/server/flow-surfaces/service.d.ts +17 -1
  27. package/dist/server/flow-surfaces/service.js +820 -53
  28. package/dist/server/flow-surfaces/support-matrix.js +11 -0
  29. package/dist/swagger/flow-surfaces.d.ts +173 -2
  30. package/dist/swagger/flow-surfaces.examples.d.ts +20 -15
  31. package/dist/swagger/flow-surfaces.examples.js +22 -11
  32. package/dist/swagger/flow-surfaces.js +72 -10
  33. package/dist/swagger/index.d.ts +173 -2
  34. package/package.json +2 -2
@@ -57,6 +57,7 @@ var import_errors = require("./errors");
57
57
  var import_field_semantics = require("./field-semantics");
58
58
  var import_core_field_default_bindings = require("./core-field-default-bindings");
59
59
  var import_field_binding_registry = require("./field-binding-registry");
60
+ var import_association_interfaces = require("./association-interfaces");
60
61
  var import_service_helpers = require("./service-helpers");
61
62
  var import_support_matrix = require("./support-matrix");
62
63
  const ANY_VALUE_SCHEMA = {};
@@ -333,6 +334,36 @@ const CALENDAR_SETTINGS_GROUP = {
333
334
  "linkageRules.value": ARRAY_SCHEMA
334
335
  }
335
336
  };
337
+ const TREE_BLOCK_PROP_SCHEMAS = {
338
+ searchable: BOOLEAN_SCHEMA,
339
+ defaultExpandAll: BOOLEAN_SCHEMA,
340
+ includeDescendants: BOOLEAN_SCHEMA,
341
+ fieldNames: OBJECT_SCHEMA,
342
+ pageSize: NUMBER_SCHEMA
343
+ };
344
+ const TREE_SETTINGS_GROUP = {
345
+ allowedPaths: [
346
+ "searchable.searchable",
347
+ "defaultExpandAll.defaultExpandAll",
348
+ "includeDescendants.includeDescendants",
349
+ "titleField.titleField",
350
+ "pageSize.pageSize",
351
+ "dataScope.filter",
352
+ "defaultSorting.sort"
353
+ ],
354
+ clearable: true,
355
+ mergeStrategy: "deep",
356
+ eventBindingSteps: ["treeSettings", "dataScope", "defaultSorting"],
357
+ pathSchemas: {
358
+ "searchable.searchable": BOOLEAN_SCHEMA,
359
+ "defaultExpandAll.defaultExpandAll": BOOLEAN_SCHEMA,
360
+ "includeDescendants.includeDescendants": BOOLEAN_SCHEMA,
361
+ "titleField.titleField": STRING_SCHEMA,
362
+ "pageSize.pageSize": NUMBER_SCHEMA,
363
+ "dataScope.filter": FILTER_GROUP_SCHEMA,
364
+ "defaultSorting.sort": ARRAY_SCHEMA
365
+ }
366
+ };
336
367
  const KANBAN_SETTINGS_GROUP = {
337
368
  allowedPaths: [
338
369
  "grouping.groupField",
@@ -426,6 +457,7 @@ const REGISTERED_FILTER_FIELD_USE_SET = (0, import_field_binding_registry.getReg
426
457
  const EDITABLE_FIELD_USE_SET = /* @__PURE__ */ new Set([
427
458
  ...JS_EDITABLE_FIELD_USE_SET,
428
459
  "RecordSelectFieldModel",
460
+ "RecordPickerFieldModel",
429
461
  "JsonFieldModel",
430
462
  "TextareaFieldModel",
431
463
  "IconFieldModel",
@@ -443,11 +475,15 @@ const EDITABLE_FIELD_USE_SET = /* @__PURE__ */ new Set([
443
475
  "TimeFieldModel",
444
476
  "CollectionSelectorFieldModel",
445
477
  "RichTextFieldModel",
446
- "InputFieldModel"
478
+ "InputFieldModel",
479
+ "SubFormListFieldModel",
480
+ "SubTableFieldModel",
481
+ "PopupSubTableFieldModel"
447
482
  ]);
448
483
  const DISPLAY_FIELD_USE_SET = /* @__PURE__ */ new Set([
449
484
  ...JS_DISPLAY_FIELD_USE_SET,
450
485
  "DisplaySubItemFieldModel",
486
+ "DisplaySubListFieldModel",
451
487
  "DisplaySubTableFieldModel",
452
488
  "DisplayHtmlFieldModel",
453
489
  "DisplayNumberFieldModel",
@@ -479,7 +515,6 @@ const APPROVAL_DETAILS_FIELD_COMPONENT_WRAPPER_USE_SET = /* @__PURE__ */ new Set
479
515
  "ApplyTaskCardDetailsItemModel",
480
516
  "ApprovalTaskCardDetailsItemModel"
481
517
  ]);
482
- const SINGLE_VALUE_ASSOCIATION_INTERFACES = /* @__PURE__ */ new Set(["m2o", "o2o", "oho", "obo", "updatedBy", "createdBy"]);
483
518
  const KNOWN_FIELD_NODE_USES = /* @__PURE__ */ new Set([
484
519
  ...EDITABLE_FIELD_USE_SET,
485
520
  ...DISPLAY_FIELD_USE_SET,
@@ -920,6 +955,27 @@ CALENDAR_BLOCK_CONTRACT.domains.stepParams = groupedDomain({
920
955
  calendarSettings: CALENDAR_SETTINGS_GROUP,
921
956
  cardSettings: BLOCK_CARD_SETTINGS_GROUP
922
957
  });
958
+ const TREE_BLOCK_CONTRACT = createContract({
959
+ editableDomains: ["props", "decoratorProps", "stepParams", "flowRegistry"],
960
+ props: ["searchable", "defaultExpandAll", "includeDescendants", "fieldNames", "pageSize"],
961
+ decoratorProps: ["height", "heightMode"],
962
+ stepParams: ["resourceSettings", "treeSettings", "cardSettings"],
963
+ flowRegistry: true,
964
+ eventCapabilities: {
965
+ direct: DEFAULT_DIRECT_EVENTS,
966
+ object: ["click"]
967
+ }
968
+ });
969
+ TREE_BLOCK_CONTRACT.domains.props = keyedDomain(
970
+ ["searchable", "defaultExpandAll", "includeDescendants", "fieldNames", "pageSize"],
971
+ "deep",
972
+ TREE_BLOCK_PROP_SCHEMAS
973
+ );
974
+ TREE_BLOCK_CONTRACT.domains.stepParams = groupedDomain({
975
+ resourceSettings: RESOURCE_SETTINGS_GROUP,
976
+ treeSettings: TREE_SETTINGS_GROUP,
977
+ cardSettings: BLOCK_CARD_SETTINGS_GROUP
978
+ });
923
979
  const KANBAN_BLOCK_CONTRACT = createContract({
924
980
  editableDomains: ["props", "decoratorProps", "stepParams", "flowRegistry"],
925
981
  props: [
@@ -2385,6 +2441,7 @@ const NODE_CONTRACT_ENTRIES = [
2385
2441
  ["ApprovalBlockGridModel", GRID_NODE_CONTRACT],
2386
2442
  ["TableBlockModel", TABLE_BLOCK_CONTRACT],
2387
2443
  ["CalendarBlockModel", CALENDAR_BLOCK_CONTRACT],
2444
+ ["TreeBlockModel", TREE_BLOCK_CONTRACT],
2388
2445
  ["KanbanBlockModel", KANBAN_BLOCK_CONTRACT],
2389
2446
  ["CreateFormModel", CREATE_FORM_BLOCK_CONTRACT],
2390
2447
  ["EditFormModel", EDIT_FORM_BLOCK_CONTRACT],
@@ -2544,7 +2601,7 @@ function getAllowedFieldUseSet(containerUse, enabledPackages) {
2544
2601
  return null;
2545
2602
  }
2546
2603
  }
2547
- function canUseNestedApprovalAssociationFieldComponent(input) {
2604
+ function canUseNestedAssociationFieldComponent(input) {
2548
2605
  var _a;
2549
2606
  const getCollection = input.getCollection || (() => null);
2550
2607
  const targetCollection = (0, import_service_helpers.resolveFieldTargetCollection)(input.field, input.dataSourceKey || "main", getCollection);
@@ -2559,40 +2616,89 @@ function getSupportedFieldComponentUseSet(input) {
2559
2616
  if (!baseAllowedFieldUses || !fieldInterface) {
2560
2617
  return baseAllowedFieldUses;
2561
2618
  }
2562
- const wrapperUse = (0, import_approval.getApprovalFieldWrapperUse)(input.containerUse) || String(input.containerUse || "").trim();
2619
+ const wrapperUse = (0, import_approval.getApprovalFieldWrapperUse)(input.containerUse) || getFieldWrapperUseForContainer(input.containerUse) || String(input.containerUse || "").trim();
2563
2620
  const inferredFieldUse = inferFieldUseByContainer(input.containerUse, input.field, {
2564
2621
  enabledPackages: input.enabledPackages,
2565
2622
  dataSourceKey: input.dataSourceKey,
2566
2623
  getCollection: input.getCollection
2567
2624
  });
2568
2625
  if (wrapperUse === "PatternFormItemModel") {
2569
- if (SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2626
+ if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2570
2627
  return new Set(
2571
2628
  [
2572
2629
  "RecordSelectFieldModel",
2573
2630
  "RecordPickerFieldModel",
2574
- canUseNestedApprovalAssociationFieldComponent(input) ? "SubFormFieldModel" : void 0,
2631
+ canUseNestedAssociationFieldComponent(input) ? "SubFormFieldModel" : void 0,
2575
2632
  inferredFieldUse
2576
2633
  ].filter(Boolean)
2577
2634
  );
2578
2635
  }
2579
- if (import_field_semantics.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2636
+ if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2580
2637
  return new Set(
2581
2638
  [
2582
2639
  "RecordSelectFieldModel",
2583
2640
  "RecordPickerFieldModel",
2584
- canUseNestedApprovalAssociationFieldComponent(input) ? "SubFormListFieldModel" : void 0,
2585
- canUseNestedApprovalAssociationFieldComponent(input) ? "PatternSubTableFieldModel" : void 0,
2641
+ canUseNestedAssociationFieldComponent(input) ? "SubFormListFieldModel" : void 0,
2642
+ canUseNestedAssociationFieldComponent(input) ? "SubTableFieldModel" : void 0,
2643
+ canUseNestedAssociationFieldComponent(input) ? "PopupSubTableFieldModel" : void 0,
2644
+ inferredFieldUse
2645
+ ].filter(Boolean)
2646
+ );
2647
+ }
2648
+ }
2649
+ if (wrapperUse === "FormItemModel") {
2650
+ if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2651
+ return new Set(
2652
+ [
2653
+ "RecordSelectFieldModel",
2654
+ "RecordPickerFieldModel",
2655
+ canUseNestedAssociationFieldComponent(input) ? "SubFormFieldModel" : void 0,
2656
+ inferredFieldUse
2657
+ ].filter(Boolean)
2658
+ );
2659
+ }
2660
+ if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2661
+ return new Set(
2662
+ [
2663
+ "RecordSelectFieldModel",
2664
+ "RecordPickerFieldModel",
2665
+ canUseNestedAssociationFieldComponent(input) ? "SubFormListFieldModel" : void 0,
2666
+ canUseNestedAssociationFieldComponent(input) ? "SubTableFieldModel" : void 0,
2667
+ canUseNestedAssociationFieldComponent(input) ? "PopupSubTableFieldModel" : void 0,
2586
2668
  inferredFieldUse
2587
2669
  ].filter(Boolean)
2588
2670
  );
2589
2671
  }
2590
2672
  }
2591
2673
  if (APPROVAL_DETAILS_FIELD_COMPONENT_WRAPPER_USE_SET.has(wrapperUse)) {
2592
- if (SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2674
+ if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2675
+ return new Set(["DisplayTextFieldModel", "DisplaySubItemFieldModel", inferredFieldUse].filter(Boolean));
2676
+ }
2677
+ if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2678
+ return new Set(
2679
+ ["DisplayTextFieldModel", "DisplaySubListFieldModel", "DisplaySubTableFieldModel", inferredFieldUse].filter(
2680
+ Boolean
2681
+ )
2682
+ );
2683
+ }
2684
+ }
2685
+ if (wrapperUse === "DetailsItemModel") {
2686
+ if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2593
2687
  return new Set(["DisplayTextFieldModel", "DisplaySubItemFieldModel", inferredFieldUse].filter(Boolean));
2594
2688
  }
2595
- if (import_field_semantics.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2689
+ if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2690
+ return new Set(
2691
+ ["DisplayTextFieldModel", "DisplaySubListFieldModel", "DisplaySubTableFieldModel", inferredFieldUse].filter(
2692
+ Boolean
2693
+ )
2694
+ );
2695
+ }
2696
+ }
2697
+ if (wrapperUse === "FormAssociationItemModel" || wrapperUse === "TableColumnModel") {
2698
+ if (import_association_interfaces.SINGLE_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2699
+ return new Set(["DisplayTextFieldModel", inferredFieldUse].filter(Boolean));
2700
+ }
2701
+ if (import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface)) {
2596
2702
  return new Set(
2597
2703
  ["DisplayTextFieldModel", "DisplaySubListFieldModel", "DisplaySubTableFieldModel", inferredFieldUse].filter(
2598
2704
  Boolean
@@ -2600,6 +2706,9 @@ function getSupportedFieldComponentUseSet(input) {
2600
2706
  );
2601
2707
  }
2602
2708
  }
2709
+ if (inferredFieldUse) {
2710
+ return /* @__PURE__ */ new Set([inferredFieldUse]);
2711
+ }
2603
2712
  return baseAllowedFieldUses;
2604
2713
  }
2605
2714
  function inferFieldUseByContainer(containerUse, field, options = {}) {
@@ -2737,12 +2846,18 @@ function resolveSupportedFieldCapability(input) {
2737
2846
  }
2738
2847
  throw new import_errors.FlowSurfaceBadRequestError(`flowSurfaces field '${input.containerUse}' requires a supported fieldUse`);
2739
2848
  }
2740
- if (input.requestedFieldUse && inferredFieldUse && input.requestedFieldUse !== inferredFieldUse && KNOWN_FIELD_NODE_USES.has(input.requestedFieldUse)) {
2849
+ if (input.requestedFieldUse && inferredFieldUse && input.requestedFieldUse !== inferredFieldUse && input.requestedFieldUseMode !== "fieldType" && KNOWN_FIELD_NODE_USES.has(input.requestedFieldUse)) {
2741
2850
  throw new import_errors.FlowSurfaceBadRequestError(
2742
2851
  `flowSurfaces fieldUse '${input.requestedFieldUse}' does not match inferred fieldUse '${inferredFieldUse}' under '${input.containerUse}'`
2743
2852
  );
2744
2853
  }
2745
- const allowedFieldUses = getAllowedFieldUseSet(input.containerUse, input.enabledPackages);
2854
+ const allowedFieldUses = input.requestedFieldUseMode === "fieldType" && input.field ? getSupportedFieldComponentUseSet({
2855
+ containerUse: input.containerUse,
2856
+ field: input.field,
2857
+ enabledPackages: input.enabledPackages,
2858
+ dataSourceKey: input.dataSourceKey,
2859
+ getCollection: input.getCollection
2860
+ }) : getAllowedFieldUseSet(input.containerUse, input.enabledPackages);
2746
2861
  if (!(allowedFieldUses == null ? void 0 : allowedFieldUses.has(fieldUse))) {
2747
2862
  throw new import_errors.FlowSurfaceBadRequestError(
2748
2863
  `flowSurfaces fieldUse '${fieldUse}' is not allowed under '${input.containerUse}'`
@@ -2810,6 +2925,7 @@ function getAvailableActionCatalogItems(containerUse, scope, enabledPackages) {
2810
2925
  const COLLECTION_RESOURCE_REQUIRED = /* @__PURE__ */ new Set([
2811
2926
  "TableBlockModel",
2812
2927
  "CalendarBlockModel",
2928
+ "TreeBlockModel",
2813
2929
  "KanbanBlockModel",
2814
2930
  "CreateFormModel",
2815
2931
  "EditFormModel",
@@ -23,6 +23,14 @@ export type FlowSurfaceComposeNormalizedFieldSpec = {
23
23
  associationPathName?: string;
24
24
  renderer?: string;
25
25
  type?: string;
26
+ fieldType?: string;
27
+ fields?: string[];
28
+ selectorFields?: string[];
29
+ titleField?: string;
30
+ openMode?: string;
31
+ popupSize?: string;
32
+ pageSize?: number;
33
+ showIndex?: boolean;
26
34
  target?: string | Record<string, unknown>;
27
35
  settings?: FlowSurfaceComposeObject;
28
36
  popup?: FlowSurfaceComposeObject;
@@ -123,6 +123,14 @@ function buildComposeFieldCreatePayload(fieldSpec) {
123
123
  ...fieldSpec.associationPathName ? { associationPathName: fieldSpec.associationPathName } : {},
124
124
  ...fieldSpec.renderer ? { renderer: fieldSpec.renderer } : {},
125
125
  ...fieldSpec.type ? { type: fieldSpec.type } : {},
126
+ ...fieldSpec.fieldType ? { fieldType: fieldSpec.fieldType } : {},
127
+ ...typeof fieldSpec.fields !== "undefined" ? { fields: fieldSpec.fields } : {},
128
+ ...typeof fieldSpec.selectorFields !== "undefined" ? { selectorFields: fieldSpec.selectorFields } : {},
129
+ ...fieldSpec.titleField ? { titleField: fieldSpec.titleField } : {},
130
+ ...fieldSpec.openMode ? { openMode: fieldSpec.openMode } : {},
131
+ ...fieldSpec.popupSize ? { popupSize: fieldSpec.popupSize } : {},
132
+ ...typeof fieldSpec.pageSize !== "undefined" ? { pageSize: fieldSpec.pageSize } : {},
133
+ ...typeof fieldSpec.showIndex !== "undefined" ? { showIndex: fieldSpec.showIndex } : {},
126
134
  ...fieldSpec.popup ? { popup: fieldSpec.popup } : {},
127
135
  ...fieldSpec.__autoPopupForRelationField ? { __autoPopupForRelationField: true } : {},
128
136
  ...fieldSpec[import_defaults.FLOW_SURFACE_APPLY_BLUEPRINT_POPUP_DEFAULTS_KEY] ? {
@@ -34,6 +34,7 @@ __export(configure_options_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(configure_options_exports);
36
36
  var import_approval = require("./approval");
37
+ var import_field_type_resolver = require("./field-type-resolver");
37
38
  const stringOption = (description, extra = {}) => ({
38
39
  type: "string",
39
40
  ...description ? { description } : {},
@@ -90,9 +91,25 @@ const DISPLAY_STYLE = stringOption("Display style", {
90
91
  enum: ["text", "tag"],
91
92
  example: "tag"
92
93
  });
93
- const FIELD_COMPONENT = stringOption("Field component model use", {
94
- example: "DisplayTextFieldModel"
94
+ const FIELD_TYPE = stringOption("Public relation field presentation type", {
95
+ enum: [...import_field_type_resolver.FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES],
96
+ example: "popupSubTable"
95
97
  });
98
+ const RELATION_FIELDS = arrayOption("Relation target fields", {
99
+ example: ["title", "name"]
100
+ });
101
+ const SELECTOR_FIELDS = arrayOption("Record picker selector fields", {
102
+ example: ["title", "code"]
103
+ });
104
+ const RELATION_FIELD_TYPE_OPTIONS = {
105
+ fieldType: FIELD_TYPE,
106
+ fields: RELATION_FIELDS,
107
+ selectorFields: SELECTOR_FIELDS,
108
+ openMode: stringOption("Popup open mode", { example: "drawer" }),
109
+ popupSize: stringOption("Popup size", { example: "medium" }),
110
+ pageSize: numberOption("Page size", { example: 10 }),
111
+ showIndex: booleanOption("Whether to show index", { example: true })
112
+ };
96
113
  const CONFIRM = objectOption("Confirmation dialog configuration. You can also pass a boolean directly.", {
97
114
  example: {
98
115
  enable: true,
@@ -219,6 +236,19 @@ const CALENDAR_OPTIONS = {
219
236
  quickCreatePopup: OPEN_VIEW,
220
237
  eventPopup: OPEN_VIEW
221
238
  };
239
+ const TREE_OPTIONS = {
240
+ ...COMMON_BLOCK_HEADER_OPTIONS,
241
+ ...COMMON_HEIGHT_OPTIONS,
242
+ resource: COMMON_RESOURCE,
243
+ searchable: booleanOption("Whether search is enabled", { example: true }),
244
+ defaultExpandAll: booleanOption("Whether all tree nodes are expanded by default", { example: false }),
245
+ includeDescendants: booleanOption("Whether child nodes are included when filtering", { example: true }),
246
+ titleField: stringOption("Tree node title field", { example: "title" }),
247
+ fieldNames: objectOption("Tree field names", { example: { title: "title", key: "id", children: "children" } }),
248
+ pageSize: numberOption("Root records per page", { example: 200 }),
249
+ dataScope: FILTER_GROUP,
250
+ sorting: SORTING
251
+ };
222
252
  const KANBAN_OPTIONS = {
223
253
  ...COMMON_BLOCK_HEADER_OPTIONS,
224
254
  ...COMMON_HEIGHT_OPTIONS,
@@ -386,7 +416,7 @@ const TABLE_FIELD_WRAPPER_OPTIONS = {
386
416
  editable: booleanOption("Whether editable", { example: false }),
387
417
  dataIndex: stringOption("Data index"),
388
418
  titleField: stringOption("Association display title field", { example: "title" }),
389
- fieldComponent: FIELD_COMPONENT,
419
+ ...RELATION_FIELD_TYPE_OPTIONS,
390
420
  clickToOpen: booleanOption("Whether clicking can open details", { example: true }),
391
421
  openView: OPEN_VIEW,
392
422
  code: JS_CODE,
@@ -402,7 +432,7 @@ const DETAILS_FIELD_WRAPPER_OPTIONS = {
402
432
  disabled: booleanOption("Whether disabled", { example: false }),
403
433
  pattern: stringOption("Display mode"),
404
434
  titleField: stringOption("Association display title field", { example: "title" }),
405
- fieldComponent: FIELD_COMPONENT,
435
+ ...RELATION_FIELD_TYPE_OPTIONS,
406
436
  labelWidth: stringOption("Label width", { example: "120px" }),
407
437
  labelWrap: booleanOption("Whether labels should wrap", { example: false }),
408
438
  clickToOpen: booleanOption("Whether clicking can open details", { example: true }),
@@ -422,7 +452,7 @@ const FILTER_FIELD_WRAPPER_OPTIONS = {
422
452
  allowMultiple: booleanOption("Whether multiple selection is allowed", { example: false }),
423
453
  maxCount: numberOption("Maximum count", { example: 5 }),
424
454
  name: stringOption("Field name override"),
425
- fieldComponent: FIELD_COMPONENT,
455
+ ...RELATION_FIELD_TYPE_OPTIONS,
426
456
  labelWidth: stringOption("Label width", { example: "120px" }),
427
457
  labelWrap: booleanOption("Whether labels should wrap", { example: false }),
428
458
  clickToOpen: booleanOption("Whether clicking can open details", { example: false }),
@@ -446,7 +476,7 @@ const FORM_FIELD_WRAPPER_OPTIONS = {
446
476
  pattern: stringOption("Input mode"),
447
477
  titleField: stringOption("Association display title field", { example: "title" }),
448
478
  name: stringOption("Field name override"),
449
- fieldComponent: FIELD_COMPONENT,
479
+ ...RELATION_FIELD_TYPE_OPTIONS,
450
480
  labelWidth: stringOption("Label width", { example: "120px" }),
451
481
  labelWrap: booleanOption("Whether labels should wrap", { example: false }),
452
482
  clickToOpen: booleanOption("Whether clicking can open details", { example: false }),
@@ -744,6 +774,9 @@ function getConfigureOptionsForUse(use) {
744
774
  case "CalendarBlockModel":
745
775
  options = cloneOptions(CALENDAR_OPTIONS);
746
776
  break;
777
+ case "TreeBlockModel":
778
+ options = cloneOptions(TREE_OPTIONS);
779
+ break;
747
780
  case "KanbanBlockModel":
748
781
  options = cloneOptions(KANBAN_OPTIONS);
749
782
  break;
@@ -50,7 +50,7 @@ __export(default_action_popup_exports, {
50
50
  });
51
51
  module.exports = __toCommonJS(default_action_popup_exports);
52
52
  var import_lodash = __toESM(require("lodash"));
53
- var import_field_semantics = require("./field-semantics");
53
+ var import_association_interfaces = require("./association-interfaces");
54
54
  var import_service_helpers = require("./service-helpers");
55
55
  const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_NAMES = /* @__PURE__ */ new Set(["id", "createdBy", "createdById", "updatedBy", "updatedById"]);
56
56
  const DEFAULT_ACTION_POPUP_SYSTEM_FIELD_INTERFACES = /* @__PURE__ */ new Set([
@@ -198,7 +198,7 @@ function isFlowSurfaceDefaultActionPopupAuditTimestampField(field) {
198
198
  }
199
199
  function isFlowSurfaceDefaultActionPopupMultiValueAssociationField(field) {
200
200
  const fieldInterface = String((0, import_service_helpers.getFieldInterface)(field) || "").trim();
201
- return import_field_semantics.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface);
201
+ return import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(fieldInterface);
202
202
  }
203
203
  function isFlowSurfaceDefaultActionPopupAssociationField(field) {
204
204
  const fieldType = String((0, import_service_helpers.getFieldType)(field) || "").trim();
@@ -6,6 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ export { MULTI_VALUE_ASSOCIATION_INTERFACES, SINGLE_VALUE_ASSOCIATION_INTERFACES } from './association-interfaces';
9
10
  export type FlowSurfaceFieldBindingScope = 'display' | 'editable' | 'filter';
10
11
  export type FlowSurfaceFieldBindingResolution = {
11
12
  modelClassName: string;
@@ -26,12 +26,15 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
27
  var field_binding_registry_exports = {};
28
28
  __export(field_binding_registry_exports, {
29
+ MULTI_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.MULTI_VALUE_ASSOCIATION_INTERFACES,
30
+ SINGLE_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.SINGLE_VALUE_ASSOCIATION_INTERFACES,
29
31
  getRegisteredFieldUses: () => getRegisteredFieldUses,
30
32
  resolveRegisteredFieldBinding: () => resolveRegisteredFieldBinding
31
33
  });
32
34
  module.exports = __toCommonJS(field_binding_registry_exports);
33
35
  var import_field_semantics = require("./field-semantics");
34
36
  var import_service_helpers = require("./service-helpers");
37
+ var import_association_interfaces2 = require("./association-interfaces");
35
38
  const FILE_MANAGER_PLUGIN = "@nocobase/plugin-file-manager";
36
39
  const ATTACHMENT_URL_PLUGIN = "@nocobase/plugin-field-attachment-url";
37
40
  const CODE_PLUGIN = "@nocobase/plugin-field-code";
@@ -386,6 +389,8 @@ function resolveRegisteredFieldBinding(input) {
386
389
  }
387
390
  // Annotate the CommonJS export names for ESM import in node:
388
391
  0 && (module.exports = {
392
+ MULTI_VALUE_ASSOCIATION_INTERFACES,
393
+ SINGLE_VALUE_ASSOCIATION_INTERFACES,
389
394
  getRegisteredFieldUses,
390
395
  resolveRegisteredFieldBinding
391
396
  });
@@ -6,7 +6,7 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
- export declare const MULTI_VALUE_ASSOCIATION_INTERFACES: Set<string>;
9
+ export { MULTI_VALUE_ASSOCIATION_INTERFACES } from './association-interfaces';
10
10
  export declare function normalizeFieldContainerKind(containerUse?: string): "form" | "details" | "table" | "filter-form";
11
11
  export declare function shouldUseAssociationTitleTextDisplay(input: {
12
12
  containerUse?: string;
@@ -26,12 +26,14 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
27
  var field_semantics_exports = {};
28
28
  __export(field_semantics_exports, {
29
- MULTI_VALUE_ASSOCIATION_INTERFACES: () => MULTI_VALUE_ASSOCIATION_INTERFACES,
29
+ MULTI_VALUE_ASSOCIATION_INTERFACES: () => import_association_interfaces2.MULTI_VALUE_ASSOCIATION_INTERFACES,
30
30
  normalizeFieldContainerKind: () => normalizeFieldContainerKind,
31
31
  shouldUseAssociationTitleTextDisplay: () => shouldUseAssociationTitleTextDisplay
32
32
  });
33
33
  module.exports = __toCommonJS(field_semantics_exports);
34
34
  var import_approval = require("./approval");
35
+ var import_association_interfaces = require("./association-interfaces");
36
+ var import_association_interfaces2 = require("./association-interfaces");
35
37
  const FORM_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
36
38
  "FormBlockModel",
37
39
  "CreateFormModel",
@@ -54,7 +56,6 @@ const DETAILS_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set([
54
56
  ]);
55
57
  const FILTER_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["FilterFormBlockModel", "FilterFormGridModel", "FilterFormItemModel"]);
56
58
  const TABLE_FIELD_CONTAINER_USES = /* @__PURE__ */ new Set(["TableBlockModel", "TableColumnModel"]);
57
- const MULTI_VALUE_ASSOCIATION_INTERFACES = /* @__PURE__ */ new Set(["m2m", "o2m", "mbm"]);
58
59
  function normalizeFieldContainerKind(containerUse) {
59
60
  const normalized = (0, import_approval.normalizeApprovalSemanticUse)(containerUse);
60
61
  if (FORM_FIELD_CONTAINER_USES.has(normalized)) {
@@ -73,7 +74,7 @@ function normalizeFieldContainerKind(containerUse) {
73
74
  }
74
75
  function shouldUseAssociationTitleTextDisplay(input) {
75
76
  const containerKind = normalizeFieldContainerKind(input.containerUse);
76
- return (containerKind === "table" || containerKind === "details") && !String(input.associationPathName || "").trim() && MULTI_VALUE_ASSOCIATION_INTERFACES.has(String(input.fieldInterface || "").trim());
77
+ return (containerKind === "table" || containerKind === "details") && !String(input.associationPathName || "").trim() && import_association_interfaces.MULTI_VALUE_ASSOCIATION_INTERFACES.has(String(input.fieldInterface || "").trim());
77
78
  }
78
79
  // Annotate the CommonJS export names for ESM import in node:
79
80
  0 && (module.exports = {
@@ -0,0 +1,46 @@
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_RELATION_FIELD_TYPES: readonly ["text", "select", "picker", "subForm", "subFormList", "subDetails", "subDetailsList", "subTable", "popupSubTable"];
10
+ export type FlowSurfacePublicRelationFieldType = (typeof FLOW_SURFACE_PUBLIC_RELATION_FIELD_TYPES)[number];
11
+ export declare const FLOW_SURFACE_RESERVED_RELATION_FIELD_TYPES: readonly ["cascade", "upload", "preview"];
12
+ export declare const FLOW_SURFACE_PUBLIC_FIELD_TYPE_SET: Set<string>;
13
+ export declare const FLOW_SURFACE_INTERNAL_FIELD_KEYS: string[];
14
+ export declare function assertNoInternalFieldKeys(input: Record<string, any> | undefined, context: string): void;
15
+ export declare function normalizePublicFieldType(value: any, context: string): FlowSurfacePublicRelationFieldType | undefined;
16
+ export declare function normalizePublicFieldNameList(value: any, context: string): string[] | undefined;
17
+ export declare function getPublicFieldTypeForUse(use?: string): FlowSurfacePublicRelationFieldType | undefined;
18
+ export declare function resolveRelationFieldType(input: {
19
+ fieldType: any;
20
+ containerUse: string;
21
+ field: any;
22
+ dataSourceKey: string;
23
+ getCollection: (dataSourceKey: string, collectionName: string) => any;
24
+ fields?: any;
25
+ selectorFields?: any;
26
+ titleField?: any;
27
+ openMode?: any;
28
+ popupSize?: any;
29
+ pageSize?: any;
30
+ showIndex?: any;
31
+ applyDefaults?: boolean;
32
+ context: string;
33
+ }): {
34
+ fieldType: "select" | "subForm" | "text" | "picker" | "subFormList" | "subDetails" | "subDetailsList" | "subTable" | "popupSubTable";
35
+ fieldUse: string;
36
+ cardinality: "single" | "multi";
37
+ targetCollection: any;
38
+ fields: any[];
39
+ selectorFields: any[];
40
+ titleField: any;
41
+ openMode: any;
42
+ popupSize: any;
43
+ pageSize: any;
44
+ showIndex: any;
45
+ };
46
+ export declare function usesNestedRelationFields(fieldUse?: string): boolean;