@zhenliang/sheet 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/table/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
-
var _excluded = ["columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "draggable", "eventHandler"];
|
|
2
|
+
var _excluded = ["sheetInstance", "columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "handleAdd", "draggable", "eventHandler"];
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
@@ -18,6 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
20
|
import { Sheet } from "../..";
|
|
21
|
+
import { Button } from 'antd';
|
|
21
22
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
22
23
|
import { SheetEvent } from "../sheet/Event";
|
|
23
24
|
import { DraggableShell } from "../shell/draggableShell";
|
|
@@ -30,12 +31,14 @@ import { useRowSelection } from "./useRowSelection";
|
|
|
30
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
32
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
33
|
var Table = function Table(_ref) {
|
|
33
|
-
var
|
|
34
|
+
var sheetRef = _ref.sheetInstance,
|
|
35
|
+
columns = _ref.columns,
|
|
34
36
|
dataSource = _ref.dataSource,
|
|
35
37
|
rowKey = _ref.rowKey,
|
|
36
38
|
rowSelection = _ref.rowSelection,
|
|
37
39
|
groupConfig = _ref.groupConfig,
|
|
38
40
|
onChange = _ref.onChange,
|
|
41
|
+
handleAdd = _ref.handleAdd,
|
|
39
42
|
draggable = _ref.draggable,
|
|
40
43
|
eventHandler = _ref.eventHandler,
|
|
41
44
|
args = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -43,7 +46,8 @@ var Table = function Table(_ref) {
|
|
|
43
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
47
|
data = _useState2[0],
|
|
45
48
|
setData = _useState2[1];
|
|
46
|
-
var
|
|
49
|
+
var _sheetInstance = useRef(null);
|
|
50
|
+
var sheetInstance = sheetRef || _sheetInstance;
|
|
47
51
|
var hasChildren = dataSource === null || dataSource === void 0 ? void 0 : dataSource.some(function (item) {
|
|
48
52
|
var _item$children;
|
|
49
53
|
return (item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0;
|
|
@@ -307,12 +311,20 @@ var Table = function Table(_ref) {
|
|
|
307
311
|
}, "group-open-title")] : null, /*#__PURE__*/_jsx(SheetEvent, {
|
|
308
312
|
name: "reverse",
|
|
309
313
|
handler: handleReverse
|
|
310
|
-
}), Object.keys(eventHandler || {}).map(function (key) {
|
|
314
|
+
}, "_reverse"), Object.keys(eventHandler || {}).map(function (key) {
|
|
311
315
|
return /*#__PURE__*/_jsx(SheetEvent, {
|
|
312
316
|
name: key,
|
|
313
317
|
handler: eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler[key]
|
|
314
318
|
}, key);
|
|
315
|
-
})
|
|
319
|
+
}), handleAdd ? /*#__PURE__*/_jsx(Button, {
|
|
320
|
+
type: "dashed",
|
|
321
|
+
style: {
|
|
322
|
+
width: '100%',
|
|
323
|
+
height: 32
|
|
324
|
+
},
|
|
325
|
+
onClick: handleAdd,
|
|
326
|
+
children: "+ \u6DFB\u52A0"
|
|
327
|
+
}) : null]
|
|
316
328
|
}));
|
|
317
329
|
};
|
|
318
330
|
export default Table;
|
|
@@ -15,7 +15,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
15
15
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import { Modal } from 'antd';
|
|
18
|
-
import
|
|
18
|
+
import { cloneDeep, random } from 'lodash';
|
|
19
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
19
20
|
import { DateEditor, getCascaderEditor, getNumberEditor, getSelectEditor } from "../core/editor";
|
|
20
21
|
import Table from "../core/table";
|
|
21
22
|
import { BtnViewer } from "../core/viewer/btnViewer";
|
|
@@ -176,34 +177,81 @@ var App = function App() {
|
|
|
176
177
|
_useState2 = _slicedToArray(_useState, 2),
|
|
177
178
|
state = _useState2[0],
|
|
178
179
|
setState = _useState2[1];
|
|
180
|
+
var sheetInstance = useRef(null);
|
|
181
|
+
var handleChange = useCallback(function (changes) {
|
|
182
|
+
var newState = cloneDeep(state);
|
|
183
|
+
changes.forEach(function (change) {
|
|
184
|
+
var row = change.row,
|
|
185
|
+
key = change.key,
|
|
186
|
+
value = change.value;
|
|
187
|
+
newState[row][key] = value;
|
|
188
|
+
});
|
|
189
|
+
setState(newState);
|
|
190
|
+
}, [state]);
|
|
191
|
+
var handleAdd = useCallback(function () {
|
|
192
|
+
var _sheetInstance$curren;
|
|
193
|
+
var newState = cloneDeep(state);
|
|
194
|
+
(_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 ? void 0 : _sheetInstance$curren.pushToHistory({
|
|
195
|
+
type: 'NewRow',
|
|
196
|
+
changes: [],
|
|
197
|
+
rowInfo: {
|
|
198
|
+
newRow: newState.length
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
setState([].concat(_toConsumableArray(newState), [{
|
|
202
|
+
key: String(random()),
|
|
203
|
+
name: 'new',
|
|
204
|
+
open: false,
|
|
205
|
+
date: '1990-01-01',
|
|
206
|
+
address2: "\u6253\u5F00\u5BF9\u8BDD\u68462".concat(newState.length + 2),
|
|
207
|
+
age: 40 + newState.length,
|
|
208
|
+
select: '111111',
|
|
209
|
+
address: 'London Park'
|
|
210
|
+
}]));
|
|
211
|
+
}, [state]);
|
|
179
212
|
return /*#__PURE__*/_jsx(Table, {
|
|
213
|
+
sheetInstance: sheetInstance,
|
|
180
214
|
columns: columns,
|
|
181
215
|
dataSource: state,
|
|
182
216
|
scroll: {
|
|
183
217
|
x: '100%'
|
|
184
218
|
},
|
|
185
|
-
onChange:
|
|
219
|
+
onChange: handleChange,
|
|
220
|
+
handleAdd: handleAdd,
|
|
186
221
|
eventHandler: {
|
|
187
|
-
|
|
222
|
+
reverse: function reverse(value) {
|
|
223
|
+
// 处理 行列删除自定义事件
|
|
188
224
|
var _ref = value,
|
|
189
|
-
|
|
190
|
-
|
|
225
|
+
type = _ref.type,
|
|
226
|
+
rowInfo = _ref.rowInfo;
|
|
227
|
+
if (type === 'Custom') {
|
|
228
|
+
console.log('操作');
|
|
229
|
+
} else if (type === 'NewRow') {
|
|
230
|
+
var newState = _toConsumableArray(state);
|
|
231
|
+
newState.splice(rowInfo === null || rowInfo === void 0 ? void 0 : rowInfo.newRow, 1);
|
|
232
|
+
setState(newState);
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
'cell-edit': function cellEdit(value) {
|
|
236
|
+
var _ref2 = value,
|
|
237
|
+
row = _ref2.row,
|
|
238
|
+
cellValue = _ref2.value;
|
|
191
239
|
Modal.confirm({
|
|
192
240
|
title: "".concat(row, " - ").concat(cellValue, "\u7F16\u8F91\u70B9\u4EC0\u4E48")
|
|
193
241
|
});
|
|
194
242
|
},
|
|
195
243
|
'btn-click': function btnClick(value) {
|
|
196
|
-
var
|
|
197
|
-
row =
|
|
198
|
-
type =
|
|
244
|
+
var _ref3 = value,
|
|
245
|
+
row = _ref3.row,
|
|
246
|
+
type = _ref3.type;
|
|
199
247
|
Modal.confirm({
|
|
200
248
|
title: "".concat(row, " - ").concat(type, "\u63D0\u793A\u70B9\u4EC0\u4E48")
|
|
201
249
|
});
|
|
202
250
|
},
|
|
203
251
|
'cell-switch': function cellSwitch(value) {
|
|
204
|
-
var
|
|
205
|
-
row =
|
|
206
|
-
cellValue =
|
|
252
|
+
var _ref4 = value,
|
|
253
|
+
row = _ref4.row,
|
|
254
|
+
cellValue = _ref4.value;
|
|
207
255
|
var newState = _toConsumableArray(state);
|
|
208
256
|
newState[row] = _objectSpread(_objectSpread({}, newState[row]), {}, {
|
|
209
257
|
open: !cellValue
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
|
+
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
|
+
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { getNumberEditor, getSelectEditor, Table } from "./..";
|
|
8
|
+
import { useCallback, useState } from 'react';
|
|
9
|
+
import { SwitchViewer } from "../core/viewer";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
var RateValueInput = getNumberEditor({
|
|
12
|
+
addonAfter: '%',
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 100
|
|
15
|
+
});
|
|
16
|
+
var ValueInput = getNumberEditor({
|
|
17
|
+
min: 0,
|
|
18
|
+
max: 100000000
|
|
19
|
+
});
|
|
20
|
+
var RateViewer = function RateViewer(props) {
|
|
21
|
+
var value = props.value;
|
|
22
|
+
return /*#__PURE__*/_jsx("span", {
|
|
23
|
+
children: value ? value + '%' : '-'
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var data = [{
|
|
27
|
+
id: 2443,
|
|
28
|
+
draftId: '101601',
|
|
29
|
+
valuationType: 2,
|
|
30
|
+
termDiscountRate: null,
|
|
31
|
+
reversionDiscountRate: null,
|
|
32
|
+
vacancyDiscountRate: null,
|
|
33
|
+
discountRate: 8.5,
|
|
34
|
+
exitCapRate: 4.5,
|
|
35
|
+
gfaUnitPrice: 107350.31545913525,
|
|
36
|
+
nlaUnitPrice: 90130.38038659678,
|
|
37
|
+
totalValuation: 1622707368.4802885,
|
|
38
|
+
isEnabled: true
|
|
39
|
+
}, {
|
|
40
|
+
id: 2444,
|
|
41
|
+
draftId: '101601',
|
|
42
|
+
valuationType: 5,
|
|
43
|
+
termDiscountRate: 4.5,
|
|
44
|
+
reversionDiscountRate: 5.5,
|
|
45
|
+
vacancyDiscountRate: 5.5,
|
|
46
|
+
discountRate: null,
|
|
47
|
+
exitCapRate: null,
|
|
48
|
+
gfaUnitPrice: 89327.04427210477,
|
|
49
|
+
nlaUnitPrice: 89327.04427210477,
|
|
50
|
+
totalValuation: 1429232708.3536763,
|
|
51
|
+
isEnabled: false
|
|
52
|
+
}];
|
|
53
|
+
export default (function () {
|
|
54
|
+
var evaluateMethods = [{
|
|
55
|
+
label: 'DCF',
|
|
56
|
+
value: 2
|
|
57
|
+
}, {
|
|
58
|
+
label: 'T&R',
|
|
59
|
+
value: 5
|
|
60
|
+
}];
|
|
61
|
+
var _useState = useState(data),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
63
|
+
state = _useState2[0];
|
|
64
|
+
var columns = [{
|
|
65
|
+
title: '默认使用',
|
|
66
|
+
dataIndex: 'isEnabled',
|
|
67
|
+
width: 66,
|
|
68
|
+
// cellType: 'operate',
|
|
69
|
+
readonly: function readonly(value, record) {
|
|
70
|
+
return !!record.valuationType;
|
|
71
|
+
},
|
|
72
|
+
render: SwitchViewer
|
|
73
|
+
// component: (record: any, row: number, col: number) => (
|
|
74
|
+
// <Switch
|
|
75
|
+
// disabled={isNil(record.valuationType)}
|
|
76
|
+
// checked={record.isEnabled}
|
|
77
|
+
// onChange={handleSwitchChange(record, row)}
|
|
78
|
+
// />
|
|
79
|
+
// ),
|
|
80
|
+
}, {
|
|
81
|
+
title: '评估方法',
|
|
82
|
+
dataIndex: 'valuationType',
|
|
83
|
+
width: 134,
|
|
84
|
+
readonly: function readonly(value, record, row) {
|
|
85
|
+
return !row;
|
|
86
|
+
},
|
|
87
|
+
render: function (props) {
|
|
88
|
+
var _evaluateMethods$find;
|
|
89
|
+
return /*#__PURE__*/_jsx("span", {
|
|
90
|
+
children: (_evaluateMethods$find = evaluateMethods.find(function (item) {
|
|
91
|
+
return item.value === props.value;
|
|
92
|
+
})) === null || _evaluateMethods$find === void 0 ? void 0 : _evaluateMethods$find.label
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
editor: getSelectEditor(evaluateMethods)
|
|
96
|
+
// calcReadOnly: (record, rowIndex) => !rowIndex,
|
|
97
|
+
// getSelectOptions: (record: any) => {
|
|
98
|
+
// if (record.valuationType === 2) {
|
|
99
|
+
// return evaluateMethods.slice(0, 1);
|
|
100
|
+
// }
|
|
101
|
+
// return evaluateMethods.slice(1);
|
|
102
|
+
// },
|
|
103
|
+
}, {
|
|
104
|
+
title: '租期内折现率',
|
|
105
|
+
dataIndex: 'termDiscountRate',
|
|
106
|
+
width: 134,
|
|
107
|
+
editor: RateValueInput,
|
|
108
|
+
viewer: RateViewer,
|
|
109
|
+
readonly: function readonly(value, record, row) {
|
|
110
|
+
return !row || isNil(record.valuationType);
|
|
111
|
+
}
|
|
112
|
+
// calcReadOnly: (record, rowIndex) => !rowIndex || isNil(record.valuationType),
|
|
113
|
+
}, {
|
|
114
|
+
title: '租期外折现率',
|
|
115
|
+
dataIndex: 'reversionDiscountRate',
|
|
116
|
+
width: 134,
|
|
117
|
+
viewer: RateViewer,
|
|
118
|
+
editor: RateValueInput,
|
|
119
|
+
readonly: function readonly(value, record, row) {
|
|
120
|
+
return !row || isNil(record.valuationType);
|
|
121
|
+
}
|
|
122
|
+
}, {
|
|
123
|
+
title: '空置面积折现率',
|
|
124
|
+
dataIndex: 'vacancyDiscountRate',
|
|
125
|
+
width: 134,
|
|
126
|
+
viewer: RateViewer,
|
|
127
|
+
editor: RateValueInput,
|
|
128
|
+
readonly: function readonly(value, record, row) {
|
|
129
|
+
return !row || isNil(record.valuationType);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
title: '折现率',
|
|
133
|
+
dataIndex: 'discountRate',
|
|
134
|
+
width: 134,
|
|
135
|
+
viewer: RateViewer,
|
|
136
|
+
editor: RateValueInput,
|
|
137
|
+
readonly: function readonly(value, record, row) {
|
|
138
|
+
return !row || isNil(record.valuationType);
|
|
139
|
+
}
|
|
140
|
+
}, {
|
|
141
|
+
title: '退出资本化率',
|
|
142
|
+
dataIndex: 'exitCapRate',
|
|
143
|
+
width: 134,
|
|
144
|
+
viewer: RateViewer,
|
|
145
|
+
editor: RateValueInput,
|
|
146
|
+
readonly: function readonly(value, record, row) {
|
|
147
|
+
return !row || isNil(record.valuationType);
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
title: '估值单价/GFA',
|
|
151
|
+
dataIndex: 'gfaUnitPrice',
|
|
152
|
+
width: 134,
|
|
153
|
+
editor: ValueInput,
|
|
154
|
+
readonly: true
|
|
155
|
+
}, {
|
|
156
|
+
title: '估值单价/NLA',
|
|
157
|
+
dataIndex: 'nlaUnitPrice',
|
|
158
|
+
width: 134,
|
|
159
|
+
editor: ValueInput,
|
|
160
|
+
readonly: true
|
|
161
|
+
}, {
|
|
162
|
+
title: '估值',
|
|
163
|
+
dataIndex: 'totalValuation',
|
|
164
|
+
width: 134,
|
|
165
|
+
editor: ValueInput,
|
|
166
|
+
readonly: true
|
|
167
|
+
}, {
|
|
168
|
+
title: '操作',
|
|
169
|
+
width: 62,
|
|
170
|
+
dataIndex: 'id',
|
|
171
|
+
cellType: 'operate',
|
|
172
|
+
editable: false,
|
|
173
|
+
render: function (props) {
|
|
174
|
+
var row = props.row,
|
|
175
|
+
record = props.record;
|
|
176
|
+
if (row) {
|
|
177
|
+
return /*#__PURE__*/_jsx("div", {
|
|
178
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
179
|
+
type: "link",
|
|
180
|
+
onClick: function onClick() {
|
|
181
|
+
handleDelete(record.id);
|
|
182
|
+
// const infos = [{ id: record.id, row, extra: record }];
|
|
183
|
+
// operateCb && operateCb(4, { row, infos });
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
size: "small",
|
|
187
|
+
children: "\u5220\u9664"
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return /*#__PURE__*/_jsx("div", {
|
|
192
|
+
className: "value-viewer number-value-viewer"
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// component: (record: any, row: number, col: number, operateCb?: ExcelTableType.OperateCollector) => {
|
|
197
|
+
// if (row) {
|
|
198
|
+
// return (
|
|
199
|
+
// <div>
|
|
200
|
+
// <Button
|
|
201
|
+
// type="link"
|
|
202
|
+
// onClick={() => {
|
|
203
|
+
// handleDelete(record.id);
|
|
204
|
+
// const infos = [{ id: record.id, row, extra: record }];
|
|
205
|
+
// operateCb && operateCb(4, { row, infos });
|
|
206
|
+
// }}
|
|
207
|
+
// size="small"
|
|
208
|
+
// >
|
|
209
|
+
// 删除
|
|
210
|
+
// </Button>
|
|
211
|
+
// </div>
|
|
212
|
+
// );
|
|
213
|
+
// }
|
|
214
|
+
// return <div className="value-viewer number-value-viewer" />;
|
|
215
|
+
// },
|
|
216
|
+
}];
|
|
217
|
+
|
|
218
|
+
var handleChange = useCallback(function () {}, [state]);
|
|
219
|
+
return /*#__PURE__*/_jsx(Table, {
|
|
220
|
+
columns: columns,
|
|
221
|
+
dataSource: state,
|
|
222
|
+
onChange: handleChange
|
|
223
|
+
});
|
|
224
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { SheetType } from '.';
|
|
2
3
|
export declare type refAssertion = {
|
|
3
4
|
contains?: (target: EventTarget | null) => boolean;
|
|
@@ -31,6 +32,7 @@ export declare type TableGroupConfig = {
|
|
|
31
32
|
};
|
|
32
33
|
export declare type TableProps = {
|
|
33
34
|
className?: string;
|
|
35
|
+
sheetInstance?: React.MutableRefObject<SheetType.SheetInstance | null>;
|
|
34
36
|
columns: ColumnProps[];
|
|
35
37
|
virtualized?: boolean;
|
|
36
38
|
dataSource: Record<string, unknown>[];
|
|
@@ -51,5 +53,6 @@ export declare type TableProps = {
|
|
|
51
53
|
onChange: (value: TableGroupConfig) => void;
|
|
52
54
|
};
|
|
53
55
|
onChange: (changes: TableChange[]) => void;
|
|
56
|
+
handleAdd?: () => void;
|
|
54
57
|
eventHandler?: Record<'btn-click' | 'cell-edit' | 'cell-switch' | string, undefined | ((value: unknown) => void)>;
|
|
55
58
|
};
|