@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
|
@@ -26,7 +26,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
CustomTitleComponentFieldSettings: ()=>CustomTitleComponentFieldSettings
|
|
28
28
|
});
|
|
29
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
30
|
+
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
29
31
|
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
|
|
32
|
+
const useFieldComponentName_js_namespaceObject = require("../../../../common/useFieldComponentName.js");
|
|
33
|
+
const index_js_namespaceObject = require("../../../../data-source/index.js");
|
|
34
|
+
const external_schema_component_index_js_namespaceObject = require("../../../../schema-component/index.js");
|
|
35
|
+
const util_js_namespaceObject = require("../../../../schema-component/antd/association-field/util.js");
|
|
30
36
|
const FormItem_Settings_js_namespaceObject = require("../../../../schema-component/antd/form-item/FormItem.Settings.js");
|
|
31
37
|
const Table_Column_Decorator_js_namespaceObject = require("../../../../schema-component/antd/table-v2/Table.Column.Decorator.js");
|
|
32
38
|
const useIsShowMultipleSwitch_js_namespaceObject = require("../../../../schema-settings/hooks/useIsShowMultipleSwitch.js");
|
|
@@ -35,12 +41,96 @@ const CustomTitleComponentFieldSettings = new SchemaSettings_js_namespaceObject.
|
|
|
35
41
|
name: 'fieldSettings:component:CustomTitle',
|
|
36
42
|
items: [
|
|
37
43
|
{
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
name: 'fieldComponent',
|
|
45
|
+
type: 'select',
|
|
46
|
+
useComponentProps () {
|
|
47
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
|
|
48
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
49
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
50
|
+
const collectionFieldCurrent = (0, index_js_namespaceObject.useCollectionField)();
|
|
51
|
+
const { fieldSchema: tableColumnSchema, collectionField } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
|
|
52
|
+
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
53
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
54
|
+
const fieldModeOptions = (0, external_schema_component_index_js_namespaceObject.useFieldModeOptions)({
|
|
55
|
+
fieldSchema: tableColumnSchema,
|
|
56
|
+
collectionField
|
|
57
|
+
});
|
|
58
|
+
const isAddNewForm = (0, external_schema_component_index_js_namespaceObject.useIsAddNewForm)();
|
|
59
|
+
const fieldMode = (0, useFieldComponentName_js_namespaceObject.useFieldComponentName)();
|
|
60
|
+
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
61
|
+
const isSelect = [
|
|
62
|
+
'select',
|
|
63
|
+
'multipleSelect'
|
|
64
|
+
].includes(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
65
|
+
const optionsMuiltipleSelect = [
|
|
66
|
+
{
|
|
67
|
+
label: t('Select'),
|
|
68
|
+
value: 'Select'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: t('Radio group'),
|
|
72
|
+
value: 'Radio group'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: t('Custom Title'),
|
|
76
|
+
value: 'CustomTitle'
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
if ((null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface) === 'multipleSelect') {
|
|
80
|
+
const index = optionsMuiltipleSelect.findIndex((item)=>{
|
|
81
|
+
if ('Select' === item.value) item.value = 'multiple';
|
|
82
|
+
return 'Radio group' === item.value;
|
|
83
|
+
});
|
|
84
|
+
optionsMuiltipleSelect.splice(index, 1);
|
|
85
|
+
}
|
|
86
|
+
const dm = (0, index_js_namespaceObject.useDataSourceManager)();
|
|
87
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
88
|
+
const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
|
|
89
|
+
const componentOptions = isSelect ? optionsMuiltipleSelect : fieldModeOptions;
|
|
90
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
91
|
+
if (!(null == componentOptions ? void 0 : componentOptions.find((modeItem)=>modeItem.value === item.value))) null == componentOptions || componentOptions.push({
|
|
92
|
+
label: compile(item.label),
|
|
93
|
+
value: item.value
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
return {
|
|
97
|
+
title: t('Field component'),
|
|
98
|
+
options: componentOptions,
|
|
99
|
+
value: fieldMode,
|
|
100
|
+
onChange (mode) {
|
|
101
|
+
const schema = {
|
|
102
|
+
['x-uid']: fieldSchema['x-uid']
|
|
103
|
+
};
|
|
104
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
105
|
+
fieldSchema['x-component-props']['mode'] = mode;
|
|
106
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
107
|
+
field.componentProps = field.componentProps || {};
|
|
108
|
+
field.componentProps.mode = mode;
|
|
109
|
+
if ((0, util_js_namespaceObject.isSubMode)(fieldSchema) && isAddNewForm) {
|
|
110
|
+
var _field_setInitialValue, _field_setValue;
|
|
111
|
+
schema.default = null;
|
|
112
|
+
fieldSchema.default = null;
|
|
113
|
+
null == field || null == (_field_setInitialValue = field.setInitialValue) || _field_setInitialValue.call(field, null);
|
|
114
|
+
null == field || null == (_field_setValue = field.setValue) || _field_setValue.call(field, null);
|
|
115
|
+
}
|
|
116
|
+
dn.emit('patch', {
|
|
117
|
+
schema
|
|
118
|
+
});
|
|
119
|
+
dn.refresh();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
useVisible () {
|
|
124
|
+
const fieldMode = (0, useFieldComponentName_js_namespaceObject.useFieldComponentName)();
|
|
125
|
+
return 'CustomTitle' === fieldMode;
|
|
126
|
+
}
|
|
40
127
|
},
|
|
41
128
|
{
|
|
42
129
|
...selectComponentFieldSettings_js_namespaceObject.CustomTitle,
|
|
43
|
-
useVisible
|
|
130
|
+
useVisible () {
|
|
131
|
+
const fieldMode = (0, useFieldComponentName_js_namespaceObject.useFieldComponentName)();
|
|
132
|
+
return 'CustomTitle' === fieldMode;
|
|
133
|
+
}
|
|
44
134
|
},
|
|
45
135
|
{
|
|
46
136
|
...selectComponentFieldSettings_js_namespaceObject.setTheDataScope,
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (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 = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
inputPreviewComponentFieldSettings: ()=>inputPreviewComponentFieldSettings
|
|
28
|
+
});
|
|
29
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
30
|
+
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
31
|
+
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
|
|
32
|
+
const index_js_namespaceObject = require("../../../../schema-component/index.js");
|
|
33
|
+
const createSettingsItem = (config)=>({
|
|
34
|
+
name: config.name,
|
|
35
|
+
type: 'select',
|
|
36
|
+
useComponentProps () {
|
|
37
|
+
var _fieldSchema_xcomponentprops;
|
|
38
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
39
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
40
|
+
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
41
|
+
const { fieldSchema: tableColumnSchema } = (0, index_js_namespaceObject.useColumnSchema)();
|
|
42
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
43
|
+
const { dn } = (0, index_js_namespaceObject.useDesignable)();
|
|
44
|
+
return {
|
|
45
|
+
title: t(config.title),
|
|
46
|
+
options: config.options(t),
|
|
47
|
+
value: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops[config.name]) || config.defaultValue,
|
|
48
|
+
onChange (value) {
|
|
49
|
+
const schema = {
|
|
50
|
+
['x-uid']: fieldSchema['x-uid']
|
|
51
|
+
};
|
|
52
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
53
|
+
fieldSchema['x-component-props'][config.name] = value;
|
|
54
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
55
|
+
field.componentProps = field.componentProps || {};
|
|
56
|
+
field.componentProps[config.name] = value;
|
|
57
|
+
dn.emit('patch', {
|
|
58
|
+
schema
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const getSizeOptions = (t)=>[
|
|
65
|
+
{
|
|
66
|
+
value: 'small',
|
|
67
|
+
label: t('Small')
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: 'middle',
|
|
71
|
+
label: t('Middle')
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: 'large',
|
|
75
|
+
label: t('Large')
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
value: 'oversized',
|
|
79
|
+
label: t('Oversized')
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
value: 'auto',
|
|
83
|
+
label: t('Auto')
|
|
84
|
+
}
|
|
85
|
+
];
|
|
86
|
+
const getObjectFitOptions = (t)=>[
|
|
87
|
+
{
|
|
88
|
+
value: 'cover',
|
|
89
|
+
label: t('Cover')
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
value: 'fill',
|
|
93
|
+
label: t('Fill')
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
value: 'contain',
|
|
97
|
+
label: t('Contain')
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: 'scale-down',
|
|
101
|
+
label: t('Scale Down')
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
value: 'none',
|
|
105
|
+
label: t('None')
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
const size = createSettingsItem({
|
|
109
|
+
name: 'size',
|
|
110
|
+
title: 'Size',
|
|
111
|
+
options: getSizeOptions,
|
|
112
|
+
defaultValue: 'small'
|
|
113
|
+
});
|
|
114
|
+
const objectFit = createSettingsItem({
|
|
115
|
+
name: 'objectFit',
|
|
116
|
+
title: 'Object Fit',
|
|
117
|
+
options: getObjectFitOptions,
|
|
118
|
+
defaultValue: 'cover'
|
|
119
|
+
});
|
|
120
|
+
const inputPreviewComponentFieldSettings = new SchemaSettings_js_namespaceObject.SchemaSettings({
|
|
121
|
+
name: 'fieldSettings:component:Input.Preview',
|
|
122
|
+
items: [
|
|
123
|
+
size,
|
|
124
|
+
objectFit
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
exports.inputPreviewComponentFieldSettings = __webpack_exports__.inputPreviewComponentFieldSettings;
|
|
128
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
129
|
+
"inputPreviewComponentFieldSettings"
|
|
130
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
131
|
+
Object.defineProperty(exports, '__esModule', {
|
|
132
|
+
value: true
|
|
133
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (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 = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
multipleComponentFieldSettings: ()=>multipleComponentFieldSettings
|
|
28
|
+
});
|
|
29
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
30
|
+
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
31
|
+
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
|
|
32
|
+
const index_js_namespaceObject = require("../../../../collection-manager/index.js");
|
|
33
|
+
const external_data_source_index_js_namespaceObject = require("../../../../data-source/index.js");
|
|
34
|
+
const external_schema_component_index_js_namespaceObject = require("../../../../schema-component/index.js");
|
|
35
|
+
const Table_Column_Decorator_js_namespaceObject = require("../../../../schema-component/antd/table-v2/Table.Column.Decorator.js");
|
|
36
|
+
const multipleComponentFieldSettings = new SchemaSettings_js_namespaceObject.SchemaSettings({
|
|
37
|
+
name: 'fieldSettings:component:multiple',
|
|
38
|
+
items: [
|
|
39
|
+
{
|
|
40
|
+
name: 'fieldComponent',
|
|
41
|
+
type: 'select',
|
|
42
|
+
useComponentProps () {
|
|
43
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions, _fieldSchema_xcomponentprops;
|
|
44
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
45
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
46
|
+
const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
|
|
47
|
+
const { getCollectionJoinField } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
48
|
+
const dm = (0, external_data_source_index_js_namespaceObject.useDataSourceManager)();
|
|
49
|
+
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
50
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
51
|
+
const collectionField = getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
52
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
53
|
+
const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
|
|
54
|
+
const fieldModeOptions = [
|
|
55
|
+
{
|
|
56
|
+
label: t('Select'),
|
|
57
|
+
value: 'multiple'
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
61
|
+
if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
|
|
62
|
+
label: compile(item.label),
|
|
63
|
+
value: item.value
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
67
|
+
return {
|
|
68
|
+
title: t('Field component'),
|
|
69
|
+
options: fieldModeOptions,
|
|
70
|
+
value: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.mode) || 'multiple',
|
|
71
|
+
onChange (mode) {
|
|
72
|
+
const schema = {
|
|
73
|
+
['x-uid']: fieldSchema['x-uid']
|
|
74
|
+
};
|
|
75
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
76
|
+
fieldSchema['x-component-props']['mode'] = mode;
|
|
77
|
+
fieldSchema['x-component-props']['multiple'] = true;
|
|
78
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
79
|
+
field.componentProps = field.componentProps || {};
|
|
80
|
+
field.componentProps.mode = mode;
|
|
81
|
+
field.componentProps.multiple = true;
|
|
82
|
+
dn.emit('patch', {
|
|
83
|
+
schema
|
|
84
|
+
});
|
|
85
|
+
dn.refresh();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
exports.multipleComponentFieldSettings = __webpack_exports__.multipleComponentFieldSettings;
|
|
93
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
94
|
+
"multipleComponentFieldSettings"
|
|
95
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
96
|
+
Object.defineProperty(exports, '__esModule', {
|
|
97
|
+
value: true
|
|
98
|
+
});
|
|
@@ -29,7 +29,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
30
30
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
31
31
|
const SchemaSettings_js_namespaceObject = require("../../../../application/schema-settings/SchemaSettings.js");
|
|
32
|
-
const index_js_namespaceObject = require("../../../../
|
|
32
|
+
const index_js_namespaceObject = require("../../../../collection-manager/index.js");
|
|
33
|
+
const external_data_source_index_js_namespaceObject = require("../../../../data-source/index.js");
|
|
34
|
+
const external_schema_component_index_js_namespaceObject = require("../../../../schema-component/index.js");
|
|
33
35
|
const Table_Column_Decorator_js_namespaceObject = require("../../../../schema-component/antd/table-v2/Table.Column.Decorator.js");
|
|
34
36
|
const radioComponentFieldSettings = new SchemaSettings_js_namespaceObject.SchemaSettings({
|
|
35
37
|
name: 'fieldSettings:component:Radio group',
|
|
@@ -38,7 +40,7 @@ const radioComponentFieldSettings = new SchemaSettings_js_namespaceObject.Schema
|
|
|
38
40
|
name: 'fieldComponent',
|
|
39
41
|
type: 'select',
|
|
40
42
|
useComponentProps () {
|
|
41
|
-
var _fieldSchema_xcomponentprops;
|
|
43
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions, _fieldSchema_xcomponentprops;
|
|
42
44
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
43
45
|
const field = (0, schema_namespaceObject.useField)();
|
|
44
46
|
const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
|
|
@@ -54,7 +56,18 @@ const radioComponentFieldSettings = new SchemaSettings_js_namespaceObject.Schema
|
|
|
54
56
|
value: 'Radio group'
|
|
55
57
|
}
|
|
56
58
|
];
|
|
57
|
-
const
|
|
59
|
+
const dm = (0, external_data_source_index_js_namespaceObject.useDataSourceManager)();
|
|
60
|
+
const { getCollectionJoinField } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
61
|
+
const collectionField = getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
62
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
63
|
+
const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
|
|
64
|
+
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
65
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
66
|
+
if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
|
|
67
|
+
label: compile(item.label),
|
|
68
|
+
value: item.value
|
|
69
|
+
});
|
|
70
|
+
});
|
|
58
71
|
return {
|
|
59
72
|
title: t('Field component'),
|
|
60
73
|
options: fieldModeOptions,
|
|
@@ -317,6 +317,7 @@ const fieldComponent = {
|
|
|
317
317
|
name: 'fieldComponent',
|
|
318
318
|
type: 'select',
|
|
319
319
|
useComponentProps () {
|
|
320
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
|
|
320
321
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
321
322
|
const field = (0, schema_namespaceObject.useField)();
|
|
322
323
|
const collectionFieldCurrent = (0, external_data_source_index_js_namespaceObject.useCollectionField)();
|
|
@@ -331,7 +332,8 @@ const fieldComponent = {
|
|
|
331
332
|
const fieldMode = (0, useFieldComponentName_js_namespaceObject.useFieldComponentName)();
|
|
332
333
|
const { dn } = (0, external_schema_component_index_js_namespaceObject.useDesignable)();
|
|
333
334
|
const isMuiltipleSelect = [
|
|
334
|
-
'select'
|
|
335
|
+
'select',
|
|
336
|
+
'multipleSelect'
|
|
335
337
|
].includes(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
336
338
|
const optionsMuiltipleSelect = [
|
|
337
339
|
{
|
|
@@ -343,9 +345,27 @@ const fieldComponent = {
|
|
|
343
345
|
value: 'Radio group'
|
|
344
346
|
}
|
|
345
347
|
];
|
|
348
|
+
if ((null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface) === 'multipleSelect') {
|
|
349
|
+
const index = optionsMuiltipleSelect.findIndex((item)=>'Radio group' === item.value);
|
|
350
|
+
optionsMuiltipleSelect.splice(index, 1);
|
|
351
|
+
}
|
|
352
|
+
const dm = (0, external_data_source_index_js_namespaceObject.useDataSourceManager)();
|
|
353
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
354
|
+
const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
|
|
355
|
+
if (fieldSchema['x-component-props']['multiple']) {
|
|
356
|
+
const index = fieldModeOptions.findIndex((item)=>'Radio group' === item.value);
|
|
357
|
+
fieldModeOptions.splice(index, 1);
|
|
358
|
+
}
|
|
359
|
+
const componentOptions = isMuiltipleSelect ? optionsMuiltipleSelect : fieldModeOptions;
|
|
360
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
361
|
+
if (!(null == componentOptions ? void 0 : componentOptions.find((modeItem)=>modeItem.value === item.value))) null == componentOptions || componentOptions.push({
|
|
362
|
+
label: compile(item.label),
|
|
363
|
+
value: item.value
|
|
364
|
+
});
|
|
365
|
+
});
|
|
346
366
|
return {
|
|
347
367
|
title: t('Field component'),
|
|
348
|
-
options:
|
|
368
|
+
options: componentOptions,
|
|
349
369
|
value: fieldMode,
|
|
350
370
|
onChange (mode) {
|
|
351
371
|
const schema = {
|
|
@@ -436,8 +456,7 @@ const selectComponentFieldSettings = new SchemaSettings_js_namespaceObject.Schem
|
|
|
436
456
|
name: 'fieldSettings:component:Select',
|
|
437
457
|
items: [
|
|
438
458
|
{
|
|
439
|
-
...fieldComponent
|
|
440
|
-
useVisible: FormItem_Settings_js_namespaceObject.useIsMuiltipleAble
|
|
459
|
+
...fieldComponent
|
|
441
460
|
},
|
|
442
461
|
{
|
|
443
462
|
...setTheDataScope,
|
|
@@ -80,7 +80,7 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
80
80
|
const isTreeCollection = (null == targetCollection ? void 0 : targetCollection.template) === 'tree';
|
|
81
81
|
const ellipsisWithTooltipRef = (0, external_react_namespaceObject.useRef)();
|
|
82
82
|
const getLabelUiSchema = (0, external_util_js_namespaceObject.useLabelUiSchemaV2)();
|
|
83
|
-
const { formulaRecord, fieldNames } =
|
|
83
|
+
const { formulaRecord, fieldNames } = (0, external_hooks_js_namespaceObject.useCustomTitle)(recordCtx, fieldSchema, defFieldNames);
|
|
84
84
|
const renderRecords = ()=>(0, schema_namespaceObject.toArr)(formulaRecord[fieldSchema['name']] || props.value).map((record, index, arr)=>{
|
|
85
85
|
var _getCollection_options, _getCollection, _targetCollection_fieldsMap_, _targetCollection_fieldsMap, _getCollection_options1, _getCollection1, _targetCollection_fieldsMap_1, _targetCollection_fieldsMap1;
|
|
86
86
|
const value = null == record ? void 0 : record[(null == fieldNames ? void 0 : fieldNames.label) || 'label'];
|
|
@@ -173,60 +173,6 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
173
173
|
}, {
|
|
174
174
|
displayName: 'ReadPrettyInternalViewer'
|
|
175
175
|
});
|
|
176
|
-
const customTitle = (record, schema, fieldNames)=>{
|
|
177
|
-
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
178
|
-
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)) {
|
|
179
|
-
var _schema_xcomponentprops_fieldNames1, _schema_xcomponentprops2;
|
|
180
|
-
const regex = /{{(.*?)}}/g;
|
|
181
|
-
const valueOject = {};
|
|
182
|
-
let outputStr = '';
|
|
183
|
-
let match;
|
|
184
|
-
const formula = null == (_schema_xcomponentprops2 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames1 = _schema_xcomponentprops2.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames1.formula;
|
|
185
|
-
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
186
|
-
const fieldList = [
|
|
187
|
-
schema.name
|
|
188
|
-
];
|
|
189
|
-
fieldList.push(...match[1].split('.'));
|
|
190
|
-
const result = {
|
|
191
|
-
currRecord: record,
|
|
192
|
-
value: ''
|
|
193
|
-
};
|
|
194
|
-
fieldList.forEach((value, index)=>{
|
|
195
|
-
var _result_currRecord;
|
|
196
|
-
if (fieldList.length - 1 !== index) {
|
|
197
|
-
var _result_currRecord1;
|
|
198
|
-
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
202
|
-
});
|
|
203
|
-
var _result_value;
|
|
204
|
-
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
205
|
-
} else {
|
|
206
|
-
var _record_schema_name;
|
|
207
|
-
valueOject[match[1]] = (null == (_record_schema_name = record[schema['name']]) ? void 0 : _record_schema_name[match[1]]) || '';
|
|
208
|
-
}
|
|
209
|
-
outputStr = replacePlaceholders(formula, valueOject);
|
|
210
|
-
record[schema['name']] = {
|
|
211
|
-
...record[schema['name']],
|
|
212
|
-
customLabel: outputStr
|
|
213
|
-
};
|
|
214
|
-
return {
|
|
215
|
-
formulaRecord: record,
|
|
216
|
-
fieldNames: {
|
|
217
|
-
...fieldNames,
|
|
218
|
-
label: 'customLabel'
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
formulaRecord: record,
|
|
224
|
-
fieldNames
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
228
|
-
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
229
|
-
});
|
|
230
176
|
exports.ReadPrettyInternalViewer = __webpack_exports__.ReadPrettyInternalViewer;
|
|
231
177
|
exports.isObject = __webpack_exports__.isObject;
|
|
232
178
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
@@ -34,6 +34,7 @@ var __webpack_exports__ = {};
|
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
36
|
useAssociationFieldContext: ()=>useAssociationFieldContext,
|
|
37
|
+
useCustomTitle: ()=>useCustomTitle,
|
|
37
38
|
default: ()=>useServiceOptions,
|
|
38
39
|
SubFormProvider: ()=>SubFormProvider,
|
|
39
40
|
useSubFormValue: ()=>useSubFormValue,
|
|
@@ -191,9 +192,61 @@ const useSubFormValue = ()=>{
|
|
|
191
192
|
collection
|
|
192
193
|
};
|
|
193
194
|
};
|
|
195
|
+
const useCustomTitle = (record, schema, fieldNames)=>{
|
|
196
|
+
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
197
|
+
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)) {
|
|
198
|
+
if (Array.isArray(record[schema['name']])) record[schema['name']].forEach((recordItem)=>{
|
|
199
|
+
recordItem['customLabel'] = getCustomLabel(recordItem, schema);
|
|
200
|
+
});
|
|
201
|
+
else record[schema['name']]['customLabel'] = getCustomLabel(record[schema['name']], schema);
|
|
202
|
+
return {
|
|
203
|
+
formulaRecord: record,
|
|
204
|
+
fieldNames: {
|
|
205
|
+
...fieldNames,
|
|
206
|
+
label: 'customLabel'
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
formulaRecord: record,
|
|
212
|
+
fieldNames
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
const getCustomLabel = (record, schema)=>{
|
|
216
|
+
var _schema_xcomponentprops_fieldNames, _schema_xcomponentprops;
|
|
217
|
+
const regex = /{{(.*?)}}/g;
|
|
218
|
+
const valueOject = {};
|
|
219
|
+
let outputStr = '';
|
|
220
|
+
let match;
|
|
221
|
+
const formula = null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula;
|
|
222
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
223
|
+
const fieldList = match[1].split('.');
|
|
224
|
+
const result = {
|
|
225
|
+
currRecord: record,
|
|
226
|
+
value: ''
|
|
227
|
+
};
|
|
228
|
+
fieldList.forEach((value, index)=>{
|
|
229
|
+
var _result_currRecord;
|
|
230
|
+
if (fieldList.length - 1 !== index) {
|
|
231
|
+
var _result_currRecord1;
|
|
232
|
+
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
236
|
+
});
|
|
237
|
+
var _result_value;
|
|
238
|
+
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
239
|
+
} else valueOject[match[1]] = record[match[1]] || '';
|
|
240
|
+
outputStr = replacePlaceholders(formula, valueOject);
|
|
241
|
+
return outputStr;
|
|
242
|
+
};
|
|
243
|
+
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
244
|
+
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
245
|
+
});
|
|
194
246
|
exports.SubFormProvider = __webpack_exports__.SubFormProvider;
|
|
195
247
|
exports["default"] = __webpack_exports__["default"];
|
|
196
248
|
exports.useAssociationFieldContext = __webpack_exports__.useAssociationFieldContext;
|
|
249
|
+
exports.useCustomTitle = __webpack_exports__.useCustomTitle;
|
|
197
250
|
exports.useFieldNames = __webpack_exports__.useFieldNames;
|
|
198
251
|
exports.useInsertSchema = __webpack_exports__.useInsertSchema;
|
|
199
252
|
exports.useSubFormValue = __webpack_exports__.useSubFormValue;
|
|
@@ -201,6 +254,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
201
254
|
"SubFormProvider",
|
|
202
255
|
"default",
|
|
203
256
|
"useAssociationFieldContext",
|
|
257
|
+
"useCustomTitle",
|
|
204
258
|
"useFieldNames",
|
|
205
259
|
"useInsertSchema",
|
|
206
260
|
"useSubFormValue"
|
|
@@ -50,7 +50,8 @@ const Input = Object.assign((0, schema_namespaceObject.connect)(external_antd_na
|
|
|
50
50
|
})), (0, schema_namespaceObject.mapReadPretty)(external_ReadPretty_js_namespaceObject.ReadPretty.TextArea)),
|
|
51
51
|
URL: (0, schema_namespaceObject.connect)(external_antd_namespaceObject.Input, (0, schema_namespaceObject.mapReadPretty)(external_ReadPretty_js_namespaceObject.ReadPretty.URL)),
|
|
52
52
|
JSON: (0, schema_namespaceObject.connect)(external_Json_js_namespaceObject.Json, (0, schema_namespaceObject.mapReadPretty)(external_ReadPretty_js_namespaceObject.ReadPretty.JSON)),
|
|
53
|
-
ReadPretty: external_ReadPretty_js_namespaceObject.ReadPretty.Input
|
|
53
|
+
ReadPretty: external_ReadPretty_js_namespaceObject.ReadPretty.Input,
|
|
54
|
+
Preview: external_ReadPretty_js_namespaceObject.ReadPretty.Preview
|
|
54
55
|
});
|
|
55
56
|
const input_Input = Input;
|
|
56
57
|
exports.Input = __webpack_exports__.Input;
|
|
@@ -38,6 +38,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
39
|
require("react");
|
|
40
40
|
const components_namespaceObject = require("@tachybase/components");
|
|
41
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
41
42
|
const css_namespaceObject = require("@emotion/css");
|
|
42
43
|
const external_antd_namespaceObject = require("antd");
|
|
43
44
|
const external_classnames_namespaceObject = require("classnames");
|
|
@@ -189,11 +190,38 @@ const _JSON = (props)=>{
|
|
|
189
190
|
children: null != props.value ? JSON.stringify(props.value, null, null != (_props_space = props.space) ? _props_space : 2) : ''
|
|
190
191
|
});
|
|
191
192
|
};
|
|
193
|
+
const sizes = {
|
|
194
|
+
small: 24,
|
|
195
|
+
middle: 48,
|
|
196
|
+
large: 72,
|
|
197
|
+
oversized: 120
|
|
198
|
+
};
|
|
199
|
+
const _Preview = (props)=>{
|
|
200
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
201
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
202
|
+
const size = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['size']) || 'small';
|
|
203
|
+
const objectFit = (null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['objectFit']) || 'cover';
|
|
204
|
+
if (!props.value) return props.value;
|
|
205
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Image, {
|
|
206
|
+
style: [
|
|
207
|
+
'small',
|
|
208
|
+
'middle',
|
|
209
|
+
'large',
|
|
210
|
+
'oversized'
|
|
211
|
+
].includes(size) ? {
|
|
212
|
+
width: sizes[size],
|
|
213
|
+
height: sizes[size],
|
|
214
|
+
objectFit
|
|
215
|
+
} : {},
|
|
216
|
+
src: props.value
|
|
217
|
+
});
|
|
218
|
+
};
|
|
192
219
|
ReadPretty.Input = _Input;
|
|
193
220
|
ReadPretty.TextArea = _TextArea;
|
|
194
221
|
ReadPretty.URL = _URL;
|
|
195
222
|
ReadPretty.Html = _Html;
|
|
196
223
|
ReadPretty.JSON = _JSON;
|
|
224
|
+
ReadPretty.Preview = _Preview;
|
|
197
225
|
exports.ReadPretty = __webpack_exports__.ReadPretty;
|
|
198
226
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
199
227
|
"ReadPretty"
|