@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
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  });
29
29
  const schema_namespaceObject = require("@tachybase/schema");
30
30
  const external_react_i18next_namespaceObject = require("react-i18next");
31
- const external_react_router_namespaceObject = require("react-router");
32
31
  const external_index_js_namespaceObject = require("../../index.js");
33
32
  const index_js_namespaceObject = require("../../../application/schema-settings/index.js");
34
33
  const schema_toolbar_index_js_namespaceObject = require("../../../application/schema-toolbar/index.js");
@@ -65,38 +64,6 @@ const pageSettings = new index_js_namespaceObject.SchemaSettings({
65
64
  };
66
65
  }
67
66
  },
68
- {
69
- name: 'enablesharePage',
70
- type: 'switch',
71
- useVisible () {
72
- const isShare = (0, external_react_router_namespaceObject.useMatch)('/share/:name');
73
- return !isShare;
74
- },
75
- useComponentProps () {
76
- var _fieldSchema_xcomponentprops;
77
- const { dn } = (0, external_index_js_namespaceObject.useDesignable)();
78
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
79
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
80
- const { title } = (0, schema_toolbar_index_js_namespaceObject.useSchemaToolbar)();
81
- return {
82
- title: t('Enable Share page'),
83
- checked: null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.enableSharePage,
84
- onChange (v) {
85
- fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
86
- fieldSchema['x-component-props']['enableSharePage'] = v;
87
- if (!fieldSchema.title) fieldSchema.title = title;
88
- dn.emit('patch', {
89
- schema: {
90
- ['x-uid']: fieldSchema['x-uid'],
91
- ['x-component-props']: fieldSchema['x-component-props'],
92
- title: fieldSchema.title
93
- }
94
- });
95
- dn.refresh();
96
- }
97
- };
98
- }
99
- },
100
67
  {
101
68
  name: 'divider',
102
69
  type: 'divider',
@@ -66,7 +66,6 @@ const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
66
66
  const external_error_fallback_index_js_namespaceObject = require("../error-fallback/index.js");
67
67
  const external_FixedBlock_js_namespaceObject = require("./FixedBlock.js");
68
68
  var external_FixedBlock_js_default = /*#__PURE__*/ __webpack_require__.n(external_FixedBlock_js_namespaceObject);
69
- const useShareActions_js_namespaceObject = require("./hooks/useShareActions.js");
70
69
  const external_Page_style_js_namespaceObject = require("./Page.style.js");
71
70
  const external_PageDesigner_js_namespaceObject = require("./PageDesigner.js");
72
71
  const external_PageTabDesigner_js_namespaceObject = require("./PageTabDesigner.js");
@@ -128,29 +127,21 @@ const Page = (props)=>{
128
127
  }));
129
128
  };
130
129
  const PageHeader = (props)=>{
131
- var _fieldSchema_xcomponentprops;
130
+ var _fieldSchema_xcomponentprops, _Object_values, _Object_values1;
132
131
  const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
133
132
  const { theme } = (0, theme_index_js_namespaceObject.useGlobalTheme)();
134
133
  const options = (0, external_react_namespaceObject.useContext)(schema_namespaceObject.SchemaOptionsContext);
135
134
  const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
136
- const [open, setOpen] = (0, external_react_namespaceObject.useState)(false);
137
- const [imageOpen, setImageOpen] = (0, external_react_namespaceObject.useState)(false);
138
135
  const { showScrollArea } = (0, useContextMenu_js_namespaceObject.useContextMenu)();
139
136
  const hidePageTitle = null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
137
+ const extendComponents = fieldSchema['x-extend-components'] || {};
140
138
  const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
141
- const isShare = (0, external_react_router_dom_namespaceObject.useMatch)('/share/:name');
142
139
  const items = fieldSchema.mapProperties((schema)=>({
143
140
  key: schema.name,
144
141
  label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabItem, {
145
142
  schema: schema
146
143
  })
147
144
  }));
148
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
149
- const { styles } = (0, external_style_js_namespaceObject.useStyles)();
150
- const { copyLink, imageAction } = (0, useShareActions_js_namespaceObject.useShareActions)({
151
- title: pageHeaderTitle,
152
- uid: ''
153
- });
154
145
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
155
146
  ref: (ref)=>{
156
147
  setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
@@ -162,12 +153,29 @@ const PageHeader = (props)=>{
162
153
  ghost: false,
163
154
  title: pageHeaderTitle || ' ',
164
155
  ...parentProps,
165
- extra: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HeaderExtra, {
166
- enablePageTabs: enablePageTabs,
167
- showScrollArea: showScrollArea,
168
- isShare: isShare,
169
- setOpen: setOpen,
170
- enableSharePage: enableSharePage
156
+ extra: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
157
+ children: [
158
+ null == (_Object_values = Object.values(extendComponents)) ? void 0 : _Object_values.map((item, index)=>{
159
+ const schema = {
160
+ type: 'void',
161
+ name: item.name,
162
+ 'x-component': item.component,
163
+ 'x-component-props': {}
164
+ };
165
+ const componentProps = {
166
+ ...props,
167
+ isExtra: true,
168
+ fieldSchema
169
+ };
170
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.PageExtendComponentProvider, {
171
+ ...componentProps,
172
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponent, {
173
+ schema: schema
174
+ })
175
+ });
176
+ }),
177
+ !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {})
178
+ ]
171
179
  }),
172
180
  footer: enablePageTabs && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabComponent, {
173
181
  activeKey: activeKey,
@@ -179,84 +187,27 @@ const PageHeader = (props)=>{
179
187
  items: items
180
188
  })
181
189
  }),
182
- disablePageHeader && enableSharePage && !isShare && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
183
- className: "tb-page-header-button",
184
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
185
- icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ShareAltOutlined, {}),
186
- onClick: ()=>{
187
- setOpen(true);
188
- },
189
- children: t('Share')
190
- })
191
- }),
192
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Modal, {
193
- open: open,
194
- className: styles.firstmodal,
195
- title: t('Share'),
196
- footer: null,
197
- width: 500,
198
- onCancel: ()=>{
199
- setOpen(false);
200
- },
201
- children: [
202
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
203
- className: styles.secondmodal,
204
- children: [
205
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
206
- className: "tb-header-modal-list",
207
- onClick: copyLink,
208
- children: [
209
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_index_js_namespaceObject.Icon, {
210
- type: "PaperClipOutlined"
211
- }),
212
- t('Copy link')
213
- ]
214
- }),
215
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
216
- className: "tb-header-modal-list",
217
- onClick: ()=>{
218
- setImageOpen(true);
219
- },
220
- children: [
221
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_index_js_namespaceObject.Icon, {
222
- type: "QrcodeOutlined"
223
- }),
224
- t('Generate QR code')
225
- ]
226
- })
227
- ]
228
- }),
229
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Modal, {
230
- className: styles.imageModal,
231
- open: imageOpen,
232
- footer: null,
233
- onCancel: ()=>{
234
- setImageOpen(false);
235
- },
236
- children: imageAction()
190
+ null == (_Object_values1 = Object.values(extendComponents)) ? void 0 : _Object_values1.map((item, index)=>{
191
+ const schema = {
192
+ type: 'void',
193
+ name: 'icon' + item.name,
194
+ 'x-component': item.component,
195
+ 'x-component-props': {}
196
+ };
197
+ const componentProps = {
198
+ ...props,
199
+ fieldSchema
200
+ };
201
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.PageExtendComponentProvider, {
202
+ ...componentProps,
203
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponent, {
204
+ schema: schema
237
205
  })
238
- ]
206
+ });
239
207
  })
240
208
  ]
241
209
  });
242
210
  };
243
- const HeaderExtra = (param)=>{
244
- let { enablePageTabs, showScrollArea, isShare, setOpen, enableSharePage } = param;
245
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
246
- children: [
247
- !isShare && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
248
- icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ShareAltOutlined, {}),
249
- onClick: ()=>{
250
- setOpen(true);
251
- },
252
- style: {
253
- visibility: "".concat(enableSharePage ? 'visible' : 'hidden')
254
- }
255
- }),
256
- !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {})
257
- ]
258
- });
259
- };
260
211
  const TabComponent = (props)=>{
261
212
  const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
262
213
  const { styles } = (0, external_Page_style_js_namespaceObject.useStyles)();
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var __webpack_modules__ = {
3
- "./useShareActions": function(module) {
4
- module.exports = require("./useShareActions.js");
3
+ "./useIsBlockInPage": function(module) {
4
+ module.exports = require("./useIsBlockInPage.js");
5
5
  }
6
6
  };
7
7
  var __webpack_module_cache__ = {};
@@ -47,10 +47,10 @@ function __webpack_require__(moduleId) {
47
47
  var __webpack_exports__ = {};
48
48
  (()=>{
49
49
  __webpack_require__.r(__webpack_exports__);
50
- var _useShareActions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./useShareActions");
50
+ var _useIsBlockInPage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./useIsBlockInPage");
51
51
  var __WEBPACK_REEXPORT_OBJECT__ = {};
52
- for(var __WEBPACK_IMPORT_KEY__ in _useShareActions__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
53
- return _useShareActions__WEBPACK_IMPORTED_MODULE_0__[key];
52
+ for(var __WEBPACK_IMPORT_KEY__ in _useIsBlockInPage__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
53
+ return _useIsBlockInPage__WEBPACK_IMPORTED_MODULE_0__[key];
54
54
  }).bind(0, __WEBPACK_IMPORT_KEY__);
55
55
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
56
56
  })();
@@ -17,6 +17,9 @@ var __webpack_modules__ = {
17
17
  },
18
18
  "./hooks?5620": function(module) {
19
19
  module.exports = require("./hooks/index.js");
20
+ },
21
+ "./pageExtendComponentProvider": function(module) {
22
+ module.exports = require("./pageExtendComponentProvider.js");
20
23
  }
21
24
  };
22
25
  var __webpack_module_cache__ = {};
@@ -98,6 +101,12 @@ var __webpack_exports__ = {};
98
101
  return _hooks__WEBPACK_IMPORTED_MODULE_5__[key];
99
102
  }).bind(0, __WEBPACK_IMPORT_KEY__);
100
103
  __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
104
+ var _pageExtendComponentProvider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./pageExtendComponentProvider");
105
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
106
+ for(var __WEBPACK_IMPORT_KEY__ in _pageExtendComponentProvider__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
107
+ return _pageExtendComponentProvider__WEBPACK_IMPORTED_MODULE_6__[key];
108
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
109
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
101
110
  })();
102
111
  for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
103
112
  Object.defineProperty(exports, '__esModule', {
@@ -24,20 +24,25 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- ShareSchemaComponent: ()=>ShareSchemaComponent
27
+ usePageExtendComponentContext: ()=>usePageExtendComponentContext,
28
+ PageExtendComponentContext: ()=>PageExtendComponentContext,
29
+ PageExtendComponentProvider: ()=>PageExtendComponentProvider
28
30
  });
29
31
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- const external_react_router_namespaceObject = require("react-router");
31
- const index_js_namespaceObject = require("../../schema-component/index.js");
32
- function ShareSchemaComponent() {
33
- const params = (0, external_react_router_namespaceObject.useParams)();
34
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.RemoteSchemaComponent, {
35
- uid: params.name
32
+ const external_react_namespaceObject = require("react");
33
+ const PageExtendComponentContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({});
34
+ const PageExtendComponentProvider = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageExtendComponentContext.Provider, {
35
+ value: props,
36
+ children: props.children
36
37
  });
37
- }
38
- exports.ShareSchemaComponent = __webpack_exports__.ShareSchemaComponent;
38
+ const usePageExtendComponentContext = ()=>(0, external_react_namespaceObject.useContext)(PageExtendComponentContext);
39
+ exports.PageExtendComponentContext = __webpack_exports__.PageExtendComponentContext;
40
+ exports.PageExtendComponentProvider = __webpack_exports__.PageExtendComponentProvider;
41
+ exports.usePageExtendComponentContext = __webpack_exports__.usePageExtendComponentContext;
39
42
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
40
- "ShareSchemaComponent"
43
+ "PageExtendComponentContext",
44
+ "PageExtendComponentProvider",
45
+ "usePageExtendComponentContext"
41
46
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
42
47
  Object.defineProperty(exports, '__esModule', {
43
48
  value: true
@@ -24,46 +24,9 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- getStyles: ()=>getStyles,
28
- useStyles: ()=>useStyles
27
+ getStyles: ()=>getStyles
29
28
  });
30
- const external_antd_style_namespaceObject = require("antd-style");
31
29
  const index_js_namespaceObject = require("../__builtins__/index.js");
32
- function _tagged_template_literal(strings, raw) {
33
- if (!raw) raw = strings.slice(0);
34
- return Object.freeze(Object.defineProperties(strings, {
35
- raw: {
36
- value: Object.freeze(raw)
37
- }
38
- }));
39
- }
40
- function _templateObject() {
41
- const data = _tagged_template_literal([
42
- "\n .ant-modal-content {\n position: relative;\n overflow: hidden;\n border-radius: 16px;\n &::before,\n &::after {\n content: '';\n position: absolute;\n width: 300px;\n height: 300px;\n background: radial-gradient(circle, rgba(0, 149, 255, 0.11) 0%, transparent 70%);\n z-index: 0;\n pointer-events: none;\n }\n\n &::before {\n top: -165px;\n left: -10px;\n }\n\n &::after {\n bottom: -160px;\n right: -150px;\n }\n .ant-modal-header {\n text-align: center;\n margin-bottom: 20px;\n margin-top: 15px;\n .ant-modal-title {\n font-size: x-large;\n font-weight: 400;\n }\n }\n .ant-modal-body {\n justify-items: center;\n }\n }\n "
43
- ]);
44
- _templateObject = function() {
45
- return data;
46
- };
47
- return data;
48
- }
49
- function _templateObject1() {
50
- const data = _tagged_template_literal([
51
- "\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n margin-top: 20px;\n margin-bottom: 40px;\n position: relative;\n gap: 20%;\n padding-left: 10%;\n padding-right: 10%;\n .tb-header-modal-list {\n width: 50%;\n gap: 10px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n border: 1px solid transparent;\n border-color: rgba(203, 227, 254, 0.62);\n box-shadow: none;\n border-radius: 12px;\n padding: 16px;\n transition:\n box-shadow 0.2s ease,\n transform 0.2s ease;\n z-index: 1;\n position: relative;\n &:hover {\n border-color: rgba(0, 120, 255, 0.3);\n box-shadow: 0 4px 16px rgba(0, 120, 255, 0.15);\n }\n &:active {\n box-shadow: none;\n transform: translateY(2px);\n }\n .anticon {\n width: 100%;\n display: flex;\n justify-content: center;\n svg {\n width: 30px;\n height: 30px;\n }\n }\n .tb-header-modal-list-text {\n text-align: center;\n }\n }\n "
52
- ]);
53
- _templateObject1 = function() {
54
- return data;
55
- };
56
- return data;
57
- }
58
- function _templateObject2() {
59
- const data = _tagged_template_literal([
60
- "\n display: flex;\n justify-content: center;\n .ant-modal-content {\n width: 280px;\n height: 360px;\n }\n "
61
- ]);
62
- _templateObject2 = function() {
63
- return data;
64
- };
65
- return data;
66
- }
67
30
  const getStyles = (0, index_js_namespaceObject.genStyleHook)('tb-page', (token)=>{
68
31
  const { componentCls } = token;
69
32
  return {
@@ -208,19 +171,9 @@ const getStyles = (0, index_js_namespaceObject.genStyleHook)('tb-page', (token)=
208
171
  }
209
172
  };
210
173
  });
211
- const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
212
- let { css, token } = param;
213
- return {
214
- firstmodal: css(_templateObject()),
215
- secondmodal: css(_templateObject1()),
216
- imageModal: css(_templateObject2())
217
- };
218
- });
219
174
  exports.getStyles = __webpack_exports__.getStyles;
220
- exports.useStyles = __webpack_exports__.useStyles;
221
175
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
222
- "getStyles",
223
- "useStyles"
176
+ "getStyles"
224
177
  ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
225
178
  Object.defineProperty(exports, '__esModule', {
226
179
  value: true
@@ -24,7 +24,7 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- default: ()=>FormulaSelect
27
+ default: ()=>select_FormulaSelect
28
28
  });
29
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  const external_react_namespaceObject = require("react");
@@ -131,6 +131,7 @@ const useLabelOptions = (others)=>{
131
131
  const collectionField = (0, external_react_namespaceObject.useMemo)(()=>getField(fieldSchema['x-collection-field']), [
132
132
  fieldSchema['x-collection-field']
133
133
  ]);
134
+ if (!(null == collectionField ? void 0 : collectionField.target) && !fieldSchema['collectionName']) return others;
134
135
  const request = {
135
136
  resource: (null == collectionField ? void 0 : collectionField.target) || fieldSchema['collectionName'],
136
137
  action: 'list',
@@ -179,16 +180,18 @@ const useLabelOptions = (others)=>{
179
180
  }
180
181
  return others;
181
182
  };
182
- const FormulaSelect_FormulaSelect = (props)=>{
183
+ const FormulaSelect = (props)=>{
183
184
  const { objectValue, loading, value, rawOptions, defaultValue, ...others } = props;
184
185
  let mode = props.multiple ? 'multiple' : props.mode;
185
186
  const filterField = null == others ? void 0 : others['params'];
186
187
  const [options, setOptions] = (0, external_react_namespaceObject.useState)([]);
187
188
  const [collectionName, setCollectionName] = (0, external_react_namespaceObject.useState)('');
189
+ const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
188
190
  const api = (0, index_js_namespaceObject.useAPIClient)();
189
191
  if (mode && ![
190
192
  'multiple',
191
- 'tags'
193
+ 'tags',
194
+ 'CustomTitle'
192
195
  ].includes(mode)) mode = void 0;
193
196
  const fieldProps = {
194
197
  ...others
@@ -210,6 +213,7 @@ const FormulaSelect_FormulaSelect = (props)=>{
210
213
  } else if ((null == others ? void 0 : others.collection) === collectionName) fieldProps['options'] = options.map((option)=>({
211
214
  ...option
212
215
  }));
216
+ else fieldProps['options'] = getFormulaValue(props.fieldNames['formula'], (null == props ? void 0 : props.options) || [], fieldSchema);
213
217
  const modifiedProps = useLabelOptions(fieldProps);
214
218
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ObjectSelect, {
215
219
  rawOptions: rawOptions,
@@ -220,7 +224,15 @@ const FormulaSelect_FormulaSelect = (props)=>{
220
224
  loading: loading
221
225
  });
222
226
  };
223
- const FormulaSelect = FormulaSelect_FormulaSelect;
227
+ const select_FormulaSelect = FormulaSelect;
228
+ const getFormulaValue = (template, options, fieldSchema)=>options.map((item)=>{
229
+ const label = item.label;
230
+ const customLabel = template.replace(new RegExp("{{".concat(fieldSchema['name'], "}}"), 'g'), label);
231
+ return {
232
+ ...item,
233
+ label: customLabel
234
+ };
235
+ });
224
236
  exports["default"] = __webpack_exports__["default"];
225
237
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
226
238
  "default"
@@ -34,7 +34,7 @@ const CollectionFieldProvider_js_namespaceObject = require("../../../data-source
34
34
  const EllipsisWithTooltip_js_namespaceObject = require("../input/EllipsisWithTooltip.js");
35
35
  const external_utils_js_namespaceObject = require("./utils.js");
36
36
  const ReadPretty = (0, schema_namespaceObject.observer)((props)=>{
37
- var _field_value;
37
+ var _field_value, _fieldSchema_xcomponentprops_fieldNames;
38
38
  const fieldNames = {
39
39
  ...external_utils_js_namespaceObject.defaultFieldNames,
40
40
  ...props.fieldNames
@@ -43,8 +43,10 @@ const ReadPretty = (0, schema_namespaceObject.observer)((props)=>{
43
43
  if (!(0, schema_namespaceObject.isValid)(props.value)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {});
44
44
  if ((0, schema_namespaceObject.isArrayField)(field) && (null == field ? void 0 : null == (_field_value = field.value) ? void 0 : _field_value.length) === 0) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {});
45
45
  const collectionField = (0, CollectionFieldProvider_js_namespaceObject.useCollectionField)();
46
+ const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
46
47
  const dataSource = field.dataSource || props.options || (null == collectionField ? void 0 : collectionField.uiSchema.enum) || [];
47
- const currentOptions = (0, external_utils_js_namespaceObject.getCurrentOptions)(field.value, dataSource, fieldNames);
48
+ const options = (0, external_utils_js_namespaceObject.getCurrentOptions)(field.value, dataSource, fieldNames);
49
+ const currentOptions = getFormulaValue(null == (_fieldSchema_xcomponentprops_fieldNames = fieldSchema['x-component-props'].fieldNames) ? void 0 : _fieldSchema_xcomponentprops_fieldNames['formula'], options, fieldSchema);
48
50
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
49
51
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EllipsisWithTooltip_js_namespaceObject.EllipsisWithTooltip, {
50
52
  ellipsis: props.ellipsis,
@@ -58,6 +60,17 @@ const ReadPretty = (0, schema_namespaceObject.observer)((props)=>{
58
60
  }, {
59
61
  displayName: 'ReadPretty'
60
62
  });
63
+ const getFormulaValue = (template, options, fieldSchema)=>{
64
+ if (!template) return options;
65
+ return options.map((item)=>{
66
+ const label = item.label;
67
+ const customLabel = template.replace(new RegExp("{{".concat(fieldSchema['name'], "}}"), 'g'), label);
68
+ return {
69
+ ...item,
70
+ label: customLabel
71
+ };
72
+ });
73
+ };
61
74
  exports.ReadPretty = __webpack_exports__.ReadPretty;
62
75
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
63
76
  "ReadPretty"
@@ -120,8 +120,12 @@ const InternalSelect = (0, schema_namespaceObject.connect)((props)=>{
120
120
  let mode = props.multiple ? 'multiple' : props.mode;
121
121
  if (mode && ![
122
122
  'multiple',
123
- 'tags'
123
+ 'tags',
124
+ 'CustomTitle'
124
125
  ].includes(mode)) mode = void 0;
126
+ let options = props.options ? [
127
+ ...props.options
128
+ ] : [];
125
129
  if ([
126
130
  'CustomTitle'
127
131
  ].includes(props.mode) && ('formula' in others.fieldNames || 'collection' in props)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FormulaSelect_js_default(), {
@@ -156,6 +160,7 @@ const InternalSelect = (0, schema_namespaceObject.connect)((props)=>{
156
160
  "aria-label": "icon-close-select"
157
161
  })
158
162
  },
163
+ options: options,
159
164
  popupMatchSelectWidth: false,
160
165
  notFoundContent: loading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Spin, {}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Empty, {
161
166
  image: external_antd_namespaceObject.Empty.PRESENTED_IMAGE_SIMPLE
@@ -30,8 +30,10 @@ const external_react_namespaceObject = require("react");
30
30
  const schema_namespaceObject = require("@tachybase/schema");
31
31
  const external_react_i18next_namespaceObject = require("react-i18next");
32
32
  const index_js_namespaceObject = require("../../collection-manager/index.js");
33
+ const external_data_source_index_js_namespaceObject = require("../../data-source/index.js");
34
+ const external_useCompile_js_namespaceObject = require("./useCompile.js");
33
35
  const useFieldModeOptions = (props)=>{
34
- var _fieldSchema_xcomponentprops;
36
+ var _fieldSchema_xcomponentprops, _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
35
37
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
36
38
  const { getCollectionJoinField, getCollection } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
37
39
  const currentFieldSchema = (0, schema_namespaceObject.useFieldSchema)();
@@ -39,12 +41,15 @@ const useFieldModeOptions = (props)=>{
39
41
  const field = (0, schema_namespaceObject.useField)();
40
42
  const form = (0, schema_namespaceObject.useForm)();
41
43
  const isReadPretty = (null == fieldSchema ? void 0 : fieldSchema['x-read-pretty']) || field.readPretty || form.readPretty;
44
+ const dm = (0, external_data_source_index_js_namespaceObject.useDataSourceManager)();
42
45
  const isTableField = null == props ? void 0 : props.fieldSchema;
43
46
  const { getField } = (0, index_js_namespaceObject.useCollection_deprecated)();
44
47
  const collectionField = (null == props ? void 0 : props.collectionField) || getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
48
+ const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
45
49
  const { label } = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.fieldNames) || {};
50
+ const compile = (0, external_useCompile_js_namespaceObject.useCompile)();
46
51
  const fieldModeOptions = (0, external_react_namespaceObject.useMemo)(()=>{
47
- if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return;
52
+ if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return [];
48
53
  if (![
49
54
  'o2o',
50
55
  'oho',
@@ -234,10 +239,6 @@ const useFieldModeOptions = (props)=>{
234
239
  label: t('Tag'),
235
240
  value: 'Tag'
236
241
  },
237
- {
238
- label: t('Custom Title'),
239
- value: 'CustomTitle'
240
- },
241
242
  !isTableField && {
242
243
  label: t('Sub-details'),
243
244
  value: 'Nester'
@@ -266,10 +267,6 @@ const useFieldModeOptions = (props)=>{
266
267
  {
267
268
  label: t('Cascader'),
268
269
  value: 'Cascader'
269
- },
270
- {
271
- label: t('Custom Title'),
272
- value: 'CustomTitle'
273
270
  }
274
271
  ];
275
272
  default:
@@ -314,6 +311,12 @@ const useFieldModeOptions = (props)=>{
314
311
  null == collectionField ? void 0 : collectionField.interface,
315
312
  label
316
313
  ]);
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 == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
316
+ label: compile(item.label),
317
+ value: item.value
318
+ });
319
+ });
317
320
  return (fieldModeOptions || []).filter(Boolean);
318
321
  };
319
322
  exports.useFieldModeOptions = __webpack_exports__.useFieldModeOptions;
@@ -45,6 +45,12 @@ function useFormulaTitleOptions() {
45
45
  const collectionManage = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
46
46
  const collectionManageField = collectionManage.collections.filter((value)=>value.name === fieldSchema['x-decorator-props'])[0];
47
47
  const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
48
+ const isAssociationField = collectionField && [
49
+ 'hasOne',
50
+ 'hasMany',
51
+ 'belongsTo',
52
+ 'belongsToMany'
53
+ ].includes(collectionField.type);
48
54
  let fields = [];
49
55
  if (collectionField) fields = getCollectionFields(collectionField ? collectionField.target ? collectionField.target : collectionField.collectionName : fieldSchema['name']);
50
56
  else if (collectionManageField) fields = collectionManageField['fields'];
@@ -53,7 +59,7 @@ function useFormulaTitleOptions() {
53
59
  if (![
54
60
  'm2m',
55
61
  'o2m'
56
- ].includes(field.interface)) {
62
+ ].includes(field.interface) && isAssociationField) {
57
63
  if (field.uiSchema) {
58
64
  var _getCollectionFields;
59
65
  var _getCollectionFields_filter_map;
@@ -67,6 +73,18 @@ function useFormulaTitleOptions() {
67
73
  });
68
74
  }
69
75
  }
76
+ if (!isAssociationField && field.name === fieldSchema['name']) {
77
+ var _getCollectionFields1;
78
+ var _getCollectionFields_filter_map1;
79
+ options.push({
80
+ label: compile(field.uiSchema.title),
81
+ value: field.name,
82
+ children: null != (_getCollectionFields_filter_map1 = null == (_getCollectionFields1 = getCollectionFields(field.target)) ? void 0 : _getCollectionFields1.filter((subField)=>subField.uiSchema).map((subField)=>({
83
+ label: subField.uiSchema ? compile(subField.uiSchema.title) : '',
84
+ value: subField.name
85
+ }))) ? _getCollectionFields_filter_map1 : []
86
+ });
87
+ }
70
88
  });
71
89
  return options;
72
90
  }
@@ -71,6 +71,8 @@ const fileManagerComponentFieldSettings_js_namespaceObject = require("../modules
71
71
  const uploadAttachmentComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.js");
72
72
  const inputComponentFieldsSettings_js_namespaceObject = require("../modules/fields/component/Input/inputComponentFieldsSettings.js");
73
73
  const inputNumberComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/InputNumber/inputNumberComponentFieldSettings.js");
74
+ const inputPreviewComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js");
75
+ const multipleSelectComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js");
74
76
  const subformComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Nester/subformComponentFieldSettings.js");
75
77
  const recordPickerComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/Picker/recordPickerComponentFieldSettings.js");
76
78
  const subformPopoverComponentFieldSettings_js_namespaceObject = require("../modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.js");
@@ -128,6 +130,7 @@ class SchemaSettingsPlugin extends Plugin_js_namespaceObject.Plugin {
128
130
  this.schemaSettingsManager.add(datePickerComponentFieldSettings_js_namespaceObject.datePickerComponentFieldSettings);
129
131
  this.schemaSettingsManager.add(unixTimestampComponentFieldSettings_js_namespaceObject.unixTimestampComponentFieldSettings);
130
132
  this.schemaSettingsManager.add(inputComponentFieldsSettings_js_namespaceObject.inputComponentFieldSettings);
133
+ this.schemaSettingsManager.add(inputPreviewComponentFieldSettings_js_namespaceObject.inputPreviewComponentFieldSettings);
131
134
  this.schemaSettingsManager.add(inputNumberComponentFieldSettings_js_namespaceObject.inputNumberComponentFieldSettings);
132
135
  this.schemaSettingsManager.add(checkboxComponentFieldSettings_js_namespaceObject.checkboxComponentFieldSettings);
133
136
  this.schemaSettingsManager.add(radioComponentFieldSettings_js_namespaceObject.radioComponentFieldSettings);
@@ -137,6 +140,7 @@ class SchemaSettingsPlugin extends Plugin_js_namespaceObject.Plugin {
137
140
  this.schemaSettingsManager.add(cascadeSelectComponentFieldSettings_js_namespaceObject.cascadeSelectComponentFieldSettings);
138
141
  this.schemaSettingsManager.add(uploadAttachmentComponentFieldSettings_js_namespaceObject.uploadAttachmentComponentFieldSettings);
139
142
  this.schemaSettingsManager.add(cascaderComponentFieldSettings_js_namespaceObject.cascaderComponentFieldSettings);
143
+ this.schemaSettingsManager.add(multipleSelectComponentFieldSettings_js_namespaceObject.multipleComponentFieldSettings);
140
144
  }
141
145
  }
142
146
  exports.SchemaSettingsPlugin = __webpack_exports__.SchemaSettingsPlugin;