@zhenliang/sheet 0.1.20 → 0.1.22
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/changes.md +45 -0
- package/package.json +1 -1
- package/dist/core/config.d.ts +0 -13
- package/dist/core/config.js +0 -13
- package/dist/core/editor/cascaderEditor/index.d.ts +0 -5
- package/dist/core/editor/cascaderEditor/index.js +0 -54
- package/dist/core/editor/cascaderEditor/index.less +0 -28
- package/dist/core/editor/dateEditor/index.d.ts +0 -5
- package/dist/core/editor/dateEditor/index.js +0 -55
- package/dist/core/editor/dateEditor/index.less +0 -11
- package/dist/core/editor/index.d.ts +0 -4
- package/dist/core/editor/index.js +0 -4
- package/dist/core/editor/numberEditor/index.d.ts +0 -8
- package/dist/core/editor/numberEditor/index.js +0 -107
- package/dist/core/editor/numberEditor/index.less +0 -30
- package/dist/core/editor/selectEditor/index.d.ts +0 -6
- package/dist/core/editor/selectEditor/index.js +0 -96
- package/dist/core/editor/selectEditor/index.less +0 -43
- package/dist/core/reducers/index.d.ts +0 -9
- package/dist/core/reducers/index.js +0 -38
- package/dist/core/reducers/keyboardReducer.d.ts +0 -2
- package/dist/core/reducers/keyboardReducer.js +0 -93
- package/dist/core/reducers/mouseReducer.d.ts +0 -2
- package/dist/core/reducers/mouseReducer.js +0 -164
- package/dist/core/reducers/sideEffectReducer.d.ts +0 -4
- package/dist/core/reducers/sideEffectReducer.js +0 -378
- package/dist/core/reducers/stateReducer.d.ts +0 -2
- package/dist/core/reducers/stateReducer.js +0 -174
- package/dist/core/sheet/Cell.d.ts +0 -4
- package/dist/core/sheet/Cell.js +0 -181
- package/dist/core/sheet/DataEditor.d.ts +0 -3
- package/dist/core/sheet/DataEditor.js +0 -24
- package/dist/core/sheet/DefaultCell.d.ts +0 -11
- package/dist/core/sheet/DefaultCell.js +0 -31
- package/dist/core/sheet/DefaultRow.d.ts +0 -12
- package/dist/core/sheet/DefaultRow.js +0 -28
- package/dist/core/sheet/DefaultRowMapper.d.ts +0 -8
- package/dist/core/sheet/DefaultRowMapper.js +0 -15
- package/dist/core/sheet/DefaultShell.d.ts +0 -8
- package/dist/core/sheet/DefaultShell.js +0 -12
- package/dist/core/sheet/Event.d.ts +0 -5
- package/dist/core/sheet/Event.js +0 -17
- package/dist/core/sheet/ValueViewer.d.ts +0 -3
- package/dist/core/sheet/ValueViewer.js +0 -9
- package/dist/core/sheet/index.d.ts +0 -5
- package/dist/core/sheet/index.js +0 -265
- package/dist/core/sheet/index.less +0 -307
- package/dist/core/sheet/useCellEvent.d.ts +0 -3
- package/dist/core/sheet/useCellEvent.js +0 -22
- package/dist/core/sheet/useContextMenu.d.ts +0 -21
- package/dist/core/sheet/useContextMenu.js +0 -86
- package/dist/core/sheet/useKeyBoardEvent.d.ts +0 -3
- package/dist/core/sheet/useKeyBoardEvent.js +0 -66
- package/dist/core/sheet/useMouseEvent.d.ts +0 -3
- package/dist/core/sheet/useMouseEvent.js +0 -298
- package/dist/core/sheet/useSelectVisible.d.ts +0 -2
- package/dist/core/sheet/useSelectVisible.js +0 -57
- package/dist/core/sheet/useVirtualList.d.ts +0 -7
- package/dist/core/sheet/useVirtualList.js +0 -103
- package/dist/core/sheet/var.less +0 -41
- package/dist/core/shell/draggableShell/index.d.ts +0 -5
- package/dist/core/shell/draggableShell/index.js +0 -197
- package/dist/core/shell/draggableShell/index.less +0 -16
- package/dist/core/shell/tableShell.d.ts +0 -5
- package/dist/core/shell/tableShell.js +0 -109
- package/dist/core/table/events.d.ts +0 -15
- package/dist/core/table/events.js +0 -95
- package/dist/core/table/index.d.ts +0 -4
- package/dist/core/table/index.js +0 -313
- package/dist/core/table/useGroupConfig.d.ts +0 -2
- package/dist/core/table/useGroupConfig.js +0 -65
- package/dist/core/table/useRowSelection.d.ts +0 -2
- package/dist/core/table/useRowSelection.js +0 -24
- package/dist/core/table/util.d.ts +0 -8
- package/dist/core/table/util.js +0 -29
- package/dist/core/util.d.ts +0 -59
- package/dist/core/util.js +0 -490
- package/dist/core/viewer/btnViewer/index.d.ts +0 -2
- package/dist/core/viewer/btnViewer/index.js +0 -37
- package/dist/core/viewer/cascaderViewer/index.d.ts +0 -2
- package/dist/core/viewer/cascaderViewer/index.js +0 -11
- package/dist/core/viewer/checkViewer/index.d.ts +0 -2
- package/dist/core/viewer/checkViewer/index.js +0 -23
- package/dist/core/viewer/editViewer/index.d.ts +0 -2
- package/dist/core/viewer/editViewer/index.js +0 -31
- package/dist/core/viewer/groupViewer/index.d.ts +0 -2
- package/dist/core/viewer/groupViewer/index.js +0 -34
- package/dist/core/viewer/index.d.ts +0 -7
- package/dist/core/viewer/index.js +0 -7
- package/dist/core/viewer/selectorViewer/index.d.ts +0 -2
- package/dist/core/viewer/selectorViewer/index.js +0 -16
- package/dist/core/viewer/switchViewer/index.d.ts +0 -2
- package/dist/core/viewer/switchViewer/index.js +0 -22
- package/dist/example/antComponent.d.ts +0 -3
- package/dist/example/antComponent.js +0 -314
- package/dist/example/basic.d.ts +0 -4
- package/dist/example/basic.js +0 -121
- package/dist/example/ellipsis.d.ts +0 -3
- package/dist/example/ellipsis.js +0 -64
- package/dist/example/fixed.d.ts +0 -3
- package/dist/example/fixed.js +0 -89
- package/dist/example/group.d.ts +0 -3
- package/dist/example/group.js +0 -123
- package/dist/example/index.less +0 -5
- package/dist/example/selection.d.ts +0 -4
- package/dist/example/selection.js +0 -86
- package/dist/example/sheet.d.ts +0 -4
- package/dist/example/sheet.js +0 -393
- package/dist/example/valuationAnalyze.d.ts +0 -2
- package/dist/example/valuationAnalyze.js +0 -227
- package/dist/hooks/index.d.ts +0 -8
- package/dist/hooks/index.js +0 -7
- package/dist/hooks/useEventBus.d.ts +0 -4
- package/dist/hooks/useEventBus.js +0 -17
- package/dist/hooks/useKeyboard.d.ts +0 -18
- package/dist/hooks/useKeyboard.js +0 -108
- package/dist/hooks/useMiddlewareReducer.d.ts +0 -12
- package/dist/hooks/useMiddlewareReducer.js +0 -47
- package/dist/hooks/useMouse.d.ts +0 -11
- package/dist/hooks/useMouse.js +0 -68
- package/dist/hooks/useSetState.d.ts +0 -2
- package/dist/hooks/useSetState.js +0 -27
- package/dist/hooks/useSheetEvent.d.ts +0 -5
- package/dist/hooks/useSheetEvent.js +0 -5
- package/dist/hooks/useWidthConfig.d.ts +0 -4
- package/dist/hooks/useWidthConfig.js +0 -5
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/standardUtils/index.d.ts +0 -9
- package/dist/standardUtils/index.js +0 -32
- package/dist/type/index.d.ts +0 -2
- package/dist/type/index.js +0 -4
- package/dist/type/sheet.d.ts +0 -205
- package/dist/type/sheet.js +0 -9
- package/dist/type/sheetTable.d.ts +0 -89
- package/dist/type/sheetTable.js +0 -1
- package/dist/typings/index.d.ts +0 -1
package/dist/core/util.js
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
|
-
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."); }
|
|
10
|
-
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); }
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
|
-
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; }
|
|
14
|
-
/* eslint-disable no-param-reassign */
|
|
15
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
16
|
-
|
|
17
|
-
import { message } from 'antd';
|
|
18
|
-
import { cloneDeep, get, isNil, range } from 'lodash';
|
|
19
|
-
export function findParentTd(el) {
|
|
20
|
-
if (!el) return null;
|
|
21
|
-
if (el.tagName === 'TD') return el;
|
|
22
|
-
return findParentTd(el.parentElement);
|
|
23
|
-
}
|
|
24
|
-
export function extractDataRowAndCol(el) {
|
|
25
|
-
var row = Number(el.getAttribute('data-row'));
|
|
26
|
-
var col = Number(el.getAttribute('data-col'));
|
|
27
|
-
return {
|
|
28
|
-
row: row,
|
|
29
|
-
col: col
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export function getRowColConfig(start, end) {
|
|
33
|
-
var _start$row, _end$row, _start$row2, _end$row2, _start$col, _end$col, _start$col2, _end$col2;
|
|
34
|
-
var startRow = Math.min((_start$row = start === null || start === void 0 ? void 0 : start.row) !== null && _start$row !== void 0 ? _start$row : -1, (_end$row = end === null || end === void 0 ? void 0 : end.row) !== null && _end$row !== void 0 ? _end$row : -1);
|
|
35
|
-
var endRow = Math.max((_start$row2 = start === null || start === void 0 ? void 0 : start.row) !== null && _start$row2 !== void 0 ? _start$row2 : -1, (_end$row2 = end === null || end === void 0 ? void 0 : end.row) !== null && _end$row2 !== void 0 ? _end$row2 : -1);
|
|
36
|
-
var startCol = Math.min((_start$col = start === null || start === void 0 ? void 0 : start.col) !== null && _start$col !== void 0 ? _start$col : -1, (_end$col = end === null || end === void 0 ? void 0 : end.col) !== null && _end$col !== void 0 ? _end$col : -1);
|
|
37
|
-
var endCol = Math.max((_start$col2 = start === null || start === void 0 ? void 0 : start.col) !== null && _start$col2 !== void 0 ? _start$col2 : -1, (_end$col2 = end === null || end === void 0 ? void 0 : end.col) !== null && _end$col2 !== void 0 ? _end$col2 : -1);
|
|
38
|
-
return {
|
|
39
|
-
startRow: startRow,
|
|
40
|
-
endRow: endRow,
|
|
41
|
-
startCol: startCol,
|
|
42
|
-
endCol: endCol
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export function flatRowColIndex(start, end) {
|
|
46
|
-
var _getRowColConfig = getRowColConfig(start, end),
|
|
47
|
-
startRow = _getRowColConfig.startRow,
|
|
48
|
-
endRow = _getRowColConfig.endRow,
|
|
49
|
-
startCol = _getRowColConfig.startCol,
|
|
50
|
-
endCol = _getRowColConfig.endCol;
|
|
51
|
-
if ([startRow, endRow, startCol, endCol].some(function (a) {
|
|
52
|
-
return a === -1;
|
|
53
|
-
})) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
var cellList = [];
|
|
57
|
-
for (var i = startRow; i <= endRow; i++) {
|
|
58
|
-
for (var j = startCol; j <= endCol; j++) {
|
|
59
|
-
cellList.push({
|
|
60
|
-
row: i,
|
|
61
|
-
col: j
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return cellList;
|
|
66
|
-
}
|
|
67
|
-
export function flatRowCol(start, end) {
|
|
68
|
-
var rowColIndex = flatRowColIndex(start, end);
|
|
69
|
-
return rowColIndex.map(function (_ref) {
|
|
70
|
-
var row = _ref.row,
|
|
71
|
-
col = _ref.col;
|
|
72
|
-
return "".concat(row, "-").concat(col);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
export function isInputKey(keyCode) {
|
|
76
|
-
var numbersPressed = keyCode >= 48 && keyCode <= 57;
|
|
77
|
-
var lettersPressed = keyCode >= 65 && keyCode <= 90;
|
|
78
|
-
var latin1Supplement = keyCode >= 160 && keyCode <= 255;
|
|
79
|
-
var numPadKeysPressed = keyCode >= 96 && keyCode <= 105;
|
|
80
|
-
var equationKeysPressed = [187 /* equal */, 189 /* substract */, 190 /* period */, 107 /* add */, 109 /* decimal point */, 110].indexOf(keyCode) > -1;
|
|
81
|
-
return numPadKeysPressed || numbersPressed || lettersPressed || latin1Supplement || equationKeysPressed;
|
|
82
|
-
}
|
|
83
|
-
export function classNames() {
|
|
84
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
85
|
-
args[_key] = arguments[_key];
|
|
86
|
-
}
|
|
87
|
-
return args.filter(Boolean).join(' ');
|
|
88
|
-
}
|
|
89
|
-
export function stringToClipboardData(str, count) {
|
|
90
|
-
// navigator.clipboard.writeText(str);
|
|
91
|
-
navigator.clipboard.writeText(str).then(function () {
|
|
92
|
-
// console.log('复制成功');
|
|
93
|
-
message.success("\u5DF2\u590D\u5236".concat(count, "\u4E2A\u5355\u5143\u683C"));
|
|
94
|
-
}, function () {
|
|
95
|
-
// console.error('复制失败');
|
|
96
|
-
message.info("\u590D\u5236\u5931\u8D25");
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
export var defaultParsePaste = function defaultParsePaste(str) {
|
|
100
|
-
return str.split(/\r\n|\n|\r/).map(function (row) {
|
|
101
|
-
return row.split('\t');
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
export function clipboardDataToString() {
|
|
105
|
-
return new Promise(function (resolve) {
|
|
106
|
-
navigator.clipboard.readText().then(function (res) {
|
|
107
|
-
resolve(defaultParsePaste(res));
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
export function formatDataToCell(_ref2) {
|
|
112
|
-
var _start$row3, _end$row3;
|
|
113
|
-
var start = _ref2.start,
|
|
114
|
-
editing = _ref2.editing,
|
|
115
|
-
end = _ref2.end,
|
|
116
|
-
data = _ref2.data,
|
|
117
|
-
pasteData = _ref2.pasteData,
|
|
118
|
-
groupConfig = _ref2.groupConfig,
|
|
119
|
-
_ref2$freePaste = _ref2.freePaste,
|
|
120
|
-
freePaste = _ref2$freePaste === void 0 ? false : _ref2$freePaste;
|
|
121
|
-
if (editing || !data) return;
|
|
122
|
-
var cells = flatRowColIndex(start, end);
|
|
123
|
-
if (!cells.length) return;
|
|
124
|
-
var rowCount = cells[cells.length - 1].row - cells[0].row + 1;
|
|
125
|
-
if (!cells.length) return;
|
|
126
|
-
var isMultiCells = cells.length > 1;
|
|
127
|
-
var isSinglePaste = pasteData.length === 1 && pasteData[0].length === 1;
|
|
128
|
-
|
|
129
|
-
// todo 超出行的处理
|
|
130
|
-
// const isExRow = (cells[cells.length - 1].row as number) > (data?.length || 0);
|
|
131
|
-
|
|
132
|
-
var groupMap = groupConfigToGroupMap(groupConfig);
|
|
133
|
-
var actualRowCount = range((_start$row3 = start === null || start === void 0 ? void 0 : start.row) !== null && _start$row3 !== void 0 ? _start$row3 : 0, ((_end$row3 = end === null || end === void 0 ? void 0 : end.row) !== null && _end$row3 !== void 0 ? _end$row3 : 0) + 1).reduce(function (left, index) {
|
|
134
|
-
var _groupMap$get, _groupMap$get2;
|
|
135
|
-
if (groupMap.get(index) && !((_groupMap$get = groupMap.get(index)) !== null && _groupMap$get !== void 0 && _groupMap$get.isStart) && !((_groupMap$get2 = groupMap.get(index)) !== null && _groupMap$get2 !== void 0 && _groupMap$get2.isOpen)) {
|
|
136
|
-
return left;
|
|
137
|
-
}
|
|
138
|
-
return left + 1;
|
|
139
|
-
}, 0);
|
|
140
|
-
var changes = [];
|
|
141
|
-
if (isMultiCells && isSinglePaste) {
|
|
142
|
-
// 选中多个单元格,粘贴单个数据
|
|
143
|
-
cells.forEach(function (_ref3) {
|
|
144
|
-
var _groupMap$get3, _groupMap$get4;
|
|
145
|
-
var row = _ref3.row,
|
|
146
|
-
col = _ref3.col;
|
|
147
|
-
if (data[row][col].readonly) return;
|
|
148
|
-
if (groupMap.get(row) && !((_groupMap$get3 = groupMap.get(row)) !== null && _groupMap$get3 !== void 0 && _groupMap$get3.isStart) && !((_groupMap$get4 = groupMap.get(row)) !== null && _groupMap$get4 !== void 0 && _groupMap$get4.isOpen)) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
changes.push({
|
|
152
|
-
row: row,
|
|
153
|
-
col: col,
|
|
154
|
-
value: pasteData[0][0].trimStart().trimEnd()
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
return {
|
|
158
|
-
changes: changes
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
if (!isMultiCells) {
|
|
162
|
-
// 选中单个单元格
|
|
163
|
-
var _cells$ = cells[0],
|
|
164
|
-
row = _cells$.row,
|
|
165
|
-
col = _cells$.col;
|
|
166
|
-
var extChanges = [];
|
|
167
|
-
var hasStartAndNotOpen = false;
|
|
168
|
-
pasteData.forEach(function (rowData, i) {
|
|
169
|
-
rowData.forEach(function (cell, j) {
|
|
170
|
-
if (row + i >= data.length) {
|
|
171
|
-
var _pasteData$i$j;
|
|
172
|
-
extChanges.push({
|
|
173
|
-
row: row + i,
|
|
174
|
-
col: col + j,
|
|
175
|
-
value: (_pasteData$i$j = pasteData[i][j]) === null || _pasteData$i$j === void 0 ? void 0 : _pasteData$i$j.trimStart().trimEnd()
|
|
176
|
-
});
|
|
177
|
-
} else {
|
|
178
|
-
var _data, _data2, _groupMap$get5, _groupMap$get6, _pasteData$i$j2;
|
|
179
|
-
if (data !== null && data !== void 0 && (_data = data[row + i]) !== null && _data !== void 0 && (_data2 = _data[col + j]) !== null && _data2 !== void 0 && _data2.readonly) return;
|
|
180
|
-
if (groupMap.get(row + i) && !((_groupMap$get5 = groupMap.get(row + i)) !== null && _groupMap$get5 !== void 0 && _groupMap$get5.isStart) && !((_groupMap$get6 = groupMap.get(row + i)) !== null && _groupMap$get6 !== void 0 && _groupMap$get6.isOpen)) {
|
|
181
|
-
hasStartAndNotOpen = true;
|
|
182
|
-
}
|
|
183
|
-
changes.push({
|
|
184
|
-
row: row + i,
|
|
185
|
-
col: col + j,
|
|
186
|
-
value: (_pasteData$i$j2 = pasteData[i][j]) === null || _pasteData$i$j2 === void 0 ? void 0 : _pasteData$i$j2.trimStart().trimEnd()
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
if (hasStartAndNotOpen) {
|
|
192
|
-
console.error('有折叠单元格,不可粘贴');
|
|
193
|
-
return {
|
|
194
|
-
changes: [],
|
|
195
|
-
extChanges: []
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
return {
|
|
199
|
-
changes: changes,
|
|
200
|
-
extChanges: freePaste ? extChanges : undefined
|
|
201
|
-
};
|
|
202
|
-
} else {
|
|
203
|
-
// 选中多个单元格,粘贴多个数据
|
|
204
|
-
if (actualRowCount !== pasteData.length || cells.length / rowCount * actualRowCount !== pasteData.length * pasteData[0].length) {
|
|
205
|
-
// 单元格数量不对
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
var baseCol = cells[0].col;
|
|
209
|
-
var lastRow = cells[0].row;
|
|
210
|
-
var pasteCount = 0;
|
|
211
|
-
cells.forEach(function (_ref4) {
|
|
212
|
-
var _data$row$col, _groupMap$get7, _groupMap$get8, _pasteData$pasteCount, _pasteData$pasteCount2;
|
|
213
|
-
var row = _ref4.row,
|
|
214
|
-
col = _ref4.col;
|
|
215
|
-
if ((_data$row$col = data[row][col]) !== null && _data$row$col !== void 0 && _data$row$col.readonly) return;
|
|
216
|
-
if (groupMap.get(row) && !((_groupMap$get7 = groupMap.get(row)) !== null && _groupMap$get7 !== void 0 && _groupMap$get7.isStart) && !((_groupMap$get8 = groupMap.get(row)) !== null && _groupMap$get8 !== void 0 && _groupMap$get8.isOpen)) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
if (row !== lastRow) {
|
|
220
|
-
pasteCount++;
|
|
221
|
-
lastRow = row;
|
|
222
|
-
}
|
|
223
|
-
changes.push({
|
|
224
|
-
row: row,
|
|
225
|
-
col: col,
|
|
226
|
-
value: pasteData === null || pasteData === void 0 ? void 0 : (_pasteData$pasteCount = pasteData[pasteCount]) === null || _pasteData$pasteCount === void 0 ? void 0 : (_pasteData$pasteCount2 = _pasteData$pasteCount[col - baseCol]) === null || _pasteData$pasteCount2 === void 0 ? void 0 : _pasteData$pasteCount2.trimStart().trimEnd()
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
return {
|
|
230
|
-
changes: changes
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
export var defaultValueRenderer = function defaultValueRenderer(cell) {
|
|
235
|
-
return cell.value;
|
|
236
|
-
};
|
|
237
|
-
export function renderValue(cell) {
|
|
238
|
-
var value = defaultValueRenderer(cell);
|
|
239
|
-
return value === null || typeof value === 'undefined' ? '' : value;
|
|
240
|
-
}
|
|
241
|
-
export var optionsToValuesFromLabelOrValue = function optionsToValuesFromLabelOrValue(options, val) {
|
|
242
|
-
var labelRes = optionsTransferToValue(options, val);
|
|
243
|
-
var valueRes = optionsTransferToValue(options, val, 'value');
|
|
244
|
-
return labelRes !== null && labelRes !== void 0 && labelRes.length ? labelRes : valueRes;
|
|
245
|
-
};
|
|
246
|
-
export var optionsTransferToValue = function optionsTransferToValue(options, val) {
|
|
247
|
-
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
248
|
-
var values = [];
|
|
249
|
-
for (var i = 0; i < options.length; i++) {
|
|
250
|
-
var _options$i = options[i],
|
|
251
|
-
value = _options$i.value,
|
|
252
|
-
children = _options$i.children;
|
|
253
|
-
if (children) {
|
|
254
|
-
values = optionsTransferToValue(children, val, key);
|
|
255
|
-
if (values.length) {
|
|
256
|
-
values = [value].concat(_toConsumableArray(values));
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
} else if (get(options[i], key) === val) {
|
|
260
|
-
values.push(value);
|
|
261
|
-
break;
|
|
262
|
-
} else {
|
|
263
|
-
values = [];
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return values;
|
|
267
|
-
};
|
|
268
|
-
export var optionsTransferToValue2 = function optionsTransferToValue2(options, value) {
|
|
269
|
-
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
270
|
-
if (!(options !== null && options !== void 0 && options.length) || !value) return _toConsumableArray(path);
|
|
271
|
-
var leaveNode = options === null || options === void 0 ? void 0 : options.find(function (item) {
|
|
272
|
-
var _item$children;
|
|
273
|
-
return !((_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) && value === item.value;
|
|
274
|
-
});
|
|
275
|
-
if (leaveNode) {
|
|
276
|
-
return [leaveNode.value];
|
|
277
|
-
}
|
|
278
|
-
var childrenNodes = options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
279
|
-
var _item$children2;
|
|
280
|
-
return (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length;
|
|
281
|
-
});
|
|
282
|
-
if (childrenNodes) {
|
|
283
|
-
var _iterator = _createForOfIteratorHelper(childrenNodes),
|
|
284
|
-
_step;
|
|
285
|
-
try {
|
|
286
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
287
|
-
var childrenNode = _step.value;
|
|
288
|
-
var allPath = optionsTransferToValue(childrenNode.children, value, [].concat(_toConsumableArray(path), [childrenNode.value]));
|
|
289
|
-
if (allPath !== null && allPath !== void 0 && allPath.length) {
|
|
290
|
-
return allPath;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
} catch (err) {
|
|
294
|
-
_iterator.e(err);
|
|
295
|
-
} finally {
|
|
296
|
-
_iterator.f();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return [];
|
|
300
|
-
};
|
|
301
|
-
export var valuesTransferToLabel = function valuesTransferToLabel(options, value) {
|
|
302
|
-
if (!(options !== null && options !== void 0 && options.length) || !value) return null;
|
|
303
|
-
var leaveNode = options === null || options === void 0 ? void 0 : options.find(function (item) {
|
|
304
|
-
var _item$children3;
|
|
305
|
-
return !((_item$children3 = item.children) !== null && _item$children3 !== void 0 && _item$children3.length) && value === item.value;
|
|
306
|
-
});
|
|
307
|
-
var childrenNode = options === null || options === void 0 ? void 0 : options.filter(function (item) {
|
|
308
|
-
var _item$children4;
|
|
309
|
-
return (_item$children4 = item.children) === null || _item$children4 === void 0 ? void 0 : _item$children4.length;
|
|
310
|
-
}).map(function (item) {
|
|
311
|
-
return item.children;
|
|
312
|
-
});
|
|
313
|
-
if (leaveNode) {
|
|
314
|
-
return leaveNode.label;
|
|
315
|
-
}
|
|
316
|
-
if (childrenNode) {
|
|
317
|
-
var _iterator2 = _createForOfIteratorHelper(childrenNode),
|
|
318
|
-
_step2;
|
|
319
|
-
try {
|
|
320
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
321
|
-
var children = _step2.value;
|
|
322
|
-
var label = valuesTransferToLabel(children, value);
|
|
323
|
-
if (label) {
|
|
324
|
-
return label;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
} catch (err) {
|
|
328
|
-
_iterator2.e(err);
|
|
329
|
-
} finally {
|
|
330
|
-
_iterator2.f();
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
return null;
|
|
334
|
-
};
|
|
335
|
-
export var groupConfigToGroupMap = function groupConfigToGroupMap(rowGroupConfig) {
|
|
336
|
-
var _rowGroupConfig$group;
|
|
337
|
-
var groupMap = new Map();
|
|
338
|
-
if (!rowGroupConfig || !((_rowGroupConfig$group = rowGroupConfig.groups) !== null && _rowGroupConfig$group !== void 0 && _rowGroupConfig$group.length)) return groupMap;
|
|
339
|
-
var groups = rowGroupConfig.groups;
|
|
340
|
-
groups === null || groups === void 0 ? void 0 : groups.forEach(function (group, index) {
|
|
341
|
-
var groupStart = group.groupStart,
|
|
342
|
-
groupEnd = group.groupEnd;
|
|
343
|
-
for (var i = groupStart; i <= groupEnd; i++) {
|
|
344
|
-
groupMap.set(i, _objectSpread(_objectSpread({}, group), {}, {
|
|
345
|
-
isStart: i === groupStart,
|
|
346
|
-
isOpen: rowGroupConfig.groupOpen[index]
|
|
347
|
-
}));
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
return groupMap;
|
|
351
|
-
};
|
|
352
|
-
export var changeGroupConfig = function changeGroupConfig(rowGroupConfig, changeInfo) {
|
|
353
|
-
var groupMap = groupConfigToGroupMap(rowGroupConfig);
|
|
354
|
-
if (!groupMap.size) return rowGroupConfig;
|
|
355
|
-
var newGroups = cloneDeep(rowGroupConfig.groups);
|
|
356
|
-
// 顺序是先增后减
|
|
357
|
-
var add = changeInfo.add,
|
|
358
|
-
remove = changeInfo.remove;
|
|
359
|
-
if (!isNil(add)) {
|
|
360
|
-
for (var i = 0; i < newGroups.length; i++) {
|
|
361
|
-
var _newGroups$i = newGroups[i],
|
|
362
|
-
groupStart = _newGroups$i.groupStart,
|
|
363
|
-
groupEnd = _newGroups$i.groupEnd;
|
|
364
|
-
if (groupStart >= add) {
|
|
365
|
-
newGroups[i].groupStart++;
|
|
366
|
-
newGroups[i].groupEnd++;
|
|
367
|
-
} else if (groupStart < add && groupEnd >= add) {
|
|
368
|
-
newGroups[i].groupEnd++;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
if (!isNil(remove)) {
|
|
373
|
-
for (var _i = 0; _i < newGroups.length; _i++) {
|
|
374
|
-
var _newGroups$_i = newGroups[_i],
|
|
375
|
-
_groupStart = _newGroups$_i.groupStart,
|
|
376
|
-
_groupEnd = _newGroups$_i.groupEnd;
|
|
377
|
-
if (_groupStart > remove) {
|
|
378
|
-
newGroups[_i].groupStart--;
|
|
379
|
-
newGroups[_i].groupEnd--;
|
|
380
|
-
} else if (_groupStart <= remove && _groupEnd > remove) {
|
|
381
|
-
newGroups[_i].groupEnd--;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
return _objectSpread(_objectSpread({}, rowGroupConfig), {}, {
|
|
386
|
-
groups: newGroups
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
export var rowToActualRow = function rowToActualRow(row, groupConfig) {
|
|
390
|
-
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10000;
|
|
391
|
-
var groupMap = groupConfigToGroupMap(groupConfig);
|
|
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
|
-
if (i >= row) {
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
openCount++;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return openCount;
|
|
406
|
-
};
|
|
407
|
-
export var rowToCountRow = function rowToCountRow(row, groupConfig, max) {
|
|
408
|
-
var groupMap = groupConfigToGroupMap(groupConfig);
|
|
409
|
-
if (!groupMap.size || row < 0) return row;
|
|
410
|
-
|
|
411
|
-
// 加法的做法
|
|
412
|
-
var maxCount = 0;
|
|
413
|
-
var maxIndex = max;
|
|
414
|
-
for (var i = 0; i < max; i++) {
|
|
415
|
-
var _groupMap$get11, _groupMap$get12;
|
|
416
|
-
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)) {
|
|
417
|
-
continue;
|
|
418
|
-
} else {
|
|
419
|
-
maxCount++;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
if (row >= maxCount) {
|
|
423
|
-
return maxIndex;
|
|
424
|
-
}
|
|
425
|
-
maxIndex = 0;
|
|
426
|
-
var openCount = 0;
|
|
427
|
-
for (var _i2 = 0; _i2 < max; _i2++) {
|
|
428
|
-
var _groupMap$get13, _groupMap$get14;
|
|
429
|
-
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)) {
|
|
430
|
-
continue;
|
|
431
|
-
} else {
|
|
432
|
-
openCount++;
|
|
433
|
-
if (openCount >= row) {
|
|
434
|
-
maxIndex = _i2;
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
return maxIndex;
|
|
440
|
-
};
|
|
441
|
-
export var getRowHeight = function getRowHeight(container) {
|
|
442
|
-
var _container$getElement, _container$getElement2;
|
|
443
|
-
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;
|
|
444
|
-
return h;
|
|
445
|
-
};
|
|
446
|
-
export var getNextVisibleRow = function getNextVisibleRow(row, maxRow, groupMap) {
|
|
447
|
-
var _groupMap$get15, _groupMap$get16;
|
|
448
|
-
var up = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
449
|
-
if (!(groupMap !== null && groupMap !== void 0 && groupMap.size)) {
|
|
450
|
-
return row;
|
|
451
|
-
}
|
|
452
|
-
if (row > maxRow) {
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
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)) {
|
|
456
|
-
return getNextVisibleRow(row + up, maxRow, groupMap);
|
|
457
|
-
}
|
|
458
|
-
return row;
|
|
459
|
-
};
|
|
460
|
-
export var calcMenuPosition = function calcMenuPosition(_ref5) {
|
|
461
|
-
var _menuElement$getBound, _tableElement$getBoun;
|
|
462
|
-
var tableElement = _ref5.tableElement,
|
|
463
|
-
menuElement = _ref5.menuElement,
|
|
464
|
-
x = _ref5.x,
|
|
465
|
-
y = _ref5.y;
|
|
466
|
-
var top = y;
|
|
467
|
-
var left = x;
|
|
468
|
-
var _ref6 = (_menuElement$getBound = menuElement === null || menuElement === void 0 ? void 0 : menuElement.getBoundingClientRect()) !== null && _menuElement$getBound !== void 0 ? _menuElement$getBound : {},
|
|
469
|
-
menuRight = _ref6.right,
|
|
470
|
-
menuBottom = _ref6.bottom;
|
|
471
|
-
// 这里不考虑 左边和上边 因为 屏幕连一个 menu都发不下的情况应该特殊处理
|
|
472
|
-
var _ref7 = (_tableElement$getBoun = tableElement === null || tableElement === void 0 ? void 0 : tableElement.getBoundingClientRect()) !== null && _tableElement$getBoun !== void 0 ? _tableElement$getBoun : {},
|
|
473
|
-
tableBottom = _ref7.bottom,
|
|
474
|
-
tableRight = _ref7.right;
|
|
475
|
-
var _document$body = document.body,
|
|
476
|
-
clientHeight = _document$body.clientHeight,
|
|
477
|
-
clientWidth = _document$body.clientWidth;
|
|
478
|
-
var edgeRight = Math.min(tableRight, clientWidth);
|
|
479
|
-
var edgeBottom = Math.min(tableBottom, clientHeight);
|
|
480
|
-
if (menuRight > edgeRight) {
|
|
481
|
-
left = left - (menuRight - edgeRight);
|
|
482
|
-
}
|
|
483
|
-
if (menuBottom > edgeBottom) {
|
|
484
|
-
top = top - (menuBottom - edgeBottom);
|
|
485
|
-
}
|
|
486
|
-
return {
|
|
487
|
-
top: top,
|
|
488
|
-
left: left
|
|
489
|
-
};
|
|
490
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useSheetEvent } from "../../..";
|
|
2
|
-
import { Button, Divider } from 'antd';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export var BtnViewer = function BtnViewer(props) {
|
|
7
|
-
var value = props.value,
|
|
8
|
-
row = props.row,
|
|
9
|
-
record = props.record;
|
|
10
|
-
var eventBus = useSheetEvent();
|
|
11
|
-
var handleClick = useCallback(function (event) {
|
|
12
|
-
eventBus && eventBus.emit('btn-click', event);
|
|
13
|
-
}, [eventBus, row, record, value]);
|
|
14
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
15
|
-
children: [/*#__PURE__*/_jsx(Button, {
|
|
16
|
-
type: "link",
|
|
17
|
-
onClick: function onClick() {
|
|
18
|
-
return handleClick({
|
|
19
|
-
row: row,
|
|
20
|
-
type: 'copy'
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
children: "\u590D\u5236"
|
|
24
|
-
}, "copy"), /*#__PURE__*/_jsx(Divider, {
|
|
25
|
-
type: "vertical"
|
|
26
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
27
|
-
type: "link",
|
|
28
|
-
onClick: function onClick() {
|
|
29
|
-
return handleClick({
|
|
30
|
-
row: row,
|
|
31
|
-
type: 'delete'
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
children: "\u5220\u9664"
|
|
35
|
-
}, "delete")]
|
|
36
|
-
});
|
|
37
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable eqeqeq */
|
|
2
|
-
// == string 和 number 类型忽略
|
|
3
|
-
|
|
4
|
-
import { valuesTransferToLabel } from "../../util";
|
|
5
|
-
export var getCascaderViewer = function getCascaderViewer(options) {
|
|
6
|
-
var TypeViewer = function TypeViewer(props) {
|
|
7
|
-
var value = props.value;
|
|
8
|
-
return valuesTransferToLabel(options, value) || value;
|
|
9
|
-
};
|
|
10
|
-
return TypeViewer;
|
|
11
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useSheetEvent } from "../../..";
|
|
2
|
-
import { Checkbox } from 'antd';
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export var CheckViewer = function CheckViewer(props) {
|
|
6
|
-
var value = props.value,
|
|
7
|
-
row = props.row,
|
|
8
|
-
record = props.record;
|
|
9
|
-
var eventBus = useSheetEvent();
|
|
10
|
-
var handleChange = useCallback(function () {
|
|
11
|
-
if (!eventBus) return;
|
|
12
|
-
if (record !== null && record !== void 0 && record.isHeader) {
|
|
13
|
-
eventBus.emit('row-select-title', record !== null && record !== void 0 && record.indeterminate ? false : true);
|
|
14
|
-
} else {
|
|
15
|
-
eventBus.emit('row-select', row);
|
|
16
|
-
}
|
|
17
|
-
}, [eventBus, row, record, value]);
|
|
18
|
-
return /*#__PURE__*/_jsx(Checkbox, {
|
|
19
|
-
indeterminate: record === null || record === void 0 ? void 0 : record.indeterminate,
|
|
20
|
-
checked: value,
|
|
21
|
-
onChange: handleChange
|
|
22
|
-
});
|
|
23
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { EditFilled } from '@ant-design/icons';
|
|
2
|
-
import { useSheetEvent } from "../../..";
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export var EditViewer = function EditViewer(props) {
|
|
7
|
-
var value = props.value,
|
|
8
|
-
row = props.row,
|
|
9
|
-
record = props.record;
|
|
10
|
-
var eventBus = useSheetEvent();
|
|
11
|
-
var handleClick = useCallback(function () {
|
|
12
|
-
if (!eventBus) return;
|
|
13
|
-
eventBus.emit('cell-edit', {
|
|
14
|
-
row: row,
|
|
15
|
-
record: record,
|
|
16
|
-
value: value
|
|
17
|
-
});
|
|
18
|
-
}, [eventBus, row, record, value]);
|
|
19
|
-
return /*#__PURE__*/_jsxs("span", {
|
|
20
|
-
style: {
|
|
21
|
-
display: 'flex',
|
|
22
|
-
justifyContent: 'space-between',
|
|
23
|
-
color: 'green'
|
|
24
|
-
},
|
|
25
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
26
|
-
children: value
|
|
27
|
-
}), /*#__PURE__*/_jsx(EditFilled, {
|
|
28
|
-
onClick: handleClick
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
2
|
-
import { useSheetEvent } from "../../..";
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export var GroupViewer = function GroupViewer(props) {
|
|
6
|
-
var value = props.value,
|
|
7
|
-
row = props.row,
|
|
8
|
-
record = props.record;
|
|
9
|
-
var eventBus = useSheetEvent();
|
|
10
|
-
var handleChange = useCallback(function () {
|
|
11
|
-
if (!eventBus) return;
|
|
12
|
-
if (record !== null && record !== void 0 && record.isHeader) {
|
|
13
|
-
eventBus.emit('group-open-title', !(record !== null && record !== void 0 && record.open));
|
|
14
|
-
} else {
|
|
15
|
-
eventBus.emit('group-open', {
|
|
16
|
-
row: row,
|
|
17
|
-
open: record === null || record === void 0 ? void 0 : record.open
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}, [eventBus, row, record === null || record === void 0 ? void 0 : record.open]);
|
|
21
|
-
if (value) {
|
|
22
|
-
return /*#__PURE__*/_jsx("span", {
|
|
23
|
-
style: {
|
|
24
|
-
cursor: 'pointer'
|
|
25
|
-
},
|
|
26
|
-
onMouseDown: function onMouseDown(e) {
|
|
27
|
-
return e.stopPropagation();
|
|
28
|
-
},
|
|
29
|
-
onClick: handleChange,
|
|
30
|
-
children: !(record !== null && record !== void 0 && record.open) ? /*#__PURE__*/_jsx(PlusSquareOutlined, {}) : /*#__PURE__*/_jsx(MinusSquareOutlined, {})
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/_jsx("span", {});
|
|
34
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { BtnViewer } from './btnViewer';
|
|
2
|
-
export { getCascaderViewer } from './cascaderViewer';
|
|
3
|
-
export { CheckViewer } from './checkViewer';
|
|
4
|
-
export { EditViewer } from './editViewer';
|
|
5
|
-
export { GroupViewer } from './groupViewer';
|
|
6
|
-
export { getSelectorViewer } from './selectorViewer';
|
|
7
|
-
export { SwitchViewer } from './switchViewer';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { BtnViewer } from "./btnViewer";
|
|
2
|
-
export { getCascaderViewer } from "./cascaderViewer";
|
|
3
|
-
export { CheckViewer } from "./checkViewer";
|
|
4
|
-
export { EditViewer } from "./editViewer";
|
|
5
|
-
export { GroupViewer } from "./groupViewer";
|
|
6
|
-
export { getSelectorViewer } from "./selectorViewer";
|
|
7
|
-
export { SwitchViewer } from "./switchViewer";
|