@nocobase/plugin-client 2.2.0-alpha.1 → 2.2.0-alpha.11

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.
@@ -154,10 +154,12 @@
154
154
  "Assign value": "赋值",
155
155
  "A pre-filled value. Editable, for new entries only, and won’t affect existing data (including empty values).": "预填值,可修改,仅用于新增,不影响已有数据(含空值)",
156
156
  "A system-set value. Read-only.": "系统固定值,只读不可改",
157
+ "Overrides existing values until the user edits it.": "覆盖已有值,直到用户修改该字段",
157
158
  "Assignment mode": "赋值方式",
158
159
  "Associate": "关联",
159
160
  "Field values": "字段值",
160
161
  "Fixed value": "固定值",
162
+ "Override value": "覆盖值",
161
163
  "Associated records": "关联记录",
162
164
  "Association field settings": "关系字段设置",
163
165
  "Association fields": "关系字段",
@@ -203,6 +205,7 @@
203
205
  "Block templates": "区块模板",
204
206
  "Block title": "区块标题",
205
207
  "Menu linkage rules": "菜单联动规则",
208
+ "Tab linkage rules": "标签页联动规则",
206
209
  "Block type": "区块类型",
207
210
  "Blocks": "区块",
208
211
  "Blue": "拂晓蓝",
@@ -603,7 +606,7 @@
603
606
  "Exportable fields": "可导出字段",
604
607
  "Expression": "表达式",
605
608
  "Expression collection": "表达式表",
606
- "FORMULAJS_DOC_URL": "https://v2.docs.nocobase.com/cn/calculation-engine/formula",
609
+ "FORMULAJS_DOC_URL": "https://docs.nocobase.com/cn/calculation-engine/formula",
607
610
  "Failed to load plugin": "插件加载失败",
608
611
  "False": "假",
609
612
  "Feedback": "反馈问题",
@@ -612,6 +615,7 @@
612
615
  "Assignment takes precedence over form field assignment": "赋值优先级高于表单字段赋值",
613
616
  "Field assignment": "字段赋值",
614
617
  "Field component": "字段组件",
618
+ "Server-side field validation rules": "服务端字段验证规则",
615
619
  "Field display name": "字段名称",
616
620
  "Field interface": "UI 类型",
617
621
  "Field linkage rules": "字段联动规则",
@@ -722,7 +726,7 @@
722
726
  "https://www.example.com": "https://www.example.com",
723
727
  "Icon": "图标",
724
728
  "Icon only": "仅显示图标",
725
- "Identifier for program usage. Support letters, numbers and underscores, must start with an letter.": "用于程序使用的标识符,支持字母、数字和下划线,必须以字母开头。",
729
+ "Identifier for program usage. Support letters, numbers and underscores, must start with a letter.": "用于程序使用的标识符,支持字母、数字和下划线,必须以字母开头。",
726
730
  "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "当数据表没有主键时,你需要配置记录唯一标识符,用于在区块中定位行记录,不配置将无法创建该表的数据区块。",
727
731
  "If collection inherits, choose inherited collections as templates": "当前表有继承关系时,可选择继承链路上的表作为模板来源",
728
732
  "If selected, the page will display Tab pages.": "如果选中,该页面将显示标签页。",
@@ -813,7 +817,7 @@
813
817
  "Logo": "Logo",
814
818
  "Logs": "日志",
815
819
  "Long text": "多行文本",
816
- "MATHJS_DOC_URL": "https://v2.docs.nocobase.com/cn/calculation-engine/math",
820
+ "MATHJS_DOC_URL": "https://docs.nocobase.com/cn/calculation-engine/math",
817
821
  "Magenta": "法式洋红",
818
822
  "Main": "主数据源",
819
823
  "Main department": "主属部门",
@@ -902,6 +906,7 @@
902
906
  "No blocks to connect": "没有可连接的区块",
903
907
  "No camera device detected": "未检测到摄像头设备",
904
908
  "No configuration available.": "无可配置项。",
909
+ "No configured entries": "未配置入口",
905
910
  "No available data currently": "当前无可用数据",
906
911
  "No data": "暂无数据",
907
912
  "No event flows": "暂无事件流",
@@ -954,6 +959,7 @@
954
959
  "Open in new window": "新窗口打开",
955
960
  "Open in<1><0>Modal</0><1>Drawer</1><2>Window</2></1>": "在 <1><0>对话框</0><1>抽屉</1><2>窗口</2></1> 内打开",
956
961
  "Open classic page access": "跳转到旧版页面",
962
+ "Open from the original entry": "返回原入口访问",
957
963
  "Open mode": "打开方式",
958
964
  "Open mode configuration": "打开方式配置",
959
965
  "Operate on existing data": "对已有数据操作",
@@ -1110,7 +1116,7 @@
1110
1116
  "Quick duplicate": "快速复制",
1111
1117
  "Quick upload": "快速上传",
1112
1118
  "Radio group": "单选框",
1113
- "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "随机生成,可修改。支持英文、数字和下划线,必须以英文字母开头。",
1119
+ "Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.": "随机生成,可修改。支持英文、数字和下划线,必须以英文字母开头。",
1114
1120
  "Read only": "只读(禁止编辑)",
1115
1121
  "ReadOnly": "只读",
1116
1122
  "ReadPretty": "美观只读",
@@ -1255,6 +1261,7 @@
1255
1261
  "Set block state": "设置区块状态",
1256
1262
  "Set button state": "设置按钮状态",
1257
1263
  "Set menu item state": "设置菜单项状态",
1264
+ "Set tab state": "设置标签页状态",
1258
1265
  "Set condition": "设置条件",
1259
1266
  "Set data loading mode": "设置数据加载方式",
1260
1267
  "Set data scope": "设置数据范围",
@@ -1274,6 +1281,7 @@
1274
1281
  "Setting": "设置",
1275
1282
  "Settings": "设置",
1276
1283
  "Set Primary Key": "设置主键",
1284
+ "Show block card": "显示区块卡片",
1277
1285
  "Show date range": "显示日期范围",
1278
1286
  "Show file name": "显示文件名",
1279
1287
  "Show in menu": "在菜单中显示",
@@ -1409,6 +1417,7 @@
1409
1417
  "The following field types are not compatible and do not support output and display": "以下字段类型未适配,不支持输出和显示",
1410
1418
  "The selected fields will automatically populate the form": "用于自动填充到表单",
1411
1419
  "The title field is used to identify the template record": "用于识别模板数据",
1420
+ "The {{modernClientPath}} branch only supports new pages. This page is a legacy page. Please open it from the original entry.": "{{modernClientPath}} 分支仅支持新版页面,当前页面属于旧版页面。请返回原入口访问。",
1412
1421
  "The value of this variable is derived from the query string of the page URL. This variable can only be used normally when the page has a query string.": "该变量的值是根据页面 URL 的 query string 得来的,只有当页面存在 query string 的时候,该变量才能正常使用。",
1413
1422
  "The will interrupt service, it may take a few seconds to restart. Are you sure to continue?": "重启将会中断当前服务,这个过程可能需要一点时间,确定要继续吗?",
1414
1423
  "The {{type}} \"{{name}}\" may have been deleted. Please remove this {{blockType}}.": "{{type}} \"{{name}}\" 可能已被删除。请删除当前{{blockType}}.",
@@ -1425,6 +1434,7 @@
1425
1434
  "This field is required": "此字段为必填项",
1426
1435
  "This is a demo text, **supports Markdown syntax**.": "这是一段演示文本,**支持 Markdown 语法**。",
1427
1436
  "This is likely a NocoBase internals bug. Please open an issue at <1>here</1>": "这可能是 NocoBase 内部的问题,你可以在<1>这里</1>将该错误反馈给我们,我们会尽快修复",
1437
+ "This page is not supported in the {{modernClientPath}} branch": "此页面不支持在 {{modernClientPath}} 分支中使用",
1428
1438
  "This month": "本月",
1429
1439
  "This quarter": "本季度",
1430
1440
  "This variable has been deprecated and can be replaced with \"Current form\"": "该变量已被弃用,可以使用“当前表单”替代",
@@ -1462,6 +1472,7 @@
1462
1472
  "Two tone": "双色风格",
1463
1473
  "Type": "类型",
1464
1474
  "UI Editor": "界面配置",
1475
+ "Client-side validation rules": "客户端验证规则",
1465
1476
  "UI editor": "界面配置",
1466
1477
  "URL": "URL",
1467
1478
  "URL search params": "URL 查询参数",
@@ -1628,6 +1639,7 @@
1628
1639
  "Enable select action": "启用选择操作",
1629
1640
  "Enable remove action": "启用移除操作",
1630
1641
  "Multiple": "多选",
1642
+ "Multiple of": "多倍数",
1631
1643
  "Custom column width": "自定义列宽度",
1632
1644
  "The block is hidden and only visible when the UI Editor is active": "当前区块已被隐藏,仅配置状态下显示",
1633
1645
  "The field is hidden and only visible when the UI Editor is active": "当前字段已被隐藏,仅配置状态下显示",
@@ -576,7 +576,7 @@
576
576
  "Exportable fields": "可匯出欄位",
577
577
  "Expression": "表達式",
578
578
  "Expression collection": "表達式表",
579
- "FORMULAJS_DOC_URL": "https://v2.docs.nocobase.com/cn/calculation-engine/formula",
579
+ "FORMULAJS_DOC_URL": "https://docs.nocobase.com/cn/calculation-engine/formula",
580
580
  "Failed to load plugin": "插件載入失敗",
581
581
  "False": "False",
582
582
  "Feedback": "反饋問題",
@@ -690,7 +690,7 @@
690
690
  "ID": "ID",
691
691
  "Icon": "圖示",
692
692
  "Icon only": "Icon only",
693
- "Identifier for program usage. Support letters, numbers and underscores, must start with an letter.": "用於程式使用的識別符號,支援字母、數字和下劃線,必須以字母開頭。",
693
+ "Identifier for program usage. Support letters, numbers and underscores, must start with a letter.": "用於程式使用的識別符號,支援字母、數字和下劃線,必須以字母開頭。",
694
694
  "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.",
695
695
  "If collection inherits, choose inherited collections as templates": "當前表有繼承關聯時,可選擇繼承鏈路上的表作為模板來源",
696
696
  "If selected, the page will display Tab pages.": "如果選中,該頁面將顯示標籤頁。",
@@ -778,7 +778,7 @@
778
778
  "Logo": "Logo",
779
779
  "Logs": "日誌",
780
780
  "Long text": "多行文字",
781
- "MATHJS_DOC_URL": "https://v2.docs.nocobase.com/cn/calculation-engine/math",
781
+ "MATHJS_DOC_URL": "https://docs.nocobase.com/cn/calculation-engine/math",
782
782
  "Magenta": "法式洋紅",
783
783
  "Main": "Main",
784
784
  "Main department": "Main department",
@@ -1061,7 +1061,7 @@
1061
1061
  "Quick duplicate": "快速複製",
1062
1062
  "Quick upload": "快速上傳",
1063
1063
  "Radio group": "單選框",
1064
- "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "隨機生成,可編輯。支援英文、數字和下劃線,必須以英文字母開頭。",
1064
+ "Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.": "隨機生成,可編輯。支援英文、數字和下劃線,必須以英文字母開頭。",
1065
1065
  "Read only": "唯讀",
1066
1066
  "ReadOnly": "ReadOnly",
1067
1067
  "ReadPretty": "ReadPretty",
@@ -1 +1 @@
1
- {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2026-06-10T18:11:50.208Z"}
1
+ {"name":"cronstrue","title":"cRonstrue","version":"2.47.0","description":"Convert cron expressions into human readable descriptions","author":"Brady Holt","license":"MIT","bugs":{"url":"https://github.com/bradymholt/cronstrue/issues"},"homepage":"https://github.com/bradymholt/cronstrue","keywords":["cron","cronjob","crontab","schedule","parser","cron expression","cron description","pretty cron","cron for humans","cron translated","cron english","cron schedule","cron english","cron schedule"],"main":"dist/cronstrue.js","bin":{"cronstrue":"bin/cli.js"},"typings":"dist/cronstrue.d.ts","files":["dist/","locales/","i18n.js","i18n.d.ts"],"repository":{"type":"git","url":"git+https://github.com/bradymholt/cronstrue.git"},"publishConfig":{"access":"public"},"prettier":{"printWidth":120},"devDependencies":{"@types/chai":"^4.2.11","@types/mocha":"^8.0.0","chai":"^4.2.0","handlebars":"^4.7.6","marked":"^4.0.10","mocha":"^10.1.0","pixl-xml":"^1.0.13","prettier":"^2.1.1","terser-webpack-plugin":"^5.3.1","ts-loader":"^9.2.6","ts-node":"^10.5.0","typescript":"^4.6.2","webpack":"^5.69.1","webpack-cli":"^4.9.2","xml2js":"^0.5.0"},"scripts":{"start":"npm run build","build":"npx tsc -p ./src --emitDeclarationOnly","test":"npx mocha --reporter spec --require ts-node/register \"./test/**/*.ts\"","prepublishOnly":"rm -rf ./dist && ./node_modules/webpack-cli/bin/cli.js && git add -A"},"dependencies":{},"_lastModified":"2026-07-28T07:39:58.822Z"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ import type { AppStatus } from '@nocobase/server';
10
+ export type AppPortalAppStatus = AppStatus | Record<string, AppStatus> | null;
11
+ export type AppPortalAppItem = {
12
+ name: string;
13
+ title?: string | null;
14
+ icon?: string | null;
15
+ cname?: string | null;
16
+ ssoEnabled?: boolean;
17
+ target?: string;
18
+ status?: AppPortalAppStatus;
19
+ };
20
+ export type AppPortalItem = {
21
+ uid?: string | null;
22
+ appName: string;
23
+ title?: string | null;
24
+ icon?: string | null;
25
+ routePath: string;
26
+ layout?: string | null;
27
+ defaultPortal?: boolean;
28
+ };
29
+ export type StoredAppPortalItem = Omit<AppPortalItem, 'appName' | 'defaultPortal'>;
30
+ export declare function listAppPortals(currentAppName?: string | null): Promise<{
31
+ apps: AppPortalAppItem[];
32
+ portals: AppPortalItem[];
33
+ }>;
@@ -0,0 +1,168 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var appPortals_exports = {};
28
+ __export(appPortals_exports, {
29
+ listAppPortals: () => listAppPortals
30
+ });
31
+ module.exports = __toCommonJS(appPortals_exports);
32
+ var import_server = require("@nocobase/server");
33
+ const MAIN_APP_NAME = "main";
34
+ const MULTI_PORTAL_MANIFEST_NAMESPACE = "multi-portal";
35
+ const DEFAULT_PORTALS = [
36
+ {
37
+ uid: "__default_admin__",
38
+ title: "Admin",
39
+ icon: "DesktopOutlined",
40
+ routePath: "/admin",
41
+ layout: "desktop",
42
+ defaultPortal: true
43
+ },
44
+ {
45
+ uid: "__default_mobile__",
46
+ title: "Mobile",
47
+ icon: "MobileOutlined",
48
+ routePath: "/mobile",
49
+ layout: "mobile",
50
+ defaultPortal: true
51
+ }
52
+ ];
53
+ function getCname(cname) {
54
+ const trimmed = cname == null ? void 0 : cname.trim();
55
+ return trimmed || null;
56
+ }
57
+ function getAppName(appModel) {
58
+ return typeof appModel.name === "string" && appModel.name ? appModel.name : null;
59
+ }
60
+ function getAppStatus(appName, statuses) {
61
+ return statuses[appName] ?? null;
62
+ }
63
+ function shouldUseCnameVisitUrl(options) {
64
+ const { cname, ssoEnabled, ssoCnameEnabled } = options;
65
+ return Boolean(cname && (!ssoEnabled || ssoCnameEnabled));
66
+ }
67
+ function toAppPortalAppItem(appModel, appSsoIssuer, target) {
68
+ var _a, _b, _c, _d;
69
+ const name = getAppName(appModel);
70
+ if (!name || name === MAIN_APP_NAME) {
71
+ return null;
72
+ }
73
+ const cname = getCname(appModel.cname);
74
+ const ssoEnabled = ((_b = (_a = appModel.options) == null ? void 0 : _a.sso) == null ? void 0 : _b.enabled) === true;
75
+ const ssoCnameEnabled = Boolean(((_d = (_c = appModel.options) == null ? void 0 : _c.sso) == null ? void 0 : _d.issuer) || appSsoIssuer);
76
+ return {
77
+ name,
78
+ title: appModel.title || name,
79
+ icon: appModel.icon || null,
80
+ cname: shouldUseCnameVisitUrl({ cname, ssoEnabled, ssoCnameEnabled }) ? cname : null,
81
+ ssoEnabled,
82
+ target
83
+ };
84
+ }
85
+ function getPortalKey(item) {
86
+ return item.uid ? `${item.appName}:${item.uid}` : `${item.appName}:${item.routePath}`;
87
+ }
88
+ function addPortal(portals, item) {
89
+ if (!item.appName || !item.routePath) {
90
+ return;
91
+ }
92
+ portals.set(getPortalKey(item), item);
93
+ }
94
+ function addDefaultPortals(portals, appNames) {
95
+ for (const appName of appNames) {
96
+ for (const portal of DEFAULT_PORTALS) {
97
+ addPortal(portals, {
98
+ ...portal,
99
+ appName
100
+ });
101
+ }
102
+ }
103
+ }
104
+ function addStoredPortals(portals, appName, storedPortals) {
105
+ if (!Array.isArray(storedPortals)) {
106
+ return;
107
+ }
108
+ for (const portal of storedPortals) {
109
+ if (!portal || typeof portal.routePath !== "string" || !portal.routePath) {
110
+ continue;
111
+ }
112
+ addPortal(portals, {
113
+ uid: typeof portal.uid === "string" ? portal.uid : null,
114
+ appName,
115
+ title: typeof portal.title === "string" ? portal.title : null,
116
+ icon: typeof portal.icon === "string" ? portal.icon : null,
117
+ routePath: portal.routePath,
118
+ layout: typeof portal.layout === "string" ? portal.layout : null
119
+ });
120
+ }
121
+ }
122
+ async function listAppPortals(currentAppName) {
123
+ const supervisor = import_server.AppSupervisor.getInstance();
124
+ const appModels = await supervisor.listAppModels();
125
+ const apps = /* @__PURE__ */ new Map();
126
+ const appNames = /* @__PURE__ */ new Set([MAIN_APP_NAME]);
127
+ const target = currentAppName === MAIN_APP_NAME ? "_blank" : void 0;
128
+ const appSsoIssuer = supervisor.getAppSsoIssuer();
129
+ const appItems = appModels.map((appModel) => toAppPortalAppItem(appModel, appSsoIssuer, target));
130
+ if (currentAppName) {
131
+ appNames.add(currentAppName);
132
+ }
133
+ for (const app of appItems) {
134
+ if (!app) {
135
+ continue;
136
+ }
137
+ apps.set(app.name, app);
138
+ appNames.add(app.name);
139
+ }
140
+ if (appNames.size > 1 && !apps.has(MAIN_APP_NAME)) {
141
+ apps.set(MAIN_APP_NAME, {
142
+ name: MAIN_APP_NAME,
143
+ title: "Main",
144
+ icon: null
145
+ });
146
+ }
147
+ const appStatuses = await supervisor.getAppsStatuses(Array.from(appNames));
148
+ for (const app of apps.values()) {
149
+ app.status = getAppStatus(app.name, appStatuses);
150
+ }
151
+ const manifests = await supervisor.getAppManifests(
152
+ MULTI_PORTAL_MANIFEST_NAMESPACE,
153
+ Array.from(appNames)
154
+ );
155
+ const portals = /* @__PURE__ */ new Map();
156
+ addDefaultPortals(portals, appNames);
157
+ for (const appName of appNames) {
158
+ addStoredPortals(portals, appName, manifests[appName]);
159
+ }
160
+ return {
161
+ apps: [...apps.values()],
162
+ portals: [...portals.values()]
163
+ };
164
+ }
165
+ // Annotate the CommonJS export names for ESM import in node:
166
+ 0 && (module.exports = {
167
+ listAppPortals
168
+ });
@@ -32,10 +32,12 @@ module.exports = __toCommonJS(cron_exports);
32
32
  var import_utils = require("@nocobase/utils");
33
33
  var import_path = require("path");
34
34
  const getCronLocale = (lang) => {
35
- const lng = lang.replace("-", "_");
36
- const files = [(0, import_path.resolve)(__dirname, `./../locale/cron/${lng}`)];
35
+ const candidates = Array.from(/* @__PURE__ */ new Set([lang, lang.replace("-", "_")]));
36
+ const files = candidates.map((candidate) => (0, import_path.resolve)(__dirname, `./../locale/cron/${candidate}`));
37
37
  if (process.env.APP_ENV !== "production") {
38
- files.push(`@nocobase/client/src/locale/cron/${lng}`, `@nocobase/client/lib/locale/cron/${lng}`);
38
+ for (const candidate of candidates) {
39
+ files.push(`@nocobase/client/src/locale/cron/${candidate}`, `@nocobase/client/lib/locale/cron/${candidate}`);
40
+ }
39
41
  }
40
42
  for (const file of files) {
41
43
  try {
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare function parseLocaleResourceNamespaces(value: unknown): string[];
10
+ export declare function filterLocaleResources<T extends {
11
+ resources?: Record<string, unknown>;
12
+ }>(payload: T, namespaceQuery: unknown): T;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var localeResources_exports = {};
28
+ __export(localeResources_exports, {
29
+ filterLocaleResources: () => filterLocaleResources,
30
+ parseLocaleResourceNamespaces: () => parseLocaleResourceNamespaces
31
+ });
32
+ module.exports = __toCommonJS(localeResources_exports);
33
+ function parseLocaleResourceNamespaces(value) {
34
+ const values = Array.isArray(value) ? value : [value];
35
+ return [
36
+ ...new Set(
37
+ values.flatMap((item) => typeof item === "string" ? item.split(",") : []).map((item) => item.trim()).filter(Boolean)
38
+ )
39
+ ];
40
+ }
41
+ function filterLocaleResources(payload, namespaceQuery) {
42
+ const namespaces = parseLocaleResourceNamespaces(namespaceQuery);
43
+ if (!namespaces.length) return payload;
44
+ const resources = payload.resources || {};
45
+ return {
46
+ ...payload,
47
+ resources: Object.fromEntries(
48
+ namespaces.filter((namespace) => Object.prototype.hasOwnProperty.call(resources, namespace)).map((namespace) => [namespace, resources[namespace]])
49
+ )
50
+ };
51
+ }
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ filterLocaleResources,
55
+ parseLocaleResourceNamespaces
56
+ });
@@ -45,9 +45,11 @@ var import_utils = require("@nocobase/utils");
45
45
  var import_lodash = __toESM(require("lodash"));
46
46
  var process = __toESM(require("node:process"));
47
47
  var import_path = require("path");
48
+ var import_appPortals = require("./appPortals");
48
49
  var import_antd = require("./antd");
49
50
  var import_cron = require("./cron");
50
51
  var import_cronstrue = require("./cronstrue");
52
+ var import_localeResources = require("./localeResources");
51
53
  async function getLang(ctx) {
52
54
  const SystemSetting = ctx.db.getRepository("systemSettings");
53
55
  const systemSetting = await SystemSetting.findOne();
@@ -80,6 +82,7 @@ class PluginClientServer extends import_server.Plugin {
80
82
  });
81
83
  this.app.acl.allow("app", "getLang");
82
84
  this.app.acl.allow("app", "getInfo");
85
+ this.app.acl.allow("app", "getPortals", "loggedIn");
83
86
  this.app.acl.registerSnippet({
84
87
  name: "app",
85
88
  actions: ["app:restart", "app:refresh", "app:clearCache", "app:publishEvent"]
@@ -121,13 +124,18 @@ class PluginClientServer extends import_server.Plugin {
121
124
  },
122
125
  async getLang(ctx, next) {
123
126
  const lang = await getLang(ctx);
124
- const resources = await ctx.app.localeManager.get(lang);
127
+ const resources = (0, import_localeResources.filterLocaleResources)(await ctx.app.localeManager.get(lang), ctx.request.query.ns);
125
128
  ctx.body = {
126
129
  lang,
127
130
  ...resources
128
131
  };
129
132
  await next();
130
133
  },
134
+ getPortals: async (ctx, next) => {
135
+ var _a;
136
+ ctx.body = await (0, import_appPortals.listAppPortals)((_a = ctx.app) == null ? void 0 : _a.name);
137
+ await next();
138
+ },
131
139
  async clearCache(ctx, next) {
132
140
  await ctx.cache.reset();
133
141
  await next();
@@ -153,7 +161,7 @@ class PluginClientServer extends import_server.Plugin {
153
161
  }
154
162
  const { id, username } = ((_c = ctx.auth) == null ? void 0 : _c.user) ?? {};
155
163
  const user = id ? { id, username } : void 0;
156
- const eventName = `${command}@${plugin}`;
164
+ const eventName = `${command.replaceAll(":", ".")}.${plugin}`;
157
165
  try {
158
166
  await ctx.app.eventQueue.publish(eventName, {
159
167
  plugin,
@@ -201,7 +209,7 @@ class PluginClientServer extends import_server.Plugin {
201
209
  });
202
210
  this.app.acl.registerSnippet({
203
211
  name: `pm.desktopRoutes`,
204
- actions: ["desktopRoutes:list", "roles.desktopRoutes:*"]
212
+ actions: ["roles.desktopRoutes:*"]
205
213
  });
206
214
  this.app.acl.allow("desktopRoutes", ["listAccessible", "getAccessible"], "loggedIn");
207
215
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Provides a client interface for the NocoBase server",
7
7
  "description.ru-RU": "Предоставляет клиентский интерфейс для сервера NocoBase",
8
8
  "description.zh-CN": "为 NocoBase 服务端提供客户端界面",
9
- "version": "2.2.0-alpha.1",
9
+ "version": "2.2.0-alpha.11",
10
10
  "main": "./dist/server/index.js",
11
11
  "license": "Apache-2.0",
12
12
  "devDependencies": {
@@ -23,5 +23,5 @@
23
23
  "@nocobase/test": "2.x",
24
24
  "@nocobase/utils": "2.x"
25
25
  },
26
- "gitHead": "303663aba6c6eefa27e6a6435b4c0352074ec40f"
26
+ "gitHead": "c9ff1f51e5c33bc6437b64eb779212be71b78f58"
27
27
  }