@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,380 @@
|
|
|
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_antd__ from "antd";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__ from "../../../data-source/index.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE__interfaces_mjs__ from "../interfaces.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__xlsxFormValueContextProvider_mjs__ from "./xlsxFormValueContextProvider.mjs";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE__xlsxImportAction_mjs__ from "./xlsxImportAction.mjs";
|
|
13
|
+
const xlsxFieldsConfigure = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
|
|
14
|
+
const { filedata } = props;
|
|
15
|
+
const { fields, data } = filedata;
|
|
16
|
+
(0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useDataSourceManager)();
|
|
17
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
18
|
+
const initOptions = (0, __WEBPACK_EXTERNAL_MODULE__interfaces_mjs__.useFieldInterfaceOptions)();
|
|
19
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
20
|
+
const [selectedTitleField, setSelectedTitleField] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)();
|
|
21
|
+
const form = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useForm)();
|
|
22
|
+
const [formValue, setFormValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(fields);
|
|
23
|
+
const { getInterface } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCollectionManager_deprecated)();
|
|
24
|
+
const getDefaultUiSchema = (interfaceType, title)=>{
|
|
25
|
+
var _interfaceConfigValues_default;
|
|
26
|
+
const interfaceConfig = getInterface(interfaceType) || {};
|
|
27
|
+
const interfaceConfigValues = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(interfaceConfig);
|
|
28
|
+
const defaultUiSchema = (null == interfaceConfigValues ? void 0 : null === (_interfaceConfigValues_default = interfaceConfigValues.default) || void 0 === _interfaceConfigValues_default ? void 0 : _interfaceConfigValues_default.uiSchema) || {};
|
|
29
|
+
return {
|
|
30
|
+
...defaultUiSchema,
|
|
31
|
+
title
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const handleFieldChange = (updatedField, index)=>{
|
|
35
|
+
const updatedFieldData = [
|
|
36
|
+
...formValue
|
|
37
|
+
];
|
|
38
|
+
updatedFieldData[index] = updatedField;
|
|
39
|
+
setFormValue(updatedFieldData);
|
|
40
|
+
};
|
|
41
|
+
const handleFieldTypeChange = async (updatedField, index)=>{
|
|
42
|
+
const { type, name: dataIndex, uiSchema } = updatedField;
|
|
43
|
+
const updatedData = [
|
|
44
|
+
...data
|
|
45
|
+
];
|
|
46
|
+
let hasError = false;
|
|
47
|
+
const typeToInterface = {
|
|
48
|
+
json: 'json',
|
|
49
|
+
boolean: 'checkbox',
|
|
50
|
+
string: 'input',
|
|
51
|
+
integer: 'integer',
|
|
52
|
+
float: 'number',
|
|
53
|
+
date: 'datetime'
|
|
54
|
+
};
|
|
55
|
+
updatedField.interface = await typeToInterface[type] || null;
|
|
56
|
+
const currentUiSchema = await getDefaultUiSchema(updatedField.interface, uiSchema.title);
|
|
57
|
+
updatedField.uiSchema = currentUiSchema;
|
|
58
|
+
updatedData.forEach((row, rowIndex)=>{
|
|
59
|
+
try {
|
|
60
|
+
if (void 0 !== row[dataIndex]) row[dataIndex] = parseValue(row[dataIndex], type);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
hasError = true;
|
|
63
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error("Row ".concat(rowIndex + 1, ", Column ").concat(uiSchema.title, ": ").concat(error.message));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (!hasError) {
|
|
67
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.success("".concat(t('Fields'), ' "').concat(uiSchema.title, '"').concat(t('Converted to'), " ").concat(type));
|
|
68
|
+
const updatedFieldData = [
|
|
69
|
+
...formValue
|
|
70
|
+
];
|
|
71
|
+
updatedFieldData[index] = updatedField;
|
|
72
|
+
setFormValue(updatedFieldData);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleFieldInterfaceChange = async (updatedField, index)=>{
|
|
76
|
+
const currentUiSchema = await getDefaultUiSchema(updatedField.interface, updatedField.uiSchema.title);
|
|
77
|
+
updatedField.uiSchema = currentUiSchema;
|
|
78
|
+
const updatedFieldData = [
|
|
79
|
+
...formValue
|
|
80
|
+
];
|
|
81
|
+
updatedFieldData[index] = updatedField;
|
|
82
|
+
setFormValue(updatedFieldData);
|
|
83
|
+
};
|
|
84
|
+
const parseValue = (value, type)=>{
|
|
85
|
+
try {
|
|
86
|
+
switch(type){
|
|
87
|
+
case 'boolean':
|
|
88
|
+
if ('true' === value.toLowerCase()) return true;
|
|
89
|
+
if ('false' === value.toLowerCase()) return false;
|
|
90
|
+
throw new Error('Invalid boolean');
|
|
91
|
+
case 'integer':
|
|
92
|
+
if (!/^-?\d+$/.test(value)) throw new Error('Invalid integer');
|
|
93
|
+
return parseInt(value, 10);
|
|
94
|
+
case 'float':
|
|
95
|
+
if (!/^-?\d+(\.\d+)?$/.test(value)) throw new Error('Invalid number');
|
|
96
|
+
return Number(value);
|
|
97
|
+
case 'json':
|
|
98
|
+
return JSON.parse(value);
|
|
99
|
+
case 'date':
|
|
100
|
+
if (isNaN(Date.parse(value))) throw new Error('Invalid date');
|
|
101
|
+
return new Date(value);
|
|
102
|
+
default:
|
|
103
|
+
if (null == value || '' === value) return '';
|
|
104
|
+
return value.toString();
|
|
105
|
+
}
|
|
106
|
+
} catch (error) {
|
|
107
|
+
throw new Error("Type conversion error: ".concat(error.message));
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleTitleChange = (checked, field)=>{
|
|
111
|
+
const newTitleField = checked ? field.name : null;
|
|
112
|
+
setSelectedTitleField(newTitleField);
|
|
113
|
+
form.setValuesIn('titleField', newTitleField);
|
|
114
|
+
};
|
|
115
|
+
const isTitleField = (field)=>{
|
|
116
|
+
var _getInterface;
|
|
117
|
+
return !field.isForeignKey && (null === (_getInterface = getInterface(field.interface)) || void 0 === _getInterface ? void 0 : _getInterface.titleUsable);
|
|
118
|
+
};
|
|
119
|
+
const getOptions = (type)=>{
|
|
120
|
+
const InterfaceOptions = getInterfaceOptions(initOptions, type);
|
|
121
|
+
const options = InterfaceOptions.map((group)=>({
|
|
122
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
123
|
+
children: compile(group.label)
|
|
124
|
+
}),
|
|
125
|
+
title: group.key,
|
|
126
|
+
options: group.children.map((item)=>({
|
|
127
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
128
|
+
children: compile(item.label)
|
|
129
|
+
}),
|
|
130
|
+
value: item.name
|
|
131
|
+
}))
|
|
132
|
+
}));
|
|
133
|
+
return options;
|
|
134
|
+
};
|
|
135
|
+
const getInterfaceOptions = (data, type)=>{
|
|
136
|
+
const interfaceOptions = [];
|
|
137
|
+
data.forEach((item)=>{
|
|
138
|
+
const options = item.children.filter((h)=>{
|
|
139
|
+
var _h_availableTypes;
|
|
140
|
+
return null == h ? void 0 : null === (_h_availableTypes = h.availableTypes) || void 0 === _h_availableTypes ? void 0 : _h_availableTypes.includes(type);
|
|
141
|
+
});
|
|
142
|
+
interfaceOptions.push({
|
|
143
|
+
label: item.label,
|
|
144
|
+
key: item.key,
|
|
145
|
+
children: options
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
return interfaceOptions.filter((v)=>{
|
|
149
|
+
if ('sort' === type) return 'advanced' === v.key;
|
|
150
|
+
return v.children.length > 0;
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
const columns = [
|
|
154
|
+
{
|
|
155
|
+
title: t('Field display name'),
|
|
156
|
+
dataIndex: 'title',
|
|
157
|
+
key: 'title',
|
|
158
|
+
render: (text, record, index)=>{
|
|
159
|
+
const field = formValue[index];
|
|
160
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Input, {
|
|
161
|
+
value: field.uiSchema.title || text,
|
|
162
|
+
onChange: (e)=>handleFieldChange({
|
|
163
|
+
...field,
|
|
164
|
+
uiSchema: {
|
|
165
|
+
title: e.target.value
|
|
166
|
+
}
|
|
167
|
+
}, index)
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
title: t('Field name'),
|
|
173
|
+
dataIndex: 'name',
|
|
174
|
+
key: 'name',
|
|
175
|
+
render: (text, record, index)=>{
|
|
176
|
+
const field = formValue[index];
|
|
177
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Input, {
|
|
178
|
+
value: field.name || text,
|
|
179
|
+
variant: "borderless",
|
|
180
|
+
disabled: true
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
title: t('Field type'),
|
|
186
|
+
dataIndex: 'type',
|
|
187
|
+
key: 'type',
|
|
188
|
+
render: (text, record, index)=>{
|
|
189
|
+
const field = formValue[index];
|
|
190
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Select, {
|
|
191
|
+
value: field.type || text,
|
|
192
|
+
onChange: (e)=>handleFieldTypeChange({
|
|
193
|
+
...field,
|
|
194
|
+
type: e
|
|
195
|
+
}, index),
|
|
196
|
+
options: [
|
|
197
|
+
{
|
|
198
|
+
value: 'string',
|
|
199
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
200
|
+
children: "string"
|
|
201
|
+
})
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
value: 'boolean',
|
|
205
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
206
|
+
children: "boolean"
|
|
207
|
+
})
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
value: 'integer',
|
|
211
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
212
|
+
children: "integer"
|
|
213
|
+
})
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
value: 'float',
|
|
217
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
218
|
+
children: "float"
|
|
219
|
+
})
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
value: 'json',
|
|
223
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
224
|
+
children: "json"
|
|
225
|
+
})
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
value: 'date',
|
|
229
|
+
label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
230
|
+
children: "date"
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
title: t('Field interface'),
|
|
239
|
+
dataIndex: 'interface',
|
|
240
|
+
key: 'interface',
|
|
241
|
+
render: (text, record, index)=>{
|
|
242
|
+
const field = formValue[index];
|
|
243
|
+
const options = getOptions(field.type);
|
|
244
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Select, {
|
|
245
|
+
"aria-label": "field-interface-".concat(null == field ? void 0 : field.type),
|
|
246
|
+
role: "button",
|
|
247
|
+
value: field.interface,
|
|
248
|
+
popupMatchSelectWidth: false,
|
|
249
|
+
onChange: (e)=>handleFieldInterfaceChange({
|
|
250
|
+
...field,
|
|
251
|
+
interface: e
|
|
252
|
+
}, index),
|
|
253
|
+
options: options
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
dataIndex: 'titleField',
|
|
259
|
+
title: t('Title field'),
|
|
260
|
+
render: function(_, record, index) {
|
|
261
|
+
const field = formValue[index];
|
|
262
|
+
return isTitleField(field) ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tooltip, {
|
|
263
|
+
title: t('Default title for each record'),
|
|
264
|
+
placement: "right",
|
|
265
|
+
overlayInnerStyle: {
|
|
266
|
+
textAlign: 'center'
|
|
267
|
+
},
|
|
268
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Switch, {
|
|
269
|
+
"aria-label": "switch-title-field-".concat(field.name),
|
|
270
|
+
size: "small",
|
|
271
|
+
checked: field.name === selectedTitleField,
|
|
272
|
+
onChange: (checked)=>handleTitleChange(checked, field)
|
|
273
|
+
})
|
|
274
|
+
}) : null;
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
title: t('Description'),
|
|
279
|
+
dataIndex: 'description',
|
|
280
|
+
key: 'description',
|
|
281
|
+
render: (text, record, index)=>{
|
|
282
|
+
const field = formValue[index];
|
|
283
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Input.TextArea, {
|
|
284
|
+
value: field.description,
|
|
285
|
+
variant: "borderless",
|
|
286
|
+
disabled: true
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
title: t('Actions'),
|
|
292
|
+
dataIndex: 'actions',
|
|
293
|
+
key: 'actions',
|
|
294
|
+
render: (text, record, index)=>{
|
|
295
|
+
const field = formValue[index];
|
|
296
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Space, {
|
|
297
|
+
size: "middle",
|
|
298
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__xlsxImportAction_mjs__.XlsxEditFieldAction, {
|
|
299
|
+
record: {
|
|
300
|
+
index,
|
|
301
|
+
...field
|
|
302
|
+
},
|
|
303
|
+
...props
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
];
|
|
309
|
+
const previewTablecolumns = formValue.map((field)=>({
|
|
310
|
+
title: field.uiSchema.title,
|
|
311
|
+
dataIndex: field.name,
|
|
312
|
+
key: field.name,
|
|
313
|
+
render: (text)=>{
|
|
314
|
+
if ('boolean' == typeof text) return text ? 'True' : 'False';
|
|
315
|
+
if ('date' === field.type && text) return new Date(text).toLocaleString();
|
|
316
|
+
if ('json' === field.type && text) try {
|
|
317
|
+
return 'string' == typeof text ? text : JSON.stringify(text, null, 2);
|
|
318
|
+
} catch (error) {
|
|
319
|
+
return 'Invalid JSON';
|
|
320
|
+
}
|
|
321
|
+
return text;
|
|
322
|
+
},
|
|
323
|
+
width: 200
|
|
324
|
+
}));
|
|
325
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
326
|
+
form.setValuesIn('fields', formValue);
|
|
327
|
+
form.setValuesIn('collectionData', filedata.data);
|
|
328
|
+
console.log('%c Line:294 🍔 filedata.data', 'font-size:18px;color:#42b983;background:#3f7cff', filedata.data);
|
|
329
|
+
}, [
|
|
330
|
+
formValue
|
|
331
|
+
]);
|
|
332
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__xlsxFormValueContextProvider_mjs__.xlsxFormValueContext.Provider, {
|
|
333
|
+
value: {
|
|
334
|
+
value: formValue,
|
|
335
|
+
setFormValue
|
|
336
|
+
},
|
|
337
|
+
children: [
|
|
338
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Table, {
|
|
339
|
+
bordered: true,
|
|
340
|
+
size: "small",
|
|
341
|
+
columns: columns,
|
|
342
|
+
dataSource: formValue,
|
|
343
|
+
scroll: {
|
|
344
|
+
y: 300
|
|
345
|
+
},
|
|
346
|
+
pagination: false,
|
|
347
|
+
rowClassName: "row",
|
|
348
|
+
rowKey: "uid",
|
|
349
|
+
style: {
|
|
350
|
+
marginBottom: '16px'
|
|
351
|
+
},
|
|
352
|
+
...props
|
|
353
|
+
}),
|
|
354
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
|
|
355
|
+
style: {
|
|
356
|
+
fontWeight: 'bold',
|
|
357
|
+
marginBottom: '10px'
|
|
358
|
+
},
|
|
359
|
+
children: [
|
|
360
|
+
t('Preview'),
|
|
361
|
+
":"
|
|
362
|
+
]
|
|
363
|
+
}),
|
|
364
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Table, {
|
|
365
|
+
bordered: true,
|
|
366
|
+
size: "small",
|
|
367
|
+
columns: previewTablecolumns,
|
|
368
|
+
dataSource: filedata.data,
|
|
369
|
+
scroll: {
|
|
370
|
+
y: 300,
|
|
371
|
+
x: 'max-content'
|
|
372
|
+
},
|
|
373
|
+
rowKey: "name"
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
});
|
|
377
|
+
}, {
|
|
378
|
+
displayName: 'FieldsConfigure'
|
|
379
|
+
});
|
|
380
|
+
export { xlsxFieldsConfigure };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
+
const xlsxFormValueContext = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].createContext({});
|
|
3
|
+
const useFormValueContext = ()=>__WEBPACK_EXTERNAL_MODULE_react__["default"].useContext(xlsxFormValueContext);
|
|
4
|
+
export { useFormValueContext, xlsxFormValueContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const XlsxEditFieldAction: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,187 @@
|
|
|
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_components__ from "@tachybase/components";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__ from "../../../api-client/index.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__ from "../../../record-provider/index.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../schema-component/index.mjs";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE__action_hooks_mjs__ from "../../action-hooks.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_useDialect_mjs__ from "../../hooks/useDialect.mjs";
|
|
13
|
+
import * as __WEBPACK_EXTERNAL_MODULE__components_index_mjs__ from "../components/index.mjs";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE__setUpdateXlsxCollectionField_mjs__ from "./setUpdateXlsxCollectionField.mjs";
|
|
15
|
+
const XlsxEditFieldAction = (props)=>{
|
|
16
|
+
const { scope, getContainer, record, parentItem: parentRecord, children, handleUiSchemaChange, ...otherProps } = props;
|
|
17
|
+
const { getInterface, collections, getCollection } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCollectionManager_deprecated)();
|
|
18
|
+
const [visible, setVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
19
|
+
const [schema, setSchema] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({});
|
|
20
|
+
(0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useAPIClient)();
|
|
21
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
22
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
23
|
+
const [data, setData] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
|
|
24
|
+
record
|
|
25
|
+
});
|
|
26
|
+
const { isDialect } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_useDialect_mjs__["default"])();
|
|
27
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__.RecordProvider, {
|
|
28
|
+
record: record,
|
|
29
|
+
parent: parentRecord,
|
|
30
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.ActionContextProvider, {
|
|
31
|
+
value: {
|
|
32
|
+
visible,
|
|
33
|
+
setVisible
|
|
34
|
+
},
|
|
35
|
+
children: [
|
|
36
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("a", {
|
|
37
|
+
...otherProps,
|
|
38
|
+
onClick: async ()=>{
|
|
39
|
+
setData(record);
|
|
40
|
+
const interfaceConf = getInterface(record.interface);
|
|
41
|
+
const defaultValues = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(record) || {};
|
|
42
|
+
if (!(null == defaultValues ? void 0 : defaultValues.reverseField)) {
|
|
43
|
+
var _interfaceConf_default;
|
|
44
|
+
defaultValues.autoCreateReverseField = false;
|
|
45
|
+
defaultValues.reverseField = null == interfaceConf ? void 0 : null === (_interfaceConf_default = interfaceConf.default) || void 0 === _interfaceConf_default ? void 0 : _interfaceConf_default.reverseField;
|
|
46
|
+
(0, __WEBPACK_EXTERNAL_MODULE_lodash__.set)(defaultValues.reverseField, 'name', record.name);
|
|
47
|
+
(0, __WEBPACK_EXTERNAL_MODULE_lodash__.set)(defaultValues, 'uiSchema.title', record.uiSchema.title);
|
|
48
|
+
}
|
|
49
|
+
const schema = getSchema({
|
|
50
|
+
...interfaceConf,
|
|
51
|
+
default: defaultValues
|
|
52
|
+
}, record, compile, getContainer);
|
|
53
|
+
setSchema(schema);
|
|
54
|
+
setVisible(true);
|
|
55
|
+
},
|
|
56
|
+
children: children || t('Edit')
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.SchemaComponent, {
|
|
59
|
+
schema: schema,
|
|
60
|
+
components: {
|
|
61
|
+
...__WEBPACK_EXTERNAL_MODULE__components_index_mjs__,
|
|
62
|
+
ArrayTable: __WEBPACK_EXTERNAL_MODULE__tachybase_components__.ArrayTable
|
|
63
|
+
},
|
|
64
|
+
scope: {
|
|
65
|
+
getContainer,
|
|
66
|
+
useCancelAction: __WEBPACK_EXTERNAL_MODULE__action_hooks_mjs__.useCancelAction,
|
|
67
|
+
showReverseFieldConfig: !(null == data ? void 0 : data.reverseField),
|
|
68
|
+
isDialect,
|
|
69
|
+
setUpdateXlsxCollectionField: __WEBPACK_EXTERNAL_MODULE__setUpdateXlsxCollectionField_mjs__.setUpdateXlsxCollectionField,
|
|
70
|
+
disabledJSONB: true,
|
|
71
|
+
createMainOnly: true,
|
|
72
|
+
...scope
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
})
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const getSchema = (schema, record, compile, getContainer)=>{
|
|
80
|
+
if (!schema) return;
|
|
81
|
+
const properties = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(schema.properties);
|
|
82
|
+
if (null == properties ? void 0 : properties.name) properties.name['x-disabled'] = true;
|
|
83
|
+
if (true === schema.hasDefaultValue) {
|
|
84
|
+
properties['defaultValue'] = (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)(schema.default) || {};
|
|
85
|
+
properties.defaultValue.required = false;
|
|
86
|
+
properties['defaultValue']['title'] = compile('{{ t("Default value") }}');
|
|
87
|
+
properties['defaultValue']['x-decorator'] = 'FormItem';
|
|
88
|
+
properties['defaultValue']['x-reactions'] = [
|
|
89
|
+
{
|
|
90
|
+
dependencies: [
|
|
91
|
+
'uiSchema.x-component-props.gmt',
|
|
92
|
+
'uiSchema.x-component-props.showTime',
|
|
93
|
+
'uiSchema.x-component-props.dateFormat',
|
|
94
|
+
'uiSchema.x-component-props.timeFormat'
|
|
95
|
+
],
|
|
96
|
+
fulfill: {
|
|
97
|
+
state: {
|
|
98
|
+
componentProps: {
|
|
99
|
+
gmt: '{{$deps[0]}}',
|
|
100
|
+
showTime: '{{$deps[1]}}',
|
|
101
|
+
dateFormat: '{{$deps[2]}}',
|
|
102
|
+
timeFormat: '{{$deps[3]}}'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
dependencies: [
|
|
109
|
+
'primaryKey',
|
|
110
|
+
'unique',
|
|
111
|
+
'autoIncrement'
|
|
112
|
+
],
|
|
113
|
+
when: '{{$deps[0]||$deps[1]||$deps[2]}}',
|
|
114
|
+
fulfill: {
|
|
115
|
+
state: {
|
|
116
|
+
hidden: true,
|
|
117
|
+
value: void 0
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
otherwise: {
|
|
121
|
+
state: {
|
|
122
|
+
hidden: false
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {
|
|
131
|
+
[(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.uid)()]: {
|
|
132
|
+
type: 'void',
|
|
133
|
+
'x-component': 'Action.Drawer',
|
|
134
|
+
'x-component-props': {
|
|
135
|
+
getContainer: getContainer
|
|
136
|
+
},
|
|
137
|
+
'x-decorator': 'Form',
|
|
138
|
+
'x-decorator-props': {
|
|
139
|
+
useValues (options) {
|
|
140
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useRequest)(()=>Promise.resolve({
|
|
141
|
+
data: (0, __WEBPACK_EXTERNAL_MODULE_lodash__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_lodash__.omit)(schema.default, [
|
|
142
|
+
'uiSchema.rawTitle'
|
|
143
|
+
]))
|
|
144
|
+
}), options);
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
title: "".concat(compile(record.uiSchema.title), " - ").concat(compile('{{ t("Edit field") }}')),
|
|
148
|
+
properties: {
|
|
149
|
+
summary: {
|
|
150
|
+
type: 'void',
|
|
151
|
+
'x-component': 'FieldSummary',
|
|
152
|
+
'x-component-props': {
|
|
153
|
+
schemaKey: schema.name
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
...properties,
|
|
157
|
+
description: {
|
|
158
|
+
type: 'string',
|
|
159
|
+
title: '{{t("Description")}}',
|
|
160
|
+
'x-decorator': 'FormItem',
|
|
161
|
+
'x-component': 'Input.TextArea'
|
|
162
|
+
},
|
|
163
|
+
footer: {
|
|
164
|
+
type: 'void',
|
|
165
|
+
'x-component': 'Action.Drawer.Footer',
|
|
166
|
+
properties: {
|
|
167
|
+
action1: {
|
|
168
|
+
title: '{{ t("Cancel") }}',
|
|
169
|
+
'x-component': 'Action',
|
|
170
|
+
'x-use-component-props': 'useCancelActionProps'
|
|
171
|
+
},
|
|
172
|
+
action2: {
|
|
173
|
+
title: '{{ t("Submit") }}',
|
|
174
|
+
'x-component': 'Action',
|
|
175
|
+
'x-component-props': {
|
|
176
|
+
type: 'primary'
|
|
177
|
+
},
|
|
178
|
+
'x-use-component-props': 'setUpdateXlsxCollectionField'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
export { XlsxEditFieldAction };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const xlsxPreviewTable: import("react").MemoExoticComponent<import("@tachybase/schema").ReactFC<Omit<any, "ref">>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
5
|
+
const xlsxPreviewTable = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
|
|
6
|
+
const { filedata } = props;
|
|
7
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
8
|
+
const previewTablecolumns = filedata.fields.map((field)=>({
|
|
9
|
+
title: field.uiSchema.title,
|
|
10
|
+
dataIndex: field.name,
|
|
11
|
+
key: field.name,
|
|
12
|
+
render: (text)=>text,
|
|
13
|
+
width: 200
|
|
14
|
+
}));
|
|
15
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Table, {
|
|
16
|
+
bordered: true,
|
|
17
|
+
size: "small",
|
|
18
|
+
columns: previewTablecolumns,
|
|
19
|
+
dataSource: filedata.data,
|
|
20
|
+
scroll: {
|
|
21
|
+
y: 300,
|
|
22
|
+
x: 'max-content'
|
|
23
|
+
},
|
|
24
|
+
pagination: false,
|
|
25
|
+
rowKey: "name"
|
|
26
|
+
});
|
|
27
|
+
}, {
|
|
28
|
+
displayName: 'PreviewTable'
|
|
29
|
+
});
|
|
30
|
+
export { xlsxPreviewTable };
|
|
@@ -4,6 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__data_source_data_source_DataSourceManager
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__interfaces_index_mjs__ from "./interfaces/index.mjs";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__mixins_InheritanceCollectionMixin_mjs__ from "./mixins/InheritanceCollectionMixin.mjs";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__templates_index_mjs__ from "./templates/index.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__templates_xlsx_mjs__ from "./templates/xlsx.mjs";
|
|
7
8
|
class MainDataSource extends __WEBPACK_EXTERNAL_MODULE__data_source_data_source_DataSource_mjs__.DataSource {
|
|
8
9
|
async getDataSource() {
|
|
9
10
|
var _service_data;
|
|
@@ -122,7 +123,8 @@ class CollectionPlugin extends __WEBPACK_EXTERNAL_MODULE__application_Plugin_mjs
|
|
|
122
123
|
__WEBPACK_EXTERNAL_MODULE__templates_index_mjs__.SqlCollectionTemplate,
|
|
123
124
|
__WEBPACK_EXTERNAL_MODULE__templates_index_mjs__.TreeCollectionTemplate,
|
|
124
125
|
__WEBPACK_EXTERNAL_MODULE__templates_index_mjs__.ViewCollectionTemplate,
|
|
125
|
-
__WEBPACK_EXTERNAL_MODULE__templates_index_mjs__.ImportCollectionTemplate
|
|
126
|
+
__WEBPACK_EXTERNAL_MODULE__templates_index_mjs__.ImportCollectionTemplate,
|
|
127
|
+
__WEBPACK_EXTERNAL_MODULE__templates_xlsx_mjs__.ImportXlsxTemplate
|
|
126
128
|
]);
|
|
127
129
|
}
|
|
128
130
|
}
|
|
@@ -11,7 +11,7 @@ function _define_property(obj, key, value) {
|
|
|
11
11
|
}
|
|
12
12
|
class ImportCollectionTemplate extends __WEBPACK_EXTERNAL_MODULE__data_source_collection_template_CollectionTemplate_mjs__.CollectionTemplate {
|
|
13
13
|
constructor(...args){
|
|
14
|
-
super(...args), _define_property(this, "name", 'import'), _define_property(this, "title", '{{t("Import collection")}}'), _define_property(this, "order", 5), _define_property(this, "color", 'blue'), _define_property(this, "divider", true), _define_property(this, "default", {
|
|
14
|
+
super(...args), _define_property(this, "name", 'import'), _define_property(this, "title", '{{t("Import json collection")}}'), _define_property(this, "order", 5), _define_property(this, "color", 'blue'), _define_property(this, "divider", true), _define_property(this, "default", {
|
|
15
15
|
fields: []
|
|
16
16
|
});
|
|
17
17
|
}
|