zzz-pc-view 0.0.89 → 0.0.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zzz-pc-view",
3
- "version": "0.0.89",
3
+ "version": "0.0.91",
4
4
  "main": "src/index.umd.js",
5
5
  "module": "src/index.es.js",
6
6
  "types": "src/index.d.ts",
package/src/index.es.js CHANGED
@@ -1926,20 +1926,28 @@ const selectCtrlByAll = (param) => {
1926
1926
  };
1927
1927
  const selectCtrlByInvert = (param) => {
1928
1928
  const { keyProp, selected, defaultBoolean } = param;
1929
- return param.toMap ? param.list.reduce(
1930
- (map2, item) => {
1929
+ return param.toMap ? (
1930
+ // 如果 toMap 为真,则使用 reduce 方法将列表转换为键值对对象
1931
+ param.list.reduce(
1932
+ (map2, item) => {
1933
+ const key2 = item[keyProp];
1934
+ const isSelect = Object.prototype.hasOwnProperty.call(selected, key2) ? selected[key2] : defaultBoolean;
1935
+ map2[key2] = !isSelect;
1936
+ return map2;
1937
+ },
1938
+ {}
1939
+ )
1940
+ ) : (
1941
+ // 如果 toMap 为假,则使用 reduce 方法将列表转换为数组
1942
+ param.list.reduce((list2, item) => {
1931
1943
  const key2 = item[keyProp];
1932
- map2[key2] = Object.prototype.hasOwnProperty.call(selected, key2) ? !selected[key2] : defaultBoolean;
1933
- return map2;
1934
- },
1935
- {}
1936
- ) : param.list.reduce((list2, item) => {
1937
- const key2 = item[keyProp];
1938
- if (Object.prototype.hasOwnProperty.call(selected, key2) ? !selected[key2] : defaultBoolean) {
1939
- list2.push(key2);
1940
- }
1941
- return list2;
1942
- }, []);
1944
+ const isSelect = Object.prototype.hasOwnProperty.call(selected, key2) ? selected[key2] : defaultBoolean;
1945
+ if (!isSelect) {
1946
+ list2.push(key2);
1947
+ }
1948
+ return list2;
1949
+ }, [])
1950
+ );
1943
1951
  };
1944
1952
  const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1945
1953
  __proto__: null,