@tachybase/client 0.23.48 → 1.0.6

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 (215) hide show
  1. package/es/api-client/APIClient.d.ts +5 -2
  2. package/es/api-client/APIClient.mjs +93 -49
  3. package/es/api-client/hooks/useRequest.d.ts +2 -0
  4. package/es/application/Application.d.ts +6 -0
  5. package/es/application/Application.mjs +19 -0
  6. package/es/application/CustomRouterContextProvider.d.ts +54 -0
  7. package/es/application/CustomRouterContextProvider.mjs +209 -0
  8. package/es/application/RouterManager.d.ts +8 -3
  9. package/es/application/RouterManager.mjs +48 -15
  10. package/es/application/hooks/index.d.ts +1 -0
  11. package/es/application/hooks/index.mjs +1 -0
  12. package/es/application/hooks/useGlobalVariable.d.ts +1 -0
  13. package/es/application/hooks/useGlobalVariable.mjs +18 -0
  14. package/es/application/schema-initializer/context/index.d.ts +1 -1
  15. package/es/application/schema-settings/hooks/index.d.ts +1 -1
  16. package/es/application/schema-settings/hooks/index.mjs +6 -8
  17. package/es/block-provider/hooks/index.d.ts +2 -0
  18. package/es/block-provider/hooks/index.mjs +29 -22
  19. package/es/built-in/context-menu/ContextMenu.provider.mjs +6 -6
  20. package/es/built-in/context-menu/ContextMenuItemsProps.d.ts +4 -4
  21. package/es/built-in/context-menu/ContextMenuItemsProps.mjs +6 -6
  22. package/es/built-in/context-menu/index.mjs +1 -1
  23. package/es/built-in/context-menu/useContextMenu.d.ts +2 -2
  24. package/es/built-in/index.mjs +8 -0
  25. package/es/built-in/locale/LocalePlugin.mjs +5 -1
  26. package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
  27. package/es/built-in/system-settings/SystemSettingsProvider.d.ts +2 -3
  28. package/es/built-in/system-settings/SystemSettingsProvider.mjs +4 -3
  29. package/es/built-in/system-settings/SystemSettingsShortcut.mjs +11 -8
  30. package/es/collection-manager/Configuration/AddCollectionAction.mjs +12 -2
  31. package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.d.ts +2 -0
  32. package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.mjs +255 -0
  33. package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.d.ts +89 -0
  34. package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.mjs +96 -0
  35. package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.d.ts +3 -0
  36. package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.mjs +47 -0
  37. package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.d.ts +3 -0
  38. package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.mjs +44 -0
  39. package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.d.ts +1 -0
  40. package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +380 -0
  41. package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.d.ts +8 -0
  42. package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.mjs +4 -0
  43. package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.d.ts +1 -0
  44. package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.mjs +187 -0
  45. package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.d.ts +1 -0
  46. package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.mjs +30 -0
  47. package/es/collection-manager/collectionPlugin.mjs +3 -1
  48. package/es/collection-manager/templates/import.mjs +1 -1
  49. package/es/collection-manager/templates/sql.d.ts +1 -1
  50. package/es/collection-manager/templates/view.d.ts +1 -1
  51. package/es/collection-manager/templates/xlsx.d.ts +11 -0
  52. package/es/collection-manager/templates/xlsx.mjs +19 -0
  53. package/es/data-source/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
  54. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +18 -0
  55. package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.d.ts +8 -1
  56. package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.mjs +20 -0
  57. package/es/data-source/commonsSettingsItem/fieldComponent.mjs +3 -1
  58. package/es/data-source/data-source/DataSource.d.ts +1 -1
  59. package/es/filter-provider/utils.mjs +6 -0
  60. package/es/i18n/i18n.mjs +7 -12
  61. package/es/modules/actions/delete/deleteActionSettings.mjs +10 -0
  62. package/es/modules/blocks/data-blocks/form/FilterItemCustomSettings.mjs +1 -1
  63. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +9 -4
  64. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +6 -4
  65. package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +4 -0
  66. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +44 -0
  67. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +4 -0
  68. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +9 -0
  69. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
  70. package/es/modules/fields/component/SubTable/secondLevelSelect.d.ts +11 -0
  71. package/es/modules/fields/component/SubTable/secondLevelSelect.mjs +102 -0
  72. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +79 -41
  73. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +103 -100
  74. package/es/powered-by/index.mjs +4 -7
  75. package/es/schema-component/antd/action/Action.Designer.mjs +43 -5
  76. package/es/schema-component/antd/action/Action.Modal.mjs +19 -31
  77. package/es/schema-component/antd/action/Action.Modal.style.d.ts +4 -0
  78. package/es/schema-component/antd/action/Action.Modal.style.mjs +35 -0
  79. package/es/schema-component/antd/action/Action.mjs +1 -3
  80. package/es/schema-component/antd/action/utils.d.ts +1 -1
  81. package/es/schema-component/antd/action/utils.mjs +70 -70
  82. package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
  83. package/es/schema-component/antd/checkbox/Checkbox.mjs +9 -2
  84. package/es/schema-component/antd/index.d.ts +1 -0
  85. package/es/schema-component/antd/index.mjs +1 -0
  86. package/es/schema-component/antd/media-card/MediaCard.d.ts +11 -0
  87. package/es/schema-component/antd/media-card/MediaCard.mjs +35 -0
  88. package/es/schema-component/antd/media-card/index.d.ts +1 -0
  89. package/es/schema-component/antd/media-card/index.mjs +1 -0
  90. package/es/schema-component/antd/media-card/style.d.ts +3 -0
  91. package/es/schema-component/antd/media-card/style.mjs +25 -0
  92. package/es/schema-component/antd/page/Page.d.ts +1 -5
  93. package/es/schema-component/antd/page/Page.mjs +235 -144
  94. package/es/schema-component/antd/page/Page.style.d.ts +5 -0
  95. package/es/schema-component/antd/page/Page.style.mjs +45 -0
  96. package/es/schema-component/antd/page/PageDesigner.d.ts +3 -0
  97. package/es/schema-component/antd/page/PageDesigner.mjs +28 -0
  98. package/es/schema-component/antd/page/PageTabDesigner.d.ts +0 -3
  99. package/es/schema-component/antd/page/PageTabDesigner.mjs +3 -50
  100. package/es/schema-component/antd/page/style.d.ts +1 -1
  101. package/es/schema-component/antd/page/style.mjs +3 -13
  102. package/es/schema-component/antd/password/Password.d.ts +1 -1
  103. package/es/schema-component/antd/password/utils.d.ts +1 -1
  104. package/es/schema-component/antd/scroll-area/ScrollArea.d.ts +1 -1
  105. package/es/schema-component/antd/scroll-area/ScrollArea.mjs +2 -1
  106. package/es/schema-component/antd/variable/TextArea.mjs +1 -1
  107. package/es/schema-component/antd/variable/TextAreaWithGlobalScope.d.ts +13 -0
  108. package/es/schema-component/antd/variable/TextAreaWithGlobalScope.mjs +59 -0
  109. package/es/schema-component/antd/variable/index.d.ts +1 -0
  110. package/es/schema-component/antd/variable/index.mjs +3 -0
  111. package/es/schema-component/common/dnd-context/index.mjs +1 -7
  112. package/es/schema-component/common/sortable-item/DragHandlePageTab.d.ts +1 -0
  113. package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +71 -0
  114. package/es/schema-component/common/sortable-item/DragHandlePageTab.style.d.ts +3 -0
  115. package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +25 -0
  116. package/es/schema-items/GeneralSettings.mjs +5 -0
  117. package/es/schema-settings/EditCustomDefaultValue.mjs +1 -1
  118. package/es/schema-settings/SchemaSettings.mjs +1 -1
  119. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +2 -0
  120. package/es/schema-settings/utils/createModalSettingsItem.d.ts +26 -0
  121. package/es/schema-settings/utils/createModalSettingsItem.mjs +46 -0
  122. package/es/schema-settings/utils/createSelectSettingsItem.d.ts +25 -0
  123. package/es/schema-settings/utils/createSelectSettingsItem.mjs +40 -0
  124. package/es/schema-settings/utils/createSwitchSettingsItem.d.ts +21 -0
  125. package/es/schema-settings/utils/createSwitchSettingsItem.mjs +38 -0
  126. package/es/schema-settings/utils/createTextSettingsItem.d.ts +9 -0
  127. package/es/schema-settings/utils/createTextSettingsItem.mjs +21 -0
  128. package/es/schema-settings/utils/index.d.ts +4 -0
  129. package/es/schema-settings/utils/index.mjs +4 -0
  130. package/es/schema-settings/utils/util.d.ts +12 -0
  131. package/es/schema-settings/utils/util.mjs +24 -0
  132. package/es/user/CurrentUserProvider.mjs +6 -3
  133. package/lib/api-client/APIClient.js +93 -49
  134. package/lib/application/Application.js +19 -0
  135. package/lib/application/CustomRouterContextProvider.js +276 -0
  136. package/lib/application/RouterManager.js +49 -15
  137. package/lib/application/hooks/index.js +9 -0
  138. package/lib/application/hooks/useGlobalVariable.js +52 -0
  139. package/lib/application/schema-initializer/hooks/index.js +2 -2
  140. package/lib/application/schema-settings/hooks/index.js +6 -8
  141. package/lib/block-provider/hooks/index.js +80 -59
  142. package/lib/built-in/context-menu/ContextMenu.provider.js +6 -6
  143. package/lib/built-in/context-menu/ContextMenuItemsProps.js +6 -6
  144. package/lib/built-in/context-menu/index.js +1 -1
  145. package/lib/built-in/index.js +8 -0
  146. package/lib/built-in/locale/LocalePlugin.js +5 -1
  147. package/lib/built-in/page-style/PageStyle.provider.js +2 -2
  148. package/lib/built-in/system-settings/SystemSettingsProvider.js +4 -3
  149. package/lib/built-in/system-settings/SystemSettingsShortcut.js +11 -8
  150. package/lib/collection-manager/Configuration/AddCollectionAction.js +12 -2
  151. package/lib/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.js +304 -0
  152. package/lib/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.js +130 -0
  153. package/lib/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.js +81 -0
  154. package/lib/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.js +78 -0
  155. package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +414 -0
  156. package/lib/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.js +53 -0
  157. package/lib/collection-manager/Configuration/ImportXlsx/xlsxImportAction.js +235 -0
  158. package/lib/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.js +64 -0
  159. package/lib/collection-manager/collectionPlugin.js +3 -1
  160. package/lib/collection-manager/templates/import.js +1 -1
  161. package/lib/collection-manager/templates/xlsx.js +53 -0
  162. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +18 -0
  163. package/lib/data-source/collection-field-interface/CollectionFieldInterfaceManager.js +20 -0
  164. package/lib/data-source/commonsSettingsItem/fieldComponent.js +3 -1
  165. package/lib/filter-provider/utils.js +6 -0
  166. package/lib/i18n/i18n.js +7 -12
  167. package/lib/locale/en_US.js +1 -0
  168. package/lib/locale/zh-CN.js +14 -2
  169. package/lib/modules/actions/delete/deleteActionSettings.js +10 -0
  170. package/lib/modules/blocks/data-blocks/form/FilterItemCustomSettings.js +1 -1
  171. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +9 -4
  172. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +6 -4
  173. package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +4 -0
  174. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +44 -0
  175. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +4 -0
  176. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +9 -0
  177. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
  178. package/lib/modules/fields/component/SubTable/secondLevelSelect.js +136 -0
  179. package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +104 -103
  180. package/lib/powered-by/index.js +4 -7
  181. package/lib/schema-component/antd/action/Action.Designer.js +43 -5
  182. package/lib/schema-component/antd/action/Action.Modal.js +19 -31
  183. package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
  184. package/lib/schema-component/antd/action/Action.js +1 -3
  185. package/lib/schema-component/antd/action/utils.js +70 -70
  186. package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
  187. package/lib/schema-component/antd/checkbox/Checkbox.js +9 -2
  188. package/lib/schema-component/antd/index.js +18 -4
  189. package/lib/schema-component/antd/media-card/MediaCard.js +69 -0
  190. package/lib/schema-component/antd/media-card/index.js +65 -0
  191. package/lib/schema-component/antd/media-card/style.js +59 -0
  192. package/lib/schema-component/antd/page/Page.js +235 -144
  193. package/lib/schema-component/antd/page/Page.style.js +79 -0
  194. package/lib/schema-component/antd/page/PageDesigner.js +62 -0
  195. package/lib/schema-component/antd/page/PageTabDesigner.js +2 -50
  196. package/lib/schema-component/antd/page/style.js +3 -13
  197. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -1
  198. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  199. package/lib/schema-component/antd/variable/TextAreaWithGlobalScope.js +94 -0
  200. package/lib/schema-component/antd/variable/index.js +13 -1
  201. package/lib/schema-component/common/dnd-context/index.js +1 -7
  202. package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +105 -0
  203. package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +59 -0
  204. package/lib/schema-items/GeneralSettings.js +5 -0
  205. package/lib/schema-settings/EditCustomDefaultValue.js +1 -1
  206. package/lib/schema-settings/SchemaSettings.js +1 -1
  207. package/lib/schema-settings/SchemaSettingsDefaultValue.js +2 -0
  208. package/lib/schema-settings/utils/createModalSettingsItem.js +94 -0
  209. package/lib/schema-settings/utils/createSelectSettingsItem.js +88 -0
  210. package/lib/schema-settings/utils/createSwitchSettingsItem.js +86 -0
  211. package/lib/schema-settings/utils/createTextSettingsItem.js +55 -0
  212. package/lib/schema-settings/utils/index.js +92 -0
  213. package/lib/schema-settings/utils/util.js +74 -0
  214. package/lib/user/CurrentUserProvider.js +6 -3
  215. package/package.json +7 -7
@@ -0,0 +1,414 @@
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
+ xlsxFieldsConfigure: ()=>xlsxFieldsConfigure
30
+ });
31
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
+ const external_react_namespaceObject = require("react");
33
+ const schema_namespaceObject = require("@tachybase/schema");
34
+ const external_antd_namespaceObject = require("antd");
35
+ const external_lodash_namespaceObject = require("lodash");
36
+ const external_react_i18next_namespaceObject = require("react-i18next");
37
+ const index_js_namespaceObject = require("../../../data-source/index.js");
38
+ const external_schema_component_index_js_namespaceObject = require("../../../schema-component/index.js");
39
+ const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
40
+ const external_interfaces_js_namespaceObject = require("../interfaces.js");
41
+ const external_xlsxFormValueContextProvider_js_namespaceObject = require("./xlsxFormValueContextProvider.js");
42
+ const external_xlsxImportAction_js_namespaceObject = require("./xlsxImportAction.js");
43
+ const xlsxFieldsConfigure = (0, schema_namespaceObject.observer)((props)=>{
44
+ const { filedata } = props;
45
+ const { fields, data } = filedata;
46
+ (0, index_js_namespaceObject.useDataSourceManager)();
47
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
48
+ const initOptions = (0, external_interfaces_js_namespaceObject.useFieldInterfaceOptions)();
49
+ const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
50
+ const [selectedTitleField, setSelectedTitleField] = (0, external_react_namespaceObject.useState)();
51
+ const form = (0, schema_namespaceObject.useForm)();
52
+ const [formValue, setFormValue] = (0, external_react_namespaceObject.useState)(fields);
53
+ const { getInterface } = (0, external_hooks_index_js_namespaceObject.useCollectionManager_deprecated)();
54
+ const getDefaultUiSchema = (interfaceType, title)=>{
55
+ var _interfaceConfigValues_default;
56
+ const interfaceConfig = getInterface(interfaceType) || {};
57
+ const interfaceConfigValues = (0, external_lodash_namespaceObject.cloneDeep)(interfaceConfig);
58
+ const defaultUiSchema = (null == interfaceConfigValues ? void 0 : null === (_interfaceConfigValues_default = interfaceConfigValues.default) || void 0 === _interfaceConfigValues_default ? void 0 : _interfaceConfigValues_default.uiSchema) || {};
59
+ return {
60
+ ...defaultUiSchema,
61
+ title
62
+ };
63
+ };
64
+ const handleFieldChange = (updatedField, index)=>{
65
+ const updatedFieldData = [
66
+ ...formValue
67
+ ];
68
+ updatedFieldData[index] = updatedField;
69
+ setFormValue(updatedFieldData);
70
+ };
71
+ const handleFieldTypeChange = async (updatedField, index)=>{
72
+ const { type, name: dataIndex, uiSchema } = updatedField;
73
+ const updatedData = [
74
+ ...data
75
+ ];
76
+ let hasError = false;
77
+ const typeToInterface = {
78
+ json: 'json',
79
+ boolean: 'checkbox',
80
+ string: 'input',
81
+ integer: 'integer',
82
+ float: 'number',
83
+ date: 'datetime'
84
+ };
85
+ updatedField.interface = await typeToInterface[type] || null;
86
+ const currentUiSchema = await getDefaultUiSchema(updatedField.interface, uiSchema.title);
87
+ updatedField.uiSchema = currentUiSchema;
88
+ updatedData.forEach((row, rowIndex)=>{
89
+ try {
90
+ if (void 0 !== row[dataIndex]) row[dataIndex] = parseValue(row[dataIndex], type);
91
+ } catch (error) {
92
+ hasError = true;
93
+ external_antd_namespaceObject.message.error("Row ".concat(rowIndex + 1, ", Column ").concat(uiSchema.title, ": ").concat(error.message));
94
+ }
95
+ });
96
+ if (!hasError) {
97
+ external_antd_namespaceObject.message.success("".concat(t('Fields'), ' "').concat(uiSchema.title, '"').concat(t('Converted to'), " ").concat(type));
98
+ const updatedFieldData = [
99
+ ...formValue
100
+ ];
101
+ updatedFieldData[index] = updatedField;
102
+ setFormValue(updatedFieldData);
103
+ }
104
+ };
105
+ const handleFieldInterfaceChange = async (updatedField, index)=>{
106
+ const currentUiSchema = await getDefaultUiSchema(updatedField.interface, updatedField.uiSchema.title);
107
+ updatedField.uiSchema = currentUiSchema;
108
+ const updatedFieldData = [
109
+ ...formValue
110
+ ];
111
+ updatedFieldData[index] = updatedField;
112
+ setFormValue(updatedFieldData);
113
+ };
114
+ const parseValue = (value, type)=>{
115
+ try {
116
+ switch(type){
117
+ case 'boolean':
118
+ if ('true' === value.toLowerCase()) return true;
119
+ if ('false' === value.toLowerCase()) return false;
120
+ throw new Error('Invalid boolean');
121
+ case 'integer':
122
+ if (!/^-?\d+$/.test(value)) throw new Error('Invalid integer');
123
+ return parseInt(value, 10);
124
+ case 'float':
125
+ if (!/^-?\d+(\.\d+)?$/.test(value)) throw new Error('Invalid number');
126
+ return Number(value);
127
+ case 'json':
128
+ return JSON.parse(value);
129
+ case 'date':
130
+ if (isNaN(Date.parse(value))) throw new Error('Invalid date');
131
+ return new Date(value);
132
+ default:
133
+ if (null == value || '' === value) return '';
134
+ return value.toString();
135
+ }
136
+ } catch (error) {
137
+ throw new Error("Type conversion error: ".concat(error.message));
138
+ }
139
+ };
140
+ const handleTitleChange = (checked, field)=>{
141
+ const newTitleField = checked ? field.name : null;
142
+ setSelectedTitleField(newTitleField);
143
+ form.setValuesIn('titleField', newTitleField);
144
+ };
145
+ const isTitleField = (field)=>{
146
+ var _getInterface;
147
+ return !field.isForeignKey && (null === (_getInterface = getInterface(field.interface)) || void 0 === _getInterface ? void 0 : _getInterface.titleUsable);
148
+ };
149
+ const getOptions = (type)=>{
150
+ const InterfaceOptions = getInterfaceOptions(initOptions, type);
151
+ const options = InterfaceOptions.map((group)=>({
152
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
153
+ children: compile(group.label)
154
+ }),
155
+ title: group.key,
156
+ options: group.children.map((item)=>({
157
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
158
+ children: compile(item.label)
159
+ }),
160
+ value: item.name
161
+ }))
162
+ }));
163
+ return options;
164
+ };
165
+ const getInterfaceOptions = (data, type)=>{
166
+ const interfaceOptions = [];
167
+ data.forEach((item)=>{
168
+ const options = item.children.filter((h)=>{
169
+ var _h_availableTypes;
170
+ return null == h ? void 0 : null === (_h_availableTypes = h.availableTypes) || void 0 === _h_availableTypes ? void 0 : _h_availableTypes.includes(type);
171
+ });
172
+ interfaceOptions.push({
173
+ label: item.label,
174
+ key: item.key,
175
+ children: options
176
+ });
177
+ });
178
+ return interfaceOptions.filter((v)=>{
179
+ if ('sort' === type) return 'advanced' === v.key;
180
+ return v.children.length > 0;
181
+ });
182
+ };
183
+ const columns = [
184
+ {
185
+ title: t('Field display name'),
186
+ dataIndex: 'title',
187
+ key: 'title',
188
+ render: (text, record, index)=>{
189
+ const field = formValue[index];
190
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input, {
191
+ value: field.uiSchema.title || text,
192
+ onChange: (e)=>handleFieldChange({
193
+ ...field,
194
+ uiSchema: {
195
+ title: e.target.value
196
+ }
197
+ }, index)
198
+ });
199
+ }
200
+ },
201
+ {
202
+ title: t('Field name'),
203
+ dataIndex: 'name',
204
+ key: 'name',
205
+ render: (text, record, index)=>{
206
+ const field = formValue[index];
207
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input, {
208
+ value: field.name || text,
209
+ variant: "borderless",
210
+ disabled: true
211
+ });
212
+ }
213
+ },
214
+ {
215
+ title: t('Field type'),
216
+ dataIndex: 'type',
217
+ key: 'type',
218
+ render: (text, record, index)=>{
219
+ const field = formValue[index];
220
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
221
+ value: field.type || text,
222
+ onChange: (e)=>handleFieldTypeChange({
223
+ ...field,
224
+ type: e
225
+ }, index),
226
+ options: [
227
+ {
228
+ value: 'string',
229
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
230
+ children: "string"
231
+ })
232
+ },
233
+ {
234
+ value: 'boolean',
235
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
236
+ children: "boolean"
237
+ })
238
+ },
239
+ {
240
+ value: 'integer',
241
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
242
+ children: "integer"
243
+ })
244
+ },
245
+ {
246
+ value: 'float',
247
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
248
+ children: "float"
249
+ })
250
+ },
251
+ {
252
+ value: 'json',
253
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
254
+ children: "json"
255
+ })
256
+ },
257
+ {
258
+ value: 'date',
259
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
260
+ children: "date"
261
+ })
262
+ }
263
+ ]
264
+ });
265
+ }
266
+ },
267
+ {
268
+ title: t('Field interface'),
269
+ dataIndex: 'interface',
270
+ key: 'interface',
271
+ render: (text, record, index)=>{
272
+ const field = formValue[index];
273
+ const options = getOptions(field.type);
274
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
275
+ "aria-label": "field-interface-".concat(null == field ? void 0 : field.type),
276
+ role: "button",
277
+ value: field.interface,
278
+ popupMatchSelectWidth: false,
279
+ onChange: (e)=>handleFieldInterfaceChange({
280
+ ...field,
281
+ interface: e
282
+ }, index),
283
+ options: options
284
+ });
285
+ }
286
+ },
287
+ {
288
+ dataIndex: 'titleField',
289
+ title: t('Title field'),
290
+ render: function(_, record, index) {
291
+ const field = formValue[index];
292
+ return isTitleField(field) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tooltip, {
293
+ title: t('Default title for each record'),
294
+ placement: "right",
295
+ overlayInnerStyle: {
296
+ textAlign: 'center'
297
+ },
298
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Switch, {
299
+ "aria-label": "switch-title-field-".concat(field.name),
300
+ size: "small",
301
+ checked: field.name === selectedTitleField,
302
+ onChange: (checked)=>handleTitleChange(checked, field)
303
+ })
304
+ }) : null;
305
+ }
306
+ },
307
+ {
308
+ title: t('Description'),
309
+ dataIndex: 'description',
310
+ key: 'description',
311
+ render: (text, record, index)=>{
312
+ const field = formValue[index];
313
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input.TextArea, {
314
+ value: field.description,
315
+ variant: "borderless",
316
+ disabled: true
317
+ });
318
+ }
319
+ },
320
+ {
321
+ title: t('Actions'),
322
+ dataIndex: 'actions',
323
+ key: 'actions',
324
+ render: (text, record, index)=>{
325
+ const field = formValue[index];
326
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Space, {
327
+ size: "middle",
328
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_xlsxImportAction_js_namespaceObject.XlsxEditFieldAction, {
329
+ record: {
330
+ index,
331
+ ...field
332
+ },
333
+ ...props
334
+ })
335
+ });
336
+ }
337
+ }
338
+ ];
339
+ const previewTablecolumns = formValue.map((field)=>({
340
+ title: field.uiSchema.title,
341
+ dataIndex: field.name,
342
+ key: field.name,
343
+ render: (text)=>{
344
+ if ('boolean' == typeof text) return text ? 'True' : 'False';
345
+ if ('date' === field.type && text) return new Date(text).toLocaleString();
346
+ if ('json' === field.type && text) try {
347
+ return 'string' == typeof text ? text : JSON.stringify(text, null, 2);
348
+ } catch (error) {
349
+ return 'Invalid JSON';
350
+ }
351
+ return text;
352
+ },
353
+ width: 200
354
+ }));
355
+ (0, external_react_namespaceObject.useEffect)(()=>{
356
+ form.setValuesIn('fields', formValue);
357
+ form.setValuesIn('collectionData', filedata.data);
358
+ console.log('%c Line:294 🍔 filedata.data', 'font-size:18px;color:#42b983;background:#3f7cff', filedata.data);
359
+ }, [
360
+ formValue
361
+ ]);
362
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_xlsxFormValueContextProvider_js_namespaceObject.xlsxFormValueContext.Provider, {
363
+ value: {
364
+ value: formValue,
365
+ setFormValue
366
+ },
367
+ children: [
368
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Table, {
369
+ bordered: true,
370
+ size: "small",
371
+ columns: columns,
372
+ dataSource: formValue,
373
+ scroll: {
374
+ y: 300
375
+ },
376
+ pagination: false,
377
+ rowClassName: "row",
378
+ rowKey: "uid",
379
+ style: {
380
+ marginBottom: '16px'
381
+ },
382
+ ...props
383
+ }),
384
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
385
+ style: {
386
+ fontWeight: 'bold',
387
+ marginBottom: '10px'
388
+ },
389
+ children: [
390
+ t('Preview'),
391
+ ":"
392
+ ]
393
+ }),
394
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Table, {
395
+ bordered: true,
396
+ size: "small",
397
+ columns: previewTablecolumns,
398
+ dataSource: filedata.data,
399
+ scroll: {
400
+ y: 300,
401
+ x: 'max-content'
402
+ },
403
+ rowKey: "name"
404
+ })
405
+ ]
406
+ });
407
+ }, {
408
+ displayName: 'FieldsConfigure'
409
+ });
410
+ var __webpack_export_target__ = exports;
411
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
412
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
413
+ value: true
414
+ });
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = function(module) {
5
+ var getter = module && module.__esModule ? function() {
6
+ return module['default'];
7
+ } : function() {
8
+ return module;
9
+ };
10
+ __webpack_require__.d(getter, {
11
+ a: getter
12
+ });
13
+ return getter;
14
+ };
15
+ })();
16
+ (()=>{
17
+ __webpack_require__.d = function(exports1, definition) {
18
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
19
+ enumerable: true,
20
+ get: definition[key]
21
+ });
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = function(obj, prop) {
26
+ return Object.prototype.hasOwnProperty.call(obj, prop);
27
+ };
28
+ })();
29
+ (()=>{
30
+ __webpack_require__.r = function(exports1) {
31
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
32
+ value: 'Module'
33
+ });
34
+ Object.defineProperty(exports1, '__esModule', {
35
+ value: true
36
+ });
37
+ };
38
+ })();
39
+ var __webpack_exports__ = {};
40
+ __webpack_require__.r(__webpack_exports__);
41
+ __webpack_require__.d(__webpack_exports__, {
42
+ useFormValueContext: ()=>useFormValueContext,
43
+ xlsxFormValueContext: ()=>xlsxFormValueContext
44
+ });
45
+ const external_react_namespaceObject = require("react");
46
+ var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
47
+ const xlsxFormValueContext = /*#__PURE__*/ external_react_default().createContext({});
48
+ const useFormValueContext = ()=>external_react_default().useContext(xlsxFormValueContext);
49
+ var __webpack_export_target__ = exports;
50
+ for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
51
+ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
52
+ value: true
53
+ });