@tachybase/client 0.23.22 → 0.23.35

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 (187) hide show
  1. package/es/application/schema-initializer/components/SchemaInitializerChildren.mjs +1 -1
  2. package/es/built-in/admin-layout/InternalAdminLayout.mjs +4 -2
  3. package/es/built-in/admin-layout/MenuEditor.mjs +2 -2
  4. package/es/built-in/admin-layout/style.d.ts +1 -1
  5. package/es/built-in/admin-layout/style.mjs +4 -4
  6. package/es/built-in/assistant/Assistant.provider.d.ts +0 -6
  7. package/es/built-in/assistant/Assistant.provider.mjs +15 -112
  8. package/es/built-in/assistant/index.d.ts +0 -1
  9. package/es/built-in/assistant/index.mjs +0 -7
  10. package/es/built-in/attachment-preview/previewers/file-pdf.mjs +4 -2
  11. package/es/built-in/context-menu/ContextMenu.provider.d.ts +1 -0
  12. package/es/built-in/context-menu/ContextMenu.provider.mjs +29 -1
  13. package/es/built-in/context-menu/index.mjs +1 -0
  14. package/es/built-in/index.mjs +44 -5
  15. package/es/built-in/page-style/TabHeader.d.ts +1 -1
  16. package/es/built-in/page-style/TabHeader.mjs +26 -33
  17. package/es/built-in/page-style/TabHeader.style.d.ts +4 -0
  18. package/es/built-in/page-style/TabHeader.style.mjs +35 -0
  19. package/es/built-in/pinned-list/PinnedPluginListProvider.d.ts +3 -1
  20. package/es/built-in/pinned-list/PinnedPluginListProvider.mjs +5 -4
  21. package/es/built-in/scroll-assistant/useJoystick.mjs +3 -1
  22. package/es/built-in/setting-layout/SettingLayout.mjs +10 -1
  23. package/es/built-in/{assistant/calculator → setting-layout}/style.d.ts +1 -1
  24. package/es/built-in/setting-layout/style.mjs +25 -0
  25. package/es/collection-manager/action-hooks.d.ts +1 -4
  26. package/es/collection-manager/action-hooks.mjs +39 -11
  27. package/es/icon/preloaded.mjs +4 -4
  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 +71 -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 +1 -1
  68. package/es/schema-component/antd/menu/Menu.Designer.mjs +59 -40
  69. package/es/schema-component/antd/menu/Menu.mjs +108 -141
  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/MenuSearch.d.ts +5 -0
  73. package/es/schema-component/antd/menu/MenuSearch.mjs +32 -0
  74. package/es/schema-component/antd/menu/tools.d.ts +9 -0
  75. package/es/schema-component/antd/menu/tools.mjs +36 -0
  76. package/es/schema-component/antd/scroll-area/ScrollArea.mjs +0 -17
  77. package/es/schema-component/antd/select/Select.d.ts +3 -13
  78. package/es/schema-component/antd/select/Select.mjs +33 -2
  79. package/es/schema-component/antd/table/Table.Void.Designer.mjs +2 -1
  80. package/es/schema-component/antd/table-v2/TableBlockDesigner.mjs +2 -1
  81. package/es/schema-component/antd/table-v2/TableSelectorDesigner.mjs +2 -1
  82. package/es/schema-component/common/dnd-context/index.d.ts +1 -2
  83. package/es/schema-component/common/sortable-item/DragHandleMenu.d.ts +1 -0
  84. package/es/schema-component/common/sortable-item/DragHandleMenu.mjs +78 -0
  85. package/es/schema-component/common/sortable-item/DragHandleMenu.style.d.ts +3 -0
  86. package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +25 -0
  87. package/es/schema-initializer/SchemaInitializerPlugin.mjs +5 -2
  88. package/es/schema-initializer/utils.mjs +9 -7
  89. package/es/schema-settings/GeneralSchemaDesigner.d.ts +2 -1
  90. package/es/schema-settings/GeneralSchemaDesigner.mjs +9 -1
  91. package/es/schema-settings/SchemaSettings.d.ts +3 -1
  92. package/es/schema-settings/SchemaSettings.mjs +16 -4
  93. package/es/schema-settings/SchemaSettingsPlugin.mjs +2 -0
  94. package/es/schema-settings/SchemaSettingsSortingRule.mjs +2 -1
  95. package/es/schema-settings/styles.mjs +2 -2
  96. package/lib/application/schema-initializer/components/SchemaInitializerChildren.js +1 -1
  97. package/lib/built-in/admin-layout/InternalAdminLayout.js +4 -2
  98. package/lib/built-in/admin-layout/MenuEditor.js +2 -2
  99. package/lib/built-in/admin-layout/style.js +4 -4
  100. package/lib/built-in/assistant/Assistant.provider.js +16 -115
  101. package/lib/built-in/assistant/index.js +3 -16
  102. package/lib/built-in/attachment-preview/previewers/file-pdf.js +4 -2
  103. package/lib/built-in/context-menu/ContextMenu.provider.js +29 -0
  104. package/lib/built-in/context-menu/index.js +1 -0
  105. package/lib/built-in/index.js +44 -5
  106. package/lib/built-in/page-style/TabHeader.js +26 -33
  107. package/lib/built-in/page-style/TabHeader.style.js +69 -0
  108. package/lib/built-in/pinned-list/PinnedPluginListProvider.js +5 -4
  109. package/lib/built-in/scroll-assistant/useJoystick.js +17 -1
  110. package/lib/built-in/setting-layout/SettingLayout.js +10 -1
  111. package/lib/built-in/{assistant/calculator/CalculatorKey.js → setting-layout/style.js} +25 -11
  112. package/lib/collection-manager/action-hooks.js +39 -11
  113. package/lib/icon/preloaded.js +4 -4
  114. package/lib/locale/en_US.js +8 -0
  115. package/lib/locale/zh-CN.js +8 -0
  116. package/lib/modules/actions/associate/AssociateActionInitializer.js +105 -0
  117. package/lib/modules/actions/associate/AssociateActionProvider.js +116 -0
  118. package/lib/modules/actions/associate/AssociateActionSettings.js +91 -0
  119. package/lib/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.js +2 -1
  120. package/lib/modules/blocks/data-blocks/form/RecordFormBlockInitializer.js +21 -14
  121. package/lib/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.js +2 -1
  122. package/lib/modules/blocks/data-blocks/list/listBlockSettings.js +2 -1
  123. package/lib/modules/blocks/data-blocks/table/TableActionInitializers.js +15 -0
  124. package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +2 -1
  125. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +2 -2
  126. package/lib/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.js +2 -1
  127. package/lib/modules/fields/component/Cascader/cascaderComponentFieldSettings.js +2 -1
  128. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +4 -0
  129. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +16 -2
  130. package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +2 -1
  131. package/lib/modules/menu/GroupItem.js +5 -1
  132. package/lib/modules/menu/LinkMenuItem.js +7 -3
  133. package/lib/modules/menu/PageMenuItem.js +5 -1
  134. package/lib/modules/menu/UploadMenuItem.js +115 -0
  135. package/lib/modules/menu/menuItemInitializer.js +2 -23
  136. package/lib/schema-component/antd/action/Action.Designer.js +4 -1
  137. package/lib/schema-component/antd/association-select/AssociationSelect.js +4 -2
  138. package/lib/schema-component/antd/checkbox/Checkbox.js +11 -6
  139. package/lib/schema-component/antd/date-picker/DatePicker.js +4 -0
  140. package/lib/schema-component/antd/form-item/FormItem.Settings.js +16 -1
  141. package/lib/schema-component/antd/form-v2/Form.Settings.js +2 -1
  142. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +2 -1
  143. package/lib/schema-component/antd/list/List.Designer.js +2 -1
  144. package/lib/schema-component/antd/menu/AdminMenu.js +105 -0
  145. package/lib/schema-component/antd/menu/AdminMenu.style.js +70 -0
  146. package/lib/schema-component/antd/menu/Menu.Designer.js +59 -40
  147. package/lib/schema-component/antd/menu/Menu.js +108 -141
  148. package/lib/schema-component/antd/menu/Menu.styles.js +8 -20
  149. package/lib/schema-component/antd/menu/MenuSearch.js +80 -0
  150. package/lib/schema-component/antd/menu/tools.js +72 -0
  151. package/lib/schema-component/antd/scroll-area/ScrollArea.js +0 -17
  152. package/lib/schema-component/antd/select/Select.js +33 -2
  153. package/lib/schema-component/antd/table/Table.Void.Designer.js +2 -1
  154. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  155. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +2 -1
  156. package/lib/schema-component/common/sortable-item/DragHandleMenu.js +112 -0
  157. package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +59 -0
  158. package/lib/schema-initializer/SchemaInitializerPlugin.js +5 -2
  159. package/lib/schema-initializer/utils.js +9 -7
  160. package/lib/schema-settings/GeneralSchemaDesigner.js +9 -1
  161. package/lib/schema-settings/SchemaSettings.js +16 -4
  162. package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
  163. package/lib/schema-settings/SchemaSettingsSortingRule.js +2 -1
  164. package/lib/schema-settings/styles.js +2 -2
  165. package/package.json +8 -7
  166. package/es/built-in/assistant/calculator/AutoScalingText.d.ts +0 -3
  167. package/es/built-in/assistant/calculator/AutoScalingText.mjs +0 -33
  168. package/es/built-in/assistant/calculator/Calculator.d.ts +0 -2
  169. package/es/built-in/assistant/calculator/Calculator.mjs +0 -235
  170. package/es/built-in/assistant/calculator/CalculatorDisplay.d.ts +0 -4
  171. package/es/built-in/assistant/calculator/CalculatorDisplay.mjs +0 -21
  172. package/es/built-in/assistant/calculator/CalculatorKey.d.ts +0 -5
  173. package/es/built-in/assistant/calculator/CalculatorKey.mjs +0 -11
  174. package/es/built-in/assistant/calculator/CalculatorProvider.d.ts +0 -10
  175. package/es/built-in/assistant/calculator/CalculatorProvider.mjs +0 -29
  176. package/es/built-in/assistant/calculator/Draggable.d.ts +0 -8
  177. package/es/built-in/assistant/calculator/Draggable.mjs +0 -54
  178. package/es/built-in/assistant/calculator/style.mjs +0 -25
  179. package/es/built-in/assistant/search-and-jump/index.d.ts +0 -16
  180. package/es/built-in/assistant/search-and-jump/index.mjs +0 -59
  181. package/lib/built-in/assistant/calculator/AutoScalingText.js +0 -67
  182. package/lib/built-in/assistant/calculator/Calculator.js +0 -283
  183. package/lib/built-in/assistant/calculator/CalculatorDisplay.js +0 -55
  184. package/lib/built-in/assistant/calculator/CalculatorProvider.js +0 -65
  185. package/lib/built-in/assistant/calculator/Draggable.js +0 -102
  186. package/lib/built-in/assistant/calculator/style.js +0 -59
  187. package/lib/built-in/assistant/search-and-jump/index.js +0 -96
@@ -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,105 @@
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
+ role: "button",
65
+ "aria-label": t(field.title),
66
+ removeParentsIfNoChildren: false,
67
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(DragHandleMenu_js_namespaceObject.DragHandleMenu, {
68
+ className: "drag-handle-menu",
69
+ isAdminMenu: true,
70
+ children: [
71
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("a", {
72
+ className: "field-link",
73
+ role: "button",
74
+ "aria-label": t(field.title),
75
+ title: t(field.title),
76
+ children: [
77
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
78
+ className: "icon-wrapper",
79
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_1.Icon, {
80
+ type: null != icon ? icon : 'QuestionCircleOutlined'
81
+ })
82
+ }),
83
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
84
+ className: "field-title",
85
+ children: t(field.title)
86
+ })
87
+ ]
88
+ }),
89
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Designer, {
90
+ isAdminMenu: true
91
+ })
92
+ ]
93
+ })
94
+ })
95
+ })
96
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
97
+ children: item.label
98
+ })
99
+ });
100
+ };
101
+ var __webpack_export_target__ = exports;
102
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
103
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
104
+ value: true
105
+ });
@@ -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, 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: 5rem;\n color: inherit;\n border: 0;\n border-radius: 8px;\n box-shadow: none;\n\n &:hover {\n background-color: #f4f4f4;\n box-shadow: none;\n }\n }\n\n &.ant-card-grid .ant-btn {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n width: 100%;\n padding: 0;\n border: none;\n box-shadow: none;\n }\n\n .field-link {\n display: flex;\n flex-direction: column;\n justify-content: space-around;\n align-items: center;\n color: inherit;\n\n &:hover {\n color: inherit;\n }\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 .drag-handle-menu {\n width: 100%;\n height: 100%;\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
+ });
@@ -29,7 +29,6 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  MenuDesigner: ()=>MenuDesigner
30
30
  });
31
31
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
- require("react");
33
32
  const components_namespaceObject = require("@tachybase/components");
34
33
  const schema_namespaceObject = require("@tachybase/schema");
35
34
  const external_antd_namespaceObject = require("antd");
@@ -62,14 +61,10 @@ const findMenuSchema = (fieldSchema)=>{
62
61
  parent = parent.parent;
63
62
  }
64
63
  };
65
- const InsertMenuItems = (props)=>{
66
- const { eventKey, title, insertPosition } = props;
64
+ const InsertMenuItemsGroup = ()=>{
67
65
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
68
66
  const { dn } = (0, external_index_js_namespaceObject_3.useDesignable)();
69
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
70
- const isSubMenu = 'Menu.SubMenu' === fieldSchema['x-component'];
71
67
  const api = (0, external_index_js_namespaceObject_3.useAPIClient)();
72
- if (!isSubMenu && 'beforeEnd' === insertPosition) return null;
73
68
  const serverHooks = [
74
69
  {
75
70
  type: 'onSelfCreate',
@@ -80,23 +75,25 @@ const InsertMenuItems = (props)=>{
80
75
  method: 'extractTextToLocale'
81
76
  }
82
77
  ];
83
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.SchemaSettingsSubMenu, {
84
- eventKey: eventKey,
85
- title: title,
78
+ const insertPosition = 'beforeEnd';
79
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.SchemaSettingsItemGroup, {
86
80
  children: [
87
81
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
88
82
  eventKey: "".concat(insertPosition, "group"),
89
- title: t('Submenu'),
83
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
84
+ type: 'FolderAddOutlined'
85
+ }),
86
+ title: t('Create group'),
90
87
  schema: {
91
88
  type: 'object',
92
- title: t('Add group'),
89
+ title: t('Create group'),
93
90
  properties: {
94
91
  title: {
95
92
  'x-decorator': 'FormItem',
96
93
  'x-component': 'Input',
94
+ 'x-component-props': {},
97
95
  title: t('Menu item title'),
98
- required: true,
99
- 'x-component-props': {}
96
+ required: true
100
97
  },
101
98
  icon: {
102
99
  title: t('Icon'),
@@ -121,10 +118,13 @@ const InsertMenuItems = (props)=>{
121
118
  }),
122
119
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
123
120
  eventKey: "".concat(insertPosition, "page"),
124
- title: t('Page'),
121
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
122
+ type: 'FileOutlined'
123
+ }),
124
+ title: t('Create page'),
125
125
  schema: {
126
126
  type: 'object',
127
- title: t('Add page'),
127
+ title: t('Create page'),
128
128
  properties: {
129
129
  title: {
130
130
  'x-decorator': 'FormItem',
@@ -171,10 +171,13 @@ const InsertMenuItems = (props)=>{
171
171
  }),
172
172
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
173
173
  eventKey: "".concat(insertPosition, "link"),
174
- title: t('Link'),
174
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
175
+ type: 'GlobalOutlined'
176
+ }),
177
+ title: t('Create link'),
175
178
  schema: {
176
179
  type: 'object',
177
- title: t('Add link'),
180
+ title: t('Create link'),
178
181
  properties: {
179
182
  title: {
180
183
  title: t('Menu item title'),
@@ -212,10 +215,13 @@ const InsertMenuItems = (props)=>{
212
215
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsDivider, {}),
213
216
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
214
217
  eventKey: "".concat(insertPosition, "restore"),
215
- title: t('Load'),
218
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
219
+ type: 'UploadOutlined'
220
+ }),
221
+ title: t('Load menu config'),
216
222
  schema: {
217
223
  type: 'object',
218
- title: t('Load'),
224
+ title: t('Load menu config'),
219
225
  properties: {
220
226
  title: {
221
227
  'x-decorator': 'FormItem',
@@ -224,6 +230,13 @@ const InsertMenuItems = (props)=>{
224
230
  required: true,
225
231
  'x-component-props': {}
226
232
  },
233
+ bindMenuToRole: {
234
+ type: 'boolean',
235
+ title: '{{ t("Automatically assign permissions to all matching roles") }}',
236
+ 'x-decorator': 'FormItem',
237
+ 'x-component': 'Checkbox',
238
+ default: true
239
+ },
227
240
  file: {
228
241
  type: 'object',
229
242
  title: '{{ t("File") }}',
@@ -238,12 +251,19 @@ const InsertMenuItems = (props)=>{
238
251
  }
239
252
  },
240
253
  onSubmit: async (param)=>{
241
- let { title, file } = param;
254
+ let { title, file, bindMenuToRole } = param;
242
255
  const { data } = await api.request({
243
256
  url: file.url,
244
257
  baseURL: '/'
245
258
  });
246
259
  const s = null != data ? data : {};
260
+ if (bindMenuToRole) {
261
+ const hooks = data['x-server-hooks'];
262
+ if (!hooks.some((v)=>'onSelfCreate' === v.type && 'bindMenuToRole' === v.method)) hooks.push({
263
+ type: 'onSelfCreate',
264
+ method: 'bindMenuToRole'
265
+ });
266
+ }
247
267
  s.title = title;
248
268
  dn.insertAdjacent(insertPosition, s);
249
269
  }
@@ -251,7 +271,8 @@ const InsertMenuItems = (props)=>{
251
271
  ]
252
272
  });
253
273
  };
254
- const MenuDesigner = ()=>{
274
+ const MenuDesigner = (props)=>{
275
+ const { isAdminMenu } = props;
255
276
  const field = (0, schema_namespaceObject.useField)();
256
277
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
257
278
  const api = (0, external_index_js_namespaceObject_3.useAPIClient)();
@@ -304,8 +325,8 @@ const MenuDesigner = ()=>{
304
325
  },
305
326
  icon: {
306
327
  title: t('Menu item icon'),
307
- 'x-component': 'IconPicker',
308
- 'x-decorator': 'FormItem'
328
+ 'x-decorator': 'FormItem',
329
+ 'x-component': 'IconPicker'
309
330
  }
310
331
  }
311
332
  };
@@ -313,6 +334,8 @@ const MenuDesigner = ()=>{
313
334
  title: field.title,
314
335
  icon: field.componentProps.icon
315
336
  };
337
+ const isSubMenu = 'Menu.SubMenu' === fieldSchema['x-component'];
338
+ const hiddenAddMenu = isAdminMenu || !isSubMenu;
316
339
  if ('Menu.URL' === fieldSchema['x-component']) {
317
340
  schema.properties['href'] = {
318
341
  title: t('Link'),
@@ -322,10 +345,15 @@ const MenuDesigner = ()=>{
322
345
  initialValues['href'] = field.componentProps.href;
323
346
  }
324
347
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_index_js_namespaceObject_3.GeneralSchemaDesigner, {
348
+ draggable: false,
349
+ AddMenuModalComponent: !hiddenAddMenu && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsertMenuItemsGroup, {}),
325
350
  children: [
326
351
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsModalItem, {
327
- title: t('Edit'),
352
+ title: t('Modify the name and icon'),
328
353
  eventKey: "edit",
354
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
355
+ type: 'FormOutlined'
356
+ }),
329
357
  schema: schema,
330
358
  initialValues: initialValues,
331
359
  onSubmit: (param)=>{
@@ -366,6 +394,9 @@ const MenuDesigner = ()=>{
366
394
  TreeSelect: components_namespaceObject.TreeSelect
367
395
  },
368
396
  effects: effects,
397
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
398
+ type: 'DragOutlined'
399
+ }),
369
400
  schema: {
370
401
  type: 'object',
371
402
  title: t('Move to'),
@@ -414,24 +445,11 @@ const MenuDesigner = ()=>{
414
445
  }
415
446
  }),
416
447
  /*#__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
448
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsItem, {
434
449
  title: t('Dump'),
450
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.Icon, {
451
+ type: 'DownloadOutlined'
452
+ }),
435
453
  onClick: async ()=>{
436
454
  const deleteUid = (s)=>{
437
455
  delete s['name'];
@@ -455,6 +473,7 @@ const MenuDesigner = ()=>{
455
473
  }
456
474
  }),
457
475
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject_3.SchemaSettingsRemove, {
476
+ icon: "DeleteOutlined",
458
477
  confirm: {
459
478
  title: t('Delete menu item')
460
479
  }