@zhenliang/sheet 0.1.7-3.beta.0 → 0.1.7-3.beta.10

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 (87) hide show
  1. package/dist/core/editor/cascaderEditor/index.js +2 -2
  2. package/dist/core/editor/dateEditor/index.js +2 -2
  3. package/dist/core/editor/numberEditor/index.js +2 -2
  4. package/dist/core/editor/selectEditor/index.js +4 -4
  5. package/dist/core/reducers/keyboardReducer.js +2 -1
  6. package/dist/core/reducers/mouseReducer.js +3 -2
  7. package/dist/core/reducers/sideEffectReducer.js +3 -3
  8. package/dist/core/sheet/Cell.d.ts +1 -1
  9. package/dist/core/sheet/Cell.js +3 -3
  10. package/dist/core/sheet/Control.d.ts +1 -1
  11. package/dist/core/sheet/Control.js +2 -2
  12. package/dist/core/sheet/DataEditor.js +2 -2
  13. package/dist/core/sheet/DefaultCell.js +1 -1
  14. package/dist/core/sheet/DefaultRow.js +2 -2
  15. package/dist/core/sheet/DefaultRowMapper.js +4 -4
  16. package/dist/core/sheet/DefaultShell.js +1 -1
  17. package/dist/core/sheet/Event.d.ts +1 -1
  18. package/dist/core/sheet/Event.js +1 -1
  19. package/dist/core/sheet/Menu.d.ts +1 -1
  20. package/dist/core/sheet/Menu.js +3 -3
  21. package/dist/core/sheet/Remark.d.ts +9 -0
  22. package/dist/core/sheet/Remark.js +32 -0
  23. package/dist/core/sheet/ValueViewer.js +1 -1
  24. package/dist/core/sheet/index.js +52 -14
  25. package/dist/core/sheet/index.less +34 -0
  26. package/dist/core/sheet/searchInput.d.ts +1 -1
  27. package/dist/core/sheet/searchInput.js +3 -3
  28. package/dist/core/sheet/useCellEvent.js +1 -1
  29. package/dist/core/sheet/useContextMenu.js +4 -4
  30. package/dist/core/sheet/useMouseEvent.js +1 -1
  31. package/dist/core/sheet/useRemarkContainer.d.ts +14 -0
  32. package/dist/core/sheet/useRemarkContainer.js +121 -0
  33. package/dist/core/sheet/useSearchInput.js +1 -1
  34. package/dist/core/sheet/useSelectVisible.js +1 -1
  35. package/dist/core/sheet/useVirtualList.js +2 -2
  36. package/dist/core/shell/draggableShell/index.d.ts +1 -1
  37. package/dist/core/shell/draggableShell/index.js +10 -5
  38. package/dist/core/shell/tableShell.d.ts +2 -2
  39. package/dist/core/shell/tableShell.js +11 -155
  40. package/dist/core/table/addButton.d.ts +1 -2
  41. package/dist/core/table/addButton.js +3 -4
  42. package/dist/core/table/events.d.ts +1 -1
  43. package/dist/core/table/events.js +3 -3
  44. package/dist/core/table/index.d.ts +1 -0
  45. package/dist/core/table/index.js +164 -12
  46. package/dist/core/table/index.less +19 -0
  47. package/dist/core/table/remarkEvent.d.ts +5 -0
  48. package/dist/core/table/remarkEvent.js +9 -0
  49. package/dist/core/table/useGroupConfig.d.ts +1 -1
  50. package/dist/core/table/useGroupConfig.js +7 -5
  51. package/dist/core/table/useRowSelection.d.ts +1 -1
  52. package/dist/core/table/useRowSelection.js +7 -4
  53. package/dist/core/viewer/btnViewer/index.js +3 -3
  54. package/dist/core/viewer/cascaderViewer/index.js +2 -2
  55. package/dist/core/viewer/checkViewer/index.js +2 -2
  56. package/dist/core/viewer/editViewer/index.js +3 -3
  57. package/dist/core/viewer/groupViewer/index.js +2 -2
  58. package/dist/core/viewer/selectorViewer/index.js +1 -1
  59. package/dist/core/viewer/switchViewer/index.js +2 -2
  60. package/dist/example/antComponent.d.ts +1 -1
  61. package/dist/example/antComponent.js +2 -2
  62. package/dist/example/basic.d.ts +1 -1
  63. package/dist/example/basic.js +4 -4
  64. package/dist/example/ellipsis.d.ts +1 -1
  65. package/dist/example/ellipsis.js +2 -2
  66. package/dist/example/fixed.d.ts +1 -1
  67. package/dist/example/fixed.js +2 -2
  68. package/dist/example/group.js +2 -2
  69. package/dist/example/selection.d.ts +1 -1
  70. package/dist/example/selection.js +2 -2
  71. package/dist/example/sheet.d.ts +1 -1
  72. package/dist/example/sheet.js +3 -3
  73. package/dist/example/valuationAnalyze.js +356 -13
  74. package/dist/hooks/useEventBus.js +1 -1
  75. package/dist/hooks/useGroupConfig.d.ts +1 -1
  76. package/dist/hooks/useGroupConfig.js +2 -2
  77. package/dist/hooks/useKeyboard.js +1 -1
  78. package/dist/hooks/useMiddlewareReducer.js +1 -1
  79. package/dist/hooks/useMouse.js +1 -1
  80. package/dist/hooks/useSetState.js +1 -1
  81. package/dist/hooks/useSheetEvent.d.ts +1 -1
  82. package/dist/hooks/useSheetEvent.js +2 -2
  83. package/dist/hooks/useWidthConfig.d.ts +1 -1
  84. package/dist/hooks/useWidthConfig.js +2 -2
  85. package/dist/type/sheet.d.ts +8 -1
  86. package/dist/type/sheetTable.d.ts +15 -2
  87. package/package.json +4 -1
@@ -1,10 +1,14 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["sheetInstance", "columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "handleAdd", "handleBatchAdd", "draggable", "eventHandler"];
2
+ var _excluded = ["sheetInstance", "columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "handleAdd", "handleBatchAdd", "draggable", "eventHandler", "remarkRender", "handleAddRemark", "showRemark", "freeze"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
12
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
13
  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."); }
10
14
  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); }
@@ -17,16 +21,19 @@ import { Sheet, useSetState } from "../..";
17
21
  import { GroupContext } from "../../hooks/useGroupConfig";
18
22
  import { WidthContext } from "../../hooks/useWidthConfig";
19
23
  import { ConfigProvider, Empty } from 'antd';
20
- import { useCallback, useEffect, useMemo, useRef, useState } from "../../../node_modules/@types/react";
24
+ import { flatten } from 'lodash';
25
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
21
26
  import { SheetEvent } from "../sheet/Event";
22
27
  import { DraggableShell } from "../shell/draggableShell";
23
28
  import { TableShell } from "../shell/tableShell";
24
29
  import { AddButton } from "./addButton";
25
30
  import { GroupEvent, SelectionEvent } from "./events";
31
+ import "./index.less";
32
+ import { RemarkEvent } from "./remarkEvent";
26
33
  import { formatGroupData, useGroupConfig } from "./useGroupConfig";
27
34
  import { formatSelectionData, useRowSelection } from "./useRowSelection";
28
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
29
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
35
+ import { jsx as _jsx } from "react/jsx-runtime";
36
+ import { jsxs as _jsxs } from "react/jsx-runtime";
30
37
  var Table = function Table(_ref) {
31
38
  var sheetRef = _ref.sheetInstance,
32
39
  columns = _ref.columns,
@@ -39,6 +46,12 @@ var Table = function Table(_ref) {
39
46
  handleBatchAdd = _ref.handleBatchAdd,
40
47
  draggable = _ref.draggable,
41
48
  eventHandler = _ref.eventHandler,
49
+ RemarkRender = _ref.remarkRender,
50
+ handleAddRemark = _ref.handleAddRemark,
51
+ _ref$showRemark = _ref.showRemark,
52
+ showRemark = _ref$showRemark === void 0 ? false : _ref$showRemark,
53
+ _ref$freeze = _ref.freeze,
54
+ freeze = _ref$freeze === void 0 ? false : _ref$freeze,
42
55
  args = _objectWithoutProperties(_ref, _excluded);
43
56
  var _useState = useState([[]]),
44
57
  _useState2 = _slicedToArray(_useState, 2),
@@ -49,7 +62,7 @@ var Table = function Table(_ref) {
49
62
  _useSetState2 = _slicedToArray(_useSetState, 2),
50
63
  widths = _useSetState2[0],
51
64
  setWidth = _useSetState2[1];
52
- var sheetInstance = sheetRef || _sheetInstance;
65
+ var sheetInstance = _sheetInstance;
53
66
  var dataHasChildren = dataSource === null || dataSource === void 0 ? void 0 : dataSource.some(function (item) {
54
67
  var _item$children;
55
68
  return (item === null || item === void 0 || (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0;
@@ -58,6 +71,40 @@ var Table = function Table(_ref) {
58
71
  var hasChildren = dataHasChildren || configWithChildren;
59
72
  var hasControl = hasChildren || !!rowSelection;
60
73
  var offset = hasControl ? 2 : 1;
74
+ useImperativeHandle(sheetRef, function () {
75
+ return new Proxy({}, {
76
+ get: function get(target, property) {
77
+ var _sheetInstance$curren3;
78
+ var flatDataSource = flatten(dataSource.map(function (item) {
79
+ return item.children ? [item].concat(_toConsumableArray(item.children)) : [item];
80
+ }));
81
+ if (property === 'goToByTable') {
82
+ return function (id, columnKey) {
83
+ var _sheetInstance$curren, _sheetInstance$curren2;
84
+ var toCol = columns.findIndex(function (column) {
85
+ return column.dataIndex === columnKey;
86
+ }) + offset;
87
+ var toRow = flatDataSource.findIndex(function (d) {
88
+ return String(d === null || d === void 0 ? void 0 : d.id) === String(id);
89
+ });
90
+ console.log(sheetInstance.current, data, flatDataSource, toRow, toCol);
91
+ (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 || _sheetInstance$curren.goTo(toRow, toCol);
92
+ (_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0 || _sheetInstance$curren2.select({
93
+ start: {
94
+ row: toRow,
95
+ col: toCol
96
+ },
97
+ end: {
98
+ row: toRow,
99
+ col: toCol
100
+ }
101
+ });
102
+ };
103
+ }
104
+ return (_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0 ? void 0 : _sheetInstance$curren3[property];
105
+ }
106
+ });
107
+ }, [columns, dataSource]);
61
108
  var _useRowSelection = useRowSelection(dataSource, rowSelection, hasChildren),
62
109
  _useRowSelection2 = _slicedToArray(_useRowSelection, 2),
63
110
  checkedRow = _useRowSelection2[0],
@@ -74,9 +121,10 @@ var Table = function Table(_ref) {
74
121
  setData(formatGroupData({
75
122
  dataSource: dataSource,
76
123
  columns: columns,
77
- rowKey: rowKey
124
+ rowKey: rowKey,
125
+ showRemark: showRemark
78
126
  }));
79
- }, [dataSource, columns, hasChildren, rowKey]);
127
+ }, [dataSource, columns, hasChildren, rowKey, showRemark]);
80
128
  useEffect(function () {
81
129
  if (hasChildren) return;
82
130
  if (!dataSource || !columns) return;
@@ -85,15 +133,17 @@ var Table = function Table(_ref) {
85
133
  columns: columns,
86
134
  checked: checkedRow,
87
135
  rowKey: rowKey,
88
- rowSelection: rowSelection
136
+ rowSelection: rowSelection,
137
+ showRemark: showRemark
89
138
  }));
90
- }, [dataSource, columns, checkedRow, hasChildren, rowKey, rowSelection]);
139
+ }, [dataSource, columns, checkedRow, hasChildren, rowKey, rowSelection, showRemark]);
91
140
  useEffect(function () {
92
141
  if (!dataSource || !columns) {
93
142
  setData([[]]);
94
143
  }
95
144
  }, [dataSource, columns]);
96
145
  var handleChanges = useCallback(function (changes, extChange) {
146
+ if (freeze) return;
97
147
  onChange && onChange(changes.map(function (item) {
98
148
  return {
99
149
  col: item.col,
@@ -111,7 +161,7 @@ var Table = function Table(_ref) {
111
161
  value: item.value
112
162
  };
113
163
  }));
114
- }, [columns, onChange, hasControl]);
164
+ }, [columns, onChange, hasControl, freeze]);
115
165
  var handleReverse = useCallback(function (value) {
116
166
  var _ref2 = value,
117
167
  type = _ref2.type,
@@ -167,6 +217,102 @@ var Table = function Table(_ref) {
167
217
  }
168
218
  });
169
219
  }, [columns.length, columnsTitle, draggable, headSelection, hasChildren]);
220
+ var _useState3 = useState(false),
221
+ _useState4 = _slicedToArray(_useState3, 2),
222
+ showRemarkPop = _useState4[0],
223
+ setShowRemark = _useState4[1];
224
+ var _useState5 = useState(),
225
+ _useState6 = _slicedToArray(_useState5, 2),
226
+ remarkInfo = _useState6[0],
227
+ setRemarkInfo = _useState6[1];
228
+ var handleCellClick = useCallback(function (cell) {
229
+ var _columns$dataIndex, _data$row, _data$row2;
230
+ var _ref4 = cell !== null && cell !== void 0 ? cell : {},
231
+ col = _ref4.col,
232
+ row = _ref4.row;
233
+ if (!cell || !(columns !== null && columns !== void 0 && columns.length) || !(data !== null && data !== void 0 && data.length) || !columns[col - offset]) {
234
+ //remove pop
235
+ setShowRemark(false);
236
+ return;
237
+ }
238
+ var columnKey = (_columns$dataIndex = columns[col - offset].dataIndex) !== null && _columns$dataIndex !== void 0 ? _columns$dataIndex : '';
239
+ setRemarkInfo({
240
+ cell: cell,
241
+ columnKey: columnKey,
242
+ id: data === null || data === void 0 || (_data$row = data[row]) === null || _data$row === void 0 || (_data$row = _data$row[col]) === null || _data$row === void 0 || (_data$row = _data$row.record) === null || _data$row === void 0 ? void 0 : _data$row.id
243
+ });
244
+ setShowRemark(!!(data !== null && data !== void 0 && (_data$row2 = data[row]) !== null && _data$row2 !== void 0 && (_data$row2 = _data$row2[col]) !== null && _data$row2 !== void 0 && (_data$row2 = _data$row2.record) !== null && _data$row2 !== void 0 && (_data$row2 = _data$row2.remarks) !== null && _data$row2 !== void 0 && _data$row2.includes(columnKey)));
245
+ }, [offset, columns, data]);
246
+ var remarkElement = useMemo(function () {
247
+ if (!showRemark || !remarkInfo || !RemarkRender) {
248
+ return null;
249
+ }
250
+ return /*#__PURE__*/_jsx(RemarkRender, _objectSpread(_objectSpread({}, remarkInfo), {}, {
251
+ close: function close() {
252
+ return setShowRemark(false);
253
+ }
254
+ }));
255
+ }, [RemarkRender, remarkInfo, showRemark, data]);
256
+ var addRemark = useCallback(function (value) {
257
+ handleAddRemark === null || handleAddRemark === void 0 || handleAddRemark(value);
258
+ setShowRemark(true);
259
+ }, [handleAddRemark]);
260
+ var menuRenderer = args.menuRenderer;
261
+ var wrappMenuRenderer = useMemo(function () {
262
+ var remarkMenu = /*#__PURE__*/_jsx("div", {
263
+ className: "harvest-menu-item",
264
+ onClick: function onClick() {
265
+ return addRemark(remarkInfo);
266
+ },
267
+ children: "\u6DFB\u52A0\u8BC4\u8BBA"
268
+ }, "remark");
269
+ if (!menuRenderer) {
270
+ if (showRemark) {
271
+ return function (props) {
272
+ var _data$row3, _target$record, _target$record$includ;
273
+ var cell = props.cell;
274
+ var _ref5 = cell !== null && cell !== void 0 ? cell : {},
275
+ _ref5$col = _ref5.col,
276
+ col = _ref5$col === void 0 ? -1 : _ref5$col,
277
+ _ref5$row = _ref5.row,
278
+ row = _ref5$row === void 0 ? -1 : _ref5$row;
279
+ var target = data === null || data === void 0 || (_data$row3 = data[row]) === null || _data$row3 === void 0 ? void 0 : _data$row3[col + 1];
280
+ var cellHasRemark = (_target$record = target.record) === null || _target$record === void 0 || (_target$record = _target$record.remarks) === null || _target$record === void 0 || (_target$record$includ = _target$record.includes) === null || _target$record$includ === void 0 ? void 0 : _target$record$includ.call(_target$record, target.dataIndex);
281
+ if ((target === null || target === void 0 ? void 0 : target.readonly) !== true && !target.fixed && !cellHasRemark) {
282
+ return /*#__PURE__*/_jsx("div", {
283
+ className: "harvest-menu",
284
+ style: _objectSpread({}, props.position),
285
+ children: remarkMenu
286
+ });
287
+ }
288
+ return null;
289
+ };
290
+ }
291
+ return undefined;
292
+ } else {
293
+ return function (props) {
294
+ var _data$row4, _target$record2, _target$record2$inclu;
295
+ var cell = props.cell;
296
+ var _ref6 = cell !== null && cell !== void 0 ? cell : {},
297
+ _ref6$col = _ref6.col,
298
+ col = _ref6$col === void 0 ? -1 : _ref6$col,
299
+ _ref6$row = _ref6.row,
300
+ row = _ref6$row === void 0 ? -1 : _ref6$row;
301
+ var target = data === null || data === void 0 || (_data$row4 = data[row]) === null || _data$row4 === void 0 ? void 0 : _data$row4[col + 1];
302
+ var MenuFC = menuRenderer;
303
+ var cellHasRemark = (_target$record2 = target.record) === null || _target$record2 === void 0 || (_target$record2 = _target$record2.remarks) === null || _target$record2 === void 0 || (_target$record2$inclu = _target$record2.includes) === null || _target$record2$inclu === void 0 ? void 0 : _target$record2$inclu.call(_target$record2, target.dataIndex);
304
+ if (showRemark && (target === null || target === void 0 ? void 0 : target.readonly) !== true && !target.fixed && !cellHasRemark) {
305
+ return /*#__PURE__*/_jsx(MenuFC, _objectSpread(_objectSpread({}, props), {}, {
306
+ target: target,
307
+ children: remarkMenu
308
+ }));
309
+ }
310
+ return /*#__PURE__*/_jsx(MenuFC, _objectSpread(_objectSpread({}, props), {}, {
311
+ target: target
312
+ }));
313
+ };
314
+ }
315
+ }, [showRemark, showRemarkPop, menuRenderer, remarkInfo, addRemark, data]);
170
316
  return /*#__PURE__*/_jsx(ConfigProvider, {
171
317
  renderEmpty: function renderEmpty() {
172
318
  return /*#__PURE__*/_jsx(Empty, {
@@ -184,11 +330,15 @@ var Table = function Table(_ref) {
184
330
  onChange: setGroupConfig
185
331
  },
186
332
  children: /*#__PURE__*/_jsxs(Sheet, _objectSpread(_objectSpread({}, args), {}, {
333
+ freeze: freeze,
334
+ menuRenderer: wrappMenuRenderer,
335
+ showRemark: showRemarkPop,
187
336
  sheetInstance: sheetInstance,
188
337
  sheetRenderer: WrappedTableShell,
189
338
  data: data,
190
339
  onCellsChanged: handleChanges,
191
340
  handleAdd: handleAdd,
341
+ remarkElement: remarkElement,
192
342
  children: [/*#__PURE__*/_jsx(SelectionEvent, {
193
343
  hasChildren: hasChildren,
194
344
  rowSelection: rowSelection,
@@ -201,12 +351,14 @@ var Table = function Table(_ref) {
201
351
  }), /*#__PURE__*/_jsx(SheetEvent, {
202
352
  name: "reverse",
203
353
  handler: handleReverse
204
- }, "_reverse"), Object.keys(eventHandler || {}).map(function (key) {
354
+ }, "_reverse"), /*#__PURE__*/_jsx(RemarkEvent, {
355
+ handler: handleCellClick
356
+ }), Object.keys(eventHandler || {}).map(function (key) {
205
357
  return /*#__PURE__*/_jsx(SheetEvent, {
206
358
  name: key,
207
359
  handler: eventHandler === null || eventHandler === void 0 ? void 0 : eventHandler[key]
208
360
  }, key);
209
- }), /*#__PURE__*/_jsx(AddButton, {
361
+ }), freeze ? null : /*#__PURE__*/_jsx(AddButton, {
210
362
  handleAdd: handleAdd,
211
363
  handleBatchAdd: handleBatchAdd
212
364
  })]
@@ -9,4 +9,23 @@
9
9
  }
10
10
  }
11
11
  }
12
+ }
13
+ .remark-cell{
14
+ position: relative !important;
15
+ overflow: hidden;
16
+ &::before{
17
+ position: absolute;
18
+ transform: translate(6px,-6px);
19
+ content: '';
20
+ top:4px;
21
+ right:4px;
22
+ border:4px solid transparent;
23
+ border-top-color: red;
24
+ border-right-color: red;
25
+ }
26
+ }
27
+ .harvest-menu-divider{
28
+ margin: 5px 8px;
29
+ height: 1px;
30
+ background-color: rgb(235, 235, 235);
12
31
  }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { SheetType } from "../../type";
3
+ export declare const RemarkEvent: React.FC<{
4
+ handler: (value: SheetType.CellPosition) => void;
5
+ }>;
@@ -0,0 +1,9 @@
1
+ import { SheetEvent } from "../sheet/Event";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export var RemarkEvent = function RemarkEvent(_ref) {
4
+ var handler = _ref.handler;
5
+ return /*#__PURE__*/_jsx(SheetEvent, {
6
+ name: "cell-select-single",
7
+ handler: handler
8
+ }, "cell-select-single");
9
+ };
@@ -2,4 +2,4 @@ import type { SheetTableType, SheetType } from "../../type";
2
2
  export declare const useGroupConfig: (dataSource: Record<string, unknown>[], tableGroupConfig?: SheetTableType.TableGroupConfig, hasChildren?: boolean) => [SheetType.RowGroupConfig & {
3
3
  configMap: SheetType.GroupMap;
4
4
  }, (value: SheetType.RowGroupConfig) => void];
5
- export declare const formatGroupData: (param: Pick<SheetTableType.TableProps, 'dataSource' | 'columns' | 'rowKey'>) => SheetType.Cell[][];
5
+ export declare const formatGroupData: (param: Pick<SheetTableType.TableProps, 'dataSource' | 'columns' | 'rowKey' | 'showRemark'>) => SheetType.Cell[][];
@@ -15,8 +15,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
15
15
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { flatten, isNil } from 'lodash';
18
- import { useCallback, useEffect, useMemo, useRef, useState } from "../../../node_modules/@types/react";
19
- import { groupConfigToGroupMap } from "../util";
18
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19
+ import { classNames, groupConfigToGroupMap } from "../util";
20
20
  import { GroupViewer } from "../viewer";
21
21
  import { dataSourceToRowConfig } from "./util";
22
22
  export var useGroupConfig = function useGroupConfig(dataSource, tableGroupConfig, hasChildren) {
@@ -104,7 +104,8 @@ export var useGroupConfig = function useGroupConfig(dataSource, tableGroupConfig
104
104
  export var formatGroupData = function formatGroupData(param) {
105
105
  var dataSource = param.dataSource,
106
106
  columns = param.columns,
107
- rowKey = param.rowKey;
107
+ rowKey = param.rowKey,
108
+ showRemark = param.showRemark;
108
109
  var data = [];
109
110
  var currentIndex = 0;
110
111
  dataSource.forEach(function (item, row) {
@@ -147,8 +148,9 @@ export var formatGroupData = function formatGroupData(param) {
147
148
  className: 'sheet-control'
148
149
  });
149
150
  columns.forEach(function (colInfo, col) {
150
- var _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
151
+ var _itemRow$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
151
152
  var value = itemRow[colInfo.dataIndex || ''];
153
+ var hasRemark = showRemark && (itemRow === null || itemRow === void 0 || (_itemRow$remarks = itemRow.remarks) === null || _itemRow$remarks === void 0 ? void 0 : _itemRow$remarks.includes(colInfo.dataIndex));
152
154
  dataRow.push({
153
155
  id: rowId,
154
156
  value: value,
@@ -161,7 +163,7 @@ export var formatGroupData = function formatGroupData(param) {
161
163
  dataEditor: colInfo.editor ? colInfo.editor : undefined,
162
164
  searchKey: colInfo.searchKey,
163
165
  row: currentIndex,
164
- className: !(((_colInfo$cellConfig = colInfo.cellConfig) === null || _colInfo$cellConfig === void 0 ? void 0 : _colInfo$cellConfig.className) instanceof Function) ? (_colInfo$cellConfig2 = colInfo.cellConfig) === null || _colInfo$cellConfig2 === void 0 ? void 0 : _colInfo$cellConfig2.className : (_colInfo$cellConfig3 = colInfo.cellConfig) === null || _colInfo$cellConfig3 === void 0 ? void 0 : _colInfo$cellConfig3.className(value, itemRow, currentIndex),
166
+ className: classNames(!(((_colInfo$cellConfig = colInfo.cellConfig) === null || _colInfo$cellConfig === void 0 ? void 0 : _colInfo$cellConfig.className) instanceof Function) ? (_colInfo$cellConfig2 = colInfo.cellConfig) === null || _colInfo$cellConfig2 === void 0 ? void 0 : _colInfo$cellConfig2.className : (_colInfo$cellConfig3 = colInfo.cellConfig) === null || _colInfo$cellConfig3 === void 0 ? void 0 : _colInfo$cellConfig3.className(value, itemRow, currentIndex), hasRemark ? 'remark-cell' : null),
165
167
  dataIndex: colInfo.dataIndex,
166
168
  key: colInfo.key,
167
169
  allowClear: colInfo.allowClear,
@@ -1,5 +1,5 @@
1
1
  import { SheetTableType } from "../..";
2
2
  export declare const useRowSelection: (dataSource: Record<string, unknown>[], rowSelection?: SheetTableType.TableRowSelection, hasChildren?: boolean) => [boolean[], (value: boolean[]) => void];
3
- export declare const formatSelectionData: (param: Pick<SheetTableType.TableProps, "columns" | "dataSource" | "rowKey" | "rowSelection"> & {
3
+ export declare const formatSelectionData: (param: Pick<SheetTableType.TableProps, "columns" | "dataSource" | "rowKey" | "showRemark" | "rowSelection"> & {
4
4
  checked: boolean[];
5
5
  }) => any[][];
@@ -5,7 +5,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { CheckViewer } from "../..";
8
- import { useEffect, useRef, useState } from "../../../node_modules/@types/react";
8
+ import { useEffect, useRef, useState } from 'react';
9
+ import { classNames } from "../util";
9
10
  export var useRowSelection = function useRowSelection(dataSource, rowSelection, hasChildren) {
10
11
  var _dataSource$length;
11
12
  var _useState = useState(Array((_dataSource$length = dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) !== null && _dataSource$length !== void 0 ? _dataSource$length : 0).fill(false)),
@@ -28,7 +29,8 @@ export var formatSelectionData = function formatSelectionData(param) {
28
29
  columns = param.columns,
29
30
  checked = param.checked,
30
31
  rowKey = param.rowKey,
31
- rowSelection = param.rowSelection;
32
+ rowSelection = param.rowSelection,
33
+ showRemark = param.showRemark;
32
34
  return dataSource.map(function (item, row) {
33
35
  var rowId = item.id || item.key || String(row);
34
36
  if (rowKey) {
@@ -64,8 +66,9 @@ export var formatSelectionData = function formatSelectionData(param) {
64
66
  });
65
67
  }
66
68
  columns.forEach(function (colInfo, col) {
67
- var _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
69
+ var _item$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
68
70
  var value = item[colInfo.dataIndex || ''];
71
+ var hasRemark = showRemark && (item === null || item === void 0 || (_item$remarks = item.remarks) === null || _item$remarks === void 0 ? void 0 : _item$remarks.includes(colInfo.dataIndex));
69
72
  rows.push({
70
73
  id: rowId,
71
74
  value: value,
@@ -77,7 +80,7 @@ export var formatSelectionData = function formatSelectionData(param) {
77
80
  valueViewer: colInfo.render ? colInfo.render : undefined,
78
81
  dataEditor: colInfo.editor ? colInfo.editor : undefined,
79
82
  searchKey: colInfo.searchKey,
80
- className: !(((_colInfo$cellConfig = colInfo.cellConfig) === null || _colInfo$cellConfig === void 0 ? void 0 : _colInfo$cellConfig.className) instanceof Function) ? (_colInfo$cellConfig2 = colInfo.cellConfig) === null || _colInfo$cellConfig2 === void 0 ? void 0 : _colInfo$cellConfig2.className : (_colInfo$cellConfig3 = colInfo.cellConfig) === null || _colInfo$cellConfig3 === void 0 ? void 0 : _colInfo$cellConfig3.className(value, item, row),
83
+ className: classNames(!(((_colInfo$cellConfig = colInfo.cellConfig) === null || _colInfo$cellConfig === void 0 ? void 0 : _colInfo$cellConfig.className) instanceof Function) ? (_colInfo$cellConfig2 = colInfo.cellConfig) === null || _colInfo$cellConfig2 === void 0 ? void 0 : _colInfo$cellConfig2.className : (_colInfo$cellConfig3 = colInfo.cellConfig) === null || _colInfo$cellConfig3 === void 0 ? void 0 : _colInfo$cellConfig3.className(value, item, row), hasRemark ? 'remark-cell' : null),
81
84
  row: row,
82
85
  col: col,
83
86
  dataIndex: colInfo.dataIndex,
@@ -1,8 +1,8 @@
1
1
  import { useSheetEvent } from "../../..";
2
2
  import { Button, Divider } from 'antd';
3
- import { useCallback } from "../../../../node_modules/@types/react";
4
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
5
- import { jsxs as _jsxs } from "../../../../node_modules/@types/react/jsx-runtime";
3
+ import { useCallback } from 'react';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
6
  export var BtnViewer = function BtnViewer(props) {
7
7
  var value = props.value,
8
8
  row = props.row,
@@ -2,8 +2,8 @@
2
2
  // == string 和 number 类型忽略
3
3
 
4
4
  import { valuesTransferToLabel } from "../../util";
5
- import { Fragment as _Fragment } from "../../../../node_modules/@types/react/jsx-runtime";
6
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  export var getCascaderViewer = function getCascaderViewer(options) {
8
8
  var TypeViewer = function TypeViewer(props) {
9
9
  var value = props.value;
@@ -1,7 +1,7 @@
1
1
  import { useSheetEvent } from "../../..";
2
2
  import { Checkbox } from 'antd';
3
- import { useCallback } from "../../../../node_modules/@types/react";
4
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
3
+ import { useCallback } from 'react';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export var CheckViewer = function CheckViewer(props) {
6
6
  var value = props.value,
7
7
  row = props.row,
@@ -1,8 +1,8 @@
1
1
  import { EditFilled } from '@ant-design/icons';
2
2
  import { useSheetEvent } from "../../..";
3
- import { useCallback } from "../../../../node_modules/@types/react";
4
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
5
- import { jsxs as _jsxs } from "../../../../node_modules/@types/react/jsx-runtime";
3
+ import { useCallback } from 'react';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
6
  export var EditViewer = function EditViewer(props) {
7
7
  var value = props.value,
8
8
  row = props.row,
@@ -1,8 +1,8 @@
1
1
  import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons';
2
2
  import { useSheetEvent } from "../../..";
3
3
  import { useGroup } from "../../../hooks/useGroupConfig";
4
- import { useCallback } from "../../../../node_modules/@types/react";
5
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
4
+ import { useCallback } from 'react';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export var GroupViewer = function GroupViewer(props) {
7
7
  var _config$configMap, _config$configMap2, _config$groupOpen;
8
8
  var _props$row = props.row,
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable eqeqeq */
3
3
  // == string 和 number 类型忽略
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { useSheetEvent } from "../../..";
2
2
  import { Switch } from 'antd';
3
- import { useCallback } from "../../../../node_modules/@types/react";
4
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
3
+ import { useCallback } from 'react';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  export var SwitchViewer = function SwitchViewer(props) {
6
6
  var value = props.value,
7
7
  row = props.row,
@@ -1,3 +1,3 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  declare const App: React.FC;
3
3
  export default App;
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { Button, Modal } from 'antd';
18
18
  import { cloneDeep, random, range } from 'lodash';
19
- import React, { useCallback, useMemo, useRef, useState } from "../../node_modules/@types/react";
19
+ import React, { useCallback, useMemo, useRef, useState } from 'react';
20
20
  import { getCascaderEditor, getDateEditor, getNumberEditor, getSelectEditor } from "../core/editor";
21
21
  import Table from "../core/table";
22
22
  import { getSelectorViewer } from "../core/viewer";
@@ -25,7 +25,7 @@ import { getCascaderViewer } from "../core/viewer/cascaderViewer";
25
25
  import { EditViewer } from "../core/viewer/editViewer";
26
26
  import { SwitchViewer } from "../core/viewer/switchViewer";
27
27
  import { SheetType } from "../type";
28
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
28
+ import { jsx as _jsx } from "react/jsx-runtime";
29
29
  var Precision2MoneyEditor = getNumberEditor({
30
30
  max: 1000,
31
31
  min: 0,
@@ -1,4 +1,4 @@
1
1
  import 'antd/dist/antd.css';
2
- import React from "../../node_modules/@types/react";
2
+ import React from 'react';
3
3
  declare const App: React.FC;
4
4
  export default App;
@@ -17,10 +17,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { Table } from "./..";
18
18
  import { Space, Tag } from 'antd';
19
19
  import 'antd/dist/antd.css';
20
- import React, { useCallback, useState } from "../../node_modules/@types/react";
21
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
22
- import { Fragment as _Fragment } from "../../node_modules/@types/react/jsx-runtime";
23
- import { jsxs as _jsxs } from "../../node_modules/@types/react/jsx-runtime";
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
24
  var columns = [{
25
25
  title: 'Name',
26
26
  dataIndex: 'name',
@@ -1,3 +1,3 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  declare const App: React.FC;
3
3
  export default App;
@@ -1,6 +1,6 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  import Table from "../core/table";
3
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  var columns = [{
5
5
  title: 'Name',
6
6
  dataIndex: 'name',
@@ -1,3 +1,3 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  declare const App: React.FC;
3
3
  export default App;
@@ -1,6 +1,6 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  import Table from "../core/table";
3
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  var columns = [{
5
5
  title: 'Full Name',
6
6
  width: 100,
@@ -9,9 +9,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9
9
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { cloneDeep } from 'lodash';
12
- import { useCallback, useState } from "../../node_modules/@types/react";
12
+ import { useCallback, useState } from 'react';
13
13
  import Table from "../core/table";
14
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  var columns = [{
16
16
  title: 'Name',
17
17
  dataIndex: 'name',
@@ -1,4 +1,4 @@
1
1
  import 'antd/dist/antd.css';
2
- import React from "../../node_modules/@types/react";
2
+ import React from 'react';
3
3
  declare const App: React.FC;
4
4
  export default App;
@@ -16,8 +16,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
16
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
17
  import { Table } from "./..";
18
18
  import 'antd/dist/antd.css';
19
- import React, { useCallback, useState } from "../../node_modules/@types/react";
20
- import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
19
+ import React, { useCallback, useState } from 'react';
20
+ import { jsx as _jsx } from "react/jsx-runtime";
21
21
  var columns = [{
22
22
  title: 'Name',
23
23
  dataIndex: 'name',
@@ -1,4 +1,4 @@
1
- import React from "../../node_modules/@types/react";
1
+ import React from 'react';
2
2
  import './index.less';
3
3
  declare const BasicSheet: React.FC;
4
4
  export default BasicSheet;