@next-bricks/nav 1.16.1 → 1.17.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.
package/dist/types.json CHANGED
@@ -1,9 +1,4 @@
1
1
  {
2
- "nav.easyops-navbar-alerts": {
3
- "properties": [],
4
- "events": [],
5
- "methods": []
6
- },
7
2
  "eo-app-bar-wrapper": {
8
3
  "properties": [
9
4
  {
@@ -233,6 +228,11 @@
233
228
  "events": [],
234
229
  "methods": []
235
230
  },
231
+ "nav.easyops-navbar-alerts": {
232
+ "properties": [],
233
+ "events": [],
234
+ "methods": []
235
+ },
236
236
  "eo-sidebar-sub-menu": {
237
237
  "properties": [
238
238
  {
@@ -564,18 +564,381 @@
564
564
  "events": [],
565
565
  "methods": []
566
566
  },
567
- "eo-search-launchpad": {
568
- "properties": [
567
+ "nav.get-menu-config-tree": {
568
+ "type": "provider",
569
+ "params": [
569
570
  {
570
- "name": "readonly",
571
+ "name": "menuList",
571
572
  "annotation": {
572
- "type": "keyword",
573
- "value": "boolean"
573
+ "type": "array",
574
+ "elementType": {
575
+ "type": "reference",
576
+ "typeName": {
577
+ "type": "identifier",
578
+ "name": "MenuRawData"
579
+ }
580
+ }
574
581
  }
575
582
  }
576
583
  ],
577
- "events": [],
578
- "methods": []
584
+ "returns": {
585
+ "annotation": {
586
+ "type": "reference",
587
+ "typeName": {
588
+ "type": "identifier",
589
+ "name": "Promise"
590
+ },
591
+ "typeParameters": {
592
+ "type": "typeParameterInstantiation",
593
+ "params": [
594
+ {
595
+ "type": "array",
596
+ "elementType": {
597
+ "type": "reference",
598
+ "typeName": {
599
+ "type": "identifier",
600
+ "name": "TreeNode"
601
+ }
602
+ }
603
+ }
604
+ ]
605
+ }
606
+ }
607
+ },
608
+ "types": [
609
+ {
610
+ "type": "interface",
611
+ "name": "MenuRawData",
612
+ "body": [
613
+ {
614
+ "type": "propertySignature",
615
+ "key": {
616
+ "type": "identifier",
617
+ "name": "menuId"
618
+ },
619
+ "annotation": {
620
+ "type": "keyword",
621
+ "value": "string"
622
+ },
623
+ "computed": false
624
+ },
625
+ {
626
+ "type": "propertySignature",
627
+ "key": {
628
+ "type": "identifier",
629
+ "name": "title"
630
+ },
631
+ "annotation": {
632
+ "type": "keyword",
633
+ "value": "string"
634
+ },
635
+ "computed": false
636
+ },
637
+ {
638
+ "type": "propertySignature",
639
+ "key": {
640
+ "type": "identifier",
641
+ "name": "icon"
642
+ },
643
+ "annotation": {
644
+ "type": "keyword",
645
+ "value": "unknown"
646
+ },
647
+ "optional": true,
648
+ "computed": false
649
+ },
650
+ {
651
+ "type": "propertySignature",
652
+ "key": {
653
+ "type": "identifier",
654
+ "name": "type"
655
+ },
656
+ "annotation": {
657
+ "type": "union",
658
+ "types": [
659
+ {
660
+ "type": "jsLiteral",
661
+ "value": "main"
662
+ },
663
+ {
664
+ "type": "jsLiteral",
665
+ "value": "inject"
666
+ }
667
+ ]
668
+ },
669
+ "optional": true,
670
+ "computed": false
671
+ },
672
+ {
673
+ "type": "propertySignature",
674
+ "key": {
675
+ "type": "identifier",
676
+ "name": "injectMenuGroupId"
677
+ },
678
+ "annotation": {
679
+ "type": "keyword",
680
+ "value": "string"
681
+ },
682
+ "optional": true,
683
+ "computed": false
684
+ },
685
+ {
686
+ "type": "propertySignature",
687
+ "key": {
688
+ "type": "identifier",
689
+ "name": "dynamicItems"
690
+ },
691
+ "annotation": {
692
+ "type": "keyword",
693
+ "value": "boolean"
694
+ },
695
+ "optional": true,
696
+ "computed": false
697
+ },
698
+ {
699
+ "type": "propertySignature",
700
+ "key": {
701
+ "type": "identifier",
702
+ "name": "itemsResolve"
703
+ },
704
+ "annotation": {
705
+ "type": "keyword",
706
+ "value": "unknown"
707
+ },
708
+ "optional": true,
709
+ "computed": false
710
+ },
711
+ {
712
+ "type": "propertySignature",
713
+ "key": {
714
+ "type": "identifier",
715
+ "name": "items"
716
+ },
717
+ "annotation": {
718
+ "type": "array",
719
+ "elementType": {
720
+ "type": "reference",
721
+ "typeName": {
722
+ "type": "identifier",
723
+ "name": "MenuItemRawData"
724
+ }
725
+ }
726
+ },
727
+ "optional": true,
728
+ "computed": false
729
+ }
730
+ ]
731
+ },
732
+ {
733
+ "type": "interface",
734
+ "name": "MenuItemRawData",
735
+ "body": [
736
+ {
737
+ "type": "propertySignature",
738
+ "key": {
739
+ "type": "identifier",
740
+ "name": "text"
741
+ },
742
+ "annotation": {
743
+ "type": "keyword",
744
+ "value": "string"
745
+ },
746
+ "computed": false,
747
+ "description": "菜单项文本。"
748
+ },
749
+ {
750
+ "type": "propertySignature",
751
+ "key": {
752
+ "type": "identifier",
753
+ "name": "icon"
754
+ },
755
+ "annotation": {
756
+ "type": "keyword",
757
+ "value": "unknown"
758
+ },
759
+ "optional": true,
760
+ "computed": false
761
+ },
762
+ {
763
+ "type": "propertySignature",
764
+ "key": {
765
+ "type": "identifier",
766
+ "name": "sort"
767
+ },
768
+ "annotation": {
769
+ "type": "keyword",
770
+ "value": "number"
771
+ },
772
+ "optional": true,
773
+ "computed": false
774
+ },
775
+ {
776
+ "type": "propertySignature",
777
+ "key": {
778
+ "type": "identifier",
779
+ "name": "groupId"
780
+ },
781
+ "annotation": {
782
+ "type": "keyword",
783
+ "value": "string"
784
+ },
785
+ "optional": true,
786
+ "computed": false
787
+ },
788
+ {
789
+ "type": "propertySignature",
790
+ "key": {
791
+ "type": "identifier",
792
+ "name": "hidden"
793
+ },
794
+ "annotation": {
795
+ "type": "keyword",
796
+ "value": "boolean"
797
+ },
798
+ "optional": true,
799
+ "computed": false
800
+ },
801
+ {
802
+ "type": "propertySignature",
803
+ "key": {
804
+ "type": "identifier",
805
+ "name": "children"
806
+ },
807
+ "annotation": {
808
+ "type": "array",
809
+ "elementType": {
810
+ "type": "reference",
811
+ "typeName": {
812
+ "type": "identifier",
813
+ "name": "MenuItemRawData"
814
+ }
815
+ }
816
+ },
817
+ "optional": true,
818
+ "computed": false
819
+ }
820
+ ]
821
+ },
822
+ {
823
+ "type": "interface",
824
+ "name": "TreeNode",
825
+ "body": [
826
+ {
827
+ "type": "propertySignature",
828
+ "key": {
829
+ "type": "identifier",
830
+ "name": "key"
831
+ },
832
+ "annotation": {
833
+ "type": "keyword",
834
+ "value": "string"
835
+ },
836
+ "computed": false
837
+ },
838
+ {
839
+ "type": "propertySignature",
840
+ "key": {
841
+ "type": "identifier",
842
+ "name": "title"
843
+ },
844
+ "annotation": {
845
+ "type": "keyword",
846
+ "value": "string"
847
+ },
848
+ "computed": false
849
+ },
850
+ {
851
+ "type": "propertySignature",
852
+ "key": {
853
+ "type": "identifier",
854
+ "name": "icon"
855
+ },
856
+ "annotation": {
857
+ "type": "keyword",
858
+ "value": "unknown"
859
+ },
860
+ "optional": true,
861
+ "computed": false
862
+ },
863
+ {
864
+ "type": "propertySignature",
865
+ "key": {
866
+ "type": "identifier",
867
+ "name": "faded"
868
+ },
869
+ "annotation": {
870
+ "type": "keyword",
871
+ "value": "unknown"
872
+ },
873
+ "optional": true,
874
+ "computed": false
875
+ },
876
+ {
877
+ "type": "propertySignature",
878
+ "key": {
879
+ "type": "identifier",
880
+ "name": "children"
881
+ },
882
+ "annotation": {
883
+ "type": "array",
884
+ "elementType": {
885
+ "type": "reference",
886
+ "typeName": {
887
+ "type": "identifier",
888
+ "name": "TreeNode"
889
+ }
890
+ }
891
+ },
892
+ "optional": true,
893
+ "computed": false
894
+ },
895
+ {
896
+ "type": "propertySignature",
897
+ "key": {
898
+ "type": "identifier",
899
+ "name": "data"
900
+ },
901
+ "annotation": {
902
+ "type": "union",
903
+ "types": [
904
+ {
905
+ "type": "reference",
906
+ "typeName": {
907
+ "type": "identifier",
908
+ "name": "MenuRawData"
909
+ }
910
+ },
911
+ {
912
+ "type": "reference",
913
+ "typeName": {
914
+ "type": "identifier",
915
+ "name": "MenuItemRawData"
916
+ }
917
+ }
918
+ ]
919
+ },
920
+ "computed": false
921
+ },
922
+ {
923
+ "type": "propertySignature",
924
+ "key": {
925
+ "type": "identifier",
926
+ "name": "__keys"
927
+ },
928
+ "annotation": {
929
+ "type": "array",
930
+ "elementType": {
931
+ "type": "keyword",
932
+ "value": "string"
933
+ }
934
+ },
935
+ "optional": true,
936
+ "computed": false,
937
+ "description": "第一个节点额外返回 __keys,包含所有节点的 key"
938
+ }
939
+ ]
940
+ }
941
+ ]
579
942
  },
580
943
  "eo-launchpad-recent-visits": {
581
944
  "properties": [
@@ -593,6 +956,19 @@
593
956
  "events": [],
594
957
  "methods": []
595
958
  },
959
+ "eo-search-launchpad": {
960
+ "properties": [
961
+ {
962
+ "name": "readonly",
963
+ "annotation": {
964
+ "type": "keyword",
965
+ "value": "boolean"
966
+ }
967
+ }
968
+ ],
969
+ "events": [],
970
+ "methods": []
971
+ },
596
972
  "eo-sidebar-menu-submenu": {
597
973
  "properties": [
598
974
  {
@@ -992,29 +1368,6 @@
992
1368
  }
993
1369
  ]
994
1370
  },
995
- "eo-launchpad-quick-access": {
996
- "properties": [
997
- {
998
- "name": "readonly",
999
- "annotation": {
1000
- "type": "keyword",
1001
- "value": "boolean"
1002
- }
1003
- },
1004
- {
1005
- "name": "target",
1006
- "annotation": {
1007
- "type": "reference",
1008
- "typeName": {
1009
- "type": "identifier",
1010
- "name": "Target"
1011
- }
1012
- }
1013
- }
1014
- ],
1015
- "events": [],
1016
- "methods": []
1017
- },
1018
1371
  "eo-directory-tree": {
1019
1372
  "properties": [
1020
1373
  {
@@ -1448,6 +1801,13 @@
1448
1801
  "type": "keyword",
1449
1802
  "value": "string"
1450
1803
  }
1804
+ },
1805
+ {
1806
+ "name": "customUrlTemplate",
1807
+ "annotation": {
1808
+ "type": "keyword",
1809
+ "value": "string"
1810
+ }
1451
1811
  }
1452
1812
  ],
1453
1813
  "events": [
@@ -2021,6 +2381,29 @@
2021
2381
  "events": [],
2022
2382
  "methods": []
2023
2383
  },
2384
+ "eo-launchpad-quick-access": {
2385
+ "properties": [
2386
+ {
2387
+ "name": "readonly",
2388
+ "annotation": {
2389
+ "type": "keyword",
2390
+ "value": "boolean"
2391
+ }
2392
+ },
2393
+ {
2394
+ "name": "target",
2395
+ "annotation": {
2396
+ "type": "reference",
2397
+ "typeName": {
2398
+ "type": "identifier",
2399
+ "name": "Target"
2400
+ }
2401
+ }
2402
+ }
2403
+ ],
2404
+ "events": [],
2405
+ "methods": []
2406
+ },
2024
2407
  "eo-launchpad-button-v2": {
2025
2408
  "properties": [],
2026
2409
  "events": [],
@@ -20,3 +20,4 @@ import "./directory-tree/directory-tree-leaf/index.js";
20
20
  import "./directory-tree/directory-tree-internal-node/index.js";
21
21
  import "./nav-logo/index.js";
22
22
  import "./poll-announce/index.js";
23
+ import "./data-providers/get-menu-config-tree.js";
@@ -0,0 +1,40 @@
1
+ /** 原始菜单数据。 */
2
+ export interface MenuRawData {
3
+ menuId: string;
4
+ title: string;
5
+ icon?: unknown;
6
+ type?: "main" | "inject";
7
+ injectMenuGroupId?: string;
8
+ dynamicItems?: boolean;
9
+ itemsResolve?: unknown;
10
+ items?: MenuItemRawData[];
11
+ }
12
+ /** 原始菜单项数据。 */
13
+ export type MenuItemRawData = {
14
+ /** 菜单项文本。 */
15
+ text: string;
16
+ icon?: unknown;
17
+ sort?: number;
18
+ groupId?: string;
19
+ hidden?: boolean;
20
+ children?: MenuItemRawData[];
21
+ };
22
+ export interface TitleDataSource {
23
+ objectId: string;
24
+ instanceId: string;
25
+ attributeId?: string;
26
+ }
27
+ export interface TreeNode {
28
+ key: string;
29
+ title: string;
30
+ icon?: unknown;
31
+ faded?: unknown;
32
+ children?: TreeNode[];
33
+ data: MenuRawData | MenuItemRawData;
34
+ /** 第一个节点额外返回 __keys,包含所有节点的 key */
35
+ __keys?: string[];
36
+ }
37
+ /**
38
+ * 构造用于菜单自定义的树形结构数据。
39
+ */
40
+ export declare function getMenuConfigTree(menuList: MenuRawData[]): Promise<TreeNode[]>;
@@ -5,21 +5,24 @@ export interface MenuGroupProps {
5
5
  actions?: MenuAction[];
6
6
  variant?: "launchpad-config" | "menu-config";
7
7
  urlTemplate?: string;
8
+ customUrlTemplate?: string;
8
9
  onActionClick?: (detail: MenuActionEventDetail) => void;
9
10
  }
10
- export declare function MenuGroup({ data, actions, variant, urlTemplate, onActionClick, }: MenuGroupProps): React.JSX.Element;
11
+ export declare function MenuGroup({ data, actions, variant, urlTemplate, customUrlTemplate, onActionClick, }: MenuGroupProps): React.JSX.Element;
11
12
  export interface MenuItemProps {
12
13
  data: ConfigMenuItemNormal;
13
14
  actions?: MenuAction[];
14
15
  variant?: "launchpad-config" | "menu-config";
15
16
  urlTemplate?: string;
17
+ customUrlTemplate?: string;
16
18
  onActionClick?: (detail: MenuActionEventDetail) => void;
17
19
  }
18
- export declare function MenuItem({ data, actions, variant, urlTemplate, onActionClick, }: MenuItemProps): React.JSX.Element;
20
+ export declare function MenuItem({ data, actions, variant, urlTemplate, customUrlTemplate, onActionClick, }: MenuItemProps): React.JSX.Element;
19
21
  export interface MenuItemFolderProps {
20
22
  data: ConfigMenuItemDir;
21
23
  actions?: MenuAction[];
22
24
  variant?: "launchpad-config" | "menu-config";
23
25
  urlTemplate?: string;
26
+ customUrlTemplate?: string;
24
27
  onActionClick?: (detail: MenuActionEventDetail) => void;
25
28
  }
@@ -18,11 +18,19 @@ export declare class LaunchpadConfig extends ReactNextElement implements Launchp
18
18
  */
19
19
  accessor variant: "launchpad-config" | "menu-config" | undefined;
20
20
  /**
21
- * 菜单项链接模板,例如可配置为 `/app/{{ id }}`。
21
+ * 菜单项 APP 类型的链接模板,例如可配置为 `/app/{{ id }}`。
22
22
  *
23
23
  * 注:仅用于 variant: "menu-config"。
24
24
  */
25
25
  accessor urlTemplate: string | undefined;
26
+ /**
27
+ * 菜单项自定义类型的链接模板,例如可配置为 `/custom?url={{ __pathname }}`。
28
+ *
29
+ * 注:仅用于 variant: "menu-config"。
30
+ * 外链菜单链接会设置为禁用。
31
+ * `__pathname` 是运行时变量,表示 url 解析后的 pathname。
32
+ */
33
+ accessor customUrlTemplate: string | undefined;
26
34
  render(): React.JSX.Element;
27
35
  }
28
36
  export interface LaunchpadConfigProps {
@@ -30,6 +38,7 @@ export interface LaunchpadConfigProps {
30
38
  actions?: MenuAction[];
31
39
  variant?: "launchpad-config" | "menu-config";
32
40
  urlTemplate?: string;
41
+ customUrlTemplate?: string;
33
42
  onActionClick?: (detail: MenuActionEventDetail) => void;
34
43
  }
35
- export declare function LaunchpadConfigComponent({ menuGroups, actions, variant, urlTemplate, onActionClick, }: LaunchpadConfigProps): React.JSX.Element;
44
+ export declare function LaunchpadConfigComponent({ menuGroups, actions, variant, urlTemplate, customUrlTemplate, onActionClick, }: LaunchpadConfigProps): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/nav",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-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": "9f899805a630d67747061540862bb53d386168af"
46
+ "gitHead": "b15ad3ff681344213818a78def4c643a1ad8124f"
47
47
  }