@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.
Files changed (135) 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/Configuration/components/Summary.mjs +3 -3
  10. package/es/collection-manager/collectionPlugin.mjs +36 -0
  11. package/es/collection-manager/interfaces/url.d.ts +4 -0
  12. package/es/collection-manager/interfaces/url.mjs +10 -1
  13. package/es/collection-manager/templates/sql.d.ts +3 -3
  14. package/es/collection-manager/templates/view.d.ts +3 -3
  15. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
  16. package/es/flag-provider/FlagProvider.d.ts +1 -0
  17. package/es/flag-provider/hooks/useFlag.mjs +1 -1
  18. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
  19. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
  20. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
  21. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
  22. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
  23. package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
  24. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
  25. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
  26. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
  27. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
  28. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
  29. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
  30. package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
  31. package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
  32. package/es/schema-component/antd/association-field/hooks.mjs +52 -1
  33. package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
  34. package/es/schema-component/antd/date-picker/util.d.ts +13 -0
  35. package/es/schema-component/antd/date-picker/util.mjs +14 -1
  36. package/es/schema-component/antd/input/Input.mjs +2 -1
  37. package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
  38. package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
  39. package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
  40. package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
  41. package/es/schema-component/antd/page/Page.mjs +46 -95
  42. package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
  43. package/es/schema-component/antd/page/hooks/index.mjs +1 -1
  44. package/es/schema-component/antd/page/index.d.ts +1 -0
  45. package/es/schema-component/antd/page/index.mjs +1 -0
  46. package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
  47. package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
  48. package/es/schema-component/antd/page/style.d.ts +0 -5
  49. package/es/schema-component/antd/page/style.mjs +1 -45
  50. package/es/schema-component/antd/password/utils.d.ts +1 -1
  51. package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
  52. package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
  53. package/es/schema-component/antd/select/Select.mjs +6 -1
  54. package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
  55. package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
  56. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
  57. package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
  58. package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
  59. package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
  60. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
  61. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
  62. package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
  63. package/es/user/ChangePassword.mjs +109 -6
  64. package/es/user/index.d.ts +1 -0
  65. package/es/user/index.mjs +2 -0
  66. package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
  67. package/lib/application/Application.js +0 -8
  68. package/lib/application/components/index.js +0 -18
  69. package/lib/block-provider/hooks/index.js +5 -5
  70. package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
  71. package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
  72. package/lib/built-in/index.js +30 -4
  73. package/lib/built-in/pm/index.js +1 -1
  74. package/lib/collection-manager/Configuration/components/Summary.js +3 -3
  75. package/lib/collection-manager/collectionPlugin.js +36 -0
  76. package/lib/collection-manager/index.js +17 -17
  77. package/lib/collection-manager/interfaces/url.js +10 -1
  78. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
  79. package/lib/flag-provider/hooks/useFlag.js +1 -1
  80. package/lib/icon/Icon.js +2 -2
  81. package/lib/locale/zh-CN.js +6 -0
  82. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
  83. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
  84. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
  85. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
  86. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
  87. package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
  88. package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
  89. package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
  90. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
  91. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
  92. package/lib/schema-component/antd/action/Action.Container.js +2 -2
  93. package/lib/schema-component/antd/action/Action.Modal.js +2 -2
  94. package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
  95. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
  96. package/lib/schema-component/antd/association-field/hooks.js +54 -0
  97. package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
  98. package/lib/schema-component/antd/date-picker/util.js +16 -0
  99. package/lib/schema-component/antd/form-tab/index.js +2 -2
  100. package/lib/schema-component/antd/form-v2/index.js +2 -2
  101. package/lib/schema-component/antd/input/Input.js +2 -1
  102. package/lib/schema-component/antd/input/ReadPretty.js +28 -0
  103. package/lib/schema-component/antd/markdown/Markdown.js +5 -5
  104. package/lib/schema-component/antd/page/Page.Settings.js +0 -33
  105. package/lib/schema-component/antd/page/Page.js +41 -90
  106. package/lib/schema-component/antd/page/hooks/index.js +5 -5
  107. package/lib/schema-component/antd/page/index.js +9 -0
  108. package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
  109. package/lib/schema-component/antd/page/style.js +2 -49
  110. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
  111. package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
  112. package/lib/schema-component/antd/select/ReadPretty.js +15 -2
  113. package/lib/schema-component/antd/select/Select.js +6 -1
  114. package/lib/schema-component/antd/table-v2/index.js +3 -3
  115. package/lib/schema-component/antd/upload/shared.js +4 -4
  116. package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
  117. package/lib/schema-settings/EditFormulaTitleField.js +19 -1
  118. package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
  119. package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
  120. package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
  121. package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
  122. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
  123. package/lib/user/ChangePassword.js +118 -5
  124. package/lib/user/index.js +24 -4
  125. package/lib/variables/VariablesProvider.js +2 -2
  126. package/lib/variables/hooks/useBuiltinVariables.js +7 -1
  127. package/package.json +10 -10
  128. package/es/application/components/SharePage.d.ts +0 -4
  129. package/es/application/components/SharePage.mjs +0 -113
  130. package/es/application/components/ShareSchemaComponent.d.ts +0 -1
  131. package/es/application/components/ShareSchemaComponent.mjs +0 -10
  132. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
  133. package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
  134. package/lib/application/components/SharePage.js +0 -156
  135. package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
@@ -2,16 +2,16 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useContext, useEffect, useMemo, useState } from "react";
3
3
  import { FormLayout } from "@tachybase/components";
4
4
  import { Schema, SchemaOptionsContext, useFieldSchema } from "@tachybase/schema";
5
- import { PlusOutlined, ShareAltOutlined } from "@ant-design/icons";
5
+ import { PlusOutlined } from "@ant-design/icons";
6
6
  import { PageHeader } from "@ant-design/pro-layout";
7
7
  import { PointerSensor, useSensor, useSensors } from "@dnd-kit/core";
8
- import { Button, Modal, Tabs } from "antd";
8
+ import { Button, Tabs } from "antd";
9
9
  import { cx } from "antd-style";
10
10
  import classnames from "classnames";
11
11
  import { ErrorBoundary } from "react-error-boundary";
12
12
  import { useTranslation } from "react-i18next";
13
- import { useMatch, useSearchParams } from "react-router-dom";
14
- import { FormDialog, ScrollArea } from "../index.mjs";
13
+ import { useSearchParams } from "react-router-dom";
14
+ import { FormDialog, PageExtendComponentProvider, ScrollArea } from "../index.mjs";
15
15
  import { useToken } from "../__builtins__/index.mjs";
16
16
  import { useStyles } from "../../../built-in/acl/style.mjs";
17
17
  import { useContextMenu } from "../../../built-in/context-menu/useContextMenu.mjs";
@@ -27,11 +27,10 @@ import { SchemaComponent, SchemaComponentOptions } from "../../core/index.mjs";
27
27
  import { useCompile, useDesignable } from "../../hooks/index.mjs";
28
28
  import { ErrorFallback } from "../error-fallback/index.mjs";
29
29
  import FixedBlock from "./FixedBlock.mjs";
30
- import { useShareActions } from "./hooks/useShareActions.mjs";
31
30
  import { useStyles as external_Page_style_mjs_useStyles } from "./Page.style.mjs";
32
31
  import { PageDesigner } from "./PageDesigner.mjs";
33
32
  import { PageTabDesigner } from "./PageTabDesigner.mjs";
34
- import { getStyles, useStyles as external_style_mjs_useStyles } from "./style.mjs";
33
+ import { getStyles } from "./style.mjs";
35
34
  const Page = (props)=>{
36
35
  var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
37
36
  const { children, ...others } = props;
@@ -89,29 +88,21 @@ const Page = (props)=>{
89
88
  }));
90
89
  };
91
90
  const Page_PageHeader = (props)=>{
92
- var _fieldSchema_xcomponentprops;
91
+ var _fieldSchema_xcomponentprops, _Object_values, _Object_values1;
93
92
  const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
94
93
  const { theme } = useGlobalTheme();
95
94
  const options = useContext(SchemaOptionsContext);
96
95
  const compile = useCompile();
97
- const [open, setOpen] = useState(false);
98
- const [imageOpen, setImageOpen] = useState(false);
99
96
  const { showScrollArea } = useContextMenu();
100
97
  const hidePageTitle = null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
98
+ const extendComponents = fieldSchema['x-extend-components'] || {};
101
99
  const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
102
- const isShare = useMatch('/share/:name');
103
100
  const items = fieldSchema.mapProperties((schema)=>({
104
101
  key: schema.name,
105
102
  label: /*#__PURE__*/ jsx(TabItem, {
106
103
  schema: schema
107
104
  })
108
105
  }));
109
- const { t } = useTranslation();
110
- const { styles } = external_style_mjs_useStyles();
111
- const { copyLink, imageAction } = useShareActions({
112
- title: pageHeaderTitle,
113
- uid: ''
114
- });
115
106
  return /*#__PURE__*/ jsxs("div", {
116
107
  ref: (ref)=>{
117
108
  setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
@@ -123,12 +114,29 @@ const Page_PageHeader = (props)=>{
123
114
  ghost: false,
124
115
  title: pageHeaderTitle || ' ',
125
116
  ...parentProps,
126
- extra: /*#__PURE__*/ jsx(HeaderExtra, {
127
- enablePageTabs: enablePageTabs,
128
- showScrollArea: showScrollArea,
129
- isShare: isShare,
130
- setOpen: setOpen,
131
- enableSharePage: enableSharePage
117
+ extra: /*#__PURE__*/ jsxs(Fragment, {
118
+ children: [
119
+ null == (_Object_values = Object.values(extendComponents)) ? void 0 : _Object_values.map((item, index)=>{
120
+ const schema = {
121
+ type: 'void',
122
+ name: item.name,
123
+ 'x-component': item.component,
124
+ 'x-component-props': {}
125
+ };
126
+ const componentProps = {
127
+ ...props,
128
+ isExtra: true,
129
+ fieldSchema
130
+ };
131
+ return /*#__PURE__*/ jsx(PageExtendComponentProvider, {
132
+ ...componentProps,
133
+ children: /*#__PURE__*/ jsx(SchemaComponent, {
134
+ schema: schema
135
+ })
136
+ });
137
+ }),
138
+ !enablePageTabs && showScrollArea && /*#__PURE__*/ jsx(ScrollArea, {})
139
+ ]
132
140
  }),
133
141
  footer: enablePageTabs && /*#__PURE__*/ jsx(TabComponent, {
134
142
  activeKey: activeKey,
@@ -140,84 +148,27 @@ const Page_PageHeader = (props)=>{
140
148
  items: items
141
149
  })
142
150
  }),
143
- disablePageHeader && enableSharePage && !isShare && /*#__PURE__*/ jsx("div", {
144
- className: "tb-page-header-button",
145
- children: /*#__PURE__*/ jsx(Button, {
146
- icon: /*#__PURE__*/ jsx(ShareAltOutlined, {}),
147
- onClick: ()=>{
148
- setOpen(true);
149
- },
150
- children: t('Share')
151
- })
152
- }),
153
- /*#__PURE__*/ jsxs(Modal, {
154
- open: open,
155
- className: styles.firstmodal,
156
- title: t('Share'),
157
- footer: null,
158
- width: 500,
159
- onCancel: ()=>{
160
- setOpen(false);
161
- },
162
- children: [
163
- /*#__PURE__*/ jsxs("div", {
164
- className: styles.secondmodal,
165
- children: [
166
- /*#__PURE__*/ jsxs("div", {
167
- className: "tb-header-modal-list",
168
- onClick: copyLink,
169
- children: [
170
- /*#__PURE__*/ jsx(Icon, {
171
- type: "PaperClipOutlined"
172
- }),
173
- t('Copy link')
174
- ]
175
- }),
176
- /*#__PURE__*/ jsxs("div", {
177
- className: "tb-header-modal-list",
178
- onClick: ()=>{
179
- setImageOpen(true);
180
- },
181
- children: [
182
- /*#__PURE__*/ jsx(Icon, {
183
- type: "QrcodeOutlined"
184
- }),
185
- t('Generate QR code')
186
- ]
187
- })
188
- ]
189
- }),
190
- /*#__PURE__*/ jsx(Modal, {
191
- className: styles.imageModal,
192
- open: imageOpen,
193
- footer: null,
194
- onCancel: ()=>{
195
- setImageOpen(false);
196
- },
197
- children: imageAction()
151
+ null == (_Object_values1 = Object.values(extendComponents)) ? void 0 : _Object_values1.map((item, index)=>{
152
+ const schema = {
153
+ type: 'void',
154
+ name: 'icon' + item.name,
155
+ 'x-component': item.component,
156
+ 'x-component-props': {}
157
+ };
158
+ const componentProps = {
159
+ ...props,
160
+ fieldSchema
161
+ };
162
+ return /*#__PURE__*/ jsx(PageExtendComponentProvider, {
163
+ ...componentProps,
164
+ children: /*#__PURE__*/ jsx(SchemaComponent, {
165
+ schema: schema
198
166
  })
199
- ]
167
+ });
200
168
  })
201
169
  ]
202
170
  });
203
171
  };
204
- const HeaderExtra = (param)=>{
205
- let { enablePageTabs, showScrollArea, isShare, setOpen, enableSharePage } = param;
206
- return /*#__PURE__*/ jsxs(Fragment, {
207
- children: [
208
- !isShare && /*#__PURE__*/ jsx(Button, {
209
- icon: /*#__PURE__*/ jsx(ShareAltOutlined, {}),
210
- onClick: ()=>{
211
- setOpen(true);
212
- },
213
- style: {
214
- visibility: "".concat(enableSharePage ? 'visible' : 'hidden')
215
- }
216
- }),
217
- !enablePageTabs && showScrollArea && /*#__PURE__*/ jsx(ScrollArea, {})
218
- ]
219
- });
220
- };
221
172
  const TabComponent = (props)=>{
222
173
  const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
223
174
  const { styles } = external_Page_style_mjs_useStyles();
@@ -1 +1 @@
1
- export * from './useShareActions';
1
+ export * from './useIsBlockInPage';
@@ -1 +1 @@
1
- export * from "./useShareActions.mjs";
1
+ export * from "./useIsBlockInPage.mjs";
@@ -4,3 +4,4 @@ export * from './PageTab.Settings';
4
4
  export * from './Page.Settings';
5
5
  export * from './FixedBlockDesignerItem';
6
6
  export * from './hooks';
7
+ export * from './pageExtendComponentProvider';
@@ -4,3 +4,4 @@ export * from "./PageTab.Settings.mjs";
4
4
  export * from "./Page.Settings.mjs";
5
5
  export * from "./FixedBlockDesignerItem.mjs";
6
6
  export * from "./hooks/index.mjs";
7
+ export * from "./pageExtendComponentProvider.mjs";
@@ -0,0 +1,3 @@
1
+ export declare const PageExtendComponentContext: import("react").Context<{}>;
2
+ export declare const PageExtendComponentProvider: (props: any) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const usePageExtendComponentContext: () => {};
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from "react";
3
+ const PageExtendComponentContext = /*#__PURE__*/ createContext({});
4
+ const PageExtendComponentProvider = (props)=>/*#__PURE__*/ jsx(PageExtendComponentContext.Provider, {
5
+ value: props,
6
+ children: props.children
7
+ });
8
+ const usePageExtendComponentContext = ()=>useContext(PageExtendComponentContext);
9
+ export { PageExtendComponentContext, PageExtendComponentProvider, usePageExtendComponentContext };
@@ -1,6 +1 @@
1
1
  export declare const getStyles: (props?: any) => import("./../__builtins__").UseComponentStyleResult;
2
- export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
3
- firstmodal: import("antd-style").SerializedStyles;
4
- secondmodal: import("antd-style").SerializedStyles;
5
- imageModal: import("antd-style").SerializedStyles;
6
- }>;
@@ -1,40 +1,4 @@
1
- import { createStyles } from "antd-style";
2
1
  import { genStyleHook } from "../__builtins__/index.mjs";
3
- function _tagged_template_literal(strings, raw) {
4
- if (!raw) raw = strings.slice(0);
5
- return Object.freeze(Object.defineProperties(strings, {
6
- raw: {
7
- value: Object.freeze(raw)
8
- }
9
- }));
10
- }
11
- function _templateObject() {
12
- const data = _tagged_template_literal([
13
- "\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 "
14
- ]);
15
- _templateObject = function() {
16
- return data;
17
- };
18
- return data;
19
- }
20
- function _templateObject1() {
21
- const data = _tagged_template_literal([
22
- "\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 "
23
- ]);
24
- _templateObject1 = function() {
25
- return data;
26
- };
27
- return data;
28
- }
29
- function _templateObject2() {
30
- const data = _tagged_template_literal([
31
- "\n display: flex;\n justify-content: center;\n .ant-modal-content {\n width: 280px;\n height: 360px;\n }\n "
32
- ]);
33
- _templateObject2 = function() {
34
- return data;
35
- };
36
- return data;
37
- }
38
2
  const getStyles = genStyleHook('tb-page', (token)=>{
39
3
  const { componentCls } = token;
40
4
  return {
@@ -179,12 +143,4 @@ const getStyles = genStyleHook('tb-page', (token)=>{
179
143
  }
180
144
  };
181
145
  });
182
- const useStyles = createStyles((param)=>{
183
- let { css, token } = param;
184
- return {
185
- firstmodal: css(_templateObject()),
186
- secondmodal: css(_templateObject1()),
187
- imageModal: css(_templateObject2())
188
- };
189
- });
190
- export { getStyles, useStyles };
146
+ export { getStyles };
@@ -1 +1 @@
1
- export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
1
+ export declare const getStrength: (val: any) => 0 | 20 | 100 | 60 | 40 | 80;
@@ -103,6 +103,7 @@ const useLabelOptions = (others)=>{
103
103
  const collectionField = useMemo(()=>getField(fieldSchema['x-collection-field']), [
104
104
  fieldSchema['x-collection-field']
105
105
  ]);
106
+ if (!(null == collectionField ? void 0 : collectionField.target) && !fieldSchema['collectionName']) return others;
106
107
  const request = {
107
108
  resource: (null == collectionField ? void 0 : collectionField.target) || fieldSchema['collectionName'],
108
109
  action: 'list',
@@ -151,16 +152,18 @@ const useLabelOptions = (others)=>{
151
152
  }
152
153
  return others;
153
154
  };
154
- const FormulaSelect_FormulaSelect = (props)=>{
155
+ const FormulaSelect = (props)=>{
155
156
  const { objectValue, loading, value, rawOptions, defaultValue, ...others } = props;
156
157
  let mode = props.multiple ? 'multiple' : props.mode;
157
158
  const filterField = null == others ? void 0 : others['params'];
158
159
  const [options, setOptions] = useState([]);
159
160
  const [collectionName, setCollectionName] = useState('');
161
+ const fieldSchema = useFieldSchema();
160
162
  const api = useAPIClient();
161
163
  if (mode && ![
162
164
  'multiple',
163
- 'tags'
165
+ 'tags',
166
+ 'CustomTitle'
164
167
  ].includes(mode)) mode = void 0;
165
168
  const fieldProps = {
166
169
  ...others
@@ -182,6 +185,7 @@ const FormulaSelect_FormulaSelect = (props)=>{
182
185
  } else if ((null == others ? void 0 : others.collection) === collectionName) fieldProps['options'] = options.map((option)=>({
183
186
  ...option
184
187
  }));
188
+ else fieldProps['options'] = getFormulaValue(props.fieldNames['formula'], (null == props ? void 0 : props.options) || [], fieldSchema);
185
189
  const modifiedProps = useLabelOptions(fieldProps);
186
190
  return /*#__PURE__*/ jsx(ObjectSelect, {
187
191
  rawOptions: rawOptions,
@@ -192,5 +196,13 @@ const FormulaSelect_FormulaSelect = (props)=>{
192
196
  loading: loading
193
197
  });
194
198
  };
195
- const FormulaSelect = FormulaSelect_FormulaSelect;
196
- export { FormulaSelect as default };
199
+ const select_FormulaSelect = FormulaSelect;
200
+ const getFormulaValue = (template, options, fieldSchema)=>options.map((item)=>{
201
+ const label = item.label;
202
+ const customLabel = template.replace(new RegExp("{{".concat(fieldSchema['name'], "}}"), 'g'), label);
203
+ return {
204
+ ...item,
205
+ label: customLabel
206
+ };
207
+ });
208
+ export { select_FormulaSelect as default };
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
- import { isArrayField, isValid, observer, useField } from "@tachybase/schema";
3
+ import { isArrayField, isValid, observer, useField, useFieldSchema } from "@tachybase/schema";
4
4
  import { Tag } from "antd";
5
5
  import { useCollectionField } from "../../../data-source/collection-field/CollectionFieldProvider.mjs";
6
6
  import { EllipsisWithTooltip } from "../input/EllipsisWithTooltip.mjs";
7
7
  import { defaultFieldNames, getCurrentOptions } from "./utils.mjs";
8
8
  const ReadPretty = observer((props)=>{
9
- var _field_value;
9
+ var _field_value, _fieldSchema_xcomponentprops_fieldNames;
10
10
  const fieldNames = {
11
11
  ...defaultFieldNames,
12
12
  ...props.fieldNames
@@ -15,8 +15,10 @@ const ReadPretty = observer((props)=>{
15
15
  if (!isValid(props.value)) return /*#__PURE__*/ jsx("div", {});
16
16
  if (isArrayField(field) && (null == field ? void 0 : null == (_field_value = field.value) ? void 0 : _field_value.length) === 0) return /*#__PURE__*/ jsx("div", {});
17
17
  const collectionField = useCollectionField();
18
+ const fieldSchema = useFieldSchema();
18
19
  const dataSource = field.dataSource || props.options || (null == collectionField ? void 0 : collectionField.uiSchema.enum) || [];
19
- const currentOptions = getCurrentOptions(field.value, dataSource, fieldNames);
20
+ const options = getCurrentOptions(field.value, dataSource, fieldNames);
21
+ const currentOptions = getFormulaValue(null == (_fieldSchema_xcomponentprops_fieldNames = fieldSchema['x-component-props'].fieldNames) ? void 0 : _fieldSchema_xcomponentprops_fieldNames['formula'], options, fieldSchema);
20
22
  return /*#__PURE__*/ jsx("div", {
21
23
  children: /*#__PURE__*/ jsx(EllipsisWithTooltip, {
22
24
  ellipsis: props.ellipsis,
@@ -30,4 +32,15 @@ const ReadPretty = observer((props)=>{
30
32
  }, {
31
33
  displayName: 'ReadPretty'
32
34
  });
35
+ const getFormulaValue = (template, options, fieldSchema)=>{
36
+ if (!template) return options;
37
+ return options.map((item)=>{
38
+ const label = item.label;
39
+ const customLabel = template.replace(new RegExp("{{".concat(fieldSchema['name'], "}}"), 'g'), label);
40
+ return {
41
+ ...item,
42
+ label: customLabel
43
+ };
44
+ });
45
+ };
33
46
  export { ReadPretty };
@@ -81,8 +81,12 @@ const InternalSelect = connect((props)=>{
81
81
  let mode = props.multiple ? 'multiple' : props.mode;
82
82
  if (mode && ![
83
83
  'multiple',
84
- 'tags'
84
+ 'tags',
85
+ 'CustomTitle'
85
86
  ].includes(mode)) mode = void 0;
87
+ let options = props.options ? [
88
+ ...props.options
89
+ ] : [];
86
90
  if ([
87
91
  'CustomTitle'
88
92
  ].includes(props.mode) && ('formula' in others.fieldNames || 'collection' in props)) return /*#__PURE__*/ jsx(FormulaSelect, {
@@ -117,6 +121,7 @@ const InternalSelect = connect((props)=>{
117
121
  "aria-label": "icon-close-select"
118
122
  })
119
123
  },
124
+ options: options,
120
125
  popupMatchSelectWidth: false,
121
126
  notFoundContent: loading ? /*#__PURE__*/ jsx(Spin, {}) : /*#__PURE__*/ jsx(Empty, {
122
127
  image: Empty.PRESENTED_IMAGE_SIMPLE
@@ -2,8 +2,10 @@ import { useMemo } from "react";
2
2
  import { useField, useFieldSchema, useForm } from "@tachybase/schema";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useCollectionManager_deprecated, useCollection_deprecated } from "../../collection-manager/index.mjs";
5
+ import { useDataSourceManager } from "../../data-source/index.mjs";
6
+ import { useCompile } from "./useCompile.mjs";
5
7
  const useFieldModeOptions = (props)=>{
6
- var _fieldSchema_xcomponentprops;
8
+ var _fieldSchema_xcomponentprops, _collectionInterface_componentOptions_filter, _collectionInterface_componentOptions;
7
9
  const { t } = useTranslation();
8
10
  const { getCollectionJoinField, getCollection } = useCollectionManager_deprecated();
9
11
  const currentFieldSchema = useFieldSchema();
@@ -11,12 +13,15 @@ const useFieldModeOptions = (props)=>{
11
13
  const field = useField();
12
14
  const form = useForm();
13
15
  const isReadPretty = (null == fieldSchema ? void 0 : fieldSchema['x-read-pretty']) || field.readPretty || form.readPretty;
16
+ const dm = useDataSourceManager();
14
17
  const isTableField = null == props ? void 0 : props.fieldSchema;
15
18
  const { getField } = useCollection_deprecated();
16
19
  const collectionField = (null == props ? void 0 : props.collectionField) || getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
20
+ const collectionInterface = dm.collectionFieldInterfaceManager.getFieldInterface(null == collectionField ? void 0 : collectionField.interface);
17
21
  const { label } = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.fieldNames) || {};
22
+ const compile = useCompile();
18
23
  const fieldModeOptions = useMemo(()=>{
19
- if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return;
24
+ if (!collectionField || !(null == collectionField ? void 0 : collectionField.interface)) return [];
20
25
  if (![
21
26
  'o2o',
22
27
  'oho',
@@ -206,10 +211,6 @@ const useFieldModeOptions = (props)=>{
206
211
  label: t('Tag'),
207
212
  value: 'Tag'
208
213
  },
209
- {
210
- label: t('Custom Title'),
211
- value: 'CustomTitle'
212
- },
213
214
  !isTableField && {
214
215
  label: t('Sub-details'),
215
216
  value: 'Nester'
@@ -238,10 +239,6 @@ const useFieldModeOptions = (props)=>{
238
239
  {
239
240
  label: t('Cascader'),
240
241
  value: 'Cascader'
241
- },
242
- {
243
- label: t('Custom Title'),
244
- value: 'CustomTitle'
245
242
  }
246
243
  ];
247
244
  default:
@@ -286,6 +283,12 @@ const useFieldModeOptions = (props)=>{
286
283
  null == collectionField ? void 0 : collectionField.interface,
287
284
  label
288
285
  ]);
286
+ null == collectionInterface || null == (_collectionInterface_componentOptions = collectionInterface.componentOptions) || null == (_collectionInterface_componentOptions_filter = _collectionInterface_componentOptions.filter((item)=>!item.useVisible || item.useVisible())) || _collectionInterface_componentOptions_filter.forEach((item)=>{
287
+ if (!(null == fieldModeOptions ? void 0 : fieldModeOptions.find((modeItem)=>modeItem.value === item.value))) null == fieldModeOptions || fieldModeOptions.push({
288
+ label: compile(item.label),
289
+ value: item.value
290
+ });
291
+ });
289
292
  return (fieldModeOptions || []).filter(Boolean);
290
293
  };
291
294
  export { useFieldModeOptions };
@@ -15,6 +15,12 @@ function useFormulaTitleOptions() {
15
15
  const collectionManage = useCollectionManager_deprecated();
16
16
  const collectionManageField = collectionManage.collections.filter((value)=>value.name === fieldSchema['x-decorator-props'])[0];
17
17
  const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
18
+ const isAssociationField = collectionField && [
19
+ 'hasOne',
20
+ 'hasMany',
21
+ 'belongsTo',
22
+ 'belongsToMany'
23
+ ].includes(collectionField.type);
18
24
  let fields = [];
19
25
  if (collectionField) fields = getCollectionFields(collectionField ? collectionField.target ? collectionField.target : collectionField.collectionName : fieldSchema['name']);
20
26
  else if (collectionManageField) fields = collectionManageField['fields'];
@@ -23,7 +29,7 @@ function useFormulaTitleOptions() {
23
29
  if (![
24
30
  'm2m',
25
31
  'o2m'
26
- ].includes(field.interface)) {
32
+ ].includes(field.interface) && isAssociationField) {
27
33
  if (field.uiSchema) {
28
34
  var _getCollectionFields;
29
35
  var _getCollectionFields_filter_map;
@@ -37,6 +43,18 @@ function useFormulaTitleOptions() {
37
43
  });
38
44
  }
39
45
  }
46
+ if (!isAssociationField && field.name === fieldSchema['name']) {
47
+ var _getCollectionFields1;
48
+ var _getCollectionFields_filter_map1;
49
+ options.push({
50
+ label: compile(field.uiSchema.title),
51
+ value: field.name,
52
+ children: null != (_getCollectionFields_filter_map1 = null == (_getCollectionFields1 = getCollectionFields(field.target)) ? void 0 : _getCollectionFields1.filter((subField)=>subField.uiSchema).map((subField)=>({
53
+ label: subField.uiSchema ? compile(subField.uiSchema.title) : '',
54
+ value: subField.name
55
+ }))) ? _getCollectionFields_filter_map1 : []
56
+ });
57
+ }
40
58
  });
41
59
  return options;
42
60
  }
@@ -88,6 +88,7 @@ const SchemaSettingsDefaultValue = function(props) {
88
88
  isInSubForm: isInSubForm,
89
89
  isInSubTable: isInSubTable,
90
90
  isInSetDefaultValueDialog: true,
91
+ collectionField: collectionField,
91
92
  children: /*#__PURE__*/ jsx(VariableInput, {
92
93
  ...props
93
94
  })
@@ -104,7 +105,7 @@ const SchemaSettingsDefaultValue = function(props) {
104
105
  'x-decorator': 'FormItem',
105
106
  'x-component': 'VariableInput',
106
107
  'x-component-props': {
107
- ...(null == fieldSchema ? void 0 : fieldSchema['x-component-props']) || {},
108
+ ...null == fieldSchema ? void 0 : fieldSchema['x-component-props'],
108
109
  collectionField,
109
110
  contextCollectionName: isAllowContextVariable && tableCtx.collection,
110
111
  schema: null == collectionField ? void 0 : collectionField.uiSchema,
@@ -133,7 +134,7 @@ const SchemaSettingsDefaultValue = function(props) {
133
134
  s.type = 'void';
134
135
  }
135
136
  const schema = {
136
- ...s || {},
137
+ ...s,
137
138
  'x-decorator': 'FormItem',
138
139
  'x-component-props': {
139
140
  ...s['x-component-props'],
@@ -43,6 +43,8 @@ import { fileManagerComponentFieldSettings } from "../modules/fields/component/F
43
43
  import { uploadAttachmentComponentFieldSettings } from "../modules/fields/component/FileManager/uploadAttachmentComponentFieldSettings.mjs";
44
44
  import { inputComponentFieldSettings } from "../modules/fields/component/Input/inputComponentFieldsSettings.mjs";
45
45
  import { inputNumberComponentFieldSettings } from "../modules/fields/component/InputNumber/inputNumberComponentFieldSettings.mjs";
46
+ import { inputPreviewComponentFieldSettings } from "../modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs";
47
+ import { multipleComponentFieldSettings } from "../modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs";
46
48
  import { subformComponentFieldSettings } from "../modules/fields/component/Nester/subformComponentFieldSettings.mjs";
47
49
  import { recordPickerComponentFieldSettings } from "../modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs";
48
50
  import { subformPopoverComponentFieldSettings } from "../modules/fields/component/PopoverNester/subformPopoverComponentFieldSettings.mjs";
@@ -100,6 +102,7 @@ class SchemaSettingsPlugin extends Plugin {
100
102
  this.schemaSettingsManager.add(datePickerComponentFieldSettings);
101
103
  this.schemaSettingsManager.add(unixTimestampComponentFieldSettings);
102
104
  this.schemaSettingsManager.add(inputComponentFieldSettings);
105
+ this.schemaSettingsManager.add(inputPreviewComponentFieldSettings);
103
106
  this.schemaSettingsManager.add(inputNumberComponentFieldSettings);
104
107
  this.schemaSettingsManager.add(checkboxComponentFieldSettings);
105
108
  this.schemaSettingsManager.add(radioComponentFieldSettings);
@@ -109,6 +112,7 @@ class SchemaSettingsPlugin extends Plugin {
109
112
  this.schemaSettingsManager.add(cascadeSelectComponentFieldSettings);
110
113
  this.schemaSettingsManager.add(uploadAttachmentComponentFieldSettings);
111
114
  this.schemaSettingsManager.add(cascaderComponentFieldSettings);
115
+ this.schemaSettingsManager.add(multipleComponentFieldSettings);
112
116
  }
113
117
  }
114
118
  export { SchemaSettingsPlugin };
@@ -1,3 +1,4 @@
1
1
  export * from './useBaseVariable';
2
2
  export * from './useDateVariable';
3
3
  export * from './useUserVariable';
4
+ export * from './useExactDateVariable';
@@ -1,3 +1,4 @@
1
1
  export * from "./useBaseVariable.mjs";
2
2
  export * from "./useDateVariable.mjs";
3
3
  export * from "./useUserVariable.mjs";
4
+ export * from "./useExactDateVariable.mjs";