@tachybase/client 0.23.58 → 1.0.18
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 +3 -0
- package/es/application/Application.mjs +11 -0
- package/es/application/CustomRouterContextProvider.d.ts +54 -0
- package/es/application/CustomRouterContextProvider.mjs +209 -0
- package/es/application/NoticesManager.d.ts +12 -3
- package/es/application/NoticesManager.mjs +27 -3
- package/es/application/RouterManager.d.ts +8 -3
- package/es/application/RouterManager.mjs +48 -15
- package/es/application/schema-initializer/context/index.d.ts +1 -1
- package/es/block-provider/hooks/index.d.ts +2 -0
- package/es/block-provider/hooks/index.mjs +25 -21
- 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 +5 -0
- package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
- package/es/built-in/pm/PluginManager.mjs +45 -45
- package/es/collection-manager/interfaces/email.d.ts +0 -1
- package/es/collection-manager/interfaces/input.d.ts +0 -2
- package/es/collection-manager/interfaces/integer.d.ts +0 -2
- package/es/collection-manager/interfaces/number.d.ts +0 -1
- package/es/collection-manager/interfaces/password.d.ts +0 -1
- package/es/collection-manager/interfaces/percent.d.ts +0 -1
- package/es/collection-manager/interfaces/phone.d.ts +0 -1
- package/es/collection-manager/interfaces/properties/index.d.ts +0 -2
- package/es/collection-manager/interfaces/properties/index.mjs +0 -2
- package/es/collection-manager/templates/sql.d.ts +1 -1
- package/es/collection-manager/templates/view.d.ts +1 -1
- 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 +2 -2
- 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/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 +38 -3
- package/es/schema-component/antd/action/Action.Modal.mjs +0 -1
- package/es/schema-component/antd/action/Action.mjs +1 -3
- package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
- package/es/schema-component/antd/checkbox/Checkbox.mjs +6 -4
- 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.mjs +34 -24
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- 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 +11 -0
- package/lib/application/CustomRouterContextProvider.js +276 -0
- package/lib/application/NoticesManager.js +27 -3
- package/lib/application/RouterManager.js +49 -15
- package/lib/block-provider/hooks/index.js +76 -58
- 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 +5 -0
- package/lib/built-in/page-style/PageStyle.provider.js +2 -2
- package/lib/built-in/pm/PluginManager.js +45 -45
- package/lib/collection-manager/interfaces/properties/index.js +0 -2
- 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 +4 -0
- package/lib/locale/zh-CN.js +13 -1
- 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 +2 -2
- 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/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 +38 -3
- package/lib/schema-component/antd/action/Action.Modal.js +0 -1
- package/lib/schema-component/antd/action/Action.js +1 -3
- package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
- package/lib/schema-component/antd/checkbox/Checkbox.js +6 -4
- 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 +34 -24
- 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
|
@@ -4,6 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components__ from "@tachybase/c
|
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__ from "@ant-design/pro-layout";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__ from "@dnd-kit/core";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
8
9
|
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
|
|
9
10
|
import * as __WEBPACK_EXTERNAL_MODULE_classnames__ from "classnames";
|
|
@@ -21,6 +22,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelO
|
|
|
21
22
|
import * as __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__ from "../../../style/theme/index.mjs";
|
|
22
23
|
import * as __WEBPACK_EXTERNAL_MODULE__common_index_mjs__ from "../../common/index.mjs";
|
|
23
24
|
import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__ from "../../common/sortable-item/index.mjs";
|
|
25
|
+
import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__ from "../../common/sortable-item/DragHandlePageTab.mjs";
|
|
24
26
|
import * as __WEBPACK_EXTERNAL_MODULE__core_index_mjs__ from "../../core/index.mjs";
|
|
25
27
|
import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
|
|
26
28
|
import * as __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__ from "../error-fallback/index.mjs";
|
|
@@ -89,7 +91,7 @@ const PageHeader = (props)=>{
|
|
|
89
91
|
const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
|
|
90
92
|
const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
|
|
91
93
|
const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
|
|
92
|
-
const {
|
|
94
|
+
const { showScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
|
|
93
95
|
const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
|
|
94
96
|
const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
|
|
95
97
|
const items = fieldSchema.mapProperties((schema)=>({
|
|
@@ -108,12 +110,12 @@ const PageHeader = (props)=>{
|
|
|
108
110
|
ghost: false,
|
|
109
111
|
title: pageHeaderTitle || ' ',
|
|
110
112
|
...parentProps,
|
|
111
|
-
extra: !enablePageTabs &&
|
|
113
|
+
extra: !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
|
|
112
114
|
footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
|
|
113
115
|
activeKey: activeKey,
|
|
114
116
|
setLoading: setLoading,
|
|
115
117
|
setSearchParams: setSearchParams,
|
|
116
|
-
|
|
118
|
+
showScrollArea: showScrollArea,
|
|
117
119
|
options: options,
|
|
118
120
|
theme: theme,
|
|
119
121
|
items: items
|
|
@@ -122,9 +124,14 @@ const PageHeader = (props)=>{
|
|
|
122
124
|
});
|
|
123
125
|
};
|
|
124
126
|
const TabComponent = (props)=>{
|
|
125
|
-
const { activeKey, setLoading, setSearchParams,
|
|
127
|
+
const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
|
|
126
128
|
const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
|
|
127
129
|
const [hasMounted, setHasMounted] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
130
|
+
const sensors = (0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensors)((0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensor)(__WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.PointerSensor, {
|
|
131
|
+
activationConstraint: {
|
|
132
|
+
distance: 5
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
128
135
|
const handleTabClick = (activeKey)=>{
|
|
129
136
|
setLoading(true);
|
|
130
137
|
setSearchParams([
|
|
@@ -143,6 +150,7 @@ const TabComponent = (props)=>{
|
|
|
143
150
|
});
|
|
144
151
|
}, []);
|
|
145
152
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_index_mjs__.DndContext, {
|
|
153
|
+
sensors: sensors,
|
|
146
154
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tabs, {
|
|
147
155
|
className: styles.tabComponentClass,
|
|
148
156
|
type: "card",
|
|
@@ -153,7 +161,7 @@ const TabComponent = (props)=>{
|
|
|
153
161
|
onTabClick: handleTabClick,
|
|
154
162
|
tabBarExtraContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabBarExtraContent, {
|
|
155
163
|
theme: theme,
|
|
156
|
-
|
|
164
|
+
showScrollArea: showScrollArea,
|
|
157
165
|
options: options
|
|
158
166
|
})
|
|
159
167
|
})
|
|
@@ -163,31 +171,33 @@ const TabItem = (props)=>{
|
|
|
163
171
|
const { schema } = props;
|
|
164
172
|
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
165
173
|
const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
|
|
166
|
-
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.
|
|
174
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
|
|
167
175
|
id: schema.name,
|
|
168
176
|
schema: schema,
|
|
169
177
|
className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('tb-action-link', 'designerCss', props.className, styles.tabItemClass),
|
|
170
|
-
children:
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
178
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__.DragHandlePageTab, {
|
|
179
|
+
children: [
|
|
180
|
+
schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
|
|
181
|
+
style: {
|
|
182
|
+
marginRight: 8
|
|
183
|
+
},
|
|
184
|
+
type: schema['x-icon']
|
|
185
|
+
}),
|
|
186
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
187
|
+
children: schema.title || t('Unnamed')
|
|
188
|
+
}),
|
|
189
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
|
|
190
|
+
className: "tab-designer-wrapper",
|
|
191
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
|
|
192
|
+
schema: schema
|
|
193
|
+
})
|
|
184
194
|
})
|
|
185
|
-
|
|
186
|
-
|
|
195
|
+
]
|
|
196
|
+
})
|
|
187
197
|
});
|
|
188
198
|
};
|
|
189
199
|
const TabBarExtraContent = (props)=>{
|
|
190
|
-
const {
|
|
200
|
+
const { showScrollArea, options, theme } = props;
|
|
191
201
|
const dn = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
|
|
192
202
|
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
193
203
|
const { getAriaLabel } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__.useGetAriaLabelOfSchemaInitializer)();
|
|
@@ -220,7 +230,7 @@ const TabBarExtraContent = (props)=>{
|
|
|
220
230
|
icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.PlusOutlined, {}),
|
|
221
231
|
onClick: handleAddTab
|
|
222
232
|
}),
|
|
223
|
-
|
|
233
|
+
showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {
|
|
224
234
|
className: "scroll-area-extra-content"
|
|
225
235
|
})
|
|
226
236
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getStrength: (val: any) => 0 |
|
|
1
|
+
export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
|
|
@@ -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 };
|
|
@@ -33,9 +33,12 @@ const useCurrentRoles = ()=>{
|
|
|
33
33
|
return options;
|
|
34
34
|
};
|
|
35
35
|
const CurrentUserProvider = (props)=>{
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
const api = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useAPIClient)();
|
|
37
|
+
const result = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useRequest)(()=>api.request({
|
|
38
|
+
url: '/auth:check',
|
|
39
|
+
skipNotify: true,
|
|
40
|
+
skipAuth: true
|
|
41
|
+
}).then((res)=>null == res ? void 0 : res.data));
|
|
39
42
|
if (result.loading) return;
|
|
40
43
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(CurrentUserContext.Provider, {
|
|
41
44
|
value: result,
|