@sheinx/hooks 3.4.3-beta.1 → 3.4.3-beta.3
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/components/use-tree/use-tree-node.js +1 -1
- package/cjs/components/use-tree/use-tree-node.type.d.ts +1 -1
- package/cjs/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +3 -2
- package/cjs/components/use-tree/use-tree.type.d.ts +1 -1
- package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree-node.js +1 -1
- package/esm/components/use-tree/use-tree-node.type.d.ts +1 -1
- package/esm/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +3 -2
- package/esm/components/use-tree/use-tree.type.d.ts +1 -1
- package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/package.json +1 -1
@@ -62,7 +62,7 @@ var useTreeNode = function useTreeNode(props) {
|
|
62
62
|
return true;
|
63
63
|
};
|
64
64
|
(0, _react.useEffect)(function () {
|
65
|
-
var _bindNode = bindNode(id, update),
|
65
|
+
var _bindNode = bindNode(id, update, data),
|
66
66
|
active = _bindNode.active,
|
67
67
|
nextExpanded = _bindNode.expanded;
|
68
68
|
setActive(active);
|
@@ -14,7 +14,7 @@ export interface BaseTreeNodeProps<DataItem, Value> {
|
|
14
14
|
element: React.RefObject<HTMLDivElement>;
|
15
15
|
dragImageSelector: (data?: DataItem) => string | undefined;
|
16
16
|
dragImageStyle?: React.CSSProperties;
|
17
|
-
bindNode: (id: KeygenResult, update: UpdateFunc) => {
|
17
|
+
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
18
18
|
expanded: boolean;
|
19
19
|
active: boolean;
|
20
20
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree-node.type.d.ts","sourceRoot":"","sources":["use-tree-node.type.ts"],"names":[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,EAKb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;CAkbZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -96,14 +96,15 @@ var useTree = function useTree(props) {
|
|
96
96
|
});
|
97
97
|
|
98
98
|
// 注册节点
|
99
|
-
var bindNode = function bindNode(id, update) {
|
99
|
+
var bindNode = function bindNode(id, update, item) {
|
100
100
|
context.updateMap.set(id, update);
|
101
101
|
var isActive = activeProp === id;
|
102
102
|
var expandeds = expanded;
|
103
103
|
if (defaultExpandAll) {
|
104
|
+
var shouldDefaultExpand = defaultExpandAll && (0, _is.isArray)(item[childrenKey]) && item[childrenKey].length > 0;
|
104
105
|
return {
|
105
106
|
active: isActive,
|
106
|
-
expanded:
|
107
|
+
expanded: shouldDefaultExpand
|
107
108
|
};
|
108
109
|
}
|
109
110
|
return {
|
@@ -118,7 +118,7 @@ export interface TreeDatum<DataItem> {
|
|
118
118
|
setValue: (value?: KeygenResult[]) => void;
|
119
119
|
setData: (data?: DataItem[]) => void;
|
120
120
|
isDisabled: (id: KeygenResult) => boolean;
|
121
|
-
bindNode: (id: KeygenResult, update: UpdateFunc) => {
|
121
|
+
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
122
122
|
active: boolean;
|
123
123
|
expanded: boolean;
|
124
124
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.type.d.ts","sourceRoot":"","sources":["use-tree.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,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AAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,KACX;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5C,WAAW,EAAE,CACX,EAAE,EAAE,YAAY,KACb,QAAQ,GAAG;QAAE,oBAAoB,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,GAAG,IAAI,CAAC;IAC9E,UAAU,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrC,QAAQ,EAAE,GAAG,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;CAChD"}
|
@@ -55,7 +55,7 @@ var useTreeNode = function useTreeNode(props) {
|
|
55
55
|
return true;
|
56
56
|
};
|
57
57
|
useEffect(function () {
|
58
|
-
var _bindNode = bindNode(id, update),
|
58
|
+
var _bindNode = bindNode(id, update, data),
|
59
59
|
active = _bindNode.active,
|
60
60
|
nextExpanded = _bindNode.expanded;
|
61
61
|
setActive(active);
|
@@ -14,7 +14,7 @@ export interface BaseTreeNodeProps<DataItem, Value> {
|
|
14
14
|
element: React.RefObject<HTMLDivElement>;
|
15
15
|
dragImageSelector: (data?: DataItem) => string | undefined;
|
16
16
|
dragImageStyle?: React.CSSProperties;
|
17
|
-
bindNode: (id: KeygenResult, update: UpdateFunc) => {
|
17
|
+
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
18
18
|
expanded: boolean;
|
19
19
|
active: boolean;
|
20
20
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree-node.type.d.ts","sourceRoot":"","sources":["use-tree-node.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB,CAAC,QAAQ,EAAE,KAAK;IAChD,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACzC,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,MAAM,GAAG,SAAS,CAAC;IAC3D,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,QAAQ,EAAE,
|
1
|
+
{"version":3,"file":"use-tree-node.type.d.ts","sourceRoot":"","sources":["use-tree-node.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;AAE5D,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE,MAAM,WAAW,SAAS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G;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AASjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;CAkbZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -89,14 +89,15 @@ var useTree = function useTree(props) {
|
|
89
89
|
});
|
90
90
|
|
91
91
|
// 注册节点
|
92
|
-
var bindNode = function bindNode(id, update) {
|
92
|
+
var bindNode = function bindNode(id, update, item) {
|
93
93
|
context.updateMap.set(id, update);
|
94
94
|
var isActive = activeProp === id;
|
95
95
|
var expandeds = expanded;
|
96
96
|
if (defaultExpandAll) {
|
97
|
+
var shouldDefaultExpand = defaultExpandAll && isArray(item[childrenKey]) && item[childrenKey].length > 0;
|
97
98
|
return {
|
98
99
|
active: isActive,
|
99
|
-
expanded:
|
100
|
+
expanded: shouldDefaultExpand
|
100
101
|
};
|
101
102
|
}
|
102
103
|
return {
|
@@ -118,7 +118,7 @@ export interface TreeDatum<DataItem> {
|
|
118
118
|
setValue: (value?: KeygenResult[]) => void;
|
119
119
|
setData: (data?: DataItem[]) => void;
|
120
120
|
isDisabled: (id: KeygenResult) => boolean;
|
121
|
-
bindNode: (id: KeygenResult, update: UpdateFunc) => {
|
121
|
+
bindNode: (id: KeygenResult, update: UpdateFunc, data: DataItem) => {
|
122
122
|
active: boolean;
|
123
123
|
expanded: boolean;
|
124
124
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-tree.type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