@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.
- package/es/api-client/APIClient.d.ts +5 -2
- package/es/api-client/APIClient.mjs +93 -49
- package/es/api-client/hooks/useRequest.d.ts +2 -0
- package/es/application/Application.d.ts +6 -0
- package/es/application/Application.mjs +19 -0
- package/es/application/CustomRouterContextProvider.d.ts +54 -0
- package/es/application/CustomRouterContextProvider.mjs +209 -0
- package/es/application/RouterManager.d.ts +8 -3
- package/es/application/RouterManager.mjs +48 -15
- package/es/application/hooks/index.d.ts +1 -0
- package/es/application/hooks/index.mjs +1 -0
- package/es/application/hooks/useGlobalVariable.d.ts +1 -0
- package/es/application/hooks/useGlobalVariable.mjs +18 -0
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.mjs +6 -8
- package/es/block-provider/hooks/index.d.ts +2 -0
- package/es/block-provider/hooks/index.mjs +29 -22
- package/es/built-in/context-menu/ContextMenu.provider.mjs +6 -6
- package/es/built-in/context-menu/ContextMenuItemsProps.d.ts +4 -4
- package/es/built-in/context-menu/ContextMenuItemsProps.mjs +6 -6
- package/es/built-in/context-menu/index.mjs +1 -1
- package/es/built-in/context-menu/useContextMenu.d.ts +2 -2
- package/es/built-in/index.mjs +8 -0
- package/es/built-in/locale/LocalePlugin.mjs +5 -1
- package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
- package/es/built-in/system-settings/SystemSettingsProvider.d.ts +2 -3
- package/es/built-in/system-settings/SystemSettingsProvider.mjs +4 -3
- package/es/built-in/system-settings/SystemSettingsShortcut.mjs +11 -8
- package/es/collection-manager/Configuration/AddCollectionAction.mjs +12 -2
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.d.ts +2 -0
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.mjs +255 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.d.ts +89 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.mjs +96 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.mjs +47 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.mjs +44 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +380 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.d.ts +8 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.mjs +4 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.mjs +187 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.mjs +30 -0
- package/es/collection-manager/collectionPlugin.mjs +3 -1
- package/es/collection-manager/templates/import.mjs +1 -1
- package/es/collection-manager/templates/sql.d.ts +1 -1
- package/es/collection-manager/templates/view.d.ts +1 -1
- package/es/collection-manager/templates/xlsx.d.ts +11 -0
- package/es/collection-manager/templates/xlsx.mjs +19 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +18 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.d.ts +8 -1
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.mjs +20 -0
- package/es/data-source/commonsSettingsItem/fieldComponent.mjs +3 -1
- package/es/data-source/data-source/DataSource.d.ts +1 -1
- package/es/filter-provider/utils.mjs +6 -0
- package/es/i18n/i18n.mjs +7 -12
- package/es/modules/actions/delete/deleteActionSettings.mjs +10 -0
- package/es/modules/blocks/data-blocks/form/FilterItemCustomSettings.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +9 -4
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +6 -4
- package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +4 -0
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +44 -0
- package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +4 -0
- package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +9 -0
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
- package/es/modules/fields/component/SubTable/secondLevelSelect.d.ts +11 -0
- package/es/modules/fields/component/SubTable/secondLevelSelect.mjs +102 -0
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +79 -41
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +103 -100
- package/es/powered-by/index.mjs +4 -7
- package/es/schema-component/antd/action/Action.Designer.mjs +43 -5
- package/es/schema-component/antd/action/Action.Modal.mjs +19 -31
- package/es/schema-component/antd/action/Action.Modal.style.d.ts +4 -0
- package/es/schema-component/antd/action/Action.Modal.style.mjs +35 -0
- package/es/schema-component/antd/action/Action.mjs +1 -3
- package/es/schema-component/antd/action/utils.d.ts +1 -1
- package/es/schema-component/antd/action/utils.mjs +70 -70
- package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
- package/es/schema-component/antd/checkbox/Checkbox.mjs +9 -2
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.mjs +1 -0
- package/es/schema-component/antd/media-card/MediaCard.d.ts +11 -0
- package/es/schema-component/antd/media-card/MediaCard.mjs +35 -0
- package/es/schema-component/antd/media-card/index.d.ts +1 -0
- package/es/schema-component/antd/media-card/index.mjs +1 -0
- package/es/schema-component/antd/media-card/style.d.ts +3 -0
- package/es/schema-component/antd/media-card/style.mjs +25 -0
- package/es/schema-component/antd/page/Page.d.ts +1 -5
- package/es/schema-component/antd/page/Page.mjs +235 -144
- package/es/schema-component/antd/page/Page.style.d.ts +5 -0
- package/es/schema-component/antd/page/Page.style.mjs +45 -0
- package/es/schema-component/antd/page/PageDesigner.d.ts +3 -0
- package/es/schema-component/antd/page/PageDesigner.mjs +28 -0
- package/es/schema-component/antd/page/PageTabDesigner.d.ts +0 -3
- package/es/schema-component/antd/page/PageTabDesigner.mjs +3 -50
- package/es/schema-component/antd/page/style.d.ts +1 -1
- package/es/schema-component/antd/page/style.mjs +3 -13
- package/es/schema-component/antd/password/Password.d.ts +1 -1
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.mjs +2 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.d.ts +13 -0
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.mjs +59 -0
- package/es/schema-component/antd/variable/index.d.ts +1 -0
- package/es/schema-component/antd/variable/index.mjs +3 -0
- package/es/schema-component/common/dnd-context/index.mjs +1 -7
- package/es/schema-component/common/sortable-item/DragHandlePageTab.d.ts +1 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +71 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.d.ts +3 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +25 -0
- package/es/schema-items/GeneralSettings.mjs +5 -0
- package/es/schema-settings/EditCustomDefaultValue.mjs +1 -1
- package/es/schema-settings/SchemaSettings.mjs +1 -1
- package/es/schema-settings/SchemaSettingsDefaultValue.mjs +2 -0
- package/es/schema-settings/utils/createModalSettingsItem.d.ts +26 -0
- package/es/schema-settings/utils/createModalSettingsItem.mjs +46 -0
- package/es/schema-settings/utils/createSelectSettingsItem.d.ts +25 -0
- package/es/schema-settings/utils/createSelectSettingsItem.mjs +40 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.d.ts +21 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.mjs +38 -0
- package/es/schema-settings/utils/createTextSettingsItem.d.ts +9 -0
- package/es/schema-settings/utils/createTextSettingsItem.mjs +21 -0
- package/es/schema-settings/utils/index.d.ts +4 -0
- package/es/schema-settings/utils/index.mjs +4 -0
- package/es/schema-settings/utils/util.d.ts +12 -0
- package/es/schema-settings/utils/util.mjs +24 -0
- package/es/user/CurrentUserProvider.mjs +6 -3
- package/lib/api-client/APIClient.js +93 -49
- package/lib/application/Application.js +19 -0
- package/lib/application/CustomRouterContextProvider.js +276 -0
- package/lib/application/RouterManager.js +49 -15
- package/lib/application/hooks/index.js +9 -0
- package/lib/application/hooks/useGlobalVariable.js +52 -0
- package/lib/application/schema-initializer/hooks/index.js +2 -2
- package/lib/application/schema-settings/hooks/index.js +6 -8
- package/lib/block-provider/hooks/index.js +80 -59
- package/lib/built-in/context-menu/ContextMenu.provider.js +6 -6
- package/lib/built-in/context-menu/ContextMenuItemsProps.js +6 -6
- package/lib/built-in/context-menu/index.js +1 -1
- package/lib/built-in/index.js +8 -0
- package/lib/built-in/locale/LocalePlugin.js +5 -1
- package/lib/built-in/page-style/PageStyle.provider.js +2 -2
- package/lib/built-in/system-settings/SystemSettingsProvider.js +4 -3
- package/lib/built-in/system-settings/SystemSettingsShortcut.js +11 -8
- package/lib/collection-manager/Configuration/AddCollectionAction.js +12 -2
- package/lib/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.js +304 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.js +130 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.js +81 -0
- package/lib/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.js +78 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +414 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.js +53 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxImportAction.js +235 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.js +64 -0
- package/lib/collection-manager/collectionPlugin.js +3 -1
- package/lib/collection-manager/templates/import.js +1 -1
- package/lib/collection-manager/templates/xlsx.js +53 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +18 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterfaceManager.js +20 -0
- package/lib/data-source/commonsSettingsItem/fieldComponent.js +3 -1
- package/lib/filter-provider/utils.js +6 -0
- package/lib/i18n/i18n.js +7 -12
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/zh-CN.js +14 -2
- package/lib/modules/actions/delete/deleteActionSettings.js +10 -0
- package/lib/modules/blocks/data-blocks/form/FilterItemCustomSettings.js +1 -1
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +9 -4
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +6 -4
- package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +4 -0
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +44 -0
- package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +4 -0
- package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +9 -0
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
- package/lib/modules/fields/component/SubTable/secondLevelSelect.js +136 -0
- package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +104 -103
- package/lib/powered-by/index.js +4 -7
- package/lib/schema-component/antd/action/Action.Designer.js +43 -5
- package/lib/schema-component/antd/action/Action.Modal.js +19 -31
- package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
- package/lib/schema-component/antd/action/Action.js +1 -3
- package/lib/schema-component/antd/action/utils.js +70 -70
- package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
- package/lib/schema-component/antd/checkbox/Checkbox.js +9 -2
- package/lib/schema-component/antd/index.js +18 -4
- package/lib/schema-component/antd/media-card/MediaCard.js +69 -0
- package/lib/schema-component/antd/media-card/index.js +65 -0
- package/lib/schema-component/antd/media-card/style.js +59 -0
- package/lib/schema-component/antd/page/Page.js +235 -144
- package/lib/schema-component/antd/page/Page.style.js +79 -0
- package/lib/schema-component/antd/page/PageDesigner.js +62 -0
- package/lib/schema-component/antd/page/PageTabDesigner.js +2 -50
- package/lib/schema-component/antd/page/style.js +3 -13
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/antd/variable/TextAreaWithGlobalScope.js +94 -0
- package/lib/schema-component/antd/variable/index.js +13 -1
- package/lib/schema-component/common/dnd-context/index.js +1 -7
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +105 -0
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +59 -0
- package/lib/schema-items/GeneralSettings.js +5 -0
- package/lib/schema-settings/EditCustomDefaultValue.js +1 -1
- package/lib/schema-settings/SchemaSettings.js +1 -1
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +2 -0
- package/lib/schema-settings/utils/createModalSettingsItem.js +94 -0
- package/lib/schema-settings/utils/createSelectSettingsItem.js +88 -0
- package/lib/schema-settings/utils/createSwitchSettingsItem.js +86 -0
- package/lib/schema-settings/utils/createTextSettingsItem.js +55 -0
- package/lib/schema-settings/utils/index.js +92 -0
- package/lib/schema-settings/utils/util.js +74 -0
- package/lib/user/CurrentUserProvider.js +6 -3
- package/package.json +7 -7
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_dayjs__ from "dayjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_xlsx__ from "xlsx";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE__XlsxCollectionSchema_mjs__ from "./XlsxCollectionSchema.mjs";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE__XlsxEditFieldAction_mjs__ from "./XlsxEditFieldAction.mjs";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE__xlsxFieldsConfigure_mjs__ from "./xlsxFieldsConfigure.mjs";
|
|
15
|
+
import * as __WEBPACK_EXTERNAL_MODULE__xlsxPreviewTable_mjs__ from "./xlsxPreviewTable.mjs";
|
|
16
|
+
const { Dragger } = __WEBPACK_EXTERNAL_MODULE_antd__.Upload;
|
|
17
|
+
const ImportUpload = (props)=>{
|
|
18
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
19
|
+
const { close } = props;
|
|
20
|
+
const { getInterface } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCollectionManager_deprecated)();
|
|
21
|
+
const [fileList, setFile] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)([]);
|
|
22
|
+
const [filedata, setFileData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({});
|
|
23
|
+
const [visible, setVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
24
|
+
const [schema, setSchema] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({});
|
|
25
|
+
const inferType = (values, header)=>{
|
|
26
|
+
const isDateHeader = /date|time|日期/i.test(header);
|
|
27
|
+
const isPossibleDate = isDateHeader && values.every((value)=>(0, __WEBPACK_EXTERNAL_MODULE_dayjs__["default"])(value).isValid());
|
|
28
|
+
if (isPossibleDate) return 'date';
|
|
29
|
+
const types = values.map((value)=>{
|
|
30
|
+
if (null != value) {
|
|
31
|
+
const valueLower = value.toString().toLowerCase();
|
|
32
|
+
if ('true' === valueLower || 'yes' === valueLower) return 'boolean';
|
|
33
|
+
if ('false' === valueLower || 'no' === valueLower) return 'boolean';
|
|
34
|
+
}
|
|
35
|
+
const num = Number(value);
|
|
36
|
+
if (!isNaN(num)) return Number.isInteger(num) ? 'integer' : 'float';
|
|
37
|
+
try {
|
|
38
|
+
JSON.parse(value);
|
|
39
|
+
return 'json';
|
|
40
|
+
} catch {}
|
|
41
|
+
return 'string';
|
|
42
|
+
});
|
|
43
|
+
const typeCount = types.reduce((acc, type)=>{
|
|
44
|
+
acc[type] = (acc[type] || 0) + 1;
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
const uniqueTypes = Object.keys(typeCount);
|
|
48
|
+
if (uniqueTypes.length > 1) return 'string';
|
|
49
|
+
return uniqueTypes[0];
|
|
50
|
+
};
|
|
51
|
+
const inferInterface = (type, header)=>{
|
|
52
|
+
switch(type){
|
|
53
|
+
case 'json':
|
|
54
|
+
return 'json';
|
|
55
|
+
case 'boolean':
|
|
56
|
+
return 'checkbox';
|
|
57
|
+
case 'string':
|
|
58
|
+
return 'input';
|
|
59
|
+
case 'integer':
|
|
60
|
+
return 'integer';
|
|
61
|
+
case 'float':
|
|
62
|
+
return 'number';
|
|
63
|
+
case 'date':
|
|
64
|
+
return 'datetime';
|
|
65
|
+
default:
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const handleFileUpload = (file)=>{
|
|
70
|
+
const reader = new FileReader();
|
|
71
|
+
reader.onload = async (e)=>{
|
|
72
|
+
const binaryStr = e.target.result;
|
|
73
|
+
const workbook = __WEBPACK_EXTERNAL_MODULE_xlsx__.read(binaryStr, {
|
|
74
|
+
type: 'binary'
|
|
75
|
+
});
|
|
76
|
+
const firstSheetName = workbook.SheetNames[0];
|
|
77
|
+
const worksheet = workbook.Sheets[firstSheetName];
|
|
78
|
+
const jsonData = __WEBPACK_EXTERNAL_MODULE_xlsx__.utils.sheet_to_json(worksheet, {
|
|
79
|
+
header: 1
|
|
80
|
+
});
|
|
81
|
+
if (0 === jsonData.length) return;
|
|
82
|
+
const headers = jsonData[0];
|
|
83
|
+
const rows = jsonData.slice(1);
|
|
84
|
+
const fields = await Promise.all(headers.map(async (header, index)=>{
|
|
85
|
+
const columnValues = rows.map((row)=>row[index]);
|
|
86
|
+
const type = inferType(columnValues, header);
|
|
87
|
+
const interfaceType = type ? inferInterface(type, header) : null;
|
|
88
|
+
const interfaceConfig = interfaceType ? getInterface(interfaceType) : null;
|
|
89
|
+
const interfaceConfigValues = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(interfaceConfig);
|
|
90
|
+
const defaultUiSchema = (null == interfaceConfigValues ? void 0 : interfaceConfigValues.default.uiSchema) || {};
|
|
91
|
+
const fieldsName = "f_".concat((0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)());
|
|
92
|
+
return {
|
|
93
|
+
name: fieldsName,
|
|
94
|
+
type,
|
|
95
|
+
interface: interfaceType,
|
|
96
|
+
uiSchema: {
|
|
97
|
+
title: header,
|
|
98
|
+
...defaultUiSchema
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}));
|
|
102
|
+
const parseValue = (value, type)=>{
|
|
103
|
+
try {
|
|
104
|
+
switch(type){
|
|
105
|
+
case 'boolean':
|
|
106
|
+
{
|
|
107
|
+
const valueLower = value.toString().toLowerCase();
|
|
108
|
+
if ('true' === valueLower || 'yes' === valueLower) return true;
|
|
109
|
+
if ('false' === valueLower || 'no' === valueLower) return false;
|
|
110
|
+
throw new Error('Invalid boolean');
|
|
111
|
+
}
|
|
112
|
+
case 'integer':
|
|
113
|
+
if (!/^-?\d+$/.test(value)) throw new Error('Invalid integer');
|
|
114
|
+
return parseInt(value, 10);
|
|
115
|
+
case 'float':
|
|
116
|
+
if (!/^-?\d+(\.\d+)?$/.test(value)) throw new Error('Invalid number');
|
|
117
|
+
return Number(value);
|
|
118
|
+
case 'json':
|
|
119
|
+
return JSON.parse(value);
|
|
120
|
+
case 'date':
|
|
121
|
+
if (isNaN(Date.parse(value))) throw new Error('Invalid date');
|
|
122
|
+
return new Date(value);
|
|
123
|
+
default:
|
|
124
|
+
if (null == value || '' === value) return '';
|
|
125
|
+
return value.toString();
|
|
126
|
+
}
|
|
127
|
+
} catch (error) {
|
|
128
|
+
throw new Error("Type conversion error: ".concat(error.message));
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const convertedRows = rows.map((row, rowIndex)=>headers.reduce((acc, header, index)=>{
|
|
132
|
+
var _fields_index, _fields_index1;
|
|
133
|
+
const fieldsName = null === (_fields_index = fields[index]) || void 0 === _fields_index ? void 0 : _fields_index.name;
|
|
134
|
+
const type = null === (_fields_index1 = fields[index]) || void 0 === _fields_index1 ? void 0 : _fields_index1.type;
|
|
135
|
+
if (fieldsName && type) try {
|
|
136
|
+
const convertedValue = parseValue(row[index], type);
|
|
137
|
+
acc[fieldsName] = convertedValue;
|
|
138
|
+
} catch (error) {
|
|
139
|
+
acc[fieldsName] = null;
|
|
140
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error('Error in column "'.concat(header, '" at row ').concat(rowIndex + 1, ": ").concat(error.message));
|
|
141
|
+
}
|
|
142
|
+
return acc;
|
|
143
|
+
}, {}));
|
|
144
|
+
const fileData = {
|
|
145
|
+
fields: fields,
|
|
146
|
+
data: convertedRows
|
|
147
|
+
};
|
|
148
|
+
setFileData(fileData);
|
|
149
|
+
};
|
|
150
|
+
reader.readAsBinaryString(file);
|
|
151
|
+
};
|
|
152
|
+
const importProps = {
|
|
153
|
+
onRemove: (file)=>{
|
|
154
|
+
const index = fileList.indexOf(file);
|
|
155
|
+
const newFileList = fileList.slice();
|
|
156
|
+
newFileList.splice(index, 1);
|
|
157
|
+
setFile(newFileList);
|
|
158
|
+
},
|
|
159
|
+
beforeUpload: (file)=>{
|
|
160
|
+
const isExcel = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' === file.type || file.name.endsWith('.xlsx') || file.name.endsWith('.xls');
|
|
161
|
+
if (!isExcel) {
|
|
162
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error(t('You can only upload Excel files!'));
|
|
163
|
+
return __WEBPACK_EXTERNAL_MODULE_antd__.Upload.LIST_IGNORE;
|
|
164
|
+
}
|
|
165
|
+
handleFileUpload(file);
|
|
166
|
+
setFile([
|
|
167
|
+
file
|
|
168
|
+
]);
|
|
169
|
+
return false;
|
|
170
|
+
},
|
|
171
|
+
fileList
|
|
172
|
+
};
|
|
173
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
174
|
+
children: [
|
|
175
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(Dragger, {
|
|
176
|
+
maxCount: 1,
|
|
177
|
+
...importProps,
|
|
178
|
+
children: [
|
|
179
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("p", {
|
|
180
|
+
className: "ant-upload-drag-icon",
|
|
181
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.InboxOutlined, {})
|
|
182
|
+
}),
|
|
183
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("p", {
|
|
184
|
+
className: "ant-upload-text",
|
|
185
|
+
children: [
|
|
186
|
+
" ",
|
|
187
|
+
t('Click or drag file to this area to upload')
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
}),
|
|
192
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.ActionContextProvider, {
|
|
193
|
+
value: {
|
|
194
|
+
visible,
|
|
195
|
+
setVisible
|
|
196
|
+
},
|
|
197
|
+
children: [
|
|
198
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
|
|
199
|
+
type: "primary",
|
|
200
|
+
onClick: async ()=>{
|
|
201
|
+
const xlsxCollectionSchema = (0, __WEBPACK_EXTERNAL_MODULE__XlsxCollectionSchema_mjs__.createXlsxCollectionSchema)(fileList, filedata);
|
|
202
|
+
setSchema(xlsxCollectionSchema);
|
|
203
|
+
setVisible(true);
|
|
204
|
+
close();
|
|
205
|
+
},
|
|
206
|
+
disabled: 0 === fileList.length,
|
|
207
|
+
style: {
|
|
208
|
+
marginTop: 16
|
|
209
|
+
},
|
|
210
|
+
children: t('Upload')
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.SchemaComponent, {
|
|
213
|
+
schema: schema,
|
|
214
|
+
components: {
|
|
215
|
+
xlsxFieldsConfigure: __WEBPACK_EXTERNAL_MODULE__xlsxFieldsConfigure_mjs__.xlsxFieldsConfigure
|
|
216
|
+
},
|
|
217
|
+
scope: {
|
|
218
|
+
xlsxPreviewTable: __WEBPACK_EXTERNAL_MODULE__xlsxPreviewTable_mjs__.xlsxPreviewTable,
|
|
219
|
+
xlsxImportAction: __WEBPACK_EXTERNAL_MODULE__XlsxEditFieldAction_mjs__.xlsxImportAction
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
const ImportXlsxMetaAction = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef((props, ref)=>{
|
|
228
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
229
|
+
const [isModalOpen, setIsModalOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
230
|
+
const [loading, setLoading] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
231
|
+
const showModal = ()=>{
|
|
232
|
+
setIsModalOpen(true);
|
|
233
|
+
};
|
|
234
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useImperativeHandle)(ref, ()=>({
|
|
235
|
+
showModal
|
|
236
|
+
}));
|
|
237
|
+
const handleCancel = ()=>{
|
|
238
|
+
setIsModalOpen(false);
|
|
239
|
+
};
|
|
240
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
241
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Drawer, {
|
|
242
|
+
title: t('Import collection'),
|
|
243
|
+
footer: void 0,
|
|
244
|
+
open: isModalOpen,
|
|
245
|
+
onClose: handleCancel,
|
|
246
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Spin, {
|
|
247
|
+
spinning: loading,
|
|
248
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ImportUpload, {
|
|
249
|
+
close: handleCancel
|
|
250
|
+
})
|
|
251
|
+
})
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
export { ImportXlsxMetaAction };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export declare const createXlsxCollectionSchema: (filelist: any, filedata: any) => {
|
|
2
|
+
type: string;
|
|
3
|
+
properties: {
|
|
4
|
+
[x: string]: {
|
|
5
|
+
type: string;
|
|
6
|
+
'x-decorator': string;
|
|
7
|
+
'x-component': string;
|
|
8
|
+
'x-component-props': {
|
|
9
|
+
width: string;
|
|
10
|
+
};
|
|
11
|
+
'x-use-component-props': string;
|
|
12
|
+
properties: {
|
|
13
|
+
action: {
|
|
14
|
+
type: string;
|
|
15
|
+
'x-component': string;
|
|
16
|
+
'x-component-props': {
|
|
17
|
+
layout: string;
|
|
18
|
+
style: {
|
|
19
|
+
justifyContent: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
properties: {
|
|
23
|
+
cancel: {
|
|
24
|
+
title: string;
|
|
25
|
+
'x-component': string;
|
|
26
|
+
'x-use-component-props': string;
|
|
27
|
+
};
|
|
28
|
+
submit: {
|
|
29
|
+
title: string;
|
|
30
|
+
'x-component': string;
|
|
31
|
+
'x-component-props': {
|
|
32
|
+
type: string;
|
|
33
|
+
htmlType: string;
|
|
34
|
+
};
|
|
35
|
+
'x-use-component-props': string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
title: {
|
|
40
|
+
type: string;
|
|
41
|
+
default: any;
|
|
42
|
+
title: string;
|
|
43
|
+
required: boolean;
|
|
44
|
+
'x-decorator': string;
|
|
45
|
+
'x-component': string;
|
|
46
|
+
};
|
|
47
|
+
name: {
|
|
48
|
+
type: string;
|
|
49
|
+
title: string;
|
|
50
|
+
default: string;
|
|
51
|
+
required: boolean;
|
|
52
|
+
'x-decorator': string;
|
|
53
|
+
'x-component': string;
|
|
54
|
+
'x-validator': string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
category: {
|
|
58
|
+
title: string;
|
|
59
|
+
type: string;
|
|
60
|
+
name: string;
|
|
61
|
+
'x-decorator': string;
|
|
62
|
+
'x-component': string;
|
|
63
|
+
'x-component-props': {
|
|
64
|
+
mode: string;
|
|
65
|
+
};
|
|
66
|
+
'x-reactions': string[];
|
|
67
|
+
};
|
|
68
|
+
description: {
|
|
69
|
+
title: string;
|
|
70
|
+
type: string;
|
|
71
|
+
name: string;
|
|
72
|
+
'x-decorator': string;
|
|
73
|
+
'x-component': string;
|
|
74
|
+
};
|
|
75
|
+
fields: {
|
|
76
|
+
type: string;
|
|
77
|
+
title: string;
|
|
78
|
+
default: any;
|
|
79
|
+
'x-decorator': string;
|
|
80
|
+
'x-component': string;
|
|
81
|
+
'x-component-props': {
|
|
82
|
+
filedata: any;
|
|
83
|
+
};
|
|
84
|
+
required: boolean;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
const createXlsxCollectionSchema = (filelist, filedata)=>{
|
|
3
|
+
var _filelist_;
|
|
4
|
+
return {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
[(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
|
|
8
|
+
type: 'void',
|
|
9
|
+
'x-decorator': 'FormV2',
|
|
10
|
+
'x-component': 'Action.Drawer',
|
|
11
|
+
'x-component-props': {
|
|
12
|
+
width: '70%'
|
|
13
|
+
},
|
|
14
|
+
'x-use-component-props': 'useFormBlockProps',
|
|
15
|
+
properties: {
|
|
16
|
+
action: {
|
|
17
|
+
type: 'void',
|
|
18
|
+
'x-component': 'ActionBar',
|
|
19
|
+
'x-component-props': {
|
|
20
|
+
layout: 'one-column',
|
|
21
|
+
style: {
|
|
22
|
+
justifyContent: 'right'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
properties: {
|
|
26
|
+
cancel: {
|
|
27
|
+
title: 'Cancel',
|
|
28
|
+
'x-component': 'Action',
|
|
29
|
+
'x-use-component-props': 'useCancelActionProps'
|
|
30
|
+
},
|
|
31
|
+
submit: {
|
|
32
|
+
title: '{{t("Submit")}}',
|
|
33
|
+
'x-component': 'Action',
|
|
34
|
+
'x-component-props': {
|
|
35
|
+
type: 'primary',
|
|
36
|
+
htmlType: 'submit'
|
|
37
|
+
},
|
|
38
|
+
'x-use-component-props': 'xlsxImportAction'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
title: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
default: null === (_filelist_ = filelist[0]) || void 0 === _filelist_ ? void 0 : _filelist_.name.replace(/\.[^/.]+$/, ''),
|
|
45
|
+
title: '{{ t("Collection display name") }}',
|
|
46
|
+
required: true,
|
|
47
|
+
'x-decorator': 'FormItem',
|
|
48
|
+
'x-component': 'Input'
|
|
49
|
+
},
|
|
50
|
+
name: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
title: '{{t("Collection name")}}',
|
|
53
|
+
default: '{{ useNewId("t_") }}',
|
|
54
|
+
required: true,
|
|
55
|
+
'x-decorator': 'FormItem',
|
|
56
|
+
'x-component': 'Input',
|
|
57
|
+
'x-validator': 'uid',
|
|
58
|
+
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
|
|
59
|
+
},
|
|
60
|
+
category: {
|
|
61
|
+
title: '{{t("Categories")}}',
|
|
62
|
+
type: 'hasMany',
|
|
63
|
+
name: 'category',
|
|
64
|
+
'x-decorator': 'FormItem',
|
|
65
|
+
'x-component': 'Select',
|
|
66
|
+
'x-component-props': {
|
|
67
|
+
mode: 'multiple'
|
|
68
|
+
},
|
|
69
|
+
'x-reactions': [
|
|
70
|
+
'{{useAsyncDataSource(loadCategories)}}'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
description: {
|
|
74
|
+
title: '{{t("Description")}}',
|
|
75
|
+
type: 'string',
|
|
76
|
+
name: 'description',
|
|
77
|
+
'x-decorator': 'FormItem',
|
|
78
|
+
'x-component': 'Input.TextArea'
|
|
79
|
+
},
|
|
80
|
+
fields: {
|
|
81
|
+
type: 'array',
|
|
82
|
+
title: '{{t("Fields")}}',
|
|
83
|
+
default: filedata.fields,
|
|
84
|
+
'x-decorator': 'FormItem',
|
|
85
|
+
'x-component': 'xlsxFieldsConfigure',
|
|
86
|
+
'x-component-props': {
|
|
87
|
+
filedata
|
|
88
|
+
},
|
|
89
|
+
required: true
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export { createXlsxCollectionSchema };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__ from "../../../api-client/index.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__ResourceActionProvider_mjs__ from "../../ResourceActionProvider.mjs";
|
|
9
|
+
const xlsxImportAction = ()=>{
|
|
10
|
+
const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
|
|
11
|
+
const ctx = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useActionContext)();
|
|
12
|
+
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
13
|
+
const api = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useAPIClient)();
|
|
14
|
+
const { refresh } = (0, __WEBPACK_EXTERNAL_MODULE__ResourceActionProvider_mjs__.useResourceActionContext)();
|
|
15
|
+
const { refreshCM } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCollectionManager_deprecated)();
|
|
16
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
17
|
+
return {
|
|
18
|
+
async onClick () {
|
|
19
|
+
field.data = field.data || {};
|
|
20
|
+
field.data.loading = true;
|
|
21
|
+
try {
|
|
22
|
+
await form.submit();
|
|
23
|
+
const values = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(form.values);
|
|
24
|
+
const { collectionData, ...collections } = values;
|
|
25
|
+
if (!collections.autoCreateReverseField) delete collections.reverseField;
|
|
26
|
+
delete collections.autoCreateReverseField;
|
|
27
|
+
await api.resource('collections').create({
|
|
28
|
+
values: {
|
|
29
|
+
logging: true,
|
|
30
|
+
...collections
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
api.resource("".concat(collections.name)).create({
|
|
34
|
+
values: collectionData
|
|
35
|
+
});
|
|
36
|
+
ctx.setVisible(false);
|
|
37
|
+
null == refresh || refresh();
|
|
38
|
+
await refreshCM();
|
|
39
|
+
field.data.loading = false;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
field.data.loading = false;
|
|
42
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error(t('Operation failed'));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export { xlsxImportAction };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__xlsxFormValueContextProvider_mjs__ from "./xlsxFormValueContextProvider.mjs";
|
|
7
|
+
const setUpdateXlsxCollectionField = ()=>{
|
|
8
|
+
const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
|
|
9
|
+
const { value, setFormValue } = (0, __WEBPACK_EXTERNAL_MODULE__xlsxFormValueContextProvider_mjs__.useFormValueContext)();
|
|
10
|
+
const ctx = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useActionContext)();
|
|
11
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
12
|
+
const handleFieldChange = (index, updatedField)=>{
|
|
13
|
+
const updatedFieldData = [
|
|
14
|
+
...value
|
|
15
|
+
];
|
|
16
|
+
if (updatedField.primaryKey) {
|
|
17
|
+
const existingPrimaryKey = updatedFieldData.find((field, i)=>true === field.primaryKey && i !== index);
|
|
18
|
+
if (existingPrimaryKey) {
|
|
19
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error(t('existingPrimaryKeyError', {
|
|
20
|
+
name: existingPrimaryKey.name
|
|
21
|
+
}));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
updatedFieldData[index] = updatedField;
|
|
26
|
+
setFormValue(updatedFieldData);
|
|
27
|
+
};
|
|
28
|
+
return {
|
|
29
|
+
async onClick () {
|
|
30
|
+
await form.submit();
|
|
31
|
+
const values = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(form.values);
|
|
32
|
+
values.autoCreateReverseField || delete values.reverseField;
|
|
33
|
+
delete values.autoCreateReverseField;
|
|
34
|
+
const { index, ...updatedField } = values;
|
|
35
|
+
if (index < 0 || index >= value.length) {
|
|
36
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error('Invalid field index');
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
handleFieldChange(index, updatedField);
|
|
40
|
+
ctx.setVisible(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export { setUpdateXlsxCollectionField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const xlsxFieldsConfigure: import("react").MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|