@tachybase/client 0.23.20 → 0.23.35
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/schema-initializer/components/SchemaInitializerChildren.mjs +1 -1
- package/es/built-in/admin-layout/InternalAdminLayout.mjs +4 -2
- package/es/built-in/admin-layout/MenuEditor.mjs +2 -2
- package/es/built-in/admin-layout/style.d.ts +1 -1
- package/es/built-in/admin-layout/style.mjs +4 -4
- package/es/built-in/assistant/Assistant.provider.d.ts +0 -6
- package/es/built-in/assistant/Assistant.provider.mjs +15 -112
- package/es/built-in/assistant/index.d.ts +0 -1
- package/es/built-in/assistant/index.mjs +0 -7
- package/es/built-in/attachment-preview/previewers/file-pdf.mjs +4 -2
- package/es/built-in/context-menu/ContextMenu.provider.d.ts +1 -0
- package/es/built-in/context-menu/ContextMenu.provider.mjs +29 -1
- package/es/built-in/context-menu/index.mjs +1 -0
- package/es/built-in/index.mjs +44 -5
- package/es/built-in/page-style/TabHeader.d.ts +1 -1
- package/es/built-in/page-style/TabHeader.mjs +26 -33
- package/es/built-in/page-style/TabHeader.style.d.ts +4 -0
- package/es/built-in/page-style/TabHeader.style.mjs +35 -0
- package/es/built-in/pinned-list/PinnedPluginListProvider.d.ts +3 -1
- package/es/built-in/pinned-list/PinnedPluginListProvider.mjs +5 -4
- package/es/built-in/scroll-assistant/useJoystick.mjs +3 -1
- package/es/built-in/setting-layout/SettingLayout.mjs +10 -1
- package/es/built-in/{assistant/calculator → setting-layout}/style.d.ts +1 -1
- package/es/built-in/setting-layout/style.mjs +25 -0
- package/es/collection-manager/action-hooks.d.ts +1 -4
- package/es/collection-manager/action-hooks.mjs +39 -11
- package/es/icon/preloaded.mjs +4 -4
- package/es/modules/actions/associate/AssociateActionInitializer.d.ts +1 -0
- package/es/modules/actions/associate/AssociateActionInitializer.mjs +71 -0
- package/es/modules/actions/associate/AssociateActionProvider.d.ts +7 -0
- package/es/modules/actions/associate/AssociateActionProvider.mjs +82 -0
- package/es/modules/actions/associate/AssociateActionSettings.d.ts +2 -0
- package/es/modules/actions/associate/AssociateActionSettings.mjs +57 -0
- package/es/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.mjs +2 -1
- package/es/modules/blocks/data-blocks/form/RecordFormBlockInitializer.mjs +21 -14
- package/es/modules/blocks/data-blocks/form/createEditFormBlockUISchema.d.ts +1 -2
- package/es/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.mjs +2 -1
- package/es/modules/blocks/data-blocks/list/listBlockSettings.mjs +2 -1
- package/es/modules/blocks/data-blocks/table/TableActionInitializers.mjs +15 -0
- package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +2 -1
- package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +2 -2
- package/es/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.mjs +2 -1
- package/es/modules/fields/component/Cascader/cascaderComponentFieldSettings.mjs +2 -1
- package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +4 -0
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +16 -2
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +2 -1
- package/es/modules/menu/GroupItem.mjs +5 -1
- package/es/modules/menu/LinkMenuItem.mjs +7 -3
- package/es/modules/menu/PageMenuItem.mjs +5 -1
- package/es/modules/menu/UploadMenuItem.d.ts +1 -0
- package/es/modules/menu/UploadMenuItem.mjs +81 -0
- package/es/modules/menu/menuItemInitializer.d.ts +0 -4
- package/es/modules/menu/menuItemInitializer.mjs +3 -23
- package/es/schema-component/antd/action/Action.Designer.mjs +4 -1
- package/es/schema-component/antd/association-select/AssociationSelect.mjs +4 -2
- package/es/schema-component/antd/checkbox/Checkbox.mjs +11 -6
- package/es/schema-component/antd/date-picker/DatePicker.mjs +4 -0
- package/es/schema-component/antd/form-item/FormItem.Settings.d.ts +2 -0
- package/es/schema-component/antd/form-item/FormItem.Settings.mjs +14 -1
- package/es/schema-component/antd/form-v2/Form.Settings.mjs +2 -1
- package/es/schema-component/antd/grid-card/GridCard.Designer.mjs +2 -1
- package/es/schema-component/antd/list/List.Designer.mjs +2 -1
- package/es/schema-component/antd/menu/AdminMenu.d.ts +1 -0
- package/es/schema-component/antd/menu/AdminMenu.mjs +71 -0
- package/es/schema-component/antd/menu/AdminMenu.style.d.ts +4 -0
- package/es/schema-component/antd/menu/AdminMenu.style.mjs +36 -0
- package/es/schema-component/antd/menu/Menu.Designer.d.ts +1 -1
- package/es/schema-component/antd/menu/Menu.Designer.mjs +59 -40
- package/es/schema-component/antd/menu/Menu.mjs +108 -141
- package/es/schema-component/antd/menu/Menu.styles.d.ts +1 -2
- package/es/schema-component/antd/menu/Menu.styles.mjs +8 -20
- package/es/schema-component/antd/menu/MenuSearch.d.ts +5 -0
- package/es/schema-component/antd/menu/MenuSearch.mjs +32 -0
- package/es/schema-component/antd/menu/tools.d.ts +9 -0
- package/es/schema-component/antd/menu/tools.mjs +36 -0
- package/es/schema-component/antd/scroll-area/ScrollArea.mjs +0 -17
- package/es/schema-component/antd/select/Select.d.ts +3 -13
- package/es/schema-component/antd/select/Select.mjs +33 -2
- package/es/schema-component/antd/table/Table.Void.Designer.mjs +2 -1
- package/es/schema-component/antd/table-v2/TableBlockDesigner.mjs +2 -1
- package/es/schema-component/antd/table-v2/TableSelectorDesigner.mjs +2 -1
- package/es/schema-component/common/dnd-context/index.d.ts +1 -2
- package/es/schema-component/common/sortable-item/DragHandleMenu.d.ts +1 -0
- package/es/schema-component/common/sortable-item/DragHandleMenu.mjs +78 -0
- package/es/schema-component/common/sortable-item/DragHandleMenu.style.d.ts +3 -0
- package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +25 -0
- package/es/schema-initializer/SchemaInitializerPlugin.mjs +5 -2
- package/es/schema-initializer/utils.mjs +24 -12
- package/es/schema-settings/GeneralSchemaDesigner.d.ts +2 -1
- package/es/schema-settings/GeneralSchemaDesigner.mjs +9 -1
- package/es/schema-settings/SchemaSettings.d.ts +3 -1
- package/es/schema-settings/SchemaSettings.mjs +16 -4
- package/es/schema-settings/SchemaSettingsPlugin.mjs +2 -0
- package/es/schema-settings/SchemaSettingsSortingRule.mjs +2 -1
- package/es/schema-settings/styles.mjs +2 -2
- package/lib/application/schema-initializer/components/SchemaInitializerChildren.js +1 -1
- package/lib/built-in/admin-layout/InternalAdminLayout.js +4 -2
- package/lib/built-in/admin-layout/MenuEditor.js +2 -2
- package/lib/built-in/admin-layout/style.js +4 -4
- package/lib/built-in/assistant/Assistant.provider.js +16 -115
- package/lib/built-in/assistant/index.js +3 -16
- package/lib/built-in/attachment-preview/previewers/file-pdf.js +4 -2
- package/lib/built-in/context-menu/ContextMenu.provider.js +29 -0
- package/lib/built-in/context-menu/index.js +1 -0
- package/lib/built-in/index.js +44 -5
- package/lib/built-in/page-style/TabHeader.js +26 -33
- package/lib/built-in/page-style/TabHeader.style.js +69 -0
- package/lib/built-in/pinned-list/PinnedPluginListProvider.js +5 -4
- package/lib/built-in/scroll-assistant/useJoystick.js +17 -1
- package/lib/built-in/setting-layout/SettingLayout.js +10 -1
- package/lib/built-in/{assistant/calculator/CalculatorKey.js → setting-layout/style.js} +25 -11
- package/lib/collection-manager/action-hooks.js +39 -11
- package/lib/icon/preloaded.js +4 -4
- package/lib/locale/en_US.js +8 -0
- package/lib/locale/zh-CN.js +8 -0
- package/lib/modules/actions/associate/AssociateActionInitializer.js +105 -0
- package/lib/modules/actions/associate/AssociateActionProvider.js +116 -0
- package/lib/modules/actions/associate/AssociateActionSettings.js +91 -0
- package/lib/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.js +2 -1
- package/lib/modules/blocks/data-blocks/form/RecordFormBlockInitializer.js +21 -14
- package/lib/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.js +2 -1
- package/lib/modules/blocks/data-blocks/list/listBlockSettings.js +2 -1
- package/lib/modules/blocks/data-blocks/table/TableActionInitializers.js +15 -0
- package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +2 -1
- package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +2 -2
- package/lib/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.js +2 -1
- package/lib/modules/fields/component/Cascader/cascaderComponentFieldSettings.js +2 -1
- package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +4 -0
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +16 -2
- package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +2 -1
- package/lib/modules/menu/GroupItem.js +5 -1
- package/lib/modules/menu/LinkMenuItem.js +7 -3
- package/lib/modules/menu/PageMenuItem.js +5 -1
- package/lib/modules/menu/UploadMenuItem.js +115 -0
- package/lib/modules/menu/menuItemInitializer.js +2 -23
- package/lib/schema-component/antd/action/Action.Designer.js +4 -1
- package/lib/schema-component/antd/association-select/AssociationSelect.js +4 -2
- package/lib/schema-component/antd/checkbox/Checkbox.js +11 -6
- package/lib/schema-component/antd/date-picker/DatePicker.js +4 -0
- package/lib/schema-component/antd/form-item/FormItem.Settings.js +16 -1
- package/lib/schema-component/antd/form-v2/Form.Settings.js +2 -1
- package/lib/schema-component/antd/grid-card/GridCard.Designer.js +2 -1
- package/lib/schema-component/antd/list/List.Designer.js +2 -1
- package/lib/schema-component/antd/menu/AdminMenu.js +105 -0
- package/lib/schema-component/antd/menu/AdminMenu.style.js +70 -0
- package/lib/schema-component/antd/menu/Menu.Designer.js +59 -40
- package/lib/schema-component/antd/menu/Menu.js +108 -141
- package/lib/schema-component/antd/menu/Menu.styles.js +8 -20
- package/lib/schema-component/antd/menu/MenuSearch.js +80 -0
- package/lib/schema-component/antd/menu/tools.js +72 -0
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +0 -17
- package/lib/schema-component/antd/select/Select.js +33 -2
- package/lib/schema-component/antd/table/Table.Void.Designer.js +2 -1
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
- package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +2 -1
- package/lib/schema-component/common/sortable-item/DragHandleMenu.js +112 -0
- package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +59 -0
- package/lib/schema-initializer/SchemaInitializerPlugin.js +5 -2
- package/lib/schema-initializer/utils.js +24 -12
- package/lib/schema-settings/GeneralSchemaDesigner.js +9 -1
- package/lib/schema-settings/SchemaSettings.js +16 -4
- package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
- package/lib/schema-settings/SchemaSettingsSortingRule.js +2 -1
- package/lib/schema-settings/styles.js +2 -2
- package/package.json +8 -7
- package/es/built-in/assistant/calculator/AutoScalingText.d.ts +0 -3
- package/es/built-in/assistant/calculator/AutoScalingText.mjs +0 -33
- package/es/built-in/assistant/calculator/Calculator.d.ts +0 -2
- package/es/built-in/assistant/calculator/Calculator.mjs +0 -235
- package/es/built-in/assistant/calculator/CalculatorDisplay.d.ts +0 -4
- package/es/built-in/assistant/calculator/CalculatorDisplay.mjs +0 -21
- package/es/built-in/assistant/calculator/CalculatorKey.d.ts +0 -5
- package/es/built-in/assistant/calculator/CalculatorKey.mjs +0 -11
- package/es/built-in/assistant/calculator/CalculatorProvider.d.ts +0 -10
- package/es/built-in/assistant/calculator/CalculatorProvider.mjs +0 -29
- package/es/built-in/assistant/calculator/Draggable.d.ts +0 -8
- package/es/built-in/assistant/calculator/Draggable.mjs +0 -54
- package/es/built-in/assistant/calculator/style.mjs +0 -25
- package/es/built-in/assistant/search-and-jump/index.d.ts +0 -16
- package/es/built-in/assistant/search-and-jump/index.mjs +0 -59
- package/lib/built-in/assistant/calculator/AutoScalingText.js +0 -67
- package/lib/built-in/assistant/calculator/Calculator.js +0 -283
- package/lib/built-in/assistant/calculator/CalculatorDisplay.js +0 -55
- package/lib/built-in/assistant/calculator/CalculatorProvider.js +0 -65
- package/lib/built-in/assistant/calculator/Draggable.js +0 -102
- package/lib/built-in/assistant/calculator/style.js +0 -59
- package/lib/built-in/assistant/search-and-jump/index.js +0 -96
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_lodash__ from "lodash";
|
|
2
3
|
const useJoystick = (ref, callbacks)=>{
|
|
3
4
|
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
4
5
|
if (!ref.current) return;
|
|
@@ -17,6 +18,7 @@ const useJoystick = (ref, callbacks)=>{
|
|
|
17
18
|
let moveY = 0;
|
|
18
19
|
let displayX = 0;
|
|
19
20
|
let displayY = 0;
|
|
21
|
+
const debouncedOnMousewheel = __WEBPACK_EXTERNAL_MODULE_lodash__["default"].debounce(onMousewheel, 16);
|
|
20
22
|
ele.addEventListener('mousedown', down);
|
|
21
23
|
ele.addEventListener('mousemove', move);
|
|
22
24
|
ele.addEventListener('mouseup', up);
|
|
@@ -24,7 +26,7 @@ const useJoystick = (ref, callbacks)=>{
|
|
|
24
26
|
ele.addEventListener('touchmove', move);
|
|
25
27
|
ele.addEventListener('touchend', up);
|
|
26
28
|
ele.addEventListener('contextmenu', onContextmenu);
|
|
27
|
-
ele.addEventListener('mousewheel',
|
|
29
|
+
ele.addEventListener('mousewheel', debouncedOnMousewheel);
|
|
28
30
|
const stickEle = createStickCanvas();
|
|
29
31
|
const baseEle = createBaseCanvas();
|
|
30
32
|
ele.appendChild(baseEle);
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__ from "@ant-design/pro-components";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../index.mjs";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__user_index_mjs__ from "../../user/index.mjs";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__admin_layout_index_mjs__ from "../admin-layout/index.mjs";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__admin_layout_AdminProvider_mjs__ from "../admin-layout/AdminProvider.mjs";
|
|
10
10
|
import * as __WEBPACK_EXTERNAL_MODULE__system_settings_index_mjs__ from "../system-settings/index.mjs";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
|
|
11
12
|
const SettingLayout = (param)=>{
|
|
12
13
|
let { selectedKeys, onClick, route, children, fullscreen } = param;
|
|
13
14
|
var _result_data_data, _result_data, _result_data_data_logo, _result_data_data1, _result_data1, _data_data, _data_data1, _data_data2;
|
|
@@ -20,18 +21,26 @@ const SettingLayout = (param)=>{
|
|
|
20
21
|
fixedHeader: true,
|
|
21
22
|
siderMenuType: 'sub'
|
|
22
23
|
};
|
|
24
|
+
const app = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useApp)();
|
|
23
25
|
const location = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useLocation)();
|
|
24
26
|
const navigate = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useNavigate)();
|
|
25
27
|
const { data } = (0, __WEBPACK_EXTERNAL_MODULE__user_index_mjs__.useCurrentUserContext)();
|
|
26
28
|
const result = (0, __WEBPACK_EXTERNAL_MODULE__system_settings_index_mjs__.useSystemSettings)();
|
|
29
|
+
const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
|
|
30
|
+
const redirectToUserHome = ()=>{
|
|
31
|
+
if (app.adminUrl.startsWith('/')) navigate(app.adminUrl);
|
|
32
|
+
else window.location.href = app.adminUrl;
|
|
33
|
+
};
|
|
27
34
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__admin_layout_AdminProvider_mjs__.AdminProvider, {
|
|
28
35
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__.ProConfigProvider, {
|
|
29
36
|
hashed: false,
|
|
30
37
|
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_components__.ProLayout, {
|
|
38
|
+
className: styles.settingLayout,
|
|
31
39
|
title: null == result ? void 0 : null === (_result_data = result.data) || void 0 === _result_data ? void 0 : null === (_result_data_data = _result_data.data) || void 0 === _result_data_data ? void 0 : _result_data_data.title,
|
|
32
40
|
logo: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("img", {
|
|
33
41
|
src: null == result ? void 0 : null === (_result_data1 = result.data) || void 0 === _result_data1 ? void 0 : null === (_result_data_data1 = _result_data1.data) || void 0 === _result_data_data1 ? void 0 : null === (_result_data_data_logo = _result_data_data1.logo) || void 0 === _result_data_data_logo ? void 0 : _result_data_data_logo.url
|
|
34
42
|
}),
|
|
43
|
+
onMenuHeaderClick: redirectToUserHome,
|
|
35
44
|
bgLayoutImgList: [
|
|
36
45
|
{
|
|
37
46
|
src: 'https://img.alicdn.com/imgextra/i2/O1CN01O4etvp1DvpFLKfuWq_!!6000000000279-2-tps-609-606.png',
|
|
@@ -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 /* Depends on antd's ProLayout component structure */\n .ant-pro-global-header-logo {\n cursor: pointer;\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
|
+
settingLayout: css(_templateObject())
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
export { useStyles };
|
|
@@ -17,10 +17,7 @@ export declare const useKanbanEvents: () => {
|
|
|
17
17
|
toPosition: any;
|
|
18
18
|
}): Promise<void>;
|
|
19
19
|
};
|
|
20
|
-
export declare const useSortFields: (collectionName: string) =>
|
|
21
|
-
value: any;
|
|
22
|
-
label: any;
|
|
23
|
-
}[];
|
|
20
|
+
export declare const useSortFields: (collectionName: any, depth?: number, parentFieldName?: string, parentLabel?: string) => any[];
|
|
24
21
|
export declare const useChildrenCollections: (collectionName: string) => {
|
|
25
22
|
value: any;
|
|
26
23
|
label: any;
|
|
@@ -74,21 +74,49 @@ const useKanbanEvents = ()=>{
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
};
|
|
77
|
-
const
|
|
77
|
+
const toOneField = (field)=>[
|
|
78
|
+
'belongsTo',
|
|
79
|
+
'hasOne'
|
|
80
|
+
].includes(field.type);
|
|
81
|
+
const useSortFields = function(collectionName) {
|
|
82
|
+
let depth = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 1, parentFieldName = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : '', parentLabel = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : '';
|
|
83
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
78
84
|
const { getCollectionFields, getInterface } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCollectionManager_deprecated)();
|
|
79
85
|
const fields = getCollectionFields(collectionName);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
+
if (!Array.isArray(fields) || 0 === fields.length) return [];
|
|
87
|
+
fields.sort((a, b)=>{
|
|
88
|
+
const toOnFieldA = toOneField(a);
|
|
89
|
+
const toOnFieldB = toOneField(b);
|
|
90
|
+
if (toOnFieldA && !toOnFieldB) return 1;
|
|
91
|
+
if (!toOnFieldA && toOnFieldB) return -1;
|
|
92
|
+
return a.sort - b.sort;
|
|
93
|
+
});
|
|
94
|
+
return fields.map((field)=>{
|
|
86
95
|
var _field_uiSchema;
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
if (!field.interface) return null;
|
|
97
|
+
const fieldInterface = getInterface(field.interface);
|
|
98
|
+
if (!(null == fieldInterface ? void 0 : fieldInterface.sortable) && !toOneField(field)) return null;
|
|
99
|
+
if (!(null == fieldInterface ? void 0 : fieldInterface.sortable) && depth >= 2) return null;
|
|
100
|
+
if (field.target === collectionName) return null;
|
|
101
|
+
const value = parentFieldName ? "".concat(parentFieldName, ".").concat(field.name) : field.name;
|
|
102
|
+
const currentLabel = (null == field ? void 0 : null === (_field_uiSchema = field.uiSchema) || void 0 === _field_uiSchema ? void 0 : _field_uiSchema.title) || field.name;
|
|
103
|
+
let fullLabel = '';
|
|
104
|
+
if (parentLabel) {
|
|
105
|
+
if (parentLabel.includes('{{') || currentLabel.includes('{{')) {
|
|
106
|
+
const formatLabel = (label)=>label.includes('{{t(') ? "t(".concat(label.slice(4, -3), ")") : label.includes('{{') ? "t(".concat(label.slice(2, -2), ")") : '"'.concat(label, '"');
|
|
107
|
+
let formattedParentLabel = formatLabel(parentLabel);
|
|
108
|
+
const formattedCurrentLabel = formatLabel(currentLabel);
|
|
109
|
+
fullLabel = "{{t(".concat(formattedParentLabel, ' + "/" + ').concat(formattedCurrentLabel, ")}}");
|
|
110
|
+
} else fullLabel = "".concat(parentLabel, " / ").concat(currentLabel);
|
|
111
|
+
} else fullLabel = currentLabel;
|
|
112
|
+
const option = {
|
|
113
|
+
label: currentLabel,
|
|
114
|
+
fullLabel,
|
|
115
|
+
value
|
|
90
116
|
};
|
|
91
|
-
|
|
117
|
+
if (field.target) option.children = useSortFields(field.target, depth + 1, value, fullLabel);
|
|
118
|
+
return option;
|
|
119
|
+
}).filter(Boolean);
|
|
92
120
|
};
|
|
93
121
|
const useChildrenCollections = (collectionName)=>{
|
|
94
122
|
const { getChildrenCollections } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCollectionManager_deprecated)();
|
package/es/icon/preloaded.mjs
CHANGED
|
@@ -36,7 +36,7 @@ const Approval = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runti
|
|
|
36
36
|
]
|
|
37
37
|
});
|
|
38
38
|
const ApprovalNew = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("svg", {
|
|
39
|
-
|
|
39
|
+
fillRule: "evenodd",
|
|
40
40
|
viewBox: "0 0 34 34",
|
|
41
41
|
focusable: "false",
|
|
42
42
|
fill: "currentColor",
|
|
@@ -51,7 +51,7 @@ const ApprovalNew = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_ru
|
|
|
51
51
|
id: "Ellipse 42",
|
|
52
52
|
d: "M16.8963 7C14.6872 7 12.8963 8.79086 12.8963 11C12.8963 12.2907 13.5076 13.4385 14.4564 14.1699C14.7966 14.4322 15.018 14.8415 14.9526 15.266L14.6723 17.0856C14.5972 17.5734 14.1774 17.9334 13.6839 17.9334H10.999C10.4467 17.9334 9.99902 18.3811 9.99902 18.9334V22.012",
|
|
53
53
|
stroke: "white",
|
|
54
|
-
|
|
54
|
+
strokeWidth: "1.5"
|
|
55
55
|
}),
|
|
56
56
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("path", {
|
|
57
57
|
id: "Ellipse 43",
|
|
@@ -62,8 +62,8 @@ const ApprovalNew = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_ru
|
|
|
62
62
|
id: "Vector 5",
|
|
63
63
|
d: "M10.0479 25.0195H23.7546",
|
|
64
64
|
stroke: "white",
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
strokeWidth: "1.5",
|
|
66
|
+
strokeLinecap: "round"
|
|
67
67
|
})
|
|
68
68
|
]
|
|
69
69
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AssociateActionInitializer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../application/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_items_ActionInitializer_mjs__ from "../../../schema-initializer/items/ActionInitializer.mjs";
|
|
5
|
+
const AssociateActionInitializer = ()=>{
|
|
6
|
+
const schema = {
|
|
7
|
+
type: 'void',
|
|
8
|
+
'x-action': 'associate',
|
|
9
|
+
'x-acl-action': 'associate',
|
|
10
|
+
title: "{{t('Associate')}}",
|
|
11
|
+
'x-toolbar': 'ActionSchemaToolbar',
|
|
12
|
+
'x-settings': 'actionSettings:associate',
|
|
13
|
+
'x-component': 'Action',
|
|
14
|
+
'x-component-props': {
|
|
15
|
+
actionType: 'associations',
|
|
16
|
+
openMode: 'drawer',
|
|
17
|
+
type: 'primary',
|
|
18
|
+
icon: 'PlusOutlined'
|
|
19
|
+
},
|
|
20
|
+
properties: {
|
|
21
|
+
drawer: {
|
|
22
|
+
type: 'void',
|
|
23
|
+
title: '{{ t("Select record") }}',
|
|
24
|
+
'x-component': 'Action.Container',
|
|
25
|
+
'x-component-props': {
|
|
26
|
+
className: 'nb-record-picker-selector'
|
|
27
|
+
},
|
|
28
|
+
'x-decorator': 'AssociateActionProvider',
|
|
29
|
+
properties: {
|
|
30
|
+
grid: {
|
|
31
|
+
type: 'void',
|
|
32
|
+
'x-component': 'Grid',
|
|
33
|
+
'x-initializer': 'popup:tableSelector:addBlock',
|
|
34
|
+
properties: {}
|
|
35
|
+
},
|
|
36
|
+
footer: {
|
|
37
|
+
'x-component': 'Action.Container.Footer',
|
|
38
|
+
'x-component-props': {},
|
|
39
|
+
properties: {
|
|
40
|
+
actions: {
|
|
41
|
+
type: 'void',
|
|
42
|
+
'x-component': 'ActionBar',
|
|
43
|
+
'x-component-props': {},
|
|
44
|
+
properties: {
|
|
45
|
+
submit: {
|
|
46
|
+
title: '{{ t("Submit") }}',
|
|
47
|
+
'x-action': 'submit',
|
|
48
|
+
'x-component': 'Action',
|
|
49
|
+
'x-use-component-props': 'usePickActionProps',
|
|
50
|
+
'x-toolbar': 'ActionSchemaToolbar',
|
|
51
|
+
'x-settings': 'actionSettings:submit',
|
|
52
|
+
'x-component-props': {
|
|
53
|
+
type: 'primary',
|
|
54
|
+
htmlType: 'submit'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const itemConfig = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializerItem)();
|
|
66
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_initializer_items_ActionInitializer_mjs__.ActionInitializer, {
|
|
67
|
+
item: itemConfig,
|
|
68
|
+
schema: schema
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export { AssociateActionInitializer };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AssociateActionProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
onChange?: (selectedRows: any[]) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const AssociateActionProvider: (props: AssociateActionProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
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__index_mjs__ from "../../../index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_TableSelectorProvider_mjs__ from "../../../block-provider/TableSelectorProvider.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_record_picker_index_mjs__ from "../../../schema-component/antd/record-picker/index.mjs";
|
|
6
|
+
const useTableSelectorProps = ()=>{
|
|
7
|
+
const { setSelectedRows } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__schema_component_antd_record_picker_index_mjs__.RecordPickerContext);
|
|
8
|
+
const { onRowSelectionChange, rowKey = 'id', ...others } = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_TableSelectorProvider_mjs__.useTableSelectorProps)();
|
|
9
|
+
return {
|
|
10
|
+
...others,
|
|
11
|
+
rowKey,
|
|
12
|
+
rowSelection: {
|
|
13
|
+
type: 'checkbox'
|
|
14
|
+
},
|
|
15
|
+
onRowSelectionChange (selectedRowKeys, selectedRows) {
|
|
16
|
+
null == setSelectedRows || setSelectedRows(selectedRowKeys);
|
|
17
|
+
null == onRowSelectionChange || onRowSelectionChange(selectedRowKeys, selectedRows);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
const AssociateActionProvider = (props)=>{
|
|
22
|
+
const [selectedRows, setSelectedRows] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)([]);
|
|
23
|
+
const collection = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCollection)();
|
|
24
|
+
const { resource, service, block, __parent } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useBlockRequestContext)();
|
|
25
|
+
const pickerProps = {
|
|
26
|
+
size: 'small',
|
|
27
|
+
onChange: null == props ? void 0 : props.onChange,
|
|
28
|
+
selectedRows,
|
|
29
|
+
setSelectedRows
|
|
30
|
+
};
|
|
31
|
+
const usePickActionProps = ()=>{
|
|
32
|
+
const { selectedRows } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__schema_component_antd_record_picker_index_mjs__.RecordPickerContext);
|
|
33
|
+
const { setVisible, setFormValueChanged } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useActionContext)();
|
|
34
|
+
return {
|
|
35
|
+
async onClick (e, callBack) {
|
|
36
|
+
await resource.add({
|
|
37
|
+
values: selectedRows
|
|
38
|
+
});
|
|
39
|
+
null == callBack || callBack();
|
|
40
|
+
null == setVisible || setVisible(false);
|
|
41
|
+
if (block && 'TableField' !== block) {
|
|
42
|
+
var __parent_service_refresh, __parent_service;
|
|
43
|
+
null == __parent || null === (__parent_service = __parent.service) || void 0 === __parent_service || null === (__parent_service_refresh = __parent_service.refresh) || void 0 === __parent_service_refresh || __parent_service_refresh.call(__parent_service);
|
|
44
|
+
null == setFormValueChanged || setFormValueChanged(false);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const getFilter = ()=>{
|
|
50
|
+
var _service_data;
|
|
51
|
+
const targetKey = (null == collection ? void 0 : collection.filterTargetKey) || 'id';
|
|
52
|
+
if (null === (_service_data = service.data) || void 0 === _service_data ? void 0 : _service_data.data) {
|
|
53
|
+
var _service_data1;
|
|
54
|
+
const list = null === (_service_data1 = service.data) || void 0 === _service_data1 ? void 0 : _service_data1.data.map((option)=>option[targetKey]).filter(Boolean);
|
|
55
|
+
const filter = list.length ? {
|
|
56
|
+
$and: [
|
|
57
|
+
{
|
|
58
|
+
["".concat(targetKey, ".$ne")]: list
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
} : {};
|
|
62
|
+
return filter;
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_component_antd_record_picker_index_mjs__.RecordPickerProvider, {
|
|
67
|
+
...pickerProps,
|
|
68
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.SchemaComponentOptions, {
|
|
69
|
+
scope: {
|
|
70
|
+
useTableSelectorProps,
|
|
71
|
+
usePickActionProps
|
|
72
|
+
},
|
|
73
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__block_provider_TableSelectorProvider_mjs__.TableSelectorParamsProvider, {
|
|
74
|
+
params: {
|
|
75
|
+
filter: getFilter()
|
|
76
|
+
},
|
|
77
|
+
children: props.children
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
export { AssociateActionProvider };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../application/index.mjs";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../application/schema-settings/SchemaSettings.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../collection-manager/index.mjs";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_Action_Designer_mjs__ from "../../../schema-component/antd/action/Action.Designer.mjs";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_items_index_mjs__ from "../../../schema-items/index.mjs";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettings_mjs__ from "../../../schema-settings/SchemaSettings.mjs";
|
|
8
|
+
const associateActionSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
|
|
9
|
+
name: 'actionSettings:associate',
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
name: 'editButton',
|
|
13
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_Action_Designer_mjs__.ButtonEditor,
|
|
14
|
+
useComponentProps () {
|
|
15
|
+
const { buttonEditorProps } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaToolbar)();
|
|
16
|
+
return buttonEditorProps;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'openMode',
|
|
21
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_items_index_mjs__.SchemaSettingOpenModeSchemaItems,
|
|
22
|
+
componentProps: {
|
|
23
|
+
openMode: true,
|
|
24
|
+
openSize: true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'enableChildCollections',
|
|
29
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettings_mjs__.SchemaSettingsEnableChildCollections,
|
|
30
|
+
useComponentProps () {
|
|
31
|
+
const { name } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollection_deprecated)();
|
|
32
|
+
return {
|
|
33
|
+
collectionName: name
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
useVisible () {
|
|
37
|
+
const { name } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollection_deprecated)();
|
|
38
|
+
const { getChildrenCollections } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollectionManager_deprecated)();
|
|
39
|
+
const isChildCollectionAction = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>getChildrenCollections(name).length > 0, [
|
|
40
|
+
getChildrenCollections,
|
|
41
|
+
name
|
|
42
|
+
]);
|
|
43
|
+
return isChildCollectionAction;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'delete',
|
|
48
|
+
sort: 100,
|
|
49
|
+
Component: __WEBPACK_EXTERNAL_MODULE__schema_component_antd_action_Action_Designer_mjs__.RemoveButton,
|
|
50
|
+
useComponentProps () {
|
|
51
|
+
const { removeButtonProps } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaToolbar)();
|
|
52
|
+
return removeButtonProps;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
export { associateActionSettings };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../../application/index.mjs";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../../../../collection-manager/index.mjs";
|
|
@@ -34,23 +35,27 @@ const RecordFormBlockInitializer = ()=>{
|
|
|
34
35
|
};
|
|
35
36
|
function useCreateEditFormBlock() {
|
|
36
37
|
const { insert } = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useSchemaInitializer)();
|
|
38
|
+
const cm = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useCollectionManager)();
|
|
39
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
40
|
+
const actionType = null == fieldSchema ? void 0 : fieldSchema['actionType'];
|
|
37
41
|
const association = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useAssociationName)();
|
|
38
42
|
const createEditFormBlock = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((param)=>{
|
|
39
43
|
let { item } = param;
|
|
40
|
-
const
|
|
41
|
-
|
|
44
|
+
const field = item.associationField;
|
|
45
|
+
const collectionName = (null == field ? void 0 : field.target) ? cm.getCollection(field.target).name : item.collectionName || item.name;
|
|
46
|
+
if (item.associationField) {
|
|
42
47
|
const field = item.associationField;
|
|
43
48
|
insert((0, __WEBPACK_EXTERNAL_MODULE__createEditFormBlockUISchema_mjs__.createEditFormBlockUISchema)({
|
|
44
49
|
dataSource: item.dataSource,
|
|
45
50
|
association: "".concat(field.collectionName, ".").concat(field.name)
|
|
46
51
|
}));
|
|
47
|
-
} else insert((0, __WEBPACK_EXTERNAL_MODULE__createEditFormBlockUISchema_mjs__.createEditFormBlockUISchema)(association ? {
|
|
52
|
+
} else insert((0, __WEBPACK_EXTERNAL_MODULE__createEditFormBlockUISchema_mjs__.createEditFormBlockUISchema)(association && !actionType ? {
|
|
48
53
|
association,
|
|
49
54
|
dataSource: item.dataSource,
|
|
50
55
|
isCurrent: true
|
|
51
56
|
} : {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
dataSource: item.dataSource,
|
|
58
|
+
collectionName
|
|
54
59
|
}));
|
|
55
60
|
}, [
|
|
56
61
|
association,
|
|
@@ -60,16 +65,18 @@ function useCreateEditFormBlock() {
|
|
|
60
65
|
let { item } = param;
|
|
61
66
|
if ('FormItem' !== item.template.componentName) return templateSchema;
|
|
62
67
|
{
|
|
63
|
-
const
|
|
64
|
-
association,
|
|
65
|
-
dataSource: item.dataSource,
|
|
66
|
-
templateSchema: templateSchema,
|
|
67
|
-
isCurrent: true
|
|
68
|
-
} : {
|
|
69
|
-
collectionName: item.collectionName || item.name,
|
|
68
|
+
const options = {
|
|
70
69
|
dataSource: item.dataSource,
|
|
71
|
-
templateSchema
|
|
72
|
-
}
|
|
70
|
+
templateSchema
|
|
71
|
+
};
|
|
72
|
+
if (item.associationField) {
|
|
73
|
+
const field = item.associationField;
|
|
74
|
+
options.association = "".concat(field.collectionName, ".").concat(field.name);
|
|
75
|
+
} else if (association) {
|
|
76
|
+
options.association = association;
|
|
77
|
+
options.isCurrent = true;
|
|
78
|
+
} else options.collectionName = item.collectionName || item.name;
|
|
79
|
+
const blockSchema = (0, __WEBPACK_EXTERNAL_MODULE__createEditFormBlockUISchema_mjs__.createEditFormBlockUISchema)(options);
|
|
73
80
|
if ('reference' === item.mode) blockSchema['x-template-key'] = item.template.key;
|
|
74
81
|
return blockSchema;
|
|
75
82
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ISchema } from '@tachybase/schema';
|
|
2
|
-
interface EditFormBlockOptions {
|
|
2
|
+
export interface EditFormBlockOptions {
|
|
3
3
|
dataSource: string;
|
|
4
4
|
/** 如果传了 association 就不需要再传 collectionName 了 */
|
|
5
5
|
collectionName?: string;
|
|
@@ -11,4 +11,3 @@ interface EditFormBlockOptions {
|
|
|
11
11
|
isCurrent?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare function createEditFormBlockUISchema(options: EditFormBlockOptions): ISchema;
|
|
14
|
-
export {};
|
|
@@ -44,6 +44,21 @@ const tableActionInitializers = new __WEBPACK_EXTERNAL_MODULE__application_schem
|
|
|
44
44
|
].includes(collection.template) || (null == collection ? void 0 : collection.writableView);
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
type: 'item',
|
|
49
|
+
title: "{{t('Associate')}}",
|
|
50
|
+
name: 'associate',
|
|
51
|
+
Component: 'AssociateActionInitializer',
|
|
52
|
+
useVisible () {
|
|
53
|
+
const collection = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useCollection)();
|
|
54
|
+
const props = (0, __WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.useDataBlockProps)();
|
|
55
|
+
return props.association && (![
|
|
56
|
+
'view',
|
|
57
|
+
'file',
|
|
58
|
+
'sql'
|
|
59
|
+
].includes(collection.template) || (null == collection ? void 0 : collection.writableView));
|
|
60
|
+
}
|
|
61
|
+
},
|
|
47
62
|
{
|
|
48
63
|
type: 'item',
|
|
49
64
|
title: "{{t('Delete')}}",
|
|
@@ -112,12 +112,12 @@ const tableColumnSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_se
|
|
|
112
112
|
name: 'sortable',
|
|
113
113
|
type: 'switch',
|
|
114
114
|
useVisible () {
|
|
115
|
-
|
|
115
|
+
(0, __WEBPACK_EXTERNAL_MODULE__data_source_collection_CollectionProvider_mjs__.useCollection)();
|
|
116
116
|
const { collectionField } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__.useColumnSchema)();
|
|
117
117
|
const { getInterface } = (0, __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__.useCollectionManager_deprecated)();
|
|
118
118
|
const interfaceCfg = getInterface(null == collectionField ? void 0 : collectionField.interface);
|
|
119
119
|
const { currentMode } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_antd_association_field_hooks_mjs__.useAssociationFieldContext)();
|
|
120
|
-
return (null == interfaceCfg ? void 0 : interfaceCfg.sortable) === true && !currentMode
|
|
120
|
+
return (null == interfaceCfg ? void 0 : interfaceCfg.sortable) === true && !currentMode;
|
|
121
121
|
},
|
|
122
122
|
useComponentProps () {
|
|
123
123
|
const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
|
|
@@ -24,6 +24,10 @@ const radioComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_s
|
|
|
24
24
|
{
|
|
25
25
|
label: t('Radio group'),
|
|
26
26
|
value: 'Radio group'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
label: t('Select'),
|
|
30
|
+
value: 'Select'
|
|
27
31
|
}
|
|
28
32
|
];
|
|
29
33
|
const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
|