@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
|
@@ -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(
|
|
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 (
|
|
26
|
-
const protocol = '
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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),
|
|
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)
|
|
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) {
|
|
@@ -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:
|
|
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:
|
|
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:
|
|
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: "
|
|
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: "
|
|
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("
|
|
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("
|
|
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("
|
|
161
|
+
label: '{{t("≤")}}',
|
|
162
162
|
value: '$lte'
|
|
163
163
|
},
|
|
164
164
|
{
|
package/es/hooks/index.d.ts
CHANGED
package/es/hooks/index.mjs
CHANGED
|
@@ -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 };
|
package/es/locale/index.mjs
CHANGED
|
@@ -68,25 +68,25 @@ const dayjsLocale = {
|
|
|
68
68
|
};
|
|
69
69
|
const locale = {
|
|
70
70
|
'ar-EG': {
|
|
71
|
-
label:
|
|
71
|
+
label: 'العربية'
|
|
72
72
|
},
|
|
73
73
|
'az-AZ': {
|
|
74
|
-
label:
|
|
74
|
+
label: 'Azərbaycan dili'
|
|
75
75
|
},
|
|
76
76
|
'bg-BG': {
|
|
77
|
-
label:
|
|
77
|
+
label: 'Български'
|
|
78
78
|
},
|
|
79
79
|
'bn-BD': {
|
|
80
80
|
label: 'Bengali'
|
|
81
81
|
},
|
|
82
82
|
'by-BY': {
|
|
83
|
-
label:
|
|
83
|
+
label: 'Беларускі'
|
|
84
84
|
},
|
|
85
85
|
'ca-ES': {
|
|
86
|
-
label:
|
|
86
|
+
label: 'Сatalà/Espanya'
|
|
87
87
|
},
|
|
88
88
|
'cs-CZ': {
|
|
89
|
-
label:
|
|
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:
|
|
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:
|
|
107
|
+
label: 'Español'
|
|
108
108
|
},
|
|
109
109
|
'et-EE': {
|
|
110
110
|
label: 'Estonian (Eesti)'
|
|
111
111
|
},
|
|
112
112
|
'fa-IR': {
|
|
113
|
-
label:
|
|
113
|
+
label: 'فارسی'
|
|
114
114
|
},
|
|
115
115
|
'fi-FI': {
|
|
116
116
|
label: 'Suomi'
|
|
117
117
|
},
|
|
118
118
|
'fr-BE': {
|
|
119
|
-
label:
|
|
119
|
+
label: 'Français(BE)'
|
|
120
120
|
},
|
|
121
121
|
'fr-CA': {
|
|
122
|
-
label:
|
|
122
|
+
label: 'Français(CA)'
|
|
123
123
|
},
|
|
124
124
|
'fr-FR': {
|
|
125
|
-
label:
|
|
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:
|
|
134
|
+
label: 'עברית'
|
|
135
135
|
},
|
|
136
136
|
'hi-IN': {
|
|
137
|
-
label:
|
|
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:
|
|
146
|
+
label: 'Հայերեն'
|
|
147
147
|
},
|
|
148
148
|
'id-ID': {
|
|
149
149
|
label: 'Bahasa Indonesia'
|
|
150
150
|
},
|
|
151
151
|
'is-IS': {
|
|
152
|
-
label:
|
|
152
|
+
label: 'Íslenska'
|
|
153
153
|
},
|
|
154
154
|
'it-IT': {
|
|
155
155
|
label: 'Italiano'
|
|
156
156
|
},
|
|
157
157
|
'ja-JP': {
|
|
158
|
-
label:
|
|
158
|
+
label: '日本語'
|
|
159
159
|
},
|
|
160
160
|
'ka-GE': {
|
|
161
|
-
label:
|
|
161
|
+
label: 'ქართული'
|
|
162
162
|
},
|
|
163
163
|
'kk-KZ': {
|
|
164
|
-
label:
|
|
164
|
+
label: 'Қазақ тілі'
|
|
165
165
|
},
|
|
166
166
|
'km-KH': {
|
|
167
|
-
label:
|
|
167
|
+
label: 'ភាសាខ្មែរ'
|
|
168
168
|
},
|
|
169
169
|
'kn-IN': {
|
|
170
|
-
label:
|
|
170
|
+
label: 'ಕನ್ನಡ'
|
|
171
171
|
},
|
|
172
172
|
'ko-KR': {
|
|
173
|
-
label:
|
|
173
|
+
label: '한국어'
|
|
174
174
|
},
|
|
175
175
|
'ku-IQ': {
|
|
176
|
-
label:
|
|
176
|
+
label: 'کوردی'
|
|
177
177
|
},
|
|
178
178
|
'lt-LT': {
|
|
179
|
-
label:
|
|
179
|
+
label: 'lietuvių'
|
|
180
180
|
},
|
|
181
181
|
'lv-LV': {
|
|
182
|
-
label:
|
|
182
|
+
label: 'Latviešu valoda'
|
|
183
183
|
},
|
|
184
184
|
'mk-MK': {
|
|
185
|
-
label:
|
|
185
|
+
label: 'македонски јазик'
|
|
186
186
|
},
|
|
187
187
|
'ml-IN': {
|
|
188
|
-
label:
|
|
188
|
+
label: 'മലയാളം'
|
|
189
189
|
},
|
|
190
190
|
'mn-MN': {
|
|
191
|
-
label:
|
|
191
|
+
label: 'Монгол хэл'
|
|
192
192
|
},
|
|
193
193
|
'ms-MY': {
|
|
194
|
-
label:
|
|
194
|
+
label: 'بهاس ملايو'
|
|
195
195
|
},
|
|
196
196
|
'nb-NO': {
|
|
197
|
-
label:
|
|
197
|
+
label: 'Norsk bokmål'
|
|
198
198
|
},
|
|
199
199
|
'ne-NP': {
|
|
200
|
-
label:
|
|
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:
|
|
212
|
+
label: 'Português brasileiro'
|
|
213
213
|
},
|
|
214
214
|
'pt-PT': {
|
|
215
|
-
label:
|
|
215
|
+
label: 'Português'
|
|
216
216
|
},
|
|
217
217
|
'ro-RO': {
|
|
218
|
-
label:
|
|
218
|
+
label: 'România'
|
|
219
219
|
},
|
|
220
220
|
'ru-RU': {
|
|
221
|
-
label:
|
|
221
|
+
label: 'Русский'
|
|
222
222
|
},
|
|
223
223
|
'si-LK': {
|
|
224
|
-
label:
|
|
224
|
+
label: 'සිංහල'
|
|
225
225
|
},
|
|
226
226
|
'sk-SK': {
|
|
227
|
-
label:
|
|
227
|
+
label: 'Slovenčina'
|
|
228
228
|
},
|
|
229
229
|
'sl-SI': {
|
|
230
|
-
label:
|
|
230
|
+
label: 'Slovenščina'
|
|
231
231
|
},
|
|
232
232
|
'sr-RS': {
|
|
233
|
-
label:
|
|
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:
|
|
242
|
+
label: 'ภาษาไทย'
|
|
243
243
|
},
|
|
244
244
|
'tk-TK': {
|
|
245
245
|
label: 'Turkmen'
|
|
246
246
|
},
|
|
247
247
|
'tr-TR': {
|
|
248
|
-
label:
|
|
248
|
+
label: 'Türkçe'
|
|
249
249
|
},
|
|
250
250
|
'uk-UA': {
|
|
251
|
-
label:
|
|
251
|
+
label: 'Українська'
|
|
252
252
|
},
|
|
253
253
|
'ur-PK': {
|
|
254
|
-
label:
|
|
254
|
+
label: 'Oʻzbekcha'
|
|
255
255
|
},
|
|
256
256
|
'vi-VN': {
|
|
257
|
-
label:
|
|
257
|
+
label: 'Tiếng Việt'
|
|
258
258
|
},
|
|
259
259
|
'zh-CN': {
|
|
260
|
-
label:
|
|
260
|
+
label: '简体中文'
|
|
261
261
|
},
|
|
262
262
|
'zh-HK': {
|
|
263
|
-
label:
|
|
263
|
+
label: '繁體中文(香港)'
|
|
264
264
|
},
|
|
265
265
|
'zh-TW': {
|
|
266
|
-
label:
|
|
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)=>
|
|
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 (
|
|
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 /*
|
|
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;
|
|
@@ -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
|
|
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 };
|