@tachybase/client 1.5.1 → 1.6.1
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/PluginManager.mjs +9 -1
- package/es/application/WebSocketClient.d.ts +19 -0
- package/es/application/WebSocketClient.mjs +26 -6
- package/es/application/utils/remotePlugins.mjs +8 -2
- package/es/built-in/attachment-preview/previewers/file-sheet.mjs +1 -1
- package/es/built-in/pm/PluginDetail.mjs +1 -1
- package/es/collection-manager/Configuration/components/index.mjs +3 -3
- package/es/collection-manager/interfaces/components/index.mjs +2 -2
- package/es/collection-manager/interfaces/properties/operators.mjs +3 -3
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/useOptimizedMemo.d.ts +25 -0
- package/es/hooks/useOptimizedMemo.mjs +30 -0
- package/es/locale/index.mjs +47 -47
- package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +4 -1
- package/es/schema-component/antd/AntdSchemaComponentProvider.mjs +3 -1
- package/es/schema-component/antd/__builtins__/hooks/usePrefixCls.mjs +1 -1
- package/es/schema-component/antd/action/Action.Area.style.mjs +1 -1
- package/es/schema-component/antd/action/Action.Designer.mjs +1 -1
- package/es/schema-component/antd/action/Action.mjs +3 -2
- package/es/schema-component/antd/action/hooks/useCompiledAction.d.ts +7 -0
- package/es/schema-component/antd/action/hooks/useCompiledAction.mjs +35 -0
- package/es/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.mjs +14 -4
- package/es/schema-component/antd/association-field/AssociationSelect.mjs +1 -1
- package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +1 -1
- package/es/schema-component/antd/association-field/SubTabs/styles.mjs +1 -1
- package/es/schema-component/antd/block-item/BlockToolbar.mjs +16 -16
- package/es/schema-component/antd/grid-card/options.mjs +3 -3
- package/es/schema-component/antd/input/ReadPretty.mjs +1 -3
- package/es/schema-component/antd/menu/Menu.styles.mjs +1 -1
- package/es/schema-component/antd/menu/MenuSearchAdd.style.mjs +1 -1
- package/es/schema-component/antd/page/Page.mjs +3 -0
- package/es/schema-component/antd/page/Page.style.mjs +1 -1
- package/es/schema-component/antd/table/Table.Array.mjs +1 -0
- package/es/schema-component/antd/table/Table.Column.Designer.mjs +5 -5
- package/es/schema-component/antd/table/Table.Void.Designer.mjs +4 -4
- package/es/schema-component/antd/table-v2/EnabledToggle.d.ts +9 -0
- package/es/schema-component/antd/table-v2/EnabledToggle.mjs +72 -0
- package/es/schema-component/antd/table-v2/Table.styles.mjs +1 -1
- package/es/schema-component/antd/table-v2/index.d.ts +1 -0
- package/es/schema-component/antd/table-v2/index.mjs +1 -0
- package/es/schema-component/antd/variable/CodeMirror.mjs +1 -1
- package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +1 -1
- package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +1 -1
- package/es/schema-templates/BlockTemplateDetails.mjs +1 -1
- package/es/user/ChangePassword.mjs +1 -1
- package/lib/application/PluginManager.js +9 -1
- package/lib/application/WebSocketClient.js +26 -6
- package/lib/application/utils/remotePlugins.js +8 -2
- package/lib/built-in/attachment-preview/previewers/file-sheet.js +1 -1
- package/lib/built-in/pm/PluginDetail.js +1 -1
- package/lib/collection-manager/Configuration/components/index.js +3 -3
- package/lib/collection-manager/interfaces/components/index.js +2 -2
- package/lib/collection-manager/interfaces/properties/operators.js +3 -3
- package/lib/hooks/index.js +12 -3
- package/lib/hooks/useOptimizedMemo.js +74 -0
- package/lib/locale/en_US.js +1 -0
- package/lib/locale/es_ES.js +1 -0
- package/lib/locale/fr_FR.js +1 -0
- package/lib/locale/ko_KR.js +1 -0
- package/lib/locale/pt_BR.js +1 -0
- package/lib/locale/uk_UA.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +4 -1
- package/lib/schema-component/antd/AntdSchemaComponentProvider.js +3 -1
- package/lib/schema-component/antd/__builtins__/hooks/usePrefixCls.js +1 -1
- package/lib/schema-component/antd/action/Action.Area.style.js +1 -1
- package/lib/schema-component/antd/action/Action.Designer.js +1 -1
- package/lib/schema-component/antd/action/Action.js +3 -2
- package/lib/schema-component/antd/action/hooks/useCompiledAction.js +69 -0
- package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.js +14 -4
- package/lib/schema-component/antd/association-field/AssociationSelect.js +1 -1
- package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
- package/lib/schema-component/antd/association-field/SubTabs/styles.js +1 -1
- package/lib/schema-component/antd/block-item/BlockToolbar.js +16 -16
- package/lib/schema-component/antd/grid-card/options.js +3 -3
- package/lib/schema-component/antd/input/ReadPretty.js +1 -3
- package/lib/schema-component/antd/menu/Menu.styles.js +1 -1
- package/lib/schema-component/antd/menu/MenuSearchAdd.style.js +1 -1
- package/lib/schema-component/antd/page/Page.js +3 -0
- package/lib/schema-component/antd/page/Page.style.js +1 -1
- package/lib/schema-component/antd/table/Table.Array.js +1 -0
- package/lib/schema-component/antd/table/Table.Column.Designer.js +5 -5
- package/lib/schema-component/antd/table/Table.Void.Designer.js +4 -4
- package/lib/schema-component/antd/table-v2/EnabledToggle.js +106 -0
- package/lib/schema-component/antd/table-v2/Table.styles.js +1 -1
- package/lib/schema-component/antd/table-v2/index.js +13 -0
- package/lib/schema-component/antd/variable/CodeMirror.js +1 -1
- package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +1 -1
- package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +1 -1
- package/lib/schema-templates/BlockTemplateDetails.js +1 -1
- package/lib/user/ChangePassword.js +1 -1
- package/package.json +4 -4
|
@@ -9,7 +9,11 @@ function usePropsCollection(param) {
|
|
|
9
9
|
return collection;
|
|
10
10
|
}
|
|
11
11
|
function loadChildren(option) {
|
|
12
|
-
|
|
12
|
+
var _this_needLeaf;
|
|
13
|
+
const needLeaf = null != (_this_needLeaf = this.needLeaf) ? _this_needLeaf : false;
|
|
14
|
+
const result = getCollectionFieldOptions.call(this, option.field.target, option, {
|
|
15
|
+
needLeaf
|
|
16
|
+
});
|
|
13
17
|
if (result.length) {
|
|
14
18
|
if (!result.some((item)=>isAssociation(item.field))) option.isLeaf = true;
|
|
15
19
|
} else option.isLeaf = true;
|
|
@@ -29,13 +33,18 @@ function getCollectionFieldOptions(collection, parentNode) {
|
|
|
29
33
|
const [dataSourceName, collectionName] = parseCollectionName(collection);
|
|
30
34
|
const rawFields = this.getCollectionFields(collectionName, dataSourceName);
|
|
31
35
|
const fields = needLeaf ? rawFields : rawFields.filter(isAssociation);
|
|
32
|
-
const boundLoadChildren = loadChildren.bind(
|
|
36
|
+
const boundLoadChildren = loadChildren.bind({
|
|
37
|
+
...this,
|
|
38
|
+
needLeaf
|
|
39
|
+
});
|
|
33
40
|
return fields.filter(this.filter).map((field)=>{
|
|
34
41
|
var _field_uiSchema;
|
|
35
42
|
const key = parentNode ? "".concat(parentNode.value ? "".concat(parentNode.value, ".") : '').concat(field.name) : field.name;
|
|
36
43
|
var _this_compile;
|
|
37
44
|
const fieldTitle = null != (_this_compile = this.compile(null == (_field_uiSchema = field.uiSchema) ? void 0 : _field_uiSchema.title)) ? _this_compile : field.name;
|
|
38
|
-
const
|
|
45
|
+
const targetFields = field.target ? this.getCollectionFields(field.target) : [];
|
|
46
|
+
const availableFields = needLeaf ? targetFields : targetFields.filter(isAssociation);
|
|
47
|
+
const isLeaf = !availableFields.filter(this.filter).length;
|
|
39
48
|
var _parentNode_key;
|
|
40
49
|
return {
|
|
41
50
|
pId: null != (_parentNode_key = null == parentNode ? void 0 : parentNode.key) ? _parentNode_key : null,
|
|
@@ -99,7 +108,8 @@ const AppendsTreeSelectV2 = (props)=>{
|
|
|
99
108
|
const tData = null === propsLoadData ? [] : getCollectionFieldOptions.call({
|
|
100
109
|
compile,
|
|
101
110
|
getCollectionFields,
|
|
102
|
-
filter
|
|
111
|
+
filter,
|
|
112
|
+
needLeaf
|
|
103
113
|
}, collectionString, parentNode, {
|
|
104
114
|
needLeaf
|
|
105
115
|
});
|
|
@@ -75,7 +75,7 @@ const InternaDrawerSubTable = observer((props)=>{
|
|
|
75
75
|
extra: /*#__PURE__*/ jsx(Button, {
|
|
76
76
|
type: "primary",
|
|
77
77
|
onClick: ()=>setVisible(false),
|
|
78
|
-
children: "
|
|
78
|
+
children: "确认"
|
|
79
79
|
}),
|
|
80
80
|
children: /*#__PURE__*/ jsx(FlagProvider, {
|
|
81
81
|
isInSubForm: true,
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n display: flex;\n flex-direction: row;\n max-height: 30vh;\n .left-pane {\n padding: 2px;\n display: flex;\n font-weight: 500;\n flex-direction: column;\n width: 100px;\n overflow-y: auto;\n /*
|
|
12
|
+
"\n display: flex;\n flex-direction: row;\n max-height: 30vh;\n .left-pane {\n padding: 2px;\n display: flex;\n font-weight: 500;\n flex-direction: column;\n width: 100px;\n overflow-y: auto;\n /* 隐藏滚动条 微软/火狐 */\n -ms-overflow-style: none;\n scrollbar-width: none;\n border-right: 2px solid #d4d4d4;\n padding: 2px;\n margin-right: 5px;\n div {\n background-color: #ffffff;\n white-space: normal;\n cursor: pointer;\n margin: 5px 0 5px;\n }\n div:last-of-type {\n margin-bottom: 0;\n }\n }\n /* 隐藏滚动条 谷歌浏览器 */\n .left-pane::-webkit-scrollbar {\n display: none;\n }\n\n .right-pane {\n padding: 2px;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n flex: 1;\n div {\n margin-bottom: 1em;\n .ant-btn {\n margin-right: 2px;\n }\n }\n div:last-of-type {\n margin-bottom: 0;\n }\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -5,60 +5,60 @@ import { message } from "antd";
|
|
|
5
5
|
const defaultItems = [
|
|
6
6
|
{
|
|
7
7
|
icon: /*#__PURE__*/ jsx(FullscreenOutlined, {}),
|
|
8
|
-
title:
|
|
8
|
+
title: '全屏'
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
icon: /*#__PURE__*/ jsx(UndoOutlined, {}),
|
|
12
|
-
title:
|
|
12
|
+
title: '撤销'
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
icon: /*#__PURE__*/ jsx(RedoOutlined, {}),
|
|
16
|
-
title:
|
|
16
|
+
title: '重做'
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
icon: /*#__PURE__*/ jsx(DeleteOutlined, {}),
|
|
20
|
-
title:
|
|
20
|
+
title: '删除'
|
|
21
21
|
}
|
|
22
22
|
];
|
|
23
23
|
const customItems = [
|
|
24
24
|
{
|
|
25
25
|
icon: /*#__PURE__*/ jsx(CopyOutlined, {}),
|
|
26
26
|
placement: 'bottom',
|
|
27
|
-
title:
|
|
27
|
+
title: '复制'
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
icon: /*#__PURE__*/ jsx(ZoomInOutlined, {}),
|
|
31
|
-
title:
|
|
31
|
+
title: '放大!'
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
icon: /*#__PURE__*/ jsx(ZoomOutOutlined, {}),
|
|
35
35
|
style: {
|
|
36
36
|
color: '#1890ff'
|
|
37
37
|
},
|
|
38
|
-
title:
|
|
38
|
+
title: '缩小!'
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
type: 'divider'
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
icon: /*#__PURE__*/ jsx(DragOutlined, {}),
|
|
45
|
-
title:
|
|
45
|
+
title: '快速定位'
|
|
46
46
|
}
|
|
47
47
|
];
|
|
48
48
|
const dropdownMenuItems = [
|
|
49
49
|
{
|
|
50
50
|
icon: /*#__PURE__*/ jsx(CopyOutlined, {}),
|
|
51
51
|
onClick: ()=>{
|
|
52
|
-
message.info(
|
|
52
|
+
message.info('复制!');
|
|
53
53
|
},
|
|
54
|
-
label:
|
|
54
|
+
label: '复制'
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
icon: /*#__PURE__*/ jsx(ZoomInOutlined, {}),
|
|
58
58
|
onClick: ()=>{
|
|
59
|
-
message.success(
|
|
59
|
+
message.success('放大!');
|
|
60
60
|
},
|
|
61
|
-
label:
|
|
61
|
+
label: '放大!'
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
icon: /*#__PURE__*/ jsx(ZoomOutOutlined, {}),
|
|
@@ -66,9 +66,9 @@ const dropdownMenuItems = [
|
|
|
66
66
|
color: '#1890ff'
|
|
67
67
|
},
|
|
68
68
|
onClick: ()=>{
|
|
69
|
-
message.success(
|
|
69
|
+
message.success('缩小!');
|
|
70
70
|
},
|
|
71
|
-
label:
|
|
71
|
+
label: '缩小!'
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
type: 'divider'
|
|
@@ -76,9 +76,9 @@ const dropdownMenuItems = [
|
|
|
76
76
|
{
|
|
77
77
|
icon: /*#__PURE__*/ jsx(DragOutlined, {}),
|
|
78
78
|
onClick: ()=>{
|
|
79
|
-
message.loading(
|
|
79
|
+
message.loading('快速定位ing');
|
|
80
80
|
},
|
|
81
|
-
label:
|
|
81
|
+
label: '快速定位'
|
|
82
82
|
}
|
|
83
83
|
];
|
|
84
84
|
const BlockToolbar = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx("div", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { useFieldSchema } from "@tachybase/schema";
|
|
4
|
-
import { css } from "@emotion/css";
|
|
5
4
|
import { usePrefixCls } from "@tego/client";
|
|
5
|
+
import { css } from "@emotion/css";
|
|
6
6
|
import { Image, Typography } from "antd";
|
|
7
7
|
import classnames from "classnames";
|
|
8
8
|
import { useCompile } from "../../index.mjs";
|
|
@@ -32,8 +32,6 @@ const _Input = (props)=>{
|
|
|
32
32
|
return /*#__PURE__*/ jsxs("div", {
|
|
33
33
|
className: classnames(prefixCls, props.className),
|
|
34
34
|
style: {
|
|
35
|
-
display: 'flex',
|
|
36
|
-
alignItems: 'center',
|
|
37
35
|
overflowWrap: 'break-word',
|
|
38
36
|
whiteSpace: 'normal',
|
|
39
37
|
...props.style
|
|
@@ -28,7 +28,7 @@ function _templateObject1() {
|
|
|
28
28
|
function _templateObject2() {
|
|
29
29
|
const data = _tagged_template_literal([
|
|
30
30
|
"\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n .ant-menu-submenu.ant-menu-submenu-inline .ant-menu-submenu-title {\n position: relative;\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: ",
|
|
31
|
-
";\n\n /*
|
|
31
|
+
";\n\n /* 使用 clip-path 裁剪为梯形 */\n clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);\n }\n }\n\n .ant-menu-submenu.ant-menu-submenu-inline.ant-menu-submenu-open > .ant-menu-submenu-title {\n ::before {\n background-color: ",
|
|
32
32
|
";\n }\n }\n\n .ant-menu-item,\n .ant-menu-submenu-title {\n padding-inline-end: 10px;\n }\n\n .ant-menu-submenu-title {\n .ant-menu-title-content {\n > div {\n > .general-schema-designer {\n right: 6px !important;\n }\n > span.anticon {\n margin-right: 10px;\n }\n }\n }\n }\n "
|
|
33
33
|
]);
|
|
34
34
|
_templateObject2 = function() {
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n /* NOTE:
|
|
12
|
+
"\n /* NOTE: 这里的样式是为了让搜索框的样式, 避免上层 antd 写死的 padding-left: 24px 的影响 */\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n\n /* NOTE: 放这三个样式是为了提升选择器优先级, 覆盖掉 antd 的默认样式 */\n .ant-input-outlined.ant-input-outlined.ant-input-outlined {\n background-color: #f9f9f9;\n border-radius: 5px;\n border: none;\n box-shadow: none;\n }\n\n /* 移除 antd 默认的后置搜索图标 */\n .ant-input-group-addon {\n display: none;\n }\n\n .menu-add-wrapper {\n .ant-dropdown-trigger {\n display: grid;\n place-items: center;\n\n width: 30px;\n /* 这里是为了和前边元素保持对齐, antd 组件写死了高度 */\n height: 28px;\n\n cursor: pointer;\n\n :hover,\n :active {\n border-radius: 5px;\n color: #ffffff;\n background-color: #f4f4f4;\n }\n }\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n .ant-tabs-nav-wrap.ant-tabs-nav-wrap {\n flex: none;\n }\n .ant-tabs-tab.ant-tabs-tab.ant-tabs-tab {\n
|
|
12
|
+
"\n .ant-tabs-nav-wrap.ant-tabs-nav-wrap {\n flex: none;\n }\n .ant-tabs-tab.ant-tabs-tab.ant-tabs-tab {\n border: none;\n background-color: #ffffff;\n }\n\n .ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active.ant-tabs-tab-active {\n border-radius: 8px 8px 0 0;\n box-shadow: none;\n text-shadow: none;\n background-color: var(--tb-box-bg);\n }\n .ant-tabs-extra-content {\n flex: 1;\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -33,9 +33,9 @@ const TableColumnDesigner = (props)=>{
|
|
|
33
33
|
return /*#__PURE__*/ jsxs(GeneralSchemaDesigner, {
|
|
34
34
|
children: [
|
|
35
35
|
/*#__PURE__*/ jsx(SchemaSettingsPopupItem, {
|
|
36
|
-
title:
|
|
36
|
+
title: '编辑',
|
|
37
37
|
schema: {
|
|
38
|
-
title:
|
|
38
|
+
title: '编辑字段',
|
|
39
39
|
'x-component': 'Action.Modal',
|
|
40
40
|
'x-component-props': {
|
|
41
41
|
width: 520
|
|
@@ -49,9 +49,9 @@ const TableColumnDesigner = (props)=>{
|
|
|
49
49
|
title: {
|
|
50
50
|
'x-decorator': 'FormItem',
|
|
51
51
|
'x-component': 'Input',
|
|
52
|
-
title:
|
|
52
|
+
title: '字段标题',
|
|
53
53
|
'x-component-props': {},
|
|
54
|
-
description: "
|
|
54
|
+
description: "原字段标题:".concat(null == collectionField ? void 0 : null == (_collectionField_uiSchema = collectionField.uiSchema) ? void 0 : _collectionField_uiSchema.title)
|
|
55
55
|
},
|
|
56
56
|
footer: {
|
|
57
57
|
type: 'void',
|
|
@@ -107,7 +107,7 @@ const TableColumnDesigner = (props)=>{
|
|
|
107
107
|
}
|
|
108
108
|
}),
|
|
109
109
|
(null == collectionField ? void 0 : collectionField.target) && /*#__PURE__*/ jsx(SchemaSettingsSelectItem, {
|
|
110
|
-
title:
|
|
110
|
+
title: '标题字段',
|
|
111
111
|
options: options,
|
|
112
112
|
value: null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : null == (_fieldSchema_xcomponentprops_fieldNames = _fieldSchema_xcomponentprops['fieldNames']) ? void 0 : _fieldSchema_xcomponentprops_fieldNames['label'],
|
|
113
113
|
onChange: (label)=>{
|
|
@@ -52,14 +52,14 @@ const TableVoidDesigner = ()=>{
|
|
|
52
52
|
}
|
|
53
53
|
}),
|
|
54
54
|
/*#__PURE__*/ jsx(SchemaSettingsModalItem, {
|
|
55
|
-
title:
|
|
55
|
+
title: '设置数据范围',
|
|
56
56
|
schema: {
|
|
57
57
|
type: 'object',
|
|
58
|
-
title:
|
|
58
|
+
title: '设置数据范围',
|
|
59
59
|
properties: {
|
|
60
60
|
filter: {
|
|
61
61
|
default: defaultFilter,
|
|
62
|
-
title:
|
|
62
|
+
title: '数据范围',
|
|
63
63
|
enum: dataSource,
|
|
64
64
|
'x-component': 'Filter',
|
|
65
65
|
'x-component-props': {}
|
|
@@ -182,7 +182,7 @@ const TableVoidDesigner = ()=>{
|
|
|
182
182
|
}
|
|
183
183
|
}),
|
|
184
184
|
/*#__PURE__*/ jsx(SchemaSettingsSelectItem, {
|
|
185
|
-
title:
|
|
185
|
+
title: '每页显示',
|
|
186
186
|
value: (null == (_field_decoratorProps_request_params = field.decoratorProps.request.params) ? void 0 : _field_decoratorProps_request_params.pageSize) || 20,
|
|
187
187
|
options: [
|
|
188
188
|
{
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface EnabledToggleProps {
|
|
3
|
+
resource?: string;
|
|
4
|
+
checkedChildren?: string;
|
|
5
|
+
unCheckedChildren?: string;
|
|
6
|
+
fieldName?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const EnabledToggle: React.MemoExoticComponent<import("@tachybase/schema").ReactFC<EnabledToggleProps>>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { observer } from "@tachybase/schema";
|
|
4
|
+
import { Switch, message } from "antd";
|
|
5
|
+
import { createStyles } from "antd-style";
|
|
6
|
+
import { useTranslation } from "react-i18next";
|
|
7
|
+
import { useAPIClient } from "../../../api-client/index.mjs";
|
|
8
|
+
import { useCollectionRecordData } from "../../../data-source/collection-record/CollectionRecordProvider.mjs";
|
|
9
|
+
import { useDataBlockRequest } from "../../../data-source/data-block/DataBlockRequestProvider.mjs";
|
|
10
|
+
function _tagged_template_literal(strings, raw) {
|
|
11
|
+
if (!raw) raw = strings.slice(0);
|
|
12
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
13
|
+
raw: {
|
|
14
|
+
value: Object.freeze(raw)
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
function _templateObject() {
|
|
19
|
+
const data = _tagged_template_literal([
|
|
20
|
+
"\n &.ant-switch-checked {\n background-color: #52c41a !important;\n }\n min-height: 16px;\n height: 16px;\n line-height: 16px;\n "
|
|
21
|
+
]);
|
|
22
|
+
_templateObject = function() {
|
|
23
|
+
return data;
|
|
24
|
+
};
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
const useStyles = createStyles((param)=>{
|
|
28
|
+
let { css } = param;
|
|
29
|
+
return {
|
|
30
|
+
switchClass: css(_templateObject())
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const EnabledToggle = observer(function() {
|
|
34
|
+
let props = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
35
|
+
const { styles } = useStyles();
|
|
36
|
+
const record = useCollectionRecordData();
|
|
37
|
+
const api = useAPIClient();
|
|
38
|
+
const { refresh } = useDataBlockRequest();
|
|
39
|
+
const { t } = useTranslation();
|
|
40
|
+
const fieldName = props.fieldName || 'enabled';
|
|
41
|
+
var _record_fieldName;
|
|
42
|
+
const enabled = null != (_record_fieldName = null == record ? void 0 : record[fieldName]) ? _record_fieldName : false;
|
|
43
|
+
const resourceName = props.resource || 'workflows';
|
|
44
|
+
const checkedChildren = props.checkedChildren || t('On');
|
|
45
|
+
const unCheckedChildren = props.unCheckedChildren || t('Off');
|
|
46
|
+
const handleChange = async (checked)=>{
|
|
47
|
+
if (props.disabled) return;
|
|
48
|
+
try {
|
|
49
|
+
await api.resource(resourceName).update({
|
|
50
|
+
filterByTk: record.id,
|
|
51
|
+
values: {
|
|
52
|
+
[fieldName]: checked
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
message.success(t('Operation succeeded'));
|
|
56
|
+
refresh();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
message.error(t('Operation failed'));
|
|
59
|
+
console.error(error);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return /*#__PURE__*/ jsx(Switch, {
|
|
63
|
+
checked: enabled,
|
|
64
|
+
onChange: handleChange,
|
|
65
|
+
checkedChildren: checkedChildren,
|
|
66
|
+
unCheckedChildren: unCheckedChildren,
|
|
67
|
+
size: "small",
|
|
68
|
+
className: styles.switchClass,
|
|
69
|
+
disabled: props.disabled
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
export { EnabledToggle };
|
|
@@ -19,7 +19,7 @@ function _templateObject() {
|
|
|
19
19
|
}
|
|
20
20
|
function _templateObject1() {
|
|
21
21
|
const data = _tagged_template_literal([
|
|
22
|
-
"\n //
|
|
22
|
+
"\n // 扩大 SchemaToolbar 的面积\n .tb-action-link {\n margin: -",
|
|
23
23
|
"px -",
|
|
24
24
|
"px;\n padding: ",
|
|
25
25
|
"px ",
|
|
@@ -10,6 +10,7 @@ export * from "./TableBlockDesigner.mjs";
|
|
|
10
10
|
export * from "./TableField.mjs";
|
|
11
11
|
export * from "./TableSelectorDesigner.mjs";
|
|
12
12
|
export * from "./Table.Column.Designer.mjs";
|
|
13
|
+
export * from "./EnabledToggle.mjs";
|
|
13
14
|
const TableV2 = Table;
|
|
14
15
|
TableV2.Column = TableColumn;
|
|
15
16
|
TableV2.Column.ActionBar = TableColumnActionBar;
|
|
@@ -74,7 +74,7 @@ const CodeMirror_CodeMirror = (props)=>{
|
|
|
74
74
|
children: [
|
|
75
75
|
/*#__PURE__*/ jsx("div", {
|
|
76
76
|
className: css(_templateObject1()),
|
|
77
|
-
children: t(
|
|
77
|
+
children: t('Click on the right to select variables →')
|
|
78
78
|
}),
|
|
79
79
|
disabled ? null : /*#__PURE__*/ jsx(VariableSelect, {
|
|
80
80
|
className: css(_templateObject2()),
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
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 &.leftBorder {\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: var(--colorPrimaryText);\n\n /*
|
|
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 &.leftBorder {\n ::before {\n content: '';\n position: absolute;\n left: 0;\n top: 50%;\n transform: translateY(-50%);\n width: 3px;\n height: 50%;\n background-color: var(--colorPrimaryText);\n\n /* 使用 clip-path 裁剪为梯形 */\n clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);\n }\n }\n\n &.adminMenu {\n .general-schema-designer {\n display: none;\n }\n }\n\n .wrapper {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -9,7 +9,7 @@ function _tagged_template_literal(strings, raw) {
|
|
|
9
9
|
}
|
|
10
10
|
function _templateObject() {
|
|
11
11
|
const data = _tagged_template_literal([
|
|
12
|
-
"\n position: relative;\n width: 100%;\n height: 100%;\n
|
|
12
|
+
"\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: 8px 8px 0 0;\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n "
|
|
13
13
|
]);
|
|
14
14
|
_templateObject = function() {
|
|
15
15
|
return data;
|
|
@@ -115,7 +115,7 @@ const schema = {
|
|
|
115
115
|
],
|
|
116
116
|
fulfill: {
|
|
117
117
|
state: {
|
|
118
|
-
hidden: "{{\n !$deps[1] ||\n !smsVerifyEnabled ||\n ($deps[0] !== 'code' && $deps[0] !== undefined) //
|
|
118
|
+
hidden: "{{\n !$deps[1] ||\n !smsVerifyEnabled ||\n ($deps[0] !== 'code' && $deps[0] !== undefined) // 有 verifyMethod 但未选 code\n }}"
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
@@ -62,9 +62,17 @@ class PluginManager {
|
|
|
62
62
|
pluginData: pluginList,
|
|
63
63
|
devDynamicImport: this.app.devDynamicImport
|
|
64
64
|
});
|
|
65
|
-
for await (const [name, pluginClass] of plugins){
|
|
65
|
+
for await (const [name, pluginClass] of plugins)try {
|
|
66
66
|
const info = pluginList.find((item)=>item.name === name);
|
|
67
67
|
await this.add(pluginClass, info);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.error("[PluginManager.initRemotePlugins] ✗ Error adding plugin ".concat(name, ":"), {
|
|
70
|
+
error,
|
|
71
|
+
errorMessage: null == error ? void 0 : error.message,
|
|
72
|
+
errorStack: null == error ? void 0 : error.stack,
|
|
73
|
+
pluginClass
|
|
74
|
+
});
|
|
75
|
+
throw error;
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
78
|
async add(plugin) {
|
|
@@ -45,22 +45,42 @@ class WebSocketClient {
|
|
|
45
45
|
const options = this.app.getOptions();
|
|
46
46
|
const apiBaseURL = null == options ? void 0 : null == (_options_apiClient = options.apiClient) ? void 0 : _options_apiClient['baseURL'];
|
|
47
47
|
if (!apiBaseURL) return;
|
|
48
|
+
const locationHostname = window.__tachybase_location_hostname__;
|
|
49
|
+
const windowHostname = window.location.hostname;
|
|
50
|
+
let hostname = locationHostname || windowHostname;
|
|
51
|
+
const hostnameFixer = window.__tachybase_fix_websocket_hostname__;
|
|
52
|
+
if ('function' == typeof hostnameFixer) {
|
|
53
|
+
const fixedHostname = hostnameFixer(hostname);
|
|
54
|
+
if (fixedHostname && 'string' == typeof fixedHostname) hostname = fixedHostname;
|
|
55
|
+
}
|
|
48
56
|
const subApp = (0, client_namespaceObject.getSubAppName)(this.app.getPublicPath());
|
|
49
|
-
const queryString = subApp ? "?__appName=".concat(subApp) : "?__hostname=".concat(
|
|
57
|
+
const queryString = subApp ? "?__appName=".concat(subApp) : "?__hostname=".concat(hostname);
|
|
50
58
|
const wsPath = this.options.basename || '/ws';
|
|
59
|
+
const hostnameWasFixed = hostname !== window.location.hostname;
|
|
51
60
|
if (this.options.url) {
|
|
52
61
|
const url = new URL(this.options.url);
|
|
53
|
-
if (
|
|
54
|
-
const protocol = '
|
|
55
|
-
|
|
62
|
+
if (hostnameWasFixed) {
|
|
63
|
+
const protocol = 'wss:' === url.protocol ? 'wss' : 'ws';
|
|
64
|
+
const port = url.port || '';
|
|
65
|
+
const host = port ? "".concat(hostname, ":").concat(port) : hostname;
|
|
66
|
+
return "".concat(protocol, "://").concat(host).concat(wsPath).concat(queryString);
|
|
56
67
|
}
|
|
57
68
|
return "".concat(this.options.url).concat(queryString);
|
|
58
69
|
}
|
|
59
70
|
try {
|
|
60
71
|
const url = new URL(apiBaseURL);
|
|
61
|
-
|
|
72
|
+
const finalHostname = hostnameWasFixed ? hostname : url.hostname;
|
|
73
|
+
const port = url.port || '';
|
|
74
|
+
const host = port ? "".concat(finalHostname, ":").concat(port) : finalHostname;
|
|
75
|
+
return "".concat('https:' === url.protocol ? 'wss' : 'ws', "://").concat(host).concat(wsPath).concat(queryString);
|
|
62
76
|
} catch (error) {
|
|
63
|
-
|
|
77
|
+
let port = location.port;
|
|
78
|
+
if (!port && apiBaseURL) try {
|
|
79
|
+
const apiUrl = new URL(apiBaseURL);
|
|
80
|
+
port = apiUrl.port;
|
|
81
|
+
} catch (e) {}
|
|
82
|
+
const host = port ? "".concat(hostname, ":").concat(port) : hostname;
|
|
83
|
+
return "".concat('https:' === location.protocol ? 'wss' : 'ws', "://").concat(host).concat(wsPath).concat(queryString);
|
|
64
84
|
}
|
|
65
85
|
}
|
|
66
86
|
get reconnectAttempts() {
|
|
@@ -105,12 +105,18 @@ function getRemotePlugins(requirejs) {
|
|
|
105
105
|
definePluginClient(packageName);
|
|
106
106
|
});
|
|
107
107
|
return new Promise((resolve, reject)=>{
|
|
108
|
-
requirejs.requirejs(packageNames, processRemotePlugins(pluginData, resolve),
|
|
108
|
+
requirejs.requirejs(packageNames, processRemotePlugins(pluginData, resolve), (error)=>{
|
|
109
|
+
console.error('[getRemotePlugins] requirejs error:', error);
|
|
110
|
+
reject(error);
|
|
111
|
+
});
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
114
|
async function getPlugins(options) {
|
|
112
115
|
const { requirejs, pluginData, devDynamicImport } = options;
|
|
113
|
-
if (0 === pluginData.length)
|
|
116
|
+
if (0 === pluginData.length) {
|
|
117
|
+
console.warn('[getPlugins] ⚠ Early return: pluginData.length === 0');
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
114
120
|
const res = [];
|
|
115
121
|
const resolveDevPlugins = {};
|
|
116
122
|
if (devDynamicImport) {
|
|
@@ -327,7 +327,7 @@ const PluginDetail = (param)=>{
|
|
|
327
327
|
}),
|
|
328
328
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Space, {
|
|
329
329
|
split: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
330
|
-
children: "\xa0
|
|
330
|
+
children: "\xa0•\xa0"
|
|
331
331
|
}),
|
|
332
332
|
children: [
|
|
333
333
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
@@ -57,7 +57,7 @@ const SourceForeignKey = (0, schema_namespaceObject.observer)(()=>{
|
|
|
57
57
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
58
58
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
|
|
59
59
|
allowClear: true,
|
|
60
|
-
placeholder:
|
|
60
|
+
placeholder: '留空时,自动生成 FK 字段',
|
|
61
61
|
disabled: field.disabled,
|
|
62
62
|
value: field.value,
|
|
63
63
|
options: getCollectionFields(collection.name).filter((field)=>field.type).map((field)=>{
|
|
@@ -80,7 +80,7 @@ const ThroughForeignKey = (0, schema_namespaceObject.observer)(()=>{
|
|
|
80
80
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
|
|
81
81
|
allowClear: true,
|
|
82
82
|
popupMatchSelectWidth: false,
|
|
83
|
-
placeholder:
|
|
83
|
+
placeholder: '留空时,自动生成 FK 字段',
|
|
84
84
|
disabled: field.disabled,
|
|
85
85
|
value: field.value,
|
|
86
86
|
options: getCollectionFields(form.values.through).filter((field)=>field.type).map((field)=>{
|
|
@@ -103,7 +103,7 @@ const TargetForeignKey = (0, schema_namespaceObject.observer)(()=>{
|
|
|
103
103
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Select, {
|
|
104
104
|
allowClear: true,
|
|
105
105
|
popupMatchSelectWidth: false,
|
|
106
|
-
placeholder:
|
|
106
|
+
placeholder: '留空时,自动生成 FK 字段',
|
|
107
107
|
disabled: field.disabled,
|
|
108
108
|
value: field.value,
|
|
109
109
|
options: getCollectionFields(form.values.target).filter((field)=>field.type).map((field)=>{
|