@zhenliang/sheet 0.1.4 → 0.1.6

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.
@@ -77,7 +77,8 @@ export var GroupEvent = function GroupEvent(props) {
77
77
  name: "group-open-title",
78
78
  handler: function handler(value) {
79
79
  onGroupChange && onGroupChange(_objectSpread(_objectSpread({}, rowGroupConfig), {}, {
80
- groupOpen: Array(rowGroupConfig.groupOpen.length).fill(value)
80
+ groupOpen: Array(rowGroupConfig === null || rowGroupConfig === void 0 ? void 0 : rowGroupConfig.groupOpen.length).fill(value),
81
+ defaultOpen: !groups.length ? value : undefined
81
82
  }));
82
83
  sheetInstance === null || sheetInstance === void 0 ? void 0 : sheetInstance.pushToHistory({
83
84
  type: 'Custom',
@@ -33,7 +33,7 @@ import { useRowSelection } from "./useRowSelection";
33
33
  import { jsx as _jsx } from "react/jsx-runtime";
34
34
  import { jsxs as _jsxs } from "react/jsx-runtime";
35
35
  var Table = function Table(_ref) {
36
- var _rowGroupConfig$group;
36
+ var _rowGroupConfig$group, _rowGroupConfig$group2;
37
37
  var sheetRef = _ref.sheetInstance,
38
38
  columns = _ref.columns,
39
39
  dataSource = _ref.dataSource,
@@ -228,10 +228,11 @@ var Table = function Table(_ref) {
228
228
  newChecked[currentRow] = !newChecked[currentRow];
229
229
  setCheckedRow(newChecked);
230
230
  }, [sheetInstance, checkedRow]);
231
- var headGroupOpen = !(rowGroupConfig !== null && rowGroupConfig !== void 0 && (_rowGroupConfig$group = rowGroupConfig.groupOpen) !== null && _rowGroupConfig$group !== void 0 && _rowGroupConfig$group.some(function (value) {
231
+ var headGroupOpen = !(rowGroupConfig !== null && rowGroupConfig !== void 0 && (_rowGroupConfig$group = rowGroupConfig.groupOpen) !== null && _rowGroupConfig$group !== void 0 && _rowGroupConfig$group.length) ? !!(rowGroupConfig !== null && rowGroupConfig !== void 0 && rowGroupConfig.defaultOpen) : !(rowGroupConfig !== null && rowGroupConfig !== void 0 && (_rowGroupConfig$group2 = rowGroupConfig.groupOpen) !== null && _rowGroupConfig$group2 !== void 0 && _rowGroupConfig$group2.some(function (value) {
232
232
  return !value;
233
233
  }));
234
234
  var headSelection = !!rowSelection;
235
+ console.log('shell-render', rowGroupConfig === null || rowGroupConfig === void 0 ? void 0 : rowGroupConfig.defaultOpen, headGroupOpen);
235
236
  var WrappedTableShell = useMemo(function () {
236
237
  console.log('shell-render', '损耗性能大');
237
238
  if (draggable) {
@@ -64,6 +64,7 @@ export declare type RowGroup = {
64
64
  groupEnd: number;
65
65
  };
66
66
  export declare type RowGroupConfig = {
67
+ defaultOpen?: boolean;
67
68
  groups: RowGroup[];
68
69
  groupOpen: boolean[];
69
70
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",