@tachybase/client 1.6.40 → 1.6.41

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.
@@ -5,6 +5,7 @@ import { Navigate, Outlet, useLocation, useNavigate } from "react-router-dom";
5
5
  import { ADMIN_SETTINGS_PATH, useApp } from "../../application/index.mjs";
6
6
  import { useCompile } from "../../schema-component/index.mjs";
7
7
  import { SettingLayout } from "./SettingLayout.mjs";
8
+ import { getVisibleSystemSettingsItems } from "./systemSettingsMenu.mjs";
8
9
  const SettingsCenterContext = /*#__PURE__*/ createContext({});
9
10
  SettingsCenterContext.displayName = 'SettingsCenterContext';
10
11
  function matchRoute(data, url) {
@@ -39,17 +40,20 @@ const AdminSettingsLayout = ()=>{
39
40
  compile
40
41
  ]);
41
42
  const routeChildren = useMemo(()=>{
42
- const list = app.systemSettingsManager.getList();
43
+ const list = getVisibleSystemSettingsItems(app.systemSettingsManager.getList());
43
44
  function traverse(settings) {
44
45
  return settings.map((item)=>{
45
46
  var _item_children;
46
- if (item.path.includes(':')) item.hideInMenu = true;
47
- item.title = compile(item.title);
48
- item.label = compile(item.title);
49
- if (null == (_item_children = item.children) ? void 0 : _item_children.length) item.children = traverse(item.children);
47
+ const title = compile(item.title);
48
+ const children = (null == (_item_children = item.children) ? void 0 : _item_children.length) ? traverse(item.children) : void 0;
50
49
  return {
51
50
  ...item,
52
- name: item.label
51
+ ...(null == children ? void 0 : children.length) ? {
52
+ children
53
+ } : {},
54
+ title,
55
+ label: title,
56
+ name: title
53
57
  };
54
58
  });
55
59
  }
@@ -6,6 +6,7 @@ import { Link } from "react-router-dom";
6
6
  import { useApp } from "../../application/index.mjs";
7
7
  import { useCompile } from "../../schema-component/index.mjs";
8
8
  import { useToken } from "../../style/index.mjs";
9
+ import { getVisibleSystemSettingsItems } from "./systemSettingsMenu.mjs";
9
10
  const SettingsCenterDropdown = ()=>{
10
11
  const compile = useCompile();
11
12
  const { token } = useToken();
@@ -26,25 +27,23 @@ const SettingsCenterDropdown = ()=>{
26
27
  type: 'divider'
27
28
  });
28
29
  const menuItems = useMemo(()=>{
29
- const list = app.systemSettingsManager.getList();
30
+ const list = getVisibleSystemSettingsItems(app.systemSettingsManager.getList());
30
31
  function traverse(settings) {
31
- return settings.filter((item)=>!item.hideInMenu && !item.path.includes(':')).map((item)=>{
32
+ return settings.map((item)=>{
32
33
  var _item_children;
33
34
  const title = compile(item.title);
35
+ const children = (null == (_item_children = item.children) ? void 0 : _item_children.length) ? traverse(item.children) : void 0;
34
36
  var _item_key;
35
- item.label = /*#__PURE__*/ jsx(Link, {
36
- to: item.path,
37
- children: title
38
- }, null != (_item_key = item.key) ? _item_key : item.path);
39
- if (null == (_item_children = item.children) ? void 0 : _item_children.length) {
40
- item.children = traverse(item.children);
41
- item.label = title;
42
- }
43
37
  return {
44
38
  key: item.key,
45
- label: item.label,
39
+ label: (null == children ? void 0 : children.length) ? title : /*#__PURE__*/ jsx(Link, {
40
+ to: item.path,
41
+ children: title
42
+ }, null != (_item_key = item.key) ? _item_key : item.path),
46
43
  path: item.path,
47
- children: item.children,
44
+ ...(null == children ? void 0 : children.length) ? {
45
+ children
46
+ } : {},
48
47
  name: title
49
48
  };
50
49
  });
@@ -0,0 +1,2 @@
1
+ import type { PluginSettingsPageType } from '../../application';
2
+ export declare function getVisibleSystemSettingsItems(settings: Partial<PluginSettingsPageType>[]): Partial<PluginSettingsPageType>[];
@@ -0,0 +1,14 @@
1
+ function getVisibleSystemSettingsItems(settings) {
2
+ return settings.filter((item)=>{
3
+ var _item_path;
4
+ return !item.hideInMenu && !(null == (_item_path = item.path) ? void 0 : _item_path.includes(':'));
5
+ }).map((param)=>{
6
+ let { children: rawChildren, ...item } = param;
7
+ const children = (null == rawChildren ? void 0 : rawChildren.length) ? getVisibleSystemSettingsItems(rawChildren) : [];
8
+ return children.length ? {
9
+ ...item,
10
+ children
11
+ } : item;
12
+ });
13
+ }
14
+ export { getVisibleSystemSettingsItems };
@@ -34,6 +34,7 @@ const external_react_router_dom_namespaceObject = require("react-router-dom");
34
34
  const index_js_namespaceObject = require("../../application/index.js");
35
35
  const external_schema_component_index_js_namespaceObject = require("../../schema-component/index.js");
36
36
  const external_SettingLayout_js_namespaceObject = require("./SettingLayout.js");
37
+ const external_systemSettingsMenu_js_namespaceObject = require("./systemSettingsMenu.js");
37
38
  const SettingsCenterContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({});
38
39
  SettingsCenterContext.displayName = 'SettingsCenterContext';
39
40
  function matchRoute(data, url) {
@@ -68,17 +69,20 @@ const AdminSettingsLayout = ()=>{
68
69
  compile
69
70
  ]);
70
71
  const routeChildren = (0, external_react_namespaceObject.useMemo)(()=>{
71
- const list = app.systemSettingsManager.getList();
72
+ const list = (0, external_systemSettingsMenu_js_namespaceObject.getVisibleSystemSettingsItems)(app.systemSettingsManager.getList());
72
73
  function traverse(settings) {
73
74
  return settings.map((item)=>{
74
75
  var _item_children;
75
- if (item.path.includes(':')) item.hideInMenu = true;
76
- item.title = compile(item.title);
77
- item.label = compile(item.title);
78
- if (null == (_item_children = item.children) ? void 0 : _item_children.length) item.children = traverse(item.children);
76
+ const title = compile(item.title);
77
+ const children = (null == (_item_children = item.children) ? void 0 : _item_children.length) ? traverse(item.children) : void 0;
79
78
  return {
80
79
  ...item,
81
- name: item.label
80
+ ...(null == children ? void 0 : children.length) ? {
81
+ children
82
+ } : {},
83
+ title,
84
+ label: title,
85
+ name: title
82
86
  };
83
87
  });
84
88
  }
@@ -34,6 +34,7 @@ const external_react_router_dom_namespaceObject = require("react-router-dom");
34
34
  const index_js_namespaceObject = require("../../application/index.js");
35
35
  const external_schema_component_index_js_namespaceObject = require("../../schema-component/index.js");
36
36
  const external_style_index_js_namespaceObject = require("../../style/index.js");
37
+ const external_systemSettingsMenu_js_namespaceObject = require("./systemSettingsMenu.js");
37
38
  const SettingsCenterDropdown = ()=>{
38
39
  const compile = (0, external_schema_component_index_js_namespaceObject.useCompile)();
39
40
  const { token } = (0, external_style_index_js_namespaceObject.useToken)();
@@ -54,25 +55,23 @@ const SettingsCenterDropdown = ()=>{
54
55
  type: 'divider'
55
56
  });
56
57
  const menuItems = (0, external_react_namespaceObject.useMemo)(()=>{
57
- const list = app.systemSettingsManager.getList();
58
+ const list = (0, external_systemSettingsMenu_js_namespaceObject.getVisibleSystemSettingsItems)(app.systemSettingsManager.getList());
58
59
  function traverse(settings) {
59
- return settings.filter((item)=>!item.hideInMenu && !item.path.includes(':')).map((item)=>{
60
+ return settings.map((item)=>{
60
61
  var _item_children;
61
62
  const title = compile(item.title);
63
+ const children = (null == (_item_children = item.children) ? void 0 : _item_children.length) ? traverse(item.children) : void 0;
62
64
  var _item_key;
63
- item.label = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
64
- to: item.path,
65
- children: title
66
- }, null != (_item_key = item.key) ? _item_key : item.path);
67
- if (null == (_item_children = item.children) ? void 0 : _item_children.length) {
68
- item.children = traverse(item.children);
69
- item.label = title;
70
- }
71
65
  return {
72
66
  key: item.key,
73
- label: item.label,
67
+ label: (null == children ? void 0 : children.length) ? title : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Link, {
68
+ to: item.path,
69
+ children: title
70
+ }, null != (_item_key = item.key) ? _item_key : item.path),
74
71
  path: item.path,
75
- children: item.children,
72
+ ...(null == children ? void 0 : children.length) ? {
73
+ children
74
+ } : {},
76
75
  name: title
77
76
  };
78
77
  });
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ getVisibleSystemSettingsItems: ()=>getVisibleSystemSettingsItems
28
+ });
29
+ function getVisibleSystemSettingsItems(settings) {
30
+ return settings.filter((item)=>{
31
+ var _item_path;
32
+ return !item.hideInMenu && !(null == (_item_path = item.path) ? void 0 : _item_path.includes(':'));
33
+ }).map((param)=>{
34
+ let { children: rawChildren, ...item } = param;
35
+ const children = (null == rawChildren ? void 0 : rawChildren.length) ? getVisibleSystemSettingsItems(rawChildren) : [];
36
+ return children.length ? {
37
+ ...item,
38
+ children
39
+ } : item;
40
+ });
41
+ }
42
+ exports.getVisibleSystemSettingsItems = __webpack_exports__.getVisibleSystemSettingsItems;
43
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
44
+ "getVisibleSystemSettingsItems"
45
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
46
+ Object.defineProperty(exports, '__esModule', {
47
+ value: true
48
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/client",
3
- "version": "1.6.40",
3
+ "version": "1.6.41",
4
4
  "homepage": "https://github.com/tegojs/tego-standard#readme",
5
5
  "bugs": {
6
6
  "url": "https://github.com/tegojs/tego-standard/issues"