@next-bricks/nav 1.4.0 → 1.5.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 (50) hide show
  1. package/dist/bricks.json +10 -2
  2. package/dist/chunks/4282.dba653e3.js +3 -0
  3. package/dist/chunks/4282.dba653e3.js.map +1 -0
  4. package/dist/chunks/{4504.bf55ef18.js → 4504.0a34e5c5.js} +2 -2
  5. package/dist/chunks/{4504.bf55ef18.js.map → 4504.0a34e5c5.js.map} +1 -1
  6. package/dist/chunks/{9102.b3a5fd52.js → 9102.1a6633c8.js} +3 -3
  7. package/dist/chunks/{9102.b3a5fd52.js.map → 9102.1a6633c8.js.map} +1 -1
  8. package/dist/chunks/{easyops-navbar-alerts.4dcfd2a2.js → easyops-navbar-alerts.8ce7a30f.js} +2 -2
  9. package/dist/chunks/{easyops-navbar-alerts.4dcfd2a2.js.map → easyops-navbar-alerts.8ce7a30f.js.map} +1 -1
  10. package/dist/chunks/eo-directory-tree-internal-node.97782b3e.js +2 -0
  11. package/dist/chunks/eo-directory-tree-internal-node.97782b3e.js.map +1 -0
  12. package/dist/chunks/eo-directory-tree-leaf.b2fbb3a4.js +2 -0
  13. package/dist/chunks/eo-directory-tree-leaf.b2fbb3a4.js.map +1 -0
  14. package/dist/chunks/eo-directory-tree.3d795d83.js +2 -0
  15. package/dist/chunks/eo-directory-tree.3d795d83.js.map +1 -0
  16. package/dist/chunks/{eo-frame-breadcrumb.beaa823c.js → eo-frame-breadcrumb.e04ed276.js} +2 -2
  17. package/dist/chunks/{eo-frame-breadcrumb.beaa823c.js.map → eo-frame-breadcrumb.e04ed276.js.map} +1 -1
  18. package/dist/chunks/{eo-sidebar.2882735c.js → eo-sidebar.46731c6b.js} +3 -3
  19. package/dist/chunks/{eo-sidebar.2882735c.js.map → eo-sidebar.46731c6b.js.map} +1 -1
  20. package/dist/chunks/main.7a935b30.js +2 -0
  21. package/dist/chunks/main.7a935b30.js.map +1 -0
  22. package/dist/examples.json +9 -0
  23. package/dist/index.8b01c08b.js +2 -0
  24. package/dist/index.8b01c08b.js.map +1 -0
  25. package/dist/manifest.json +145 -0
  26. package/dist/types.json +371 -0
  27. package/dist-types/bootstrap.d.ts +3 -0
  28. package/dist-types/directory-tree/DirectoryTreeContext.d.ts +20 -0
  29. package/dist-types/directory-tree/Tree.d.ts +7 -0
  30. package/dist-types/directory-tree/constants.d.ts +1 -0
  31. package/dist-types/directory-tree/directory-tree-internal-node/index.d.ts +32 -0
  32. package/dist-types/directory-tree/directory-tree-internal-node/index.spec.d.ts +1 -0
  33. package/dist-types/directory-tree/directory-tree-leaf/index.d.ts +32 -0
  34. package/dist-types/directory-tree/directory-tree-leaf/index.spec.d.ts +1 -0
  35. package/dist-types/directory-tree/index.d.ts +89 -0
  36. package/dist-types/directory-tree/index.spec.d.ts +1 -0
  37. package/dist-types/directory-tree/utils.d.ts +6 -0
  38. package/docs/eo-directory-tree-internal-node.md +48 -0
  39. package/docs/eo-directory-tree-leaf.md +24 -0
  40. package/docs/eo-directory-tree.md +80 -0
  41. package/package.json +2 -2
  42. package/dist/chunks/622.2c4c4691.js +0 -3
  43. package/dist/chunks/622.2c4c4691.js.map +0 -1
  44. package/dist/chunks/main.ac44054c.js +0 -2
  45. package/dist/chunks/main.ac44054c.js.map +0 -1
  46. package/dist/index.605511d2.js +0 -2
  47. package/dist/index.605511d2.js.map +0 -1
  48. /package/dist/chunks/{622.2c4c4691.js.LICENSE.txt → 4282.dba653e3.js.LICENSE.txt} +0 -0
  49. /package/dist/chunks/{9102.b3a5fd52.js.LICENSE.txt → 9102.1a6633c8.js.LICENSE.txt} +0 -0
  50. /package/dist/chunks/{eo-sidebar.2882735c.js.LICENSE.txt → eo-sidebar.46731c6b.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -581,6 +581,36 @@
581
581
  "events": [],
582
582
  "methods": []
583
583
  },
584
+ "eo-directory-tree-internal-node": {
585
+ "properties": [
586
+ {
587
+ "name": "depth",
588
+ "annotation": {
589
+ "type": "keyword",
590
+ "value": "number"
591
+ }
592
+ },
593
+ {
594
+ "name": "expanded",
595
+ "annotation": {
596
+ "type": "keyword",
597
+ "value": "boolean"
598
+ }
599
+ }
600
+ ],
601
+ "events": [
602
+ {
603
+ "name": "expand",
604
+ "detail": {
605
+ "annotation": {
606
+ "type": "keyword",
607
+ "value": "boolean"
608
+ }
609
+ }
610
+ }
611
+ ],
612
+ "methods": []
613
+ },
584
614
  "eo-sidebar-menu-group": {
585
615
  "properties": [
586
616
  {
@@ -727,6 +757,36 @@
727
757
  }
728
758
  ]
729
759
  },
760
+ "eo-directory-tree-leaf": {
761
+ "properties": [
762
+ {
763
+ "name": "depth",
764
+ "annotation": {
765
+ "type": "keyword",
766
+ "value": "number"
767
+ }
768
+ },
769
+ {
770
+ "name": "selected",
771
+ "annotation": {
772
+ "type": "keyword",
773
+ "value": "boolean"
774
+ }
775
+ }
776
+ ],
777
+ "events": [
778
+ {
779
+ "name": "select",
780
+ "detail": {
781
+ "annotation": {
782
+ "type": "keyword",
783
+ "value": "void"
784
+ }
785
+ }
786
+ }
787
+ ],
788
+ "methods": []
789
+ },
730
790
  "eo-launchpad-quick-access": {
731
791
  "properties": [
732
792
  {
@@ -740,6 +800,317 @@
740
800
  "events": [],
741
801
  "methods": []
742
802
  },
803
+ "eo-directory-tree": {
804
+ "properties": [
805
+ {
806
+ "name": "data",
807
+ "annotation": {
808
+ "type": "array",
809
+ "elementType": {
810
+ "type": "reference",
811
+ "typeName": {
812
+ "type": "identifier",
813
+ "name": "TreeItem"
814
+ }
815
+ }
816
+ }
817
+ },
818
+ {
819
+ "name": "directoryTitle",
820
+ "annotation": {
821
+ "type": "keyword",
822
+ "value": "string"
823
+ }
824
+ },
825
+ {
826
+ "name": "searchable",
827
+ "annotation": {
828
+ "type": "keyword",
829
+ "value": "boolean"
830
+ }
831
+ },
832
+ {
833
+ "name": "placeholder",
834
+ "annotation": {
835
+ "type": "keyword",
836
+ "value": "string"
837
+ }
838
+ },
839
+ {
840
+ "name": "searchFields",
841
+ "annotation": {
842
+ "type": "array",
843
+ "elementType": {
844
+ "type": "parenthesizedType",
845
+ "annotation": {
846
+ "type": "union",
847
+ "types": [
848
+ {
849
+ "type": "keyword",
850
+ "value": "string"
851
+ },
852
+ {
853
+ "type": "array",
854
+ "elementType": {
855
+ "type": "keyword",
856
+ "value": "string"
857
+ }
858
+ }
859
+ ]
860
+ }
861
+ }
862
+ }
863
+ },
864
+ {
865
+ "name": "suffixBrick",
866
+ "annotation": {
867
+ "type": "typeLiteral",
868
+ "members": [
869
+ {
870
+ "type": "propertySignature",
871
+ "key": {
872
+ "type": "identifier",
873
+ "name": "useBrick"
874
+ },
875
+ "annotation": {
876
+ "type": "reference",
877
+ "typeName": {
878
+ "type": "identifier",
879
+ "name": "UseBrickConf"
880
+ }
881
+ },
882
+ "computed": false
883
+ }
884
+ ]
885
+ }
886
+ },
887
+ {
888
+ "name": "selectedKeys",
889
+ "annotation": {
890
+ "type": "array",
891
+ "elementType": {
892
+ "type": "keyword",
893
+ "value": "string"
894
+ }
895
+ }
896
+ },
897
+ {
898
+ "name": "expandedKeys",
899
+ "annotation": {
900
+ "type": "array",
901
+ "elementType": {
902
+ "type": "keyword",
903
+ "value": "string"
904
+ }
905
+ }
906
+ }
907
+ ],
908
+ "events": [
909
+ {
910
+ "name": "expand",
911
+ "detail": {
912
+ "annotation": {
913
+ "type": "typeLiteral",
914
+ "members": [
915
+ {
916
+ "type": "propertySignature",
917
+ "key": {
918
+ "type": "identifier",
919
+ "name": "keys"
920
+ },
921
+ "annotation": {
922
+ "type": "array",
923
+ "elementType": {
924
+ "type": "keyword",
925
+ "value": "string"
926
+ }
927
+ },
928
+ "computed": false
929
+ },
930
+ {
931
+ "type": "propertySignature",
932
+ "key": {
933
+ "type": "identifier",
934
+ "name": "node"
935
+ },
936
+ "annotation": {
937
+ "type": "reference",
938
+ "typeName": {
939
+ "type": "identifier",
940
+ "name": "NodeData"
941
+ }
942
+ },
943
+ "computed": false
944
+ }
945
+ ]
946
+ }
947
+ }
948
+ },
949
+ {
950
+ "name": "select",
951
+ "detail": {
952
+ "annotation": {
953
+ "type": "typeLiteral",
954
+ "members": [
955
+ {
956
+ "type": "propertySignature",
957
+ "key": {
958
+ "type": "identifier",
959
+ "name": "keys"
960
+ },
961
+ "annotation": {
962
+ "type": "array",
963
+ "elementType": {
964
+ "type": "keyword",
965
+ "value": "string"
966
+ }
967
+ },
968
+ "computed": false
969
+ },
970
+ {
971
+ "type": "propertySignature",
972
+ "key": {
973
+ "type": "identifier",
974
+ "name": "node"
975
+ },
976
+ "annotation": {
977
+ "type": "reference",
978
+ "typeName": {
979
+ "type": "identifier",
980
+ "name": "NodeData"
981
+ }
982
+ },
983
+ "computed": false
984
+ }
985
+ ]
986
+ }
987
+ }
988
+ }
989
+ ],
990
+ "methods": [
991
+ {
992
+ "name": "expandAll",
993
+ "params": [],
994
+ "returns": {}
995
+ },
996
+ {
997
+ "name": "collapseAll",
998
+ "params": [],
999
+ "returns": {}
1000
+ }
1001
+ ],
1002
+ "types": [
1003
+ {
1004
+ "type": "interface",
1005
+ "name": "TreeItem",
1006
+ "body": [
1007
+ {
1008
+ "type": "propertySignature",
1009
+ "key": {
1010
+ "type": "identifier",
1011
+ "name": "key"
1012
+ },
1013
+ "annotation": {
1014
+ "type": "keyword",
1015
+ "value": "string"
1016
+ },
1017
+ "computed": false
1018
+ },
1019
+ {
1020
+ "type": "propertySignature",
1021
+ "key": {
1022
+ "type": "identifier",
1023
+ "name": "title"
1024
+ },
1025
+ "annotation": {
1026
+ "type": "keyword",
1027
+ "value": "string"
1028
+ },
1029
+ "computed": false
1030
+ },
1031
+ {
1032
+ "type": "propertySignature",
1033
+ "key": {
1034
+ "type": "identifier",
1035
+ "name": "children"
1036
+ },
1037
+ "annotation": {
1038
+ "type": "array",
1039
+ "elementType": {
1040
+ "type": "reference",
1041
+ "typeName": {
1042
+ "type": "identifier",
1043
+ "name": "TreeItem"
1044
+ }
1045
+ }
1046
+ },
1047
+ "optional": true,
1048
+ "computed": false
1049
+ },
1050
+ {
1051
+ "type": "indexSignature",
1052
+ "parameter": {
1053
+ "type": "identifier",
1054
+ "name": "key",
1055
+ "annotation": {
1056
+ "type": "keyword",
1057
+ "value": "string"
1058
+ }
1059
+ },
1060
+ "annotation": {
1061
+ "type": "keyword",
1062
+ "value": "any"
1063
+ }
1064
+ }
1065
+ ]
1066
+ },
1067
+ {
1068
+ "type": "interface",
1069
+ "name": "NodeData",
1070
+ "body": [
1071
+ {
1072
+ "type": "propertySignature",
1073
+ "key": {
1074
+ "type": "identifier",
1075
+ "name": "depth"
1076
+ },
1077
+ "annotation": {
1078
+ "type": "keyword",
1079
+ "value": "number"
1080
+ },
1081
+ "computed": false
1082
+ },
1083
+ {
1084
+ "type": "propertySignature",
1085
+ "key": {
1086
+ "type": "identifier",
1087
+ "name": "index"
1088
+ },
1089
+ "annotation": {
1090
+ "type": "keyword",
1091
+ "value": "number"
1092
+ },
1093
+ "computed": false
1094
+ },
1095
+ {
1096
+ "type": "propertySignature",
1097
+ "key": {
1098
+ "type": "identifier",
1099
+ "name": "data"
1100
+ },
1101
+ "annotation": {
1102
+ "type": "reference",
1103
+ "typeName": {
1104
+ "type": "identifier",
1105
+ "name": "TreeItem"
1106
+ }
1107
+ },
1108
+ "computed": false
1109
+ }
1110
+ ]
1111
+ }
1112
+ ]
1113
+ },
743
1114
  "nav.launchpad-config": {
744
1115
  "properties": [
745
1116
  {
@@ -15,3 +15,6 @@ import "./sidebar/sidebar-menu/index.js";
15
15
  import "./sidebar/index.js";
16
16
  import "./sidebar-sub-menu/index.js";
17
17
  import "./directory/index.js";
18
+ import "./directory-tree/index.js";
19
+ import "./directory-tree/directory-tree-leaf/index.js";
20
+ import "./directory-tree/directory-tree-internal-node/index.js";
@@ -0,0 +1,20 @@
1
+ import { UseBrickConf } from "@next-core/types";
2
+ import React from "react";
3
+ import { NodeData } from ".";
4
+ export interface ContextOfDirectoryTree {
5
+ expandedKeysSet: Set<string>;
6
+ selectedKeysSet: Set<string>;
7
+ onExpand: (data: {
8
+ keys: string[];
9
+ node: NodeData;
10
+ }) => void;
11
+ onSelect: (data: {
12
+ keys: string[];
13
+ node: NodeData;
14
+ }) => void;
15
+ suffixBrick?: {
16
+ useBrick: UseBrickConf;
17
+ };
18
+ }
19
+ export declare const DirectoryTreeContext: React.Context<ContextOfDirectoryTree>;
20
+ export declare const useDirectoryTreeContext: () => ContextOfDirectoryTree;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { TreeItem } from "./";
3
+ interface TreeProps {
4
+ data: TreeItem[];
5
+ }
6
+ export declare function Tree(props: TreeProps): React.JSX.Element[];
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare const IndentSize = 10;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ export interface EoDirectoryTreeInternalNodeProps {
5
+ depth: number;
6
+ expanded?: boolean;
7
+ }
8
+ export interface EoDirectoryTreeInternalNodeEvents {
9
+ expand: CustomEvent<boolean>;
10
+ }
11
+ export interface EoDirectoryTreeInternalNodeEventsMap {
12
+ onExpand: "expand";
13
+ }
14
+ /**
15
+ * 目录树节点节点
16
+ */
17
+ export declare class EoDirectoryTreeInternalNode extends ReactNextElement {
18
+ #private;
19
+ /**
20
+ * 深度
21
+ */
22
+ accessor depth: number;
23
+ /**
24
+ * 是否展开
25
+ */
26
+ accessor expanded: boolean | undefined;
27
+ render(): React.JSX.Element;
28
+ }
29
+ export interface EoDirectoryTreeInternalNodeComponentProps extends EoDirectoryTreeInternalNodeProps {
30
+ onExpand: () => void;
31
+ }
32
+ export declare function EoDirectoryTreeInternalNodeComponent(props: EoDirectoryTreeInternalNodeComponentProps): React.JSX.Element;
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ export interface EoDirectoryTreeLeafProps {
5
+ depth: number;
6
+ selected?: boolean;
7
+ }
8
+ export interface EoDirectoryTreeLeafEvents {
9
+ select: CustomEvent<void>;
10
+ }
11
+ export interface EoDirectoryTreeLeafEventsMap {
12
+ onSelect: "select";
13
+ }
14
+ /**
15
+ * 目录树叶子节点
16
+ */
17
+ export declare class EoDirectoryTreeLeaf extends ReactNextElement {
18
+ #private;
19
+ /**
20
+ * 深度
21
+ */
22
+ accessor depth: number;
23
+ /**
24
+ * 是否选中
25
+ */
26
+ accessor selected: boolean | undefined;
27
+ render(): React.JSX.Element;
28
+ }
29
+ export interface EoDirectoryTreeLeafComponentProps extends EoDirectoryTreeLeafProps {
30
+ onSelect: () => void;
31
+ }
32
+ export declare function EoDirectoryTreeLeafComponent(props: EoDirectoryTreeLeafComponentProps): React.JSX.Element;
@@ -0,0 +1,89 @@
1
+ import React from "react";
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import "@next-core/theme";
4
+ import { UseBrickConf } from "@next-core/types";
5
+ export interface TreeItem {
6
+ key: string;
7
+ title: string;
8
+ children?: TreeItem[];
9
+ [key: string]: any;
10
+ }
11
+ export interface NodeData {
12
+ depth: number;
13
+ index: number;
14
+ data: TreeItem;
15
+ }
16
+ export interface EoDirectoryTreeProps {
17
+ data: TreeItem[];
18
+ directoryTitle?: string;
19
+ searchable?: boolean;
20
+ placeholder?: string;
21
+ selectedKeys?: string[];
22
+ expandedKeys?: string[];
23
+ searchFields?: (string | string[])[];
24
+ suffixBrick?: {
25
+ useBrick: UseBrickConf;
26
+ };
27
+ }
28
+ /**
29
+ * 目录树
30
+ */
31
+ export declare class EoDirectoryTree extends ReactNextElement {
32
+ #private;
33
+ /**
34
+ * 数据源
35
+ */
36
+ accessor data: TreeItem[];
37
+ /**
38
+ * 目录标题
39
+ */
40
+ accessor directoryTitle: string | undefined;
41
+ /**
42
+ * 可搜索
43
+ */
44
+ accessor searchable: boolean | undefined;
45
+ /**
46
+ * 搜索占位说明
47
+ */
48
+ accessor placeholder: string | undefined;
49
+ /**
50
+ * 除了 title 以外,额外的搜索字段
51
+ */
52
+ accessor searchFields: (string | string[])[] | undefined;
53
+ /**
54
+ * 后缀 useBrick
55
+ */
56
+ accessor suffixBrick: {
57
+ useBrick: UseBrickConf;
58
+ } | undefined;
59
+ /**
60
+ * 选中的 keys
61
+ */
62
+ accessor selectedKeys: string[] | undefined;
63
+ /**
64
+ * 展开的 keys
65
+ */
66
+ accessor expandedKeys: string[] | undefined;
67
+ /**
68
+ * 展开全部
69
+ */
70
+ expandAll(): void;
71
+ /**
72
+ * 收起全部
73
+ */
74
+ collapseAll(): void;
75
+ render(): React.JSX.Element;
76
+ }
77
+ interface EoDirectoryTreeComponentProps extends EoDirectoryTreeProps {
78
+ element: EoDirectoryTree;
79
+ onExpand: (data: {
80
+ keys: string[];
81
+ node: NodeData;
82
+ }) => void;
83
+ onSelect: (data: {
84
+ keys: string[];
85
+ node: NodeData;
86
+ }) => void;
87
+ }
88
+ export declare function EoDirectoryTreeComponent(props: EoDirectoryTreeComponentProps): React.JSX.Element;
89
+ export {};
@@ -0,0 +1 @@
1
+ import "./";
@@ -0,0 +1,6 @@
1
+ import { TreeItem } from "./index";
2
+ export declare function getAllExpandableKeys(data: TreeItem[]): string[];
3
+ export declare function searchTree(data: TreeItem[], q: string, searchFields: (string | string[])[]): {
4
+ data: TreeItem[];
5
+ expandedKeys: string[];
6
+ };
@@ -0,0 +1,48 @@
1
+ 目录树节点
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ brick: eo-directory-tree-internal-node
9
+ events:
10
+ expand:
11
+ - action: console.log
12
+ args:
13
+ - <% EVENT.detail %>
14
+ properties:
15
+ style:
16
+ width: 200px
17
+ children:
18
+ - brick: span
19
+ slot: label
20
+ properties:
21
+ textContent: 第一层级
22
+ - brick: eo-tag
23
+ slot: suffix
24
+ properties:
25
+ textContent: suffixBrick
26
+ color: red
27
+ - brick: eo-directory-tree-leaf
28
+ properties:
29
+ depth: 1
30
+ children:
31
+ - brick: span
32
+ properties:
33
+ textContent: 第二层级-1
34
+ - brick: eo-directory-tree-leaf
35
+ properties:
36
+ depth: 1
37
+ children:
38
+ - brick: span
39
+ properties:
40
+ textContent: 第二层级-2
41
+ - brick: eo-directory-tree-leaf
42
+ properties:
43
+ depth: 1
44
+ children:
45
+ - brick: span
46
+ properties:
47
+ textContent: 第二层级-3
48
+ ```
@@ -0,0 +1,24 @@
1
+ 目录树叶子节点
2
+
3
+ ## Examples
4
+
5
+ ### Basic
6
+
7
+ ```yaml preview
8
+ brick: eo-directory-tree-leaf
9
+ events:
10
+ select:
11
+ - action: console.log
12
+ properties:
13
+ style:
14
+ width: 200px
15
+ children:
16
+ - brick: span
17
+ properties:
18
+ textContent: 第一层级
19
+ - brick: eo-tag
20
+ slot: suffix
21
+ properties:
22
+ textContent: suffixBrick
23
+ color: red
24
+ ```