@tachybase/client 1.3.19 → 1.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/application/Application.mjs +1 -9
- package/es/application/components/index.d.ts +0 -2
- package/es/application/components/index.mjs +0 -2
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/application/utils/globalDeps.mjs +1 -1
- package/es/block-provider/hooks/index.mjs +1 -1
- package/es/built-in/index.d.ts +2 -1
- package/es/built-in/index.mjs +3 -2
- package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
- package/es/collection-manager/collectionPlugin.mjs +36 -0
- package/es/collection-manager/interfaces/url.d.ts +4 -0
- package/es/collection-manager/interfaces/url.mjs +10 -1
- package/es/collection-manager/templates/sql.d.ts +3 -3
- package/es/collection-manager/templates/view.d.ts +3 -3
- package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
- package/es/flag-provider/FlagProvider.d.ts +1 -0
- package/es/flag-provider/hooks/useFlag.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
- package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
- package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
- package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
- package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
- package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
- package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
- package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
- package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
- package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
- package/es/schema-component/antd/association-field/hooks.mjs +52 -1
- package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
- package/es/schema-component/antd/date-picker/util.d.ts +13 -0
- package/es/schema-component/antd/date-picker/util.mjs +14 -1
- package/es/schema-component/antd/input/Input.mjs +2 -1
- package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
- package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
- package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
- package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
- package/es/schema-component/antd/page/Page.mjs +46 -95
- package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
- package/es/schema-component/antd/page/hooks/index.mjs +1 -1
- package/es/schema-component/antd/page/index.d.ts +1 -0
- package/es/schema-component/antd/page/index.mjs +1 -0
- package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
- package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
- package/es/schema-component/antd/page/style.d.ts +0 -5
- package/es/schema-component/antd/page/style.mjs +1 -45
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
- package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
- package/es/schema-component/antd/select/Select.mjs +6 -1
- package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
- package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
- package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
- package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
- package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
- package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
- package/es/user/ChangePassword.mjs +109 -6
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +2 -0
- package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
- package/lib/application/Application.js +0 -8
- package/lib/application/components/index.js +0 -18
- package/lib/block-provider/hooks/index.js +5 -5
- package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
- package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
- package/lib/built-in/index.js +30 -4
- package/lib/built-in/pm/index.js +1 -1
- package/lib/collection-manager/Configuration/components/Summary.js +3 -3
- package/lib/collection-manager/collectionPlugin.js +36 -0
- package/lib/collection-manager/index.js +17 -17
- package/lib/collection-manager/interfaces/url.js +10 -1
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
- package/lib/flag-provider/hooks/useFlag.js +1 -1
- package/lib/icon/Icon.js +2 -2
- package/lib/locale/zh-CN.js +6 -0
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
- package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
- package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
- package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
- package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
- package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
- package/lib/schema-component/antd/action/Action.Container.js +2 -2
- package/lib/schema-component/antd/action/Action.Modal.js +2 -2
- package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
- package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
- package/lib/schema-component/antd/association-field/hooks.js +54 -0
- package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
- package/lib/schema-component/antd/date-picker/util.js +16 -0
- package/lib/schema-component/antd/form-tab/index.js +2 -2
- package/lib/schema-component/antd/form-v2/index.js +2 -2
- package/lib/schema-component/antd/input/Input.js +2 -1
- package/lib/schema-component/antd/input/ReadPretty.js +28 -0
- package/lib/schema-component/antd/markdown/Markdown.js +5 -5
- package/lib/schema-component/antd/page/Page.Settings.js +0 -33
- package/lib/schema-component/antd/page/Page.js +41 -90
- package/lib/schema-component/antd/page/hooks/index.js +5 -5
- package/lib/schema-component/antd/page/index.js +9 -0
- package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
- package/lib/schema-component/antd/page/style.js +2 -49
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
- package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
- package/lib/schema-component/antd/select/ReadPretty.js +15 -2
- package/lib/schema-component/antd/select/Select.js +6 -1
- package/lib/schema-component/antd/table-v2/index.js +3 -3
- package/lib/schema-component/antd/upload/shared.js +4 -4
- package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
- package/lib/schema-settings/EditFormulaTitleField.js +19 -1
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
- package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
- package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
- package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
- package/lib/user/ChangePassword.js +118 -5
- package/lib/user/index.js +24 -4
- package/lib/variables/VariablesProvider.js +2 -2
- package/lib/variables/hooks/useBuiltinVariables.js +7 -1
- package/package.json +10 -10
- package/es/application/components/SharePage.d.ts +0 -4
- package/es/application/components/SharePage.mjs +0 -113
- package/es/application/components/ShareSchemaComponent.d.ts +0 -1
- package/es/application/components/ShareSchemaComponent.mjs +0 -10
- package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
- package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
- package/lib/application/components/SharePage.js +0 -156
- package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
|
@@ -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
|
|
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,
|
|
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 {
|
|
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
|
|
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__*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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 './
|
|
1
|
+
export * from './useIsBlockInPage';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./useIsBlockInPage.mjs";
|
|
@@ -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
|
-
|
|
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 |
|
|
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
|
|
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
|
|
196
|
-
|
|
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
|
|
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
|
-
...
|
|
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 };
|