@zhenliang/sheet 0.1.4 → 0.1.7-3.beta.0
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/assets/arrow-mac-down.svg +19 -0
- package/dist/assets/arrow-mac-right.svg +17 -0
- package/dist/assets/arrow-windows-down.svg +17 -0
- package/dist/assets/arrow-windows-right.svg +17 -0
- package/dist/core/config.d.ts +3 -0
- package/dist/core/config.js +4 -1
- package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
- package/dist/core/editor/cascaderEditor/index.js +12 -11
- package/dist/core/editor/cascaderEditor/index.less +15 -7
- package/dist/core/editor/dateEditor/index.js +31 -8
- package/dist/core/editor/dateEditor/index.less +9 -2
- package/dist/core/editor/numberEditor/index.d.ts +3 -1
- package/dist/core/editor/numberEditor/index.js +62 -27
- package/dist/core/editor/numberEditor/index.less +3 -2
- package/dist/core/editor/selectEditor/index.d.ts +1 -1
- package/dist/core/editor/selectEditor/index.js +34 -19
- package/dist/core/editor/selectEditor/index.less +16 -5
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/index.js +8 -1
- package/dist/core/reducers/keyboardReducer.js +39 -9
- package/dist/core/reducers/mouseReducer.js +115 -11
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +146 -41
- package/dist/core/reducers/stateReducer.d.ts +1 -0
- package/dist/core/reducers/stateReducer.js +96 -27
- package/dist/core/sheet/Cell.d.ts +1 -1
- package/dist/core/sheet/Cell.js +33 -24
- package/dist/core/sheet/Control.d.ts +21 -0
- package/dist/core/sheet/Control.js +83 -0
- package/dist/core/sheet/DataEditor.js +3 -3
- package/dist/core/sheet/DefaultCell.d.ts +8 -3
- package/dist/core/sheet/DefaultCell.js +12 -8
- package/dist/core/sheet/DefaultRow.js +3 -9
- package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
- package/dist/core/sheet/DefaultRowMapper.js +22 -6
- package/dist/core/sheet/DefaultShell.js +1 -1
- package/dist/core/sheet/Event.d.ts +1 -1
- package/dist/core/sheet/Event.js +1 -1
- package/dist/core/sheet/Menu.d.ts +6 -0
- package/dist/core/sheet/Menu.js +21 -0
- package/dist/core/sheet/ValueViewer.js +1 -1
- package/dist/core/sheet/index.js +249 -88
- package/dist/core/sheet/index.less +199 -107
- package/dist/core/sheet/searchInput.d.ts +15 -0
- package/dist/core/sheet/searchInput.js +78 -0
- package/dist/core/sheet/useCellEvent.js +1 -1
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +13 -10
- package/dist/core/sheet/useKeyBoardEvent.js +19 -2
- package/dist/core/sheet/useMouseEvent.js +19 -12
- package/dist/core/sheet/useSearchInput.d.ts +11 -0
- package/dist/core/sheet/useSearchInput.js +65 -0
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +17 -7
- package/dist/core/sheet/useVirtualList.d.ts +10 -1
- package/dist/core/sheet/useVirtualList.js +44 -28
- package/dist/core/sheet/var.less +41 -34
- package/dist/core/shell/draggableShell/index.d.ts +4 -1
- package/dist/core/shell/draggableShell/index.js +133 -50
- package/dist/core/shell/tableShell.d.ts +4 -1
- package/dist/core/shell/tableShell.js +82 -34
- package/dist/core/table/addButton.d.ts +6 -0
- package/dist/core/table/addButton.js +103 -0
- package/dist/core/table/events.d.ts +1 -3
- package/dist/core/table/events.js +30 -35
- package/dist/core/table/index.js +97 -189
- package/dist/core/table/index.less +12 -0
- package/dist/core/table/useGroupConfig.d.ts +4 -1
- package/dist/core/table/useGroupConfig.js +139 -14
- package/dist/core/table/useRowSelection.d.ts +3 -0
- package/dist/core/table/useRowSelection.js +68 -2
- package/dist/core/util.d.ts +10 -4
- package/dist/core/util.js +121 -69
- package/dist/core/viewer/btnViewer/index.js +3 -3
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/checkViewer/index.js +2 -2
- package/dist/core/viewer/editViewer/index.js +3 -3
- package/dist/core/viewer/groupViewer/index.js +26 -10
- package/dist/core/viewer/selectorViewer/index.js +7 -3
- package/dist/core/viewer/switchViewer/index.js +10 -4
- package/dist/example/antComponent.d.ts +1 -1
- package/dist/example/antComponent.js +63 -37
- package/dist/example/basic.d.ts +1 -1
- package/dist/example/basic.js +20 -14
- package/dist/example/ellipsis.d.ts +1 -1
- package/dist/example/ellipsis.js +3 -2
- package/dist/example/fixed.d.ts +1 -1
- package/dist/example/fixed.js +3 -2
- package/dist/example/group.js +40 -17
- package/dist/example/selection.d.ts +1 -1
- package/dist/example/selection.js +9 -8
- package/dist/example/sheet.d.ts +1 -1
- package/dist/example/sheet.js +21 -22
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +3 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useEventBus.d.ts +1 -0
- package/dist/hooks/useEventBus.js +2 -2
- package/dist/hooks/useGroupConfig.d.ts +4 -0
- package/dist/hooks/useGroupConfig.js +5 -0
- package/dist/hooks/useKeyboard.d.ts +5 -2
- package/dist/hooks/useKeyboard.js +17 -3
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +3 -3
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +7 -7
- package/dist/hooks/useSetState.js +7 -7
- package/dist/hooks/useSheetEvent.d.ts +1 -1
- package/dist/hooks/useSheetEvent.js +2 -2
- package/dist/hooks/useWidthConfig.d.ts +3 -3
- package/dist/hooks/useWidthConfig.js +2 -2
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +77 -31
- package/dist/type/sheetTable.d.ts +21 -12
- package/package.json +7 -4
package/dist/core/sheet/Cell.js
CHANGED
|
@@ -2,34 +2,20 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
2
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { isNil } from 'lodash';
|
|
8
|
-
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from
|
|
8
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from "../../../node_modules/@types/react";
|
|
9
9
|
import { useSetState, useSheetEvent } from "../../hooks";
|
|
10
10
|
import { renderValue } from "../util";
|
|
11
11
|
import DataEditor from "./DataEditor";
|
|
12
12
|
import DefaultCell from "./DefaultCell";
|
|
13
13
|
import ValueViewer from "./ValueViewer";
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
15
15
|
function initialData(_ref) {
|
|
16
16
|
var cell = _ref.cell;
|
|
17
17
|
return renderValue(cell);
|
|
18
18
|
}
|
|
19
|
-
function widthStyle(cell) {
|
|
20
|
-
var width = typeof (cell === null || cell === void 0 ? void 0 : cell.width) === 'number' ? "".concat(cell.width, "px") : cell.width;
|
|
21
|
-
var align = cell.align || 'left';
|
|
22
|
-
var position = cell.fixed ? 'sticky' : 'unset';
|
|
23
|
-
var left = cell.fixed === 'left' ? 0 : 'unset';
|
|
24
|
-
var right = cell.fixed === 'right' ? 0 : 'unset';
|
|
25
|
-
return {
|
|
26
|
-
width: width,
|
|
27
|
-
textAlign: align,
|
|
28
|
-
position: position,
|
|
29
|
-
left: left,
|
|
30
|
-
right: right
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
19
|
var Cell = function Cell(props) {
|
|
34
20
|
var _cell$editable;
|
|
35
21
|
var row = props.row,
|
|
@@ -39,7 +25,8 @@ var Cell = function Cell(props) {
|
|
|
39
25
|
CellRenderer = _props$cellRenderer === void 0 ? DefaultCell : _props$cellRenderer,
|
|
40
26
|
dataEditor = props.dataEditor,
|
|
41
27
|
valueViewer = props.valueViewer,
|
|
42
|
-
attributesRenderer = props.attributesRenderer
|
|
28
|
+
attributesRenderer = props.attributesRenderer,
|
|
29
|
+
cellFixedInfo = props.cellFixedInfo;
|
|
43
30
|
var eventBus = useSheetEvent();
|
|
44
31
|
var _useSetState = useSetState(),
|
|
45
32
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
@@ -70,7 +57,7 @@ var Cell = function Cell(props) {
|
|
|
70
57
|
} else if (eventInfo.value && eventInfo.editing) {
|
|
71
58
|
var _cell$dataEditor, _cell$dataEditor2, _cell$dataEditor2$par;
|
|
72
59
|
// 单元格直接键盘编辑,设置为输入值
|
|
73
|
-
setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0
|
|
60
|
+
setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0 || (_cell$dataEditor2 = cell.dataEditor) === null || _cell$dataEditor2 === void 0 || (_cell$dataEditor2$par = _cell$dataEditor2.parser) === null || _cell$dataEditor2$par === void 0 ? void 0 : _cell$dataEditor2$par.call(_cell$dataEditor2, eventInfo.value, cell.record) : eventInfo.value);
|
|
74
61
|
}
|
|
75
62
|
setEventState(eventInfo);
|
|
76
63
|
};
|
|
@@ -101,7 +88,8 @@ var Cell = function Cell(props) {
|
|
|
101
88
|
row: row,
|
|
102
89
|
col: col,
|
|
103
90
|
id: cell.id,
|
|
104
|
-
value: value
|
|
91
|
+
value: value,
|
|
92
|
+
key: cell.dataIndex
|
|
105
93
|
// 没必要format value 已经是legal 的值了
|
|
106
94
|
// value: cell.dataEditor?.formatter
|
|
107
95
|
// ? cell.dataEditor.formatter?.(value)
|
|
@@ -115,7 +103,7 @@ var Cell = function Cell(props) {
|
|
|
115
103
|
if (valueRef.current === value) {
|
|
116
104
|
return;
|
|
117
105
|
}
|
|
118
|
-
if (cell !== null && cell !== void 0 && (_cell$dataEditor5 = cell.dataEditor) !== null && _cell$dataEditor5 !== void 0 && _cell$dataEditor5.checker && !((_cell$dataEditor6 = cell.dataEditor) !== null && _cell$dataEditor6 !== void 0 && (_cell$dataEditor6$che = _cell$dataEditor6.checker) !== null && _cell$dataEditor6$che !== void 0 && _cell$dataEditor6$che.call(_cell$dataEditor6, value, cell.record))) {
|
|
106
|
+
if (value !== null && cell !== null && cell !== void 0 && (_cell$dataEditor5 = cell.dataEditor) !== null && _cell$dataEditor5 !== void 0 && _cell$dataEditor5.checker && !((_cell$dataEditor6 = cell.dataEditor) !== null && _cell$dataEditor6 !== void 0 && (_cell$dataEditor6$che = _cell$dataEditor6.checker) !== null && _cell$dataEditor6$che !== void 0 && _cell$dataEditor6$che.call(_cell$dataEditor6, value, cell.record))) {
|
|
119
107
|
setValue(valueRef.current);
|
|
120
108
|
return;
|
|
121
109
|
}
|
|
@@ -125,6 +113,7 @@ var Cell = function Cell(props) {
|
|
|
125
113
|
col: col,
|
|
126
114
|
id: cell.id,
|
|
127
115
|
value: value,
|
|
116
|
+
key: cell.dataIndex,
|
|
128
117
|
confirm: true
|
|
129
118
|
});
|
|
130
119
|
}, [eventBus, valueRef, cell]);
|
|
@@ -163,6 +152,22 @@ var Cell = function Cell(props) {
|
|
|
163
152
|
return a;
|
|
164
153
|
}).join(' ');
|
|
165
154
|
}, [editing, selected, selectedInfo, cell.className, cell.readonly]);
|
|
155
|
+
var widthStyle = useMemo(function () {
|
|
156
|
+
var _cellFixedInfo$fixPos, _cellFixedInfo$fixPos2;
|
|
157
|
+
var width = typeof (cell === null || cell === void 0 ? void 0 : cell.width) === 'number' ? "".concat(cell.width, "px") : cell.width;
|
|
158
|
+
var align = cell.align || 'left';
|
|
159
|
+
var position = cell.fixed ? 'sticky' : 'unset';
|
|
160
|
+
var left = cell.fixed === 'left' ? (_cellFixedInfo$fixPos = cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.fixPosition) !== null && _cellFixedInfo$fixPos !== void 0 ? _cellFixedInfo$fixPos : 0 : 'unset';
|
|
161
|
+
var right = cell.fixed === 'right' ? (_cellFixedInfo$fixPos2 = cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.fixPosition) !== null && _cellFixedInfo$fixPos2 !== void 0 ? _cellFixedInfo$fixPos2 : 0 : 'unset';
|
|
162
|
+
var obj = {
|
|
163
|
+
width: width,
|
|
164
|
+
textAlign: align,
|
|
165
|
+
position: position,
|
|
166
|
+
left: left,
|
|
167
|
+
right: right
|
|
168
|
+
};
|
|
169
|
+
return obj;
|
|
170
|
+
}, [cellFixedInfo, cell]);
|
|
166
171
|
return /*#__PURE__*/_jsx(CellRenderer, {
|
|
167
172
|
row: row,
|
|
168
173
|
col: col,
|
|
@@ -171,11 +176,15 @@ var Cell = function Cell(props) {
|
|
|
171
176
|
editing: eventState.editing,
|
|
172
177
|
attributesRenderer: attributesRenderer,
|
|
173
178
|
className: className,
|
|
174
|
-
style: widthStyle
|
|
179
|
+
style: widthStyle,
|
|
180
|
+
isFirstFixedRight: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isFirstFixedRight,
|
|
181
|
+
isLastFixedLeft: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isLastFixedLeft,
|
|
182
|
+
isScrolledOver: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isScrolledOver,
|
|
183
|
+
isScrolledToEnd: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isScrolledToEnd,
|
|
175
184
|
children: content
|
|
176
185
|
});
|
|
177
186
|
};
|
|
178
|
-
export default
|
|
179
|
-
var shouldUpdate = pre.col === next.col && pre.row === next.row && pre.cell.value === next.cell.value && pre.cell.dataEditor === next.cell.dataEditor && pre.cell.record === next.cell.record;
|
|
187
|
+
export default memo(Cell, function (pre, next) {
|
|
188
|
+
var shouldUpdate = pre.col === next.col && pre.row === next.row && pre.cell.value === next.cell.value && pre.cell.dataEditor === next.cell.dataEditor && pre.cell.className === next.cell.className && pre.cell.record === next.cell.record && pre.cellFixedInfo === next.cellFixedInfo;
|
|
180
189
|
return shouldUpdate;
|
|
181
190
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CellPosition } from "../../type/sheet";
|
|
2
|
+
import React, { CSSProperties } from "../../../node_modules/@types/react";
|
|
3
|
+
interface ControlProps {
|
|
4
|
+
startRowVisible: boolean;
|
|
5
|
+
firstRowVisible: boolean;
|
|
6
|
+
lastRowVisible: boolean;
|
|
7
|
+
showQuickLocationBtn: boolean;
|
|
8
|
+
backToEditRow: () => void;
|
|
9
|
+
toTop: () => void;
|
|
10
|
+
toBottom: () => void;
|
|
11
|
+
backEditStyle?: Partial<CSSProperties>;
|
|
12
|
+
ControlContainer?: React.FC<any>;
|
|
13
|
+
showBackEdit?: boolean;
|
|
14
|
+
selectInfo?: {
|
|
15
|
+
start?: CellPosition;
|
|
16
|
+
end?: CellPosition;
|
|
17
|
+
selecting?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const Control: React.FC<ControlProps>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { EditOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
2
|
+
import { Button, Tooltip } from 'antd';
|
|
3
|
+
import React, { useMemo } from "../../../node_modules/@types/react";
|
|
4
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
5
|
+
var itemStyle = {
|
|
6
|
+
fontSize: 18,
|
|
7
|
+
marginTop: 2
|
|
8
|
+
};
|
|
9
|
+
export var Control = function Control(props) {
|
|
10
|
+
var showBackEdit = props.showBackEdit,
|
|
11
|
+
showQuickLocationBtn = props.showQuickLocationBtn,
|
|
12
|
+
startRowVisible = props.startRowVisible,
|
|
13
|
+
firstRowVisible = props.firstRowVisible,
|
|
14
|
+
lastRowVisible = props.lastRowVisible,
|
|
15
|
+
selectInfo = props.selectInfo,
|
|
16
|
+
toTop = props.toTop,
|
|
17
|
+
toBottom = props.toBottom,
|
|
18
|
+
backToEditRow = props.backToEditRow,
|
|
19
|
+
_props$backEditStyle = props.backEditStyle,
|
|
20
|
+
backEditStyle = _props$backEditStyle === void 0 ? {
|
|
21
|
+
bottom: 0,
|
|
22
|
+
right: 0
|
|
23
|
+
} : _props$backEditStyle,
|
|
24
|
+
ControlContainer = props.ControlContainer;
|
|
25
|
+
var btns = useMemo(function () {
|
|
26
|
+
var tempBtns = [{
|
|
27
|
+
title: '置顶',
|
|
28
|
+
disabled: firstRowVisible,
|
|
29
|
+
event: toTop,
|
|
30
|
+
icon: /*#__PURE__*/_jsx(VerticalAlignTopOutlined, {
|
|
31
|
+
style: itemStyle
|
|
32
|
+
}),
|
|
33
|
+
isShow: showQuickLocationBtn
|
|
34
|
+
}, {
|
|
35
|
+
title: '置底',
|
|
36
|
+
disabled: lastRowVisible,
|
|
37
|
+
event: toBottom,
|
|
38
|
+
icon: /*#__PURE__*/_jsx(VerticalAlignBottomOutlined, {
|
|
39
|
+
style: itemStyle
|
|
40
|
+
}),
|
|
41
|
+
isShow: showQuickLocationBtn
|
|
42
|
+
}, {
|
|
43
|
+
title: '返回编辑行',
|
|
44
|
+
disabled: startRowVisible,
|
|
45
|
+
event: backToEditRow,
|
|
46
|
+
icon: /*#__PURE__*/_jsx(EditOutlined, {
|
|
47
|
+
style: itemStyle
|
|
48
|
+
}),
|
|
49
|
+
isShow: showBackEdit
|
|
50
|
+
}];
|
|
51
|
+
return tempBtns.filter(function (item) {
|
|
52
|
+
return item.isShow;
|
|
53
|
+
});
|
|
54
|
+
}, [firstRowVisible, showQuickLocationBtn, lastRowVisible, startRowVisible, showBackEdit]);
|
|
55
|
+
if (!showBackEdit && !showQuickLocationBtn) return null;
|
|
56
|
+
if (ControlContainer) {
|
|
57
|
+
return /*#__PURE__*/_jsx(ControlContainer, {
|
|
58
|
+
selectInfo: selectInfo
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return /*#__PURE__*/_jsx("div", {
|
|
62
|
+
className: "control",
|
|
63
|
+
style: backEditStyle,
|
|
64
|
+
children: btns.map(function (item) {
|
|
65
|
+
return /*#__PURE__*/_jsx("div", {
|
|
66
|
+
className: "control-item",
|
|
67
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
68
|
+
title: item.title,
|
|
69
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
70
|
+
style: {
|
|
71
|
+
width: 24,
|
|
72
|
+
height: 24,
|
|
73
|
+
padding: 0
|
|
74
|
+
},
|
|
75
|
+
disabled: item.disabled,
|
|
76
|
+
onClick: item.event,
|
|
77
|
+
children: item.icon
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}, item.title);
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useEffect, useRef } from
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { useEffect, useRef } from "../../../node_modules/@types/react";
|
|
2
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
3
3
|
var DataEditor = function DataEditor(_ref) {
|
|
4
4
|
var value = _ref.value,
|
|
5
5
|
onChange = _ref.onChange;
|
|
6
6
|
var inputRef = useRef(null);
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
var _inputRef$current;
|
|
9
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0
|
|
9
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
10
10
|
}, []);
|
|
11
11
|
var handleChange = function handleChange(e) {
|
|
12
12
|
onChange(e.target.value);
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { SheetType } from "../../type";
|
|
2
|
-
declare const DefaultCell:
|
|
3
|
+
declare const DefaultCell: React.FC<{
|
|
3
4
|
cell: SheetType.Cell;
|
|
4
5
|
row: number;
|
|
5
6
|
col: number;
|
|
6
|
-
attributesRenderer?: SheetType.AttributesRenderer
|
|
7
|
+
attributesRenderer?: SheetType.AttributesRenderer;
|
|
7
8
|
className: string;
|
|
8
9
|
style: Record<string, string>;
|
|
9
10
|
children: React.ReactElement;
|
|
10
|
-
|
|
11
|
+
isFirstFixedRight: boolean;
|
|
12
|
+
isLastFixedLeft: boolean;
|
|
13
|
+
isScrolledOver: boolean;
|
|
14
|
+
isScrolledToEnd: boolean;
|
|
15
|
+
}>;
|
|
11
16
|
export default DefaultCell;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { classNames } from "../util";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
9
9
|
var DefaultCell = function DefaultCell(props) {
|
|
10
10
|
var cell = props.cell,
|
|
11
11
|
row = props.row,
|
|
@@ -13,14 +13,18 @@ var DefaultCell = function DefaultCell(props) {
|
|
|
13
13
|
attributesRenderer = props.attributesRenderer,
|
|
14
14
|
className = props.className,
|
|
15
15
|
style = props.style,
|
|
16
|
-
children = props.children
|
|
16
|
+
children = props.children,
|
|
17
|
+
isFirstFixedRight = props.isFirstFixedRight,
|
|
18
|
+
isLastFixedLeft = props.isLastFixedLeft,
|
|
19
|
+
isScrolledOver = props.isScrolledOver,
|
|
20
|
+
isScrolledToEnd = props.isScrolledToEnd;
|
|
17
21
|
var colSpan = cell.colSpan,
|
|
18
22
|
rowSpan = cell.rowSpan;
|
|
19
23
|
var attributes = attributesRenderer ? attributesRenderer(cell, row, col) : {};
|
|
20
24
|
return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
|
|
21
25
|
"data-row": row,
|
|
22
26
|
"data-col": col,
|
|
23
|
-
className: classNames(className, cell.fixed && 'fixed', cell.fixed && "fixed-".concat(cell.fixed)),
|
|
27
|
+
className: classNames(className, cell.fixed && 'fixed', cell.fixed && "fixed-".concat(cell.fixed), cell.dataIndex === 'index' ? 'index' : null, isLastFixedLeft && isScrolledOver ? "last-fixed-left" : null, isFirstFixedRight && !isScrolledToEnd ? "first-fixed-right" : null),
|
|
24
28
|
colSpan: colSpan,
|
|
25
29
|
rowSpan: rowSpan,
|
|
26
30
|
style: style
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useMemo } from
|
|
1
|
+
import { useMemo } from "../../../node_modules/@types/react";
|
|
2
2
|
import { groupConfigToGroupMap } from "../util";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
4
4
|
var DefaultRow = function DefaultRow(_ref) {
|
|
5
5
|
var _groupMap$get, _groupMap$get2;
|
|
6
6
|
var rowClassName = _ref.rowClassName,
|
|
@@ -12,13 +12,7 @@ var DefaultRow = function DefaultRow(_ref) {
|
|
|
12
12
|
return groupConfigToGroupMap(groupConfig);
|
|
13
13
|
}, [groupConfig]);
|
|
14
14
|
if (groupMap.get(row) && !((_groupMap$get = groupMap.get(row)) !== null && _groupMap$get !== void 0 && _groupMap$get.isStart) && !((_groupMap$get2 = groupMap.get(row)) !== null && _groupMap$get2 !== void 0 && _groupMap$get2.isOpen)) {
|
|
15
|
-
return
|
|
16
|
-
className: rowClassName,
|
|
17
|
-
style: {
|
|
18
|
-
display: 'none'
|
|
19
|
-
},
|
|
20
|
-
children: children
|
|
21
|
-
});
|
|
15
|
+
return null;
|
|
22
16
|
}
|
|
23
17
|
return /*#__PURE__*/_jsx("tr", {
|
|
24
18
|
className: rowClassName,
|
|
@@ -3,6 +3,9 @@ import type { SheetType } from "../../type";
|
|
|
3
3
|
interface DefaultRowMapperProps {
|
|
4
4
|
rowData: SheetType.Cell[];
|
|
5
5
|
row: number;
|
|
6
|
+
fixedInfo: SheetType.FixedInfo[];
|
|
7
|
+
isScrolledOver: boolean;
|
|
8
|
+
isScrolledToEnd: boolean;
|
|
6
9
|
}
|
|
7
10
|
export declare const DefaultRowMapper: React.FC<DefaultRowMapperProps>;
|
|
8
11
|
export {};
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { memo } from "../../../node_modules/@types/react";
|
|
2
8
|
import Cell from "./Cell";
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
9
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "../../../node_modules/@types/react/jsx-runtime";
|
|
11
|
+
export var DefaultRowMapper = memo(function (_ref) {
|
|
5
12
|
var rowData = _ref.rowData,
|
|
6
|
-
row = _ref.row
|
|
13
|
+
row = _ref.row,
|
|
14
|
+
fixedInfo = _ref.fixedInfo,
|
|
15
|
+
isScrolledOver = _ref.isScrolledOver,
|
|
16
|
+
isScrolledToEnd = _ref.isScrolledToEnd;
|
|
7
17
|
var cls = rowData.map(function (cell, col) {
|
|
8
18
|
return /*#__PURE__*/_jsx(Cell, {
|
|
9
19
|
row: row,
|
|
10
20
|
col: col,
|
|
11
|
-
cell: cell
|
|
21
|
+
cell: cell,
|
|
22
|
+
cellFixedInfo: _objectSpread(_objectSpread({}, fixedInfo[col]), {}, {
|
|
23
|
+
isScrolledOver: isScrolledOver,
|
|
24
|
+
isScrolledToEnd: isScrolledToEnd
|
|
25
|
+
})
|
|
12
26
|
}, col);
|
|
13
27
|
});
|
|
14
|
-
return
|
|
28
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
29
|
+
children: cls
|
|
30
|
+
});
|
|
15
31
|
});
|
package/dist/core/sheet/Event.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuRenderProps } from "../../type/sheet";
|
|
2
|
+
import React from "../../../node_modules/@types/react";
|
|
3
|
+
export declare const Menu: React.ForwardRefExoticComponent<MenuRenderProps & {
|
|
4
|
+
contextMenu?: React.FC<MenuRenderProps> | undefined;
|
|
5
|
+
showMenu: boolean;
|
|
6
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { forwardRef } from "../../../node_modules/@types/react";
|
|
2
|
+
import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
|
|
3
|
+
export var Menu = forwardRef(function (props, ref) {
|
|
4
|
+
var showMenu = props.showMenu,
|
|
5
|
+
position = props.position,
|
|
6
|
+
cell = props.cell,
|
|
7
|
+
onContextMenu = props.onContextMenu,
|
|
8
|
+
ContextMenu = props.contextMenu;
|
|
9
|
+
var isMenuShow = !!ContextMenu && showMenu;
|
|
10
|
+
return /*#__PURE__*/_jsx("div", {
|
|
11
|
+
ref: ref,
|
|
12
|
+
style: {
|
|
13
|
+
display: isMenuShow ? '' : 'none'
|
|
14
|
+
},
|
|
15
|
+
children: isMenuShow && /*#__PURE__*/_jsx(ContextMenu, {
|
|
16
|
+
position: position,
|
|
17
|
+
cell: cell,
|
|
18
|
+
onContextMenu: onContextMenu
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
});
|