@zhenliang/sheet 0.1.7-3.beta.1 → 0.1.7-3.beta.11

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.
@@ -7,7 +7,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { MoreOutlined } from "@ant-design/icons";
8
8
  import { Form, InputNumber, Popover, Button } from "antd";
9
9
  import React, { useEffect, useRef, useState } from "react";
10
- import "./index.less";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  var RowPop = function RowPop(props) {
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { SheetTableType } from "../../type";
3
+ import './index.less';
3
4
  declare const Table: React.FC<SheetTableType.TableProps>;
4
5
  export default Table;
@@ -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,12 +21,15 @@ 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 '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
35
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -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,39 @@ 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
+ (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 || _sheetInstance$curren.goTo(toRow, toCol);
91
+ (_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0 || _sheetInstance$curren2.select({
92
+ start: {
93
+ row: toRow,
94
+ col: toCol
95
+ },
96
+ end: {
97
+ row: toRow,
98
+ col: toCol
99
+ }
100
+ });
101
+ };
102
+ }
103
+ return (_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0 ? void 0 : _sheetInstance$curren3[property];
104
+ }
105
+ });
106
+ }, [columns, dataSource, offset]);
61
107
  var _useRowSelection = useRowSelection(dataSource, rowSelection, hasChildren),
62
108
  _useRowSelection2 = _slicedToArray(_useRowSelection, 2),
63
109
  checkedRow = _useRowSelection2[0],
@@ -74,9 +120,10 @@ var Table = function Table(_ref) {
74
120
  setData(formatGroupData({
75
121
  dataSource: dataSource,
76
122
  columns: columns,
77
- rowKey: rowKey
123
+ rowKey: rowKey,
124
+ showRemark: showRemark
78
125
  }));
79
- }, [dataSource, columns, hasChildren, rowKey]);
126
+ }, [dataSource, columns, hasChildren, rowKey, showRemark]);
80
127
  useEffect(function () {
81
128
  if (hasChildren) return;
82
129
  if (!dataSource || !columns) return;
@@ -85,15 +132,17 @@ var Table = function Table(_ref) {
85
132
  columns: columns,
86
133
  checked: checkedRow,
87
134
  rowKey: rowKey,
88
- rowSelection: rowSelection
135
+ rowSelection: rowSelection,
136
+ showRemark: showRemark
89
137
  }));
90
- }, [dataSource, columns, checkedRow, hasChildren, rowKey, rowSelection]);
138
+ }, [dataSource, columns, checkedRow, hasChildren, rowKey, rowSelection, showRemark]);
91
139
  useEffect(function () {
92
140
  if (!dataSource || !columns) {
93
141
  setData([[]]);
94
142
  }
95
143
  }, [dataSource, columns]);
96
144
  var handleChanges = useCallback(function (changes, extChange) {
145
+ if (freeze) return;
97
146
  onChange && onChange(changes.map(function (item) {
98
147
  return {
99
148
  col: item.col,
@@ -111,7 +160,7 @@ var Table = function Table(_ref) {
111
160
  value: item.value
112
161
  };
113
162
  }));
114
- }, [columns, onChange, hasControl]);
163
+ }, [columns, onChange, hasControl, freeze]);
115
164
  var handleReverse = useCallback(function (value) {
116
165
  var _ref2 = value,
117
166
  type = _ref2.type,
@@ -167,6 +216,103 @@ var Table = function Table(_ref) {
167
216
  }
168
217
  });
169
218
  }, [columns.length, columnsTitle, draggable, headSelection, hasChildren]);
219
+ var _useState3 = useState(false),
220
+ _useState4 = _slicedToArray(_useState3, 2),
221
+ showRemarkPop = _useState4[0],
222
+ setShowRemark = _useState4[1];
223
+ var _useState5 = useState(),
224
+ _useState6 = _slicedToArray(_useState5, 2),
225
+ remarkInfo = _useState6[0],
226
+ setRemarkInfo = _useState6[1];
227
+ var handleCellClick = useCallback(function (cell) {
228
+ var _columns$dataIndex, _data$row, _data$row2;
229
+ var _ref4 = cell !== null && cell !== void 0 ? cell : {},
230
+ col = _ref4.col,
231
+ row = _ref4.row;
232
+ if (!cell || !(columns !== null && columns !== void 0 && columns.length) || !(data !== null && data !== void 0 && data.length) || !columns[col - offset]) {
233
+ //remove pop
234
+ setShowRemark(false);
235
+ return;
236
+ }
237
+ var columnKey = (_columns$dataIndex = columns[col - offset].dataIndex) !== null && _columns$dataIndex !== void 0 ? _columns$dataIndex : '';
238
+ setRemarkInfo({
239
+ cell: cell,
240
+ columnKey: columnKey,
241
+ 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
242
+ });
243
+ console.log(data);
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[][];
@@ -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 { flatten, isNil } from 'lodash';
18
18
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
19
- import { groupConfigToGroupMap } from "../util";
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[][];
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { CheckViewer } from "../..";
8
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,