@zhenliang/sheet 0.1.14 → 0.1.16
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/dist/core/editor/cascaderEditor/index.less +4 -4
- package/dist/core/editor/numberEditor/index.d.ts +3 -1
- package/dist/core/editor/numberEditor/index.js +2 -2
- package/dist/core/editor/selectEditor/index.less +5 -5
- package/dist/core/sheet/index.js +15 -10
- package/dist/core/sheet/index.less +17 -1
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +7 -2
- package/dist/core/sheet/useVirtualList.js +28 -7
- package/dist/core/table/index.js +5 -3
- package/dist/core/util.d.ts +2 -1
- package/dist/core/util.js +52 -3
- package/dist/type/sheetTable.d.ts +2 -1
- package/package.json +1 -1
|
@@ -2,5 +2,7 @@ import type { SheetType } from "../../../type";
|
|
|
2
2
|
import { InputNumberProps } from 'antd';
|
|
3
3
|
import 'antd/es/input-number/style/index.css';
|
|
4
4
|
import './index.less';
|
|
5
|
+
declare type inputProps = Partial<Pick<InputNumberProps, 'max' | 'min' | 'addonBefore' | 'addonAfter' | 'precision'>>;
|
|
5
6
|
export declare const NumberEditor: SheetType.CellEditor;
|
|
6
|
-
export declare const getNumberEditor: (extraProps?:
|
|
7
|
+
export declare const getNumberEditor: (extraProps?: inputProps, getExtraProps?: ((props: SheetType.CellEditorProps) => inputProps) | undefined) => SheetType.CellEditor;
|
|
8
|
+
export {};
|
|
@@ -34,7 +34,7 @@ export var NumberEditor = function NumberEditor(props) {
|
|
|
34
34
|
onChange: onChange
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
export var getNumberEditor = function getNumberEditor(extraProps) {
|
|
37
|
+
export var getNumberEditor = function getNumberEditor(extraProps, getExtraProps) {
|
|
38
38
|
var NumberEditor = function NumberEditor(props) {
|
|
39
39
|
var value = props.value,
|
|
40
40
|
onChange = props.onChange;
|
|
@@ -43,7 +43,7 @@ export var getNumberEditor = function getNumberEditor(extraProps) {
|
|
|
43
43
|
var _inputNumberRef$curre2;
|
|
44
44
|
inputNumberRef === null || inputNumberRef === void 0 ? void 0 : (_inputNumberRef$curre2 = inputNumberRef.current) === null || _inputNumberRef$curre2 === void 0 ? void 0 : _inputNumberRef$curre2.focus();
|
|
45
45
|
}, []);
|
|
46
|
-
var _ref = extraProps
|
|
46
|
+
var _ref = getExtraProps ? getExtraProps(props) : extraProps !== null && extraProps !== void 0 ? extraProps : {},
|
|
47
47
|
precision = _ref.precision,
|
|
48
48
|
inputArgs = _objectWithoutProperties(_ref, _excluded);
|
|
49
49
|
var valueFormatter = useCallback(function (value) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
.select-editor
|
|
1
|
+
.select-editor {
|
|
2
2
|
// select style
|
|
3
3
|
width: 100%;
|
|
4
4
|
line-height: 20px;
|
|
5
5
|
height: 20px;
|
|
6
6
|
|
|
7
7
|
.ant-select-selector {
|
|
8
|
+
width: 100%;
|
|
8
9
|
border: none !important;
|
|
9
10
|
background: transparent !important;
|
|
10
11
|
box-shadow: none !important;
|
|
@@ -36,8 +37,7 @@
|
|
|
36
37
|
box-shadow: inset 0 -100px 0 rgba(33,133,208,15%);
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
.ant-select-item {
|
|
41
|
+
font-size: 12px !important;
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
.ant-select-item {
|
|
42
|
-
font-size: 12px !important;
|
|
43
|
-
}
|
package/dist/core/sheet/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { useEffect, useMemo, useRef } from 'react';
|
|
|
15
15
|
import ReduxThunk from 'redux-thunk';
|
|
16
16
|
import DefaultRow from "./DefaultRow";
|
|
17
17
|
import DefaultShell from "./DefaultShell";
|
|
18
|
-
import {
|
|
18
|
+
import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
|
|
19
19
|
import { isNil, isNumber } from 'lodash';
|
|
20
20
|
import { SheetEventContext, useEventBus, useMiddlewareReducer } from "../../hooks";
|
|
21
21
|
import sheetReducer from "../reducers";
|
|
@@ -186,7 +186,10 @@ var Sheet = function Sheet(props) {
|
|
|
186
186
|
});
|
|
187
187
|
}, [state.data, groupConfig, virtualStart, virtualEnd, rowClassName]);
|
|
188
188
|
var memoHeight = Math.min(((_state$data$length = state === null || state === void 0 ? void 0 : (_state$data3 = state.data) === null || _state$data3 === void 0 ? void 0 : _state$data3.length) !== null && _state$data$length !== void 0 ? _state$data$length : 0) + 1, 10) * 42 + 43;
|
|
189
|
-
var
|
|
189
|
+
var _useSelectVisible = useSelectVisible(sheetWrapperRef, state.start),
|
|
190
|
+
_useSelectVisible2 = _slicedToArray(_useSelectVisible, 2),
|
|
191
|
+
startRowVisible = _useSelectVisible2[0],
|
|
192
|
+
direction = _useSelectVisible2[1];
|
|
190
193
|
return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
|
|
191
194
|
value: eventBus,
|
|
192
195
|
children: /*#__PURE__*/_jsxs("span", {
|
|
@@ -199,7 +202,7 @@ var Sheet = function Sheet(props) {
|
|
|
199
202
|
},
|
|
200
203
|
children: [/*#__PURE__*/_jsxs(SheetShell, {
|
|
201
204
|
className: classNames('harvest-sheet', className),
|
|
202
|
-
children: [virtualized && /*#__PURE__*/_jsx("tr", {
|
|
205
|
+
children: [virtualized && paddingTop > 0 && /*#__PURE__*/_jsx("tr", {
|
|
203
206
|
style: {
|
|
204
207
|
height: 0,
|
|
205
208
|
paddingBottom: paddingTop,
|
|
@@ -224,20 +227,22 @@ var Sheet = function Sheet(props) {
|
|
|
224
227
|
})
|
|
225
228
|
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
226
229
|
className: "harvest-sheet-control",
|
|
227
|
-
children: [children, showBackEdit && !startRowVisible ? /*#__PURE__*/
|
|
228
|
-
|
|
230
|
+
children: [children, showBackEdit && !startRowVisible ? /*#__PURE__*/_jsxs("div", {
|
|
231
|
+
className: "back-edit",
|
|
229
232
|
onClick: function onClick() {
|
|
230
233
|
var _sheetInstance$curren;
|
|
231
234
|
return sheetInstance === null || sheetInstance === void 0 ? void 0 : (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 ? void 0 : _sheetInstance$curren.zoomTo();
|
|
232
235
|
},
|
|
233
|
-
style: _objectSpread({
|
|
234
|
-
position: 'absolute',
|
|
235
|
-
zIndex: 4
|
|
236
|
-
}, !backEditStyle ? {
|
|
236
|
+
style: _objectSpread({}, !backEditStyle ? {
|
|
237
237
|
top: 0,
|
|
238
238
|
right: 0
|
|
239
239
|
} : backEditStyle),
|
|
240
|
-
children: "
|
|
240
|
+
children: [direction === 'up' ? /*#__PURE__*/_jsx(ArrowUpOutlined, {}) : /*#__PURE__*/_jsx(ArrowDownOutlined, {}), /*#__PURE__*/_jsx("span", {
|
|
241
|
+
style: {
|
|
242
|
+
marginLeft: 0
|
|
243
|
+
},
|
|
244
|
+
children: "\u8FD4\u56DE\u7F16\u8F91\u884C"
|
|
245
|
+
})]
|
|
241
246
|
}) : null]
|
|
242
247
|
})]
|
|
243
248
|
})
|
|
@@ -138,18 +138,22 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
138
138
|
|
|
139
139
|
.harvest-sheet-container .harvest-sheet .cell.selected-top{
|
|
140
140
|
border-top-color: var(--resizer);
|
|
141
|
+
border-top-width: 1px;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
.harvest-sheet-container .harvest-sheet .cell.selected-left{
|
|
144
145
|
border-left-color: var(--resizer);
|
|
145
|
-
|
|
146
|
+
border-left-width:1px;
|
|
147
|
+
}
|
|
146
148
|
|
|
147
149
|
.harvest-sheet-container .harvest-sheet .cell.selected-bottom{
|
|
148
150
|
border-bottom-color: var(--resizer);
|
|
151
|
+
border-bottom-width:1px;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
.harvest-sheet-container .harvest-sheet .cell.selected-right{
|
|
152
155
|
border-right-color: var(--resizer);
|
|
156
|
+
border-right-width:1px;
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
|
|
@@ -168,6 +172,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
168
172
|
background: var(--cell-read-only-background-color);
|
|
169
173
|
color: var(--read-color);
|
|
170
174
|
text-align: center;
|
|
175
|
+
cursor: not-allowed;
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
|
|
@@ -284,4 +289,15 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
284
289
|
bottom: 0;
|
|
285
290
|
left: 0;
|
|
286
291
|
background-color: white;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.harvest-sheet-container .harvest-sheet-control .back-edit{
|
|
295
|
+
padding: 5px 8px;
|
|
296
|
+
display: flex;
|
|
297
|
+
width: 105px;
|
|
298
|
+
cursor: pointer;
|
|
299
|
+
align-items: center;
|
|
300
|
+
justify-content: center;
|
|
301
|
+
position: absolute;
|
|
302
|
+
z-index: 4,
|
|
287
303
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SheetType } from "../../type";
|
|
2
|
-
export declare const useSelectVisible: (sheetWrapper: React.RefObject<SheetType.refAssertion>, start?: SheetType.CellPosition) => boolean;
|
|
2
|
+
export declare const useSelectVisible: (sheetWrapper: React.RefObject<SheetType.refAssertion>, start?: SheetType.CellPosition) => [boolean, 'up' | 'down'];
|
|
@@ -11,6 +11,10 @@ export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
|
|
|
11
11
|
_useState2 = _slicedToArray(_useState, 2),
|
|
12
12
|
startVisible = _useState2[0],
|
|
13
13
|
setStartVisible = _useState2[1];
|
|
14
|
+
var _useState3 = useState('up'),
|
|
15
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
16
|
+
backDirection = _useState4[0],
|
|
17
|
+
setBackDirection = _useState4[1];
|
|
14
18
|
useEffect(function () {
|
|
15
19
|
var _sheetWrapper$current3;
|
|
16
20
|
var handleScroll = throttle(function () {
|
|
@@ -32,6 +36,7 @@ export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
|
|
|
32
36
|
setStartVisible(true);
|
|
33
37
|
} else {
|
|
34
38
|
setStartVisible(false);
|
|
39
|
+
setBackDirection(top < cellTop ? 'down' : 'up');
|
|
35
40
|
}
|
|
36
41
|
}, 100);
|
|
37
42
|
handleScroll();
|
|
@@ -42,7 +47,7 @@ export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
|
|
|
42
47
|
};
|
|
43
48
|
}, [sheetWrapper.current, start]);
|
|
44
49
|
if (!start) {
|
|
45
|
-
return true;
|
|
50
|
+
return [true, 'up'];
|
|
46
51
|
}
|
|
47
|
-
return startVisible;
|
|
52
|
+
return [startVisible, backDirection];
|
|
48
53
|
};
|
|
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { isEqual, throttle } from 'lodash';
|
|
8
8
|
import { useEffect, useRef, useState } from 'react';
|
|
9
|
-
import { getRowHeight, rowToActualRow } from "../util";
|
|
9
|
+
import { getRowHeight, rowToActualRow, rowToCountRow } from "../util";
|
|
10
10
|
var extra = 20;
|
|
11
11
|
// 虚拟列表
|
|
12
12
|
export var useVirtualList = function useVirtualList(elementRef) {
|
|
@@ -43,18 +43,39 @@ export var useVirtualList = function useVirtualList(elementRef) {
|
|
|
43
43
|
clientHeight = _ref.clientHeight;
|
|
44
44
|
var start = Math.floor(scrollTop / itemHeight) - extra;
|
|
45
45
|
var end = Math.ceil((scrollTop + clientHeight) / itemHeight) + extra;
|
|
46
|
+
if (!groupConfigRef.current) {
|
|
47
|
+
var newConfig = {
|
|
48
|
+
virtualStart: start,
|
|
49
|
+
virtualEnd: end,
|
|
50
|
+
paddingTop: start * itemHeight,
|
|
51
|
+
paddingBottom: (data.length - end) * itemHeight
|
|
52
|
+
};
|
|
53
|
+
if (isEqual(newConfig, virtualRef.current)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
virtualRef.current = newConfig;
|
|
57
|
+
setState(newConfig);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
46
60
|
|
|
47
61
|
// todo 加入分组之后的 虚拟列表计算
|
|
48
|
-
var actualStart =
|
|
49
|
-
var actualEnd =
|
|
62
|
+
var actualStart = rowToCountRow(start, groupConfigRef.current, data.length);
|
|
63
|
+
var actualEnd = rowToCountRow(end, groupConfigRef.current, data.length);
|
|
64
|
+
var maxEnd = rowToActualRow(data.length, groupConfigRef.current);
|
|
65
|
+
var invisibleTop = rowToActualRow(actualStart, groupConfigRef.current);
|
|
66
|
+
var invisibleBottom = maxEnd > end ? maxEnd - end : 0;
|
|
67
|
+
console.log('visiable-count', start, end, maxEnd);
|
|
68
|
+
console.log('visible-toactual-count', actualStart, actualEnd);
|
|
69
|
+
console.log('invisible', invisibleTop, invisibleBottom);
|
|
50
70
|
|
|
51
71
|
// const minStart = start - (actualStart - start)
|
|
52
|
-
|
|
72
|
+
// const maxEnd = end - (actualEnd - end);
|
|
73
|
+
|
|
53
74
|
var updateVirtualConfig = {
|
|
54
75
|
virtualStart: actualStart,
|
|
55
|
-
virtualEnd:
|
|
56
|
-
paddingTop:
|
|
57
|
-
paddingBottom:
|
|
76
|
+
virtualEnd: actualEnd,
|
|
77
|
+
paddingTop: invisibleTop * itemHeight,
|
|
78
|
+
paddingBottom: invisibleBottom * itemHeight
|
|
58
79
|
};
|
|
59
80
|
if (isEqual(updateVirtualConfig, virtualRef.current)) {
|
|
60
81
|
return;
|
package/dist/core/table/index.js
CHANGED
|
@@ -122,10 +122,10 @@ var Table = function Table(_ref) {
|
|
|
122
122
|
id: rowId,
|
|
123
123
|
value: value,
|
|
124
124
|
record: itemRow,
|
|
125
|
-
readonly: !(colInfo.readonly instanceof Function) ? colInfo.readonly : colInfo.readonly(value, itemRow, currentIndex),
|
|
125
|
+
readonly: !(colInfo.readonly instanceof Function) ? colInfo.readonly : colInfo.readonly(value, itemRow, currentIndex, col),
|
|
126
126
|
align: colInfo.align,
|
|
127
127
|
fixed: colInfo.fixed,
|
|
128
|
-
editable: !(colInfo.editable instanceof Function) ? colInfo.editable : colInfo.editable(value, itemRow, currentIndex),
|
|
128
|
+
editable: !(colInfo.editable instanceof Function) ? colInfo.editable : colInfo.editable(value, itemRow, currentIndex, col),
|
|
129
129
|
valueViewer: colInfo.render ? colInfo.render : undefined,
|
|
130
130
|
dataEditor: colInfo.editor ? colInfo.editor : undefined,
|
|
131
131
|
row: currentIndex,
|
|
@@ -171,7 +171,7 @@ var Table = function Table(_ref) {
|
|
|
171
171
|
id: rowId,
|
|
172
172
|
value: value,
|
|
173
173
|
record: item,
|
|
174
|
-
readonly: !(colInfo.readonly instanceof Function) ? colInfo.readonly : colInfo.readonly(value, item, row),
|
|
174
|
+
readonly: !(colInfo.readonly instanceof Function) ? colInfo.readonly : colInfo.readonly(value, item, row, col),
|
|
175
175
|
align: colInfo.align,
|
|
176
176
|
fixed: colInfo.fixed,
|
|
177
177
|
editable: !(colInfo.editable instanceof Function) ? colInfo.editable : colInfo.editable(value, item, row),
|
|
@@ -193,6 +193,7 @@ var Table = function Table(_ref) {
|
|
|
193
193
|
var handleChanges = useCallback(function (changes, extChange) {
|
|
194
194
|
onChange && onChange(changes.map(function (item) {
|
|
195
195
|
return {
|
|
196
|
+
col: item.col,
|
|
196
197
|
row: item.row,
|
|
197
198
|
id: item.id,
|
|
198
199
|
key: columns[hasControl ? item.col - 1 : item.col].dataIndex,
|
|
@@ -200,6 +201,7 @@ var Table = function Table(_ref) {
|
|
|
200
201
|
};
|
|
201
202
|
}), extChange === null || extChange === void 0 ? void 0 : extChange.map(function (item) {
|
|
202
203
|
return {
|
|
204
|
+
col: item.col,
|
|
203
205
|
row: item.row,
|
|
204
206
|
id: item.id,
|
|
205
207
|
key: columns[hasControl ? item.col - 1 : item.col].dataIndex,
|
package/dist/core/util.d.ts
CHANGED
|
@@ -41,7 +41,8 @@ export declare const changeGroupConfig: (rowGroupConfig: SheetType.RowGroupConfi
|
|
|
41
41
|
add?: number | undefined;
|
|
42
42
|
remove?: number | undefined;
|
|
43
43
|
}) => SheetType.RowGroupConfig;
|
|
44
|
-
export declare const rowToActualRow: (row: number, groupConfig?: SheetType.RowGroupConfig) => number;
|
|
44
|
+
export declare const rowToActualRow: (row: number, groupConfig?: SheetType.RowGroupConfig, max?: number) => number;
|
|
45
|
+
export declare const rowToCountRow: (row: number, groupConfig: SheetType.RowGroupConfig, max: number) => number;
|
|
45
46
|
export declare const getRowHeight: (container: HTMLSpanElement) => number;
|
|
46
47
|
export declare const getNextVisibleRow: (row: number, maxRow: number, groupMap?: Map<number, SheetType.RowGroup & {
|
|
47
48
|
isStart: boolean;
|
package/dist/core/util.js
CHANGED
|
@@ -387,8 +387,23 @@ export var changeGroupConfig = function changeGroupConfig(rowGroupConfig, change
|
|
|
387
387
|
});
|
|
388
388
|
};
|
|
389
389
|
export var rowToActualRow = function rowToActualRow(row, groupConfig) {
|
|
390
|
+
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
|
|
390
391
|
var groupMap = groupConfigToGroupMap(groupConfig);
|
|
391
|
-
if (!groupMap.size) return row;
|
|
392
|
+
if (!groupMap.size || row < 0) return row;
|
|
393
|
+
var openCount = 0;
|
|
394
|
+
for (var i = 0; i < max; i++) {
|
|
395
|
+
var _groupMap$get9, _groupMap$get10;
|
|
396
|
+
if (groupMap.has(i) && !((_groupMap$get9 = groupMap.get(i)) !== null && _groupMap$get9 !== void 0 && _groupMap$get9.isOpen) && !((_groupMap$get10 = groupMap.get(i)) !== null && _groupMap$get10 !== void 0 && _groupMap$get10.isStart)) {
|
|
397
|
+
continue;
|
|
398
|
+
} else {
|
|
399
|
+
openCount++;
|
|
400
|
+
if (i >= row) {
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return openCount;
|
|
406
|
+
// 减法的做法 有bug
|
|
392
407
|
groupMap.forEach(function (item, index) {
|
|
393
408
|
if (index <= row && !(item !== null && item !== void 0 && item.isOpen) && !(item !== null && item !== void 0 && item.isStart)) {
|
|
394
409
|
row--;
|
|
@@ -396,13 +411,47 @@ export var rowToActualRow = function rowToActualRow(row, groupConfig) {
|
|
|
396
411
|
});
|
|
397
412
|
return row;
|
|
398
413
|
};
|
|
414
|
+
export var rowToCountRow = function rowToCountRow(row, groupConfig, max) {
|
|
415
|
+
var groupMap = groupConfigToGroupMap(groupConfig);
|
|
416
|
+
if (!groupMap.size || row < 0) return row;
|
|
417
|
+
|
|
418
|
+
// 加法的做法
|
|
419
|
+
var maxCount = 0;
|
|
420
|
+
var maxIndex = max;
|
|
421
|
+
for (var i = 0; i < max; i++) {
|
|
422
|
+
var _groupMap$get11, _groupMap$get12;
|
|
423
|
+
if (groupMap.has(i) && !((_groupMap$get11 = groupMap.get(i)) !== null && _groupMap$get11 !== void 0 && _groupMap$get11.isOpen) && !((_groupMap$get12 = groupMap.get(i)) !== null && _groupMap$get12 !== void 0 && _groupMap$get12.isStart)) {
|
|
424
|
+
continue;
|
|
425
|
+
} else {
|
|
426
|
+
maxCount++;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (row >= maxCount) {
|
|
430
|
+
return maxIndex;
|
|
431
|
+
}
|
|
432
|
+
maxIndex = 0;
|
|
433
|
+
var openCount = 0;
|
|
434
|
+
for (var _i2 = 0; _i2 < max; _i2++) {
|
|
435
|
+
var _groupMap$get13, _groupMap$get14;
|
|
436
|
+
if (groupMap.has(_i2) && !((_groupMap$get13 = groupMap.get(_i2)) !== null && _groupMap$get13 !== void 0 && _groupMap$get13.isOpen) && !((_groupMap$get14 = groupMap.get(_i2)) !== null && _groupMap$get14 !== void 0 && _groupMap$get14.isStart)) {
|
|
437
|
+
continue;
|
|
438
|
+
} else {
|
|
439
|
+
openCount++;
|
|
440
|
+
if (openCount >= row) {
|
|
441
|
+
maxIndex = _i2;
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return maxIndex;
|
|
447
|
+
};
|
|
399
448
|
export var getRowHeight = function getRowHeight(container) {
|
|
400
449
|
var _container$getElement, _container$getElement2;
|
|
401
450
|
var h = ((_container$getElement = container.getElementsByTagName('td')[0]) === null || _container$getElement === void 0 ? void 0 : (_container$getElement2 = _container$getElement.parentNode) === null || _container$getElement2 === void 0 ? void 0 : _container$getElement2.clientHeight) || 30;
|
|
402
451
|
return h;
|
|
403
452
|
};
|
|
404
453
|
export var getNextVisibleRow = function getNextVisibleRow(row, maxRow, groupMap) {
|
|
405
|
-
var _groupMap$
|
|
454
|
+
var _groupMap$get15, _groupMap$get16;
|
|
406
455
|
var up = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
407
456
|
if (!(groupMap !== null && groupMap !== void 0 && groupMap.size)) {
|
|
408
457
|
return row;
|
|
@@ -410,7 +459,7 @@ export var getNextVisibleRow = function getNextVisibleRow(row, maxRow, groupMap)
|
|
|
410
459
|
if (row > maxRow) {
|
|
411
460
|
return null;
|
|
412
461
|
}
|
|
413
|
-
if (groupMap.get(row) && !((_groupMap$
|
|
462
|
+
if (groupMap.get(row) && !((_groupMap$get15 = groupMap.get(row)) !== null && _groupMap$get15 !== void 0 && _groupMap$get15.isOpen) && !((_groupMap$get16 = groupMap.get(row)) !== null && _groupMap$get16 !== void 0 && _groupMap$get16.isStart)) {
|
|
414
463
|
return getNextVisibleRow(row + up, maxRow, groupMap);
|
|
415
464
|
}
|
|
416
465
|
return row;
|
|
@@ -5,7 +5,7 @@ export declare type refAssertion = {
|
|
|
5
5
|
focus?: () => boolean;
|
|
6
6
|
} & HTMLTableSectionElement;
|
|
7
7
|
export declare type CellFixed = SheetType.CellAlign;
|
|
8
|
-
export declare type RecordRowMap<T> = (value: unknown, record: Record<string, unknown>, index: number) => T;
|
|
8
|
+
export declare type RecordRowMap<T> = (value: unknown, record: Record<string, unknown>, index: number, colIndex?: number) => T;
|
|
9
9
|
export declare type ColumnProps = {
|
|
10
10
|
/**
|
|
11
11
|
* @description 对齐
|
|
@@ -38,6 +38,7 @@ export declare type ColumnProps = {
|
|
|
38
38
|
editor?: SheetType.CellEditor;
|
|
39
39
|
};
|
|
40
40
|
export declare type TableChange = {
|
|
41
|
+
col?: number;
|
|
41
42
|
row: number;
|
|
42
43
|
id: string;
|
|
43
44
|
key: string;
|