@tachybase/client 1.3.20 → 1.3.21
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.mjs +1 -9
- package/es/application/components/index.d.ts +0 -2
- package/es/application/components/index.mjs +0 -2
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/application/utils/globalDeps.mjs +1 -1
- package/es/block-provider/hooks/index.mjs +1 -1
- package/es/built-in/index.d.ts +2 -1
- package/es/built-in/index.mjs +3 -2
- package/es/collection-manager/collectionPlugin.mjs +36 -0
- package/es/collection-manager/interfaces/url.d.ts +4 -0
- package/es/collection-manager/interfaces/url.mjs +10 -1
- package/es/collection-manager/templates/sql.d.ts +3 -3
- package/es/collection-manager/templates/view.d.ts +3 -3
- package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
- package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
- package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
- package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
- package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
- package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
- package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
- package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
- package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
- package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
- package/es/schema-component/antd/association-field/hooks.mjs +52 -1
- package/es/schema-component/antd/input/Input.mjs +2 -1
- package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
- package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
- package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
- package/es/schema-component/antd/page/Page.mjs +46 -95
- package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
- package/es/schema-component/antd/page/hooks/index.mjs +1 -1
- package/es/schema-component/antd/page/index.d.ts +1 -0
- package/es/schema-component/antd/page/index.mjs +1 -0
- package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
- package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
- package/es/schema-component/antd/page/style.d.ts +0 -5
- package/es/schema-component/antd/page/style.mjs +1 -45
- package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
- package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
- package/es/schema-component/antd/select/Select.mjs +6 -1
- package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
- package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
- package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
- package/lib/application/Application.js +0 -8
- package/lib/application/components/index.js +0 -18
- package/lib/block-provider/hooks/index.js +1 -1
- package/lib/built-in/index.js +30 -4
- package/lib/collection-manager/collectionPlugin.js +36 -0
- package/lib/collection-manager/interfaces/url.js +10 -1
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
- package/lib/locale/zh-CN.js +1 -0
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
- package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
- package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
- package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
- package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
- package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
- package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
- package/lib/schema-component/antd/association-field/hooks.js +54 -0
- package/lib/schema-component/antd/input/Input.js +2 -1
- package/lib/schema-component/antd/input/ReadPretty.js +28 -0
- package/lib/schema-component/antd/page/Page.Settings.js +0 -33
- package/lib/schema-component/antd/page/Page.js +41 -90
- package/lib/schema-component/antd/page/hooks/index.js +5 -5
- package/lib/schema-component/antd/page/index.js +9 -0
- package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
- package/lib/schema-component/antd/page/style.js +2 -49
- package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
- package/lib/schema-component/antd/select/ReadPretty.js +15 -2
- package/lib/schema-component/antd/select/Select.js +6 -1
- package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
- package/lib/schema-settings/EditFormulaTitleField.js +19 -1
- package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
- package/package.json +7 -7
- package/es/application/components/SharePage.d.ts +0 -4
- package/es/application/components/SharePage.mjs +0 -113
- package/es/application/components/ShareSchemaComponent.d.ts +0 -1
- package/es/application/components/ShareSchemaComponent.mjs +0 -10
- package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
- package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
- package/lib/application/components/SharePage.js +0 -156
- package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { useCollectionManager_deprecated } from "../../../../collection-manager/index.mjs";
|
|
5
|
+
import { useDataSourceManager } from "../../../../data-source/index.mjs";
|
|
6
|
+
import { useCompile, useDesignable } from "../../../../schema-component/index.mjs";
|
|
5
7
|
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
6
8
|
const radioComponentFieldSettings = new SchemaSettings({
|
|
7
9
|
name: 'fieldSettings:component:Radio group',
|
|
@@ -10,7 +12,7 @@ const radioComponentFieldSettings = new SchemaSettings({
|
|
|
10
12
|
name: 'fieldComponent',
|
|
11
13
|
type: 'select',
|
|
12
14
|
useComponentProps () {
|
|
13
|
-
var _fieldSchema_xcomponentprops;
|
|
15
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions, _fieldSchema_xcomponentprops;
|
|
14
16
|
const { t } = useTranslation();
|
|
15
17
|
const field = useField();
|
|
16
18
|
const { fieldSchema: tableColumnSchema } = useColumnSchema();
|
|
@@ -26,7 +28,18 @@ const radioComponentFieldSettings = new SchemaSettings({
|
|
|
26
28
|
value: 'Radio group'
|
|
27
29
|
}
|
|
28
30
|
];
|
|
31
|
+
const dm = useDataSourceManager();
|
|
32
|
+
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
|
33
|
+
const collectionField = getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
34
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
35
|
+
const compile = useCompile();
|
|
29
36
|
const { dn } = useDesignable();
|
|
37
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
38
|
+
if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
|
|
39
|
+
label: compile(item.label),
|
|
40
|
+
value: item.value
|
|
41
|
+
});
|
|
42
|
+
});
|
|
30
43
|
return {
|
|
31
44
|
title: t('Field component'),
|
|
32
45
|
options: fieldModeOptions,
|
|
@@ -7,11 +7,11 @@ import { SchemaSettings } from "../../../../application/schema-settings/SchemaSe
|
|
|
7
7
|
import { useFormBlockContext } from "../../../../block-provider/index.mjs";
|
|
8
8
|
import { useCollectionManager_deprecated, useCollection_deprecated } from "../../../../collection-manager/index.mjs";
|
|
9
9
|
import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
|
|
10
|
-
import { useCollectionField } from "../../../../data-source/index.mjs";
|
|
10
|
+
import { useCollectionField, useDataSourceManager } from "../../../../data-source/index.mjs";
|
|
11
11
|
import { useRecord } from "../../../../record-provider/index.mjs";
|
|
12
|
-
import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
|
|
12
|
+
import { removeNullCondition, useCompile, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
|
|
13
13
|
import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
|
|
14
|
-
import { useIsAssociationField, useIsFieldReadPretty,
|
|
14
|
+
import { useIsAssociationField, useIsFieldReadPretty, useIsSelectFieldMode, useTitleFieldOptions } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
|
|
15
15
|
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
16
16
|
import { VariableInput, getShouldChange, useFormulaTitleOptions } from "../../../../schema-settings/index.mjs";
|
|
17
17
|
import { useIsShowMultipleSwitch } from "../../../../schema-settings/hooks/useIsShowMultipleSwitch.mjs";
|
|
@@ -271,6 +271,7 @@ const fieldComponent = {
|
|
|
271
271
|
name: 'fieldComponent',
|
|
272
272
|
type: 'select',
|
|
273
273
|
useComponentProps () {
|
|
274
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
|
|
274
275
|
const { t } = useTranslation();
|
|
275
276
|
const field = useField();
|
|
276
277
|
const collectionFieldCurrent = useCollectionField();
|
|
@@ -285,7 +286,8 @@ const fieldComponent = {
|
|
|
285
286
|
const fieldMode = useFieldComponentName();
|
|
286
287
|
const { dn } = useDesignable();
|
|
287
288
|
const isMuiltipleSelect = [
|
|
288
|
-
'select'
|
|
289
|
+
'select',
|
|
290
|
+
'multipleSelect'
|
|
289
291
|
].includes(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
290
292
|
const optionsMuiltipleSelect = [
|
|
291
293
|
{
|
|
@@ -297,9 +299,27 @@ const fieldComponent = {
|
|
|
297
299
|
value: 'Radio group'
|
|
298
300
|
}
|
|
299
301
|
];
|
|
302
|
+
if ((null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface) === 'multipleSelect') {
|
|
303
|
+
const index = optionsMuiltipleSelect.findIndex((item)=>'Radio group' === item.value);
|
|
304
|
+
optionsMuiltipleSelect.splice(index, 1);
|
|
305
|
+
}
|
|
306
|
+
const dm = useDataSourceManager();
|
|
307
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
308
|
+
const compile = useCompile();
|
|
309
|
+
if (fieldSchema['x-component-props']['multiple']) {
|
|
310
|
+
const index = fieldModeOptions.findIndex((item)=>'Radio group' === item.value);
|
|
311
|
+
fieldModeOptions.splice(index, 1);
|
|
312
|
+
}
|
|
313
|
+
const componentOptions = isMuiltipleSelect ? optionsMuiltipleSelect : fieldModeOptions;
|
|
314
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
315
|
+
if (!(null == componentOptions ? void 0 : componentOptions.find((modeItem)=>modeItem.value === item.value))) null == componentOptions || componentOptions.push({
|
|
316
|
+
label: compile(item.label),
|
|
317
|
+
value: item.value
|
|
318
|
+
});
|
|
319
|
+
});
|
|
300
320
|
return {
|
|
301
321
|
title: t('Field component'),
|
|
302
|
-
options:
|
|
322
|
+
options: componentOptions,
|
|
303
323
|
value: fieldMode,
|
|
304
324
|
onChange (mode) {
|
|
305
325
|
const schema = {
|
|
@@ -390,8 +410,7 @@ const selectComponentFieldSettings = new SchemaSettings({
|
|
|
390
410
|
name: 'fieldSettings:component:Select',
|
|
391
411
|
items: [
|
|
392
412
|
{
|
|
393
|
-
...fieldComponent
|
|
394
|
-
useVisible: useIsMuiltipleAble
|
|
413
|
+
...fieldComponent
|
|
395
414
|
},
|
|
396
415
|
{
|
|
397
416
|
...setTheDataScope,
|
|
@@ -11,9 +11,9 @@ import { FormProvider } from "../../core/index.mjs";
|
|
|
11
11
|
import { useCompile } from "../../hooks/index.mjs";
|
|
12
12
|
import { ActionContextProvider, useActionContext } from "../action/index.mjs";
|
|
13
13
|
import { EllipsisWithTooltip } from "../input/EllipsisWithTooltip.mjs";
|
|
14
|
-
import { useAssociationFieldContext, useFieldNames, useInsertSchema } from "./hooks.mjs";
|
|
14
|
+
import { useAssociationFieldContext, useCustomTitle, useFieldNames, useInsertSchema } from "./hooks.mjs";
|
|
15
15
|
import { transformNestedData } from "./InternalCascadeSelect.mjs";
|
|
16
|
-
import
|
|
16
|
+
import schema from "./schema.mjs";
|
|
17
17
|
import { getLabelFormatValue, useLabelUiSchemaV2 } from "./util.mjs";
|
|
18
18
|
const toValue = (value, placeholder)=>{
|
|
19
19
|
if (null == value) return placeholder;
|
|
@@ -41,7 +41,7 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
41
41
|
const isTreeCollection = (null == targetCollection ? void 0 : targetCollection.template) === 'tree';
|
|
42
42
|
const ellipsisWithTooltipRef = useRef();
|
|
43
43
|
const getLabelUiSchema = useLabelUiSchemaV2();
|
|
44
|
-
const { formulaRecord, fieldNames } =
|
|
44
|
+
const { formulaRecord, fieldNames } = useCustomTitle(recordCtx, fieldSchema, defFieldNames);
|
|
45
45
|
const renderRecords = ()=>toArr(formulaRecord[fieldSchema['name']] || props.value).map((record, index, arr)=>{
|
|
46
46
|
var _getCollection_options, _getCollection, _targetCollection_fieldsMap_, _targetCollection_fieldsMap, _getCollection_options1, _getCollection1, _targetCollection_fieldsMap_1, _targetCollection_fieldsMap1;
|
|
47
47
|
const value = null == record ? void 0 : record[(null == fieldNames ? void 0 : fieldNames.label) || 'label'];
|
|
@@ -57,7 +57,7 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
57
57
|
var _ellipsisWithTooltipRef_current;
|
|
58
58
|
e.stopPropagation();
|
|
59
59
|
e.preventDefault();
|
|
60
|
-
if (designable) insertViewer(
|
|
60
|
+
if (designable) insertViewer(schema.Viewer);
|
|
61
61
|
setVisible(true);
|
|
62
62
|
setRecord(record);
|
|
63
63
|
null == ellipsisWithTooltipRef || null == (_ellipsisWithTooltipRef_current = ellipsisWithTooltipRef.current) || _ellipsisWithTooltipRef_current.setPopoverVisible(false);
|
|
@@ -134,58 +134,4 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
134
134
|
}, {
|
|
135
135
|
displayName: 'ReadPrettyInternalViewer'
|
|
136
136
|
});
|
|
137
|
-
const customTitle = (record, schema, fieldNames)=>{
|
|
138
|
-
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
139
|
-
if ((null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null == (_schema_xcomponentprops1 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
140
|
-
var _schema_xcomponentprops_fieldNames1, _schema_xcomponentprops2;
|
|
141
|
-
const regex = /{{(.*?)}}/g;
|
|
142
|
-
const valueOject = {};
|
|
143
|
-
let outputStr = '';
|
|
144
|
-
let match;
|
|
145
|
-
const formula = null == (_schema_xcomponentprops2 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames1 = _schema_xcomponentprops2.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames1.formula;
|
|
146
|
-
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
147
|
-
const fieldList = [
|
|
148
|
-
schema.name
|
|
149
|
-
];
|
|
150
|
-
fieldList.push(...match[1].split('.'));
|
|
151
|
-
const result = {
|
|
152
|
-
currRecord: record,
|
|
153
|
-
value: ''
|
|
154
|
-
};
|
|
155
|
-
fieldList.forEach((value, index)=>{
|
|
156
|
-
var _result_currRecord;
|
|
157
|
-
if (fieldList.length - 1 !== index) {
|
|
158
|
-
var _result_currRecord1;
|
|
159
|
-
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
163
|
-
});
|
|
164
|
-
var _result_value;
|
|
165
|
-
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
166
|
-
} else {
|
|
167
|
-
var _record_schema_name;
|
|
168
|
-
valueOject[match[1]] = (null == (_record_schema_name = record[schema['name']]) ? void 0 : _record_schema_name[match[1]]) || '';
|
|
169
|
-
}
|
|
170
|
-
outputStr = replacePlaceholders(formula, valueOject);
|
|
171
|
-
record[schema['name']] = {
|
|
172
|
-
...record[schema['name']],
|
|
173
|
-
customLabel: outputStr
|
|
174
|
-
};
|
|
175
|
-
return {
|
|
176
|
-
formulaRecord: record,
|
|
177
|
-
fieldNames: {
|
|
178
|
-
...fieldNames,
|
|
179
|
-
label: 'customLabel'
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
formulaRecord: record,
|
|
185
|
-
fieldNames
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
189
|
-
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
190
|
-
});
|
|
191
137
|
export { ReadPrettyInternalViewer, isObject };
|
|
@@ -147,4 +147,55 @@ const useSubFormValue = ()=>{
|
|
|
147
147
|
collection
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
const useCustomTitle = (record, schema, fieldNames)=>{
|
|
151
|
+
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
152
|
+
if ((null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null == (_schema_xcomponentprops1 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
153
|
+
if (Array.isArray(record[schema['name']])) record[schema['name']].forEach((recordItem)=>{
|
|
154
|
+
recordItem['customLabel'] = getCustomLabel(recordItem, schema);
|
|
155
|
+
});
|
|
156
|
+
else record[schema['name']]['customLabel'] = getCustomLabel(record[schema['name']], schema);
|
|
157
|
+
return {
|
|
158
|
+
formulaRecord: record,
|
|
159
|
+
fieldNames: {
|
|
160
|
+
...fieldNames,
|
|
161
|
+
label: 'customLabel'
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
formulaRecord: record,
|
|
167
|
+
fieldNames
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const getCustomLabel = (record, schema)=>{
|
|
171
|
+
var _schema_xcomponentprops_fieldNames, _schema_xcomponentprops;
|
|
172
|
+
const regex = /{{(.*?)}}/g;
|
|
173
|
+
const valueOject = {};
|
|
174
|
+
let outputStr = '';
|
|
175
|
+
let match;
|
|
176
|
+
const formula = null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula;
|
|
177
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
178
|
+
const fieldList = match[1].split('.');
|
|
179
|
+
const result = {
|
|
180
|
+
currRecord: record,
|
|
181
|
+
value: ''
|
|
182
|
+
};
|
|
183
|
+
fieldList.forEach((value, index)=>{
|
|
184
|
+
var _result_currRecord;
|
|
185
|
+
if (fieldList.length - 1 !== index) {
|
|
186
|
+
var _result_currRecord1;
|
|
187
|
+
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
191
|
+
});
|
|
192
|
+
var _result_value;
|
|
193
|
+
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
194
|
+
} else valueOject[match[1]] = record[match[1]] || '';
|
|
195
|
+
outputStr = replacePlaceholders(formula, valueOject);
|
|
196
|
+
return outputStr;
|
|
197
|
+
};
|
|
198
|
+
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
199
|
+
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
200
|
+
});
|
|
201
|
+
export { SubFormProvider, useServiceOptions as default, useAssociationFieldContext, useCustomTitle, useFieldNames, useInsertSchema, useSubFormValue };
|
|
@@ -20,7 +20,8 @@ const Input_Input = Object.assign(connect(Input, mapProps((props, field)=>({
|
|
|
20
20
|
})), mapReadPretty(ReadPretty.TextArea)),
|
|
21
21
|
URL: connect(Input, mapReadPretty(ReadPretty.URL)),
|
|
22
22
|
JSON: connect(Json, mapReadPretty(ReadPretty.JSON)),
|
|
23
|
-
ReadPretty: ReadPretty.Input
|
|
23
|
+
ReadPretty: ReadPretty.Input,
|
|
24
|
+
Preview: ReadPretty.Preview
|
|
24
25
|
});
|
|
25
26
|
const input_Input = Input_Input;
|
|
26
27
|
export { Input_Input as Input, ReadPretty as InputReadPretty, input_Input as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { usePrefixCls } from "@tachybase/components";
|
|
4
|
+
import { useFieldSchema } from "@tachybase/schema";
|
|
4
5
|
import { css } from "@emotion/css";
|
|
5
|
-
import { Typography } from "antd";
|
|
6
|
+
import { Image, Typography } from "antd";
|
|
6
7
|
import classnames from "classnames";
|
|
7
8
|
import { useCompile } from "../../index.mjs";
|
|
8
9
|
import { EllipsisWithTooltip } from "./EllipsisWithTooltip.mjs";
|
|
@@ -151,9 +152,36 @@ const _JSON = (props)=>{
|
|
|
151
152
|
children: null != props.value ? JSON.stringify(props.value, null, null != (_props_space = props.space) ? _props_space : 2) : ''
|
|
152
153
|
});
|
|
153
154
|
};
|
|
155
|
+
const sizes = {
|
|
156
|
+
small: 24,
|
|
157
|
+
middle: 48,
|
|
158
|
+
large: 72,
|
|
159
|
+
oversized: 120
|
|
160
|
+
};
|
|
161
|
+
const _Preview = (props)=>{
|
|
162
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
163
|
+
const fieldSchema = useFieldSchema();
|
|
164
|
+
const size = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['size']) || 'small';
|
|
165
|
+
const objectFit = (null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['objectFit']) || 'cover';
|
|
166
|
+
if (!props.value) return props.value;
|
|
167
|
+
return /*#__PURE__*/ jsx(Image, {
|
|
168
|
+
style: [
|
|
169
|
+
'small',
|
|
170
|
+
'middle',
|
|
171
|
+
'large',
|
|
172
|
+
'oversized'
|
|
173
|
+
].includes(size) ? {
|
|
174
|
+
width: sizes[size],
|
|
175
|
+
height: sizes[size],
|
|
176
|
+
objectFit
|
|
177
|
+
} : {},
|
|
178
|
+
src: props.value
|
|
179
|
+
});
|
|
180
|
+
};
|
|
154
181
|
ReadPretty.Input = _Input;
|
|
155
182
|
ReadPretty.TextArea = _TextArea;
|
|
156
183
|
ReadPretty.URL = _URL;
|
|
157
184
|
ReadPretty.Html = _Html;
|
|
158
185
|
ReadPretty.JSON = _JSON;
|
|
186
|
+
ReadPretty.Preview = _Preview;
|
|
159
187
|
export { ReadPretty };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useMatch } from "react-router";
|
|
4
3
|
import { useDesignable } from "../../index.mjs";
|
|
5
4
|
import { SchemaSettings } from "../../../application/schema-settings/index.mjs";
|
|
6
5
|
import { useSchemaToolbar } from "../../../application/schema-toolbar/index.mjs";
|
|
@@ -37,38 +36,6 @@ const pageSettings = new SchemaSettings({
|
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
},
|
|
40
|
-
{
|
|
41
|
-
name: 'enablesharePage',
|
|
42
|
-
type: 'switch',
|
|
43
|
-
useVisible () {
|
|
44
|
-
const isShare = useMatch('/share/:name');
|
|
45
|
-
return !isShare;
|
|
46
|
-
},
|
|
47
|
-
useComponentProps () {
|
|
48
|
-
var _fieldSchema_xcomponentprops;
|
|
49
|
-
const { dn } = useDesignable();
|
|
50
|
-
const { t } = useTranslation();
|
|
51
|
-
const fieldSchema = useFieldSchema();
|
|
52
|
-
const { title } = useSchemaToolbar();
|
|
53
|
-
return {
|
|
54
|
-
title: t('Enable Share page'),
|
|
55
|
-
checked: null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.enableSharePage,
|
|
56
|
-
onChange (v) {
|
|
57
|
-
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
58
|
-
fieldSchema['x-component-props']['enableSharePage'] = v;
|
|
59
|
-
if (!fieldSchema.title) fieldSchema.title = title;
|
|
60
|
-
dn.emit('patch', {
|
|
61
|
-
schema: {
|
|
62
|
-
['x-uid']: fieldSchema['x-uid'],
|
|
63
|
-
['x-component-props']: fieldSchema['x-component-props'],
|
|
64
|
-
title: fieldSchema.title
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
dn.refresh();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
39
|
{
|
|
73
40
|
name: 'divider',
|
|
74
41
|
type: 'divider',
|
|
@@ -2,16 +2,16 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext, useEffect, useMemo, useState } from "react";
|
|
3
3
|
import { FormLayout } from "@tachybase/components";
|
|
4
4
|
import { Schema, SchemaOptionsContext, useFieldSchema } from "@tachybase/schema";
|
|
5
|
-
import { PlusOutlined
|
|
5
|
+
import { PlusOutlined } from "@ant-design/icons";
|
|
6
6
|
import { PageHeader } from "@ant-design/pro-layout";
|
|
7
7
|
import { PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
|
|
8
|
-
import { Button,
|
|
8
|
+
import { Button, Tabs } from "antd";
|
|
9
9
|
import { cx } from "antd-style";
|
|
10
10
|
import classnames from "classnames";
|
|
11
11
|
import { ErrorBoundary } from "react-error-boundary";
|
|
12
12
|
import { useTranslation } from "react-i18next";
|
|
13
|
-
import {
|
|
14
|
-
import { FormDialog, ScrollArea } from "../index.mjs";
|
|
13
|
+
import { useSearchParams } from "react-router-dom";
|
|
14
|
+
import { FormDialog, PageExtendComponentProvider, ScrollArea } from "../index.mjs";
|
|
15
15
|
import { useToken } from "../__builtins__/index.mjs";
|
|
16
16
|
import { useStyles } from "../../../built-in/acl/style.mjs";
|
|
17
17
|
import { useContextMenu } from "../../../built-in/context-menu/useContextMenu.mjs";
|
|
@@ -27,11 +27,10 @@ import { SchemaComponent, SchemaComponentOptions } from "../../core/index.mjs";
|
|
|
27
27
|
import { useCompile, useDesignable } from "../../hooks/index.mjs";
|
|
28
28
|
import { ErrorFallback } from "../error-fallback/index.mjs";
|
|
29
29
|
import FixedBlock from "./FixedBlock.mjs";
|
|
30
|
-
import { useShareActions } from "./hooks/useShareActions.mjs";
|
|
31
30
|
import { useStyles as external_Page_style_mjs_useStyles } from "./Page.style.mjs";
|
|
32
31
|
import { PageDesigner } from "./PageDesigner.mjs";
|
|
33
32
|
import { PageTabDesigner } from "./PageTabDesigner.mjs";
|
|
34
|
-
import { getStyles
|
|
33
|
+
import { getStyles } from "./style.mjs";
|
|
35
34
|
const Page = (props)=>{
|
|
36
35
|
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
|
|
37
36
|
const { children, ...others } = props;
|
|
@@ -89,29 +88,21 @@ const Page = (props)=>{
|
|
|
89
88
|
}));
|
|
90
89
|
};
|
|
91
90
|
const Page_PageHeader = (props)=>{
|
|
92
|
-
var _fieldSchema_xcomponentprops;
|
|
91
|
+
var _fieldSchema_xcomponentprops, _Object_values, _Object_values1;
|
|
93
92
|
const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
|
|
94
93
|
const { theme } = useGlobalTheme();
|
|
95
94
|
const options = useContext(SchemaOptionsContext);
|
|
96
95
|
const compile = useCompile();
|
|
97
|
-
const [open, setOpen] = useState(false);
|
|
98
|
-
const [imageOpen, setImageOpen] = useState(false);
|
|
99
96
|
const { showScrollArea } = useContextMenu();
|
|
100
97
|
const hidePageTitle = null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
|
|
98
|
+
const extendComponents = fieldSchema['x-extend-components'] || {};
|
|
101
99
|
const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
|
|
102
|
-
const isShare = useMatch('/share/:name');
|
|
103
100
|
const items = fieldSchema.mapProperties((schema)=>({
|
|
104
101
|
key: schema.name,
|
|
105
102
|
label: /*#__PURE__*/ jsx(TabItem, {
|
|
106
103
|
schema: schema
|
|
107
104
|
})
|
|
108
105
|
}));
|
|
109
|
-
const { t } = useTranslation();
|
|
110
|
-
const { styles } = external_style_mjs_useStyles();
|
|
111
|
-
const { copyLink, imageAction } = useShareActions({
|
|
112
|
-
title: pageHeaderTitle,
|
|
113
|
-
uid: ''
|
|
114
|
-
});
|
|
115
106
|
return /*#__PURE__*/ jsxs("div", {
|
|
116
107
|
ref: (ref)=>{
|
|
117
108
|
setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
|
|
@@ -123,12 +114,29 @@ const Page_PageHeader = (props)=>{
|
|
|
123
114
|
ghost: false,
|
|
124
115
|
title: pageHeaderTitle || ' ',
|
|
125
116
|
...parentProps,
|
|
126
|
-
extra: /*#__PURE__*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
117
|
+
extra: /*#__PURE__*/ jsxs(Fragment, {
|
|
118
|
+
children: [
|
|
119
|
+
null == (_Object_values = Object.values(extendComponents)) ? void 0 : _Object_values.map((item, index)=>{
|
|
120
|
+
const schema = {
|
|
121
|
+
type: 'void',
|
|
122
|
+
name: item.name,
|
|
123
|
+
'x-component': item.component,
|
|
124
|
+
'x-component-props': {}
|
|
125
|
+
};
|
|
126
|
+
const componentProps = {
|
|
127
|
+
...props,
|
|
128
|
+
isExtra: true,
|
|
129
|
+
fieldSchema
|
|
130
|
+
};
|
|
131
|
+
return /*#__PURE__*/ jsx(PageExtendComponentProvider, {
|
|
132
|
+
...componentProps,
|
|
133
|
+
children: /*#__PURE__*/ jsx(SchemaComponent, {
|
|
134
|
+
schema: schema
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}),
|
|
138
|
+
!enablePageTabs && showScrollArea && /*#__PURE__*/ jsx(ScrollArea, {})
|
|
139
|
+
]
|
|
132
140
|
}),
|
|
133
141
|
footer: enablePageTabs && /*#__PURE__*/ jsx(TabComponent, {
|
|
134
142
|
activeKey: activeKey,
|
|
@@ -140,84 +148,27 @@ const Page_PageHeader = (props)=>{
|
|
|
140
148
|
items: items
|
|
141
149
|
})
|
|
142
150
|
}),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
width: 500,
|
|
159
|
-
onCancel: ()=>{
|
|
160
|
-
setOpen(false);
|
|
161
|
-
},
|
|
162
|
-
children: [
|
|
163
|
-
/*#__PURE__*/ jsxs("div", {
|
|
164
|
-
className: styles.secondmodal,
|
|
165
|
-
children: [
|
|
166
|
-
/*#__PURE__*/ jsxs("div", {
|
|
167
|
-
className: "tb-header-modal-list",
|
|
168
|
-
onClick: copyLink,
|
|
169
|
-
children: [
|
|
170
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
171
|
-
type: "PaperClipOutlined"
|
|
172
|
-
}),
|
|
173
|
-
t('Copy link')
|
|
174
|
-
]
|
|
175
|
-
}),
|
|
176
|
-
/*#__PURE__*/ jsxs("div", {
|
|
177
|
-
className: "tb-header-modal-list",
|
|
178
|
-
onClick: ()=>{
|
|
179
|
-
setImageOpen(true);
|
|
180
|
-
},
|
|
181
|
-
children: [
|
|
182
|
-
/*#__PURE__*/ jsx(Icon, {
|
|
183
|
-
type: "QrcodeOutlined"
|
|
184
|
-
}),
|
|
185
|
-
t('Generate QR code')
|
|
186
|
-
]
|
|
187
|
-
})
|
|
188
|
-
]
|
|
189
|
-
}),
|
|
190
|
-
/*#__PURE__*/ jsx(Modal, {
|
|
191
|
-
className: styles.imageModal,
|
|
192
|
-
open: imageOpen,
|
|
193
|
-
footer: null,
|
|
194
|
-
onCancel: ()=>{
|
|
195
|
-
setImageOpen(false);
|
|
196
|
-
},
|
|
197
|
-
children: imageAction()
|
|
151
|
+
null == (_Object_values1 = Object.values(extendComponents)) ? void 0 : _Object_values1.map((item, index)=>{
|
|
152
|
+
const schema = {
|
|
153
|
+
type: 'void',
|
|
154
|
+
name: 'icon' + item.name,
|
|
155
|
+
'x-component': item.component,
|
|
156
|
+
'x-component-props': {}
|
|
157
|
+
};
|
|
158
|
+
const componentProps = {
|
|
159
|
+
...props,
|
|
160
|
+
fieldSchema
|
|
161
|
+
};
|
|
162
|
+
return /*#__PURE__*/ jsx(PageExtendComponentProvider, {
|
|
163
|
+
...componentProps,
|
|
164
|
+
children: /*#__PURE__*/ jsx(SchemaComponent, {
|
|
165
|
+
schema: schema
|
|
198
166
|
})
|
|
199
|
-
|
|
167
|
+
});
|
|
200
168
|
})
|
|
201
169
|
]
|
|
202
170
|
});
|
|
203
171
|
};
|
|
204
|
-
const HeaderExtra = (param)=>{
|
|
205
|
-
let { enablePageTabs, showScrollArea, isShare, setOpen, enableSharePage } = param;
|
|
206
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
207
|
-
children: [
|
|
208
|
-
!isShare && /*#__PURE__*/ jsx(Button, {
|
|
209
|
-
icon: /*#__PURE__*/ jsx(ShareAltOutlined, {}),
|
|
210
|
-
onClick: ()=>{
|
|
211
|
-
setOpen(true);
|
|
212
|
-
},
|
|
213
|
-
style: {
|
|
214
|
-
visibility: "".concat(enableSharePage ? 'visible' : 'hidden')
|
|
215
|
-
}
|
|
216
|
-
}),
|
|
217
|
-
!enablePageTabs && showScrollArea && /*#__PURE__*/ jsx(ScrollArea, {})
|
|
218
|
-
]
|
|
219
|
-
});
|
|
220
|
-
};
|
|
221
172
|
const TabComponent = (props)=>{
|
|
222
173
|
const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
|
|
223
174
|
const { styles } = external_Page_style_mjs_useStyles();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './useIsBlockInPage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./useIsBlockInPage.mjs";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const PageExtendComponentContext = /*#__PURE__*/ createContext({});
|
|
4
|
+
const PageExtendComponentProvider = (props)=>/*#__PURE__*/ jsx(PageExtendComponentContext.Provider, {
|
|
5
|
+
value: props,
|
|
6
|
+
children: props.children
|
|
7
|
+
});
|
|
8
|
+
const usePageExtendComponentContext = ()=>useContext(PageExtendComponentContext);
|
|
9
|
+
export { PageExtendComponentContext, PageExtendComponentProvider, usePageExtendComponentContext };
|
|
@@ -1,6 +1 @@
|
|
|
1
1
|
export declare const getStyles: (props?: any) => import("./../__builtins__").UseComponentStyleResult;
|
|
2
|
-
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
3
|
-
firstmodal: import("antd-style").SerializedStyles;
|
|
4
|
-
secondmodal: import("antd-style").SerializedStyles;
|
|
5
|
-
imageModal: import("antd-style").SerializedStyles;
|
|
6
|
-
}>;
|