zzz-pc-view 0.0.90 → 0.0.92

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.90",
3
+ "version": "0.0.92",
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,32 +1926,49 @@ const selectCtrlByAll = (param) => {
1926
1926
  };
1927
1927
  const selectCtrlByInvert = (param) => {
1928
1928
  const { keyProp, selected, defaultBoolean } = param;
1929
- return (
1930
- // 根据 toMap 的值选择不同的处理方式
1931
- param.toMap ? param.list.reduce(
1932
- // 将列表转换为映射对象,反转每个元素的选择状态
1929
+ return param.toMap ? (
1930
+ // 如果 toMap 为真,则使用 reduce 方法将列表转换为键值对对象
1931
+ param.list.reduce(
1933
1932
  (map2, item) => {
1934
1933
  const key2 = item[keyProp];
1935
- map2[key2] = Object.prototype.hasOwnProperty.call(selected, key2) ? !selected[key2] : defaultBoolean;
1934
+ const isSelect = Object.prototype.hasOwnProperty.call(selected, key2) ? selected[key2] : defaultBoolean;
1935
+ map2[key2] = !isSelect;
1936
1936
  return map2;
1937
1937
  },
1938
1938
  {}
1939
- ) : param.list.reduce(
1940
- // 将列表转换为数组,只包含反转后选择状态为 true 的元素
1941
- (list2, item) => {
1942
- const key2 = item[keyProp];
1943
- if (Object.prototype.hasOwnProperty.call(selected, key2) ? !selected[key2] : defaultBoolean) {
1944
- list2.push(key2);
1945
- }
1946
- return list2;
1939
+ )
1940
+ ) : (
1941
+ // 如果 toMap 为假,则使用 reduce 方法将列表转换为数组
1942
+ param.list.reduce((list2, item) => {
1943
+ const key2 = item[keyProp];
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
+ );
1951
+ };
1952
+ const selectCtrlByClear = (param) => {
1953
+ const { keyProp } = param;
1954
+ return param.toMap ? (
1955
+ // 如果 toMap 为真,则使用 reduce 方法将列表转换为键值对对象,所有键对应的选择状态都设为 false
1956
+ param.list.reduce(
1957
+ (map2, item) => {
1958
+ map2[item[keyProp]] = false;
1959
+ return map2;
1947
1960
  },
1948
- []
1961
+ {}
1949
1962
  )
1963
+ ) : (
1964
+ // 如果 toMap 为假或未提供,则返回一个空数组
1965
+ []
1950
1966
  );
1951
1967
  };
1952
1968
  const index$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1953
1969
  __proto__: null,
1954
1970
  selectCtrlByAll,
1971
+ selectCtrlByClear,
1955
1972
  selectCtrlByInvert
1956
1973
  }, Symbol.toStringTag, { value: "Module" }));
1957
1974
  const ZUtils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({