@tachybase/client 1.3.20 → 1.3.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/es/application/Application.mjs +1 -9
  2. package/es/application/components/index.d.ts +0 -2
  3. package/es/application/components/index.mjs +0 -2
  4. package/es/application/schema-initializer/context/index.d.ts +1 -1
  5. package/es/application/utils/globalDeps.mjs +1 -1
  6. package/es/block-provider/hooks/index.mjs +1 -1
  7. package/es/built-in/index.d.ts +2 -1
  8. package/es/built-in/index.mjs +3 -2
  9. package/es/collection-manager/collectionPlugin.mjs +36 -0
  10. package/es/collection-manager/interfaces/url.d.ts +4 -0
  11. package/es/collection-manager/interfaces/url.mjs +10 -1
  12. package/es/collection-manager/templates/sql.d.ts +3 -3
  13. package/es/collection-manager/templates/view.d.ts +3 -3
  14. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
  15. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
  16. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
  17. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
  18. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
  19. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
  20. package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
  21. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
  22. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
  23. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
  24. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
  25. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
  26. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
  27. package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
  28. package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
  29. package/es/schema-component/antd/association-field/hooks.mjs +52 -1
  30. package/es/schema-component/antd/input/Input.mjs +2 -1
  31. package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
  32. package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
  33. package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
  34. package/es/schema-component/antd/page/Page.mjs +46 -95
  35. package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
  36. package/es/schema-component/antd/page/hooks/index.mjs +1 -1
  37. package/es/schema-component/antd/page/index.d.ts +1 -0
  38. package/es/schema-component/antd/page/index.mjs +1 -0
  39. package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
  40. package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
  41. package/es/schema-component/antd/page/style.d.ts +0 -5
  42. package/es/schema-component/antd/page/style.mjs +1 -45
  43. package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
  44. package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
  45. package/es/schema-component/antd/select/Select.mjs +6 -1
  46. package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
  47. package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
  48. package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
  49. package/lib/application/Application.js +0 -8
  50. package/lib/application/components/index.js +0 -18
  51. package/lib/block-provider/hooks/index.js +1 -1
  52. package/lib/built-in/index.js +30 -4
  53. package/lib/collection-manager/collectionPlugin.js +36 -0
  54. package/lib/collection-manager/interfaces/url.js +10 -1
  55. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
  56. package/lib/locale/zh-CN.js +1 -0
  57. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
  58. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
  59. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
  60. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
  61. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
  62. package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
  63. package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
  64. package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
  65. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
  66. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
  67. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
  68. package/lib/schema-component/antd/association-field/hooks.js +54 -0
  69. package/lib/schema-component/antd/input/Input.js +2 -1
  70. package/lib/schema-component/antd/input/ReadPretty.js +28 -0
  71. package/lib/schema-component/antd/page/Page.Settings.js +0 -33
  72. package/lib/schema-component/antd/page/Page.js +41 -90
  73. package/lib/schema-component/antd/page/hooks/index.js +5 -5
  74. package/lib/schema-component/antd/page/index.js +9 -0
  75. package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
  76. package/lib/schema-component/antd/page/style.js +2 -49
  77. package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
  78. package/lib/schema-component/antd/select/ReadPretty.js +15 -2
  79. package/lib/schema-component/antd/select/Select.js +6 -1
  80. package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
  81. package/lib/schema-settings/EditFormulaTitleField.js +19 -1
  82. package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
  83. package/package.json +7 -7
  84. package/es/application/components/SharePage.d.ts +0 -4
  85. package/es/application/components/SharePage.mjs +0 -113
  86. package/es/application/components/ShareSchemaComponent.d.ts +0 -1
  87. package/es/application/components/ShareSchemaComponent.mjs +0 -10
  88. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
  89. package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
  90. package/lib/application/components/SharePage.js +0 -156
  91. package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
@@ -17,7 +17,7 @@ import { CSSVariableProvider } from "../style/css-variable/index.mjs";
17
17
  import { AntdAppProvider, GlobalThemeProvider } from "../style/theme/index.mjs";
18
18
  import { AppSchemaComponentProvider } from "./AppSchemaComponentProvider.mjs";
19
19
  import { AttachmentPreviewManager } from "./AttachmentPreviewManager.mjs";
20
- import { AppComponent, BlankComponent, SharePage, ShareSchemaComponent, defaultAppComponents } from "./components/index.mjs";
20
+ import { AppComponent, BlankComponent, defaultAppComponents } from "./components/index.mjs";
21
21
  import { NoticeManager } from "./NoticesManager.mjs";
22
22
  import { PluginContextMenu } from "./PluginContextMenu.mjs";
23
23
  import { PluginManager } from "./PluginManager.mjs";
@@ -87,14 +87,6 @@ class Application {
87
87
  path: '*',
88
88
  Component: this.components['AppNotFound']
89
89
  });
90
- this.router.add('share', {
91
- path: '/share',
92
- Component: SharePage
93
- });
94
- this.router.add('share.page', {
95
- path: '/share/:name',
96
- Component: ShareSchemaComponent
97
- });
98
90
  this.router.add('share.notAuthorized', {
99
91
  path: '/share/not-authorized',
100
92
  element: null
@@ -2,5 +2,3 @@ export * from './AppComponent';
2
2
  export * from './BlankComponent';
3
3
  export * from './defaultComponents';
4
4
  export * from './RouterContextCleaner';
5
- export * from './SharePage';
6
- export * from './ShareSchemaComponent';
@@ -2,5 +2,3 @@ export * from "./AppComponent.mjs";
2
2
  export * from "./BlankComponent.mjs";
3
3
  export * from "./defaultComponents.mjs";
4
4
  export * from "./RouterContextCleaner.mjs";
5
- export * from "./SharePage.mjs";
6
- export * from "./ShareSchemaComponent.mjs";
@@ -12,5 +12,5 @@ export declare const useSchemaInitializer: () => {
12
12
  visible: boolean;
13
13
  setVisible: (v: boolean) => void;
14
14
  };
15
- export declare const SchemaInitializerItemContext: React.Context<Omit<SchemaInitializerItemType, "type" | "component" | "sort" | "componentProps" | "Component" | "useVisible" | "useChildren" | "hideIfNoChildren">>;
15
+ export declare const SchemaInitializerItemContext: React.Context<Omit<SchemaInitializerItemType, "type" | "sort" | "component" | "componentProps" | "Component" | "useVisible" | "useChildren" | "hideIfNoChildren">>;
16
16
  export declare const useSchemaInitializerItem: <T = any>() => T;
@@ -16,7 +16,6 @@ import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons_a8184985__ from "@ant-de
16
16
  import * as __WEBPACK_EXTERNAL_MODULE__emotion_css_bfcd1b5d__ from "@emotion/css";
17
17
  import * as __WEBPACK_EXTERNAL_MODULE_i18next__ from "i18next";
18
18
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components_8f070c76__ from "@tachybase/components";
19
- import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
20
19
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_evaluators_client_f0da03e4__ from "@tachybase/evaluators/client";
21
20
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_cssinjs_c619260f__ from "@ant-design/cssinjs";
22
21
  import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_accessibility_682092eb__ from "@dnd-kit/accessibility";
@@ -25,6 +24,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_modifiers_69ce91a8__ from "@dnd-k
25
24
  import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_sortable_a8361dd8__ from "@dnd-kit/sortable";
26
25
  import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_utilities_3c8eb4c2__ from "@dnd-kit/utilities";
27
26
  import * as __WEBPACK_EXTERNAL_MODULE__floating_ui_react_3ddd630a__ from "@floating-ui/react";
27
+ import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router";
28
28
  import * as __WEBPACK_EXTERNAL_MODULE__index_mjs_52ce5380__ from "../../index.mjs";
29
29
  function defineGlobalDeps(requirejs) {
30
30
  requirejs.define('react', ()=>react);
@@ -1126,7 +1126,7 @@ const useAssociationNames = (dataSource)=>{
1126
1126
  appends.add(append);
1127
1127
  });
1128
1128
  }
1129
- if (null == (_s_xcomponentprops1 = s['x-component-props']) ? void 0 : null == (_s_xcomponentprops_fieldNames = _s_xcomponentprops1.fieldNames) ? void 0 : _s_xcomponentprops_fieldNames.formula) {
1129
+ if ((null == (_s_xcomponentprops1 = s['x-component-props']) ? void 0 : null == (_s_xcomponentprops_fieldNames = _s_xcomponentprops1.fieldNames) ? void 0 : _s_xcomponentprops_fieldNames.formula) && isAssociationField) {
1130
1130
  var _s_xcomponentprops_fieldNames1, _s_xcomponentprops4;
1131
1131
  appends.add(s['name']);
1132
1132
  const regex = /{{(.*?)}}/g;
@@ -1,5 +1,6 @@
1
1
  import { Plugin } from '../application/Plugin';
2
- export { AdminProvider, NoticeArea, AdminLayout } from './admin-layout';
2
+ export { AdminProvider, NoticeArea, AdminLayout, MenuEditor, AdminTabs } from './admin-layout';
3
+ export * from './pinned-list';
3
4
  export * from './context-menu/useContextMenu';
4
5
  export declare const AppNotFound: () => import("react/jsx-runtime").JSX.Element;
5
6
  export declare class BuiltInPlugin extends Plugin {
@@ -38,7 +38,8 @@ import { ScrollAssistantPlugin } from "./scroll-assistant/index.mjs";
38
38
  import { SystemSettingsPlugin } from "./system-settings/index.mjs";
39
39
  import { PluginSystemVersion } from "./system-version/index.mjs";
40
40
  import { UserSettingsPlugin } from "./user-settings/index.mjs";
41
- import { AdminLayout, AdminProvider, NoticeArea } from "./admin-layout/index.mjs";
41
+ import { AdminLayout, AdminProvider, AdminTabs, MenuEditor, NoticeArea } from "./admin-layout/index.mjs";
42
+ export * from "./pinned-list/index.mjs";
42
43
  export * from "./context-menu/useContextMenu.mjs";
43
44
  function _tagged_template_literal(strings, raw) {
44
45
  if (!raw) raw = strings.slice(0);
@@ -495,4 +496,4 @@ class BuiltInPlugin extends Plugin {
495
496
  });
496
497
  }
497
498
  }
498
- export { AdminLayout, AdminProvider, AppNotFound, BuiltInPlugin, NoticeArea };
499
+ export { AdminLayout, AdminProvider, AdminTabs, AppNotFound, BuiltInPlugin, MenuEditor, NoticeArea };
@@ -42,6 +42,42 @@ class CollectionPlugin extends Plugin {
42
42
  key: DEFAULT_DATA_SOURCE_KEY,
43
43
  displayName: DEFAULT_DATA_SOURCE_TITLE
44
44
  });
45
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('m2o', {
46
+ label: '{{t("CustomTitle")}}',
47
+ value: 'CustomTitle'
48
+ });
49
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('m2m', {
50
+ label: '{{t("CustomTitle")}}',
51
+ value: 'CustomTitle'
52
+ });
53
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('o2m', {
54
+ label: '{{t("CustomTitle")}}',
55
+ value: 'CustomTitle'
56
+ });
57
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('o2o', {
58
+ label: '{{t("CustomTitle")}}',
59
+ value: 'CustomTitle'
60
+ });
61
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('obo', {
62
+ label: '{{t("CustomTitle")}}',
63
+ value: 'CustomTitle'
64
+ });
65
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('select', {
66
+ label: '{{t("CustomTitle")}}',
67
+ value: 'CustomTitle'
68
+ });
69
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('checkbox', {
70
+ label: '{{t("CustomTitle")}}',
71
+ value: 'CustomTitle'
72
+ });
73
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('radioGroup', {
74
+ label: '{{t("CustomTitle")}}',
75
+ value: 'CustomTitle'
76
+ });
77
+ this.app.dataSourceManager.collectionFieldInterfaceManager.addFieldInterfaceComponentOption('multipleSelect', {
78
+ label: '{{t("CustomTitle")}}',
79
+ value: 'CustomTitle'
80
+ });
45
81
  }
46
82
  addFieldInterfaceGroups() {
47
83
  this.dataSourceManager.addFieldInterfaceGroups({
@@ -13,6 +13,10 @@ export declare class UrlFieldInterface extends CollectionFieldInterface {
13
13
  'x-component': string;
14
14
  };
15
15
  };
16
+ componentOptions: {
17
+ label: string;
18
+ value: string;
19
+ }[];
16
20
  availableTypes: string[];
17
21
  schemaInitialize(schema: ISchema, { block }: {
18
22
  block: any;
@@ -21,7 +21,16 @@ class UrlFieldInterface extends CollectionFieldInterface {
21
21
  type: 'string',
22
22
  'x-component': 'Input.URL'
23
23
  }
24
- }), _define_property(this, "availableTypes", [
24
+ }), _define_property(this, "componentOptions", [
25
+ {
26
+ label: 'URL',
27
+ value: 'Input.URL'
28
+ },
29
+ {
30
+ label: 'Preview',
31
+ value: 'Input.Preview'
32
+ }
33
+ ]), _define_property(this, "availableTypes", [
25
34
  'string',
26
35
  'text'
27
36
  ]), _define_property(this, "properties", {
@@ -8,9 +8,6 @@ export declare class SqlCollectionTemplate extends CollectionTemplate {
8
8
  fields: any[];
9
9
  };
10
10
  configurableProperties: {
11
- name: any;
12
- title: any;
13
- description: any;
14
11
  autoGenId: any;
15
12
  createdBy: any;
16
13
  updatedBy: any;
@@ -18,6 +15,9 @@ export declare class SqlCollectionTemplate extends CollectionTemplate {
18
15
  updatedAt: any;
19
16
  sortable: any;
20
17
  inherits: any;
18
+ title: any;
19
+ name: any;
20
+ description: any;
21
21
  category: any;
22
22
  presetFields: any;
23
23
  config: {
@@ -9,9 +9,6 @@ export declare class ViewCollectionTemplate extends CollectionTemplate {
9
9
  };
10
10
  divider: boolean;
11
11
  configurableProperties: {
12
- name: any;
13
- title: any;
14
- description: any;
15
12
  autoGenId: any;
16
13
  createdBy: any;
17
14
  updatedBy: any;
@@ -19,6 +16,9 @@ export declare class ViewCollectionTemplate extends CollectionTemplate {
19
16
  updatedAt: any;
20
17
  sortable: any;
21
18
  inherits: any;
19
+ title: any;
20
+ name: any;
21
+ description: any;
22
22
  category: any;
23
23
  presetFields: any;
24
24
  databaseView: {
@@ -10,21 +10,7 @@ function _define_property(obj, key, value) {
10
10
  }
11
11
  class CollectionFieldInterface {
12
12
  addComponentOption(componentOption) {
13
- if (!this.componentOptions) {
14
- var _this_default_uiSchema, _this_default, _this_default_uiSchema1, _this_default1;
15
- this.componentOptions = [];
16
- const xComponent = null == (_this_default = this.default) ? void 0 : null == (_this_default_uiSchema = _this_default.uiSchema) ? void 0 : _this_default_uiSchema['x-component'];
17
- const componentProps = null == (_this_default1 = this.default) ? void 0 : null == (_this_default_uiSchema1 = _this_default1.uiSchema) ? void 0 : _this_default_uiSchema1['x-component-props'];
18
- if (xComponent) this.componentOptions = [
19
- {
20
- label: xComponent.split('.').pop(),
21
- value: xComponent,
22
- useProps () {
23
- return componentProps || {};
24
- }
25
- }
26
- ];
27
- }
13
+ if (!this.componentOptions) this.componentOptions = [];
28
14
  this.componentOptions.push(componentOption);
29
15
  }
30
16
  constructor(collectionFieldInterfaceManager){
@@ -7,7 +7,7 @@ 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 { fieldComponentSettingsItem, useContextConfigSetting } from "../../../../data-source/index.mjs";
10
+ import { useContextConfigSetting } from "../../../../data-source/index.mjs";
11
11
  import { useDesignable, useValidateSchema } from "../../../../schema-component/index.mjs";
12
12
  import { useIsFormReadPretty } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
13
13
  import { getTempFieldState } from "../../../../schema-component/antd/form-v2/utils.mjs";
@@ -472,9 +472,6 @@ const fieldSettingsFormItem = new SchemaSettings({
472
472
  const validateSchema = useValidateSchema();
473
473
  return form && !isFormReadPretty && validateSchema;
474
474
  }
475
- },
476
- {
477
- ...fieldComponentSettingsItem
478
475
  }
479
476
  ];
480
477
  }
@@ -118,14 +118,26 @@ const useTableBlockProps = ()=>{
118
118
  let [key, value] = param;
119
119
  if (key.includes(ctx.rowKey) && selectedRow.includes(value)) delete items[key];
120
120
  });
121
- const mergedFilter = mergeFilter([
121
+ const mergeList = [
122
122
  ...Object.values(storedFilter).map((filter)=>removeNullCondition(filter)),
123
123
  flat.unflatten(items),
124
124
  block.defaultFilter,
125
125
  prevMergedFilter
126
- ]);
126
+ ];
127
+ const mergedFilter = mergeFilter(mergeList);
127
128
  const currFilter = filterByCleanedFields(mergedFilter);
128
129
  prevMergedFilter = currFilter;
130
+ dataBlocks.forEach((item)=>{
131
+ const targetsUidList = targets.map((targetItem)=>targetItem.uid);
132
+ if (targetsUidList.includes(item.uid) && !item.associatedFields.find((assItem)=>assItem.name === target.field || target.field.includes(assItem.name))) {
133
+ const prevFlatItems = flat(prevMergedFilter);
134
+ Object.entries(prevFlatItems).forEach((param)=>{
135
+ let [key, prevItem] = param;
136
+ if (key.split('.').includes(target.field)) delete prevFlatItems[key];
137
+ });
138
+ prevMergedFilter = flat.unflatten(prevFlatItems);
139
+ }
140
+ });
129
141
  return block.doFilter({
130
142
  ...param,
131
143
  page: 1,
@@ -4,7 +4,6 @@ import { useApp } from "../../../../application/index.mjs";
4
4
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
5
5
  import { useCollectionManager_deprecated } from "../../../../collection-manager/index.mjs";
6
6
  import { useCollection } from "../../../../data-source/collection/CollectionProvider.mjs";
7
- import { fieldComponentSettingsItem } from "../../../../data-source/commonsSettingsItem/fieldComponent.mjs";
8
7
  import { useDesignable } from "../../../../schema-component/index.mjs";
9
8
  import { useAssociationFieldContext } from "../../../../schema-component/antd/association-field/hooks.mjs";
10
9
  import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
@@ -330,8 +329,7 @@ const tableColumnSettings = new SchemaSettings({
330
329
  }
331
330
  };
332
331
  }
333
- },
334
- fieldComponentSettingsItem
332
+ }
335
333
  ]
336
334
  },
337
335
  {
@@ -4,7 +4,6 @@ import { useTranslation } from "react-i18next";
4
4
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
5
5
  import { useFormBlockContext } from "../../../../block-provider/index.mjs";
6
6
  import { useCollectionManager_deprecated, useCollection_deprecated } from "../../../../collection-manager/index.mjs";
7
- import { fieldComponentSettingsItem } from "../../../../data-source/index.mjs";
8
7
  import { useCompile, useDesignable } from "../../../../schema-component/index.mjs";
9
8
  import { SchemaSettingsDefaultSortingRules } from "../../../../schema-settings/index.mjs";
10
9
  import { SchemaSettingsDataScope } from "../../../../schema-settings/SchemaSettingsDataScope.mjs";
@@ -184,9 +183,6 @@ const filterCollapseItemFieldSettings = new SchemaSettings({
184
183
  onChange: onTitleFieldChange
185
184
  };
186
185
  }
187
- },
188
- {
189
- ...fieldComponentSettingsItem
190
186
  }
191
187
  ];
192
188
  }
@@ -6,7 +6,6 @@ import { useApp } from "../../../../application/index.mjs";
6
6
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
7
7
  import { useCollectionManager_deprecated, useCollection_deprecated } from "../../../../collection-manager/index.mjs";
8
8
  import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
9
- import { fieldComponentSettingsItem } from "../../../../data-source/index.mjs";
10
9
  import { EditOperator, useDesignable, useValidateSchema } from "../../../../schema-component/index.mjs";
11
10
  import { SchemaSettingsDefaultValue } from "../../../../schema-settings/index.mjs";
12
11
  const filterFormItemFieldSettings = new SchemaSettings({
@@ -311,9 +310,6 @@ const filterFormItemFieldSettings = new SchemaSettings({
311
310
  name: 'operator',
312
311
  Component: EditOperator
313
312
  },
314
- {
315
- ...fieldComponentSettingsItem
316
- },
317
313
  {
318
314
  name: 'editDefaultValue',
319
315
  Component: SchemaSettingsDefaultValue
@@ -1,18 +1,108 @@
1
+ import { useField, useFieldSchema } from "@tachybase/schema";
2
+ import { useTranslation } from "react-i18next";
1
3
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
2
- import { useIsAssociationField, useIsFieldReadPretty, useIsMuiltipleAble, useIsSelectFieldMode } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
4
+ import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
5
+ import { useCollectionField, useDataSourceManager } from "../../../../data-source/index.mjs";
6
+ import { useCompile, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
7
+ import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
8
+ import { useIsAssociationField, useIsFieldReadPretty, useIsSelectFieldMode } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
3
9
  import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
4
10
  import { useIsShowMultipleSwitch } from "../../../../schema-settings/hooks/useIsShowMultipleSwitch.mjs";
5
- import { CustomTitle, allowMultiple, enableLink, fieldComponent, quickCreate, setDefaultSortingRules, setTheDataScope } from "../Select/selectComponentFieldSettings.mjs";
11
+ import { CustomTitle, allowMultiple, enableLink, quickCreate, setDefaultSortingRules, setTheDataScope } from "../Select/selectComponentFieldSettings.mjs";
6
12
  const CustomTitleComponentFieldSettings = new SchemaSettings({
7
13
  name: 'fieldSettings:component:CustomTitle',
8
14
  items: [
9
15
  {
10
- ...fieldComponent,
11
- useVisible: useIsMuiltipleAble
16
+ name: 'fieldComponent',
17
+ type: 'select',
18
+ useComponentProps () {
19
+ var _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
20
+ const { t } = useTranslation();
21
+ const field = useField();
22
+ const collectionFieldCurrent = useCollectionField();
23
+ const { fieldSchema: tableColumnSchema, collectionField } = useColumnSchema();
24
+ const schema = useFieldSchema();
25
+ const fieldSchema = tableColumnSchema || schema;
26
+ const fieldModeOptions = useFieldModeOptions({
27
+ fieldSchema: tableColumnSchema,
28
+ collectionField
29
+ });
30
+ const isAddNewForm = useIsAddNewForm();
31
+ const fieldMode = useFieldComponentName();
32
+ const { dn } = useDesignable();
33
+ const isSelect = [
34
+ 'select',
35
+ 'multipleSelect'
36
+ ].includes(null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface);
37
+ const optionsMuiltipleSelect = [
38
+ {
39
+ label: t('Select'),
40
+ value: 'Select'
41
+ },
42
+ {
43
+ label: t('Radio group'),
44
+ value: 'Radio group'
45
+ },
46
+ {
47
+ label: t('Custom Title'),
48
+ value: 'CustomTitle'
49
+ }
50
+ ];
51
+ if ((null == collectionFieldCurrent ? void 0 : collectionFieldCurrent.interface) === 'multipleSelect') {
52
+ const index = optionsMuiltipleSelect.findIndex((item)=>{
53
+ if ('Select' === item.value) item.value = 'multiple';
54
+ return 'Radio group' === item.value;
55
+ });
56
+ optionsMuiltipleSelect.splice(index, 1);
57
+ }
58
+ const dm = useDataSourceManager();
59
+ const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
60
+ const compile = useCompile();
61
+ const componentOptions = isSelect ? optionsMuiltipleSelect : fieldModeOptions;
62
+ null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
63
+ if (!(null == componentOptions ? void 0 : componentOptions.find((modeItem)=>modeItem.value === item.value))) null == componentOptions || componentOptions.push({
64
+ label: compile(item.label),
65
+ value: item.value
66
+ });
67
+ });
68
+ return {
69
+ title: t('Field component'),
70
+ options: componentOptions,
71
+ value: fieldMode,
72
+ onChange (mode) {
73
+ const schema = {
74
+ ['x-uid']: fieldSchema['x-uid']
75
+ };
76
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
77
+ fieldSchema['x-component-props']['mode'] = mode;
78
+ schema['x-component-props'] = fieldSchema['x-component-props'];
79
+ field.componentProps = field.componentProps || {};
80
+ field.componentProps.mode = mode;
81
+ if (isSubMode(fieldSchema) && isAddNewForm) {
82
+ var _field_setInitialValue, _field_setValue;
83
+ schema.default = null;
84
+ fieldSchema.default = null;
85
+ null == field || null == (_field_setInitialValue = field.setInitialValue) || _field_setInitialValue.call(field, null);
86
+ null == field || null == (_field_setValue = field.setValue) || _field_setValue.call(field, null);
87
+ }
88
+ dn.emit('patch', {
89
+ schema
90
+ });
91
+ dn.refresh();
92
+ }
93
+ };
94
+ },
95
+ useVisible () {
96
+ const fieldMode = useFieldComponentName();
97
+ return 'CustomTitle' === fieldMode;
98
+ }
12
99
  },
13
100
  {
14
101
  ...CustomTitle,
15
- useVisible: useIsMuiltipleAble
102
+ useVisible () {
103
+ const fieldMode = useFieldComponentName();
104
+ return 'CustomTitle' === fieldMode;
105
+ }
16
106
  },
17
107
  {
18
108
  ...setTheDataScope,
@@ -0,0 +1,2 @@
1
+ import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
2
+ export declare const inputPreviewComponentFieldSettings: SchemaSettings<{}>;
@@ -0,0 +1,99 @@
1
+ import { useField, useFieldSchema } from "@tachybase/schema";
2
+ import { useTranslation } from "react-i18next";
3
+ import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
4
+ import { useColumnSchema, useDesignable } from "../../../../schema-component/index.mjs";
5
+ const createSettingsItem = (config)=>({
6
+ name: config.name,
7
+ type: 'select',
8
+ useComponentProps () {
9
+ var _fieldSchema_xcomponentprops;
10
+ const { t } = useTranslation();
11
+ const field = useField();
12
+ const schema = useFieldSchema();
13
+ const { fieldSchema: tableColumnSchema } = useColumnSchema();
14
+ const fieldSchema = tableColumnSchema || schema;
15
+ const { dn } = useDesignable();
16
+ return {
17
+ title: t(config.title),
18
+ options: config.options(t),
19
+ value: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops[config.name]) || config.defaultValue,
20
+ onChange (value) {
21
+ const schema = {
22
+ ['x-uid']: fieldSchema['x-uid']
23
+ };
24
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
25
+ fieldSchema['x-component-props'][config.name] = value;
26
+ schema['x-component-props'] = fieldSchema['x-component-props'];
27
+ field.componentProps = field.componentProps || {};
28
+ field.componentProps[config.name] = value;
29
+ dn.emit('patch', {
30
+ schema
31
+ });
32
+ }
33
+ };
34
+ }
35
+ });
36
+ const getSizeOptions = (t)=>[
37
+ {
38
+ value: 'small',
39
+ label: t('Small')
40
+ },
41
+ {
42
+ value: 'middle',
43
+ label: t('Middle')
44
+ },
45
+ {
46
+ value: 'large',
47
+ label: t('Large')
48
+ },
49
+ {
50
+ value: 'oversized',
51
+ label: t('Oversized')
52
+ },
53
+ {
54
+ value: 'auto',
55
+ label: t('Auto')
56
+ }
57
+ ];
58
+ const getObjectFitOptions = (t)=>[
59
+ {
60
+ value: 'cover',
61
+ label: t('Cover')
62
+ },
63
+ {
64
+ value: 'fill',
65
+ label: t('Fill')
66
+ },
67
+ {
68
+ value: 'contain',
69
+ label: t('Contain')
70
+ },
71
+ {
72
+ value: 'scale-down',
73
+ label: t('Scale Down')
74
+ },
75
+ {
76
+ value: 'none',
77
+ label: t('None')
78
+ }
79
+ ];
80
+ const size = createSettingsItem({
81
+ name: 'size',
82
+ title: 'Size',
83
+ options: getSizeOptions,
84
+ defaultValue: 'small'
85
+ });
86
+ const objectFit = createSettingsItem({
87
+ name: 'objectFit',
88
+ title: 'Object Fit',
89
+ options: getObjectFitOptions,
90
+ defaultValue: 'cover'
91
+ });
92
+ const inputPreviewComponentFieldSettings = new SchemaSettings({
93
+ name: 'fieldSettings:component:Input.Preview',
94
+ items: [
95
+ size,
96
+ objectFit
97
+ ]
98
+ });
99
+ export { inputPreviewComponentFieldSettings };
@@ -0,0 +1,2 @@
1
+ import { SchemaSettings } from '../../../../application/schema-settings/SchemaSettings';
2
+ export declare const multipleComponentFieldSettings: SchemaSettings<{}>;
@@ -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 };