@tachybase/client 0.23.48 → 0.23.58
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/application/Application.d.ts +3 -0
- package/es/application/Application.mjs +8 -0
- 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-settings/hooks/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.mjs +6 -8
- package/es/block-provider/hooks/index.mjs +4 -1
- package/es/built-in/index.mjs +3 -0
- package/es/built-in/locale/LocalePlugin.mjs +5 -1
- 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/xlsx.d.ts +11 -0
- package/es/collection-manager/templates/xlsx.mjs +19 -0
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +4 -2
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
- package/es/schema-component/antd/action/Action.Designer.mjs +5 -2
- package/es/schema-component/antd/action/Action.Modal.mjs +20 -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/utils.d.ts +1 -1
- package/es/schema-component/antd/action/utils.mjs +70 -70
- package/es/schema-component/antd/checkbox/Checkbox.mjs +6 -1
- package/es/schema-component/antd/page/Page.d.ts +1 -5
- package/es/schema-component/antd/page/Page.mjs +227 -146
- 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/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/lib/application/Application.js +8 -0
- package/lib/application/hooks/index.js +9 -0
- package/lib/application/hooks/useGlobalVariable.js +52 -0
- package/lib/application/schema-settings/hooks/index.js +6 -8
- package/lib/block-provider/hooks/index.js +6 -3
- package/lib/built-in/index.js +3 -0
- package/lib/built-in/locale/LocalePlugin.js +5 -1
- 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/locale/zh-CN.js +4 -1
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +4 -2
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
- package/lib/schema-component/antd/action/Action.Designer.js +5 -2
- package/lib/schema-component/antd/action/Action.Modal.js +20 -31
- package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
- package/lib/schema-component/antd/action/utils.js +70 -70
- package/lib/schema-component/antd/checkbox/Checkbox.js +6 -1
- package/lib/schema-component/antd/page/Page.js +227 -146
- 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/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
|
+
});
|