@nocobase/plugin-mobile 1.6.0-alpha.9 → 1.6.0-beta.10

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.
@@ -8,3 +8,5 @@
8
8
  */
9
9
  export declare function usePluginTranslation(): import("react-i18next").UseTranslationResponse<string[], undefined>;
10
10
  export declare function generatePluginTranslationTemplate(key: string): string;
11
+ export declare const ROUTE_NAMESPACE = "lm-mobile-routes";
12
+ export declare function useRouteTranslation(): import("react-i18next").UseTranslationResponse<"lm-mobile-routes", undefined>;
@@ -7,5 +7,6 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import React from 'react';
10
+ export declare function UserCenter(): React.JSX.Element;
10
11
  export declare const InternalSettings: () => React.JSX.Element;
11
12
  export declare const MobileSettings: () => React.JSX.Element;
@@ -18,6 +18,9 @@ export interface MobileRouteItem {
18
18
  icon?: string;
19
19
  parentId?: number;
20
20
  children?: MobileRouteItem[];
21
+ hideInMenu?: boolean;
22
+ enableTabs?: boolean;
23
+ hidden?: boolean;
21
24
  }
22
25
  export declare const MobileRoutesContext: React.Context<MobileRoutesContextValue>;
23
26
  export interface MobileRoutesContextValue {
@@ -11,23 +11,24 @@ module.exports = {
11
11
  "@emotion/css": "11.13.4",
12
12
  "@formily/core": "2.3.0",
13
13
  "@formily/shared": "2.3.2",
14
- "@nocobase/client": "1.6.0-alpha.9",
15
- "@nocobase/plugin-acl": "1.6.0-alpha.9",
14
+ "@nocobase/client": "1.6.0-beta.10",
15
+ "@nocobase/plugin-acl": "1.6.0-beta.10",
16
16
  "ahooks": "3.7.8",
17
17
  "antd": "5.12.8",
18
18
  "lodash": "4.17.21",
19
19
  "react": "18.2.0",
20
20
  "react-i18next": "11.18.6",
21
21
  "react-router-dom": "6.21.0",
22
- "@nocobase/database": "1.6.0-alpha.9",
23
- "@nocobase/server": "1.6.0-alpha.9",
24
- "@nocobase/test": "1.6.0-alpha.9",
25
- "@nocobase/utils": "1.6.0-alpha.9",
22
+ "@nocobase/database": "1.6.0-beta.10",
23
+ "@nocobase/server": "1.6.0-beta.10",
24
+ "@nocobase/plugin-localization": "1.6.0-beta.10",
25
+ "@nocobase/utils": "1.6.0-beta.10",
26
+ "@nocobase/test": "1.6.0-beta.10",
26
27
  "@formily/react": "2.3.0",
27
- "@nocobase/plugin-mobile": "1.6.0-alpha.9",
28
+ "@nocobase/plugin-mobile": "1.6.0-beta.10",
28
29
  "@ant-design/icons": "5.2.6",
29
30
  "react-dom": "18.2.0",
30
- "@nocobase/sdk": "1.6.0-alpha.9",
31
+ "@nocobase/sdk": "1.6.0-beta.10",
31
32
  "dayjs": "1.11.10",
32
33
  "@formily/antd-v5": "1.1.9"
33
34
  };
@@ -23,6 +23,7 @@
23
23
  "Other desktop blocks": "Other desktop blocks",
24
24
  "Settings": "Settings",
25
25
  "Mobile menu": "Mobile menu",
26
+ "Mobile routes": "Mobile routes",
26
27
  "No accessible pages found": "No accessible pages found",
27
28
  "This might be due to permission configuration issues": "This might be due to permission configuration issues",
28
29
  "Select time":"Select time"
@@ -23,5 +23,6 @@
23
23
  "Other desktop blocks": "他のデスクトップブロック",
24
24
  "Settings": "設定",
25
25
  "Fill": "塗りつぶし",
26
- "Select time":"時間の選択"
27
- }
26
+ "Select time":"時間の選択",
27
+ "Mobile routes": "モバイルルート"
28
+ }
@@ -24,6 +24,7 @@
24
24
  "Other desktop blocks": "其他桌面端区块",
25
25
  "Settings": "设置",
26
26
  "Mobile menu": "移动端菜单",
27
+ "Mobile routes": "移动端路由",
27
28
  "No accessible pages found": "没有找到你可以访问的页面",
28
29
  "This might be due to permission configuration issues": "这可能是权限配置的问题",
29
30
  "Select time": "选择时间",
@@ -33,6 +33,7 @@ var import_database = require("@nocobase/database");
33
33
  var mobileRoutes_default = (0, import_database.defineCollection)({
34
34
  name: "mobileRoutes",
35
35
  dumpRules: "required",
36
+ migrationRules: ["overwrite", "schema-only"],
36
37
  title: "mobileRoutes",
37
38
  inherit: false,
38
39
  hidden: false,
@@ -225,7 +226,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
225
226
  uiSchema: {
226
227
  type: "string",
227
228
  "x-component": "Input",
228
- title: "title"
229
+ title: '{{t("Title")}}'
229
230
  }
230
231
  },
231
232
  {
@@ -240,7 +241,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
240
241
  uiSchema: {
241
242
  type: "string",
242
243
  "x-component": "Input",
243
- title: "icon"
244
+ title: '{{t("Icon")}}'
244
245
  }
245
246
  },
246
247
  {
@@ -255,7 +256,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
255
256
  uiSchema: {
256
257
  type: "string",
257
258
  "x-component": "Input",
258
- title: "schemaUid"
259
+ title: '{{t("Schema UID")}}'
259
260
  }
260
261
  },
261
262
  {
@@ -270,7 +271,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
270
271
  uiSchema: {
271
272
  type: "string",
272
273
  "x-component": "Input",
273
- title: "type"
274
+ title: '{{t("Type")}}'
274
275
  }
275
276
  },
276
277
  {
@@ -292,7 +293,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
292
293
  }
293
294
  },
294
295
  default: null,
295
- title: "options"
296
+ title: '{{t("Options")}}'
296
297
  }
297
298
  },
298
299
  {
@@ -304,6 +305,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
304
305
  collectionName: "mobileRoutes",
305
306
  parentKey: null,
306
307
  reverseKey: null,
308
+ scopeKey: "parentId",
307
309
  uiSchema: {
308
310
  type: "number",
309
311
  "x-component": "InputNumber",
@@ -312,7 +314,7 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
312
314
  step: "1"
313
315
  },
314
316
  "x-validator": "integer",
315
- title: "sort"
317
+ title: '{{t("Sort")}}'
316
318
  }
317
319
  },
318
320
  {
@@ -321,6 +323,36 @@ var mobileRoutes_default = (0, import_database.defineCollection)({
321
323
  through: "rolesMobileRoutes",
322
324
  target: "roles",
323
325
  onDelete: "CASCADE"
326
+ },
327
+ {
328
+ type: "boolean",
329
+ name: "hideInMenu",
330
+ interface: "checkbox",
331
+ uiSchema: {
332
+ type: "boolean",
333
+ "x-component": "Checkbox",
334
+ title: '{{t("Hide in menu")}}'
335
+ }
336
+ },
337
+ {
338
+ type: "boolean",
339
+ name: "enableTabs",
340
+ interface: "checkbox",
341
+ uiSchema: {
342
+ type: "boolean",
343
+ "x-component": "Checkbox",
344
+ title: '{{t("Enable tabs")}}'
345
+ }
346
+ },
347
+ {
348
+ type: "boolean",
349
+ name: "hidden",
350
+ interface: "checkbox",
351
+ uiSchema: {
352
+ type: "boolean",
353
+ "x-component": "Checkbox",
354
+ title: '{{t("Hidden")}}'
355
+ }
324
356
  }
325
357
  ],
326
358
  category: [],
@@ -15,5 +15,6 @@ export declare class PluginMobileServer extends Plugin {
15
15
  */
16
16
  bindNewMenuToRoles(): void;
17
17
  registerActionHandlers(): void;
18
+ registerLocalizationSource(): void;
18
19
  }
19
20
  export default PluginMobileServer;
@@ -31,11 +31,27 @@ __export(plugin_exports, {
31
31
  });
32
32
  module.exports = __toCommonJS(plugin_exports);
33
33
  var import_server = require("@nocobase/server");
34
+ var import_utils = require("@nocobase/utils");
34
35
  class PluginMobileServer extends import_server.Plugin {
35
36
  async load() {
36
37
  this.registerActionHandlers();
37
38
  this.bindNewMenuToRoles();
38
39
  this.setACL();
40
+ this.registerLocalizationSource();
41
+ this.app.db.on("mobileRoutes.afterUpdate", async (instance, { transaction }) => {
42
+ if (instance.changed("enableTabs")) {
43
+ const repository = this.app.db.getRepository("mobileRoutes");
44
+ await repository.update({
45
+ filter: {
46
+ parentId: instance.id
47
+ },
48
+ values: {
49
+ hidden: !instance.enableTabs
50
+ },
51
+ transaction
52
+ });
53
+ }
54
+ });
39
55
  }
40
56
  setACL() {
41
57
  this.app.acl.registerSnippet({
@@ -94,6 +110,36 @@ class PluginMobileServer extends import_server.Plugin {
94
110
  await next();
95
111
  });
96
112
  }
113
+ registerLocalizationSource() {
114
+ const localizationPlugin = this.app.pm.get("localization");
115
+ if (!localizationPlugin) {
116
+ return;
117
+ }
118
+ localizationPlugin.sourceManager.registerSource("mobile-routes", {
119
+ title: (0, import_utils.tval)("Mobile routes"),
120
+ sync: async (ctx) => {
121
+ const mobileRoutes = await ctx.db.getRepository("mobileRoutes").find({
122
+ raw: true
123
+ });
124
+ const resources = {};
125
+ mobileRoutes.forEach((route) => {
126
+ if (route.title) {
127
+ resources[route.title] = "";
128
+ }
129
+ });
130
+ return {
131
+ "lm-mobile-routes": resources
132
+ };
133
+ },
134
+ namespace: "lm-mobile-routes",
135
+ collections: [
136
+ {
137
+ collection: "mobileRoutes",
138
+ fields: ["title"]
139
+ }
140
+ ]
141
+ });
142
+ }
97
143
  }
98
144
  var plugin_default = PluginMobileServer;
99
145
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-mobile",
3
- "version": "1.6.0-alpha.9",
3
+ "version": "1.6.0-beta.10",
4
4
  "main": "dist/server/index.js",
5
5
  "homepage": "https://docs.nocobase.com/handbook/mobile",
6
6
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile",
@@ -12,6 +12,7 @@
12
12
  "peerDependencies": {
13
13
  "@nocobase/client": "1.x",
14
14
  "@nocobase/plugin-acl": "1.x",
15
+ "@nocobase/plugin-localization": "1.x",
15
16
  "@nocobase/server": "1.x",
16
17
  "@nocobase/test": "1.x"
17
18
  },
@@ -32,5 +33,5 @@
32
33
  "react-device-detect": "2.2.3",
33
34
  "react-i18next": "11.x"
34
35
  },
35
- "gitHead": "c6136fc6c9a2daab33fb1a20716cd9768e9a147f"
36
+ "gitHead": "72684ad7261e46b67969ecc4db0f1bcbea545a8d"
36
37
  }