@sheinx/hooks 3.7.10-beta.4 → 3.7.10-beta.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAgtBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAktBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -149,6 +149,8 @@ var useTree = function useTree(props) {
149
149
  var _context$dataFlatStat2;
150
150
  context.updateMap.set(id, update);
151
151
  var isActive = activeProp === id;
152
+ // 立即调用update函数设置正确的active状态
153
+ if (isActive) update('active', isActive);
152
154
  return {
153
155
  active: isActive,
154
156
  expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
@@ -278,7 +280,7 @@ var useTree = function useTree(props) {
278
280
  context.dataMap.set(id, item);
279
281
  if (virtual) {
280
282
  context.dataFlatStatusMap.set(id, {
281
- active: false,
283
+ active: activeProp === id,
282
284
  expanded: defaultExpandAll ? true : (expanded === null || expanded === void 0 ? void 0 : expanded.includes(id)) || false,
283
285
  fetching: false
284
286
  });
@@ -1 +1 @@
1
- {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAgtBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAIV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CAktBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -142,6 +142,8 @@ var useTree = function useTree(props) {
142
142
  var _context$dataFlatStat2;
143
143
  context.updateMap.set(id, update);
144
144
  var isActive = activeProp === id;
145
+ // 立即调用update函数设置正确的active状态
146
+ if (isActive) update('active', isActive);
145
147
  return {
146
148
  active: isActive,
147
149
  expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
@@ -271,7 +273,7 @@ var useTree = function useTree(props) {
271
273
  context.dataMap.set(id, item);
272
274
  if (virtual) {
273
275
  context.dataFlatStatusMap.set(id, {
274
- active: false,
276
+ active: activeProp === id,
275
277
  expanded: defaultExpandAll ? true : (expanded === null || expanded === void 0 ? void 0 : expanded.includes(id)) || false,
276
278
  fetching: false
277
279
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.7.10-beta.4",
3
+ "version": "3.7.10-beta.5",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",