@zhenliang/sheet 0.1.10 → 0.1.13

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.
@@ -10,6 +10,7 @@ var getCascaderEditor = function getCascaderEditor(options, getCustomOptions) {
10
10
  onConfirm = props.onConfirm;
11
11
  var val = useMemo(function () {
12
12
  var res = optionsToValuesFromLabelOrValue(options, value);
13
+ console.log('cascader-editor', options, res, value);
13
14
  return res;
14
15
  }, [value, options]);
15
16
  var handleChange = function handleChange(opt) {
@@ -116,7 +116,7 @@ export var stateReducer = {
116
116
  });
117
117
  if (lastFixed) {
118
118
  var _state$data$0$indexOf, _state$data7;
119
- endCol = (_state$data$0$indexOf = (_state$data7 = state.data) === null || _state$data7 === void 0 ? void 0 : _state$data7[0].indexOf(lastFixed)) !== null && _state$data$0$indexOf !== void 0 ? _state$data$0$indexOf : 0 - 1;
119
+ endCol = ((_state$data$0$indexOf = (_state$data7 = state.data) === null || _state$data7 === void 0 ? void 0 : _state$data7[0].indexOf(lastFixed)) !== null && _state$data$0$indexOf !== void 0 ? _state$data$0$indexOf : 0) - 1;
120
120
  }
121
121
  if (startCol >= 0 && endCol >= 0) {
122
122
  return _objectSpread(_objectSpread({}, state), {}, {
@@ -70,7 +70,7 @@ var Cell = function Cell(props) {
70
70
  } else if (eventInfo.value && eventInfo.editing) {
71
71
  var _cell$dataEditor, _cell$dataEditor2, _cell$dataEditor2$par;
72
72
  // 单元格直接键盘编辑,设置为输入值
73
- setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0 ? void 0 : (_cell$dataEditor2 = cell.dataEditor) === null || _cell$dataEditor2 === void 0 ? void 0 : (_cell$dataEditor2$par = _cell$dataEditor2.parser) === null || _cell$dataEditor2$par === void 0 ? void 0 : _cell$dataEditor2$par.call(_cell$dataEditor2, eventInfo.value) : value);
73
+ setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0 ? void 0 : (_cell$dataEditor2 = cell.dataEditor) === null || _cell$dataEditor2 === void 0 ? void 0 : (_cell$dataEditor2$par = _cell$dataEditor2.parser) === null || _cell$dataEditor2$par === void 0 ? void 0 : _cell$dataEditor2$par.call(_cell$dataEditor2, eventInfo.value) : eventInfo.value);
74
74
  }
75
75
  setEventState(eventInfo);
76
76
  };
@@ -101,8 +101,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
101
101
 
102
102
 
103
103
  &.fixed-right{
104
- // transform: translateX(1px);
105
-
104
+ transform: translateX(1px);
106
105
  }
107
106
 
108
107
  &.fixed-right::after{
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SheetType } from "../../../type";
3
2
  import './index.less';
4
3
  export declare const DraggableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SheetType } from "../../type";
3
2
  import './draggableShell/index.less';
4
3
  export declare const TableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
@@ -235,7 +235,6 @@ var Table = function Table(_ref) {
235
235
  }));
236
236
  var headSelection = !!rowSelection;
237
237
  var WrappedTableShell = useMemo(function () {
238
- console.log('shell-render', '损耗性能大');
239
238
  if (draggable) {
240
239
  return DraggableShell({
241
240
  columns: columns,
@@ -28,21 +28,30 @@ export var useGroupConfig = function useGroupConfig(dataSource, tableGroupConfig
28
28
  if (!hasChildren) return;
29
29
  var rowConfig = dataSourceToRowConfig(dataSource, tableGroupConfig === null || tableGroupConfig === void 0 ? void 0 : tableGroupConfig.defaultOpen);
30
30
  if (groupConfigRef.current) {
31
- groupConfigRef.current.groups.forEach(function (_ref, index) {
32
- var _groupConfigRef$curre;
31
+ rowConfig.groups.forEach(function (_ref, index) {
32
+ var _groupConfigRef$curre, _groupConfigRef$curre2;
33
33
  var groupName = _ref.groupName;
34
- var rowIndex = rowConfig.groups.findIndex(function (item) {
34
+ var rowIndex = (_groupConfigRef$curre = (_groupConfigRef$curre2 = groupConfigRef.current) === null || _groupConfigRef$curre2 === void 0 ? void 0 : _groupConfigRef$curre2.groups.findIndex(function (item) {
35
35
  return item.groupName === groupName;
36
- });
37
- rowConfig.groupOpen[rowIndex] = ((_groupConfigRef$curre = groupConfigRef.current) === null || _groupConfigRef$curre === void 0 ? void 0 : _groupConfigRef$curre.groupOpen[index]) || rowConfig.groupOpen[rowIndex];
36
+ })) !== null && _groupConfigRef$curre !== void 0 ? _groupConfigRef$curre : -1;
37
+ if (rowIndex >= 0) {
38
+ var _groupConfigRef$curre3, _groupConfigRef$curre4, _groupConfigRef$curre5;
39
+ var hasNewLine = rowConfig.groups[rowIndex].groupEnd !== ((_groupConfigRef$curre3 = groupConfigRef.current) === null || _groupConfigRef$curre3 === void 0 ? void 0 : (_groupConfigRef$curre4 = _groupConfigRef$curre3.groups[index]) === null || _groupConfigRef$curre4 === void 0 ? void 0 : _groupConfigRef$curre4.groupEnd);
40
+ rowConfig.groupOpen[rowIndex] = hasNewLine ? true : (_groupConfigRef$curre5 = groupConfigRef.current) === null || _groupConfigRef$curre5 === void 0 ? void 0 : _groupConfigRef$curre5.groupOpen[index];
41
+ } else {
42
+ // 新子行
43
+ rowConfig.groupOpen[index] = true;
44
+ }
38
45
  });
39
46
  }
40
47
  setGroupConfig(rowConfig);
41
48
  groupConfigRef.current = rowConfig;
42
49
  }, [dataSource.length, childrenLength, hasChildren]);
43
50
  var handleGroupChange = useCallback(function (value) {
51
+ var _groupConfigRef$curre6;
44
52
  setGroupConfig(value);
45
53
  groupConfigRef.current = value;
54
+ console.log('handler', childrenLength, (_groupConfigRef$curre6 = groupConfigRef.current) === null || _groupConfigRef$curre6 === void 0 ? void 0 : _groupConfigRef$curre6.groupOpen);
46
55
  }, [setGroupConfig]);
47
56
  return [groupConfig, handleGroupChange];
48
57
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import EventEmitter from 'events';
3
2
  declare const useEventBus: () => EventEmitter;
4
3
  export { useEventBus };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",