@tachybase/client 1.3.19 → 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/Configuration/components/Summary.mjs +3 -3
- 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/flag-provider/FlagProvider.d.ts +1 -0
- package/es/flag-provider/hooks/useFlag.mjs +1 -1
- 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/color-select/ColorSelect.mjs +3 -3
- package/es/schema-component/antd/date-picker/util.d.ts +13 -0
- package/es/schema-component/antd/date-picker/util.mjs +14 -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/markdown/Markdown.mjs +4 -4
- 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/password/utils.d.ts +1 -1
- 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/SchemaSettingsDefaultValue.mjs +3 -2
- package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
- package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
- package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
- package/es/user/ChangePassword.mjs +109 -6
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +2 -0
- package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
- package/lib/application/Application.js +0 -8
- package/lib/application/components/index.js +0 -18
- package/lib/block-provider/hooks/index.js +5 -5
- package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
- package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
- package/lib/built-in/index.js +30 -4
- package/lib/built-in/pm/index.js +1 -1
- package/lib/collection-manager/Configuration/components/Summary.js +3 -3
- package/lib/collection-manager/collectionPlugin.js +36 -0
- package/lib/collection-manager/index.js +17 -17
- package/lib/collection-manager/interfaces/url.js +10 -1
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
- package/lib/flag-provider/hooks/useFlag.js +1 -1
- package/lib/icon/Icon.js +2 -2
- package/lib/locale/zh-CN.js +6 -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/action/Action.Container.js +2 -2
- package/lib/schema-component/antd/action/Action.Modal.js +2 -2
- package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
- 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/color-select/ColorSelect.js +4 -4
- package/lib/schema-component/antd/date-picker/util.js +16 -0
- package/lib/schema-component/antd/form-tab/index.js +2 -2
- package/lib/schema-component/antd/form-v2/index.js +2 -2
- 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/markdown/Markdown.js +5 -5
- 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/scroll-area/ScrollArea.js +2 -2
- 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/antd/table-v2/index.js +3 -3
- package/lib/schema-component/antd/upload/shared.js +4 -4
- package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
- package/lib/schema-settings/EditFormulaTitleField.js +19 -1
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
- package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
- package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
- package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
- package/lib/user/ChangePassword.js +118 -5
- package/lib/user/index.js +24 -4
- package/lib/variables/VariablesProvider.js +2 -2
- package/lib/variables/hooks/useBuiltinVariables.js +7 -1
- package/package.json +10 -10
- 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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
4
|
+
import { useCollectionManager_deprecated } from "../../../../collection-manager/index.mjs";
|
|
5
|
+
import { useDataSourceManager } from "../../../../data-source/index.mjs";
|
|
6
|
+
import { useCompile, useDesignable } from "../../../../schema-component/index.mjs";
|
|
7
|
+
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
8
|
+
const multipleComponentFieldSettings = new SchemaSettings({
|
|
9
|
+
name: 'fieldSettings:component:multiple',
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
name: 'fieldComponent',
|
|
13
|
+
type: 'select',
|
|
14
|
+
useComponentProps () {
|
|
15
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions, _fieldSchema_xcomponentprops;
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const field = useField();
|
|
18
|
+
const { fieldSchema: tableColumnSchema } = useColumnSchema();
|
|
19
|
+
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
|
20
|
+
const dm = useDataSourceManager();
|
|
21
|
+
const schema = useFieldSchema();
|
|
22
|
+
const fieldSchema = tableColumnSchema || schema;
|
|
23
|
+
const collectionField = getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
24
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
25
|
+
const compile = useCompile();
|
|
26
|
+
const fieldModeOptions = [
|
|
27
|
+
{
|
|
28
|
+
label: t('Select'),
|
|
29
|
+
value: 'multiple'
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
33
|
+
if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
|
|
34
|
+
label: compile(item.label),
|
|
35
|
+
value: item.value
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const { dn } = useDesignable();
|
|
39
|
+
return {
|
|
40
|
+
title: t('Field component'),
|
|
41
|
+
options: fieldModeOptions,
|
|
42
|
+
value: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.mode) || 'multiple',
|
|
43
|
+
onChange (mode) {
|
|
44
|
+
const schema = {
|
|
45
|
+
['x-uid']: fieldSchema['x-uid']
|
|
46
|
+
};
|
|
47
|
+
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
48
|
+
fieldSchema['x-component-props']['mode'] = mode;
|
|
49
|
+
fieldSchema['x-component-props']['multiple'] = true;
|
|
50
|
+
schema['x-component-props'] = fieldSchema['x-component-props'];
|
|
51
|
+
field.componentProps = field.componentProps || {};
|
|
52
|
+
field.componentProps.mode = mode;
|
|
53
|
+
field.componentProps.multiple = true;
|
|
54
|
+
dn.emit('patch', {
|
|
55
|
+
schema
|
|
56
|
+
});
|
|
57
|
+
dn.refresh();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
export { multipleComponentFieldSettings };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
3
|
import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { useCollectionManager_deprecated } from "../../../../collection-manager/index.mjs";
|
|
5
|
+
import { useDataSourceManager } from "../../../../data-source/index.mjs";
|
|
6
|
+
import { useCompile, useDesignable } from "../../../../schema-component/index.mjs";
|
|
5
7
|
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
6
8
|
const radioComponentFieldSettings = new SchemaSettings({
|
|
7
9
|
name: 'fieldSettings:component:Radio group',
|
|
@@ -10,7 +12,7 @@ const radioComponentFieldSettings = new SchemaSettings({
|
|
|
10
12
|
name: 'fieldComponent',
|
|
11
13
|
type: 'select',
|
|
12
14
|
useComponentProps () {
|
|
13
|
-
var _fieldSchema_xcomponentprops;
|
|
15
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions, _fieldSchema_xcomponentprops;
|
|
14
16
|
const { t } = useTranslation();
|
|
15
17
|
const field = useField();
|
|
16
18
|
const { fieldSchema: tableColumnSchema } = useColumnSchema();
|
|
@@ -26,7 +28,18 @@ const radioComponentFieldSettings = new SchemaSettings({
|
|
|
26
28
|
value: 'Radio group'
|
|
27
29
|
}
|
|
28
30
|
];
|
|
31
|
+
const dm = useDataSourceManager();
|
|
32
|
+
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
|
33
|
+
const collectionField = getCollectionJoinField(fieldSchema['x-collection-field']);
|
|
34
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
35
|
+
const compile = useCompile();
|
|
29
36
|
const { dn } = useDesignable();
|
|
37
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
38
|
+
if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
|
|
39
|
+
label: compile(item.label),
|
|
40
|
+
value: item.value
|
|
41
|
+
});
|
|
42
|
+
});
|
|
30
43
|
return {
|
|
31
44
|
title: t('Field component'),
|
|
32
45
|
options: fieldModeOptions,
|
|
@@ -7,11 +7,11 @@ import { SchemaSettings } from "../../../../application/schema-settings/SchemaSe
|
|
|
7
7
|
import { useFormBlockContext } from "../../../../block-provider/index.mjs";
|
|
8
8
|
import { useCollectionManager_deprecated, useCollection_deprecated } from "../../../../collection-manager/index.mjs";
|
|
9
9
|
import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
|
|
10
|
-
import { useCollectionField } from "../../../../data-source/index.mjs";
|
|
10
|
+
import { useCollectionField, useDataSourceManager } from "../../../../data-source/index.mjs";
|
|
11
11
|
import { useRecord } from "../../../../record-provider/index.mjs";
|
|
12
|
-
import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
|
|
12
|
+
import { removeNullCondition, useCompile, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
|
|
13
13
|
import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
|
|
14
|
-
import { useIsAssociationField, useIsFieldReadPretty,
|
|
14
|
+
import { useIsAssociationField, useIsFieldReadPretty, useIsSelectFieldMode, useTitleFieldOptions } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
|
|
15
15
|
import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
|
|
16
16
|
import { VariableInput, getShouldChange, useFormulaTitleOptions } from "../../../../schema-settings/index.mjs";
|
|
17
17
|
import { useIsShowMultipleSwitch } from "../../../../schema-settings/hooks/useIsShowMultipleSwitch.mjs";
|
|
@@ -271,6 +271,7 @@ const fieldComponent = {
|
|
|
271
271
|
name: 'fieldComponent',
|
|
272
272
|
type: 'select',
|
|
273
273
|
useComponentProps () {
|
|
274
|
+
var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
|
|
274
275
|
const { t } = useTranslation();
|
|
275
276
|
const field = useField();
|
|
276
277
|
const collectionFieldCurrent = useCollectionField();
|
|
@@ -285,7 +286,8 @@ const fieldComponent = {
|
|
|
285
286
|
const fieldMode = useFieldComponentName();
|
|
286
287
|
const { dn } = useDesignable();
|
|
287
288
|
const isMuiltipleSelect = [
|
|
288
|
-
'select'
|
|
289
|
+
'select',
|
|
290
|
+
'multipleSelect'
|
|
289
291
|
].includes(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
290
292
|
const optionsMuiltipleSelect = [
|
|
291
293
|
{
|
|
@@ -297,9 +299,27 @@ const fieldComponent = {
|
|
|
297
299
|
value: 'Radio group'
|
|
298
300
|
}
|
|
299
301
|
];
|
|
302
|
+
if ((null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface) === 'multipleSelect') {
|
|
303
|
+
const index = optionsMuiltipleSelect.findIndex((item)=>'Radio group' === item.value);
|
|
304
|
+
optionsMuiltipleSelect.splice(index, 1);
|
|
305
|
+
}
|
|
306
|
+
const dm = useDataSourceManager();
|
|
307
|
+
const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
|
|
308
|
+
const compile = useCompile();
|
|
309
|
+
if (fieldSchema['x-component-props']['multiple']) {
|
|
310
|
+
const index = fieldModeOptions.findIndex((item)=>'Radio group' === item.value);
|
|
311
|
+
fieldModeOptions.splice(index, 1);
|
|
312
|
+
}
|
|
313
|
+
const componentOptions = isMuiltipleSelect ? optionsMuiltipleSelect : fieldModeOptions;
|
|
314
|
+
null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
|
|
315
|
+
if (!(null == componentOptions ? void 0 : componentOptions.find((modeItem)=>modeItem.value === item.value))) null == componentOptions || componentOptions.push({
|
|
316
|
+
label: compile(item.label),
|
|
317
|
+
value: item.value
|
|
318
|
+
});
|
|
319
|
+
});
|
|
300
320
|
return {
|
|
301
321
|
title: t('Field component'),
|
|
302
|
-
options:
|
|
322
|
+
options: componentOptions,
|
|
303
323
|
value: fieldMode,
|
|
304
324
|
onChange (mode) {
|
|
305
325
|
const schema = {
|
|
@@ -390,8 +410,7 @@ const selectComponentFieldSettings = new SchemaSettings({
|
|
|
390
410
|
name: 'fieldSettings:component:Select',
|
|
391
411
|
items: [
|
|
392
412
|
{
|
|
393
|
-
...fieldComponent
|
|
394
|
-
useVisible: useIsMuiltipleAble
|
|
413
|
+
...fieldComponent
|
|
395
414
|
},
|
|
396
415
|
{
|
|
397
416
|
...setTheDataScope,
|
|
@@ -11,9 +11,9 @@ import { FormProvider } from "../../core/index.mjs";
|
|
|
11
11
|
import { useCompile } from "../../hooks/index.mjs";
|
|
12
12
|
import { ActionContextProvider, useActionContext } from "../action/index.mjs";
|
|
13
13
|
import { EllipsisWithTooltip } from "../input/EllipsisWithTooltip.mjs";
|
|
14
|
-
import { useAssociationFieldContext, useFieldNames, useInsertSchema } from "./hooks.mjs";
|
|
14
|
+
import { useAssociationFieldContext, useCustomTitle, useFieldNames, useInsertSchema } from "./hooks.mjs";
|
|
15
15
|
import { transformNestedData } from "./InternalCascadeSelect.mjs";
|
|
16
|
-
import
|
|
16
|
+
import schema from "./schema.mjs";
|
|
17
17
|
import { getLabelFormatValue, useLabelUiSchemaV2 } from "./util.mjs";
|
|
18
18
|
const toValue = (value, placeholder)=>{
|
|
19
19
|
if (null == value) return placeholder;
|
|
@@ -41,7 +41,7 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
41
41
|
const isTreeCollection = (null == targetCollection ? void 0 : targetCollection.template) === 'tree';
|
|
42
42
|
const ellipsisWithTooltipRef = useRef();
|
|
43
43
|
const getLabelUiSchema = useLabelUiSchemaV2();
|
|
44
|
-
const { formulaRecord, fieldNames } =
|
|
44
|
+
const { formulaRecord, fieldNames } = useCustomTitle(recordCtx, fieldSchema, defFieldNames);
|
|
45
45
|
const renderRecords = ()=>toArr(formulaRecord[fieldSchema['name']] || props.value).map((record, index, arr)=>{
|
|
46
46
|
var _getCollection_options, _getCollection, _targetCollection_fieldsMap_, _targetCollection_fieldsMap, _getCollection_options1, _getCollection1, _targetCollection_fieldsMap_1, _targetCollection_fieldsMap1;
|
|
47
47
|
const value = null == record ? void 0 : record[(null == fieldNames ? void 0 : fieldNames.label) || 'label'];
|
|
@@ -57,7 +57,7 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
57
57
|
var _ellipsisWithTooltipRef_current;
|
|
58
58
|
e.stopPropagation();
|
|
59
59
|
e.preventDefault();
|
|
60
|
-
if (designable) insertViewer(
|
|
60
|
+
if (designable) insertViewer(schema.Viewer);
|
|
61
61
|
setVisible(true);
|
|
62
62
|
setRecord(record);
|
|
63
63
|
null == ellipsisWithTooltipRef || null == (_ellipsisWithTooltipRef_current = ellipsisWithTooltipRef.current) || _ellipsisWithTooltipRef_current.setPopoverVisible(false);
|
|
@@ -134,58 +134,4 @@ const ReadPrettyInternalViewer = observer((props)=>{
|
|
|
134
134
|
}, {
|
|
135
135
|
displayName: 'ReadPrettyInternalViewer'
|
|
136
136
|
});
|
|
137
|
-
const customTitle = (record, schema, fieldNames)=>{
|
|
138
|
-
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
139
|
-
if ((null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null == (_schema_xcomponentprops1 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
140
|
-
var _schema_xcomponentprops_fieldNames1, _schema_xcomponentprops2;
|
|
141
|
-
const regex = /{{(.*?)}}/g;
|
|
142
|
-
const valueOject = {};
|
|
143
|
-
let outputStr = '';
|
|
144
|
-
let match;
|
|
145
|
-
const formula = null == (_schema_xcomponentprops2 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames1 = _schema_xcomponentprops2.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames1.formula;
|
|
146
|
-
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
147
|
-
const fieldList = [
|
|
148
|
-
schema.name
|
|
149
|
-
];
|
|
150
|
-
fieldList.push(...match[1].split('.'));
|
|
151
|
-
const result = {
|
|
152
|
-
currRecord: record,
|
|
153
|
-
value: ''
|
|
154
|
-
};
|
|
155
|
-
fieldList.forEach((value, index)=>{
|
|
156
|
-
var _result_currRecord;
|
|
157
|
-
if (fieldList.length - 1 !== index) {
|
|
158
|
-
var _result_currRecord1;
|
|
159
|
-
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
163
|
-
});
|
|
164
|
-
var _result_value;
|
|
165
|
-
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
166
|
-
} else {
|
|
167
|
-
var _record_schema_name;
|
|
168
|
-
valueOject[match[1]] = (null == (_record_schema_name = record[schema['name']]) ? void 0 : _record_schema_name[match[1]]) || '';
|
|
169
|
-
}
|
|
170
|
-
outputStr = replacePlaceholders(formula, valueOject);
|
|
171
|
-
record[schema['name']] = {
|
|
172
|
-
...record[schema['name']],
|
|
173
|
-
customLabel: outputStr
|
|
174
|
-
};
|
|
175
|
-
return {
|
|
176
|
-
formulaRecord: record,
|
|
177
|
-
fieldNames: {
|
|
178
|
-
...fieldNames,
|
|
179
|
-
label: 'customLabel'
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
formulaRecord: record,
|
|
185
|
-
fieldNames
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
189
|
-
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
190
|
-
});
|
|
191
137
|
export { ReadPrettyInternalViewer, isObject };
|
|
@@ -147,4 +147,55 @@ const useSubFormValue = ()=>{
|
|
|
147
147
|
collection
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
const useCustomTitle = (record, schema, fieldNames)=>{
|
|
151
|
+
var _schema_xcomponentprops, _schema_xcomponentprops_fieldNames, _schema_xcomponentprops1;
|
|
152
|
+
if ((null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.mode) === 'CustomTitle' && (null == (_schema_xcomponentprops1 = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops1.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula)) {
|
|
153
|
+
if (Array.isArray(record[schema['name']])) record[schema['name']].forEach((recordItem)=>{
|
|
154
|
+
recordItem['customLabel'] = getCustomLabel(recordItem, schema);
|
|
155
|
+
});
|
|
156
|
+
else record[schema['name']]['customLabel'] = getCustomLabel(record[schema['name']], schema);
|
|
157
|
+
return {
|
|
158
|
+
formulaRecord: record,
|
|
159
|
+
fieldNames: {
|
|
160
|
+
...fieldNames,
|
|
161
|
+
label: 'customLabel'
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
formulaRecord: record,
|
|
167
|
+
fieldNames
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
const getCustomLabel = (record, schema)=>{
|
|
171
|
+
var _schema_xcomponentprops_fieldNames, _schema_xcomponentprops;
|
|
172
|
+
const regex = /{{(.*?)}}/g;
|
|
173
|
+
const valueOject = {};
|
|
174
|
+
let outputStr = '';
|
|
175
|
+
let match;
|
|
176
|
+
const formula = null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : null == (_schema_xcomponentprops_fieldNames = _schema_xcomponentprops.fieldNames) ? void 0 : _schema_xcomponentprops_fieldNames.formula;
|
|
177
|
+
while(match = regex.exec(formula))if (match[1].includes('.')) {
|
|
178
|
+
const fieldList = match[1].split('.');
|
|
179
|
+
const result = {
|
|
180
|
+
currRecord: record,
|
|
181
|
+
value: ''
|
|
182
|
+
};
|
|
183
|
+
fieldList.forEach((value, index)=>{
|
|
184
|
+
var _result_currRecord;
|
|
185
|
+
if (fieldList.length - 1 !== index) {
|
|
186
|
+
var _result_currRecord1;
|
|
187
|
+
result.currRecord = null == (_result_currRecord1 = result.currRecord) ? void 0 : _result_currRecord1[value];
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
result.value = null == (_result_currRecord = result.currRecord) ? void 0 : _result_currRecord[value];
|
|
191
|
+
});
|
|
192
|
+
var _result_value;
|
|
193
|
+
valueOject[match[1]] = null != (_result_value = result.value) ? _result_value : '';
|
|
194
|
+
} else valueOject[match[1]] = record[match[1]] || '';
|
|
195
|
+
outputStr = replacePlaceholders(formula, valueOject);
|
|
196
|
+
return outputStr;
|
|
197
|
+
};
|
|
198
|
+
const replacePlaceholders = (inputStr, values)=>inputStr.replace(/{{(.*?)}}/g, function(match, placeholder) {
|
|
199
|
+
return Object.prototype.hasOwnProperty.call(values, placeholder) ? values[placeholder] : match;
|
|
200
|
+
});
|
|
201
|
+
export { SubFormProvider, useServiceOptions as default, useAssociationFieldContext, useCustomTitle, useFieldNames, useInsertSchema, useSubFormValue };
|
|
@@ -18,7 +18,7 @@ const colors = {
|
|
|
18
18
|
purple: '{{t("Purple")}}',
|
|
19
19
|
default: '{{t("Default")}}'
|
|
20
20
|
};
|
|
21
|
-
const
|
|
21
|
+
const ColorSelect_ColorSelect = connect((props)=>{
|
|
22
22
|
const compile = useCompile();
|
|
23
23
|
return /*#__PURE__*/ jsx(Select, {
|
|
24
24
|
...props,
|
|
@@ -44,5 +44,5 @@ const ColorSelect = connect((props)=>{
|
|
|
44
44
|
children: compile(colors[value] || colors.default)
|
|
45
45
|
});
|
|
46
46
|
}));
|
|
47
|
-
const
|
|
48
|
-
export { ColorSelect,
|
|
47
|
+
const ColorSelect = ColorSelect_ColorSelect;
|
|
48
|
+
export { ColorSelect_ColorSelect as ColorSelect, ColorSelect as default };
|
|
@@ -35,3 +35,16 @@ export declare const getDateRanges: () => {
|
|
|
35
35
|
last90Days: () => dayjs.Dayjs[];
|
|
36
36
|
next90Days: () => dayjs.Dayjs[];
|
|
37
37
|
};
|
|
38
|
+
export declare const getDateExact: () => {
|
|
39
|
+
nowUtc: () => string;
|
|
40
|
+
nowLocal: () => string;
|
|
41
|
+
todayUtc: () => string;
|
|
42
|
+
todayLocal: () => string;
|
|
43
|
+
todayDate: () => string;
|
|
44
|
+
yesterdayUtc: () => string;
|
|
45
|
+
yesterdayLocal: () => string;
|
|
46
|
+
yesterdayDate: () => string;
|
|
47
|
+
tomorrowUtc: () => string;
|
|
48
|
+
tomorrowLocal: () => string;
|
|
49
|
+
tomorrowDate: () => string;
|
|
50
|
+
};
|
|
@@ -176,4 +176,17 @@ const getDateRanges = ()=>({
|
|
|
176
176
|
getEnd(90, 'days')
|
|
177
177
|
]
|
|
178
178
|
});
|
|
179
|
-
|
|
179
|
+
const getDateExact = ()=>({
|
|
180
|
+
nowUtc: ()=>dayjs().toISOString(),
|
|
181
|
+
nowLocal: ()=>dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
182
|
+
todayUtc: ()=>dayjs().startOf('day').utc().toISOString(),
|
|
183
|
+
todayLocal: ()=>dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
184
|
+
todayDate: ()=>dayjs().format('YYYY-MM-DD'),
|
|
185
|
+
yesterdayUtc: ()=>dayjs().subtract(1, 'day').startOf('day').utc().toISOString(),
|
|
186
|
+
yesterdayLocal: ()=>dayjs().subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
187
|
+
yesterdayDate: ()=>dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
|
|
188
|
+
tomorrowUtc: ()=>dayjs().add(1, 'day').startOf('day').utc().toISOString(),
|
|
189
|
+
tomorrowLocal: ()=>dayjs().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|
190
|
+
tomorrowDate: ()=>dayjs().add(1, 'day').format('YYYY-MM-DD')
|
|
191
|
+
});
|
|
192
|
+
export { getDateExact, getDateRanges, mapDatePicker, mapRangePicker, moment2str };
|
|
@@ -20,7 +20,8 @@ const Input_Input = Object.assign(connect(Input, mapProps((props, field)=>({
|
|
|
20
20
|
})), mapReadPretty(ReadPretty.TextArea)),
|
|
21
21
|
URL: connect(Input, mapReadPretty(ReadPretty.URL)),
|
|
22
22
|
JSON: connect(Json, mapReadPretty(ReadPretty.JSON)),
|
|
23
|
-
ReadPretty: ReadPretty.Input
|
|
23
|
+
ReadPretty: ReadPretty.Input,
|
|
24
|
+
Preview: ReadPretty.Preview
|
|
24
25
|
});
|
|
25
26
|
const input_Input = Input_Input;
|
|
26
27
|
export { Input_Input as Input, ReadPretty as InputReadPretty, input_Input as default };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { usePrefixCls } from "@tachybase/components";
|
|
4
|
+
import { useFieldSchema } from "@tachybase/schema";
|
|
4
5
|
import { css } from "@emotion/css";
|
|
5
|
-
import { Typography } from "antd";
|
|
6
|
+
import { Image, Typography } from "antd";
|
|
6
7
|
import classnames from "classnames";
|
|
7
8
|
import { useCompile } from "../../index.mjs";
|
|
8
9
|
import { EllipsisWithTooltip } from "./EllipsisWithTooltip.mjs";
|
|
@@ -151,9 +152,36 @@ const _JSON = (props)=>{
|
|
|
151
152
|
children: null != props.value ? JSON.stringify(props.value, null, null != (_props_space = props.space) ? _props_space : 2) : ''
|
|
152
153
|
});
|
|
153
154
|
};
|
|
155
|
+
const sizes = {
|
|
156
|
+
small: 24,
|
|
157
|
+
middle: 48,
|
|
158
|
+
large: 72,
|
|
159
|
+
oversized: 120
|
|
160
|
+
};
|
|
161
|
+
const _Preview = (props)=>{
|
|
162
|
+
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
163
|
+
const fieldSchema = useFieldSchema();
|
|
164
|
+
const size = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['size']) || 'small';
|
|
165
|
+
const objectFit = (null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['objectFit']) || 'cover';
|
|
166
|
+
if (!props.value) return props.value;
|
|
167
|
+
return /*#__PURE__*/ jsx(Image, {
|
|
168
|
+
style: [
|
|
169
|
+
'small',
|
|
170
|
+
'middle',
|
|
171
|
+
'large',
|
|
172
|
+
'oversized'
|
|
173
|
+
].includes(size) ? {
|
|
174
|
+
width: sizes[size],
|
|
175
|
+
height: sizes[size],
|
|
176
|
+
objectFit
|
|
177
|
+
} : {},
|
|
178
|
+
src: props.value
|
|
179
|
+
});
|
|
180
|
+
};
|
|
154
181
|
ReadPretty.Input = _Input;
|
|
155
182
|
ReadPretty.TextArea = _TextArea;
|
|
156
183
|
ReadPretty.URL = _URL;
|
|
157
184
|
ReadPretty.Html = _Html;
|
|
158
185
|
ReadPretty.JSON = _JSON;
|
|
186
|
+
ReadPretty.Preview = _Preview;
|
|
159
187
|
export { ReadPretty };
|
|
@@ -8,7 +8,7 @@ import { ReadPretty } from "../input/index.mjs";
|
|
|
8
8
|
import { MarkdownVoid } from "./Markdown.Void.mjs";
|
|
9
9
|
import { useStyles } from "./style.mjs";
|
|
10
10
|
import { convertToText, useParseMarkdown } from "./util.mjs";
|
|
11
|
-
const
|
|
11
|
+
const Markdown_Markdown = connect(Input.TextArea, mapProps((props, field)=>({
|
|
12
12
|
autoSize: {
|
|
13
13
|
maxRows: 10,
|
|
14
14
|
minRows: 3
|
|
@@ -41,6 +41,6 @@ const MarkdownReadPretty = (props)=>{
|
|
|
41
41
|
value: value
|
|
42
42
|
}));
|
|
43
43
|
};
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
export { Markdown, MarkdownReadPretty,
|
|
44
|
+
Markdown_Markdown.Void = MarkdownVoid;
|
|
45
|
+
const Markdown = Markdown_Markdown;
|
|
46
|
+
export { Markdown_Markdown as Markdown, MarkdownReadPretty, Markdown as default };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useMatch } from "react-router";
|
|
4
3
|
import { useDesignable } from "../../index.mjs";
|
|
5
4
|
import { SchemaSettings } from "../../../application/schema-settings/index.mjs";
|
|
6
5
|
import { useSchemaToolbar } from "../../../application/schema-toolbar/index.mjs";
|
|
@@ -37,38 +36,6 @@ const pageSettings = new SchemaSettings({
|
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
},
|
|
40
|
-
{
|
|
41
|
-
name: 'enablesharePage',
|
|
42
|
-
type: 'switch',
|
|
43
|
-
useVisible () {
|
|
44
|
-
const isShare = useMatch('/share/:name');
|
|
45
|
-
return !isShare;
|
|
46
|
-
},
|
|
47
|
-
useComponentProps () {
|
|
48
|
-
var _fieldSchema_xcomponentprops;
|
|
49
|
-
const { dn } = useDesignable();
|
|
50
|
-
const { t } = useTranslation();
|
|
51
|
-
const fieldSchema = useFieldSchema();
|
|
52
|
-
const { title } = useSchemaToolbar();
|
|
53
|
-
return {
|
|
54
|
-
title: t('Enable Share page'),
|
|
55
|
-
checked: null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.enableSharePage,
|
|
56
|
-
onChange (v) {
|
|
57
|
-
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
58
|
-
fieldSchema['x-component-props']['enableSharePage'] = v;
|
|
59
|
-
if (!fieldSchema.title) fieldSchema.title = title;
|
|
60
|
-
dn.emit('patch', {
|
|
61
|
-
schema: {
|
|
62
|
-
['x-uid']: fieldSchema['x-uid'],
|
|
63
|
-
['x-component-props']: fieldSchema['x-component-props'],
|
|
64
|
-
title: fieldSchema.title
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
dn.refresh();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
39
|
{
|
|
73
40
|
name: 'divider',
|
|
74
41
|
type: 'divider',
|