@tachybase/client 0.23.41 → 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/data-source/collection-field/CollectionField.d.ts +1 -1
- package/es/data-source/data-source/DataSource.d.ts +3 -0
- 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/__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/__tests__/createTableBLockSchema.test.mjs +1 -1
- 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/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/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/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-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/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/__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/__tests__/createTableBLockSchema.test.js +1 -1
- 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/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/auto-complete/AutoComplete.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.Settings.js +83 -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-settings/EditFormulaTitleField.js +7 -2
- package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
- package/package.json +8 -8
|
@@ -18,7 +18,7 @@ class WebSocketClient {
|
|
|
18
18
|
const apiBaseURL = null == options ? void 0 : null === (_options_apiClient = options.apiClient) || void 0 === _options_apiClient ? void 0 : _options_apiClient['baseURL'];
|
|
19
19
|
if (!apiBaseURL) return;
|
|
20
20
|
const subApp = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_sdk__.getSubAppName)(this.app.getPublicPath());
|
|
21
|
-
const queryString = subApp ? "?__appName=".concat(subApp) :
|
|
21
|
+
const queryString = subApp ? "?__appName=".concat(subApp) : "?__hostname=".concat(window.location.hostname);
|
|
22
22
|
const wsPath = this.options.basename || '/ws';
|
|
23
23
|
if (this.options.url) {
|
|
24
24
|
const url = new URL(this.options.url);
|
|
@@ -132,20 +132,17 @@ const defaultSettingItems = [
|
|
|
132
132
|
refresh,
|
|
133
133
|
fieldSchema
|
|
134
134
|
]);
|
|
135
|
-
const { data } = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useRequest)(async ()=>{
|
|
136
|
-
const { data } = await api.request({
|
|
137
|
-
url: "/uiSchemas:getJsonSchema/".concat(fieldSchema['x-uid'], "?includeAsyncNode=true")
|
|
138
|
-
});
|
|
139
|
-
return data;
|
|
140
|
-
});
|
|
141
135
|
return {
|
|
142
136
|
width: '800px',
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
};
|
|
137
|
+
asyncGetInitialValues: async ()=>{
|
|
138
|
+
const { data } = await api.request({
|
|
139
|
+
url: "/uiSchemas:getJsonSchema/".concat(fieldSchema['x-uid'], "?includeAsyncNode=true")
|
|
140
|
+
});
|
|
148
141
|
return {
|
|
142
|
+
schema: JSON.stringify((null == data ? void 0 : data.data) || {}, null, 2)
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
schema: ()=>({
|
|
149
146
|
type: 'object',
|
|
150
147
|
title: t('Edit'),
|
|
151
148
|
properties: {
|
|
@@ -153,7 +150,6 @@ const defaultSettingItems = [
|
|
|
153
150
|
type: 'string',
|
|
154
151
|
title: '{{ t("Schema") }}',
|
|
155
152
|
required: true,
|
|
156
|
-
default: JSON.stringify((null == data ? void 0 : data.data) || {}, null, 2),
|
|
157
153
|
'x-decorator': 'FormItem',
|
|
158
154
|
'x-component': 'CodeMirror',
|
|
159
155
|
'x-component-props': {
|
|
@@ -162,9 +158,8 @@ const defaultSettingItems = [
|
|
|
162
158
|
}
|
|
163
159
|
}
|
|
164
160
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
title: data ? t('Edit') : t('Loading'),
|
|
161
|
+
}),
|
|
162
|
+
title: t('Edit'),
|
|
168
163
|
onSubmit: async (param)=>{
|
|
169
164
|
let { schema } = param;
|
|
170
165
|
dn.emit('patch', {
|
|
@@ -385,6 +385,7 @@ const useFilterBlockActionProps = ()=>{
|
|
|
385
385
|
async onClick () {
|
|
386
386
|
const { targets = [], uid } = findFilterTargets(fieldSchema);
|
|
387
387
|
actionField.data.loading = true;
|
|
388
|
+
let prevMergedFilter = {};
|
|
388
389
|
try {
|
|
389
390
|
await Promise.all(getDataBlocks().map(async (block)=>{
|
|
390
391
|
var _block_service_params, _block_service_params_, _block_service_params1, _Object_keys;
|
|
@@ -415,8 +416,10 @@ const useFilterBlockActionProps = ()=>{
|
|
|
415
416
|
const mergedFilter = (0, __WEBPACK_EXTERNAL_MODULE__filter_provider_utils_mjs__.mergeFilter)([
|
|
416
417
|
...Object.values(storedFilter).map((filter)=>(0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.removeNullCondition)(filter)),
|
|
417
418
|
block.defaultFilter,
|
|
418
|
-
filter.customFilter
|
|
419
|
+
filter.customFilter,
|
|
420
|
+
prevMergedFilter
|
|
419
421
|
]);
|
|
422
|
+
prevMergedFilter = mergedFilter;
|
|
420
423
|
if ('manual' === block.dataLoadingMode && __WEBPACK_EXTERNAL_MODULE_lodash__["default"].isEmpty(mergedFilter)) return block.clearData();
|
|
421
424
|
return block.doFilter({
|
|
422
425
|
...param,
|
|
@@ -1089,7 +1092,7 @@ const useAssociationNames = (dataSource)=>{
|
|
|
1089
1092
|
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
1090
1093
|
const _getAssociationAppends = (schema, str)=>{
|
|
1091
1094
|
schema.reduceProperties((pre, s)=>{
|
|
1092
|
-
var _s_xcomponentprops, _s_xcomponentprops1, _getCollection;
|
|
1095
|
+
var _s_xcomponentprops, _s_xcomponentprops_fieldNames, _s_xcomponentprops1, _s_xcomponentprops2, _getCollection;
|
|
1093
1096
|
const prefix = pre || str;
|
|
1094
1097
|
const collectionField = s['x-collection-field'] && getCollectionJoinField(s['x-collection-field'], dataSource);
|
|
1095
1098
|
const isAssociationSubfield = s.name.includes('.');
|
|
@@ -1100,11 +1103,27 @@ const useAssociationNames = (dataSource)=>{
|
|
|
1100
1103
|
'belongsToMany'
|
|
1101
1104
|
].includes(collectionField.type);
|
|
1102
1105
|
if (null === (_s_xcomponentprops = s['x-component-props']) || void 0 === _s_xcomponentprops ? void 0 : _s_xcomponentprops['appends']) {
|
|
1103
|
-
var
|
|
1104
|
-
__WEBPACK_EXTERNAL_MODULE_lodash__["default"].forEach(null === (
|
|
1106
|
+
var _s_xcomponentprops3;
|
|
1107
|
+
__WEBPACK_EXTERNAL_MODULE_lodash__["default"].forEach(null === (_s_xcomponentprops3 = s['x-component-props']) || void 0 === _s_xcomponentprops3 ? void 0 : _s_xcomponentprops3['appends'], (append)=>{
|
|
1105
1108
|
appends.add(append);
|
|
1106
1109
|
});
|
|
1107
1110
|
}
|
|
1111
|
+
if (null === (_s_xcomponentprops1 = s['x-component-props']) || void 0 === _s_xcomponentprops1 ? void 0 : null === (_s_xcomponentprops_fieldNames = _s_xcomponentprops1.fieldNames) || void 0 === _s_xcomponentprops_fieldNames ? void 0 : _s_xcomponentprops_fieldNames.formula) {
|
|
1112
|
+
var _s_xcomponentprops_fieldNames1, _s_xcomponentprops4;
|
|
1113
|
+
appends.add(s['name']);
|
|
1114
|
+
const regex = /{{(.*?)}}/g;
|
|
1115
|
+
const formula = null === (_s_xcomponentprops4 = s['x-component-props']) || void 0 === _s_xcomponentprops4 ? void 0 : null === (_s_xcomponentprops_fieldNames1 = _s_xcomponentprops4.fieldNames) || void 0 === _s_xcomponentprops_fieldNames1 ? void 0 : _s_xcomponentprops_fieldNames1.formula;
|
|
1116
|
+
let match;
|
|
1117
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
1118
|
+
const matchList = match[1].split('.');
|
|
1119
|
+
let appendsValue = s['name'];
|
|
1120
|
+
matchList.forEach((item, index)=>{
|
|
1121
|
+
if (index === matchList.length - 1) return;
|
|
1122
|
+
appendsValue += '.' + item;
|
|
1123
|
+
appends.add(appendsValue);
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1108
1127
|
if (s['x-linkage-rules']) {
|
|
1109
1128
|
const collectAppends = (obj)=>{
|
|
1110
1129
|
const type = Object.keys(obj)[0] || '$and';
|
|
@@ -1121,7 +1140,7 @@ const useAssociationNames = (dataSource)=>{
|
|
|
1121
1140
|
collectAppends(condition);
|
|
1122
1141
|
});
|
|
1123
1142
|
}
|
|
1124
|
-
if (null === (
|
|
1143
|
+
if (null === (_s_xcomponentprops2 = s['x-component-props']) || void 0 === _s_xcomponentprops2 ? void 0 : _s_xcomponentprops2['x-next-title']) {
|
|
1125
1144
|
const pre = prefix && '' !== prefix ? prefix + '.' + s.name : s.name;
|
|
1126
1145
|
const title = s['x-component-props']['x-next-title'];
|
|
1127
1146
|
const path = pre + '.' + title.label;
|
|
@@ -1129,7 +1148,7 @@ const useAssociationNames = (dataSource)=>{
|
|
|
1129
1148
|
}
|
|
1130
1149
|
const isTreeCollection = isAssociationField && (null === (_getCollection = getCollection(collectionField.target, dataSource)) || void 0 === _getCollection ? void 0 : _getCollection.template) === 'tree';
|
|
1131
1150
|
if (collectionField && (isAssociationField || isAssociationSubfield) && 'TableField' !== s['x-component']) {
|
|
1132
|
-
var
|
|
1151
|
+
var _s_xcomponentprops5;
|
|
1133
1152
|
const fieldPath = !isAssociationField && isAssociationSubfield ? getAssociationPath(s.name) : s.name;
|
|
1134
1153
|
const path = '' !== prefix && prefix ? prefix + '.' + fieldPath : fieldPath;
|
|
1135
1154
|
if (isTreeCollection) {
|
|
@@ -1140,7 +1159,7 @@ const useAssociationNames = (dataSource)=>{
|
|
|
1140
1159
|
'Nester',
|
|
1141
1160
|
'SubTable',
|
|
1142
1161
|
'PopoverNester'
|
|
1143
|
-
].includes(null === (
|
|
1162
|
+
].includes(null === (_s_xcomponentprops5 = s['x-component-props']) || void 0 === _s_xcomponentprops5 ? void 0 : _s_xcomponentprops5.mode)) {
|
|
1144
1163
|
updateAssociationValues.add(path);
|
|
1145
1164
|
const bufPrefix = prefix && '' !== prefix ? prefix + '.' + s.name : s.name;
|
|
1146
1165
|
_getAssociationAppends(s, bufPrefix);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const RoleResourceCollectionContext: React.Context<any>;
|
|
3
|
-
export declare const RolesResourcesActions: React.ForwardRefExoticComponent<Omit<
|
|
3
|
+
export declare const RolesResourcesActions: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const StrategyActions: React.ForwardRefExoticComponent<Omit<
|
|
2
|
+
export declare const StrategyActions: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
@@ -7,5 +7,5 @@ type Props = {
|
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
export declare const CollectionFieldInternalField: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const CollectionField: React.ForwardRefExoticComponent<Omit<
|
|
10
|
+
export declare const CollectionField: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
11
11
|
export {};
|
|
@@ -8,6 +8,9 @@ export interface DataSourceOptions {
|
|
|
8
8
|
errorMessage?: string;
|
|
9
9
|
status?: 'loaded' | 'loading-failed' | 'loading' | 'reloading';
|
|
10
10
|
isDBInstance?: boolean;
|
|
11
|
+
options?: {
|
|
12
|
+
baseUrl?: string;
|
|
13
|
+
};
|
|
11
14
|
}
|
|
12
15
|
export type DataSourceFactory = new (options: DataSourceOptions, dataSourceManager: DataSourceManager) => DataSource;
|
|
13
16
|
export declare abstract class DataSource {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__createDetailsWithPaginationUISchema_mjs__ from "../createDetailsWithPaginationUISchema.mjs";
|
|
2
|
-
vi.mock('@
|
|
2
|
+
vi.mock('@tachybase/schema', ()=>({
|
|
3
3
|
uid: vi.fn().mockReturnValue('mocked-uid')
|
|
4
4
|
}));
|
|
5
5
|
describe('createDetailsBlockWithPaginationUISchema', ()=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__createCreateFormBlockUISchema_mjs__ from "../createCreateFormBlockUISchema.mjs";
|
|
2
|
-
vi.mock('@
|
|
2
|
+
vi.mock('@tachybase/schema', ()=>({
|
|
3
3
|
uid: ()=>'mocked-uid'
|
|
4
4
|
}));
|
|
5
5
|
describe('createCreateFormBlockUISchema', ()=>{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_vitest__ from "vitest";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__createEditFormBlockUISchema_mjs__ from "../createEditFormBlockUISchema.mjs";
|
|
3
|
-
__WEBPACK_EXTERNAL_MODULE_vitest__.vi.mock('@
|
|
3
|
+
__WEBPACK_EXTERNAL_MODULE_vitest__.vi.mock('@tachybase/schema', ()=>({
|
|
4
4
|
uid: ()=>'uniqueId'
|
|
5
5
|
}));
|
|
6
6
|
describe('createEditFormBlockUISchema', ()=>{
|
package/es/modules/blocks/filter-blocks/collapse/__tests__/createCollapseBlockSchema.test.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__createFilterCollapseBlockSchema_mjs__ from "../createFilterCollapseBlockSchema.mjs";
|
|
2
|
-
vi.mock('@
|
|
2
|
+
vi.mock('@tachybase/schema', ()=>({
|
|
3
3
|
uid: vi.fn().mockReturnValue('mocked-uid')
|
|
4
4
|
}));
|
|
5
5
|
describe('createCollapseBlockSchema', ()=>{
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__ from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__ from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_hooks_useIsShowMultipleSwitch_mjs__ from "../../../../schema-settings/hooks/useIsShowMultipleSwitch.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__ from "../Select/selectComponentFieldSettings.mjs";
|
|
6
|
+
const CustomTitleComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
7
|
+
name: 'fieldSettings:component:CustomTitle',
|
|
8
|
+
items: [
|
|
9
|
+
{
|
|
10
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.fieldComponent,
|
|
11
|
+
useVisible: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsMuiltipleAble
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.CustomTitle,
|
|
15
|
+
useVisible: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsMuiltipleAble
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.setTheDataScope,
|
|
19
|
+
useVisible () {
|
|
20
|
+
const isSelectFieldMode = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsSelectFieldMode)();
|
|
21
|
+
const isFieldReadPretty = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsFieldReadPretty)();
|
|
22
|
+
return isSelectFieldMode && !isFieldReadPretty;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.setDefaultSortingRules,
|
|
27
|
+
useComponentProps () {
|
|
28
|
+
const { fieldSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__.useColumnSchema)();
|
|
29
|
+
return {
|
|
30
|
+
fieldSchema
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
useVisible () {
|
|
34
|
+
const isSelectFieldMode = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsSelectFieldMode)();
|
|
35
|
+
const isFieldReadPretty = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsFieldReadPretty)();
|
|
36
|
+
return isSelectFieldMode && !isFieldReadPretty;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.quickCreate,
|
|
41
|
+
useVisible () {
|
|
42
|
+
const isAssociationField = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsAssociationField)();
|
|
43
|
+
const readPretty = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsFieldReadPretty)();
|
|
44
|
+
const { fieldSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__.useColumnSchema)();
|
|
45
|
+
return isAssociationField && !fieldSchema && !readPretty;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.allowMultiple,
|
|
50
|
+
useVisible () {
|
|
51
|
+
const isAssociationField = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsAssociationField)();
|
|
52
|
+
const IsShowMultipleSwitch = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_hooks_useIsShowMultipleSwitch_mjs__.useIsShowMultipleSwitch)();
|
|
53
|
+
return isAssociationField && IsShowMultipleSwitch();
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
...__WEBPACK_EXTERNAL_MODULE__Select_selectComponentFieldSettings_mjs__.enableLink,
|
|
58
|
+
useVisible () {
|
|
59
|
+
const readPretty = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsFieldReadPretty)();
|
|
60
|
+
return (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsAssociationField)() && readPretty;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
});
|
|
65
|
+
export { CustomTitleComponentFieldSettings };
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
import { ISchema } from '@tachybase/schema';
|
|
1
2
|
import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
|
|
3
|
+
export declare const enableLink: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
useVisible(): boolean;
|
|
7
|
+
useComponentProps(): {
|
|
8
|
+
title: string;
|
|
9
|
+
checked: boolean;
|
|
10
|
+
onChange(flag: any): void;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const titleField: any;
|
|
2
14
|
export declare const allowMultiple: any;
|
|
15
|
+
export declare const quickCreate: any;
|
|
16
|
+
export declare const setDefaultSortingRules: {
|
|
17
|
+
name: string;
|
|
18
|
+
Component: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
export declare const setTheDataScope: any;
|
|
21
|
+
export declare const fieldComponent: any;
|
|
22
|
+
export declare const CustomTitle: {
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
useComponentProps(): {
|
|
26
|
+
title: string;
|
|
27
|
+
schema: ISchema;
|
|
28
|
+
onSubmit: ({ formula }: {
|
|
29
|
+
formula: any;
|
|
30
|
+
}) => void;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
3
33
|
export declare const selectComponentFieldSettings: SchemaSettings<{}>;
|
|
@@ -325,6 +325,67 @@ const fieldComponent = {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
};
|
|
328
|
+
const CustomTitle = {
|
|
329
|
+
name: 'customTitle',
|
|
330
|
+
type: 'modal',
|
|
331
|
+
useComponentProps () {
|
|
332
|
+
var _fieldSchema_xcomponentprops_fieldNames, _fieldSchema_xcomponentprops;
|
|
333
|
+
const schema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
334
|
+
const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__.useColumnSchema)();
|
|
335
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
336
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
337
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
338
|
+
const options = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useFormulaTitleOptions)();
|
|
339
|
+
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;
|
|
340
|
+
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
341
|
+
return {
|
|
342
|
+
title: t('Custom option label'),
|
|
343
|
+
schema: {
|
|
344
|
+
type: 'object',
|
|
345
|
+
title: t('Custom option label'),
|
|
346
|
+
properties: {
|
|
347
|
+
formula: {
|
|
348
|
+
required: true,
|
|
349
|
+
'x-decorator': 'FormItem',
|
|
350
|
+
'x-component': 'Variable.TextArea',
|
|
351
|
+
'x-component-props': {
|
|
352
|
+
scope: options
|
|
353
|
+
},
|
|
354
|
+
default: def
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
onSubmit: (param)=>{
|
|
359
|
+
let { formula } = param;
|
|
360
|
+
if (formula) {
|
|
361
|
+
var _fieldSchema_xcomponentprops, _field_componentProps;
|
|
362
|
+
const componentProps = {
|
|
363
|
+
...fieldSchema['x-component-props'],
|
|
364
|
+
fieldNames: {
|
|
365
|
+
...null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['fieldNames'],
|
|
366
|
+
formula
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
field.componentProps = {
|
|
370
|
+
...field.componentProps,
|
|
371
|
+
fieldNames: {
|
|
372
|
+
...null === (_field_componentProps = field.componentProps) || void 0 === _field_componentProps ? void 0 : _field_componentProps.fieldNames,
|
|
373
|
+
formula
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
fieldSchema['x-component-props'] = componentProps;
|
|
377
|
+
dn.emit('patch', {
|
|
378
|
+
schema: {
|
|
379
|
+
'x-uid': fieldSchema['x-uid'],
|
|
380
|
+
'x-component-props': componentProps
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
dn.refresh();
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
};
|
|
328
389
|
const selectComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
329
390
|
name: 'fieldSettings:component:Select',
|
|
330
391
|
items: [
|
|
@@ -381,12 +442,7 @@ const selectComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_
|
|
|
381
442
|
const readPretty = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsFieldReadPretty)();
|
|
382
443
|
return (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__.useIsAssociationField)() && readPretty;
|
|
383
444
|
}
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
name: 'formulatitleField',
|
|
387
|
-
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.EditFormulaTitleField,
|
|
388
|
-
useVisible: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useFormulaTitleVisible
|
|
389
445
|
}
|
|
390
446
|
]
|
|
391
447
|
});
|
|
392
|
-
export { allowMultiple, selectComponentFieldSettings };
|
|
448
|
+
export { CustomTitle, allowMultiple, enableLink, fieldComponent, quickCreate, selectComponentFieldSettings, setDefaultSortingRules, setTheDataScope, titleField };
|
|
@@ -254,7 +254,7 @@ function WorkflowSelectComponent(param) {
|
|
|
254
254
|
const [workflowCollection, setWorkflowCollection] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)((0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.joinCollectionName)(dataSourceKey, baseCollection.name));
|
|
255
255
|
const compile = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCompile)();
|
|
256
256
|
const workflowPlugin = (0, __WEBPACK_EXTERNAL_MODULE__application_hooks_index_mjs__.usePlugin)('workflow');
|
|
257
|
-
|
|
257
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>workflowPlugin.getTriggersOptions().filter((item)=>'function' == typeof item.options.isActionTriggerable || true === item.options.isActionTriggerable).map((item)=>item.value), [
|
|
258
258
|
workflowPlugin
|
|
259
259
|
]);
|
|
260
260
|
(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFormEffects)(()=>{
|
|
@@ -307,13 +307,11 @@ function WorkflowSelectComponent(param) {
|
|
|
307
307
|
action: 'list',
|
|
308
308
|
params: {
|
|
309
309
|
filter: {
|
|
310
|
-
type:
|
|
311
|
-
enabled:
|
|
310
|
+
type: void 0 === props.filterType ? void 0 : props.filterType,
|
|
311
|
+
enabled: void 0 === props.filterEnabled || props.filterEnabled,
|
|
312
312
|
'config.collection': noCollection ? void 0 : workflowCollection,
|
|
313
|
-
sync:
|
|
314
|
-
key: props.
|
|
315
|
-
$ne: props.parentKey
|
|
316
|
-
} : void 0
|
|
313
|
+
sync: void 0 === props.filterSync ? void 0 : props.filterSync,
|
|
314
|
+
key: void 0 === props.filterKey ? void 0 : props.filterKey
|
|
317
315
|
}
|
|
318
316
|
}
|
|
319
317
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const AssociationCascader: React.ForwardRefExoticComponent<Omit<
|
|
2
|
+
export declare const AssociationCascader: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
3
3
|
export declare const SingleValueCascader: {
|
|
4
4
|
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
@@ -17,7 +17,7 @@ const AssociationCascader = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.co
|
|
|
17
17
|
fields: [
|
|
18
18
|
titleField
|
|
19
19
|
],
|
|
20
|
-
|
|
20
|
+
paginate: false,
|
|
21
21
|
filter: (null == props ? void 0 : null === (_props_params = props.params) || void 0 === _props_params ? void 0 : _props_params.filter) ? {
|
|
22
22
|
...null == props ? void 0 : null === (_props_params1 = props.params) || void 0 === _props_params1 ? void 0 : _props_params1.filter
|
|
23
23
|
} : {}
|
|
@@ -11,5 +11,5 @@ interface AssociationSelectInterface {
|
|
|
11
11
|
FilterDesigner: React.FC;
|
|
12
12
|
}
|
|
13
13
|
export declare const AssociationSelect: AssociationSelectInterface;
|
|
14
|
-
export declare const AssociationSelectReadPretty: React.ForwardRefExoticComponent<Omit<
|
|
14
|
+
export declare const AssociationSelectReadPretty: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
15
15
|
export {};
|
|
@@ -70,7 +70,7 @@ const EditableAssociationField = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema
|
|
|
70
70
|
'PopoverNester' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__InternalPopoverNester_mjs__.InternaPopoverNester, {
|
|
71
71
|
...props
|
|
72
72
|
}),
|
|
73
|
-
'Select' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AssociationSelect, {
|
|
73
|
+
('Select' === currentMode || 'CustomTitle' === currentMode) && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AssociationSelect, {
|
|
74
74
|
...props
|
|
75
75
|
}),
|
|
76
76
|
'SubTable' === currentMode && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__InternalSubTable_mjs__.InternalSubTable, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
declare const InternalFileManager: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
declare const FileManageReadPretty: React.ForwardRefExoticComponent<Omit<
|
|
3
|
+
declare const FileManageReadPretty: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>;
|
|
4
4
|
export { FileManageReadPretty, InternalFileManager };
|
|
@@ -76,7 +76,7 @@ const Cascade = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((prop
|
|
|
76
76
|
onDropdownVisibleChange(true);
|
|
77
77
|
setSelectedOptions(defaultData);
|
|
78
78
|
} else resource.list({
|
|
79
|
-
|
|
79
|
+
paginate: false,
|
|
80
80
|
filter: propsValue.id ? {
|
|
81
81
|
id: {
|
|
82
82
|
$eq: propsValue.id
|
|
@@ -102,7 +102,7 @@ const Cascade = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((prop
|
|
|
102
102
|
const handleGetOptions = async ()=>{
|
|
103
103
|
var _response_data;
|
|
104
104
|
const response = await resource.list({
|
|
105
|
-
|
|
105
|
+
paginate: false,
|
|
106
106
|
filter: (0, __WEBPACK_EXTERNAL_MODULE__filter_provider_utils_mjs__.mergeFilter)([
|
|
107
107
|
fieldFilter,
|
|
108
108
|
filter
|
|
@@ -29,7 +29,7 @@ const ReadPrettyInternalViewer = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema
|
|
|
29
29
|
const { getCollection } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollectionManager_deprecated)();
|
|
30
30
|
const { enableLink } = fieldSchema['x-component-props'] || {};
|
|
31
31
|
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
32
|
-
const
|
|
32
|
+
const defFieldNames = (0, __WEBPACK_EXTERNAL_MODULE__hooks_mjs__.useFieldNames)(props);
|
|
33
33
|
const [visible, setVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
34
34
|
const insertViewer = (0, __WEBPACK_EXTERNAL_MODULE__hooks_mjs__.useInsertSchema)('Viewer');
|
|
35
35
|
const { options: collectionField } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_mjs__.useAssociationFieldContext)();
|
|
@@ -41,7 +41,8 @@ const ReadPrettyInternalViewer = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema
|
|
|
41
41
|
const isTreeCollection = (null == targetCollection ? void 0 : targetCollection.template) === 'tree';
|
|
42
42
|
const ellipsisWithTooltipRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
|
|
43
43
|
const getLabelUiSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.useLabelUiSchemaV2)();
|
|
44
|
-
const
|
|
44
|
+
const { formulaRecord, fieldNames } = customTitle(recordCtx, fieldSchema, defFieldNames);
|
|
45
|
+
const renderRecords = ()=>(0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.toArr)(formulaRecord[fieldSchema['name']] || props.value).map((record, index, arr)=>{
|
|
45
46
|
var _getCollection_options, _getCollection, _targetCollection_fieldsMap_, _targetCollection_fieldsMap, _getCollection_options1, _getCollection1, _targetCollection_fieldsMap_1, _targetCollection_fieldsMap1;
|
|
46
47
|
const value = null == record ? void 0 : record[(null == fieldNames ? void 0 : fieldNames.label) || 'label'];
|
|
47
48
|
const label = isTreeCollection ? (0, __WEBPACK_EXTERNAL_MODULE__InternalCascadeSelect_mjs__.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;
|
|
@@ -96,11 +97,11 @@ const ReadPrettyInternalViewer = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema
|
|
|
96
97
|
const collectionFieldNames = null == fieldSchema ? void 0 : null === (_fieldSchema_xcollectionfield = fieldSchema['x-collection-field']) || void 0 === _fieldSchema_xcollectionfield ? void 0 : _fieldSchema_xcollectionfield.split('.');
|
|
97
98
|
return collectionFieldNames && collectionFieldNames.length > 2 ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__.RecordProvider, {
|
|
98
99
|
record: record,
|
|
99
|
-
parent:
|
|
100
|
+
parent: formulaRecord[collectionFieldNames[1]],
|
|
100
101
|
children: renderWithoutTableFieldResourceProvider()
|
|
101
102
|
}) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__record_provider_index_mjs__.RecordProvider, {
|
|
102
103
|
record: record,
|
|
103
|
-
parent:
|
|
104
|
+
parent: formulaRecord,
|
|
104
105
|
children: renderWithoutTableFieldResourceProvider()
|
|
105
106
|
});
|
|
106
107
|
};
|
|
@@ -133,4 +134,58 @@ const ReadPrettyInternalViewer = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema
|
|
|
133
134
|
}, {
|
|
134
135
|
displayName: 'ReadPrettyInternalViewer'
|
|
135
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 ? 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)) {
|
|
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 === _schema_xcomponentprops2 ? void 0 : null === (_schema_xcomponentprops_fieldNames1 = _schema_xcomponentprops2.fieldNames) || void 0 === _schema_xcomponentprops_fieldNames1 ? 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 ? void 0 : _result_currRecord1[value];
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
result.value = null === (_result_currRecord = result.currRecord) || void 0 === _result_currRecord ? void 0 : _result_currRecord[value];
|
|
163
|
+
});
|
|
164
|
+
var _result_value;
|
|
165
|
+
valueOject[match[1]] = null !== (_result_value = result.value) && void 0 !== _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 ? 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
|
+
});
|
|
136
191
|
export { ReadPrettyInternalViewer, isObject };
|