@tachybase/client 0.23.40 → 0.23.47
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/WebSocketClient.mjs +1 -1
- package/es/application/schema-settings/SchemaSettingsDefaults.mjs +10 -15
- package/es/block-provider/hooks/index.mjs +26 -7
- package/es/built-in/acl/Configuration/RolesResourcesActions.d.ts +1 -1
- package/es/built-in/acl/Configuration/StrategyActions.d.ts +1 -1
- package/es/collection-manager/interfaces/properties/index.mjs +1 -1
- package/es/data-source/collection-field/CollectionField.d.ts +1 -1
- package/es/data-source/data-source/DataSource.d.ts +3 -0
- package/es/modules/actions/disassociate/__e2e__/templatesOfPage.mjs +1 -1
- package/es/modules/actions/view-edit-popup/PopupActionInitializer.mjs +1 -1
- package/es/modules/actions/view-edit-popup/UpdateActionInitializer.mjs +1 -1
- package/es/modules/blocks/data-blocks/details-multi/__tests__/createDetailsBlockWithPagingUISchema.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/details-single/__tests__/createDetailsBlockWithoutPagingUISchema.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.mjs +12 -12
- package/es/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.mjs +2 -2
- package/es/modules/blocks/data-blocks/table/__tests__/createTableBLockSchema.test.mjs +1 -1
- package/es/modules/blocks/data-blocks/table-selector/__e2e__/templatesOfBug.mjs +2 -2
- package/es/modules/blocks/data-blocks/table-selector/__tests__/createTableSelectorSchema.test.mjs +1 -1
- package/es/modules/blocks/filter-blocks/collapse/__tests__/createCollapseBlockSchema.test.mjs +1 -1
- package/es/modules/blocks/filter-blocks/form/__tests__/createFilterFormBlockSchema.test.mjs +1 -1
- package/es/modules/dialog/__e2e__/templatesOfBug.mjs +9 -9
- package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.d.ts +2 -0
- package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +65 -0
- package/es/modules/fields/component/Select/selectComponentFieldSettings.d.ts +30 -0
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +62 -6
- package/es/schema-component/antd/action/Action.Designer.mjs +5 -7
- package/es/schema-component/antd/association-cascader/AssociationCascader.d.ts +1 -1
- package/es/schema-component/antd/association-cascader/AssociationCascader.mjs +1 -1
- package/es/schema-component/antd/association-field/AssociationSelect.d.ts +1 -1
- package/es/schema-component/antd/association-field/Editable.mjs +1 -1
- package/es/schema-component/antd/association-field/FileManager.d.ts +1 -1
- package/es/schema-component/antd/association-field/InternalCascader.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalViewer.mjs +59 -4
- package/es/schema-component/antd/association-field/ReadPretty.mjs +2 -1
- package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -2
- package/es/schema-component/antd/association-field/schema.mjs +1 -1
- package/es/schema-component/antd/auto-complete/AutoComplete.d.ts +1 -1
- package/es/schema-component/antd/auto-complete/AutoComplete.mjs +1 -1
- package/es/schema-component/antd/cascader/Cascader.d.ts +1 -1
- package/es/schema-component/antd/checkbox/Checkbox.d.ts +1 -1
- package/es/schema-component/antd/collection-select/CollectionSelect.d.ts +5 -5
- package/es/schema-component/antd/color-picker/ColorPicker.d.ts +1 -1
- package/es/schema-component/antd/color-select/ColorSelect.d.ts +1 -1
- package/es/schema-component/antd/cron/CronSet.d.ts +1 -1
- package/es/schema-component/antd/custom-cascader/CustomCascader.d.ts +1 -1
- package/es/schema-component/antd/filter/FilterGroup.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.Settings.mjs +83 -2
- package/es/schema-component/antd/icon-picker/IconPicker.d.ts +1 -1
- package/es/schema-component/antd/menu/Menu.styles.mjs +4 -2
- package/es/schema-component/antd/nanoIDInput/NanoIDInput.d.ts +1 -1
- package/es/schema-component/antd/password/Password.d.ts +1 -1
- package/es/schema-component/antd/percent/Percent.d.ts +1 -1
- package/es/schema-component/antd/preview/Preview.d.ts +1 -1
- package/es/schema-component/antd/remote-select/RemoteSelect.d.ts +4 -4
- package/es/schema-component/antd/remote-select/RemoteSelect.mjs +7 -5
- package/es/schema-component/antd/rich-text/RichText.d.ts +1 -1
- package/es/schema-component/antd/select/FormulaSelect.mjs +3 -3
- package/es/schema-component/antd/select/Select.mjs +3 -1
- package/es/schema-component/antd/unixTimestamp/UnixTimestamp.d.ts +1 -1
- package/es/schema-component/antd/variable/TextArea.mjs +3 -1
- package/es/schema-component/antd/variable/Variable.d.ts +5 -5
- package/es/schema-component/hooks/useFieldModeOptions.mjs +8 -0
- package/es/schema-initializer/SchemaInitializerPlugin.mjs +1 -0
- package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
- package/es/schema-initializer/buttons/TabPaneInitializers.mjs +9 -1
- package/es/schema-settings/DateFormat/ExpiresRadio.d.ts +1 -1
- package/es/schema-settings/EditFormulaTitleField.mjs +7 -2
- package/es/schema-settings/SchemaSettingsPlugin.mjs +2 -0
- package/lib/application/WebSocketClient.js +1 -1
- package/lib/application/schema-settings/SchemaSettingsDefaults.js +10 -15
- package/lib/block-provider/hooks/index.js +26 -7
- package/lib/collection-manager/interfaces/properties/index.js +1 -1
- package/lib/modules/actions/disassociate/__e2e__/templatesOfPage.js +1 -1
- package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +1 -1
- package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +1 -1
- package/lib/modules/blocks/data-blocks/details-multi/__tests__/createDetailsBlockWithPagingUISchema.test.js +1 -1
- package/lib/modules/blocks/data-blocks/details-single/__tests__/createDetailsBlockWithoutPagingUISchema.test.js +1 -1
- package/lib/modules/blocks/data-blocks/form/__e2e__/form-create/schemaSettings.test.js +1 -1
- package/lib/modules/blocks/data-blocks/form/__e2e__/form-create/templatesOfBug.js +12 -12
- package/lib/modules/blocks/data-blocks/form/__tests__/createCreateFormBlockUISchema.test.js +1 -1
- package/lib/modules/blocks/data-blocks/form/__tests__/createEditFormBlockUISchema.test.js +1 -1
- package/lib/modules/blocks/data-blocks/table/__e2e__/templatesOfBug.js +2 -2
- package/lib/modules/blocks/data-blocks/table/__tests__/createTableBLockSchema.test.js +1 -1
- package/lib/modules/blocks/data-blocks/table-selector/__e2e__/templatesOfBug.js +2 -2
- package/lib/modules/blocks/data-blocks/table-selector/__tests__/createTableSelectorSchema.test.js +1 -1
- package/lib/modules/blocks/filter-blocks/collapse/__tests__/createCollapseBlockSchema.test.js +1 -1
- package/lib/modules/blocks/filter-blocks/form/__tests__/createFilterFormBlockSchema.test.js +1 -1
- package/lib/modules/dialog/__e2e__/templatesOfBug.js +9 -9
- package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +99 -0
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +69 -6
- package/lib/schema-component/antd/action/Action.Designer.js +5 -7
- package/lib/schema-component/antd/association-cascader/AssociationCascader.js +1 -1
- package/lib/schema-component/antd/association-field/Editable.js +1 -1
- package/lib/schema-component/antd/association-field/InternalCascader.js +2 -2
- package/lib/schema-component/antd/association-field/InternalViewer.js +59 -4
- package/lib/schema-component/antd/association-field/ReadPretty.js +2 -1
- package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -2
- package/lib/schema-component/antd/association-field/schema.js +1 -1
- package/lib/schema-component/antd/auto-complete/AutoComplete.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.Settings.js +83 -2
- package/lib/schema-component/antd/menu/Menu.styles.js +4 -2
- package/lib/schema-component/antd/remote-select/RemoteSelect.js +7 -5
- package/lib/schema-component/antd/select/FormulaSelect.js +3 -3
- package/lib/schema-component/antd/select/Select.js +3 -1
- package/lib/schema-component/antd/variable/TextArea.js +3 -1
- package/lib/schema-component/hooks/useFieldModeOptions.js +8 -0
- package/lib/schema-initializer/SchemaInitializerPlugin.js +1 -0
- package/lib/schema-initializer/buttons/TabPaneInitializers.js +9 -0
- package/lib/schema-settings/EditFormulaTitleField.js +7 -2
- package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
- package/package.json +8 -8
|
@@ -74,7 +74,7 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
74
74
|
const { getCollection } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
75
75
|
const { enableLink } = fieldSchema['x-component-props'] || {};
|
|
76
76
|
const field = (0, schema_namespaceObject.useField)();
|
|
77
|
-
const
|
|
77
|
+
const defFieldNames = (0, external_hooks_js_namespaceObject.useFieldNames)(props);
|
|
78
78
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
79
79
|
const insertViewer = (0, external_hooks_js_namespaceObject.useInsertSchema)('Viewer');
|
|
80
80
|
const { options: collectionField } = (0, external_hooks_js_namespaceObject.useAssociationFieldContext)();
|
|
@@ -86,7 +86,8 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
86
86
|
const isTreeCollection = (null == targetCollection ? void 0 : targetCollection.template) === 'tree';
|
|
87
87
|
const ellipsisWithTooltipRef = (0, external_react_namespaceObject.useRef)();
|
|
88
88
|
const getLabelUiSchema = (0, external_util_js_namespaceObject.useLabelUiSchemaV2)();
|
|
89
|
-
const
|
|
89
|
+
const { formulaRecord, fieldNames } = customTitle(recordCtx, fieldSchema, defFieldNames);
|
|
90
|
+
const renderRecords = ()=>(0, schema_namespaceObject.toArr)(formulaRecord[fieldSchema['name']] || props.value).map((record, index, arr)=>{
|
|
90
91
|
var _getCollection_options, _getCollection, _targetCollection_fieldsMap_, _targetCollection_fieldsMap, _getCollection_options1, _getCollection1, _targetCollection_fieldsMap_1, _targetCollection_fieldsMap1;
|
|
91
92
|
const value = null == record ? void 0 : record[(null == fieldNames ? void 0 : fieldNames.label) || 'label'];
|
|
92
93
|
const label = isTreeCollection ? (0, external_InternalCascadeSelect_js_namespaceObject.transformNestedData)(record).map((o)=>null == o ? void 0 : o[(null == fieldNames ? void 0 : fieldNames.label) || 'label']).join(' / ') : isObject(value) ? (null === (_getCollection = getCollection(null == targetCollection ? void 0 : null === (_targetCollection_fieldsMap = targetCollection.fieldsMap) || void 0 === _targetCollection_fieldsMap ? void 0 : null === (_targetCollection_fieldsMap_ = _targetCollection_fieldsMap[(null == fieldNames ? void 0 : fieldNames.label) || 'label']) || void 0 === _targetCollection_fieldsMap_ ? void 0 : _targetCollection_fieldsMap_.target)) || void 0 === _getCollection ? void 0 : null === (_getCollection_options = _getCollection.options) || void 0 === _getCollection_options ? void 0 : _getCollection_options.titleField) ? value[null === (_getCollection1 = getCollection(null == targetCollection ? void 0 : null === (_targetCollection_fieldsMap1 = targetCollection.fieldsMap) || void 0 === _targetCollection_fieldsMap1 ? void 0 : null === (_targetCollection_fieldsMap_1 = _targetCollection_fieldsMap1[(null == fieldNames ? void 0 : fieldNames.label) || 'label']) || void 0 === _targetCollection_fieldsMap_1 ? void 0 : _targetCollection_fieldsMap_1.target)) || void 0 === _getCollection1 ? void 0 : null === (_getCollection_options1 = _getCollection1.options) || void 0 === _getCollection_options1 ? void 0 : _getCollection_options1.titleField] : JSON.stringify(value) : value;
|
|
@@ -141,11 +142,11 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
141
142
|
const collectionFieldNames = null == fieldSchema ? void 0 : null === (_fieldSchema_xcollectionfield = fieldSchema['x-collection-field']) || void 0 === _fieldSchema_xcollectionfield ? void 0 : _fieldSchema_xcollectionfield.split('.');
|
|
142
143
|
return collectionFieldNames && collectionFieldNames.length > 2 ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_record_provider_index_js_namespaceObject.RecordProvider, {
|
|
143
144
|
record: record,
|
|
144
|
-
parent:
|
|
145
|
+
parent: formulaRecord[collectionFieldNames[1]],
|
|
145
146
|
children: renderWithoutTableFieldResourceProvider()
|
|
146
147
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_record_provider_index_js_namespaceObject.RecordProvider, {
|
|
147
148
|
record: record,
|
|
148
|
-
parent:
|
|
149
|
+
parent: formulaRecord,
|
|
149
150
|
children: renderWithoutTableFieldResourceProvider()
|
|
150
151
|
});
|
|
151
152
|
};
|
|
@@ -178,6 +179,60 @@ const ReadPrettyInternalViewer = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
178
179
|
}, {
|
|
179
180
|
displayName: 'ReadPrettyInternalViewer'
|
|
180
181
|
});
|
|
182
|
+
const customTitle = (record, schema, fieldNames)=>{
|
|
183
|
+
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
184
|
+
if ((null === (_schema_xcomponentprops = schema['x-component-props']) || void 0 === _schema_xcomponentprops ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null === (_schema_xcomponentprops1 = schema['x-component-props']) || void 0 === _schema_xcomponentprops1 ? void 0 : null === (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) || void 0 === _schema_xcomponentprops_fieldNames ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
185
|
+
var _schema_xcomponentprops_fieldNames1, _schema_xcomponentprops2;
|
|
186
|
+
const regex = /{{(.*?)}}/g;
|
|
187
|
+
const valueOject = {};
|
|
188
|
+
let outputStr = '';
|
|
189
|
+
let match;
|
|
190
|
+
const formula = null === (_schema_xcomponentprops2 = schema['x-component-props']) || void 0 === _schema_xcomponentprops2 ? void 0 : null === (_schema_xcomponentprops_fieldNames1 = _schema_xcomponentprops2.fieldNames) || void 0 === _schema_xcomponentprops_fieldNames1 ? void 0 : _schema_xcomponentprops_fieldNames1.formula;
|
|
191
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
192
|
+
const fieldList = [
|
|
193
|
+
schema.name
|
|
194
|
+
];
|
|
195
|
+
fieldList.push(...match[1].split('.'));
|
|
196
|
+
const result = {
|
|
197
|
+
currRecord: record,
|
|
198
|
+
value: ''
|
|
199
|
+
};
|
|
200
|
+
fieldList.forEach((value, index)=>{
|
|
201
|
+
var _result_currRecord;
|
|
202
|
+
if (fieldList.length - 1 !== index) {
|
|
203
|
+
var _result_currRecord1;
|
|
204
|
+
result.currRecord = null === (_result_currRecord1 = result.currRecord) || void 0 === _result_currRecord1 ? void 0 : _result_currRecord1[value];
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
result.value = null === (_result_currRecord = result.currRecord) || void 0 === _result_currRecord ? void 0 : _result_currRecord[value];
|
|
208
|
+
});
|
|
209
|
+
var _result_value;
|
|
210
|
+
valueOject[match[1]] = null !== (_result_value = result.value) && void 0 !== _result_value ? _result_value : '';
|
|
211
|
+
} else {
|
|
212
|
+
var _record_schema_name;
|
|
213
|
+
valueOject[match[1]] = (null === (_record_schema_name = record[schema['name']]) || void 0 === _record_schema_name ? void 0 : _record_schema_name[match[1]]) || '';
|
|
214
|
+
}
|
|
215
|
+
outputStr = replacePlaceholders(formula, valueOject);
|
|
216
|
+
record[schema['name']] = {
|
|
217
|
+
...record[schema['name']],
|
|
218
|
+
customLabel: outputStr
|
|
219
|
+
};
|
|
220
|
+
return {
|
|
221
|
+
formulaRecord: record,
|
|
222
|
+
fieldNames: {
|
|
223
|
+
...fieldNames,
|
|
224
|
+
label: 'customLabel'
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
formulaRecord: record,
|
|
230
|
+
fieldNames
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
234
|
+
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
235
|
+
});
|
|
181
236
|
var __webpack_export_target__ = exports;
|
|
182
237
|
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
183
238
|
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
@@ -46,7 +46,8 @@ const ReadPrettyAssociationField = (0, schema_namespaceObject.observer)((props)=
|
|
|
46
46
|
'Select',
|
|
47
47
|
'Picker',
|
|
48
48
|
'CascadeSelect',
|
|
49
|
-
'Cascader'
|
|
49
|
+
'Cascader',
|
|
50
|
+
'CustomTitle'
|
|
50
51
|
].includes(currentMode) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_InternalViewer_js_namespaceObject.ReadPrettyInternalViewer, {
|
|
51
52
|
...props
|
|
52
53
|
}),
|
|
@@ -126,7 +126,7 @@ const InternalTabs = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
126
126
|
if ((null == tabparams ? void 0 : tabparams.filter) && !fieldServiceFilter) return;
|
|
127
127
|
if ((quickAddField || 'none' !== quickAddField || !isQuickAdd) && fieldSchema.properties) {
|
|
128
128
|
const params = {
|
|
129
|
-
|
|
129
|
+
paginate: false,
|
|
130
130
|
filter: JSON.stringify(fieldServiceFilter)
|
|
131
131
|
};
|
|
132
132
|
if (quickAddParentField && (null == quickAddParentField ? void 0 : quickAddParentField.value) !== 'none') {
|
|
@@ -138,7 +138,7 @@ const InternalTabs = (0, schema_namespaceObject.observer)((props)=>{
|
|
|
138
138
|
const parentItem = await api.request({
|
|
139
139
|
url: collection.name + ':list',
|
|
140
140
|
params: {
|
|
141
|
-
|
|
141
|
+
paginate: false
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
itemParams['parentTitleField'] = collection.titleField;
|
|
@@ -51,7 +51,7 @@ const AutoComplete = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
51
51
|
const { data: { data: rawOptions } } = await api.request({
|
|
52
52
|
url: fieldSchema['collectionName'] + ':list',
|
|
53
53
|
params: {
|
|
54
|
-
|
|
54
|
+
paginate: false,
|
|
55
55
|
filter: fieldFilter ? {
|
|
56
56
|
...fieldFilter.filter
|
|
57
57
|
} : {}
|
|
@@ -66,6 +66,7 @@ const external_data_source_index_js_namespaceObject = require("../../../data-sou
|
|
|
66
66
|
const external_record_provider_index_js_namespaceObject = require("../../../record-provider/index.js");
|
|
67
67
|
const Table_Column_Decorator_js_namespaceObject = require("../table-v2/Table.Column.Decorator.js");
|
|
68
68
|
const GeneralSettings_js_namespaceObject = require("../../../schema-items/GeneralSettings.js");
|
|
69
|
+
const external_schema_settings_index_js_namespaceObject = require("../../../schema-settings/index.js");
|
|
69
70
|
const useIsAllowToSetDefaultValue_js_namespaceObject = require("../../../schema-settings/hooks/useIsAllowToSetDefaultValue.js");
|
|
70
71
|
const useIsShowMultipleSwitch_js_namespaceObject = require("../../../schema-settings/hooks/useIsShowMultipleSwitch.js");
|
|
71
72
|
const isPatternDisabled_js_namespaceObject = require("../../../schema-settings/isPatternDisabled.js");
|
|
@@ -623,6 +624,86 @@ const formItemSettings = new index_js_namespaceObject.SchemaSettings({
|
|
|
623
624
|
},
|
|
624
625
|
useVisible: useShowFieldMode
|
|
625
626
|
},
|
|
627
|
+
{
|
|
628
|
+
name: 'customTitle',
|
|
629
|
+
type: 'modal',
|
|
630
|
+
useComponentProps () {
|
|
631
|
+
var _fieldSchema_xcomponentprops_fieldNames, _fieldSchema_xcomponentprops;
|
|
632
|
+
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
633
|
+
const { fieldSchema: tableColumnSchema } = (0, Table_Column_Decorator_js_namespaceObject.useColumnSchema)();
|
|
634
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
635
|
+
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
636
|
+
const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
|
|
637
|
+
const options = (0, external_schema_settings_index_js_namespaceObject.useFormulaTitleOptions)();
|
|
638
|
+
const def = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : null === (_fieldSchema_xcomponentprops_fieldNames = _fieldSchema_xcomponentprops.fieldNames) || void 0 === _fieldSchema_xcomponentprops_fieldNames ? void 0 : _fieldSchema_xcomponentprops_fieldNames.formula;
|
|
639
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
640
|
+
return {
|
|
641
|
+
title: t('Custom option label'),
|
|
642
|
+
schema: {
|
|
643
|
+
type: 'object',
|
|
644
|
+
title: t('Custom option label'),
|
|
645
|
+
properties: {
|
|
646
|
+
formula: {
|
|
647
|
+
required: true,
|
|
648
|
+
'x-decorator': 'FormItem',
|
|
649
|
+
'x-component': 'Variable.TextArea',
|
|
650
|
+
'x-component-props': {
|
|
651
|
+
scope: options
|
|
652
|
+
},
|
|
653
|
+
default: def || ''
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
},
|
|
657
|
+
onSubmit: (param)=>{
|
|
658
|
+
let { formula } = param;
|
|
659
|
+
if (formula) {
|
|
660
|
+
var _fieldSchema_xcomponentprops, _field_componentProps;
|
|
661
|
+
const componentProps = {
|
|
662
|
+
...fieldSchema['x-component-props'],
|
|
663
|
+
fieldNames: {
|
|
664
|
+
...null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['fieldNames'],
|
|
665
|
+
formula
|
|
666
|
+
},
|
|
667
|
+
appends: [
|
|
668
|
+
fieldSchema['name']
|
|
669
|
+
]
|
|
670
|
+
};
|
|
671
|
+
const regex = /{{(.*?)}}/g;
|
|
672
|
+
let match;
|
|
673
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
674
|
+
const matchList = match[1].split('.');
|
|
675
|
+
let appendsValue = fieldSchema['name'];
|
|
676
|
+
matchList.forEach((item, index)=>{
|
|
677
|
+
if (index === matchList.length - 1) return;
|
|
678
|
+
appendsValue += '.' + item;
|
|
679
|
+
componentProps.appends.push(appendsValue);
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
field.componentProps = {
|
|
683
|
+
...field.componentProps,
|
|
684
|
+
fieldNames: {
|
|
685
|
+
...null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps.fieldNames,
|
|
686
|
+
formula
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
fieldSchema['x-component-props'] = componentProps;
|
|
690
|
+
dn.emit('patch', {
|
|
691
|
+
schema: {
|
|
692
|
+
'x-uid': fieldSchema['x-uid'],
|
|
693
|
+
'x-component-props': componentProps
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
dn.refresh();
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
},
|
|
701
|
+
useVisible: ()=>{
|
|
702
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
703
|
+
const formula = 'CustomTitle' === fieldSchema['x-component-props'].mode;
|
|
704
|
+
return useShowFieldMode() && formula;
|
|
705
|
+
}
|
|
706
|
+
},
|
|
626
707
|
{
|
|
627
708
|
name: 'popupSize',
|
|
628
709
|
type: 'select',
|
|
@@ -989,7 +1070,7 @@ const formItemSettings = new index_js_namespaceObject.SchemaSettings({
|
|
|
989
1070
|
const options = useTitleFieldOptions();
|
|
990
1071
|
const isAssociationField = useIsAssociationField();
|
|
991
1072
|
const fieldMode = useFieldMode();
|
|
992
|
-
return options.length > 0 && isAssociationField && 'SubTable' !== fieldMode;
|
|
1073
|
+
return options.length > 0 && isAssociationField && 'SubTable' !== fieldMode && 'CustomTitle' !== fieldMode;
|
|
993
1074
|
},
|
|
994
1075
|
useComponentProps () {
|
|
995
1076
|
var _field_componentProps_fieldNames, _field_componentProps;
|
|
@@ -1234,7 +1315,7 @@ function useFieldMode() {
|
|
|
1234
1315
|
function useIsSelectFieldMode() {
|
|
1235
1316
|
const fieldMode = useFieldMode();
|
|
1236
1317
|
const isAssociationField = useIsAssociationField();
|
|
1237
|
-
const isSelectFieldMode = isAssociationField && 'Select' === fieldMode;
|
|
1318
|
+
const isSelectFieldMode = isAssociationField && ('Select' === fieldMode || 'CustomTitle' === fieldMode);
|
|
1238
1319
|
return isSelectFieldMode;
|
|
1239
1320
|
}
|
|
1240
1321
|
function useValidateSchema() {
|
|
@@ -57,7 +57,9 @@ function _templateObject1() {
|
|
|
57
57
|
}
|
|
58
58
|
function _templateObject2() {
|
|
59
59
|
const data = _tagged_template_literal([
|
|
60
|
-
"\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n .ant-menu-submenu.ant-menu-submenu-inline .ant-menu-submenu-title {\n position: relative;\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color:
|
|
60
|
+
"\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n .ant-menu-submenu.ant-menu-submenu-inline .ant-menu-submenu-title {\n position: relative;\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: ",
|
|
61
|
+
";\n\n /* 使用 clip-path 裁剪为梯形 */\n clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);\n }\n }\n\n .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-open > .ant-menu-submenu-title {\n ::before {\n background-color: ",
|
|
62
|
+
";\n }\n }\n\n .ant-menu-item,\n .ant-menu-submenu-title {\n padding-inline-end: 10px;\n }\n\n .ant-menu-submenu-title {\n .ant-menu-title-content {\n > div {\n > .general-schema-designer {\n right: 6px !important;\n }\n > span.anticon {\n margin-right: 10px;\n }\n }\n }\n }\n "
|
|
61
63
|
]);
|
|
62
64
|
_templateObject2 = function() {
|
|
63
65
|
return data;
|
|
@@ -87,7 +89,7 @@ const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=
|
|
|
87
89
|
return {
|
|
88
90
|
subMenuDesignerCss: css(_templateObject()),
|
|
89
91
|
designerCss: css(_templateObject1()),
|
|
90
|
-
sideMenuClass: css(_templateObject2()),
|
|
92
|
+
sideMenuClass: css(_templateObject2(), token.colorBorder, token.colorPrimaryText),
|
|
91
93
|
menuItemClass: css(_templateObject3()),
|
|
92
94
|
headerMenuClass: css(_templateObject4())
|
|
93
95
|
};
|
|
@@ -136,15 +136,17 @@ const InternalRemoteSelect = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
136
136
|
null == targetField ? void 0 : targetField.uiSchema,
|
|
137
137
|
fieldNames
|
|
138
138
|
]);
|
|
139
|
+
const params = {
|
|
140
|
+
...null == service ? void 0 : service.params,
|
|
141
|
+
filter: null == service ? void 0 : null === (_service_params = service.params) || void 0 === _service_params ? void 0 : _service_params.filter
|
|
142
|
+
};
|
|
143
|
+
if (fieldNames['formula']) params['paginate'] = false;
|
|
144
|
+
else params['pageSize'] = 200;
|
|
139
145
|
const { data, run, loading } = (0, index_js_namespaceObject.useRequest)({
|
|
140
146
|
action: 'list',
|
|
141
147
|
...service,
|
|
142
148
|
headers,
|
|
143
|
-
params
|
|
144
|
-
pageSize: fieldNames['formula'] ? 9999 : 200,
|
|
145
|
-
...null == service ? void 0 : service.params,
|
|
146
|
-
filter: null == service ? void 0 : null === (_service_params = service.params) || void 0 === _service_params ? void 0 : _service_params.filter
|
|
147
|
-
}
|
|
149
|
+
params
|
|
148
150
|
}, {
|
|
149
151
|
manual,
|
|
150
152
|
debounceWait: wait
|
|
@@ -137,7 +137,7 @@ const useLabelOptions = (others)=>{
|
|
|
137
137
|
resource: (null == collectionField ? void 0 : collectionField.target) || fieldSchema['collectionName'],
|
|
138
138
|
action: 'list',
|
|
139
139
|
params: {
|
|
140
|
-
|
|
140
|
+
paginate: false
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
const regex = /{{(.*?)}}/g;
|
|
@@ -172,7 +172,7 @@ const useLabelOptions = (others)=>{
|
|
|
172
172
|
const opvalue = opValue[match[1].split('.')[0]];
|
|
173
173
|
const value = opvalue ? opValue[match[1].split('.')[0]][match[1].split('.')[1]] : '';
|
|
174
174
|
valueOject[match[1]] = null != value ? value : '';
|
|
175
|
-
} else valueOject[match[1]] =
|
|
175
|
+
} else valueOject[match[1]] = opValue[match[1]] || '';
|
|
176
176
|
outputStr = replacePlaceholders(formula, valueOject);
|
|
177
177
|
}
|
|
178
178
|
});
|
|
@@ -199,7 +199,7 @@ const FormulaSelect = (props)=>{
|
|
|
199
199
|
api.request({
|
|
200
200
|
url: others.collection + ':list',
|
|
201
201
|
params: {
|
|
202
|
-
|
|
202
|
+
paginate: false,
|
|
203
203
|
filter: filterField ? {
|
|
204
204
|
...filterField.filter
|
|
205
205
|
} : {}
|
|
@@ -128,7 +128,9 @@ const InternalSelect = (0, schema_namespaceObject.connect)((props)=>{
|
|
|
128
128
|
'multiple',
|
|
129
129
|
'tags'
|
|
130
130
|
].includes(mode)) mode = void 0;
|
|
131
|
-
if (
|
|
131
|
+
if ([
|
|
132
|
+
'CustomTitle'
|
|
133
|
+
].includes(props.mode) && ('formula' in others.fieldNames || 'collection' in props)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormulaSelect_js_default(), {
|
|
132
134
|
...props
|
|
133
135
|
});
|
|
134
136
|
if (objectValue) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ObjectSelect, {
|
|
@@ -185,7 +185,9 @@ function getCurrentRange(element) {
|
|
|
185
185
|
return result;
|
|
186
186
|
}
|
|
187
187
|
function TextArea(props) {
|
|
188
|
-
const { value
|
|
188
|
+
const { value: propsValue, scope, onChange, multiline = true, changeOnSelect } = props;
|
|
189
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
190
|
+
const value = propsValue || fieldSchema.default || '';
|
|
189
191
|
const { styles } = (0, external_style_js_namespaceObject.useStyles)({
|
|
190
192
|
multiline
|
|
191
193
|
});
|
|
@@ -236,6 +236,10 @@ const useFieldModeOptions = (props)=>{
|
|
|
236
236
|
label: t('Tag'),
|
|
237
237
|
value: 'Tag'
|
|
238
238
|
},
|
|
239
|
+
{
|
|
240
|
+
label: t('Custom Title'),
|
|
241
|
+
value: 'CustomTitle'
|
|
242
|
+
},
|
|
239
243
|
!isTableField && {
|
|
240
244
|
label: t('Sub-details'),
|
|
241
245
|
value: 'Nester'
|
|
@@ -264,6 +268,10 @@ const useFieldModeOptions = (props)=>{
|
|
|
264
268
|
{
|
|
265
269
|
label: t('Cascader'),
|
|
266
270
|
value: 'Cascader'
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
label: t('Custom Title'),
|
|
274
|
+
value: 'CustomTitle'
|
|
267
275
|
}
|
|
268
276
|
];
|
|
269
277
|
default:
|
|
@@ -154,6 +154,7 @@ class SchemaInitializerPlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
154
154
|
this.app.schemaInitializerManager.add(external_buttons_index_js_namespaceObject.tabPaneInitializersForRecordBlock);
|
|
155
155
|
this.app.schemaInitializerManager.add(external_buttons_index_js_namespaceObject.tabPaneInitializersForBulkEditFormBlock);
|
|
156
156
|
this.app.schemaInitializerManager.add(menuItemInitializer_js_namespaceObject.menuItemInitializer);
|
|
157
|
+
this.app.schemaInitializerManager.add(external_buttons_index_js_namespaceObject.tabPaneInitializers);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
var __webpack_export_target__ = exports;
|
|
@@ -26,6 +26,7 @@ var __webpack_require__ = {};
|
|
|
26
26
|
var __webpack_exports__ = {};
|
|
27
27
|
__webpack_require__.r(__webpack_exports__);
|
|
28
28
|
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
tabPaneInitializers: ()=>tabPaneInitializers,
|
|
29
30
|
tabPaneInitializersForRecordBlock: ()=>tabPaneInitializersForRecordBlock,
|
|
30
31
|
tabPaneInitializers_deprecated: ()=>tabPaneInitializers_deprecated,
|
|
31
32
|
TabPaneInitializersForCreateFormBlock: ()=>TabPaneInitializersForCreateFormBlock,
|
|
@@ -179,11 +180,19 @@ const TabPaneInitializersForBulkEditFormBlock = (props)=>/*#__PURE__*/ (0, jsx_r
|
|
|
179
180
|
...props,
|
|
180
181
|
isBulkEdit: true
|
|
181
182
|
});
|
|
183
|
+
const commonOptions = {
|
|
184
|
+
Component: TabPaneInitializers,
|
|
185
|
+
popover: false
|
|
186
|
+
};
|
|
182
187
|
const tabPaneInitializers_deprecated = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
|
|
183
188
|
name: 'TabPaneInitializers',
|
|
184
189
|
Component: TabPaneInitializers,
|
|
185
190
|
popover: false
|
|
186
191
|
});
|
|
192
|
+
const tabPaneInitializers = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
|
|
193
|
+
name: 'popup:addTab',
|
|
194
|
+
...commonOptions
|
|
195
|
+
});
|
|
187
196
|
const tabPaneInitializersForRecordBlock = new SchemaInitializer_js_namespaceObject.SchemaInitializer({
|
|
188
197
|
name: 'TabPaneInitializersForCreateFormBlock',
|
|
189
198
|
Component: TabPaneInitializersForCreateFormBlock,
|
|
@@ -41,7 +41,9 @@ function useFormulaTitleOptions() {
|
|
|
41
41
|
const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
|
|
42
42
|
const { getCollectionJoinField, getCollectionFields } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
43
43
|
const { getField } = (0, index_js_namespaceObject.useCollection_deprecated)();
|
|
44
|
-
const fieldSchema = (0,
|
|
44
|
+
const { fieldSchema: tableColumnSchema } = (0, external_schema_component_index_js_namespaceObject.useColumnSchema)();
|
|
45
|
+
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
46
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
45
47
|
const collectionManage = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
46
48
|
const collectionManageField = collectionManage.collections.filter((value)=>value.name === fieldSchema['x-decorator-props'])[0];
|
|
47
49
|
const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
@@ -50,7 +52,10 @@ function useFormulaTitleOptions() {
|
|
|
50
52
|
else if (collectionManageField) fields = collectionManageField['fields'];
|
|
51
53
|
const options = [];
|
|
52
54
|
null == fields || fields.forEach((field)=>{
|
|
53
|
-
if (
|
|
55
|
+
if (![
|
|
56
|
+
'm2m',
|
|
57
|
+
'o2m'
|
|
58
|
+
].includes(field.interface)) {
|
|
54
59
|
if (field.uiSchema) {
|
|
55
60
|
var _getCollectionFields;
|
|
56
61
|
var _getCollectionFields_filter_map;
|
|
@@ -66,6 +66,7 @@ const markdownBlockSettings_js_namespaceObject = require("../modules/blocks/othe
|
|
|
66
66
|
const cascaderComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Cascader/cascaderComponentFieldSettings.js");
|
|
67
67
|
const cascadeSelectComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/CascadeSelect/cascadeSelectComponentFieldSettings.js");
|
|
68
68
|
const checkboxComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Checkbox/checkboxComponentFieldSettings.js");
|
|
69
|
+
const customTitleComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js");
|
|
69
70
|
const datePickerComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/DatePicker/datePickerComponentFieldSettings.js");
|
|
70
71
|
const drawerSubTableComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js");
|
|
71
72
|
const fileManagerComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/FileManager/fileManagerComponentFieldSettings.js");
|
|
@@ -130,6 +131,7 @@ class SchemaSettingsPlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
130
131
|
this.schemaSettingsManager.add(inputNumberComponentFieldSettings_js_namespaceObject.inputNumberComponentFieldSettings);
|
|
131
132
|
this.schemaSettingsManager.add(checkboxComponentFieldSettings_js_namespaceObject.checkboxComponentFieldSettings);
|
|
132
133
|
this.schemaSettingsManager.add(radioComponentFieldSettings_js_namespaceObject.radioComponentFieldSettings);
|
|
134
|
+
this.schemaSettingsManager.add(customTitleComponentFieldSettings_js_namespaceObject.CustomTitleComponentFieldSettings);
|
|
133
135
|
this.schemaSettingsManager.add(fileManagerComponentFieldSettings_js_namespaceObject.fileManagerComponentFieldSettings);
|
|
134
136
|
this.schemaSettingsManager.add(tagComponentFieldSettings_js_namespaceObject.tagComponentFieldSettings);
|
|
135
137
|
this.schemaSettingsManager.add(cascadeSelectComponentFieldSettings_js_namespaceObject.cascadeSelectComponentFieldSettings);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/client",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.47",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.mjs",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"react-zoom-pan-pinch": "^3.6.1",
|
|
65
65
|
"sanitize-html": "2.14.0",
|
|
66
66
|
"use-deep-compare-effect": "^1.8.1",
|
|
67
|
-
"@tachybase/components": "0.23.
|
|
68
|
-
"@tachybase/
|
|
69
|
-
"@tachybase/
|
|
70
|
-
"@tachybase/schema": "0.23.
|
|
71
|
-
"@tachybase/
|
|
72
|
-
"@tachybase/
|
|
67
|
+
"@tachybase/components": "0.23.47",
|
|
68
|
+
"@tachybase/requirejs": "0.23.47",
|
|
69
|
+
"@tachybase/evaluators": "0.23.47",
|
|
70
|
+
"@tachybase/schema": "0.23.47",
|
|
71
|
+
"@tachybase/sdk": "0.23.47",
|
|
72
|
+
"@tachybase/utils": "0.23.47"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@testing-library/react": "^
|
|
75
|
+
"@testing-library/react": "^16.2.0",
|
|
76
76
|
"@types/flat": "^5.0.5",
|
|
77
77
|
"@types/lodash": "^4.17.13",
|
|
78
78
|
"@types/markdown-it": "12.2.3",
|