@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
@@ -117,6 +117,13 @@ const JS_ITEM_DEFAULT_CODE = [
117
117
  "ctx.render(<JsItem />);"
118
118
  ].join("\n");
119
119
  const JS_COLUMN_DEFAULT_CODE = `ctx.render('<span class="nb-js-column">JS column</span>');`;
120
+ const CALENDAR_QUICK_CREATE_ACTION_KEY = "quickCreateAction";
121
+ const CALENDAR_EVENT_VIEW_ACTION_KEY = "eventViewAction";
122
+ const CALENDAR_READONLY_ACTION_MODEL_USES = /* @__PURE__ */ new Set([
123
+ "CalendarNavActionModel",
124
+ "CalendarTitleActionModel",
125
+ "CalendarViewSelectActionModel"
126
+ ]);
120
127
  const JS_ACTION_DEFAULT_CODE_BY_USE = {
121
128
  JSCollectionActionModel: [
122
129
  "const rows = ctx.resource?.getSelectedRows?.() || [];",
@@ -207,6 +214,7 @@ function buildSyntheticRootPageTabModel(options) {
207
214
  };
208
215
  }
209
216
  function buildBlockTree(options) {
217
+ var _a, _b;
210
218
  const use = (0, import_catalog.resolveSupportedBlockCatalogItem)(
211
219
  {
212
220
  type: options.type,
@@ -256,6 +264,7 @@ function buildBlockTree(options) {
256
264
  import_lodash.default.set(baseStepParams, ["resourceSettings", "init"], normalizedResourceInit);
257
265
  }
258
266
  const model = {
267
+ ...use === "CalendarBlockModel" ? { uid: (0, import_utils.uid)() } : {},
259
268
  use,
260
269
  ...typeof (approvalBlockDefaults == null ? void 0 : approvalBlockDefaults.async) === "boolean" ? { async: approvalBlockDefaults.async } : {},
261
270
  props: import_lodash.default.merge(
@@ -350,16 +359,74 @@ function buildBlockTree(options) {
350
359
  }
351
360
  }
352
361
  };
362
+ } else if (use === "CalendarBlockModel") {
363
+ const blockUid = model.uid || (0, import_utils.uid)();
364
+ model.uid = blockUid;
365
+ model.subModels = {
366
+ [CALENDAR_QUICK_CREATE_ACTION_KEY]: buildCalendarPopupActionNode({
367
+ actionKey: CALENDAR_QUICK_CREATE_ACTION_KEY,
368
+ blockUid,
369
+ resourceInit: normalizedResourceInit,
370
+ popupSettings: (_a = model.props) == null ? void 0 : _a.quickCreatePopupSettings
371
+ }),
372
+ [CALENDAR_EVENT_VIEW_ACTION_KEY]: buildCalendarPopupActionNode({
373
+ actionKey: CALENDAR_EVENT_VIEW_ACTION_KEY,
374
+ blockUid,
375
+ resourceInit: normalizedResourceInit,
376
+ popupSettings: (_b = model.props) == null ? void 0 : _b.eventPopupSettings
377
+ })
378
+ };
353
379
  }
354
380
  return assignClientKeysToUids(model, {});
355
381
  }
382
+ function buildCalendarPopupActionNode(options) {
383
+ const actionUid = `${options.blockUid}-${options.actionKey}`;
384
+ return {
385
+ uid: actionUid,
386
+ use: options.actionKey === CALENDAR_QUICK_CREATE_ACTION_KEY ? "CalendarQuickCreateActionModel" : "CalendarEventViewActionModel",
387
+ stepParams: {
388
+ popupSettings: {
389
+ openView: buildCalendarPopupOpenView({
390
+ actionUid,
391
+ resourceInit: options.resourceInit,
392
+ popupSettings: options.popupSettings
393
+ })
394
+ }
395
+ }
396
+ };
397
+ }
398
+ function buildCalendarPopupOpenView(options) {
399
+ var _a, _b, _c;
400
+ const defaults = import_lodash.default.pickBy(
401
+ {
402
+ mode: "drawer",
403
+ size: "medium",
404
+ pageModelClass: "ChildPageModel",
405
+ uid: options.actionUid,
406
+ collectionName: (_a = options.resourceInit) == null ? void 0 : _a.collectionName,
407
+ dataSourceKey: ((_b = options.resourceInit) == null ? void 0 : _b.dataSourceKey) || (((_c = options.resourceInit) == null ? void 0 : _c.collectionName) ? "main" : void 0)
408
+ },
409
+ (value) => !import_lodash.default.isUndefined(value)
410
+ );
411
+ const current = import_lodash.default.cloneDeep(options.popupSettings || {});
412
+ return import_lodash.default.pickBy(
413
+ {
414
+ ...defaults,
415
+ ...current,
416
+ uid: current.uid || defaults.uid,
417
+ collectionName: current.collectionName || defaults.collectionName,
418
+ dataSourceKey: current.dataSourceKey || defaults.dataSourceKey
419
+ },
420
+ (value) => !import_lodash.default.isUndefined(value)
421
+ );
422
+ }
356
423
  function buildPopupPageTree(options) {
357
424
  const pageUid = options.pageUid || (0, import_utils.uid)();
358
425
  const tabUid = options.tabUid || (0, import_utils.uid)();
359
426
  const gridUid = options.gridUid || (0, import_utils.uid)();
360
427
  const displayTitle = options.displayTitle === true;
361
428
  const enableTabs = options.enableTabs !== false;
362
- const tabTitle = options.tabTitle || "Details";
429
+ const tabTitle = options.tabTitle || '{{t("Details")}}';
363
430
  return {
364
431
  uid: pageUid,
365
432
  use: "ChildPageModel",
@@ -554,17 +621,22 @@ function assignClientKeysToUids(spec, clientKeyToUid) {
554
621
  function buildActionDefaults(options) {
555
622
  var _a, _b, _c;
556
623
  const approvalDefaults = (0, import_approval.buildApprovalActionDefaults)(options.use);
624
+ const readonlyCalendarAction = CALENDAR_READONLY_ACTION_MODEL_USES.has(options.use);
557
625
  const props = import_lodash.default.merge(
558
626
  {},
559
627
  inferActionDefaultProps(options.use, options.catalogItem.scope),
560
628
  (approvalDefaults == null ? void 0 : approvalDefaults.props) || {}
561
629
  );
562
630
  const normalizedProps = applyContainerActionStyle(props, options.containerUse);
563
- const stepParams = import_lodash.default.merge({}, import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.stepParams) || {}), {
564
- buttonSettings: {
565
- general: pickButtonGeneralProps(normalizedProps)
631
+ const stepParams = import_lodash.default.merge(
632
+ {},
633
+ import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.stepParams) || {}),
634
+ readonlyCalendarAction ? {} : {
635
+ buttonSettings: {
636
+ general: pickButtonGeneralProps(normalizedProps)
637
+ }
566
638
  }
567
- });
639
+ );
568
640
  const subModels = import_lodash.default.cloneDeep((approvalDefaults == null ? void 0 : approvalDefaults.subModels) || {});
569
641
  if (approvalDefaults) {
570
642
  return {
@@ -599,8 +671,8 @@ function buildActionDefaults(options) {
599
671
  stepParams.deleteSettings = {
600
672
  confirm: {
601
673
  enable: true,
602
- title: "Delete record",
603
- content: "Are you sure you want to delete it?"
674
+ title: '{{t("Delete record")}}',
675
+ content: '{{t("Are you sure you want to delete it?")}}'
604
676
  }
605
677
  };
606
678
  }
@@ -608,8 +680,8 @@ function buildActionDefaults(options) {
608
680
  stepParams.submitSettings = {
609
681
  confirm: {
610
682
  enable: false,
611
- title: "Submit record",
612
- content: "Are you sure you want to save it?"
683
+ title: '{{t("Submit record")}}',
684
+ content: '{{t("Are you sure you want to save it?")}}'
613
685
  }
614
686
  };
615
687
  }
@@ -617,8 +689,8 @@ function buildActionDefaults(options) {
617
689
  stepParams.assignSettings = {
618
690
  confirm: {
619
691
  enable: false,
620
- title: options.use === "BulkUpdateActionModel" ? "Perform the Bulk update" : "Perform the Update record",
621
- content: options.use === "BulkUpdateActionModel" ? "Are you sure you want to perform the Bulk update action?" : "Are you sure you want to perform the Update record action?"
692
+ title: options.use === "BulkUpdateActionModel" ? '{{t("Bulk update")}}' : '{{t("Perform the Update record")}}',
693
+ content: '{{t("Are you sure you want to perform the Update record action?")}}'
622
694
  },
623
695
  assignFieldValues: {
624
696
  assignedValues: {}
@@ -671,156 +743,162 @@ function inferActionDefaultProps(use, scope) {
671
743
  const map = {
672
744
  AddNewActionModel: {
673
745
  type: "primary",
674
- title: "Add new",
746
+ title: '{{t("Add new")}}',
675
747
  icon: "PlusOutlined"
676
748
  },
677
749
  ViewActionModel: {
678
750
  type: "link",
679
- title: "View",
751
+ title: '{{t("View")}}',
680
752
  icon: "EyeOutlined"
681
753
  },
682
754
  EditActionModel: {
683
- title: "Edit",
755
+ title: '{{t("Edit")}}',
684
756
  icon: "EditOutlined"
685
757
  },
686
758
  PopupCollectionActionModel: {
687
- title: "Popup",
759
+ title: '{{t("Popup")}}',
688
760
  icon: "ExportOutlined"
689
761
  },
690
762
  DeleteActionModel: {
691
763
  type: "link",
692
- title: "Delete",
764
+ title: '{{t("Delete")}}',
693
765
  icon: "DeleteOutlined"
694
766
  },
695
767
  UpdateRecordActionModel: {
696
768
  type: "link",
697
- title: "Update record",
769
+ title: '{{t("Update record")}}',
698
770
  icon: "EditOutlined"
699
771
  },
700
772
  BulkUpdateActionModel: {
701
- title: "Bulk update",
773
+ title: '{{t("Bulk update")}}',
702
774
  icon: "EditOutlined"
703
775
  },
704
776
  FilterActionModel: {
705
- title: "Filter",
777
+ title: '{{t("Filter")}}',
706
778
  icon: "FilterOutlined"
707
779
  },
708
780
  RefreshActionModel: {
709
- title: "Refresh",
781
+ title: '{{t("Refresh")}}',
710
782
  icon: "ReloadOutlined"
711
783
  },
712
784
  ExpandCollapseActionModel: {
713
- title: "Expand/Collapse",
714
785
  icon: "DownOutlined"
715
786
  },
716
787
  BulkDeleteActionModel: {
717
- title: "Delete",
788
+ title: '{{t("Delete")}}',
718
789
  icon: "DeleteOutlined"
719
790
  },
720
791
  BulkEditActionModel: {
721
- title: "Bulk edit",
792
+ title: '{{t("Bulk edit")}}',
722
793
  icon: "EditOutlined"
723
794
  },
724
795
  ExportActionModel: {
725
- title: "Export",
796
+ title: '{{t("Export")}}',
726
797
  icon: "DownloadOutlined"
727
798
  },
728
799
  ExportAttachmentActionModel: {
729
- title: "Export attachments",
800
+ title: '{{t("Export attachments")}}',
730
801
  icon: "DownloadOutlined"
731
802
  },
732
803
  ImportActionModel: {
733
- title: "Import",
804
+ title: '{{t("Import")}}',
734
805
  icon: "UploadOutlined"
735
806
  },
736
807
  LinkActionModel: {
737
808
  type: "link",
738
- title: "Link"
809
+ title: '{{t("Link")}}'
739
810
  },
740
811
  UploadActionModel: {
741
- title: "Upload",
812
+ title: '{{t("Upload")}}',
742
813
  icon: "UploadOutlined"
743
814
  },
744
815
  DuplicateActionModel: {
745
816
  type: "link",
746
- title: "Duplicate",
817
+ title: '{{t("Duplicate")}}',
747
818
  icon: "CopyOutlined"
748
819
  },
749
820
  AddChildActionModel: {
750
821
  type: "link",
751
- title: "Add child",
822
+ title: '{{t("Add child")}}',
752
823
  icon: "PlusOutlined"
753
824
  },
754
825
  TemplatePrintCollectionActionModel: {
755
- title: "Template print",
826
+ title: '{{t("Template print", { ns: "@nocobase/plugin-action-template-print" })}}',
756
827
  icon: "PrinterOutlined"
757
828
  },
758
829
  TemplatePrintRecordActionModel: {
759
830
  type: "link",
760
- title: "Template print",
831
+ title: '{{t("Template print", { ns: "@nocobase/plugin-action-template-print" })}}',
761
832
  icon: "PrinterOutlined"
762
833
  },
763
834
  CollectionTriggerWorkflowActionModel: {
764
- title: "Trigger workflow",
835
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
765
836
  icon: "PlayCircleOutlined"
766
837
  },
767
838
  RecordTriggerWorkflowActionModel: {
768
839
  type: "link",
769
- title: "Trigger workflow",
840
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
770
841
  icon: "PlayCircleOutlined"
771
842
  },
772
843
  FormTriggerWorkflowActionModel: {
773
- title: "Trigger workflow",
844
+ title: '{{t("Trigger workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
774
845
  icon: "PlayCircleOutlined"
775
846
  },
776
847
  WorkbenchTriggerWorkflowActionModel: {
777
- title: "Trigger workflow",
848
+ title: '{{t("Trigger global workflow", { ns: "@nocobase/plugin-workflow-custom-action-trigger" })}}',
778
849
  icon: "PlayCircleOutlined"
779
850
  },
780
851
  MailSendActionModel: {
781
- title: "Compose email",
852
+ title: '{{t("Compose email", { ns: ["@nocobase/plugin-email-manager", "client"] })}}',
782
853
  icon: "MailOutlined"
783
854
  },
784
855
  FormSubmitActionModel: {
785
- title: "Submit",
856
+ title: '{{t("Submit")}}',
786
857
  type: "primary",
787
858
  htmlType: "submit"
788
859
  },
789
860
  FilterFormSubmitActionModel: {
790
- title: "Filter",
861
+ title: '{{t("Filter")}}',
791
862
  type: "primary"
792
863
  },
793
864
  FilterFormResetActionModel: {
794
- title: "Reset"
865
+ title: '{{t("Reset")}}'
795
866
  },
796
867
  FilterFormCollapseActionModel: {
797
868
  type: "link",
798
- title: "Collapse button"
869
+ title: '{{t("Collapse button")}}'
870
+ },
871
+ CalendarTodayActionModel: {
872
+ type: "default",
873
+ title: '{{t("Today", { ns: "calendar" })}}'
799
874
  },
875
+ CalendarNavActionModel: {},
876
+ CalendarTitleActionModel: {},
877
+ CalendarViewSelectActionModel: {},
800
878
  JSCollectionActionModel: {
801
- title: "JS action",
879
+ title: '{{t("JS action")}}',
802
880
  icon: "JavaScriptOutlined"
803
881
  },
804
882
  JSRecordActionModel: {
805
883
  type: "link",
806
- title: "JS action",
884
+ title: '{{t("JS action")}}',
807
885
  icon: "JavaScriptOutlined"
808
886
  },
809
887
  JSFormActionModel: {
810
- title: "JS action",
888
+ title: '{{t("JS action")}}',
811
889
  icon: "JavaScriptOutlined"
812
890
  },
813
891
  JSItemActionModel: {
814
- title: "JS item",
892
+ title: '{{t("JS item")}}',
815
893
  icon: "JavaScriptOutlined"
816
894
  },
817
895
  FilterFormJSActionModel: {
818
- title: "JS action",
896
+ title: '{{t("JS action")}}',
819
897
  icon: "JavaScriptOutlined"
820
898
  },
821
899
  JSActionModel: {
822
900
  type: "default",
823
- title: "JS action",
901
+ title: '{{t("JS action")}}',
824
902
  icon: "JavaScriptOutlined"
825
903
  }
826
904
  };
@@ -873,6 +951,18 @@ function buildBlockDefaults(use) {
873
951
  }
874
952
  };
875
953
  }
954
+ if (use === "CalendarBlockModel") {
955
+ return {
956
+ props: {
957
+ fieldNames: {
958
+ id: "id"
959
+ },
960
+ defaultView: "month",
961
+ enableQuickCreateEvent: true,
962
+ weekStart: 1
963
+ }
964
+ };
965
+ }
876
966
  return {};
877
967
  }
878
968
  function getStandaloneFieldDefaults(use) {
@@ -892,12 +982,12 @@ function getStandaloneFieldDefaults(use) {
892
982
  case "JSColumnModel":
893
983
  return {
894
984
  props: {
895
- title: "JS column"
985
+ title: '{{t("JS column")}}'
896
986
  },
897
987
  stepParams: {
898
988
  tableColumnSettings: {
899
989
  title: {
900
- title: "JS column"
990
+ title: '{{t("JS column")}}'
901
991
  }
902
992
  },
903
993
  jsSettings: buildRunJsStepParams(JS_COLUMN_DEFAULT_CODE)
@@ -909,13 +999,21 @@ function getStandaloneFieldDefaults(use) {
909
999
  jsSettings: buildRunJsStepParams(JS_ITEM_DEFAULT_CODE)
910
1000
  }
911
1001
  };
1002
+ case "DividerItemModel":
1003
+ return {
1004
+ props: {
1005
+ label: '{{t("Divider")}}',
1006
+ orientation: "left"
1007
+ }
1008
+ };
912
1009
  default:
913
1010
  return {};
914
1011
  }
915
1012
  }
916
1013
  function humanizeActionTitle(use) {
917
1014
  const normalized = String(use || "").replace(/ActionModel$/, "").replace(/(Collection|Record|Form|Workbench)$/, "");
918
- return import_lodash.default.startCase(normalized).replace(/\bJs\b/g, "JS").trim() || "Action";
1015
+ const title = import_lodash.default.startCase(normalized).replace(/\bJs\b/g, "JS").trim() || "Action";
1016
+ return `{{t(${JSON.stringify(title)})}}`;
919
1017
  }
920
1018
  // Annotate the CommonJS export names for ESM import in node:
921
1019
  0 && (module.exports = {