@zhenliang/sheet 0.1.7 → 0.1.8-4.beta.1
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 +10 -9
- package/dist/core/editor/cascaderEditor/index.less +14 -10
- package/dist/core/editor/dateEditor/index.js +29 -6
- 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 +60 -25
- 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 +17 -15
- package/dist/core/editor/selectEditor/index.less +15 -6
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/index.js +8 -1
- package/dist/core/reducers/keyboardReducer.js +40 -9
- package/dist/core/reducers/mouseReducer.js +123 -14
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +155 -49
- package/dist/core/reducers/stateReducer.d.ts +1 -0
- package/dist/core/reducers/stateReducer.js +126 -31
- package/dist/core/sheet/Cell.js +30 -21
- package/dist/core/sheet/Control.d.ts +21 -0
- package/dist/core/sheet/Control.js +83 -0
- package/dist/core/sheet/DataEditor.js +1 -1
- package/dist/core/sheet/DefaultCell.d.ts +8 -3
- package/dist/core/sheet/DefaultCell.js +11 -7
- package/dist/core/sheet/DefaultRow.js +1 -7
- package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
- package/dist/core/sheet/DefaultRowMapper.js +19 -3
- package/dist/core/sheet/Menu.d.ts +6 -0
- package/dist/core/sheet/Menu.js +21 -0
- package/dist/core/sheet/Remark.d.ts +9 -0
- package/dist/core/sheet/Remark.js +32 -0
- package/dist/core/sheet/index.js +328 -87
- package/dist/core/sheet/index.less +243 -107
- package/dist/core/sheet/searchInput.d.ts +16 -0
- package/dist/core/sheet/searchInput.js +105 -0
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +15 -12
- package/dist/core/sheet/useKeyBoardEvent.js +31 -7
- package/dist/core/sheet/useMouseEvent.js +37 -18
- package/dist/core/sheet/useRemarkContainer.d.ts +14 -0
- package/dist/core/sheet/useRemarkContainer.js +144 -0
- package/dist/core/sheet/useSearchInput.d.ts +11 -0
- package/dist/core/sheet/useSearchInput.js +75 -0
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +16 -6
- 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 +3 -1
- package/dist/core/shell/draggableShell/index.js +136 -46
- package/dist/core/shell/tableShell.d.ts +4 -2
- package/dist/core/shell/tableShell.js +11 -107
- package/dist/core/table/addButton.d.ts +5 -0
- package/dist/core/table/addButton.js +102 -0
- package/dist/core/table/events.d.ts +0 -2
- package/dist/core/table/events.js +30 -32
- package/dist/core/table/index.d.ts +1 -0
- package/dist/core/table/index.js +266 -192
- package/dist/core/table/index.less +31 -0
- package/dist/core/table/remarkEvent.d.ts +5 -0
- package/dist/core/table/remarkEvent.js +9 -0
- package/dist/core/table/useGroupConfig.d.ts +4 -1
- package/dist/core/table/useGroupConfig.js +141 -10
- package/dist/core/table/useRowSelection.d.ts +3 -0
- package/dist/core/table/useRowSelection.js +71 -1
- package/dist/core/util.d.ts +16 -3
- package/dist/core/util.js +156 -64
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/groupViewer/index.js +24 -8
- package/dist/core/viewer/switchViewer/index.js +8 -2
- package/dist/example/antComponent.js +72 -44
- package/dist/example/basic.js +15 -10
- package/dist/example/group.js +38 -15
- package/dist/example/selection.js +6 -6
- package/dist/example/sheet.js +18 -19
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +356 -14
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useEventBus.js +1 -1
- 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 +33 -9
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +2 -2
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +6 -6
- package/dist/hooks/useSetState.js +6 -6
- package/dist/hooks/useWidthConfig.d.ts +3 -3
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +89 -33
- package/dist/type/sheetTable.d.ts +38 -14
- package/package.json +11 -5
|
@@ -1,17 +1,94 @@
|
|
|
1
|
-
function _typeof(
|
|
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
2
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
4
|
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); }
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
7
|
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; }
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
10
|
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; }
|
|
11
|
-
function _toPropertyKey(
|
|
12
|
-
function _toPrimitive(
|
|
13
|
-
import {
|
|
14
|
-
export var
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
+
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); }
|
|
13
|
+
import { noramlizeSearch, searchInclude, stripRowIndex } from "../util";
|
|
14
|
+
export var searchReducer = {
|
|
15
|
+
changeSearch: function changeSearch(state, payload) {
|
|
16
|
+
var data = state.data;
|
|
17
|
+
var count = 0;
|
|
18
|
+
var searchResultList = [];
|
|
19
|
+
var normalSearchText = noramlizeSearch(payload);
|
|
20
|
+
payload && (data === null || data === void 0 ? void 0 : data.forEach(function (row, i) {
|
|
21
|
+
return row.forEach(function (item, j) {
|
|
22
|
+
var _item$dataEditor, _item$value;
|
|
23
|
+
if (item.fixed) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var formatterValue;
|
|
27
|
+
if (item.searchKey) {
|
|
28
|
+
formatterValue = item.searchKey(item.record);
|
|
29
|
+
if (searchInclude(normalSearchText, formatterValue)) {
|
|
30
|
+
count++;
|
|
31
|
+
searchResultList.push({
|
|
32
|
+
row: i,
|
|
33
|
+
col: j,
|
|
34
|
+
value: item.value,
|
|
35
|
+
formatterValue: formatterValue
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
} else if ((_item$dataEditor = item.dataEditor) !== null && _item$dataEditor !== void 0 && _item$dataEditor.formatter) {
|
|
39
|
+
var _item$dataEditor2;
|
|
40
|
+
formatterValue = (_item$dataEditor2 = item.dataEditor) === null || _item$dataEditor2 === void 0 || (_item$dataEditor2 = _item$dataEditor2.formatter(item.value, item.record)) === null || _item$dataEditor2 === void 0 ? void 0 : _item$dataEditor2.toString();
|
|
41
|
+
if (searchInclude(normalSearchText, formatterValue)) {
|
|
42
|
+
count++;
|
|
43
|
+
searchResultList.push({
|
|
44
|
+
row: i,
|
|
45
|
+
col: j,
|
|
46
|
+
value: item.value,
|
|
47
|
+
formatterValue: formatterValue
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
} else if (searchInclude(normalSearchText, (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.toString())) {
|
|
51
|
+
count++;
|
|
52
|
+
searchResultList.push({
|
|
53
|
+
row: i,
|
|
54
|
+
col: j,
|
|
55
|
+
value: item.value
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}));
|
|
60
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
61
|
+
searchText: payload,
|
|
62
|
+
searchTotal: count,
|
|
63
|
+
searchCurrent: -1,
|
|
64
|
+
searchResultList: searchResultList,
|
|
65
|
+
shouldSearchUpdate: false
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
closeSearch: function closeSearch(state) {
|
|
69
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
70
|
+
searchText: '',
|
|
71
|
+
showSearch: false,
|
|
72
|
+
searchTotal: 0,
|
|
73
|
+
searchCurrent: 0,
|
|
74
|
+
searchCalledCount: 0,
|
|
75
|
+
searchResultList: []
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
openSearch: function openSearch(state) {
|
|
79
|
+
var _state$searchCalledCo;
|
|
80
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
81
|
+
showSearch: true,
|
|
82
|
+
searchCalledCount: ((_state$searchCalledCo = state.searchCalledCount) !== null && _state$searchCalledCo !== void 0 ? _state$searchCalledCo : 0) + 1
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export var stateReducer = _objectSpread({
|
|
87
|
+
changeFixedPosition: function changeFixedPosition(state, payload) {
|
|
88
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
89
|
+
fixedInfo: payload
|
|
90
|
+
});
|
|
91
|
+
},
|
|
15
92
|
change: function change(state, payload) {
|
|
16
93
|
var _ref = payload,
|
|
17
94
|
key = _ref.key,
|
|
@@ -34,8 +111,8 @@ export var stateReducer = {
|
|
|
34
111
|
});
|
|
35
112
|
},
|
|
36
113
|
colMove: function colMove(state, payload) {
|
|
37
|
-
var _state$data2, _state$
|
|
38
|
-
var maxCol = (((_state$data2 = state.data) === null || _state$data2 === void 0
|
|
114
|
+
var _state$data2, _state$end3, _state$data3, _state$end4;
|
|
115
|
+
var maxCol = (((_state$data2 = state.data) === null || _state$data2 === void 0 || (_state$data2 = _state$data2[0]) === null || _state$data2 === void 0 ? void 0 : _state$data2.length) || 0) - 1;
|
|
39
116
|
var newCol = (((_state$end3 = state.end) === null || _state$end3 === void 0 ? void 0 : _state$end3.col) || 0) + payload;
|
|
40
117
|
if (newCol < 0 || newCol > maxCol || (_state$data3 = state.data) !== null && _state$data3 !== void 0 && _state$data3[0][newCol].fixed) return state;
|
|
41
118
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -55,7 +132,7 @@ export var stateReducer = {
|
|
|
55
132
|
confirm = _ref2$cell.confirm,
|
|
56
133
|
id = _ref2$cell.id;
|
|
57
134
|
var history = _toConsumableArray(state.history || []);
|
|
58
|
-
var current = data === null || data === void 0
|
|
135
|
+
var current = data === null || data === void 0 || (_data$row = data[row]) === null || _data$row === void 0 ? void 0 : _data$row[col].value;
|
|
59
136
|
history.push({
|
|
60
137
|
changes: [{
|
|
61
138
|
row: row,
|
|
@@ -69,11 +146,13 @@ export var stateReducer = {
|
|
|
69
146
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
70
147
|
editing: undefined,
|
|
71
148
|
lastEditing: state.editing,
|
|
72
|
-
history: history
|
|
149
|
+
history: history,
|
|
150
|
+
recoverHistory: []
|
|
73
151
|
});
|
|
74
152
|
}
|
|
75
153
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
76
|
-
history: history
|
|
154
|
+
history: history,
|
|
155
|
+
recoverHistory: []
|
|
77
156
|
});
|
|
78
157
|
},
|
|
79
158
|
popHistory: function popHistory(state) {
|
|
@@ -86,16 +165,39 @@ export var stateReducer = {
|
|
|
86
165
|
});
|
|
87
166
|
},
|
|
88
167
|
pushHistory: function pushHistory(state, payload) {
|
|
168
|
+
var newRecoverHistory = state.recoverHistory;
|
|
169
|
+
if (['DeleteRow', 'NewRow'].includes(payload.type)) {
|
|
170
|
+
newRecoverHistory = [];
|
|
171
|
+
}
|
|
89
172
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
90
|
-
history: [].concat(_toConsumableArray(state.history || []), [payload])
|
|
173
|
+
history: [].concat(_toConsumableArray(state.history || []), [payload]),
|
|
174
|
+
recoverHistory: newRecoverHistory
|
|
91
175
|
});
|
|
92
176
|
},
|
|
93
177
|
select: function select(state, payload) {
|
|
94
178
|
var oldStart = state.start,
|
|
95
|
-
oldEnd = state.end
|
|
179
|
+
oldEnd = state.end,
|
|
180
|
+
data = state.data;
|
|
96
181
|
var _ref3 = payload,
|
|
97
182
|
start = _ref3.start,
|
|
98
183
|
end = _ref3.end;
|
|
184
|
+
if (data) {
|
|
185
|
+
var _stripRowIndex = stripRowIndex(data),
|
|
186
|
+
startIndex = _stripRowIndex.startIndex,
|
|
187
|
+
endIndex = _stripRowIndex.endIndex;
|
|
188
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
189
|
+
start: _objectSpread(_objectSpread({}, start), {}, {
|
|
190
|
+
col: Math.max(startIndex, start.col)
|
|
191
|
+
}),
|
|
192
|
+
end: _objectSpread(_objectSpread({}, end), {}, {
|
|
193
|
+
col: Math.min(endIndex, end.col)
|
|
194
|
+
}),
|
|
195
|
+
lastSelected: {
|
|
196
|
+
start: oldStart,
|
|
197
|
+
end: oldEnd
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
99
201
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
100
202
|
start: start,
|
|
101
203
|
end: end,
|
|
@@ -105,28 +207,21 @@ export var stateReducer = {
|
|
|
105
207
|
}
|
|
106
208
|
});
|
|
107
209
|
},
|
|
108
|
-
|
|
109
|
-
var _state$data4
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return item.fixed === SheetType.CellAlign.right;
|
|
116
|
-
});
|
|
117
|
-
if (lastFixed) {
|
|
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;
|
|
120
|
-
}
|
|
121
|
-
if (startCol >= 0 && endCol >= 0) {
|
|
210
|
+
selectOneRow: function selectOneRow(state, payload) {
|
|
211
|
+
var _state$data4 = state.data,
|
|
212
|
+
data = _state$data4 === void 0 ? [] : _state$data4;
|
|
213
|
+
var _stripRowIndex2 = stripRowIndex(data),
|
|
214
|
+
startIndex = _stripRowIndex2.startIndex,
|
|
215
|
+
endIndex = _stripRowIndex2.endIndex;
|
|
216
|
+
if (startIndex >= 0 && endIndex >= 0) {
|
|
122
217
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
123
218
|
start: {
|
|
124
219
|
row: payload,
|
|
125
|
-
col:
|
|
220
|
+
col: startIndex
|
|
126
221
|
},
|
|
127
222
|
end: {
|
|
128
223
|
row: payload,
|
|
129
|
-
col:
|
|
224
|
+
col: endIndex
|
|
130
225
|
},
|
|
131
226
|
lastSelected: {
|
|
132
227
|
start: state.start,
|
|
@@ -171,4 +266,4 @@ export var stateReducer = {
|
|
|
171
266
|
lastEditing: editing
|
|
172
267
|
});
|
|
173
268
|
}
|
|
174
|
-
};
|
|
269
|
+
}, searchReducer);
|
package/dist/core/sheet/Cell.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
8
|
import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -16,20 +16,6 @@ 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
187
|
export default /*#__PURE__*/memo(Cell, function (pre, next) {
|
|
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;
|
|
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 '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 'react';
|
|
4
|
+
import { jsx as _jsx } from "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
|
+
};
|
|
@@ -6,7 +6,7 @@ var DataEditor = function DataEditor(_ref) {
|
|
|
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,9 +1,9 @@
|
|
|
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
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
var DefaultCell = function DefaultCell(props) {
|
|
@@ -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
|
|
@@ -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
|
+
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); }
|
|
1
7
|
import { memo } from 'react';
|
|
2
8
|
import Cell from "./Cell";
|
|
3
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
11
|
export var DefaultRowMapper = /*#__PURE__*/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
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuRenderProps } from "../../type/sheet";
|
|
2
|
+
import React from '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 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export var Menu = /*#__PURE__*/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
|
+
});
|