@next-bricks/nav 1.22.9 → 1.24.0

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 (69) hide show
  1. package/dist/bricks.json +19 -19
  2. package/dist/chunks/2133.8c2de8bf.js +2 -0
  3. package/dist/chunks/2133.8c2de8bf.js.map +1 -0
  4. package/dist/chunks/2241.f4e16879.js +3 -0
  5. package/dist/chunks/2241.f4e16879.js.map +1 -0
  6. package/dist/chunks/4433.37b5f4d3.js +2 -0
  7. package/dist/chunks/4433.37b5f4d3.js.map +1 -0
  8. package/dist/chunks/4691.5e4633d7.js +3 -0
  9. package/dist/chunks/4691.5e4633d7.js.map +1 -0
  10. package/dist/chunks/9149.8d0c56b4.js +2 -0
  11. package/dist/chunks/9149.8d0c56b4.js.map +1 -0
  12. package/dist/chunks/9363.e198a81d.js +3 -0
  13. package/dist/chunks/9363.e198a81d.js.map +1 -0
  14. package/dist/chunks/{eo-launchpad-button-v2.927f72d2.js → eo-launchpad-button-v2.2924d210.js} +3 -3
  15. package/dist/chunks/eo-launchpad-button-v2.2924d210.js.map +1 -0
  16. package/dist/chunks/eo-launchpad-button.ca77a7df.js +3 -0
  17. package/dist/chunks/eo-launchpad-button.ca77a7df.js.map +1 -0
  18. package/dist/chunks/eo-launchpad-quick-access.d6349d06.js +3 -0
  19. package/dist/chunks/eo-launchpad-quick-access.d6349d06.js.map +1 -0
  20. package/dist/chunks/eo-launchpad-recent-visits.49228467.js +3 -0
  21. package/dist/chunks/eo-launchpad-recent-visits.49228467.js.map +1 -0
  22. package/dist/chunks/{eo-search-launchpad.3c5eb6d6.js → eo-search-launchpad.393d7776.js} +2 -2
  23. package/dist/chunks/eo-search-launchpad.393d7776.js.map +1 -0
  24. package/dist/chunks/launchpad-config.b5571d5c.js +3 -0
  25. package/dist/chunks/launchpad-config.b5571d5c.js.map +1 -0
  26. package/dist/chunks/{main.5f7d6c2d.js → main.0b287098.js} +2 -2
  27. package/dist/chunks/{main.5f7d6c2d.js.map → main.0b287098.js.map} +1 -1
  28. package/dist/examples.json +6 -6
  29. package/dist/index.a5e874bc.js +2 -0
  30. package/dist/index.a5e874bc.js.map +1 -0
  31. package/dist/manifest.json +68 -68
  32. package/dist/types.json +188 -188
  33. package/dist-types/launchpad-button-v2/i18n.d.ts +26 -0
  34. package/dist-types/launchpad-button-v2/interfaces.d.ts +12 -9
  35. package/dist-types/launchpad-config/interfaces.d.ts +1 -1
  36. package/dist-types/shared/getLocaleName.d.ts +1 -1
  37. package/package.json +2 -2
  38. package/dist/chunks/2133.a757ee32.js +0 -2
  39. package/dist/chunks/2133.a757ee32.js.map +0 -1
  40. package/dist/chunks/3796.3de4054c.js +0 -3
  41. package/dist/chunks/3796.3de4054c.js.map +0 -1
  42. package/dist/chunks/4433.14cd7c8d.js +0 -2
  43. package/dist/chunks/4433.14cd7c8d.js.map +0 -1
  44. package/dist/chunks/4691.0ea6af77.js +0 -3
  45. package/dist/chunks/4691.0ea6af77.js.map +0 -1
  46. package/dist/chunks/9149.1010c337.js +0 -2
  47. package/dist/chunks/9149.1010c337.js.map +0 -1
  48. package/dist/chunks/9363.ef03e062.js +0 -3
  49. package/dist/chunks/9363.ef03e062.js.map +0 -1
  50. package/dist/chunks/eo-launchpad-button-v2.927f72d2.js.map +0 -1
  51. package/dist/chunks/eo-launchpad-button.350d864f.js +0 -3
  52. package/dist/chunks/eo-launchpad-button.350d864f.js.map +0 -1
  53. package/dist/chunks/eo-launchpad-quick-access.d31fac62.js +0 -3
  54. package/dist/chunks/eo-launchpad-quick-access.d31fac62.js.map +0 -1
  55. package/dist/chunks/eo-launchpad-recent-visits.e9d9813f.js +0 -3
  56. package/dist/chunks/eo-launchpad-recent-visits.e9d9813f.js.map +0 -1
  57. package/dist/chunks/eo-search-launchpad.3c5eb6d6.js.map +0 -1
  58. package/dist/chunks/launchpad-config.48bac834.js +0 -3
  59. package/dist/chunks/launchpad-config.48bac834.js.map +0 -1
  60. package/dist/index.b95ce968.js +0 -2
  61. package/dist/index.b95ce968.js.map +0 -1
  62. /package/dist/chunks/{3796.3de4054c.js.LICENSE.txt → 2241.f4e16879.js.LICENSE.txt} +0 -0
  63. /package/dist/chunks/{4691.0ea6af77.js.LICENSE.txt → 4691.5e4633d7.js.LICENSE.txt} +0 -0
  64. /package/dist/chunks/{9363.ef03e062.js.LICENSE.txt → 9363.e198a81d.js.LICENSE.txt} +0 -0
  65. /package/dist/chunks/{eo-launchpad-button-v2.927f72d2.js.LICENSE.txt → eo-launchpad-button-v2.2924d210.js.LICENSE.txt} +0 -0
  66. /package/dist/chunks/{eo-launchpad-button.350d864f.js.LICENSE.txt → eo-launchpad-button.ca77a7df.js.LICENSE.txt} +0 -0
  67. /package/dist/chunks/{eo-launchpad-quick-access.d31fac62.js.LICENSE.txt → eo-launchpad-quick-access.d6349d06.js.LICENSE.txt} +0 -0
  68. /package/dist/chunks/{eo-launchpad-recent-visits.e9d9813f.js.LICENSE.txt → eo-launchpad-recent-visits.49228467.js.LICENSE.txt} +0 -0
  69. /package/dist/chunks/{launchpad-config.48bac834.js.LICENSE.txt → launchpad-config.b5571d5c.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -1,54 +1,6 @@
1
1
  {
2
- "eo-app-bar-wrapper": {
3
- "properties": [
4
- {
5
- "name": "isFixed",
6
- "annotation": {
7
- "type": "keyword",
8
- "value": "boolean"
9
- }
10
- },
11
- {
12
- "name": "position",
13
- "annotation": {
14
- "type": "union",
15
- "types": [
16
- {
17
- "type": "jsLiteral",
18
- "value": "static"
19
- },
20
- {
21
- "type": "jsLiteral",
22
- "value": "fixed"
23
- }
24
- ]
25
- }
26
- },
27
- {
28
- "name": "displayCenter",
29
- "annotation": {
30
- "type": "keyword",
31
- "value": "boolean"
32
- }
33
- },
34
- {
35
- "name": "extraAppBarContentStyle",
36
- "annotation": {
37
- "type": "reference",
38
- "typeName": {
39
- "type": "qualifiedName",
40
- "left": {
41
- "type": "identifier",
42
- "name": "React"
43
- },
44
- "right": {
45
- "type": "identifier",
46
- "name": "CSSProperties"
47
- }
48
- }
49
- }
50
- }
51
- ],
2
+ "nav.easyops-navbar-alerts": {
3
+ "properties": [],
52
4
  "events": [],
53
5
  "methods": []
54
6
  },
@@ -140,6 +92,59 @@
140
92
  }
141
93
  ]
142
94
  },
95
+ "eo-app-bar-wrapper": {
96
+ "properties": [
97
+ {
98
+ "name": "isFixed",
99
+ "annotation": {
100
+ "type": "keyword",
101
+ "value": "boolean"
102
+ }
103
+ },
104
+ {
105
+ "name": "position",
106
+ "annotation": {
107
+ "type": "union",
108
+ "types": [
109
+ {
110
+ "type": "jsLiteral",
111
+ "value": "static"
112
+ },
113
+ {
114
+ "type": "jsLiteral",
115
+ "value": "fixed"
116
+ }
117
+ ]
118
+ }
119
+ },
120
+ {
121
+ "name": "displayCenter",
122
+ "annotation": {
123
+ "type": "keyword",
124
+ "value": "boolean"
125
+ }
126
+ },
127
+ {
128
+ "name": "extraAppBarContentStyle",
129
+ "annotation": {
130
+ "type": "reference",
131
+ "typeName": {
132
+ "type": "qualifiedName",
133
+ "left": {
134
+ "type": "identifier",
135
+ "name": "React"
136
+ },
137
+ "right": {
138
+ "type": "identifier",
139
+ "name": "CSSProperties"
140
+ }
141
+ }
142
+ }
143
+ }
144
+ ],
145
+ "events": [],
146
+ "methods": []
147
+ },
143
148
  "eo-sidebar-menu-item": {
144
149
  "properties": [
145
150
  {
@@ -228,8 +233,19 @@
228
233
  "events": [],
229
234
  "methods": []
230
235
  },
231
- "nav.easyops-navbar-alerts": {
232
- "properties": [],
236
+ "eo-sidebar-sub-menu": {
237
+ "properties": [
238
+ {
239
+ "name": "menu",
240
+ "annotation": {
241
+ "type": "reference",
242
+ "typeName": {
243
+ "type": "identifier",
244
+ "name": "SidebarMenu"
245
+ }
246
+ }
247
+ }
248
+ ],
233
249
  "events": [],
234
250
  "methods": []
235
251
  },
@@ -543,22 +559,6 @@
543
559
  }
544
560
  ]
545
561
  },
546
- "eo-sidebar-sub-menu": {
547
- "properties": [
548
- {
549
- "name": "menu",
550
- "annotation": {
551
- "type": "reference",
552
- "typeName": {
553
- "type": "identifier",
554
- "name": "SidebarMenu"
555
- }
556
- }
557
- }
558
- ],
559
- "events": [],
560
- "methods": []
561
- },
562
562
  "nav.nav-logo": {
563
563
  "properties": [],
564
564
  "events": [],
@@ -713,7 +713,7 @@
713
713
  ],
714
714
  "methods": []
715
715
  },
716
- "nav.get-menu-config-options": {
716
+ "nav.get-menu-config-tree": {
717
717
  "type": "provider",
718
718
  "params": [
719
719
  {
@@ -746,7 +746,7 @@
746
746
  "type": "reference",
747
747
  "typeName": {
748
748
  "type": "identifier",
749
- "name": "MenuOption"
749
+ "name": "TreeNode"
750
750
  }
751
751
  }
752
752
  }
@@ -1072,13 +1072,13 @@
1072
1072
  },
1073
1073
  {
1074
1074
  "type": "interface",
1075
- "name": "MenuOption",
1075
+ "name": "TreeNode",
1076
1076
  "body": [
1077
1077
  {
1078
1078
  "type": "propertySignature",
1079
1079
  "key": {
1080
1080
  "type": "identifier",
1081
- "name": "label"
1081
+ "name": "key"
1082
1082
  },
1083
1083
  "annotation": {
1084
1084
  "type": "keyword",
@@ -1090,13 +1090,102 @@
1090
1090
  "type": "propertySignature",
1091
1091
  "key": {
1092
1092
  "type": "identifier",
1093
- "name": "value"
1093
+ "name": "title"
1094
1094
  },
1095
1095
  "annotation": {
1096
1096
  "type": "keyword",
1097
1097
  "value": "string"
1098
1098
  },
1099
1099
  "computed": false
1100
+ },
1101
+ {
1102
+ "type": "propertySignature",
1103
+ "key": {
1104
+ "type": "identifier",
1105
+ "name": "icon"
1106
+ },
1107
+ "annotation": {
1108
+ "type": "keyword",
1109
+ "value": "unknown"
1110
+ },
1111
+ "optional": true,
1112
+ "computed": false
1113
+ },
1114
+ {
1115
+ "type": "propertySignature",
1116
+ "key": {
1117
+ "type": "identifier",
1118
+ "name": "faded"
1119
+ },
1120
+ "annotation": {
1121
+ "type": "keyword",
1122
+ "value": "unknown"
1123
+ },
1124
+ "optional": true,
1125
+ "computed": false
1126
+ },
1127
+ {
1128
+ "type": "propertySignature",
1129
+ "key": {
1130
+ "type": "identifier",
1131
+ "name": "children"
1132
+ },
1133
+ "annotation": {
1134
+ "type": "array",
1135
+ "elementType": {
1136
+ "type": "reference",
1137
+ "typeName": {
1138
+ "type": "identifier",
1139
+ "name": "TreeNode"
1140
+ }
1141
+ }
1142
+ },
1143
+ "optional": true,
1144
+ "computed": false
1145
+ },
1146
+ {
1147
+ "type": "propertySignature",
1148
+ "key": {
1149
+ "type": "identifier",
1150
+ "name": "data"
1151
+ },
1152
+ "annotation": {
1153
+ "type": "union",
1154
+ "types": [
1155
+ {
1156
+ "type": "reference",
1157
+ "typeName": {
1158
+ "type": "identifier",
1159
+ "name": "MenuRawData"
1160
+ }
1161
+ },
1162
+ {
1163
+ "type": "reference",
1164
+ "typeName": {
1165
+ "type": "identifier",
1166
+ "name": "MenuItemRawData"
1167
+ }
1168
+ }
1169
+ ]
1170
+ },
1171
+ "computed": false
1172
+ },
1173
+ {
1174
+ "type": "propertySignature",
1175
+ "key": {
1176
+ "type": "identifier",
1177
+ "name": "__keys"
1178
+ },
1179
+ "annotation": {
1180
+ "type": "array",
1181
+ "elementType": {
1182
+ "type": "keyword",
1183
+ "value": "string"
1184
+ }
1185
+ },
1186
+ "optional": true,
1187
+ "computed": false,
1188
+ "description": "第一个节点额外返回 __keys,包含所有节点的 key"
1100
1189
  }
1101
1190
  ]
1102
1191
  }
@@ -1381,12 +1470,7 @@
1381
1470
  }
1382
1471
  ]
1383
1472
  },
1384
- "nav.query-search": {
1385
- "properties": [],
1386
- "events": [],
1387
- "methods": []
1388
- },
1389
- "nav.get-menu-config-tree": {
1473
+ "nav.get-menu-config-options": {
1390
1474
  "type": "provider",
1391
1475
  "params": [
1392
1476
  {
@@ -1419,7 +1503,7 @@
1419
1503
  "type": "reference",
1420
1504
  "typeName": {
1421
1505
  "type": "identifier",
1422
- "name": "TreeNode"
1506
+ "name": "MenuOption"
1423
1507
  }
1424
1508
  }
1425
1509
  }
@@ -1745,13 +1829,13 @@
1745
1829
  },
1746
1830
  {
1747
1831
  "type": "interface",
1748
- "name": "TreeNode",
1832
+ "name": "MenuOption",
1749
1833
  "body": [
1750
1834
  {
1751
1835
  "type": "propertySignature",
1752
1836
  "key": {
1753
1837
  "type": "identifier",
1754
- "name": "key"
1838
+ "name": "label"
1755
1839
  },
1756
1840
  "annotation": {
1757
1841
  "type": "keyword",
@@ -1763,107 +1847,23 @@
1763
1847
  "type": "propertySignature",
1764
1848
  "key": {
1765
1849
  "type": "identifier",
1766
- "name": "title"
1850
+ "name": "value"
1767
1851
  },
1768
1852
  "annotation": {
1769
1853
  "type": "keyword",
1770
1854
  "value": "string"
1771
1855
  },
1772
1856
  "computed": false
1773
- },
1774
- {
1775
- "type": "propertySignature",
1776
- "key": {
1777
- "type": "identifier",
1778
- "name": "icon"
1779
- },
1780
- "annotation": {
1781
- "type": "keyword",
1782
- "value": "unknown"
1783
- },
1784
- "optional": true,
1785
- "computed": false
1786
- },
1787
- {
1788
- "type": "propertySignature",
1789
- "key": {
1790
- "type": "identifier",
1791
- "name": "faded"
1792
- },
1793
- "annotation": {
1794
- "type": "keyword",
1795
- "value": "unknown"
1796
- },
1797
- "optional": true,
1798
- "computed": false
1799
- },
1800
- {
1801
- "type": "propertySignature",
1802
- "key": {
1803
- "type": "identifier",
1804
- "name": "children"
1805
- },
1806
- "annotation": {
1807
- "type": "array",
1808
- "elementType": {
1809
- "type": "reference",
1810
- "typeName": {
1811
- "type": "identifier",
1812
- "name": "TreeNode"
1813
- }
1814
- }
1815
- },
1816
- "optional": true,
1817
- "computed": false
1818
- },
1819
- {
1820
- "type": "propertySignature",
1821
- "key": {
1822
- "type": "identifier",
1823
- "name": "data"
1824
- },
1825
- "annotation": {
1826
- "type": "union",
1827
- "types": [
1828
- {
1829
- "type": "reference",
1830
- "typeName": {
1831
- "type": "identifier",
1832
- "name": "MenuRawData"
1833
- }
1834
- },
1835
- {
1836
- "type": "reference",
1837
- "typeName": {
1838
- "type": "identifier",
1839
- "name": "MenuItemRawData"
1840
- }
1841
- }
1842
- ]
1843
- },
1844
- "computed": false
1845
- },
1846
- {
1847
- "type": "propertySignature",
1848
- "key": {
1849
- "type": "identifier",
1850
- "name": "__keys"
1851
- },
1852
- "annotation": {
1853
- "type": "array",
1854
- "elementType": {
1855
- "type": "keyword",
1856
- "value": "string"
1857
- }
1858
- },
1859
- "optional": true,
1860
- "computed": false,
1861
- "description": "第一个节点额外返回 __keys,包含所有节点的 key"
1862
1857
  }
1863
1858
  ]
1864
1859
  }
1865
1860
  ]
1866
1861
  },
1862
+ "nav.query-search": {
1863
+ "properties": [],
1864
+ "events": [],
1865
+ "methods": []
1866
+ },
1867
1867
  "eo-directory-tree": {
1868
1868
  "properties": [
1869
1869
  {
@@ -2487,22 +2487,6 @@
2487
2487
  "value": "string"
2488
2488
  },
2489
2489
  "computed": false
2490
- },
2491
- {
2492
- "type": "propertySignature",
2493
- "key": {
2494
- "type": "identifier",
2495
- "name": "locales"
2496
- },
2497
- "annotation": {
2498
- "type": "reference",
2499
- "typeName": {
2500
- "type": "identifier",
2501
- "name": "AppLocales"
2502
- }
2503
- },
2504
- "optional": true,
2505
- "computed": false
2506
2490
  }
2507
2491
  ],
2508
2492
  "extends": [
@@ -2631,6 +2615,22 @@
2631
2615
  },
2632
2616
  "computed": false
2633
2617
  },
2618
+ {
2619
+ "type": "propertySignature",
2620
+ "key": {
2621
+ "type": "identifier",
2622
+ "name": "locales"
2623
+ },
2624
+ "annotation": {
2625
+ "type": "reference",
2626
+ "typeName": {
2627
+ "type": "identifier",
2628
+ "name": "AppLocales"
2629
+ }
2630
+ },
2631
+ "optional": true,
2632
+ "computed": false
2633
+ },
2634
2634
  {
2635
2635
  "type": "propertySignature",
2636
2636
  "key": {
@@ -0,0 +1,26 @@
1
+ export declare enum K {
2
+ ALL = "ALL",
3
+ QUICK_ACCESS = "QUICK_ACCESS",
4
+ PLATFORM_BASE = "PLATFORM_BASE",
5
+ SCENARIO_CENTER = "SCENARIO_CENTER",
6
+ SOLUTIONS = "SOLUTIONS",
7
+ OPEN_PLATFORM = "OPEN_PLATFORM",
8
+ SEARCH_PLACEHOLDER = "SEARCH_PLACEHOLDER",
9
+ RECENT_VISITS = "RECENT_VISITS",
10
+ FAVORITE = "FAVORITE",
11
+ UNFAVORITE = "UNFAVORITE",
12
+ FAVORITES_LIMIT_REACHED = "FAVORITES_LIMIT_REACHED",
13
+ FAVORITES_LIMIT_MESSAGE = "FAVORITES_LIMIT_MESSAGE"
14
+ }
15
+ export declare const NS = "bricks/nav/launchpad-button-v2";
16
+ export declare const locales: {
17
+ en: Locale;
18
+ zh: Locale;
19
+ };
20
+ export declare const t: any;
21
+ type Locale = {
22
+ [k in K]: string;
23
+ } & {
24
+ [k in K as `${k}_plural`]?: string;
25
+ };
26
+ export {};
@@ -1,7 +1,9 @@
1
- import type { MicroApp } from "@next-core/types";
1
+ import type { AppLocales, MicroApp } from "@next-core/types";
2
2
  import type { LegacyAntdIcon, MenuIcon } from "@next-shared/general/types";
3
3
  export interface MenuGroupData {
4
4
  name: string;
5
+ localeName?: string;
6
+ locales?: AppLocales;
5
7
  instanceId: string;
6
8
  items: MenuItemData[];
7
9
  }
@@ -11,28 +13,29 @@ export type SidebarMenuItemData = MenuItemDataNormal | MenuItemDataLink;
11
13
  export interface MicroAppWithInstanceId extends MicroApp {
12
14
  instanceId: string;
13
15
  }
14
- export interface MenuItemDataApp {
15
- type: "app";
16
+ export interface MenuItemDataBase {
17
+ type: string;
16
18
  name: string;
19
+ localeName?: string;
20
+ locales?: AppLocales;
17
21
  id: string;
22
+ }
23
+ export interface MenuItemDataApp extends MenuItemDataBase {
24
+ type: "app";
18
25
  instanceId: string;
19
26
  url: string;
20
27
  description?: string;
21
28
  menuIcon?: Exclude<MenuIcon, LegacyAntdIcon>;
22
29
  }
23
- export interface MenuItemDataCustom {
30
+ export interface MenuItemDataCustom extends MenuItemDataBase {
24
31
  type: "custom";
25
- name: string;
26
- id: string;
27
32
  instanceId: string;
28
33
  url: string;
29
34
  description?: string;
30
35
  menuIcon?: Exclude<MenuIcon, LegacyAntdIcon>;
31
36
  }
32
- export interface MenuItemDataDir {
37
+ export interface MenuItemDataDir extends MenuItemDataBase {
33
38
  type: "dir";
34
- name: string;
35
- id: string;
36
39
  items: MenuItemDataNormal[];
37
40
  }
38
41
  export interface MenuItemDataLink {
@@ -12,7 +12,6 @@ export type ConfigMenuItemNormal = ConfigMenuItemApp | ConfigMenuItemCustom;
12
12
  export interface ConfigMenuItemApp extends ConfigMenuItemBase {
13
13
  type: "app";
14
14
  url: string;
15
- locales?: AppLocales;
16
15
  }
17
16
  export interface ConfigMenuItemCustom extends ConfigMenuItemBase {
18
17
  type: "custom";
@@ -32,6 +31,7 @@ interface ConfigMenuItemBase extends ConfigMenuBase {
32
31
  interface ConfigMenuBase {
33
32
  id: string;
34
33
  name: string;
34
+ locales?: AppLocales;
35
35
  instanceId: string;
36
36
  /** 有可屏蔽的 */
37
37
  blockable?: boolean;
@@ -1,2 +1,2 @@
1
1
  import type { AppLocales } from "@next-core/types";
2
- export declare function getAppLocaleName(locales: AppLocales | undefined, name: string): string;
2
+ export declare function getLocaleName(locales?: AppLocales | undefined, name?: string): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/nav",
3
- "version": "1.22.9",
3
+ "version": "1.24.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/nav",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,5 +43,5 @@
43
43
  "@next-bricks/form": "*",
44
44
  "@next-bricks/icons": "*"
45
45
  },
46
- "gitHead": "7a72596d49dd941b023d6733e8587c9608b8f14b"
46
+ "gitHead": "2f9f8ca727b09ca71ec986b5d8c296c742284ac3"
47
47
  }
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_nav=globalThis.webpackChunk_next_bricks_nav||[]).push([[2133],{2133:(e,t,n)=>{n.d(t,{fm:()=>M,ir:()=>x,pU:()=>O,sZ:()=>N});var a=n(8769),o=n(3081),s=n(9384),i=n(7137),r=n(4864),c=n(9393),l=n(3346),u=n(7296),p=n(2824),d=n(2887),m=n(8406),f=n(1030);const h=10,I=10;var y,g=n(6659);async function v(){return(await(0,u.K)({page:1,pageSize:h},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0})).list}function w(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}function k(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}const A=`launchpad-recent-visits:${null===(y=s.auth.getAuth())||void 0===y?void 0:y.org}`,F=new i.G(localStorage);let b=[],C=new Map,B=new Map,S=!1,P=[],E=!1,L=[],_=!1;const x=new r.x((async()=>{({menuGroups:b,microAppsById:C,customLinksById:B}=await async function(){var e;const t=await(0,l.i)({},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0}),n=new Map;for(const e of t.storyboards){var a;const t=e.app;t.localeName=(0,g.F)(t.locales,t.name),null!==(a=s.auth.isBlockedPath)&&void 0!==a&&a.call(s.auth,t.homepage)||n.set(t.id,t)}const o=[],i=new Map;for(const a of t.desktops){const t=[];for(const o of a.items)switch(o.type){case"app":{const e=n.get(o.id);e&&t.push({...o,name:e.localeName,url:e.homepage,menuIcon:e.menuIcon});break}case"custom":null!==(e=s.auth.isBlockedHref)&&void 0!==e&&e.call(s.auth,o.url)||(t.push(o),i.set(o.id,o));break;case"dir":{const e=[];for(const t of o.items){var r;if("app"===t.type){const a=n.get(t.id);a&&e.push({...t,name:a.localeName,url:a.homepage,menuIcon:a.menuIcon})}else"custom"!==t.type||null!==(r=s.auth.isBlockedHref)&&void 0!==r&&r.call(s.auth,t.url)||(e.push(t),i.set(t.id,t))}e.length>0&&t.push({...o,items:e});break}}t.length>0&&o.push({...a,items:t})}return{menuGroups:o,microAppsById:n,customLinksById:i}}()),S=!0})),M=new r.x((async()=>{P=await async function(){const e=await v(),t=[];for(const n of e)if("microApp"===n.type){const e=n.relatedApp;e.localeName=(0,g.F)(e.locales,e.name),t.push({favoriteId:n.instanceId,type:"app",name:e.localeName,id:e.appId,url:e.homepage,instanceId:e.instanceId,menuIcon:e.menuIcon})}else if("customItem"===n.type){const e=n.relatedCustomItem;t.push({favoriteId:n.instanceId,type:"custom",name:e.name,id:e.id,url:e.url,menuIcon:e.menuIcon})}else"link"===n.type&&t.push({favoriteId:n.instanceId,type:"link",name:n.name,url:n.link,menuIcon:n.icon});return t}(),E=!0})),O=new r.x((async()=>{L=await async function(){const e=(await(0,m.y)("MICRO_APP_CATEGORY@EASYOPS",{fields:["id","type","name","icon","order","platformApps.appId","platformApps.name","platformApps.homepage","platformApps.description","platformApps.menuIcon","platformApps.locales","platformApps._object_id","platformApps.@.order","platformItems.id","platformItems.name","platformItems.url","platformItems.description","platformItems.menuIcon","platformItems._object_id","platformItems.@.order"],page:1,page_size:300,query:{type:"platform"}})).list,t=null==e?void 0:e.map((e=>{const t=e.platformApps.map((e=>{var t,n;return null!==(t=s.auth.isBlockedPath)&&void 0!==t&&t.call(s.auth,e.homepage)?null:{type:"app",name:(0,g.F)(e.locales,e.name),id:e.appId,url:e.homepage,menuIcon:e.menuIcon,description:e.description,instanceId:e.instanceId,order:null===(n=e["@"])||void 0===n?void 0:n.order}})).filter(Boolean),n=e.platformItems.map((e=>{var t,n;return null!==(t=s.auth.isBlockedHref)&&void 0!==t&&t.call(s.auth,e.url)?null:{type:"custom",name:e.name,id:e.id,url:e.url,menuIcon:e.menuIcon,description:e.description,instanceId:e.instanceId,order:null===(n=e["@"])||void 0===n?void 0:n.order}})).filter(Boolean),a=(0,f.sortBy)([...t,...n],"order");return{instanceId:e.instanceId,id:e.id,name:e.name,icon:e.icon,order:e.order,items:a}}));return[{id:"#all",name:"全部",icon:{lib:"easyops",category:"second-menu",icon:"sprint-planning-second-menu"},items:[]},...(0,f.sortBy)(t,"order")]}(),_=!0})),T=e=>(0,c.Ds)({type:"error",message:(0,o.httpErrorToString)(e)});function N(e){const[t,n]=(0,a.useState)(b),[s,i]=(0,a.useState)(C),[r,l]=(0,a.useState)(B),[u,m]=(0,a.useState)(""),[f,y]=(0,a.useState)(!S),[g,N]=(0,a.useState)(!E),[j,G]=(0,a.useState)(!_),[q,H]=(0,a.useState)([]),[z,D]=(0,a.useState)([]),[V,Y]=(0,a.useState)(P),[$,K]=(0,a.useState)(L);(0,a.useEffect)((()=>{e&&!f&&(n(b),i(C),l(B))}),[e,f]),(0,a.useEffect)((()=>{e&&!g&&Y(P)}),[e,g]),(0,a.useEffect)((()=>{e&&!j&&K(L)}),[e,j]),(0,a.useEffect)((()=>{var t;e&&H(null!==(t=F.getItem(A))&&void 0!==t?t:[])}),[e]),(0,a.useEffect)((()=>{e&&(async()=>{try{await x.fetch(),y(!1)}catch(e){(0,o.handleHttpError)(e)}})()}),[e]),(0,a.useEffect)((()=>{e&&(async()=>{try{await M.fetch(),N(!1)}catch(e){N(!1),T(e)}})()}),[e]),(0,a.useEffect)((()=>{var t;e&&null!==(t=(0,o.getRuntime)())&&void 0!==t&&t.getFeatureFlags()["launchpad-show-platform-category"]&&(async()=>{try{await O.fetch(),G(!1)}catch(e){G(!1),T(e)}})()}),[e]),(0,a.useEffect)((()=>{if(f)return;const e=q.map((e=>{if("app"===e.type){const t=s.get(e.id);return t?{type:"app",name:t.localeName,id:t.id,url:t.homepage,instanceId:t.instanceId,menuIcon:t.menuIcon}:null}return r.get(e.id)})).filter(Boolean);D(e)}),[r,f,s,q]);const Q=(0,a.useCallback)((e=>{var t;let{type:n,id:a}=e;const o=null!==(t=F.getItem(A))&&void 0!==t?t:[],s=o.findIndex((e=>e.type===n&&e.id===a));s>-1&&o.splice(s,1),o.unshift({type:n,id:a}),o.length>I&&o.pop(),F.setItem(A,o)}),[]),U=(0,a.useCallback)((e=>V.some((t=>R(e,t)))),[V]),Z=(0,a.useCallback)((e=>{const t=V.findIndex((t=>"link"===e.type?t.favoriteId===e.favoriteId:R(e,t)));let n;if(t>-1){const e=V[t];n=V.slice(0,t).concat(V.slice(t+1)),async function(e){return e.favoriteId?(0,d.r)(e.favoriteId):v().then((t=>{var n;const a=null===(n=t.find((t=>{var n,a;return"app"===e.type?"microApp"===t.type&&(null===(n=t.relatedApp)||void 0===n?void 0:n.appId)===e.id:"custom"===e.type&&(null===(a=t.relatedCustomItem)||void 0===a?void 0:a.id)===e.id})))||void 0===n?void 0:n.instanceId;if(a)return(0,d.r)(a);console.error("Menu item to unstar not found:",e)}))}(e).catch(T)}else{if(V.length>=h)return void(0,c.ui)({type:"warn",title:"收藏数量已达上限",content:`当前收藏链接数量已达上限(${h}个),请删除部分收藏后再添加。`});const t={...e};n=V.concat(t),async function(e){return(0,p.k)({type:"app"===e.type?"microApp":"customItem",relatedInstanceId:e.instanceId},{interceptorParams:{ignoreLoadingBar:!0}})}(e).then((e=>{e&&(t.favoriteId=e.instanceId)}),T)}Y(n),P=n}),[V]),J=(0,a.useMemo)((()=>function(e,t){if(!t)return e;const n=t.toLowerCase();return e.map((e=>({...e,items:e.items.map((e=>{switch(e.type){case"app":return w(e,n);case"custom":return k(e,n);case"dir":{const t=e.items.map((e=>"app"===e.type?w(e,n):"custom"===e.type?k(e,n):null)).filter(Boolean);return t.length>0?{...e,items:t}:null}}})).filter(Boolean)}))).filter((e=>e.items.length>0))}(t,u)),[t,u]),W=(0,a.useMemo)((()=>function(e,t){if(!t)return e;const n=t.toLowerCase();return e.map((e=>({...e,items:e.items.map((e=>{switch(e.type){case"app":return w(e,n);case"custom":return k(e,n)}})).filter(Boolean)})))}($,u)),[$,u]);return{loading:f,q:u,setQ:m,menuGroups:J,loadingFavorites:g,loadingPlatformCategories:j,favorites:V,recentVisits:z,pushRecentVisit:Q,isStarred:U,toggleStar:Z,platformCategories:W}}function R(e,t){return e.instanceId&&t.instanceId?t.instanceId===e.instanceId:t.type===e.type&&t.id===e.id}},4864:(e,t,n)=>{n.d(t,{x:()=>o});var a=n(4586);class o{constructor(e){(0,a.A)(this,"preFetchId",null),(0,a.A)(this,"preFetchScheduled",!1),(0,a.A)(this,"firstFetchPromise",null),(0,a.A)(this,"isFetching",!1),(0,a.A)(this,"task",void 0),this.task=e}schedulePrefetch(){if(!this.preFetchScheduled){this.preFetchScheduled=!0;const e=async()=>{this.preFetchId=null,this.fetch()};"function"==typeof window.requestIdleCallback?this.preFetchId=window.requestIdleCallback(e):this.preFetchId=setTimeout(e)}}fetch(e){let t;return this.preFetchId&&("function"==typeof window.cancelIdleCallback?cancelIdleCallback(this.preFetchId):clearTimeout(this.preFetchId),this.preFetchId=null),this.isFetching&&!e||(this.isFetching=!0,t=this.task(),t.catch((e=>{console.error(e),this.firstFetchPromise=null})).finally((()=>{this.isFetching=!1})),this.firstFetchPromise||(this.firstFetchPromise=t),!e)?this.firstFetchPromise:t}}},6659:(e,t,n)=>{n.d(t,{F:()=>o});var a=n(79);function o(e,t){var n;if(!e)return t;const o=Object.fromEntries(Object.entries(e).filter((e=>{let[t,n]=e;return n.name})).map((e=>{let[t,n]=e;return[t,n.name]})));return null!==(n=(0,a.i18nText)(o))&&void 0!==n?n:t}},9393:(e,t,n)=>{n.d(t,{Bj:()=>s,Ds:()=>c,EM:()=>i,ui:()=>r});var a=n(1280),o=n(7732);const s=(0,a.wrapBrick)("eo-icon"),i=(0,a.wrapBrick)("eo-link"),r=(0,o.unwrapProvider)("basic.show-dialog"),c=(0,o.unwrapProvider)("basic.show-notification")}}]);
2
- //# sourceMappingURL=2133.a757ee32.js.map