@tachybase/client 0.23.22 → 0.23.40

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 (203) hide show
  1. package/es/application/schema-initializer/components/SchemaInitializerButton.mjs +1 -1
  2. package/es/application/schema-initializer/components/SchemaInitializerChildren.mjs +1 -1
  3. package/es/built-in/admin-layout/AdminLayout.mjs +15 -1
  4. package/es/built-in/admin-layout/InternalAdminLayout.mjs +4 -2
  5. package/es/built-in/admin-layout/MenuEditor.mjs +2 -2
  6. package/es/built-in/admin-layout/style.d.ts +1 -1
  7. package/es/built-in/admin-layout/style.mjs +4 -4
  8. package/es/built-in/attachment-preview/previewers/file-pdf.mjs +4 -2
  9. package/es/built-in/context-menu/ContextMenu.provider.d.ts +1 -0
  10. package/es/built-in/context-menu/ContextMenu.provider.mjs +29 -1
  11. package/es/built-in/context-menu/index.mjs +1 -0
  12. package/es/built-in/index.mjs +44 -10
  13. package/es/built-in/page-style/TabHeader.d.ts +1 -1
  14. package/es/built-in/page-style/TabHeader.mjs +26 -33
  15. package/es/built-in/page-style/TabHeader.style.d.ts +4 -0
  16. package/es/built-in/page-style/TabHeader.style.mjs +35 -0
  17. package/es/built-in/pinned-list/PinnedPluginListProvider.d.ts +3 -1
  18. package/es/built-in/pinned-list/PinnedPluginListProvider.mjs +5 -4
  19. package/es/built-in/scroll-assistant/useJoystick.mjs +3 -1
  20. package/es/built-in/setting-layout/SettingLayout.mjs +10 -1
  21. package/es/built-in/{assistant/calculator → setting-layout}/style.d.ts +1 -1
  22. package/es/built-in/setting-layout/style.mjs +25 -0
  23. package/es/collection-manager/action-hooks.d.ts +1 -4
  24. package/es/collection-manager/action-hooks.mjs +39 -11
  25. package/es/icon/preloaded.mjs +4 -4
  26. package/es/index.d.ts +0 -1
  27. package/es/index.mjs +0 -1
  28. package/es/modules/actions/associate/AssociateActionInitializer.d.ts +1 -0
  29. package/es/modules/actions/associate/AssociateActionInitializer.mjs +71 -0
  30. package/es/modules/actions/associate/AssociateActionProvider.d.ts +7 -0
  31. package/es/modules/actions/associate/AssociateActionProvider.mjs +82 -0
  32. package/es/modules/actions/associate/AssociateActionSettings.d.ts +2 -0
  33. package/es/modules/actions/associate/AssociateActionSettings.mjs +57 -0
  34. package/es/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.mjs +2 -1
  35. package/es/modules/blocks/data-blocks/form/RecordFormBlockInitializer.mjs +21 -14
  36. package/es/modules/blocks/data-blocks/form/createEditFormBlockUISchema.d.ts +1 -2
  37. package/es/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.mjs +2 -1
  38. package/es/modules/blocks/data-blocks/list/listBlockSettings.mjs +2 -1
  39. package/es/modules/blocks/data-blocks/table/TableActionInitializers.mjs +15 -0
  40. package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +2 -1
  41. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +2 -2
  42. package/es/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.mjs +2 -1
  43. package/es/modules/fields/component/Cascader/cascaderComponentFieldSettings.mjs +2 -1
  44. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +4 -0
  45. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +16 -2
  46. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +2 -1
  47. package/es/modules/menu/GroupItem.mjs +5 -1
  48. package/es/modules/menu/LinkMenuItem.mjs +7 -3
  49. package/es/modules/menu/PageMenuItem.mjs +5 -1
  50. package/es/modules/menu/UploadMenuItem.d.ts +1 -0
  51. package/es/modules/menu/UploadMenuItem.mjs +81 -0
  52. package/es/modules/menu/menuItemInitializer.d.ts +0 -4
  53. package/es/modules/menu/menuItemInitializer.mjs +3 -23
  54. package/es/schema-component/antd/action/Action.Designer.mjs +4 -1
  55. package/es/schema-component/antd/association-select/AssociationSelect.mjs +4 -2
  56. package/es/schema-component/antd/checkbox/Checkbox.mjs +11 -6
  57. package/es/schema-component/antd/date-picker/DatePicker.mjs +4 -0
  58. package/es/schema-component/antd/form-item/FormItem.Settings.d.ts +2 -0
  59. package/es/schema-component/antd/form-item/FormItem.Settings.mjs +14 -1
  60. package/es/schema-component/antd/form-v2/Form.Settings.mjs +2 -1
  61. package/es/schema-component/antd/grid-card/GridCard.Designer.mjs +2 -1
  62. package/es/schema-component/antd/list/List.Designer.mjs +2 -1
  63. package/es/schema-component/antd/menu/AdminMenu.d.ts +1 -0
  64. package/es/schema-component/antd/menu/AdminMenu.mjs +75 -0
  65. package/es/schema-component/antd/menu/AdminMenu.style.d.ts +4 -0
  66. package/es/schema-component/antd/menu/AdminMenu.style.mjs +36 -0
  67. package/es/schema-component/antd/menu/Menu.Designer.d.ts +2 -1
  68. package/es/schema-component/antd/menu/Menu.Designer.mjs +62 -42
  69. package/es/schema-component/antd/menu/Menu.mjs +124 -163
  70. package/es/schema-component/antd/menu/Menu.styles.d.ts +1 -2
  71. package/es/schema-component/antd/menu/Menu.styles.mjs +8 -20
  72. package/es/schema-component/antd/menu/MenuAdd.d.ts +1 -0
  73. package/es/schema-component/antd/menu/MenuAdd.mjs +18 -0
  74. package/es/schema-component/antd/menu/MenuSearchAdd.d.ts +7 -0
  75. package/es/schema-component/antd/menu/MenuSearchAdd.mjs +41 -0
  76. package/es/schema-component/antd/menu/MenuSearchAdd.style.d.ts +3 -0
  77. package/es/schema-component/antd/menu/MenuSearchAdd.style.mjs +25 -0
  78. package/es/schema-component/antd/menu/tools.d.ts +9 -0
  79. package/es/schema-component/antd/menu/tools.mjs +36 -0
  80. package/es/schema-component/antd/scroll-area/ScrollArea.mjs +0 -17
  81. package/es/schema-component/antd/select/Select.d.ts +3 -13
  82. package/es/schema-component/antd/select/Select.mjs +33 -2
  83. package/es/schema-component/antd/table/Table.Void.Designer.mjs +2 -1
  84. package/es/schema-component/antd/table-v2/TableBlockDesigner.mjs +2 -1
  85. package/es/schema-component/antd/table-v2/TableSelectorDesigner.mjs +2 -1
  86. package/es/schema-component/common/dnd-context/index.d.ts +1 -2
  87. package/es/schema-component/common/sortable-item/DragHandleMenu.d.ts +1 -0
  88. package/es/schema-component/common/sortable-item/DragHandleMenu.mjs +78 -0
  89. package/es/schema-component/common/sortable-item/DragHandleMenu.style.d.ts +3 -0
  90. package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +25 -0
  91. package/es/schema-component/common/sortable-item/SortableItem.d.ts +1 -0
  92. package/es/schema-initializer/SchemaInitializerPlugin.mjs +5 -2
  93. package/es/schema-initializer/utils.mjs +9 -7
  94. package/es/schema-settings/GeneralSchemaDesigner.d.ts +2 -1
  95. package/es/schema-settings/GeneralSchemaDesigner.mjs +9 -1
  96. package/es/schema-settings/SchemaSettings.d.ts +3 -1
  97. package/es/schema-settings/SchemaSettings.mjs +16 -4
  98. package/es/schema-settings/SchemaSettingsPlugin.mjs +2 -0
  99. package/es/schema-settings/SchemaSettingsSortingRule.mjs +2 -1
  100. package/es/schema-settings/styles.mjs +2 -2
  101. package/lib/application/schema-initializer/components/SchemaInitializerButton.js +1 -1
  102. package/lib/application/schema-initializer/components/SchemaInitializerChildren.js +1 -1
  103. package/lib/built-in/admin-layout/AdminLayout.js +15 -1
  104. package/lib/built-in/admin-layout/InternalAdminLayout.js +4 -2
  105. package/lib/built-in/admin-layout/MenuEditor.js +2 -2
  106. package/lib/built-in/admin-layout/style.js +4 -4
  107. package/lib/built-in/attachment-preview/previewers/file-pdf.js +4 -2
  108. package/lib/built-in/context-menu/ContextMenu.provider.js +29 -0
  109. package/lib/built-in/context-menu/index.js +1 -0
  110. package/lib/built-in/index.js +142 -114
  111. package/lib/built-in/page-style/TabHeader.js +26 -33
  112. package/lib/built-in/page-style/TabHeader.style.js +69 -0
  113. package/lib/built-in/pinned-list/PinnedPluginListProvider.js +5 -4
  114. package/lib/built-in/scroll-assistant/useJoystick.js +17 -1
  115. package/lib/built-in/setting-layout/SettingLayout.js +10 -1
  116. package/lib/built-in/{assistant/context.js → setting-layout/style.js} +24 -5
  117. package/lib/collection-manager/action-hooks.js +39 -11
  118. package/lib/icon/preloaded.js +4 -4
  119. package/lib/index.js +71 -86
  120. package/lib/locale/en_US.js +8 -0
  121. package/lib/locale/zh-CN.js +8 -0
  122. package/lib/modules/actions/associate/AssociateActionInitializer.js +105 -0
  123. package/lib/modules/actions/associate/AssociateActionProvider.js +116 -0
  124. package/lib/modules/actions/associate/AssociateActionSettings.js +91 -0
  125. package/lib/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.js +2 -1
  126. package/lib/modules/blocks/data-blocks/form/RecordFormBlockInitializer.js +21 -14
  127. package/lib/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.js +2 -1
  128. package/lib/modules/blocks/data-blocks/list/listBlockSettings.js +2 -1
  129. package/lib/modules/blocks/data-blocks/table/TableActionInitializers.js +15 -0
  130. package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +2 -1
  131. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +2 -2
  132. package/lib/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.js +2 -1
  133. package/lib/modules/fields/component/Cascader/cascaderComponentFieldSettings.js +2 -1
  134. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +4 -0
  135. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +16 -2
  136. package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +2 -1
  137. package/lib/modules/menu/GroupItem.js +5 -1
  138. package/lib/modules/menu/LinkMenuItem.js +7 -3
  139. package/lib/modules/menu/PageMenuItem.js +5 -1
  140. package/lib/modules/menu/UploadMenuItem.js +115 -0
  141. package/lib/modules/menu/menuItemInitializer.js +2 -23
  142. package/lib/schema-component/antd/action/Action.Designer.js +4 -1
  143. package/lib/schema-component/antd/association-select/AssociationSelect.js +4 -2
  144. package/lib/schema-component/antd/checkbox/Checkbox.js +11 -6
  145. package/lib/schema-component/antd/date-picker/DatePicker.js +4 -0
  146. package/lib/schema-component/antd/form-item/FormItem.Settings.js +16 -1
  147. package/lib/schema-component/antd/form-v2/Form.Settings.js +2 -1
  148. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +2 -1
  149. package/lib/schema-component/antd/list/List.Designer.js +2 -1
  150. package/lib/schema-component/antd/menu/AdminMenu.js +109 -0
  151. package/lib/schema-component/antd/menu/AdminMenu.style.js +70 -0
  152. package/lib/schema-component/antd/menu/Menu.Designer.js +62 -41
  153. package/lib/schema-component/antd/menu/Menu.js +124 -163
  154. package/lib/schema-component/antd/menu/Menu.styles.js +8 -20
  155. package/lib/{built-in/assistant/calculator/CalculatorDisplay.js → schema-component/antd/menu/MenuAdd.js} +14 -17
  156. package/lib/schema-component/antd/menu/MenuSearchAdd.js +89 -0
  157. package/lib/schema-component/antd/menu/MenuSearchAdd.style.js +59 -0
  158. package/lib/schema-component/antd/menu/tools.js +72 -0
  159. package/lib/schema-component/antd/scroll-area/ScrollArea.js +0 -17
  160. package/lib/schema-component/antd/select/Select.js +33 -2
  161. package/lib/schema-component/antd/table/Table.Void.Designer.js +2 -1
  162. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  163. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +2 -1
  164. package/lib/schema-component/common/sortable-item/DragHandleMenu.js +112 -0
  165. package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +59 -0
  166. package/lib/schema-initializer/SchemaInitializerPlugin.js +5 -2
  167. package/lib/schema-initializer/utils.js +9 -7
  168. package/lib/schema-settings/GeneralSchemaDesigner.js +9 -1
  169. package/lib/schema-settings/SchemaSettings.js +16 -4
  170. package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
  171. package/lib/schema-settings/SchemaSettingsSortingRule.js +2 -1
  172. package/lib/schema-settings/styles.js +2 -2
  173. package/package.json +8 -7
  174. package/es/built-in/assistant/Assistant.provider.d.ts +0 -9
  175. package/es/built-in/assistant/Assistant.provider.mjs +0 -125
  176. package/es/built-in/assistant/calculator/AutoScalingText.d.ts +0 -3
  177. package/es/built-in/assistant/calculator/AutoScalingText.mjs +0 -33
  178. package/es/built-in/assistant/calculator/Calculator.d.ts +0 -2
  179. package/es/built-in/assistant/calculator/Calculator.mjs +0 -235
  180. package/es/built-in/assistant/calculator/CalculatorDisplay.d.ts +0 -4
  181. package/es/built-in/assistant/calculator/CalculatorDisplay.mjs +0 -21
  182. package/es/built-in/assistant/calculator/CalculatorKey.d.ts +0 -5
  183. package/es/built-in/assistant/calculator/CalculatorKey.mjs +0 -11
  184. package/es/built-in/assistant/calculator/CalculatorProvider.d.ts +0 -10
  185. package/es/built-in/assistant/calculator/CalculatorProvider.mjs +0 -29
  186. package/es/built-in/assistant/calculator/Draggable.d.ts +0 -8
  187. package/es/built-in/assistant/calculator/Draggable.mjs +0 -54
  188. package/es/built-in/assistant/calculator/style.mjs +0 -25
  189. package/es/built-in/assistant/context.d.ts +0 -3
  190. package/es/built-in/assistant/context.mjs +0 -6
  191. package/es/built-in/assistant/index.d.ts +0 -7
  192. package/es/built-in/assistant/index.mjs +0 -16
  193. package/es/built-in/assistant/search-and-jump/index.d.ts +0 -16
  194. package/es/built-in/assistant/search-and-jump/index.mjs +0 -59
  195. package/lib/built-in/assistant/Assistant.provider.js +0 -161
  196. package/lib/built-in/assistant/calculator/AutoScalingText.js +0 -67
  197. package/lib/built-in/assistant/calculator/Calculator.js +0 -283
  198. package/lib/built-in/assistant/calculator/CalculatorKey.js +0 -45
  199. package/lib/built-in/assistant/calculator/CalculatorProvider.js +0 -65
  200. package/lib/built-in/assistant/calculator/Draggable.js +0 -102
  201. package/lib/built-in/assistant/calculator/style.js +0 -59
  202. package/lib/built-in/assistant/index.js +0 -107
  203. package/lib/built-in/assistant/search-and-jump/index.js +0 -96
@@ -26,15 +26,14 @@ var __webpack_require__ = {};
26
26
  var __webpack_exports__ = {};
27
27
  __webpack_require__.r(__webpack_exports__);
28
28
  __webpack_require__.d(__webpack_exports__, {
29
- menuItemInitializer_deprecated: ()=>menuItemInitializer_deprecated,
30
29
  menuItemInitializer: ()=>menuItemInitializer
31
30
  });
32
31
  const SchemaInitializer_js_namespaceObject = require("../../application/schema-initializer/SchemaInitializer.js");
33
32
  const external_GroupItem_js_namespaceObject = require("./GroupItem.js");
34
33
  const external_LinkMenuItem_js_namespaceObject = require("./LinkMenuItem.js");
35
34
  const external_PageMenuItem_js_namespaceObject = require("./PageMenuItem.js");
36
- const menuItemInitializer_deprecated = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
37
- name: 'MenuItemInitializers',
35
+ const menuItemInitializer = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
36
+ name: 'menuInitializers:menuItem',
38
37
  insertPosition: 'beforeEnd',
39
38
  icon: 'PlusOutlined',
40
39
  title: '{{t("Add menu item")}}',
@@ -56,26 +55,6 @@ const menuItemInitializer_deprecated = new SchemaInitializer_js_namespaceObject.
56
55
  }
57
56
  ]
58
57
  });
59
- const menuItemInitializer = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
60
- name: 'menuInitializers:menuItem',
61
- insertPosition: 'beforeEnd',
62
- icon: 'PlusOutlined',
63
- title: '{{t("Add menu item")}}',
64
- items: [
65
- {
66
- name: 'submenu',
67
- Component: external_GroupItem_js_namespaceObject.GroupItem
68
- },
69
- {
70
- name: 'page',
71
- Component: external_PageMenuItem_js_namespaceObject.PageMenuItem
72
- },
73
- {
74
- name: 'link',
75
- Component: external_LinkMenuItem_js_namespaceObject.LinkMenuItem
76
- }
77
- ]
78
- });
79
58
  var __webpack_export_target__ = exports;
80
59
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
81
60
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
@@ -236,7 +236,10 @@ function SkipValidation() {
236
236
  }
237
237
  const findSchema = (schema)=>{
238
238
  if (!schema) return;
239
- if ('ACLActionProvider' === schema['x-decorator']) return schema['x-component-props'].openMode;
239
+ if ('ACLActionProvider' === schema['x-decorator']) {
240
+ var _schema_xcomponentprops;
241
+ return null === (_schema_xcomponentprops = schema['x-component-props']) || void 0 === _schema_xcomponentprops ? void 0 : _schema_xcomponentprops.openMode;
242
+ }
240
243
  return findSchema(null == schema ? void 0 : schema.parent);
241
244
  };
242
245
  function AfterSuccess() {
@@ -431,7 +431,8 @@ AssociationSelect.Designer = function() {
431
431
  'x-component-props': {
432
432
  style: {
433
433
  width: 260
434
- }
434
+ },
435
+ optionLabelProp: 'fullLabel'
435
436
  }
436
437
  },
437
438
  direction: {
@@ -814,7 +815,8 @@ AssociationSelect.FilterDesigner = function() {
814
815
  'x-component-props': {
815
816
  style: {
816
817
  width: 260
817
- }
818
+ },
819
+ optionLabelProp: 'fullLabel'
818
820
  }
819
821
  },
820
822
  direction: {
@@ -100,12 +100,17 @@ const InternalRadioGroup = (0, schema_namespaceObject.connect)((props)=>{
100
100
  });
101
101
  }, (0, schema_namespaceObject.mapReadPretty)(ReadPretty));
102
102
  const Checkbox = (props)=>{
103
- if ('Radio group' === props.mode) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InternalRadioGroup, {
104
- ...props
105
- });
106
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InternalCheckbox, {
107
- ...props
108
- });
103
+ switch(props.mode){
104
+ case 'Radio group':
105
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InternalRadioGroup, {
106
+ ...props
107
+ });
108
+ case 'Checkbox':
109
+ default:
110
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InternalCheckbox, {
111
+ ...props
112
+ });
113
+ }
109
114
  };
110
115
  Checkbox.ReadPretty = ReadPretty;
111
116
  Checkbox.__ANT_CHECKBOX = true;
@@ -88,6 +88,10 @@ DatePicker.RangePicker = function(props) {
88
88
  external_dayjs_default()(originValue[1].value).add(-1, 'd').toISOString()
89
89
  ];
90
90
  props.onChange = (value)=>{
91
+ if (!value || !value.length) {
92
+ originOnChange(null);
93
+ return;
94
+ }
91
95
  originOnChange([
92
96
  {
93
97
  value: external_dayjs_default()(value[0]).toISOString(),
@@ -42,10 +42,12 @@ __webpack_require__.d(__webpack_exports__, {
42
42
  useIsAddNewForm: ()=>useIsAddNewForm,
43
43
  useIsFileField: ()=>useIsFileField,
44
44
  useIsFieldReadPretty: ()=>useIsFieldReadPretty,
45
+ useIsMuiltipleAble: ()=>useIsMuiltipleAble,
46
+ useIsMultipleSelect: ()=>useIsMultipleSelect,
45
47
  useIsSelectFieldMode: ()=>useIsSelectFieldMode,
48
+ formItemSettings: ()=>formItemSettings,
46
49
  useTitleFieldOptions: ()=>useTitleFieldOptions,
47
50
  useValidateSchema: ()=>useValidateSchema,
48
- formItemSettings: ()=>formItemSettings,
49
51
  useIsAssociationField: ()=>useIsAssociationField,
50
52
  useIsFormReadPretty: ()=>useIsFormReadPretty,
51
53
  useFieldMode: ()=>useFieldMode
@@ -1202,6 +1204,19 @@ function useIsAssociationField() {
1202
1204
  ].includes(null == collectionField ? void 0 : collectionField.interface);
1203
1205
  return isAssociationField;
1204
1206
  }
1207
+ function useIsMultipleSelect() {
1208
+ const collectionField = useFormItemCollectionField();
1209
+ const isMultipleSelect = [
1210
+ 'select',
1211
+ 'radioGroup'
1212
+ ].includes(null == collectionField ? void 0 : collectionField.interface);
1213
+ return isMultipleSelect;
1214
+ }
1215
+ function useIsMuiltipleAble() {
1216
+ const isAssociationField = useIsAssociationField();
1217
+ const isMultipleSelect = useIsMultipleSelect();
1218
+ return isAssociationField || isMultipleSelect;
1219
+ }
1205
1220
  function useIsFileField() {
1206
1221
  const { getCollection } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
1207
1222
  const collectionField = useFormItemCollectionField();
@@ -251,7 +251,8 @@ const formDetailsSettings = new index_js_namespaceObject.SchemaSettings({
251
251
  'x-component-props': {
252
252
  style: {
253
253
  width: 260
254
- }
254
+ },
255
+ optionLabelProp: 'fullLabel'
255
256
  }
256
257
  },
257
258
  direction: {
@@ -201,7 +201,8 @@ const GridCardDesigner = ()=>{
201
201
  'x-component-props': {
202
202
  style: {
203
203
  width: 260
204
- }
204
+ },
205
+ optionLabelProp: 'fullLabel'
205
206
  }
206
207
  },
207
208
  direction: {
@@ -136,7 +136,8 @@ const ListDesigner = ()=>{
136
136
  'x-component-props': {
137
137
  style: {
138
138
  width: 260
139
- }
139
+ },
140
+ optionLabelProp: 'fullLabel'
140
141
  }
141
142
  },
142
143
  direction: {
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = function(exports1, definition) {
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = function(obj, prop) {
13
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.r = function(exports1) {
18
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
+ value: 'Module'
20
+ });
21
+ Object.defineProperty(exports1, '__esModule', {
22
+ value: true
23
+ });
24
+ };
25
+ })();
26
+ var __webpack_exports__ = {};
27
+ __webpack_require__.r(__webpack_exports__);
28
+ __webpack_require__.d(__webpack_exports__, {
29
+ AdminMenu: ()=>AdminMenu
30
+ });
31
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
+ const schema_namespaceObject = require("@tachybase/schema");
33
+ const external_antd_namespaceObject = require("antd");
34
+ const external_react_i18next_namespaceObject = require("react-i18next");
35
+ const external_index_js_namespaceObject = require("../../index.js");
36
+ const external_index_js_namespaceObject_1 = require("../../../index.js");
37
+ const DragHandleMenu_js_namespaceObject = require("../../common/sortable-item/DragHandleMenu.js");
38
+ const external_AdminMenu_style_js_namespaceObject = require("./AdminMenu.style.js");
39
+ const AdminMenu = (props)=>{
40
+ const { items, onClick } = props;
41
+ const { styles } = (0, external_AdminMenu_style_js_namespaceObject.useStyles)();
42
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Card, {
43
+ className: styles.adminMenuStyle,
44
+ children: null == items ? void 0 : items.map((item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AdminMenuCard, {
45
+ item: item,
46
+ onClick: onClick
47
+ }, item.key))
48
+ });
49
+ };
50
+ const AdminMenuCard = (props)=>{
51
+ const { item, onClick } = props;
52
+ const { icon, field, Designer, schema } = (null == item ? void 0 : item.menu) || {};
53
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
54
+ const { styles } = (0, external_AdminMenu_style_js_namespaceObject.useStyles)();
55
+ const handleClick = ()=>onClick(item);
56
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Card.Grid, {
57
+ className: styles.adminMenuCardStyle,
58
+ onClick: handleClick,
59
+ children: item.menu ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.SchemaContext.Provider, {
60
+ value: schema,
61
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
62
+ value: field,
63
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.SortableItem, {
64
+ className: "card-wrapper",
65
+ role: "button",
66
+ "aria-label": t(field.title),
67
+ removeParentsIfNoChildren: false,
68
+ overStyle: {
69
+ background: 'transparent'
70
+ },
71
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(DragHandleMenu_js_namespaceObject.DragHandleMenu, {
72
+ className: "drag-handle-menu",
73
+ isAdminMenu: true,
74
+ children: [
75
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
76
+ className: "field-link",
77
+ role: "button",
78
+ "aria-label": t(field.title),
79
+ title: t(field.title),
80
+ children: [
81
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
82
+ className: "icon-wrapper",
83
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_1.Icon, {
84
+ type: null != icon ? icon : 'QuestionCircleOutlined'
85
+ })
86
+ }),
87
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
88
+ className: "field-title",
89
+ children: t(field.title)
90
+ })
91
+ ]
92
+ }),
93
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Designer, {
94
+ isAdminMenu: true
95
+ })
96
+ ]
97
+ })
98
+ })
99
+ })
100
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
101
+ children: item.label
102
+ })
103
+ });
104
+ };
105
+ var __webpack_export_target__ = exports;
106
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
107
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
108
+ value: true
109
+ });
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = function(exports1, definition) {
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = function(obj, prop) {
13
+ return Object.prototype.hasOwnProperty.call(obj, prop);
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.r = function(exports1) {
18
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
+ value: 'Module'
20
+ });
21
+ Object.defineProperty(exports1, '__esModule', {
22
+ value: true
23
+ });
24
+ };
25
+ })();
26
+ var __webpack_exports__ = {};
27
+ __webpack_require__.r(__webpack_exports__);
28
+ __webpack_require__.d(__webpack_exports__, {
29
+ useStyles: ()=>useStyles
30
+ });
31
+ const external_antd_style_namespaceObject = require("antd-style");
32
+ function _tagged_template_literal(strings, raw) {
33
+ if (!raw) raw = strings.slice(0);
34
+ return Object.freeze(Object.defineProperties(strings, {
35
+ raw: {
36
+ value: Object.freeze(raw)
37
+ }
38
+ }));
39
+ }
40
+ function _templateObject() {
41
+ const data = _tagged_template_literal([
42
+ "\n border: none;\n border-radius: 8px 8px 8px 8px;\n background: #ffffff;\n box-shadow:\n 0px 4px 8px 0px rgba(0, 5, 26, 0.15),\n 0px 0px 8px 0px rgba(0, 5, 26, 0.05);\n\n .ant-card-body {\n display: grid;\n grid-template-columns: repeat(3, minmax(120px, 1fr));\n justify-items: center;\n gap: 10px;\n grid-row-gap: 10px;\n }\n\n .ant-card-body::before {\n display: none;\n }\n "
43
+ ]);
44
+ _templateObject = function() {
45
+ return data;
46
+ };
47
+ return data;
48
+ }
49
+ function _templateObject1() {
50
+ const data = _tagged_template_literal([
51
+ "\n &.ant-card-grid {\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 100%;\n padding: 12px;\n color: inherit;\n border-radius: 8px;\n border: none;\n box-shadow: none;\n\n &:focus,\n &:active {\n background-color: #f4f4f4;\n }\n &:hover {\n border-radius: 8px;\n background-color: #f4f4f4;\n box-shadow: none;\n cursor: pointer;\n }\n\n .card-wrapper {\n width: 100%;\n height: 100%;\n background-color: transparent;\n border: none;\n }\n\n .drag-handle-menu {\n width: 100%;\n height: 100%;\n border-radius: 8px;\n border: none;\n }\n\n .ant-btn-icon {\n font-size: 1.2rem;\n text-align: center;\n }\n }\n\n &.ant-card-grid .ant-btn {\n display: grid;\n place-items: center;\n align-items: end;\n\n width: 100%;\n border: none;\n box-shadow: none;\n }\n\n .field-link {\n display: grid;\n place-items: center;\n\n width: 100%;\n height: 100%;\n padding: 0;\n border: none;\n border-radius: 8px;\n background-color: transparent;\n box-shadow: none;\n\n color: inherit;\n }\n\n .icon-wrapper {\n font-size: 1.2rem;\n text-align: center;\n margin-bottom: 0.3rem;\n }\n\n .field-title {\n text-align: center;\n vertical-align: middle;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n font-size: ",
52
+ ";\n }\n\n .tb-sortable-designer {\n width: 100%;\n height: 5rem;\n }\n\n .general-schema-designer {\n position: absolute;\n left: 0;\n bottom: 0;\n\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n height: 45%;\n border-radius: 1px 1px 8px 8px;\n background: rgba(0, 0, 0, 0.5);\n visibility: hidden;\n }\n\n &.ant-card-grid:hover .general-schema-designer {\n visibility: visible;\n }\n\n .general-schema-designer .anticon-menu {\n padding: 1px;\n border-radius: 2px;\n background-color: #ffffff;\n color: #2f2f2f;\n }\n "
53
+ ]);
54
+ _templateObject1 = function() {
55
+ return data;
56
+ };
57
+ return data;
58
+ }
59
+ const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
60
+ let { css, token } = param;
61
+ return {
62
+ adminMenuStyle: css(_templateObject()),
63
+ adminMenuCardStyle: css(_templateObject1(), token.fontSizeSM)
64
+ };
65
+ });
66
+ var __webpack_export_target__ = exports;
67
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
68
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
69
+ value: true
70
+ });
@@ -26,10 +26,10 @@ var __webpack_require__ = {};
26
26
  var __webpack_exports__ = {};
27
27
  __webpack_require__.r(__webpack_exports__);
28
28
  __webpack_require__.d(__webpack_exports__, {
29
+ InsertMenuItemsGroup: ()=>InsertMenuItemsGroup,
29
30
  MenuDesigner: ()=>MenuDesigner
30
31
  });
31
32
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
- require("react");
33
33
  const components_namespaceObject = require("@tachybase/components");
34
34
  const schema_namespaceObject = require("@tachybase/schema");
35
35
  const external_antd_namespaceObject = require("antd");
@@ -62,14 +62,10 @@ const findMenuSchema = (fieldSchema)=>{
62
62
  parent = parent.parent;
63
63
  }
64
64
  };
65
- const InsertMenuItems = (props)=>{
66
- const { eventKey, title, insertPosition } = props;
65
+ const InsertMenuItemsGroup = (props)=>{
67
66
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
68
- const { dn } = (0, external_index_js_namespaceObject_3.useDesignable)();
69
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
70
- const isSubMenu = 'Menu.SubMenu' === fieldSchema['x-component'];
67
+ const designable = (0, external_index_js_namespaceObject_3.useDesignable)();
71
68
  const api = (0, external_index_js_namespaceObject_3.useAPIClient)();
72
- if (!isSubMenu && 'beforeEnd' === insertPosition) return null;
73
69
  const serverHooks = [
74
70
  {
75
71
  type: 'onSelfCreate',
@@ -80,23 +76,26 @@ const InsertMenuItems = (props)=>{
80
76
  method: 'extractTextToLocale'
81
77
  }
82
78
  ];
83
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.SchemaSettingsSubMenu, {
84
- eventKey: eventKey,
85
- title: title,
79
+ const insertPosition = 'beforeEnd';
80
+ const dn = props.dn || designable.dn;
81
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.SchemaSettingsItemGroup, {
86
82
  children: [
87
83
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
88
84
  eventKey: "".concat(insertPosition, "group"),
89
- title: t('Submenu'),
85
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
86
+ type: 'FolderAddOutlined'
87
+ }),
88
+ title: t('Create group'),
90
89
  schema: {
91
90
  type: 'object',
92
- title: t('Add group'),
91
+ title: t('Create group'),
93
92
  properties: {
94
93
  title: {
95
94
  'x-decorator': 'FormItem',
96
95
  'x-component': 'Input',
96
+ 'x-component-props': {},
97
97
  title: t('Menu item title'),
98
- required: true,
99
- 'x-component-props': {}
98
+ required: true
100
99
  },
101
100
  icon: {
102
101
  title: t('Icon'),
@@ -121,10 +120,13 @@ const InsertMenuItems = (props)=>{
121
120
  }),
122
121
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
123
122
  eventKey: "".concat(insertPosition, "page"),
124
- title: t('Page'),
123
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
124
+ type: 'FileOutlined'
125
+ }),
126
+ title: t('Create page'),
125
127
  schema: {
126
128
  type: 'object',
127
- title: t('Add page'),
129
+ title: t('Create page'),
128
130
  properties: {
129
131
  title: {
130
132
  'x-decorator': 'FormItem',
@@ -171,10 +173,13 @@ const InsertMenuItems = (props)=>{
171
173
  }),
172
174
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
173
175
  eventKey: "".concat(insertPosition, "link"),
174
- title: t('Link'),
176
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
177
+ type: 'GlobalOutlined'
178
+ }),
179
+ title: t('Create link'),
175
180
  schema: {
176
181
  type: 'object',
177
- title: t('Add link'),
182
+ title: t('Create link'),
178
183
  properties: {
179
184
  title: {
180
185
  title: t('Menu item title'),
@@ -212,10 +217,13 @@ const InsertMenuItems = (props)=>{
212
217
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsDivider, {}),
213
218
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
214
219
  eventKey: "".concat(insertPosition, "restore"),
215
- title: t('Load'),
220
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
221
+ type: 'UploadOutlined'
222
+ }),
223
+ title: t('Load menu config'),
216
224
  schema: {
217
225
  type: 'object',
218
- title: t('Load'),
226
+ title: t('Load menu config'),
219
227
  properties: {
220
228
  title: {
221
229
  'x-decorator': 'FormItem',
@@ -224,6 +232,13 @@ const InsertMenuItems = (props)=>{
224
232
  required: true,
225
233
  'x-component-props': {}
226
234
  },
235
+ bindMenuToRole: {
236
+ type: 'boolean',
237
+ title: '{{ t("Automatically assign permissions to all matching roles") }}',
238
+ 'x-decorator': 'FormItem',
239
+ 'x-component': 'Checkbox',
240
+ default: true
241
+ },
227
242
  file: {
228
243
  type: 'object',
229
244
  title: '{{ t("File") }}',
@@ -238,12 +253,19 @@ const InsertMenuItems = (props)=>{
238
253
  }
239
254
  },
240
255
  onSubmit: async (param)=>{
241
- let { title, file } = param;
256
+ let { title, file, bindMenuToRole } = param;
242
257
  const { data } = await api.request({
243
258
  url: file.url,
244
259
  baseURL: '/'
245
260
  });
246
261
  const s = null != data ? data : {};
262
+ if (bindMenuToRole) {
263
+ const hooks = data['x-server-hooks'];
264
+ if (!hooks.some((v)=>'onSelfCreate' === v.type && 'bindMenuToRole' === v.method)) hooks.push({
265
+ type: 'onSelfCreate',
266
+ method: 'bindMenuToRole'
267
+ });
268
+ }
247
269
  s.title = title;
248
270
  dn.insertAdjacent(insertPosition, s);
249
271
  }
@@ -251,7 +273,8 @@ const InsertMenuItems = (props)=>{
251
273
  ]
252
274
  });
253
275
  };
254
- const MenuDesigner = ()=>{
276
+ const MenuDesigner = (props)=>{
277
+ const { isAdminMenu } = props;
255
278
  const field = (0, schema_namespaceObject.useField)();
256
279
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
257
280
  const api = (0, external_index_js_namespaceObject_3.useAPIClient)();
@@ -304,8 +327,8 @@ const MenuDesigner = ()=>{
304
327
  },
305
328
  icon: {
306
329
  title: t('Menu item icon'),
307
- 'x-component': 'IconPicker',
308
- 'x-decorator': 'FormItem'
330
+ 'x-decorator': 'FormItem',
331
+ 'x-component': 'IconPicker'
309
332
  }
310
333
  }
311
334
  };
@@ -313,6 +336,8 @@ const MenuDesigner = ()=>{
313
336
  title: field.title,
314
337
  icon: field.componentProps.icon
315
338
  };
339
+ const isSubMenu = 'Menu.SubMenu' === fieldSchema['x-component'];
340
+ const hiddenAddMenu = isAdminMenu || !isSubMenu;
316
341
  if ('Menu.URL' === fieldSchema['x-component']) {
317
342
  schema.properties['href'] = {
318
343
  title: t('Link'),
@@ -322,10 +347,15 @@ const MenuDesigner = ()=>{
322
347
  initialValues['href'] = field.componentProps.href;
323
348
  }
324
349
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.GeneralSchemaDesigner, {
350
+ draggable: false,
351
+ AddMenuModalComponent: !hiddenAddMenu && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertMenuItemsGroup, {}),
325
352
  children: [
326
353
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
327
- title: t('Edit'),
354
+ title: t('Modify the name and icon'),
328
355
  eventKey: "edit",
356
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
357
+ type: 'FormOutlined'
358
+ }),
329
359
  schema: schema,
330
360
  initialValues: initialValues,
331
361
  onSubmit: (param)=>{
@@ -366,6 +396,9 @@ const MenuDesigner = ()=>{
366
396
  TreeSelect: components_namespaceObject.TreeSelect
367
397
  },
368
398
  effects: effects,
399
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
400
+ type: 'DragOutlined'
401
+ }),
369
402
  schema: {
370
403
  type: 'object',
371
404
  title: t('Move to'),
@@ -414,24 +447,11 @@ const MenuDesigner = ()=>{
414
447
  }
415
448
  }),
416
449
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsDivider, {}),
417
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertMenuItems, {
418
- eventKey: 'insertbeforeBegin',
419
- title: t('Insert before'),
420
- insertPosition: 'beforeBegin'
421
- }),
422
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertMenuItems, {
423
- eventKey: 'insertafterEnd',
424
- title: t('Insert after'),
425
- insertPosition: 'afterEnd'
426
- }),
427
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertMenuItems, {
428
- eventKey: 'insertbeforeEnd',
429
- title: t('Insert inner'),
430
- insertPosition: 'beforeEnd'
431
- }),
432
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsDivider, {}),
433
450
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsItem, {
434
451
  title: t('Dump'),
452
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
453
+ type: 'DownloadOutlined'
454
+ }),
435
455
  onClick: async ()=>{
436
456
  const deleteUid = (s)=>{
437
457
  delete s['name'];
@@ -455,6 +475,7 @@ const MenuDesigner = ()=>{
455
475
  }
456
476
  }),
457
477
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsRemove, {
478
+ icon: "DeleteOutlined",
458
479
  confirm: {
459
480
  title: t('Delete menu item')
460
481
  }