@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
@@ -34,9 +34,17 @@ class PluginManager {
34
34
  pluginData: pluginList,
35
35
  devDynamicImport: this.app.devDynamicImport
36
36
  });
37
- for await (const [name, pluginClass] of plugins){
37
+ for await (const [name, pluginClass] of plugins)try {
38
38
  const info = pluginList.find((item)=>item.name === name);
39
39
  await this.add(pluginClass, info);
40
+ } catch (error) {
41
+ console.error("[PluginManager.initRemotePlugins] ✗ Error adding plugin ".concat(name, ":"), {
42
+ error,
43
+ errorMessage: null == error ? void 0 : error.message,
44
+ errorStack: null == error ? void 0 : error.stack,
45
+ pluginClass
46
+ });
47
+ throw error;
40
48
  }
41
49
  }
42
50
  async add(plugin) {
@@ -1,4 +1,22 @@
1
1
  import { Application } from './Application';
2
+ /**
3
+ * WebSocketClient hostname 修复函数类型
4
+ * 允许外部环境(如 Electron desktop)提供自定义的 hostname 修复逻辑
5
+ *
6
+ * @param hostname - 原始 hostname
7
+ * @returns 修复后的 hostname,如果返回 null/undefined 或非字符串值,则使用原值
8
+ */
9
+ type HostnameFixer = (hostname: string) => string | null | undefined;
10
+ declare global {
11
+ interface Window {
12
+ /**
13
+ * WebSocketClient hostname 修复函数(可选)
14
+ * 由特定环境(如 Electron desktop preload 脚本)提供
15
+ * 用于在生成 WebSocket URL 时修复 hostname
16
+ */
17
+ __tachybase_fix_websocket_hostname__?: HostnameFixer;
18
+ }
19
+ }
2
20
  export type WebSocketClientOptions = {
3
21
  reconnectInterval?: number;
4
22
  reconnectAttempts?: number;
@@ -33,3 +51,4 @@ export declare class WebSocketClient {
33
51
  off(type: string, listener: any, options?: boolean | EventListenerOptions): void;
34
52
  removeAllListeners(): void;
35
53
  }
54
+ export {};
@@ -17,22 +17,42 @@ class WebSocketClient {
17
17
  const options = this.app.getOptions();
18
18
  const apiBaseURL = null == options ? void 0 : null == (_options_apiClient = options.apiClient) ? void 0 : _options_apiClient['baseURL'];
19
19
  if (!apiBaseURL) return;
20
+ const locationHostname = window.__tachybase_location_hostname__;
21
+ const windowHostname = window.location.hostname;
22
+ let hostname = locationHostname || windowHostname;
23
+ const hostnameFixer = window.__tachybase_fix_websocket_hostname__;
24
+ if ('function' == typeof hostnameFixer) {
25
+ const fixedHostname = hostnameFixer(hostname);
26
+ if (fixedHostname && 'string' == typeof fixedHostname) hostname = fixedHostname;
27
+ }
20
28
  const subApp = getSubAppName(this.app.getPublicPath());
21
- const queryString = subApp ? "?__appName=".concat(subApp) : "?__hostname=".concat(window.location.hostname);
29
+ const queryString = subApp ? "?__appName=".concat(subApp) : "?__hostname=".concat(hostname);
22
30
  const wsPath = this.options.basename || '/ws';
31
+ const hostnameWasFixed = hostname !== window.location.hostname;
23
32
  if (this.options.url) {
24
33
  const url = new URL(this.options.url);
25
- if ('localhost' === url.hostname) {
26
- const protocol = 'https:' === location.protocol ? 'wss' : 'ws';
27
- return "".concat(protocol, "://").concat(location.hostname, ":").concat(url.port).concat(wsPath).concat(queryString);
34
+ if (hostnameWasFixed) {
35
+ const protocol = 'wss:' === url.protocol ? 'wss' : 'ws';
36
+ const port = url.port || '';
37
+ const host = port ? "".concat(hostname, ":").concat(port) : hostname;
38
+ return "".concat(protocol, "://").concat(host).concat(wsPath).concat(queryString);
28
39
  }
29
40
  return "".concat(this.options.url).concat(queryString);
30
41
  }
31
42
  try {
32
43
  const url = new URL(apiBaseURL);
33
- return "".concat('https:' === url.protocol ? 'wss' : 'ws', "://").concat(url.host).concat(wsPath).concat(queryString);
44
+ const finalHostname = hostnameWasFixed ? hostname : url.hostname;
45
+ const port = url.port || '';
46
+ const host = port ? "".concat(finalHostname, ":").concat(port) : finalHostname;
47
+ return "".concat('https:' === url.protocol ? 'wss' : 'ws', "://").concat(host).concat(wsPath).concat(queryString);
34
48
  } catch (error) {
35
- return "".concat('https:' === location.protocol ? 'wss' : 'ws', "://").concat(location.host).concat(wsPath).concat(queryString);
49
+ let port = location.port;
50
+ if (!port && apiBaseURL) try {
51
+ const apiUrl = new URL(apiBaseURL);
52
+ port = apiUrl.port;
53
+ } catch (e) {}
54
+ const host = port ? "".concat(hostname, ":").concat(port) : hostname;
55
+ return "".concat('https:' === location.protocol ? 'wss' : 'ws', "://").concat(host).concat(wsPath).concat(queryString);
36
56
  }
37
57
  }
38
58
  get reconnectAttempts() {
@@ -72,12 +72,18 @@ function getRemotePlugins(requirejs) {
72
72
  definePluginClient(packageName);
73
73
  });
74
74
  return new Promise((resolve, reject)=>{
75
- requirejs.requirejs(packageNames, processRemotePlugins(pluginData, resolve), reject);
75
+ requirejs.requirejs(packageNames, processRemotePlugins(pluginData, resolve), (error)=>{
76
+ console.error('[getRemotePlugins] requirejs error:', error);
77
+ reject(error);
78
+ });
76
79
  });
77
80
  }
78
81
  async function getPlugins(options) {
79
82
  const { requirejs, pluginData, devDynamicImport } = options;
80
- if (0 === pluginData.length) return [];
83
+ if (0 === pluginData.length) {
84
+ console.warn('[getPlugins] ⚠ Early return: pluginData.length === 0');
85
+ return [];
86
+ }
81
87
  const res = [];
82
88
  const resolveDevPlugins = {};
83
89
  if (devDynamicImport) {
@@ -24,7 +24,7 @@ const ExcelView = (props)=>{
24
24
  try {
25
25
  handleShowPreviewer();
26
26
  } catch (e) {
27
- console.log("%c Line:36 \uD83E\uDD5F e", e);
27
+ console.log('%c Line:36 🥟 e', e);
28
28
  }
29
29
  }
30
30
  }, [
@@ -289,7 +289,7 @@ const PluginDetail = (param)=>{
289
289
  }),
290
290
  /*#__PURE__*/ jsxs(Space, {
291
291
  split: /*#__PURE__*/ jsx("span", {
292
- children: "\xa0\u2022\xa0"
292
+ children: "\xa0•\xa0"
293
293
  }),
294
294
  children: [
295
295
  /*#__PURE__*/ jsx("span", {
@@ -22,7 +22,7 @@ const SourceForeignKey = observer(()=>{
22
22
  return /*#__PURE__*/ jsx("div", {
23
23
  children: /*#__PURE__*/ jsx(Select, {
24
24
  allowClear: true,
25
- placeholder: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
25
+ placeholder: '留空时,自动生成 FK 字段',
26
26
  disabled: field.disabled,
27
27
  value: field.value,
28
28
  options: getCollectionFields(collection.name).filter((field)=>field.type).map((field)=>{
@@ -45,7 +45,7 @@ const ThroughForeignKey = observer(()=>{
45
45
  children: /*#__PURE__*/ jsx(Select, {
46
46
  allowClear: true,
47
47
  popupMatchSelectWidth: false,
48
- placeholder: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
48
+ placeholder: '留空时,自动生成 FK 字段',
49
49
  disabled: field.disabled,
50
50
  value: field.value,
51
51
  options: getCollectionFields(form.values.through).filter((field)=>field.type).map((field)=>{
@@ -68,7 +68,7 @@ const TargetForeignKey = observer(()=>{
68
68
  children: /*#__PURE__*/ jsx(Select, {
69
69
  allowClear: true,
70
70
  popupMatchSelectWidth: false,
71
- placeholder: "\u7559\u7A7A\u65F6\uFF0C\u81EA\u52A8\u751F\u6210 FK \u5B57\u6BB5",
71
+ placeholder: '留空时,自动生成 FK 字段',
72
72
  disabled: field.disabled,
73
73
  value: field.value,
74
74
  options: getCollectionFields(form.values.target).filter((field)=>field.type).map((field)=>{
@@ -34,7 +34,7 @@ const ForeignKey1 = ()=>/*#__PURE__*/ jsxs("div", {
34
34
  children: [
35
35
  "Foreign key 1 ",
36
36
  /*#__PURE__*/ jsx("a", {
37
- children: "\u65B0\u5EFA"
37
+ children: "新建"
38
38
  })
39
39
  ]
40
40
  });
@@ -42,7 +42,7 @@ const ForeignKey2 = ()=>/*#__PURE__*/ jsxs("div", {
42
42
  children: [
43
43
  "Foreign key 2 ",
44
44
  /*#__PURE__*/ jsx("a", {
45
- children: "\u65B0\u5EFA"
45
+ children: "新建"
46
46
  })
47
47
  ]
48
48
  });
@@ -142,7 +142,7 @@ const number = [
142
142
  selected: true
143
143
  },
144
144
  {
145
- label: '{{t("\u2260")}}',
145
+ label: '{{t("")}}',
146
146
  value: '$ne'
147
147
  },
148
148
  {
@@ -150,7 +150,7 @@ const number = [
150
150
  value: '$gt'
151
151
  },
152
152
  {
153
- label: '{{t("\u2265")}}',
153
+ label: '{{t("")}}',
154
154
  value: '$gte'
155
155
  },
156
156
  {
@@ -158,7 +158,7 @@ const number = [
158
158
  value: '$lt'
159
159
  },
160
160
  {
161
- label: '{{t("\u2264")}}',
161
+ label: '{{t("")}}',
162
162
  value: '$lte'
163
163
  },
164
164
  {
@@ -1,2 +1,3 @@
1
1
  export * from './useAdminSchemaUid';
2
+ export * from './useOptimizedMemo';
2
3
  export * from './useViewport';
@@ -1,2 +1,3 @@
1
1
  export * from "./useAdminSchemaUid.mjs";
2
+ export * from "./useOptimizedMemo.mjs";
2
3
  export * from "./useViewport.mjs";
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 优化的 useMemo,先进行引用比较,仅在引用不同时才使用 lodash 的 isEqual 进行深度比较
3
+ * 这样可以在大多数情况下(引用相同时)避免深度比较的开销
4
+ *
5
+ * 性能分析:
6
+ * - 引用比较:O(1),几乎无开销
7
+ * - 深度比较:O(n),n 为数据大小,使用 lodash.isEqual(比 JSON.stringify 更可靠)
8
+ * - 计算成本:map、compile、字段查找等操作
9
+ *
10
+ * 权衡:对于表单摘要数据(通常 < 10KB),深度比较的开销(< 1ms)
11
+ * 远小于重新计算的成本(map + compile + 字段查找),所以值得缓存
12
+ *
13
+ * 优势:
14
+ * - 使用 lodash.isEqual 替代 JSON.stringify,更可靠(可处理循环引用、特殊类型等)
15
+ * - 代码更简洁,无需手动处理序列化错误
16
+ * - 依赖成熟的库,减少维护成本
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * const results = useOptimizedMemo(() => {
21
+ * return expensiveComputation(data);
22
+ * }, [data]);
23
+ * ```
24
+ */
25
+ export declare function useOptimizedMemo<T>(factory: () => T, deps: any[]): T;
@@ -0,0 +1,30 @@
1
+ import { useRef } from "react";
2
+ import lodash from "lodash";
3
+ function useOptimizedMemo(factory, deps) {
4
+ const ref = useRef();
5
+ if (ref.current && deps.length === ref.current.deps.length && deps.every((dep, i)=>dep === ref.current.deps[i])) return ref.current.value;
6
+ if (!ref.current || deps.length !== ref.current.deps.length) {
7
+ const value = factory();
8
+ ref.current = {
9
+ deps,
10
+ value
11
+ };
12
+ return value;
13
+ }
14
+ const depsChanged = deps.some((dep, i)=>{
15
+ const prevDep = ref.current.deps[i];
16
+ if (dep === prevDep) return false;
17
+ return !lodash.isEqual(dep, prevDep);
18
+ });
19
+ if (depsChanged) {
20
+ const value = factory();
21
+ ref.current = {
22
+ deps,
23
+ value
24
+ };
25
+ return value;
26
+ }
27
+ ref.current.deps = deps;
28
+ return ref.current.value;
29
+ }
30
+ export { useOptimizedMemo };
@@ -68,25 +68,25 @@ const dayjsLocale = {
68
68
  };
69
69
  const locale = {
70
70
  'ar-EG': {
71
- label: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
71
+ label: 'العربية'
72
72
  },
73
73
  'az-AZ': {
74
- label: "Az\u0259rbaycan dili"
74
+ label: 'Azərbaycan dili'
75
75
  },
76
76
  'bg-BG': {
77
- label: "\u0411\u044A\u043B\u0433\u0430\u0440\u0441\u043A\u0438"
77
+ label: 'Български'
78
78
  },
79
79
  'bn-BD': {
80
80
  label: 'Bengali'
81
81
  },
82
82
  'by-BY': {
83
- label: "\u0411\u0435\u043B\u0430\u0440\u0443\u0441\u043A\u0456"
83
+ label: 'Беларускі'
84
84
  },
85
85
  'ca-ES': {
86
- label: "\u0421atal\xe0/Espanya"
86
+ label: 'Сatalà/Espanya'
87
87
  },
88
88
  'cs-CZ': {
89
- label: "\u010Cesky"
89
+ label: 'Česky'
90
90
  },
91
91
  'da-DK': {
92
92
  label: 'Dansk'
@@ -95,7 +95,7 @@ const locale = {
95
95
  label: 'Deutsch'
96
96
  },
97
97
  'el-GR': {
98
- label: "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC"
98
+ label: 'Ελληνικά'
99
99
  },
100
100
  'en-GB': {
101
101
  label: 'English(GB)'
@@ -104,25 +104,25 @@ const locale = {
104
104
  label: 'English'
105
105
  },
106
106
  'es-ES': {
107
- label: "Espa\xf1ol"
107
+ label: 'Español'
108
108
  },
109
109
  'et-EE': {
110
110
  label: 'Estonian (Eesti)'
111
111
  },
112
112
  'fa-IR': {
113
- label: "\u0641\u0627\u0631\u0633\u06CC"
113
+ label: 'فارسی'
114
114
  },
115
115
  'fi-FI': {
116
116
  label: 'Suomi'
117
117
  },
118
118
  'fr-BE': {
119
- label: "Fran\xe7ais(BE)"
119
+ label: 'Français(BE)'
120
120
  },
121
121
  'fr-CA': {
122
- label: "Fran\xe7ais(CA)"
122
+ label: 'Français(CA)'
123
123
  },
124
124
  'fr-FR': {
125
- label: "Fran\xe7ais"
125
+ label: 'Français'
126
126
  },
127
127
  'ga-IE': {
128
128
  label: 'Gaeilge'
@@ -131,10 +131,10 @@ const locale = {
131
131
  label: 'Galego'
132
132
  },
133
133
  'he-IL': {
134
- label: "\u05E2\u05D1\u05E8\u05D9\u05EA"
134
+ label: 'עברית'
135
135
  },
136
136
  'hi-IN': {
137
- label: "\u0939\u093F\u0928\u094D\u0926\u0940"
137
+ label: 'हिन्दी'
138
138
  },
139
139
  'hr-HR': {
140
140
  label: 'Hrvatski jezik'
@@ -143,61 +143,61 @@ const locale = {
143
143
  label: 'Magyar'
144
144
  },
145
145
  'hy-AM': {
146
- label: "\u0540\u0561\u0575\u0565\u0580\u0565\u0576"
146
+ label: 'Հայերեն'
147
147
  },
148
148
  'id-ID': {
149
149
  label: 'Bahasa Indonesia'
150
150
  },
151
151
  'is-IS': {
152
- label: "\xcdslenska"
152
+ label: 'Íslenska'
153
153
  },
154
154
  'it-IT': {
155
155
  label: 'Italiano'
156
156
  },
157
157
  'ja-JP': {
158
- label: "\u65E5\u672C\u8A9E"
158
+ label: '日本語'
159
159
  },
160
160
  'ka-GE': {
161
- label: "\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8"
161
+ label: 'ქართული'
162
162
  },
163
163
  'kk-KZ': {
164
- label: "\u049A\u0430\u0437\u0430\u049B \u0442\u0456\u043B\u0456"
164
+ label: 'Қазақ тілі'
165
165
  },
166
166
  'km-KH': {
167
- label: "\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A"
167
+ label: 'ភាសាខ្មែរ'
168
168
  },
169
169
  'kn-IN': {
170
- label: "\u0C95\u0CA8\u0CCD\u0CA8\u0CA1"
170
+ label: 'ಕನ್ನಡ'
171
171
  },
172
172
  'ko-KR': {
173
- label: "\uD55C\uAD6D\uC5B4"
173
+ label: '한국어'
174
174
  },
175
175
  'ku-IQ': {
176
- label: "\u06A9\u0648\u0631\u062F\u06CC"
176
+ label: 'کوردی'
177
177
  },
178
178
  'lt-LT': {
179
- label: "lietuvi\u0173"
179
+ label: 'lietuvių'
180
180
  },
181
181
  'lv-LV': {
182
- label: "Latvie\u0161u valoda"
182
+ label: 'Latviešu valoda'
183
183
  },
184
184
  'mk-MK': {
185
- label: "\u043C\u0430\u043A\u0435\u0434\u043E\u043D\u0441\u043A\u0438 \u0458\u0430\u0437\u0438\u043A"
185
+ label: 'македонски јазик'
186
186
  },
187
187
  'ml-IN': {
188
- label: "\u0D2E\u0D32\u0D2F\u0D3E\u0D33\u0D02"
188
+ label: 'മലയാളം'
189
189
  },
190
190
  'mn-MN': {
191
- label: "\u041C\u043E\u043D\u0433\u043E\u043B \u0445\u044D\u043B"
191
+ label: 'Монгол хэл'
192
192
  },
193
193
  'ms-MY': {
194
- label: "\u0628\u0647\u0627\u0633 \u0645\u0644\u0627\u064A\u0648"
194
+ label: 'بهاس ملايو'
195
195
  },
196
196
  'nb-NO': {
197
- label: "Norsk bokm\xe5l"
197
+ label: 'Norsk bokmål'
198
198
  },
199
199
  'ne-NP': {
200
- label: "\u0928\u0947\u092A\u093E\u0932\u0940"
200
+ label: 'नेपाली'
201
201
  },
202
202
  'nl-BE': {
203
203
  label: 'Vlaams'
@@ -209,28 +209,28 @@ const locale = {
209
209
  label: 'Polski'
210
210
  },
211
211
  'pt-BR': {
212
- label: "Portugu\xeas brasileiro"
212
+ label: 'Português brasileiro'
213
213
  },
214
214
  'pt-PT': {
215
- label: "Portugu\xeas"
215
+ label: 'Português'
216
216
  },
217
217
  'ro-RO': {
218
- label: "Rom\xe2nia"
218
+ label: 'România'
219
219
  },
220
220
  'ru-RU': {
221
- label: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"
221
+ label: 'Русский'
222
222
  },
223
223
  'si-LK': {
224
- label: "\u0DC3\u0DD2\u0D82\u0DC4\u0DBD"
224
+ label: 'සිංහල'
225
225
  },
226
226
  'sk-SK': {
227
- label: "Sloven\u010Dina"
227
+ label: 'Slovenčina'
228
228
  },
229
229
  'sl-SI': {
230
- label: "Sloven\u0161\u010Dina"
230
+ label: 'Slovenščina'
231
231
  },
232
232
  'sr-RS': {
233
- label: "\u0441\u0440\u043F\u0441\u043A\u0438 \u0458\u0435\u0437\u0438\u043A"
233
+ label: 'српски језик'
234
234
  },
235
235
  'sv-SE': {
236
236
  label: 'Svenska'
@@ -239,31 +239,31 @@ const locale = {
239
239
  label: 'Tamil'
240
240
  },
241
241
  'th-TH': {
242
- label: "\u0E20\u0E32\u0E29\u0E32\u0E44\u0E17\u0E22"
242
+ label: 'ภาษาไทย'
243
243
  },
244
244
  'tk-TK': {
245
245
  label: 'Turkmen'
246
246
  },
247
247
  'tr-TR': {
248
- label: "T\xfcrk\xe7e"
248
+ label: 'Türkçe'
249
249
  },
250
250
  'uk-UA': {
251
- label: "\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430"
251
+ label: 'Українська'
252
252
  },
253
253
  'ur-PK': {
254
- label: "O\u02BBzbekcha"
254
+ label: 'Oʻzbekcha'
255
255
  },
256
256
  'vi-VN': {
257
- label: "Ti\u1EBFng Vi\u1EC7t"
257
+ label: 'Tiếng Việt'
258
258
  },
259
259
  'zh-CN': {
260
- label: "\u7B80\u4F53\u4E2D\u6587"
260
+ label: '简体中文'
261
261
  },
262
262
  'zh-HK': {
263
- label: "\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09"
263
+ label: '繁體中文(香港)'
264
264
  },
265
265
  'zh-TW': {
266
- label: "\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u6E7E\uFF09"
266
+ label: '繁體中文(台湾)'
267
267
  }
268
268
  };
269
269
  export { dayjsLocale, locale as default };
@@ -129,7 +129,10 @@ const useTableBlockProps = ()=>{
129
129
  prevMergedFilter = currFilter;
130
130
  dataBlocks.forEach((item)=>{
131
131
  const targetsUidList = targets.map((targetItem)=>targetItem.uid);
132
- if (targetsUidList.includes(item.uid) && !item.associatedFields.find((assItem)=>assItem.name === target.field || target.field.includes(assItem.name))) {
132
+ if (targetsUidList.includes(item.uid) && !item.associatedFields.find((assItem)=>{
133
+ var _target_field;
134
+ return assItem.name === target.field || (null == (_target_field = target.field) ? void 0 : _target_field.includes(assItem.name));
135
+ })) {
133
136
  const prevFlatItems = flat(prevMergedFilter);
134
137
  Object.entries(prevFlatItems).forEach((param)=>{
135
138
  let [key, prevItem] = param;
@@ -1,3 +1,4 @@
1
+ import { CodeMirror } from "@tego/client";
1
2
  import { Plugin } from "../../application/Plugin.mjs";
2
3
  import { actionSettings } from "./action/index.mjs";
3
4
  import { useFilterActionProps } from "./filter/useFilterActionProps.mjs";
@@ -16,7 +17,8 @@ class AntdSchemaComponentPlugin extends Plugin {
16
17
  addComponents() {
17
18
  this.app.addComponents({
18
19
  ...__WEBPACK_EXTERNAL_MODULE__index_mjs_6e7aec25__,
19
- ...__WEBPACK_EXTERNAL_MODULE__common_index_mjs_af2a4306__
20
+ ...__WEBPACK_EXTERNAL_MODULE__common_index_mjs_af2a4306__,
21
+ CodeMirror: CodeMirror
20
22
  });
21
23
  }
22
24
  addScopes() {
@@ -2,7 +2,7 @@ import { useContext } from "react";
2
2
  import { ConfigProvider } from "antd";
3
3
  const usePrefixCls = (tag, props)=>{
4
4
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext) || {};
5
- if ('ConfigContext' in ConfigProvider) return (null == getPrefixCls ? void 0 : getPrefixCls(tag, null == props ? void 0 : props.prefixCls)) || '';
5
+ if ("ConfigContext" in ConfigProvider) return (null == getPrefixCls ? void 0 : getPrefixCls(tag, null == props ? void 0 : props.prefixCls)) || '';
6
6
  {
7
7
  var _props_prefixCls;
8
8
  const prefix = null != (_props_prefixCls = null == props ? void 0 : props.prefixCls) ? _props_prefixCls : 'ant-';
@@ -33,7 +33,7 @@ function _templateObject1() {
33
33
  function _templateObject2() {
34
34
  const data = _tagged_template_literal([
35
35
  "\n position: sticky !important;\n top: 0 !important;\n z-index: 100 !important;\n background: #fff !important;\n background-color: #fff !important;\n padding: ",
36
- "px 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border-bottom: 1px solid rgba(5, 5, 5, 0.06);\n margin: 0 -16px;\n padding-left: 16px;\n padding-right: 16px;\n\n /* \u786E\u4FDD\u5B8C\u5168\u906E\u6321 */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100vw;\n right: -100vw;\n bottom: 0;\n background: #fff;\n z-index: -1;\n }\n "
36
+ "px 0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n border-bottom: 1px solid rgba(5, 5, 5, 0.06);\n margin: 0 -16px;\n padding-left: 16px;\n padding-right: 16px;\n\n /* 确保完全遮挡 */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100vw;\n right: -100vw;\n bottom: 0;\n background: #fff;\n z-index: -1;\n }\n "
37
37
  ]);
38
38
  _templateObject2 = function() {
39
39
  return data;
@@ -314,7 +314,7 @@ function WorkflowSelectComponent(param) {
314
314
  key: void 0 === props.filterKey ? void 0 : props.filterKey
315
315
  },
316
316
  sort: [
317
- '-updatedAt'
317
+ '-initAt'
318
318
  ]
319
319
  }
320
320
  },
@@ -29,6 +29,7 @@ import { ActionPage } from "./Action.Page.mjs";
29
29
  import Action_style from "./Action.style.mjs";
30
30
  import { ActionContextProvider } from "./context.mjs";
31
31
  import { useA } from "./hooks.mjs";
32
+ import { useCompiledAction } from "./hooks/useCompiledAction.mjs";
32
33
  import { useGetAriaLabelOfAction } from "./hooks/useGetAriaLabelOfAction.mjs";
33
34
  import { linkageAction } from "./utils.mjs";
34
35
  const Action = withDynamicSchemaProps(observer((props)=>{
@@ -44,9 +45,8 @@ const Action = withDynamicSchemaProps(observer((props)=>{
44
45
  const field = useField();
45
46
  const app = useApp();
46
47
  const pageMode = app.usePageMode();
47
- const { run, element } = useAction(actionCallback);
48
48
  const fieldSchema = useFieldSchema();
49
- const compile = useCompile();
49
+ const { run, element } = useCompiledAction(useAction, actionCallback);
50
50
  const form = useForm();
51
51
  const record = useCollectionRecordData();
52
52
  const collection = useCollection();
@@ -65,6 +65,7 @@ const Action = withDynamicSchemaProps(observer((props)=>{
65
65
  }
66
66
  });
67
67
  const { getAriaLabel } = useGetAriaLabelOfAction(title);
68
+ const compile = useCompile();
68
69
  let actionTitle = title || compile(fieldSchema.title);
69
70
  actionTitle = lodash.isString(actionTitle) ? t(actionTitle) : actionTitle;
70
71
  useEffect(()=>{
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 编译 useAction,支持函数和字符串引用两种形式
3
+ * @param useAction - 可以是函数或字符串引用(如 '{{ useRevisionAction }}')
4
+ * @param actionCallback - 传递给 useAction 的回调函数
5
+ * @returns 编译后的 useAction hook 的返回值 { run, element }
6
+ */
7
+ export declare const useCompiledAction: (useAction: any, actionCallback?: any) => any;
@@ -0,0 +1,35 @@
1
+ import { useMemo } from "react";
2
+ import { useExpressionScope } from "@tachybase/schema";
3
+ import { useCompile } from "../../../hooks/index.mjs";
4
+ import { useA } from "../hooks.mjs";
5
+ const useCompiledAction = (useAction, actionCallback)=>{
6
+ const compile = useCompile();
7
+ const scope = useExpressionScope();
8
+ const compiledUseAction = useMemo(()=>{
9
+ if ('function' == typeof useAction) return useAction;
10
+ if ('string' == typeof useAction && useAction.startsWith('{{')) {
11
+ const match = useAction.match(/\{\{\s*([^}]+)\s*\}\}/);
12
+ if (match && match[1]) {
13
+ const expression = match[1].trim();
14
+ const func = scope[expression];
15
+ if ('function' == typeof func) return func;
16
+ const compiled = compile(useAction);
17
+ if ('function' == typeof compiled) return compiled;
18
+ console.warn("useAction not found in scope or compilation failed: ".concat(expression), scope);
19
+ return useA;
20
+ }
21
+ const compiled = compile(useAction);
22
+ if ('function' == typeof compiled) return compiled;
23
+ console.warn("useAction compilation failed: ".concat(useAction), compiled);
24
+ return useA;
25
+ }
26
+ console.warn("useAction is not a function or string reference:", useAction);
27
+ return useA;
28
+ }, [
29
+ useAction,
30
+ compile,
31
+ scope
32
+ ]);
33
+ return compiledUseAction(actionCallback);
34
+ };
35
+ export { useCompiledAction };