@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.
Files changed (137) hide show
  1. package/changes.md +45 -0
  2. package/package.json +1 -1
  3. package/dist/core/config.d.ts +0 -13
  4. package/dist/core/config.js +0 -13
  5. package/dist/core/editor/cascaderEditor/index.d.ts +0 -5
  6. package/dist/core/editor/cascaderEditor/index.js +0 -54
  7. package/dist/core/editor/cascaderEditor/index.less +0 -28
  8. package/dist/core/editor/dateEditor/index.d.ts +0 -5
  9. package/dist/core/editor/dateEditor/index.js +0 -55
  10. package/dist/core/editor/dateEditor/index.less +0 -11
  11. package/dist/core/editor/index.d.ts +0 -4
  12. package/dist/core/editor/index.js +0 -4
  13. package/dist/core/editor/numberEditor/index.d.ts +0 -8
  14. package/dist/core/editor/numberEditor/index.js +0 -107
  15. package/dist/core/editor/numberEditor/index.less +0 -30
  16. package/dist/core/editor/selectEditor/index.d.ts +0 -6
  17. package/dist/core/editor/selectEditor/index.js +0 -96
  18. package/dist/core/editor/selectEditor/index.less +0 -43
  19. package/dist/core/reducers/index.d.ts +0 -9
  20. package/dist/core/reducers/index.js +0 -38
  21. package/dist/core/reducers/keyboardReducer.d.ts +0 -2
  22. package/dist/core/reducers/keyboardReducer.js +0 -93
  23. package/dist/core/reducers/mouseReducer.d.ts +0 -2
  24. package/dist/core/reducers/mouseReducer.js +0 -164
  25. package/dist/core/reducers/sideEffectReducer.d.ts +0 -4
  26. package/dist/core/reducers/sideEffectReducer.js +0 -378
  27. package/dist/core/reducers/stateReducer.d.ts +0 -2
  28. package/dist/core/reducers/stateReducer.js +0 -174
  29. package/dist/core/sheet/Cell.d.ts +0 -4
  30. package/dist/core/sheet/Cell.js +0 -181
  31. package/dist/core/sheet/DataEditor.d.ts +0 -3
  32. package/dist/core/sheet/DataEditor.js +0 -24
  33. package/dist/core/sheet/DefaultCell.d.ts +0 -11
  34. package/dist/core/sheet/DefaultCell.js +0 -31
  35. package/dist/core/sheet/DefaultRow.d.ts +0 -12
  36. package/dist/core/sheet/DefaultRow.js +0 -28
  37. package/dist/core/sheet/DefaultRowMapper.d.ts +0 -8
  38. package/dist/core/sheet/DefaultRowMapper.js +0 -15
  39. package/dist/core/sheet/DefaultShell.d.ts +0 -8
  40. package/dist/core/sheet/DefaultShell.js +0 -12
  41. package/dist/core/sheet/Event.d.ts +0 -5
  42. package/dist/core/sheet/Event.js +0 -17
  43. package/dist/core/sheet/ValueViewer.d.ts +0 -3
  44. package/dist/core/sheet/ValueViewer.js +0 -9
  45. package/dist/core/sheet/index.d.ts +0 -5
  46. package/dist/core/sheet/index.js +0 -265
  47. package/dist/core/sheet/index.less +0 -307
  48. package/dist/core/sheet/useCellEvent.d.ts +0 -3
  49. package/dist/core/sheet/useCellEvent.js +0 -22
  50. package/dist/core/sheet/useContextMenu.d.ts +0 -21
  51. package/dist/core/sheet/useContextMenu.js +0 -86
  52. package/dist/core/sheet/useKeyBoardEvent.d.ts +0 -3
  53. package/dist/core/sheet/useKeyBoardEvent.js +0 -66
  54. package/dist/core/sheet/useMouseEvent.d.ts +0 -3
  55. package/dist/core/sheet/useMouseEvent.js +0 -298
  56. package/dist/core/sheet/useSelectVisible.d.ts +0 -2
  57. package/dist/core/sheet/useSelectVisible.js +0 -57
  58. package/dist/core/sheet/useVirtualList.d.ts +0 -7
  59. package/dist/core/sheet/useVirtualList.js +0 -103
  60. package/dist/core/sheet/var.less +0 -41
  61. package/dist/core/shell/draggableShell/index.d.ts +0 -5
  62. package/dist/core/shell/draggableShell/index.js +0 -197
  63. package/dist/core/shell/draggableShell/index.less +0 -16
  64. package/dist/core/shell/tableShell.d.ts +0 -5
  65. package/dist/core/shell/tableShell.js +0 -109
  66. package/dist/core/table/events.d.ts +0 -15
  67. package/dist/core/table/events.js +0 -95
  68. package/dist/core/table/index.d.ts +0 -4
  69. package/dist/core/table/index.js +0 -313
  70. package/dist/core/table/useGroupConfig.d.ts +0 -2
  71. package/dist/core/table/useGroupConfig.js +0 -65
  72. package/dist/core/table/useRowSelection.d.ts +0 -2
  73. package/dist/core/table/useRowSelection.js +0 -24
  74. package/dist/core/table/util.d.ts +0 -8
  75. package/dist/core/table/util.js +0 -29
  76. package/dist/core/util.d.ts +0 -59
  77. package/dist/core/util.js +0 -490
  78. package/dist/core/viewer/btnViewer/index.d.ts +0 -2
  79. package/dist/core/viewer/btnViewer/index.js +0 -37
  80. package/dist/core/viewer/cascaderViewer/index.d.ts +0 -2
  81. package/dist/core/viewer/cascaderViewer/index.js +0 -11
  82. package/dist/core/viewer/checkViewer/index.d.ts +0 -2
  83. package/dist/core/viewer/checkViewer/index.js +0 -23
  84. package/dist/core/viewer/editViewer/index.d.ts +0 -2
  85. package/dist/core/viewer/editViewer/index.js +0 -31
  86. package/dist/core/viewer/groupViewer/index.d.ts +0 -2
  87. package/dist/core/viewer/groupViewer/index.js +0 -34
  88. package/dist/core/viewer/index.d.ts +0 -7
  89. package/dist/core/viewer/index.js +0 -7
  90. package/dist/core/viewer/selectorViewer/index.d.ts +0 -2
  91. package/dist/core/viewer/selectorViewer/index.js +0 -16
  92. package/dist/core/viewer/switchViewer/index.d.ts +0 -2
  93. package/dist/core/viewer/switchViewer/index.js +0 -22
  94. package/dist/example/antComponent.d.ts +0 -3
  95. package/dist/example/antComponent.js +0 -314
  96. package/dist/example/basic.d.ts +0 -4
  97. package/dist/example/basic.js +0 -121
  98. package/dist/example/ellipsis.d.ts +0 -3
  99. package/dist/example/ellipsis.js +0 -64
  100. package/dist/example/fixed.d.ts +0 -3
  101. package/dist/example/fixed.js +0 -89
  102. package/dist/example/group.d.ts +0 -3
  103. package/dist/example/group.js +0 -123
  104. package/dist/example/index.less +0 -5
  105. package/dist/example/selection.d.ts +0 -4
  106. package/dist/example/selection.js +0 -86
  107. package/dist/example/sheet.d.ts +0 -4
  108. package/dist/example/sheet.js +0 -393
  109. package/dist/example/valuationAnalyze.d.ts +0 -2
  110. package/dist/example/valuationAnalyze.js +0 -227
  111. package/dist/hooks/index.d.ts +0 -8
  112. package/dist/hooks/index.js +0 -7
  113. package/dist/hooks/useEventBus.d.ts +0 -4
  114. package/dist/hooks/useEventBus.js +0 -17
  115. package/dist/hooks/useKeyboard.d.ts +0 -18
  116. package/dist/hooks/useKeyboard.js +0 -108
  117. package/dist/hooks/useMiddlewareReducer.d.ts +0 -12
  118. package/dist/hooks/useMiddlewareReducer.js +0 -47
  119. package/dist/hooks/useMouse.d.ts +0 -11
  120. package/dist/hooks/useMouse.js +0 -68
  121. package/dist/hooks/useSetState.d.ts +0 -2
  122. package/dist/hooks/useSetState.js +0 -27
  123. package/dist/hooks/useSheetEvent.d.ts +0 -5
  124. package/dist/hooks/useSheetEvent.js +0 -5
  125. package/dist/hooks/useWidthConfig.d.ts +0 -4
  126. package/dist/hooks/useWidthConfig.js +0 -5
  127. package/dist/index.d.ts +0 -8
  128. package/dist/index.js +0 -8
  129. package/dist/standardUtils/index.d.ts +0 -9
  130. package/dist/standardUtils/index.js +0 -32
  131. package/dist/type/index.d.ts +0 -2
  132. package/dist/type/index.js +0 -4
  133. package/dist/type/sheet.d.ts +0 -205
  134. package/dist/type/sheet.js +0 -9
  135. package/dist/type/sheetTable.d.ts +0 -89
  136. package/dist/type/sheetTable.js +0 -1
  137. package/dist/typings/index.d.ts +0 -1
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /* eslint-disable eqeqeq */
3
- // == string 和 number 类型忽略
4
-
5
- export var getSelectorViewer = function getSelectorViewer(options) {
6
- var TypeViewer = function TypeViewer(props) {
7
- var _options$find;
8
- return /*#__PURE__*/_jsx("span", {
9
- className: "value-viewer",
10
- children: ((_options$find = options.find(function (item) {
11
- return item.label === props.value || "".concat(item.value) === "".concat(props.value);
12
- })) === null || _options$find === void 0 ? void 0 : _options$find.label) || null
13
- });
14
- };
15
- return TypeViewer;
16
- };
@@ -1,2 +0,0 @@
1
- import type { SheetType } from "../../../type";
2
- export declare const SwitchViewer: SheetType.CellViewer;
@@ -1,22 +0,0 @@
1
- import { useSheetEvent } from "../../..";
2
- import { Switch } from 'antd';
3
- import { useCallback } from 'react';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- export var SwitchViewer = function SwitchViewer(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
- eventBus.emit('cell-switch', {
13
- row: row,
14
- record: record,
15
- value: !value
16
- });
17
- }, [eventBus, row, record, value]);
18
- return /*#__PURE__*/_jsx(Switch, {
19
- checked: value,
20
- onChange: handleChange
21
- });
22
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const App: React.FC;
3
- export default App;
@@ -1,314 +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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- 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."); }
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- 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."); }
13
- 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); }
14
- 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; }
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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import { Button, Modal } from 'antd';
18
- import { cloneDeep, random } from 'lodash';
19
- import React, { useCallback, useMemo, useRef, useState } from 'react';
20
- import { getCascaderEditor, getDateEditor, getNumberEditor, getSelectEditor } from "../core/editor";
21
- import Table from "../core/table";
22
- import { getSelectorViewer } from "../core/viewer";
23
- import { BtnViewer } from "../core/viewer/btnViewer";
24
- import { getCascaderViewer } from "../core/viewer/cascaderViewer";
25
- import { EditViewer } from "../core/viewer/editViewer";
26
- import { SwitchViewer } from "../core/viewer/switchViewer";
27
- import { SheetType } from "../type";
28
- import { jsx as _jsx } from "react/jsx-runtime";
29
- var Precision2MoneyEditor = getNumberEditor({
30
- max: 1000,
31
- min: 0,
32
- precision: 2,
33
- addonAfter: '元'
34
- });
35
- var Precision2Number = getNumberEditor({
36
- max: 1000,
37
- min: 0,
38
- precision: 2
39
- });
40
- var SelectorOptions = [{
41
- value: '1',
42
- label: '111111'
43
- }, {
44
- value: '2',
45
- label: '222222'
46
- }, {
47
- value: '3',
48
- label: '333333'
49
- }];
50
- var getTypeViewer = function getTypeViewer(options) {
51
- var TypeViewer = function TypeViewer(props) {
52
- var _options$find;
53
- console.log('getTypeViewer', options);
54
- return (_options$find = options.find(function (item) {
55
- return item.label === props.value || item.value == props.value;
56
- })) === null || _options$find === void 0 ? void 0 : _options$find.label;
57
- };
58
- return TypeViewer;
59
- };
60
- var cascaderOptions = [{
61
- value: 'zhejiang',
62
- label: 'Zhejiang',
63
- children: [{
64
- value: 'hangzhou',
65
- label: 'Hangzhou',
66
- children: [{
67
- value: 'xihu',
68
- label: 'West Lake'
69
- }]
70
- }]
71
- }, {
72
- value: 'jiangsu',
73
- label: 'Jiangsu',
74
- children: [{
75
- value: 'nanjing',
76
- label: 'Nanjing',
77
- children: [{
78
- value: 'zhonghuamen',
79
- label: 'Zhong Hua Men'
80
- }]
81
- }]
82
- }];
83
- var CascaderViewer = getCascaderViewer(cascaderOptions);
84
- var CascaderSelector = getCascaderEditor(cascaderOptions);
85
- var columns = [{
86
- title: 'Full Name',
87
- width: 100,
88
- dataIndex: 'open',
89
- key: 'open',
90
- fixed: 'left',
91
- render: SwitchViewer
92
- }, {
93
- title: 'Age',
94
- width: 100,
95
- dataIndex: 'age',
96
- key: 'age',
97
- editor: Precision2Number,
98
- readonly: function readonly(value, record, row) {
99
- return row === 1;
100
- }
101
- // fixed: 'left',
102
- }, {
103
- title: 'price',
104
- width: 100,
105
- dataIndex: 'price',
106
- key: 'price',
107
- editor: Precision2MoneyEditor,
108
- readonly: function readonly(value, record, row) {
109
- return row === 1;
110
- }
111
- // fixed: 'left',
112
- }, {
113
- title: 'date',
114
- width: 150,
115
- dataIndex: 'date',
116
- key: 'date',
117
- editor: getDateEditor()
118
- // fixed: 'left',
119
- }, {
120
- title: 'select',
121
- width: 200,
122
- dataIndex: 'select',
123
- render: getSelectorViewer(SelectorOptions),
124
- editor: getSelectEditor(SelectorOptions, 'label')
125
- }, {
126
- title: 'Column 2',
127
- width: 200,
128
- titleConfig: {
129
- colSpan: 2
130
- },
131
- dataIndex: 'address1',
132
- align: SheetType.CellAlign.center,
133
- key: '2',
134
- render: CascaderViewer,
135
- editor: CascaderSelector
136
- }, {
137
- title: 'Column 3',
138
- width: 200,
139
- titleConfig: {
140
- colSpan: 0
141
- },
142
- dataIndex: 'address2',
143
- key: '3',
144
- editable: false,
145
- render: EditViewer
146
- }, {
147
- title: 'Column 4',
148
- width: 200,
149
- dataIndex: 'address3',
150
- key: '4'
151
- }, {
152
- title: 'Column 5',
153
- width: 200,
154
- dataIndex: 'address4',
155
- key: '5'
156
- }, {
157
- title: 'Column 6',
158
- width: 200,
159
- dataIndex: 'address5',
160
- key: '6'
161
- }, {
162
- title: 'Column 7',
163
- width: 200,
164
- dataIndex: 'address6',
165
- key: '7'
166
- }, {
167
- title: 'Column 8',
168
- width: 200,
169
- dataIndex: 'address7',
170
- key: '8'
171
- }, {
172
- title: 'Action',
173
- align: SheetType.CellAlign.center,
174
- key: 'operation',
175
- fixed: 'right',
176
- width: 150,
177
- render: BtnViewer
178
- }];
179
- var data = [{
180
- key: '1',
181
- name: 'John Brown',
182
- date: '2020-01-01',
183
- open: true,
184
- age: 32,
185
- address1: 'West Lake',
186
- address2: '打开对话框1',
187
- select: '111111',
188
- address: 'New York Park'
189
- }, {
190
- key: '2',
191
- name: 'Jim Green',
192
- open: false,
193
- date: '1990-01-01',
194
- address2: '打开对话框2',
195
- age: 40,
196
- select: '222222',
197
- address: 'London Park'
198
- }];
199
- var App = function App() {
200
- var _useState = useState(data),
201
- _useState2 = _slicedToArray(_useState, 2),
202
- state = _useState2[0],
203
- setState = _useState2[1];
204
- var _useState3 = useState(SelectorOptions),
205
- _useState4 = _slicedToArray(_useState3, 2),
206
- options = _useState4[0],
207
- setOptions = _useState4[1];
208
- var sheetInstance = useRef(null);
209
- var handleChange = useCallback(function (changes, extChange) {
210
- console.log(extChange);
211
- var newState = cloneDeep(state);
212
- changes.forEach(function (change) {
213
- var row = change.row,
214
- key = change.key,
215
- value = change.value;
216
- newState[row][key] = value;
217
- });
218
- setState(newState);
219
- }, [state]);
220
- var handleAdd = useCallback(function () {
221
- var _sheetInstance$curren;
222
- var newState = cloneDeep(state);
223
- (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 ? void 0 : _sheetInstance$curren.pushToHistory({
224
- type: 'NewRow',
225
- changes: [],
226
- rowInfo: {
227
- newRow: newState.length
228
- }
229
- });
230
- setState([].concat(_toConsumableArray(newState), [{
231
- key: String(random()),
232
- name: 'new',
233
- open: false,
234
- date: '1990-01-01',
235
- address2: "\u6253\u5F00\u5BF9\u8BDD\u68462".concat(newState.length + 2),
236
- age: 40 + newState.length,
237
- select: '111111',
238
- address: 'London Park'
239
- }]));
240
- }, [state]);
241
- var handleOptionsAdd = useCallback(function () {
242
- setOptions([].concat(_toConsumableArray(options), [{
243
- label: String("newSelect".concat(random(false))),
244
- value: String(random(true))
245
- }]));
246
- }, [options]);
247
- var antColumns = useMemo(function () {
248
- var newColumns = [].concat(columns);
249
- newColumns[4] = _objectSpread(_objectSpread({}, columns[4]), {}, {
250
- render: getTypeViewer(options),
251
- editor: getSelectEditor(options, 'value', /*#__PURE__*/_jsx(Button, {
252
- id: "antColumnAdd",
253
- type: "link",
254
- onClick: handleOptionsAdd,
255
- children: "\u65B0\u589E"
256
- }))
257
- });
258
- return newColumns;
259
- }, [options]);
260
- return /*#__PURE__*/_jsx(Table, {
261
- freePaste: true,
262
- draggable: true,
263
- sheetInstance: sheetInstance,
264
- columns: antColumns,
265
- dataSource: state,
266
- scroll: {
267
- x: '100%'
268
- },
269
- onChange: handleChange,
270
- handleAdd: handleAdd,
271
- eventHandler: {
272
- reverse: function reverse(value) {
273
- // 处理 行列删除自定义事件
274
- var _ref = value,
275
- type = _ref.type,
276
- rowInfo = _ref.rowInfo;
277
- if (type === 'Custom') {
278
- console.log('操作');
279
- } else if (type === 'NewRow') {
280
- var newState = _toConsumableArray(state);
281
- newState.splice(rowInfo === null || rowInfo === void 0 ? void 0 : rowInfo.newRow, 1);
282
- setState(newState);
283
- }
284
- },
285
- 'cell-edit': function cellEdit(value) {
286
- var _ref2 = value,
287
- row = _ref2.row,
288
- cellValue = _ref2.value;
289
- Modal.confirm({
290
- title: "".concat(row, " - ").concat(cellValue, "\u7F16\u8F91\u70B9\u4EC0\u4E48")
291
- });
292
- },
293
- 'btn-click': function btnClick(value) {
294
- var _ref3 = value,
295
- row = _ref3.row,
296
- type = _ref3.type;
297
- Modal.confirm({
298
- title: "".concat(row, " - ").concat(type, "\u63D0\u793A\u70B9\u4EC0\u4E48")
299
- });
300
- },
301
- 'cell-switch': function cellSwitch(value) {
302
- var _ref4 = value,
303
- row = _ref4.row,
304
- cellValue = _ref4.value;
305
- var newState = _toConsumableArray(state);
306
- newState[row] = _objectSpread(_objectSpread({}, newState[row]), {}, {
307
- open: !cellValue
308
- });
309
- setState(newState);
310
- }
311
- }
312
- });
313
- };
314
- export default App;
@@ -1,4 +0,0 @@
1
- import 'antd/dist/antd.css';
2
- import React from 'react';
3
- declare const App: React.FC;
4
- export default App;
@@ -1,121 +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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- 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."); }
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- 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."); }
13
- 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); }
14
- 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; }
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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- import { Table } from "./..";
18
- import { Space, Tag } from 'antd';
19
- import 'antd/dist/antd.css';
20
- import React, { useCallback, useState } from 'react';
21
- import { jsx as _jsx } from "react/jsx-runtime";
22
- import { Fragment as _Fragment } from "react/jsx-runtime";
23
- import { jsxs as _jsxs } from "react/jsx-runtime";
24
- var columns = [{
25
- title: 'Name',
26
- dataIndex: 'name',
27
- key: 'name',
28
- editable: false,
29
- render: function render(_ref) {
30
- var value = _ref.value;
31
- return /*#__PURE__*/_jsx("a", {
32
- children: value
33
- });
34
- }
35
- }, {
36
- title: 'Age',
37
- dataIndex: 'age',
38
- key: 'age'
39
- }, {
40
- title: 'Address',
41
- editable: false,
42
- dataIndex: 'address',
43
- key: 'address'
44
- }, {
45
- title: 'Tags',
46
- key: 'tags',
47
- dataIndex: 'tags',
48
- render: function render(_ref2) {
49
- var tags = _ref2.record.tags;
50
- return /*#__PURE__*/_jsx(_Fragment, {
51
- children: tags === null || tags === void 0 ? void 0 : tags.map(function (tag) {
52
- var color = tag.length > 5 ? 'geekblue' : 'green';
53
- if (tag === 'loser') {
54
- color = 'volcano';
55
- }
56
- return /*#__PURE__*/_jsx(Tag, {
57
- color: color,
58
- children: tag.toUpperCase()
59
- }, tag);
60
- })
61
- });
62
- }
63
- }, {
64
- title: 'Action',
65
- key: 'action',
66
- editable: false,
67
- render: function render(_ref3) {
68
- var record = _ref3.record;
69
- return /*#__PURE__*/_jsxs(Space, {
70
- size: "middle",
71
- children: [/*#__PURE__*/_jsxs("a", {
72
- children: ["Invite ", record.name]
73
- }), /*#__PURE__*/_jsx("a", {
74
- children: "Delete"
75
- })]
76
- });
77
- }
78
- }];
79
- var data = [{
80
- key: '1',
81
- name: 'John Brown',
82
- age: 32,
83
- address: 'New York No. 1 Lake Park',
84
- tags: ['nice', 'developer']
85
- }, {
86
- key: '2',
87
- name: 'Jim Green',
88
- age: 42,
89
- address: 'London No. 1 Lake Park',
90
- tags: ['loser']
91
- }, {
92
- key: '3',
93
- name: 'Joe Black',
94
- age: 32,
95
- address: 'Sidney No. 1 Lake Park',
96
- tags: ['cool', 'teacher']
97
- }];
98
- var App = function App() {
99
- var _useState = useState(data),
100
- _useState2 = _slicedToArray(_useState, 2),
101
- dataSource = _useState2[0],
102
- setData = _useState2[1];
103
- var onChange = useCallback(function (changes) {
104
- var newData = _toConsumableArray(dataSource);
105
- changes.forEach(function (_ref4) {
106
- var _String;
107
- var row = _ref4.row,
108
- key = _ref4.key,
109
- value = _ref4.value;
110
- newData[row] = _objectSpread(_objectSpread({}, newData[row]), {}, _defineProperty({}, key, key === 'tags' ? (_String = String(value)) === null || _String === void 0 ? void 0 : _String.split(',') : value));
111
- });
112
- setData(newData);
113
- }, [dataSource]);
114
- return /*#__PURE__*/_jsx(Table, {
115
- draggable: true,
116
- columns: columns,
117
- dataSource: dataSource,
118
- onChange: onChange
119
- });
120
- };
121
- export default App;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const App: React.FC;
3
- export default App;
@@ -1,64 +0,0 @@
1
- import React from 'react';
2
- import Table from "../core/table";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- var columns = [{
5
- title: 'Name',
6
- dataIndex: 'name',
7
- key: 'name',
8
- render: function render(_ref) {
9
- var value = _ref.value;
10
- return /*#__PURE__*/_jsx("a", {
11
- children: value
12
- });
13
- },
14
- width: 150
15
- }, {
16
- title: 'Age',
17
- dataIndex: 'age',
18
- key: 'age',
19
- width: 80
20
- }, {
21
- title: 'Address',
22
- dataIndex: 'address',
23
- key: 'address 1'
24
- }, {
25
- title: 'Long Column',
26
- dataIndex: 'address',
27
- key: 'address 2'
28
- }, {
29
- title: 'Long Column Long Column',
30
- dataIndex: 'address',
31
- key: 'address 3'
32
- }, {
33
- title: 'Long Column',
34
- dataIndex: 'address',
35
- key: 'address 4'
36
- }];
37
- var data = [{
38
- key: '1',
39
- name: 'John Brown',
40
- age: 32,
41
- address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
42
- tags: ['nice', 'developer']
43
- }, {
44
- key: '2',
45
- name: 'Jim Green',
46
- age: 42,
47
- address: 'London No. 2 Lake Park, London No. 2 Lake Park',
48
- tags: ['loser']
49
- }, {
50
- key: '3',
51
- name: 'Joe Black',
52
- age: 32,
53
- address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
54
- tags: ['cool', 'teacher']
55
- }];
56
- var App = function App() {
57
- return /*#__PURE__*/_jsx(Table, {
58
- draggable: true,
59
- columns: columns,
60
- dataSource: data,
61
- onChange: function onChange() {}
62
- });
63
- };
64
- export default App;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const App: React.FC;
3
- export default App;
@@ -1,89 +0,0 @@
1
- import React from 'react';
2
- import Table from "../core/table";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- var columns = [{
5
- title: 'Full Name',
6
- width: 100,
7
- dataIndex: 'name',
8
- key: 'name',
9
- fixed: 'left'
10
- }, {
11
- title: 'Age',
12
- width: 100,
13
- dataIndex: 'age',
14
- key: 'age'
15
- // fixed: 'left',
16
- }, {
17
- title: 'Column 1',
18
- width: 200,
19
- dataIndex: 'address',
20
- key: '1'
21
- }, {
22
- title: 'Column 2',
23
- width: 200,
24
- dataIndex: 'address',
25
- key: '2'
26
- }, {
27
- title: 'Column 3',
28
- width: 200,
29
- dataIndex: 'address',
30
- key: '3'
31
- }, {
32
- title: 'Column 4',
33
- width: 200,
34
- dataIndex: 'address',
35
- key: '4'
36
- }, {
37
- title: 'Column 5',
38
- width: 200,
39
- dataIndex: 'address',
40
- key: '5'
41
- }, {
42
- title: 'Column 6',
43
- width: 200,
44
- dataIndex: 'address',
45
- key: '6'
46
- }, {
47
- title: 'Column 7',
48
- width: 200,
49
- dataIndex: 'address',
50
- key: '7'
51
- }, {
52
- title: 'Column 8',
53
- width: 200,
54
- dataIndex: 'address',
55
- key: '8'
56
- }, {
57
- title: 'Action',
58
- key: 'operation',
59
- fixed: 'right',
60
- width: 100,
61
- render: function render() {
62
- return /*#__PURE__*/_jsx("a", {
63
- children: "action"
64
- });
65
- }
66
- }];
67
- var data = [{
68
- key: '1',
69
- name: 'John Brown',
70
- age: 32,
71
- address: 'New York Park'
72
- }, {
73
- key: '2',
74
- name: 'Jim Green',
75
- age: 40,
76
- address: 'London Park'
77
- }];
78
- var App = function App() {
79
- return /*#__PURE__*/_jsx(Table, {
80
- draggable: true,
81
- columns: columns,
82
- dataSource: data,
83
- scroll: {
84
- x: '100%'
85
- },
86
- onChange: function onChange() {}
87
- });
88
- };
89
- export default App;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare const App: React.FC;
3
- export default App;