@next-bricks/nav 1.24.2 → 1.24.4

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.
@@ -31,69 +31,13 @@
31
31
  "category": "navigation"
32
32
  },
33
33
  {
34
- "name": "eo-launchpad-button",
34
+ "name": "eo-launchpad-button-v2",
35
35
  "properties": [],
36
36
  "events": [],
37
37
  "slots": [],
38
38
  "methods": [],
39
39
  "parts": [],
40
- "description": "Launchpad 按钮构件",
41
- "insider": true
42
- },
43
- {
44
- "name": "nav.launchpad-config",
45
- "properties": [
46
- {
47
- "name": "menuGroups",
48
- "attribute": false,
49
- "type": "ConfigMenuGroup[]"
50
- },
51
- {
52
- "name": "actions",
53
- "attribute": false,
54
- "type": "MenuAction[]"
55
- },
56
- {
57
- "name": "variant",
58
- "description": "",
59
- "default": "\"launchpad-config\"",
60
- "type": "ConfigVariant"
61
- },
62
- {
63
- "name": "urlTemplate",
64
- "description": "菜单项 APP 类型的链接模板,例如可配置为 `/app/{{ id }}`。\n\n注:仅用于 variant: \"menu-config\"。",
65
- "type": "string"
66
- },
67
- {
68
- "name": "customUrlTemplate",
69
- "description": "菜单项自定义类型的链接模板,例如可配置为 `/custom?url={{ __pathname }}`。\n\n注:仅用于 variant: \"menu-config\"。\n 外链菜单链接会设置为禁用。\n `__pathname` 是运行时变量,表示 url 解析后的 pathname。",
70
- "type": "string"
71
- },
72
- {
73
- "name": "blacklist",
74
- "description": "屏蔽的 URL 列表,例如可配置为 `[\"/app/1\", \"/app/2\"]`。\n\n注:仅用于 variant: \"blacklist-config\"。",
75
- "attribute": false,
76
- "type": "string[]"
77
- }
78
- ],
79
- "events": [
80
- {
81
- "name": "menu-item.click",
82
- "detail": {
83
- "type": "ConfigMenuItemNormal"
84
- }
85
- },
86
- {
87
- "name": "action.click",
88
- "detail": {
89
- "type": "MenuActionEventDetail"
90
- }
91
- }
92
- ],
93
- "slots": [],
94
- "methods": [],
95
- "parts": [],
96
- "description": "进行 Launchpad 配置。\n\n也可用于菜单自定义显示产品功能清单。",
40
+ "description": "构件 `eo-launchpad-button-v2`",
97
41
  "insider": true
98
42
  },
99
43
  {
@@ -106,16 +50,6 @@
106
50
  "description": "构件 `nav.easyops-navbar-alerts`",
107
51
  "insider": true
108
52
  },
109
- {
110
- "name": "eo-launchpad-button-v2",
111
- "properties": [],
112
- "events": [],
113
- "slots": [],
114
- "methods": [],
115
- "parts": [],
116
- "description": "构件 `eo-launchpad-button-v2`",
117
- "insider": true
118
- },
119
53
  {
120
54
  "name": "eo-launchpad-quick-access",
121
55
  "properties": [
@@ -136,35 +70,29 @@
136
70
  "insider": true
137
71
  },
138
72
  {
139
- "name": "eo-launchpad-recent-visits",
73
+ "name": "eo-search-launchpad",
140
74
  "properties": [
141
75
  {
142
- "name": "target",
143
- "attribute": false,
144
- "type": "Target"
76
+ "name": "readonly",
77
+ "description": "简约模式",
78
+ "type": "boolean"
145
79
  }
146
80
  ],
147
81
  "events": [],
148
82
  "slots": [],
149
83
  "methods": [],
150
84
  "parts": [],
151
- "description": "launchpad 最近访问",
85
+ "description": "launchpad 搜索",
152
86
  "insider": true
153
87
  },
154
88
  {
155
- "name": "eo-search-launchpad",
156
- "properties": [
157
- {
158
- "name": "readonly",
159
- "description": "简约模式",
160
- "type": "boolean"
161
- }
162
- ],
89
+ "name": "eo-launchpad-button",
90
+ "properties": [],
163
91
  "events": [],
164
92
  "slots": [],
165
93
  "methods": [],
166
94
  "parts": [],
167
- "description": "launchpad 搜索",
95
+ "description": "Launchpad 按钮构件",
168
96
  "insider": true
169
97
  },
170
98
  {
@@ -242,40 +170,60 @@
242
170
  "description": "面包屑"
243
171
  },
244
172
  {
245
- "name": "eo-sidebar-menu-group",
173
+ "name": "nav.launchpad-config",
246
174
  "properties": [
247
175
  {
248
- "name": "collapsable",
249
- "description": "是否允许折叠",
250
- "type": "boolean"
176
+ "name": "menuGroups",
177
+ "attribute": false,
178
+ "type": "ConfigMenuGroup[]"
251
179
  },
252
180
  {
253
- "name": "collapsed",
254
- "description": "是否折叠",
255
- "type": "boolean"
181
+ "name": "actions",
182
+ "attribute": false,
183
+ "type": "MenuAction[]"
256
184
  },
257
185
  {
258
- "name": "selected",
259
- "description": "是否选中",
260
- "type": "boolean"
186
+ "name": "variant",
187
+ "description": "",
188
+ "default": "\"launchpad-config\"",
189
+ "type": "ConfigVariant"
261
190
  },
262
191
  {
263
- "name": "menuCollapsed",
264
- "description": "菜单整体是否收起状态",
265
- "type": "boolean"
192
+ "name": "urlTemplate",
193
+ "description": "菜单项 APP 类型的链接模板,例如可配置为 `/app/{{ id }}`。\n\n注:仅用于 variant: \"menu-config\"。",
194
+ "type": "string"
195
+ },
196
+ {
197
+ "name": "customUrlTemplate",
198
+ "description": "菜单项自定义类型的链接模板,例如可配置为 `/custom?url={{ __pathname }}`。\n\n注:仅用于 variant: \"menu-config\"。\n 外链菜单链接会设置为禁用。\n `__pathname` 是运行时变量,表示 url 解析后的 pathname。",
199
+ "type": "string"
200
+ },
201
+ {
202
+ "name": "blacklist",
203
+ "description": "屏蔽的 URL 列表,例如可配置为 `[\"/app/1\", \"/app/2\"]`。\n\n注:仅用于 variant: \"blacklist-config\"。",
204
+ "attribute": false,
205
+ "type": "string[]"
266
206
  }
267
207
  ],
268
- "events": [],
269
- "slots": [
208
+ "events": [
270
209
  {
271
- "name": "title",
272
- "description": "分组标题"
210
+ "name": "menu-item.click",
211
+ "detail": {
212
+ "type": "ConfigMenuItemNormal"
213
+ }
214
+ },
215
+ {
216
+ "name": "action.click",
217
+ "detail": {
218
+ "type": "MenuActionEventDetail"
219
+ }
273
220
  }
274
221
  ],
222
+ "slots": [],
275
223
  "methods": [],
276
224
  "parts": [],
277
- "description": "侧栏菜单分组",
278
- "category": "navigation"
225
+ "description": "进行 Launchpad 配置。\n\n也可用于菜单自定义显示产品功能清单。",
226
+ "insider": true
279
227
  },
280
228
  {
281
229
  "name": "eo-sidebar-menu-item",
@@ -325,6 +273,42 @@
325
273
  "description": "侧栏菜单项",
326
274
  "category": "navigation"
327
275
  },
276
+ {
277
+ "name": "eo-sidebar-menu-group",
278
+ "properties": [
279
+ {
280
+ "name": "collapsable",
281
+ "description": "是否允许折叠",
282
+ "type": "boolean"
283
+ },
284
+ {
285
+ "name": "collapsed",
286
+ "description": "是否折叠",
287
+ "type": "boolean"
288
+ },
289
+ {
290
+ "name": "selected",
291
+ "description": "是否选中",
292
+ "type": "boolean"
293
+ },
294
+ {
295
+ "name": "menuCollapsed",
296
+ "description": "菜单整体是否收起状态",
297
+ "type": "boolean"
298
+ }
299
+ ],
300
+ "events": [],
301
+ "slots": [
302
+ {
303
+ "name": "title",
304
+ "description": "分组标题"
305
+ }
306
+ ],
307
+ "methods": [],
308
+ "parts": [],
309
+ "description": "侧栏菜单分组",
310
+ "category": "navigation"
311
+ },
328
312
  {
329
313
  "name": "eo-sidebar-menu-submenu",
330
314
  "properties": [
@@ -363,36 +347,35 @@
363
347
  "category": "navigation"
364
348
  },
365
349
  {
366
- "name": "eo-sidebar-menu",
350
+ "name": "eo-launchpad-recent-visits",
367
351
  "properties": [
368
352
  {
369
- "name": "menuCollapsed",
370
- "description": "菜单整体是否收起状态",
371
- "type": "boolean"
353
+ "name": "target",
354
+ "attribute": false,
355
+ "type": "Target"
372
356
  }
373
357
  ],
374
358
  "events": [],
375
359
  "slots": [],
376
360
  "methods": [],
377
361
  "parts": [],
378
- "description": "侧栏菜单",
379
- "category": "navigation"
362
+ "description": "launchpad 最近访问",
363
+ "insider": true
380
364
  },
381
365
  {
382
- "name": "eo-sidebar-sub-menu",
366
+ "name": "eo-sidebar-menu",
383
367
  "properties": [
384
368
  {
385
- "name": "menu",
386
- "description": "菜单项",
387
- "attribute": false,
388
- "type": "SidebarMenu"
369
+ "name": "menuCollapsed",
370
+ "description": "菜单整体是否收起状态",
371
+ "type": "boolean"
389
372
  }
390
373
  ],
391
374
  "events": [],
392
375
  "slots": [],
393
376
  "methods": [],
394
377
  "parts": [],
395
- "description": "构件 `eo-sidebar-sub-menu`",
378
+ "description": "侧栏菜单",
396
379
  "category": "navigation"
397
380
  },
398
381
  {
@@ -445,6 +428,23 @@
445
428
  "description": "侧边栏",
446
429
  "category": "navigation"
447
430
  },
431
+ {
432
+ "name": "eo-sidebar-sub-menu",
433
+ "properties": [
434
+ {
435
+ "name": "menu",
436
+ "description": "菜单项",
437
+ "attribute": false,
438
+ "type": "SidebarMenu"
439
+ }
440
+ ],
441
+ "events": [],
442
+ "slots": [],
443
+ "methods": [],
444
+ "parts": [],
445
+ "description": "构件 `eo-sidebar-sub-menu`",
446
+ "category": "navigation"
447
+ },
448
448
  {
449
449
  "name": "eo-directory",
450
450
  "properties": [
@@ -509,6 +509,44 @@
509
509
  "parts": [],
510
510
  "description": "目录"
511
511
  },
512
+ {
513
+ "name": "eo-directory-tree-leaf",
514
+ "properties": [
515
+ {
516
+ "name": "depth",
517
+ "description": "深度",
518
+ "default": "0",
519
+ "type": "number"
520
+ },
521
+ {
522
+ "name": "selected",
523
+ "description": "是否选中",
524
+ "type": "boolean"
525
+ },
526
+ {
527
+ "name": "icon",
528
+ "attribute": false,
529
+ "type": "GeneralIconProps"
530
+ },
531
+ {
532
+ "name": "faded",
533
+ "type": "boolean"
534
+ }
535
+ ],
536
+ "events": [
537
+ {
538
+ "name": "select",
539
+ "description": "选择事件",
540
+ "detail": {
541
+ "type": "void"
542
+ }
543
+ }
544
+ ],
545
+ "slots": [],
546
+ "methods": [],
547
+ "parts": [],
548
+ "description": "目录树叶子节点"
549
+ },
512
550
  {
513
551
  "name": "eo-directory-tree",
514
552
  "properties": [
@@ -606,44 +644,6 @@
606
644
  "parts": [],
607
645
  "description": "目录树"
608
646
  },
609
- {
610
- "name": "eo-directory-tree-leaf",
611
- "properties": [
612
- {
613
- "name": "depth",
614
- "description": "深度",
615
- "default": "0",
616
- "type": "number"
617
- },
618
- {
619
- "name": "selected",
620
- "description": "是否选中",
621
- "type": "boolean"
622
- },
623
- {
624
- "name": "icon",
625
- "attribute": false,
626
- "type": "GeneralIconProps"
627
- },
628
- {
629
- "name": "faded",
630
- "type": "boolean"
631
- }
632
- ],
633
- "events": [
634
- {
635
- "name": "select",
636
- "description": "选择事件",
637
- "detail": {
638
- "type": "void"
639
- }
640
- }
641
- ],
642
- "slots": [],
643
- "methods": [],
644
- "parts": [],
645
- "description": "目录树叶子节点"
646
- },
647
647
  {
648
648
  "name": "eo-directory-tree-internal-node",
649
649
  "properties": [
package/dist/types.json CHANGED
@@ -564,22 +564,6 @@
564
564
  "events": [],
565
565
  "methods": []
566
566
  },
567
- "eo-launchpad-recent-visits": {
568
- "properties": [
569
- {
570
- "name": "target",
571
- "annotation": {
572
- "type": "reference",
573
- "typeName": {
574
- "type": "identifier",
575
- "name": "Target"
576
- }
577
- }
578
- }
579
- ],
580
- "events": [],
581
- "methods": []
582
- },
583
567
  "eo-search-launchpad": {
584
568
  "properties": [
585
569
  {
@@ -630,6 +614,22 @@
630
614
  "events": [],
631
615
  "methods": []
632
616
  },
617
+ "eo-launchpad-recent-visits": {
618
+ "properties": [
619
+ {
620
+ "name": "target",
621
+ "annotation": {
622
+ "type": "reference",
623
+ "typeName": {
624
+ "type": "identifier",
625
+ "name": "Target"
626
+ }
627
+ }
628
+ }
629
+ ],
630
+ "events": [],
631
+ "methods": []
632
+ },
633
633
  "eo-sidebar-menu": {
634
634
  "properties": [
635
635
  {
@@ -1191,40 +1191,6 @@
1191
1191
  }
1192
1192
  ]
1193
1193
  },
1194
- "eo-sidebar-menu-group": {
1195
- "properties": [
1196
- {
1197
- "name": "collapsable",
1198
- "annotation": {
1199
- "type": "keyword",
1200
- "value": "boolean"
1201
- }
1202
- },
1203
- {
1204
- "name": "collapsed",
1205
- "annotation": {
1206
- "type": "keyword",
1207
- "value": "boolean"
1208
- }
1209
- },
1210
- {
1211
- "name": "selected",
1212
- "annotation": {
1213
- "type": "keyword",
1214
- "value": "boolean"
1215
- }
1216
- },
1217
- {
1218
- "name": "menuCollapsed",
1219
- "annotation": {
1220
- "type": "keyword",
1221
- "value": "boolean"
1222
- }
1223
- }
1224
- ],
1225
- "events": [],
1226
- "methods": []
1227
- },
1228
1194
  "eo-sidebar": {
1229
1195
  "properties": [
1230
1196
  {
@@ -1337,6 +1303,40 @@
1337
1303
  }
1338
1304
  ]
1339
1305
  },
1306
+ "eo-sidebar-menu-group": {
1307
+ "properties": [
1308
+ {
1309
+ "name": "collapsable",
1310
+ "annotation": {
1311
+ "type": "keyword",
1312
+ "value": "boolean"
1313
+ }
1314
+ },
1315
+ {
1316
+ "name": "collapsed",
1317
+ "annotation": {
1318
+ "type": "keyword",
1319
+ "value": "boolean"
1320
+ }
1321
+ },
1322
+ {
1323
+ "name": "selected",
1324
+ "annotation": {
1325
+ "type": "keyword",
1326
+ "value": "boolean"
1327
+ }
1328
+ },
1329
+ {
1330
+ "name": "menuCollapsed",
1331
+ "annotation": {
1332
+ "type": "keyword",
1333
+ "value": "boolean"
1334
+ }
1335
+ }
1336
+ ],
1337
+ "events": [],
1338
+ "methods": []
1339
+ },
1340
1340
  "eo-directory-tree-leaf": {
1341
1341
  "properties": [
1342
1342
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/nav",
3
- "version": "1.24.2",
3
+ "version": "1.24.4",
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": "0db36935b2e5ac64b83b0fd50d6ad4a9c0dfc790"
46
+ "gitHead": "b794a10e6478928894814b385ef60e1c93f9dedc"
47
47
  }
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_nav=globalThis.webpackChunk_next_bricks_nav||[]).push([[2133],{403:(e,t,n)=>{n.d(t,{I:()=>i,K:()=>o,NS:()=>s,t:()=>r});var a=n(79);let o=function(e){return e.ALL="ALL",e.QUICK_ACCESS="QUICK_ACCESS",e.PLATFORM_BASE="PLATFORM_BASE",e.SCENARIO_CENTER="SCENARIO_CENTER",e.SOLUTIONS="SOLUTIONS",e.OPEN_PLATFORM="OPEN_PLATFORM",e.SEARCH_PLACEHOLDER="SEARCH_PLACEHOLDER",e.RECENT_VISITS="RECENT_VISITS",e.FAVORITE="FAVORITE",e.UNFAVORITE="UNFAVORITE",e.FAVORITES_LIMIT_REACHED="FAVORITES_LIMIT_REACHED",e.FAVORITES_LIMIT_MESSAGE="FAVORITES_LIMIT_MESSAGE",e}({});const s="bricks/nav/launchpad-button-v2",i={en:{ALL:"All",QUICK_ACCESS:"Quick Access",PLATFORM_BASE:"Platform Base",SCENARIO_CENTER:"Scenario Center",SOLUTIONS:"Solutions",OPEN_PLATFORM:"Open Platform",SEARCH_PLACEHOLDER:"Search by keyword",RECENT_VISITS:"Recent Visits",FAVORITE:"Favorite",UNFAVORITE:"Unfavorite",FAVORITES_LIMIT_REACHED:"Favorites Limit Reached",FAVORITES_LIMIT_MESSAGE:"Current favorites count has reached the limit ({{count}} items). Please remove some favorites before adding new ones."},zh:{ALL:"全部",QUICK_ACCESS:"快捷访问",PLATFORM_BASE:"平台底座",SCENARIO_CENTER:"场景中心",SOLUTIONS:"解决方案",OPEN_PLATFORM:"开放平台",SEARCH_PLACEHOLDER:"通过关键字搜索",RECENT_VISITS:"最近访问",FAVORITE:"收藏",UNFAVORITE:"取消收藏",FAVORITES_LIMIT_REACHED:"收藏数量已达上限",FAVORITES_LIMIT_MESSAGE:"当前收藏链接数量已达上限({{count}}个),请删除部分收藏后再添加。"}},r=a.i18n.getFixedT(null,s)},2133:(e,t,n)=>{n.d(t,{fm:()=>b,ir:()=>M,pU:()=>B,sZ:()=>H});var a=n(8769),o=n(3081),s=n(9384),i=n(7137),r=n(6934),c=n(4864),l=n(9393),u=n(403),p=n(3346),d=n(7296),m=n(2824),I=n(2887),f=n(8406),h=n(1030);const E=10,A=10;var S,y=n(6659);async function v(){return(await(0,d.K)({page:1,pageSize:E},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0})).list}function C(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}function R(e,t){return e.id.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)?e:null}(0,r.initializeReactI18n)(u.NS,u.I),(0,r.initializeReactI18n)(u.NS,u.I);const T=`launchpad-recent-visits:${null===(S=s.auth.getAuth())||void 0===S?void 0:S.org}`,g=new i.G(localStorage);let _=[],L=new Map,O=new Map,F=!1,w=[],k=!1,N=[],P=!1;const M=new c.x((async()=>{({menuGroups:_,microAppsById:L,customLinksById:O}=await async function(){var e;const t=await(0,p.i)({},{interceptorParams:{ignoreLoadingBar:!0},noAbortOnRouteChange:!0}),n=new Map;for(const e of t.storyboards){var a;const t=e.app;t.localeName=(0,y.y)(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.localeName=(0,y.y)(o.locales,o.name),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)||(t.localeName=(0,y.y)(t.locales,t.name),e.push(t),i.set(t.id,t))}e.length>0&&t.push({...o,items:e});break}}t.length>0&&(a.localeName=(0,y.y)(a.locales,a.name),o.push({...a,items:t}))}return{menuGroups:o,microAppsById:n,customLinksById:i}}()),F=!0})),b=new c.x((async()=>{w=await async function(){const e=await v(),t=[];for(const n of e)if("microApp"===n.type){const e=n.relatedApp,a=(0,y.y)(e.locales,e.name);t.push({favoriteId:n.instanceId,type:"app",name:a,id:e.appId,url:e.homepage,instanceId:e.instanceId,menuIcon:e.menuIcon})}else if("customItem"===n.type){const e=n.relatedCustomItem,a=(0,y.y)(e.locales,e.name);t.push({favoriteId:n.instanceId,type:"custom",name:a,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}(),k=!0})),B=new c.x((async()=>{N=await async function(){const e=(await(0,f.y)("MICRO_APP_CATEGORY@EASYOPS",{fields:["id","type","name","locales","icon","order","platformApps.appId","platformApps.name","platformApps.locales","platformApps.homepage","platformApps.description","platformApps.menuIcon","platformApps._object_id","platformApps.@.order","platformItems.id","platformItems.name","platformItems.locales","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,y.y)(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:(0,y.y)(e.locales,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,h.sortBy)([...t,...n],"order");return{instanceId:e.instanceId,id:e.id,name:(0,y.y)(e.locales,e.name),icon:e.icon,order:e.order,items:a}}));return[{id:"#all",name:(0,u.t)(u.K.ALL),icon:{lib:"easyops",category:"second-menu",icon:"sprint-planning-second-menu"},items:[]},...(0,h.sortBy)(t,"order")]}(),P=!0})),V=e=>(0,l.Ds)({type:"error",message:(0,o.httpErrorToString)(e)});function H(e){const{t}=(0,r.useTranslation)(u.NS),[n,s]=(0,a.useState)(_),[i,c]=(0,a.useState)(L),[p,d]=(0,a.useState)(O),[f,h]=(0,a.useState)(""),[S,y]=(0,a.useState)(!F),[H,D]=(0,a.useState)(!k),[x,G]=(0,a.useState)(!P),[K,Q]=(0,a.useState)([]),[j,z]=(0,a.useState)([]),[q,Y]=(0,a.useState)(w),[Z,$]=(0,a.useState)(N);(0,a.useEffect)((()=>{e&&!S&&(s(_),c(L),d(O))}),[e,S]),(0,a.useEffect)((()=>{e&&!H&&Y(w)}),[e,H]),(0,a.useEffect)((()=>{e&&!x&&$(N)}),[e,x]),(0,a.useEffect)((()=>{var t;e&&Q(null!==(t=g.getItem(T))&&void 0!==t?t:[])}),[e]),(0,a.useEffect)((()=>{e&&(async()=>{try{await M.fetch(),y(!1)}catch(e){(0,o.handleHttpError)(e)}})()}),[e]),(0,a.useEffect)((()=>{e&&(async()=>{try{await b.fetch(),D(!1)}catch(e){D(!1),V(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 B.fetch(),G(!1)}catch(e){G(!1),V(e)}})()}),[e]),(0,a.useEffect)((()=>{if(S)return;const e=K.map((e=>{if("app"===e.type){const t=i.get(e.id);return t?{type:"app",name:t.localeName,id:t.id,url:t.homepage,instanceId:t.instanceId,menuIcon:t.menuIcon}:null}const t=p.get(e.id);return t?{...t,name:t.localeName}:null})).filter(Boolean);z(e)}),[p,S,i,K]);const J=(0,a.useCallback)((e=>{var t;let{type:n,id:a}=e;const o=null!==(t=g.getItem(T))&&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>A&&o.pop(),g.setItem(T,o)}),[]),W=(0,a.useCallback)((e=>q.some((t=>U(e,t)))),[q]),X=(0,a.useCallback)((e=>{const n=q.findIndex((t=>"link"===e.type?t.favoriteId===e.favoriteId:U(e,t)));let a;if(n>-1){const e=q[n];a=q.slice(0,n).concat(q.slice(n+1)),async function(e){return e.favoriteId?(0,I.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,I.r)(a);console.error("Menu item to unstar not found:",e)}))}(e).catch(V)}else{if(q.length>=E)return void(0,l.ui)({type:"warn",title:t(u.K.FAVORITES_LIMIT_REACHED),content:t(u.K.FAVORITES_LIMIT_MESSAGE,{count:E})});const n={...e};a=q.concat(n),async function(e){return(0,m.k)({type:"app"===e.type?"microApp":"customItem",relatedInstanceId:e.instanceId},{interceptorParams:{ignoreLoadingBar:!0}})}(e).then((e=>{e&&(n.favoriteId=e.instanceId)}),V)}Y(a),w=a}),[q]),ee=(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 C(e,n);case"custom":return R(e,n);case"dir":{const t=e.items.map((e=>"app"===e.type?C(e,n):"custom"===e.type?R(e,n):null)).filter(Boolean);return t.length>0?{...e,items:t}:null}}})).filter(Boolean)}))).filter((e=>e.items.length>0))}(n,f)),[n,f]),te=(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 C(e,n);case"custom":return R(e,n)}})).filter(Boolean)})))}(Z,f)),[Z,f]);return{loading:S,q:f,setQ:h,menuGroups:ee,loadingFavorites:H,loadingPlatformCategories:x,favorites:q,recentVisits:j,pushRecentVisit:J,isStarred:W,toggleStar:X,platformCategories:te}}function U(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,{y:()=>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.8c2de8bf.js.map