@tachybase/client 0.23.48 → 1.0.6
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/api-client/APIClient.d.ts +5 -2
- package/es/api-client/APIClient.mjs +93 -49
- package/es/api-client/hooks/useRequest.d.ts +2 -0
- package/es/application/Application.d.ts +6 -0
- package/es/application/Application.mjs +19 -0
- package/es/application/CustomRouterContextProvider.d.ts +54 -0
- package/es/application/CustomRouterContextProvider.mjs +209 -0
- package/es/application/RouterManager.d.ts +8 -3
- package/es/application/RouterManager.mjs +48 -15
- package/es/application/hooks/index.d.ts +1 -0
- package/es/application/hooks/index.mjs +1 -0
- package/es/application/hooks/useGlobalVariable.d.ts +1 -0
- package/es/application/hooks/useGlobalVariable.mjs +18 -0
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.d.ts +1 -1
- package/es/application/schema-settings/hooks/index.mjs +6 -8
- package/es/block-provider/hooks/index.d.ts +2 -0
- package/es/block-provider/hooks/index.mjs +29 -22
- package/es/built-in/context-menu/ContextMenu.provider.mjs +6 -6
- package/es/built-in/context-menu/ContextMenuItemsProps.d.ts +4 -4
- package/es/built-in/context-menu/ContextMenuItemsProps.mjs +6 -6
- package/es/built-in/context-menu/index.mjs +1 -1
- package/es/built-in/context-menu/useContextMenu.d.ts +2 -2
- package/es/built-in/index.mjs +8 -0
- package/es/built-in/locale/LocalePlugin.mjs +5 -1
- package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
- package/es/built-in/system-settings/SystemSettingsProvider.d.ts +2 -3
- package/es/built-in/system-settings/SystemSettingsProvider.mjs +4 -3
- package/es/built-in/system-settings/SystemSettingsShortcut.mjs +11 -8
- package/es/collection-manager/Configuration/AddCollectionAction.mjs +12 -2
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.d.ts +2 -0
- package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.mjs +255 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.d.ts +89 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.mjs +96 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.mjs +47 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.d.ts +3 -0
- package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.mjs +44 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +380 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.d.ts +8 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.mjs +4 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.mjs +187 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.d.ts +1 -0
- package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.mjs +30 -0
- package/es/collection-manager/collectionPlugin.mjs +3 -1
- package/es/collection-manager/templates/import.mjs +1 -1
- package/es/collection-manager/templates/sql.d.ts +1 -1
- package/es/collection-manager/templates/view.d.ts +1 -1
- package/es/collection-manager/templates/xlsx.d.ts +11 -0
- package/es/collection-manager/templates/xlsx.mjs +19 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +18 -0
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.d.ts +8 -1
- package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.mjs +20 -0
- package/es/data-source/commonsSettingsItem/fieldComponent.mjs +3 -1
- package/es/data-source/data-source/DataSource.d.ts +1 -1
- package/es/filter-provider/utils.mjs +6 -0
- package/es/i18n/i18n.mjs +7 -12
- package/es/modules/actions/delete/deleteActionSettings.mjs +10 -0
- package/es/modules/blocks/data-blocks/form/FilterItemCustomSettings.mjs +1 -1
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +9 -4
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +6 -4
- package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +4 -0
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +44 -0
- package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +4 -0
- package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +9 -0
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
- package/es/modules/fields/component/SubTable/secondLevelSelect.d.ts +11 -0
- package/es/modules/fields/component/SubTable/secondLevelSelect.mjs +102 -0
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +79 -41
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +103 -100
- package/es/powered-by/index.mjs +4 -7
- package/es/schema-component/antd/action/Action.Designer.mjs +43 -5
- package/es/schema-component/antd/action/Action.Modal.mjs +19 -31
- package/es/schema-component/antd/action/Action.Modal.style.d.ts +4 -0
- package/es/schema-component/antd/action/Action.Modal.style.mjs +35 -0
- package/es/schema-component/antd/action/Action.mjs +1 -3
- package/es/schema-component/antd/action/utils.d.ts +1 -1
- package/es/schema-component/antd/action/utils.mjs +70 -70
- package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
- package/es/schema-component/antd/checkbox/Checkbox.mjs +9 -2
- package/es/schema-component/antd/index.d.ts +1 -0
- package/es/schema-component/antd/index.mjs +1 -0
- package/es/schema-component/antd/media-card/MediaCard.d.ts +11 -0
- package/es/schema-component/antd/media-card/MediaCard.mjs +35 -0
- package/es/schema-component/antd/media-card/index.d.ts +1 -0
- package/es/schema-component/antd/media-card/index.mjs +1 -0
- package/es/schema-component/antd/media-card/style.d.ts +3 -0
- package/es/schema-component/antd/media-card/style.mjs +25 -0
- package/es/schema-component/antd/page/Page.d.ts +1 -5
- package/es/schema-component/antd/page/Page.mjs +235 -144
- package/es/schema-component/antd/page/Page.style.d.ts +5 -0
- package/es/schema-component/antd/page/Page.style.mjs +45 -0
- package/es/schema-component/antd/page/PageDesigner.d.ts +3 -0
- package/es/schema-component/antd/page/PageDesigner.mjs +28 -0
- package/es/schema-component/antd/page/PageTabDesigner.d.ts +0 -3
- package/es/schema-component/antd/page/PageTabDesigner.mjs +3 -50
- package/es/schema-component/antd/page/style.d.ts +1 -1
- package/es/schema-component/antd/page/style.mjs +3 -13
- package/es/schema-component/antd/password/Password.d.ts +1 -1
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.d.ts +1 -1
- package/es/schema-component/antd/scroll-area/ScrollArea.mjs +2 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.d.ts +13 -0
- package/es/schema-component/antd/variable/TextAreaWithGlobalScope.mjs +59 -0
- package/es/schema-component/antd/variable/index.d.ts +1 -0
- package/es/schema-component/antd/variable/index.mjs +3 -0
- package/es/schema-component/common/dnd-context/index.mjs +1 -7
- package/es/schema-component/common/sortable-item/DragHandlePageTab.d.ts +1 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +71 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.d.ts +3 -0
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +25 -0
- package/es/schema-items/GeneralSettings.mjs +5 -0
- package/es/schema-settings/EditCustomDefaultValue.mjs +1 -1
- package/es/schema-settings/SchemaSettings.mjs +1 -1
- package/es/schema-settings/SchemaSettingsDefaultValue.mjs +2 -0
- package/es/schema-settings/utils/createModalSettingsItem.d.ts +26 -0
- package/es/schema-settings/utils/createModalSettingsItem.mjs +46 -0
- package/es/schema-settings/utils/createSelectSettingsItem.d.ts +25 -0
- package/es/schema-settings/utils/createSelectSettingsItem.mjs +40 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.d.ts +21 -0
- package/es/schema-settings/utils/createSwitchSettingsItem.mjs +38 -0
- package/es/schema-settings/utils/createTextSettingsItem.d.ts +9 -0
- package/es/schema-settings/utils/createTextSettingsItem.mjs +21 -0
- package/es/schema-settings/utils/index.d.ts +4 -0
- package/es/schema-settings/utils/index.mjs +4 -0
- package/es/schema-settings/utils/util.d.ts +12 -0
- package/es/schema-settings/utils/util.mjs +24 -0
- package/es/user/CurrentUserProvider.mjs +6 -3
- package/lib/api-client/APIClient.js +93 -49
- package/lib/application/Application.js +19 -0
- package/lib/application/CustomRouterContextProvider.js +276 -0
- package/lib/application/RouterManager.js +49 -15
- package/lib/application/hooks/index.js +9 -0
- package/lib/application/hooks/useGlobalVariable.js +52 -0
- package/lib/application/schema-initializer/hooks/index.js +2 -2
- package/lib/application/schema-settings/hooks/index.js +6 -8
- package/lib/block-provider/hooks/index.js +80 -59
- package/lib/built-in/context-menu/ContextMenu.provider.js +6 -6
- package/lib/built-in/context-menu/ContextMenuItemsProps.js +6 -6
- package/lib/built-in/context-menu/index.js +1 -1
- package/lib/built-in/index.js +8 -0
- package/lib/built-in/locale/LocalePlugin.js +5 -1
- package/lib/built-in/page-style/PageStyle.provider.js +2 -2
- package/lib/built-in/system-settings/SystemSettingsProvider.js +4 -3
- package/lib/built-in/system-settings/SystemSettingsShortcut.js +11 -8
- package/lib/collection-manager/Configuration/AddCollectionAction.js +12 -2
- package/lib/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.js +304 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.js +130 -0
- package/lib/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.js +81 -0
- package/lib/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.js +78 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +414 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.js +53 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxImportAction.js +235 -0
- package/lib/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.js +64 -0
- package/lib/collection-manager/collectionPlugin.js +3 -1
- package/lib/collection-manager/templates/import.js +1 -1
- package/lib/collection-manager/templates/xlsx.js +53 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +18 -0
- package/lib/data-source/collection-field-interface/CollectionFieldInterfaceManager.js +20 -0
- package/lib/data-source/commonsSettingsItem/fieldComponent.js +3 -1
- package/lib/filter-provider/utils.js +6 -0
- package/lib/i18n/i18n.js +7 -12
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/zh-CN.js +14 -2
- package/lib/modules/actions/delete/deleteActionSettings.js +10 -0
- package/lib/modules/blocks/data-blocks/form/FilterItemCustomSettings.js +1 -1
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +9 -4
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +6 -4
- package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +4 -0
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +44 -0
- package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +4 -0
- package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +9 -0
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
- package/lib/modules/fields/component/SubTable/secondLevelSelect.js +136 -0
- package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +104 -103
- package/lib/powered-by/index.js +4 -7
- package/lib/schema-component/antd/action/Action.Designer.js +43 -5
- package/lib/schema-component/antd/action/Action.Modal.js +19 -31
- package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
- package/lib/schema-component/antd/action/Action.js +1 -3
- package/lib/schema-component/antd/action/utils.js +70 -70
- package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
- package/lib/schema-component/antd/checkbox/Checkbox.js +9 -2
- package/lib/schema-component/antd/index.js +18 -4
- package/lib/schema-component/antd/media-card/MediaCard.js +69 -0
- package/lib/schema-component/antd/media-card/index.js +65 -0
- package/lib/schema-component/antd/media-card/style.js +59 -0
- package/lib/schema-component/antd/page/Page.js +235 -144
- package/lib/schema-component/antd/page/Page.style.js +79 -0
- package/lib/schema-component/antd/page/PageDesigner.js +62 -0
- package/lib/schema-component/antd/page/PageTabDesigner.js +2 -50
- package/lib/schema-component/antd/page/style.js +3 -13
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/antd/variable/TextAreaWithGlobalScope.js +94 -0
- package/lib/schema-component/antd/variable/index.js +13 -1
- package/lib/schema-component/common/dnd-context/index.js +1 -7
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +105 -0
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +59 -0
- package/lib/schema-items/GeneralSettings.js +5 -0
- package/lib/schema-settings/EditCustomDefaultValue.js +1 -1
- package/lib/schema-settings/SchemaSettings.js +1 -1
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +2 -0
- package/lib/schema-settings/utils/createModalSettingsItem.js +94 -0
- package/lib/schema-settings/utils/createSelectSettingsItem.js +88 -0
- package/lib/schema-settings/utils/createSwitchSettingsItem.js +86 -0
- package/lib/schema-settings/utils/createTextSettingsItem.js +55 -0
- package/lib/schema-settings/utils/index.js +92 -0
- package/lib/schema-settings/utils/util.js +74 -0
- package/lib/user/CurrentUserProvider.js +6 -3
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__ from "../__builtins__/index.mjs";
|
|
2
|
-
const
|
|
2
|
+
const getStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHook)('tb-page', (token)=>{
|
|
3
3
|
const { componentCls } = token;
|
|
4
4
|
return {
|
|
5
5
|
[componentCls]: {
|
|
@@ -46,8 +46,7 @@ const useStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHo
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
'.tb-page-header-wrapper': {
|
|
49
|
-
zIndex: 10
|
|
50
|
-
boxShadow: '1px 1px 10px 1px rgba(0, 0, 0, 0.1)'
|
|
49
|
+
zIndex: 10
|
|
51
50
|
},
|
|
52
51
|
'.pageHeaderCss': {
|
|
53
52
|
backgroundColor: token.colorBgContainer,
|
|
@@ -71,10 +70,6 @@ const useStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHo
|
|
|
71
70
|
fontSize: 0,
|
|
72
71
|
height: 0
|
|
73
72
|
},
|
|
74
|
-
'.addTabBtn': {
|
|
75
|
-
borderColor: 'var(--colorSettings)',
|
|
76
|
-
color: 'var(--colorSettings)'
|
|
77
|
-
},
|
|
78
73
|
'.designerCss': {
|
|
79
74
|
position: 'relative',
|
|
80
75
|
'&:hover': {
|
|
@@ -131,13 +126,8 @@ const useStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHo
|
|
|
131
126
|
paddingBottom: 0,
|
|
132
127
|
overflowX: 'hidden',
|
|
133
128
|
overflowY: 'scroll'
|
|
134
|
-
},
|
|
135
|
-
'.tb-tabs-wrapper': {
|
|
136
|
-
display: 'flex',
|
|
137
|
-
flexDirection: 'row',
|
|
138
|
-
justifyContent: 'flex-end'
|
|
139
129
|
}
|
|
140
130
|
}
|
|
141
131
|
};
|
|
142
132
|
});
|
|
143
|
-
export {
|
|
133
|
+
export { getStyles };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PasswordProps } from 'antd/es/input';
|
|
3
3
|
export interface IPasswordProps extends PasswordProps {
|
|
4
|
-
checkStrength
|
|
4
|
+
checkStrength?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const Password: React.ForwardRefExoticComponent<IPasswordProps & React.RefAttributes<never>>;
|
|
7
7
|
export default Password;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getStrength: (val: any) => 0 |
|
|
1
|
+
export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ScrollArea: () => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export declare const ScrollArea: (props: any) => import("react/jsx-runtime").JSX.Element;
|
|
2
2
|
export default ScrollArea;
|
|
@@ -2,7 +2,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtim
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../../index.mjs";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__built_in_scroll_assistant_useJoystick_mjs__ from "../../../built-in/scroll-assistant/useJoystick.mjs";
|
|
5
|
-
const ScrollArea = ()=>{
|
|
5
|
+
const ScrollArea = (props)=>{
|
|
6
6
|
const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
7
7
|
const { t } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useTranslation)();
|
|
8
8
|
(0, __WEBPACK_EXTERNAL_MODULE__built_in_scroll_assistant_useJoystick_mjs__.useJoystick)(ref);
|
|
@@ -19,6 +19,7 @@ const ScrollArea = ()=>{
|
|
|
19
19
|
cursor: 'pointer',
|
|
20
20
|
userSelect: 'none'
|
|
21
21
|
},
|
|
22
|
+
...props,
|
|
22
23
|
children: t('Horizontal scrolling area')
|
|
23
24
|
});
|
|
24
25
|
};
|
|
@@ -142,7 +142,7 @@ function getCurrentRange(element) {
|
|
|
142
142
|
function TextArea(props) {
|
|
143
143
|
const { value: propsValue, scope, onChange, multiline = true, changeOnSelect } = props;
|
|
144
144
|
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
145
|
-
const value = propsValue || fieldSchema.default || '';
|
|
145
|
+
const value = propsValue || (null == fieldSchema ? void 0 : fieldSchema.default) || '';
|
|
146
146
|
const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)({
|
|
147
147
|
multiline
|
|
148
148
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const useEnvironmentVariableOptions: (scope: any) => any;
|
|
3
|
+
interface TextAreaWithGlobalScopeProps {
|
|
4
|
+
supportsLineBreak?: boolean;
|
|
5
|
+
password?: boolean;
|
|
6
|
+
number?: boolean;
|
|
7
|
+
boolean?: boolean;
|
|
8
|
+
value?: any;
|
|
9
|
+
scope?: string | object;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const TextAreaWithGlobalScope: React.ForwardRefExoticComponent<Omit<TextAreaWithGlobalScopeProps, "ref"> & React.RefAttributes<unknown>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_hooks_useGlobalVariable_mjs__ from "../../../application/hooks/useGlobalVariable.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__input_index_mjs__ from "../input/index.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__password_index_mjs__ from "../password/index.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__RawTextArea_mjs__ from "./RawTextArea.mjs";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__TextArea_mjs__ from "./TextArea.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__Variable_mjs__ from "./Variable.mjs";
|
|
10
|
+
const useEnvironmentVariableOptions = (scope)=>{
|
|
11
|
+
const environmentVariables = (0, __WEBPACK_EXTERNAL_MODULE__application_hooks_useGlobalVariable_mjs__.useGlobalVariable)('$env');
|
|
12
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>{
|
|
13
|
+
if (environmentVariables) return [
|
|
14
|
+
environmentVariables
|
|
15
|
+
].filter(Boolean);
|
|
16
|
+
return scope;
|
|
17
|
+
}, [
|
|
18
|
+
environmentVariables,
|
|
19
|
+
scope
|
|
20
|
+
]);
|
|
21
|
+
};
|
|
22
|
+
const isVariable = (value)=>{
|
|
23
|
+
const regex = /{{.*?}}/;
|
|
24
|
+
return regex.test(value);
|
|
25
|
+
};
|
|
26
|
+
const TextAreaWithGlobalScope = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>{
|
|
27
|
+
const { supportsLineBreak, password, number, boolean, ...others } = props;
|
|
28
|
+
const scope = useEnvironmentVariableOptions(props.scope);
|
|
29
|
+
const fieldNames = {
|
|
30
|
+
value: 'name',
|
|
31
|
+
label: 'title'
|
|
32
|
+
};
|
|
33
|
+
if (supportsLineBreak) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__RawTextArea_mjs__.RawTextArea, {
|
|
34
|
+
...others,
|
|
35
|
+
scope: scope,
|
|
36
|
+
fieldNames: fieldNames,
|
|
37
|
+
rows: 3
|
|
38
|
+
});
|
|
39
|
+
if (number) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__Variable_mjs__.Variable.Input, {
|
|
40
|
+
...props,
|
|
41
|
+
scope: scope,
|
|
42
|
+
fieldNames: fieldNames
|
|
43
|
+
});
|
|
44
|
+
if (password && props.value && !isVariable(props.value)) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__password_index_mjs__.Password, {
|
|
45
|
+
...others,
|
|
46
|
+
autoFocus: true
|
|
47
|
+
});
|
|
48
|
+
if (boolean) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__Variable_mjs__.Variable.Input, {
|
|
49
|
+
...props,
|
|
50
|
+
scope: scope,
|
|
51
|
+
fieldNames: fieldNames
|
|
52
|
+
});
|
|
53
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__TextArea_mjs__.TextArea, {
|
|
54
|
+
...others,
|
|
55
|
+
scope: scope,
|
|
56
|
+
fieldNames: fieldNames
|
|
57
|
+
});
|
|
58
|
+
}, (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)(__WEBPACK_EXTERNAL_MODULE__input_index_mjs__.Input.ReadPretty));
|
|
59
|
+
export { TextAreaWithGlobalScope, useEnvironmentVariableOptions };
|
|
@@ -1 +1,4 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__TextAreaWithGlobalScope_mjs__ from "./TextAreaWithGlobalScope.mjs";
|
|
1
2
|
export * from "./Variable.mjs";
|
|
3
|
+
var __webpack_exports__TextAreaWithGlobalScope = __WEBPACK_EXTERNAL_MODULE__TextAreaWithGlobalScope_mjs__.TextAreaWithGlobalScope;
|
|
4
|
+
export { __webpack_exports__TextAreaWithGlobalScope as TextAreaWithGlobalScope };
|
|
@@ -83,13 +83,7 @@ const DndContext = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((
|
|
|
83
83
|
dropAnimation: {
|
|
84
84
|
duration: 10,
|
|
85
85
|
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)'
|
|
86
|
-
}
|
|
87
|
-
children: visible && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
88
|
-
style: {
|
|
89
|
-
whiteSpace: 'nowrap'
|
|
90
|
-
},
|
|
91
|
-
children: t('Dragging')
|
|
92
|
-
})
|
|
86
|
+
}
|
|
93
87
|
}),
|
|
94
88
|
props.children
|
|
95
89
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DragHandlePageTab: (props: any) => any;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__DragHandlePageTab_style_mjs__ from "./DragHandlePageTab.style.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__SortableItem_mjs__ from "./SortableItem.mjs";
|
|
7
|
+
const DragHandlePageTab = (props)=>{
|
|
8
|
+
const { isSubMenu, children, className: overStyle, isAdminMenu } = props;
|
|
9
|
+
const { draggable } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__SortableItem_mjs__.SortableContext);
|
|
10
|
+
const { designable } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
|
|
11
|
+
const { attributes, listeners, setNodeRef, transform, isDragging } = draggable;
|
|
12
|
+
const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__DragHandlePageTab_style_mjs__.useStyles)();
|
|
13
|
+
const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
14
|
+
const [dimensions, setDimensions] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
|
|
15
|
+
width: 0,
|
|
16
|
+
height: 0
|
|
17
|
+
});
|
|
18
|
+
const [initialPosition, setInitialPosition] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0
|
|
21
|
+
});
|
|
22
|
+
const centerOffset = {
|
|
23
|
+
x: 4 * dimensions.width,
|
|
24
|
+
y: 3 * dimensions.height
|
|
25
|
+
};
|
|
26
|
+
const style = {
|
|
27
|
+
position: isDragging ? 'fixed' : 'static',
|
|
28
|
+
top: isDragging ? initialPosition.y - centerOffset.y : 0,
|
|
29
|
+
left: isDragging ? initialPosition.x - centerOffset.x : 0,
|
|
30
|
+
width: isDragging ? 'max-content' : '100%',
|
|
31
|
+
height: isDragging ? 'max-content' : '100%',
|
|
32
|
+
zIndex: isDragging ? 999 : 'auto',
|
|
33
|
+
pointerEvents: isDragging ? 'none' : 'auto',
|
|
34
|
+
transform: transform ? "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0) scale(").concat(isDragging ? 1.05 : 1, ")") : void 0,
|
|
35
|
+
boxShadow: isDragging ? '0 4px 8px rgba(0, 0, 0, 0.1)' : 'none'
|
|
36
|
+
};
|
|
37
|
+
const handleMouseDown = (event)=>{
|
|
38
|
+
if (ref.current) {
|
|
39
|
+
const { width, height } = ref.current.getBoundingClientRect();
|
|
40
|
+
const { clientX, clientY } = event;
|
|
41
|
+
setDimensions({
|
|
42
|
+
width,
|
|
43
|
+
height
|
|
44
|
+
});
|
|
45
|
+
setInitialPosition({
|
|
46
|
+
x: clientX,
|
|
47
|
+
y: clientY
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
if (!designable) return children;
|
|
52
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
|
|
53
|
+
ref: setNodeRef,
|
|
54
|
+
className: (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.cx)(styles.dragHandleMenu, {
|
|
55
|
+
draggable: isDragging,
|
|
56
|
+
leftBorder: isSubMenu && isDragging,
|
|
57
|
+
adminMenu: isAdminMenu && isDragging
|
|
58
|
+
}, overStyle),
|
|
59
|
+
style: style,
|
|
60
|
+
...listeners,
|
|
61
|
+
...attributes,
|
|
62
|
+
role: "none",
|
|
63
|
+
onMouseDown: handleMouseDown,
|
|
64
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
|
|
65
|
+
ref: ref,
|
|
66
|
+
className: 'wrapper',
|
|
67
|
+
children: children
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export { DragHandlePageTab };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
|
|
2
|
+
function _tagged_template_literal(strings, raw) {
|
|
3
|
+
if (!raw) raw = strings.slice(0);
|
|
4
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
5
|
+
raw: {
|
|
6
|
+
value: Object.freeze(raw)
|
|
7
|
+
}
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
function _templateObject() {
|
|
11
|
+
const data = _tagged_template_literal([
|
|
12
|
+
"\n position: relative;\n width: 100%;\n height: 100%;\n\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n\n .wrapper {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n }\n "
|
|
13
|
+
]);
|
|
14
|
+
_templateObject = function() {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
|
|
20
|
+
let { css, token } = param;
|
|
21
|
+
return {
|
|
22
|
+
dragHandleMenu: css(_templateObject())
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
export { useStyles };
|
|
@@ -3,6 +3,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__ from "../application/schema-toolbar/index.mjs";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../collection-manager/index.mjs";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../schema-component/index.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDefaultValue_mjs__ from "../schema-settings/SchemaSettingsDefaultValue.mjs";
|
|
6
7
|
const generalSettingsItems = [
|
|
7
8
|
{
|
|
8
9
|
name: 'editFieldTitle',
|
|
@@ -202,6 +203,10 @@ const generalSettingsItems = [
|
|
|
202
203
|
const { required = true } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
|
|
203
204
|
return !field.readPretty && 'FormField' !== fieldSchema['x-component'] && required;
|
|
204
205
|
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'editDefaultValue',
|
|
209
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDefaultValue_mjs__.SchemaSettingsDefaultValue
|
|
205
210
|
}
|
|
206
211
|
];
|
|
207
212
|
export { generalSettingsItems };
|
|
@@ -41,7 +41,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
41
41
|
}
|
|
42
42
|
function _templateObject() {
|
|
43
43
|
const data = _tagged_template_literal([
|
|
44
|
-
"\n .ant-dropdown-menu-item-group-list {\n max-height:
|
|
44
|
+
"\n .ant-dropdown-menu-item-group-list {\n max-height: 400px;\n overflow-y: auto;\n }\n "
|
|
45
45
|
]);
|
|
46
46
|
_templateObject = function() {
|
|
47
47
|
return data;
|
|
@@ -180,6 +180,8 @@ const SchemaSettingsDefaultValue = function(props) {
|
|
|
180
180
|
const schema = {
|
|
181
181
|
['x-uid']: fieldSchema['x-uid']
|
|
182
182
|
};
|
|
183
|
+
v.default = v.default || null;
|
|
184
|
+
field.value = v.default;
|
|
183
185
|
fieldSchema.default = v.default;
|
|
184
186
|
if (!v.default && 0 !== v.default) field.value = null;
|
|
185
187
|
schema.default = v.default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ISchema } from '@tachybase/schema';
|
|
2
|
+
import { TFunction } from 'i18next';
|
|
3
|
+
import { SchemaSettingsItemType } from '../../application';
|
|
4
|
+
export interface CreateModalSchemaSettingsItemProps {
|
|
5
|
+
name: string;
|
|
6
|
+
title: string | ((t: TFunction<'translation', undefined>) => string);
|
|
7
|
+
parentSchemaKey?: string;
|
|
8
|
+
defaultValue?: any;
|
|
9
|
+
useDefaultValue?: () => any;
|
|
10
|
+
schema: (defaultValue: any) => ISchema;
|
|
11
|
+
valueKeys?: string[];
|
|
12
|
+
useVisible?: () => boolean;
|
|
13
|
+
width?: number | string;
|
|
14
|
+
useSubmit?: () => (values: any) => void;
|
|
15
|
+
/**
|
|
16
|
+
* @default 'common'
|
|
17
|
+
*/
|
|
18
|
+
type?: 'common' | 'field';
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* create `switch` type schema settings item
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
* @unstable
|
|
25
|
+
*/
|
|
26
|
+
export declare function createModalSettingsItem(options: CreateModalSchemaSettingsItemProps): SchemaSettingsItemType;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__util_mjs__ from "./util.mjs";
|
|
5
|
+
function createModalSettingsItem(options) {
|
|
6
|
+
const { name, parentSchemaKey, valueKeys, schema, title, useSubmit = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault, useVisible, defaultValue: propsDefaultValue, useDefaultValue = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault, width, type = 'common' } = options;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
type: 'actionModal',
|
|
10
|
+
useVisible,
|
|
11
|
+
useComponentProps () {
|
|
12
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.useSchemaByType)(type);
|
|
13
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
14
|
+
const defaultValue = useDefaultValue(propsDefaultValue);
|
|
15
|
+
const values = parentSchemaKey ? __WEBPACK_EXTERNAL_MODULE_lodash__["default"].get(fieldSchema, parentSchemaKey) : void 0;
|
|
16
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
17
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
18
|
+
const onSubmit = useSubmit();
|
|
19
|
+
const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useColumnSchema)() || {};
|
|
20
|
+
return {
|
|
21
|
+
title: 'function' == typeof title ? title(t) : compile(title),
|
|
22
|
+
width,
|
|
23
|
+
schema: schema({
|
|
24
|
+
...defaultValue,
|
|
25
|
+
...values
|
|
26
|
+
}),
|
|
27
|
+
onSubmit (values) {
|
|
28
|
+
const newSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.getNewSchema)({
|
|
29
|
+
fieldSchema,
|
|
30
|
+
parentSchemaKey: parentSchemaKey,
|
|
31
|
+
value: values,
|
|
32
|
+
valueKeys
|
|
33
|
+
});
|
|
34
|
+
if (tableColumnSchema) {
|
|
35
|
+
dn.emit('patch', {
|
|
36
|
+
schema: newSchema
|
|
37
|
+
});
|
|
38
|
+
dn.refresh();
|
|
39
|
+
} else dn.deepMerge(newSchema);
|
|
40
|
+
return null == onSubmit ? void 0 : onSubmit(values);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export { createModalSettingsItem };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SelectProps } from 'antd';
|
|
2
|
+
import { TFunction } from 'i18next';
|
|
3
|
+
import { SchemaSettingsItemType } from '../../application';
|
|
4
|
+
interface CreateSelectSchemaSettingsItemProps {
|
|
5
|
+
name: string;
|
|
6
|
+
title: string | ((t: TFunction<'translation', undefined>) => string);
|
|
7
|
+
options?: SelectProps['options'];
|
|
8
|
+
useOptions?: () => SelectProps['options'];
|
|
9
|
+
schemaKey: string;
|
|
10
|
+
defaultValue?: string | number;
|
|
11
|
+
useDefaultValue?: () => string | number;
|
|
12
|
+
useVisible?: () => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @default 'common'
|
|
15
|
+
*/
|
|
16
|
+
type?: 'common' | 'field';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* create `select` type schema settings item
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
* @unstable
|
|
23
|
+
*/
|
|
24
|
+
export declare const createSelectSchemaSettingsItem: (options: CreateSelectSchemaSettingsItemProps) => SchemaSettingsItemType;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__util_mjs__ from "./util.mjs";
|
|
5
|
+
const createSelectSchemaSettingsItem = (options)=>{
|
|
6
|
+
const { name, title, options: propsOptions, useOptions = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault, schemaKey, useVisible, type = 'common', defaultValue: propsDefaultValue, useDefaultValue = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault } = options;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
type: 'select',
|
|
10
|
+
useVisible,
|
|
11
|
+
useComponentProps () {
|
|
12
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.useSchemaByType)(type);
|
|
13
|
+
const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useColumnSchema)() || {};
|
|
14
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
15
|
+
const options = useOptions(propsOptions);
|
|
16
|
+
const defaultValue = useDefaultValue(propsDefaultValue);
|
|
17
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
18
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
19
|
+
return {
|
|
20
|
+
title: 'function' == typeof title ? title(t) : compile(title),
|
|
21
|
+
options,
|
|
22
|
+
value: __WEBPACK_EXTERNAL_MODULE_lodash__["default"].get(fieldSchema, schemaKey, defaultValue),
|
|
23
|
+
onChange (v) {
|
|
24
|
+
const newSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.getNewSchema)({
|
|
25
|
+
fieldSchema,
|
|
26
|
+
schemaKey,
|
|
27
|
+
value: v
|
|
28
|
+
});
|
|
29
|
+
if (tableColumnSchema) {
|
|
30
|
+
dn.emit('patch', {
|
|
31
|
+
schema: newSchema
|
|
32
|
+
});
|
|
33
|
+
dn.refresh();
|
|
34
|
+
} else dn.deepMerge(newSchema);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export { createSelectSchemaSettingsItem };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
2
|
+
import { SchemaSettingsItemType } from '../../application';
|
|
3
|
+
export interface CreateSwitchSchemaSettingsItemProps {
|
|
4
|
+
name: string;
|
|
5
|
+
title: string | ((t: TFunction<'translation', undefined>) => string);
|
|
6
|
+
schemaKey: string;
|
|
7
|
+
defaultValue?: boolean;
|
|
8
|
+
useDefaultValue?: () => boolean;
|
|
9
|
+
useVisible?: () => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @default 'common'
|
|
12
|
+
*/
|
|
13
|
+
type?: 'common' | 'field';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* create `switch` type schema settings item
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
* @unstable
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSwitchSettingsItem(options: CreateSwitchSchemaSettingsItemProps): SchemaSettingsItemType;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__util_mjs__ from "./util.mjs";
|
|
5
|
+
function createSwitchSettingsItem(options) {
|
|
6
|
+
const { name, useVisible, schemaKey, title, type = 'common', defaultValue: propsDefaultValue, useDefaultValue = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault } = options;
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
useVisible,
|
|
10
|
+
type: 'switch',
|
|
11
|
+
useComponentProps () {
|
|
12
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.useSchemaByType)(type);
|
|
13
|
+
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|
|
14
|
+
const defaultValue = useDefaultValue(propsDefaultValue);
|
|
15
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
16
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
17
|
+
const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useColumnSchema)() || {};
|
|
18
|
+
return {
|
|
19
|
+
title: 'function' == typeof title ? title(t) : compile(title),
|
|
20
|
+
checked: !!__WEBPACK_EXTERNAL_MODULE_lodash__["default"].get(fieldSchema, schemaKey, defaultValue),
|
|
21
|
+
onChange (v) {
|
|
22
|
+
const newSchema = (0, __WEBPACK_EXTERNAL_MODULE__util_mjs__.getNewSchema)({
|
|
23
|
+
fieldSchema,
|
|
24
|
+
schemaKey,
|
|
25
|
+
value: v
|
|
26
|
+
});
|
|
27
|
+
if (tableColumnSchema) {
|
|
28
|
+
dn.emit('patch', {
|
|
29
|
+
schema: newSchema
|
|
30
|
+
});
|
|
31
|
+
dn.refresh();
|
|
32
|
+
} else dn.deepMerge(newSchema);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export { createSwitchSettingsItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
2
|
+
import { SchemaSettingsItemType } from '../../application';
|
|
3
|
+
export interface CreateTextSchemaSettingsItemProps {
|
|
4
|
+
name: string;
|
|
5
|
+
useVisible?: () => boolean;
|
|
6
|
+
title: string | ((t: TFunction<'translation', undefined>) => string);
|
|
7
|
+
useTextClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createTextSettingsItem(options: CreateTextSchemaSettingsItemProps): SchemaSettingsItemType;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__util_mjs__ from "./util.mjs";
|
|
4
|
+
function createTextSettingsItem(options) {
|
|
5
|
+
const { name, useVisible, title, useTextClick = __WEBPACK_EXTERNAL_MODULE__util_mjs__.useHookDefault } = options;
|
|
6
|
+
return {
|
|
7
|
+
name,
|
|
8
|
+
type: 'item',
|
|
9
|
+
useVisible,
|
|
10
|
+
useComponentProps () {
|
|
11
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useCompile)();
|
|
12
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
13
|
+
const onClick = useTextClick();
|
|
14
|
+
return {
|
|
15
|
+
title: 'function' == typeof title ? title(t) : compile(title),
|
|
16
|
+
onClick
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export { createTextSettingsItem };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISchema } from '@tachybase/schema';
|
|
2
|
+
type IGetNewSchema = {
|
|
3
|
+
fieldSchema: ISchema;
|
|
4
|
+
schemaKey?: string;
|
|
5
|
+
parentSchemaKey?: string;
|
|
6
|
+
value: any;
|
|
7
|
+
valueKeys?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare function getNewSchema(options: IGetNewSchema): any;
|
|
10
|
+
export declare const useHookDefault: (defaultValues?: any) => any;
|
|
11
|
+
export declare const useSchemaByType: (type?: "common" | "field") => any;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../schema-component/index.mjs";
|
|
4
|
+
function getNewSchema(options) {
|
|
5
|
+
const { fieldSchema, schemaKey, parentSchemaKey, value, valueKeys } = options;
|
|
6
|
+
if (schemaKey) __WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, schemaKey, value);
|
|
7
|
+
else if (parentSchemaKey) {
|
|
8
|
+
if (void 0 === value) return fieldSchema;
|
|
9
|
+
if ('object' == typeof value) Object.keys(value).forEach((key)=>{
|
|
10
|
+
if (valueKeys && !valueKeys.includes(key)) return;
|
|
11
|
+
__WEBPACK_EXTERNAL_MODULE_lodash__["default"].set(fieldSchema, "".concat(parentSchemaKey, ".").concat(key), value[key]);
|
|
12
|
+
});
|
|
13
|
+
else console.error('value must be object');
|
|
14
|
+
}
|
|
15
|
+
return fieldSchema;
|
|
16
|
+
}
|
|
17
|
+
const useHookDefault = (defaultValues)=>defaultValues;
|
|
18
|
+
const useSchemaByType = function() {
|
|
19
|
+
let type = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 'common';
|
|
20
|
+
const schema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
21
|
+
const { fieldSchema: tableColumnSchema } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useColumnSchema)() || {};
|
|
22
|
+
return 'field' === type ? tableColumnSchema || schema : schema;
|
|
23
|
+
};
|
|
24
|
+
export { getNewSchema, useHookDefault, useSchemaByType };
|