@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.
Files changed (94) hide show
  1. package/es/application/PluginManager.mjs +9 -1
  2. package/es/application/WebSocketClient.d.ts +19 -0
  3. package/es/application/WebSocketClient.mjs +26 -6
  4. package/es/application/utils/remotePlugins.mjs +8 -2
  5. package/es/built-in/attachment-preview/previewers/file-sheet.mjs +1 -1
  6. package/es/built-in/pm/PluginDetail.mjs +1 -1
  7. package/es/collection-manager/Configuration/components/index.mjs +3 -3
  8. package/es/collection-manager/interfaces/components/index.mjs +2 -2
  9. package/es/collection-manager/interfaces/properties/operators.mjs +3 -3
  10. package/es/hooks/index.d.ts +1 -0
  11. package/es/hooks/index.mjs +1 -0
  12. package/es/hooks/useOptimizedMemo.d.ts +25 -0
  13. package/es/hooks/useOptimizedMemo.mjs +30 -0
  14. package/es/locale/index.mjs +47 -47
  15. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +4 -1
  16. package/es/schema-component/antd/AntdSchemaComponentProvider.mjs +3 -1
  17. package/es/schema-component/antd/__builtins__/hooks/usePrefixCls.mjs +1 -1
  18. package/es/schema-component/antd/action/Action.Area.style.mjs +1 -1
  19. package/es/schema-component/antd/action/Action.Designer.mjs +1 -1
  20. package/es/schema-component/antd/action/Action.mjs +3 -2
  21. package/es/schema-component/antd/action/hooks/useCompiledAction.d.ts +7 -0
  22. package/es/schema-component/antd/action/hooks/useCompiledAction.mjs +35 -0
  23. package/es/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.mjs +14 -4
  24. package/es/schema-component/antd/association-field/AssociationSelect.mjs +1 -1
  25. package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +1 -1
  26. package/es/schema-component/antd/association-field/SubTabs/styles.mjs +1 -1
  27. package/es/schema-component/antd/block-item/BlockToolbar.mjs +16 -16
  28. package/es/schema-component/antd/grid-card/options.mjs +3 -3
  29. package/es/schema-component/antd/input/ReadPretty.mjs +1 -3
  30. package/es/schema-component/antd/menu/Menu.styles.mjs +1 -1
  31. package/es/schema-component/antd/menu/MenuSearchAdd.style.mjs +1 -1
  32. package/es/schema-component/antd/page/Page.mjs +3 -0
  33. package/es/schema-component/antd/page/Page.style.mjs +1 -1
  34. package/es/schema-component/antd/table/Table.Array.mjs +1 -0
  35. package/es/schema-component/antd/table/Table.Column.Designer.mjs +5 -5
  36. package/es/schema-component/antd/table/Table.Void.Designer.mjs +4 -4
  37. package/es/schema-component/antd/table-v2/EnabledToggle.d.ts +9 -0
  38. package/es/schema-component/antd/table-v2/EnabledToggle.mjs +72 -0
  39. package/es/schema-component/antd/table-v2/Table.styles.mjs +1 -1
  40. package/es/schema-component/antd/table-v2/index.d.ts +1 -0
  41. package/es/schema-component/antd/table-v2/index.mjs +1 -0
  42. package/es/schema-component/antd/variable/CodeMirror.mjs +1 -1
  43. package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +1 -1
  44. package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +1 -1
  45. package/es/schema-templates/BlockTemplateDetails.mjs +1 -1
  46. package/es/user/ChangePassword.mjs +1 -1
  47. package/lib/application/PluginManager.js +9 -1
  48. package/lib/application/WebSocketClient.js +26 -6
  49. package/lib/application/utils/remotePlugins.js +8 -2
  50. package/lib/built-in/attachment-preview/previewers/file-sheet.js +1 -1
  51. package/lib/built-in/pm/PluginDetail.js +1 -1
  52. package/lib/collection-manager/Configuration/components/index.js +3 -3
  53. package/lib/collection-manager/interfaces/components/index.js +2 -2
  54. package/lib/collection-manager/interfaces/properties/operators.js +3 -3
  55. package/lib/hooks/index.js +12 -3
  56. package/lib/hooks/useOptimizedMemo.js +74 -0
  57. package/lib/locale/en_US.js +1 -0
  58. package/lib/locale/es_ES.js +1 -0
  59. package/lib/locale/fr_FR.js +1 -0
  60. package/lib/locale/ko_KR.js +1 -0
  61. package/lib/locale/pt_BR.js +1 -0
  62. package/lib/locale/uk_UA.js +1 -0
  63. package/lib/locale/zh-CN.js +1 -0
  64. package/lib/locale/zh-TW.js +1 -0
  65. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +4 -1
  66. package/lib/schema-component/antd/AntdSchemaComponentProvider.js +3 -1
  67. package/lib/schema-component/antd/__builtins__/hooks/usePrefixCls.js +1 -1
  68. package/lib/schema-component/antd/action/Action.Area.style.js +1 -1
  69. package/lib/schema-component/antd/action/Action.Designer.js +1 -1
  70. package/lib/schema-component/antd/action/Action.js +3 -2
  71. package/lib/schema-component/antd/action/hooks/useCompiledAction.js +69 -0
  72. package/lib/schema-component/antd/appends-tree-select/AppendsTreeSelectV2.js +14 -4
  73. package/lib/schema-component/antd/association-field/AssociationSelect.js +1 -1
  74. package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
  75. package/lib/schema-component/antd/association-field/SubTabs/styles.js +1 -1
  76. package/lib/schema-component/antd/block-item/BlockToolbar.js +16 -16
  77. package/lib/schema-component/antd/grid-card/options.js +3 -3
  78. package/lib/schema-component/antd/input/ReadPretty.js +1 -3
  79. package/lib/schema-component/antd/menu/Menu.styles.js +1 -1
  80. package/lib/schema-component/antd/menu/MenuSearchAdd.style.js +1 -1
  81. package/lib/schema-component/antd/page/Page.js +3 -0
  82. package/lib/schema-component/antd/page/Page.style.js +1 -1
  83. package/lib/schema-component/antd/table/Table.Array.js +1 -0
  84. package/lib/schema-component/antd/table/Table.Column.Designer.js +5 -5
  85. package/lib/schema-component/antd/table/Table.Void.Designer.js +4 -4
  86. package/lib/schema-component/antd/table-v2/EnabledToggle.js +106 -0
  87. package/lib/schema-component/antd/table-v2/Table.styles.js +1 -1
  88. package/lib/schema-component/antd/table-v2/index.js +13 -0
  89. package/lib/schema-component/antd/variable/CodeMirror.js +1 -1
  90. package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +1 -1
  91. package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +1 -1
  92. package/lib/schema-templates/BlockTemplateDetails.js +1 -1
  93. package/lib/user/ChangePassword.js +1 -1
  94. package/package.json +4 -4
@@ -9,7 +9,11 @@ function usePropsCollection(param) {
9
9
  return collection;
10
10
  }
11
11
  function loadChildren(option) {
12
- const result = getCollectionFieldOptions.call(this, option.field.target, option);
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(this);
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 isLeaf = !this.getCollectionFields(field.target).filter(isAssociation).filter(this.filter).length;
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
  });
@@ -105,7 +105,7 @@ const InternalAssociationSelect = observer((props)=>{
105
105
  style: {
106
106
  paddingLeft: 5
107
107
  },
108
- children: t('Add') + " \u201C".concat(props.search, "\u201D ")
108
+ children: t('Add') + " ".concat(props.search, " ")
109
109
  })
110
110
  ]
111
111
  });
@@ -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: "\u786E\u8BA4"
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 /* \u9690\u85CF\u6EDA\u52A8\u6761 \u5FAE\u8F6F/\u706B\u72D0 */\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 /* \u9690\u85CF\u6EDA\u52A8\u6761 \u8C37\u6B4C\u6D4F\u89C8\u5668 */\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 "
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: "\u5168\u5C4F"
8
+ title: '全屏'
9
9
  },
10
10
  {
11
11
  icon: /*#__PURE__*/ jsx(UndoOutlined, {}),
12
- title: "\u64A4\u9500"
12
+ title: '撤销'
13
13
  },
14
14
  {
15
15
  icon: /*#__PURE__*/ jsx(RedoOutlined, {}),
16
- title: "\u91CD\u505A"
16
+ title: '重做'
17
17
  },
18
18
  {
19
19
  icon: /*#__PURE__*/ jsx(DeleteOutlined, {}),
20
- title: "\u5220\u9664"
20
+ title: '删除'
21
21
  }
22
22
  ];
23
23
  const customItems = [
24
24
  {
25
25
  icon: /*#__PURE__*/ jsx(CopyOutlined, {}),
26
26
  placement: 'bottom',
27
- title: "\u590D\u5236"
27
+ title: '复制'
28
28
  },
29
29
  {
30
30
  icon: /*#__PURE__*/ jsx(ZoomInOutlined, {}),
31
- title: "\u653E\u5927\uFF01"
31
+ title: '放大!'
32
32
  },
33
33
  {
34
34
  icon: /*#__PURE__*/ jsx(ZoomOutOutlined, {}),
35
35
  style: {
36
36
  color: '#1890ff'
37
37
  },
38
- title: "\u7F29\u5C0F\uFF01"
38
+ title: '缩小!'
39
39
  },
40
40
  {
41
41
  type: 'divider'
42
42
  },
43
43
  {
44
44
  icon: /*#__PURE__*/ jsx(DragOutlined, {}),
45
- title: "\u5FEB\u901F\u5B9A\u4F4D"
45
+ title: '快速定位'
46
46
  }
47
47
  ];
48
48
  const dropdownMenuItems = [
49
49
  {
50
50
  icon: /*#__PURE__*/ jsx(CopyOutlined, {}),
51
51
  onClick: ()=>{
52
- message.info("\u590D\u5236\uFF01");
52
+ message.info('复制!');
53
53
  },
54
- label: "\u590D\u5236"
54
+ label: '复制'
55
55
  },
56
56
  {
57
57
  icon: /*#__PURE__*/ jsx(ZoomInOutlined, {}),
58
58
  onClick: ()=>{
59
- message.success("\u653E\u5927\uFF01");
59
+ message.success('放大!');
60
60
  },
61
- label: "\u653E\u5927\uFF01"
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("\u7F29\u5C0F\uFF01");
69
+ message.success('缩小!');
70
70
  },
71
- label: "\u7F29\u5C0F\uFF01"
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("\u5FEB\u901F\u5B9A\u4F4Ding");
79
+ message.loading('快速定位ing');
80
80
  },
81
- label: "\u5FEB\u901F\u5B9A\u4F4D"
81
+ label: '快速定位'
82
82
  }
83
83
  ];
84
84
  const BlockToolbar = /*#__PURE__*/ forwardRef((props, ref)=>/*#__PURE__*/ jsx("div", {
@@ -22,9 +22,9 @@ const screenSizeTitleMaps = {
22
22
  };
23
23
  const screenSizeMaps = {
24
24
  xs: '< 768',
25
- md: "\u2265 768",
26
- lg: "\u2265 992",
27
- xxl: "\u2265 1600"
25
+ md: '≥ 768',
26
+ lg: '≥ 992',
27
+ xxl: '≥ 1600'
28
28
  };
29
29
  const defaultColumnCount = {
30
30
  xs: 1,
@@ -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 /* \u4F7F\u7528 clip-path \u88C1\u526A\u4E3A\u68AF\u5F62 */\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: ",
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: \u8FD9\u91CC\u7684\u6837\u5F0F\u662F\u4E3A\u4E86\u8BA9\u641C\u7D22\u6846\u7684\u6837\u5F0F, \u907F\u514D\u4E0A\u5C42 antd \u5199\u6B7B\u7684 padding-left: 24px \u7684\u5F71\u54CD */\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: \u653E\u8FD9\u4E09\u4E2A\u6837\u5F0F\u662F\u4E3A\u4E86\u63D0\u5347\u9009\u62E9\u5668\u4F18\u5148\u7EA7, \u8986\u76D6\u6389 antd \u7684\u9ED8\u8BA4\u6837\u5F0F */\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 /* \u79FB\u9664 antd \u9ED8\u8BA4\u7684\u540E\u7F6E\u641C\u7D22\u56FE\u6807 */\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 /* \u8FD9\u91CC\u662F\u4E3A\u4E86\u548C\u524D\u8FB9\u5143\u7D20\u4FDD\u6301\u5BF9\u9F50, antd \u7EC4\u4EF6\u5199\u6B7B\u4E86\u9AD8\u5EA6 */\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 "
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;
@@ -230,6 +230,9 @@ const TabItem = (props)=>{
230
230
  type: schema['x-icon']
231
231
  }),
232
232
  /*#__PURE__*/ jsx("span", {
233
+ style: {
234
+ padding: '6px 16px'
235
+ },
233
236
  children: schema.title || t('Unnamed')
234
237
  }),
235
238
  /*#__PURE__*/ jsx("div", {
@@ -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 padding: 0;\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 "
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;
@@ -119,6 +119,7 @@ const useTableColumns = ()=>{
119
119
  }),
120
120
  dataIndex: s.name,
121
121
  key: s.name,
122
+ ...s['x-component-props'],
122
123
  render: (v, record)=>{
123
124
  var _field_value;
124
125
  const index = null == (_field_value = field.value) ? void 0 : _field_value.indexOf(record);
@@ -33,9 +33,9 @@ const TableColumnDesigner = (props)=>{
33
33
  return /*#__PURE__*/ jsxs(GeneralSchemaDesigner, {
34
34
  children: [
35
35
  /*#__PURE__*/ jsx(SchemaSettingsPopupItem, {
36
- title: "\u7F16\u8F91",
36
+ title: '编辑',
37
37
  schema: {
38
- title: "\u7F16\u8F91\u5B57\u6BB5",
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: "\u5B57\u6BB5\u6807\u9898",
52
+ title: '字段标题',
53
53
  'x-component-props': {},
54
- description: "\u539F\u5B57\u6BB5\u6807\u9898\uFF1A".concat(null == collectionField ? void 0 : null == (_collectionField_uiSchema = collectionField.uiSchema) ? void 0 : _collectionField_uiSchema.title)
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: "\u6807\u9898\u5B57\u6BB5",
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: "\u8BBE\u7F6E\u6570\u636E\u8303\u56F4",
55
+ title: '设置数据范围',
56
56
  schema: {
57
57
  type: 'object',
58
- title: "\u8BBE\u7F6E\u6570\u636E\u8303\u56F4",
58
+ title: '设置数据范围',
59
59
  properties: {
60
60
  filter: {
61
61
  default: defaultFilter,
62
- title: "\u6570\u636E\u8303\u56F4",
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: "\u6BCF\u9875\u663E\u793A",
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 // \u6269\u5927 SchemaToolbar \u7684\u9762\u79EF\n .tb-action-link {\n margin: -",
22
+ "\n // 扩大 SchemaToolbar 的面积\n .tb-action-link {\n margin: -",
23
23
  "px -",
24
24
  "px;\n padding: ",
25
25
  "px ",
@@ -3,4 +3,5 @@ export * from './TableField';
3
3
  export * from './TableSelectorDesigner';
4
4
  export * from './Table.Column.Designer';
5
5
  export { useColumnSchema } from './Table.Column.Decorator';
6
+ export * from './EnabledToggle';
6
7
  export declare const TableV2: any;
@@ -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("Click on the right to select variables \u2192")
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 /* \u4F7F\u7528 clip-path \u88C1\u526A\u4E3A\u68AF\u5F62 */\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 "
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 padding: 6px 16px;\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 "
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;
@@ -46,7 +46,7 @@ const EditableTitle = (props)=>{
46
46
  style: {
47
47
  color: '#bbb'
48
48
  },
49
- children: "\u672A\u547D\u540D"
49
+ children: "未命名"
50
50
  })
51
51
  })
52
52
  });
@@ -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) // \u6709 verifyMethod \u4F46\u672A\u9009 code\n }}"
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(window.location.hostname);
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 ('localhost' === url.hostname) {
54
- const protocol = 'https:' === location.protocol ? 'wss' : 'ws';
55
- return "".concat(protocol, "://").concat(location.hostname, ":").concat(url.port).concat(wsPath).concat(queryString);
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
- return "".concat('https:' === url.protocol ? 'wss' : 'ws', "://").concat(url.host).concat(wsPath).concat(queryString);
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
- return "".concat('https:' === location.protocol ? 'wss' : 'ws', "://").concat(location.host).concat(wsPath).concat(queryString);
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), reject);
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) return [];
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) {
@@ -64,7 +64,7 @@ const ExcelView = (props)=>{
64
64
  try {
65
65
  handleShowPreviewer();
66
66
  } catch (e) {
67
- console.log("%c Line:36 \uD83E\uDD5F e", e);
67
+ console.log('%c Line:36 🥟 e', e);
68
68
  }
69
69
  }
70
70
  }, [
@@ -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\u2022\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: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
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: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
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: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
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)=>{