@sheinx/hooks 3.8.2 → 3.8.3-beta.2

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;;;;;CAktBZ,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;;;;;CAotBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -208,7 +208,9 @@ var useTree = function useTree(props) {
208
208
  if (unmatch) values.push(id);
209
209
  });
210
210
  context.cachedValue = values;
211
- return values;
211
+ // why deep clone: 外部可能对数组做splice等操作,影响context.cachedValue在内部的判断逻辑
212
+ // 表现出来的bug现象是:外部删除了某个叶子结点,但是Tree的勾选情况没有同步更新; 另外是为了对齐老版本的表现
213
+ return (0, _utils.deepClone)(values);
212
214
  };
213
215
  var getPath = function getPath(id) {
214
216
  return context.pathMap.get(id);
@@ -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;;;;;CAktBZ,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;;;;;CAotBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -20,7 +20,7 @@ import { useInputAble } from "../../common/use-input-able";
20
20
  import { getExpandVirtualData } from "../use-table/use-table-tree";
21
21
  import { usePersistFn } from "../../common/use-persist-fn";
22
22
  import { isFunc, isString, isNumber, isArray, isUnMatchedData, isOptionalDisabled } from "../../utils/is";
23
- import { devUseWarning, produce, shallowEqual } from "../../utils";
23
+ import { devUseWarning, produce, shallowEqual, deepClone } from "../../utils";
24
24
  function toArray(value) {
25
25
  if (!value) return [];
26
26
  if (!Array.isArray(value)) return [value];
@@ -201,7 +201,9 @@ var useTree = function useTree(props) {
201
201
  if (unmatch) values.push(id);
202
202
  });
203
203
  context.cachedValue = values;
204
- return values;
204
+ // why deep clone: 外部可能对数组做splice等操作,影响context.cachedValue在内部的判断逻辑
205
+ // 表现出来的bug现象是:外部删除了某个叶子结点,但是Tree的勾选情况没有同步更新; 另外是为了对齐老版本的表现
206
+ return deepClone(values);
205
207
  };
206
208
  var getPath = function getPath(id) {
207
209
  return context.pathMap.get(id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/hooks",
3
- "version": "3.8.2",
3
+ "version": "3.8.3-beta.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",