@zhenliang/sheet 0.1.94 → 0.1.95

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.
@@ -246,7 +246,8 @@ export var sideEffectReducer = {
246
246
  value = _ref5.value;
247
247
  var editor = data[row][col].dataEditor;
248
248
  var notEditable = data[row][col].readonly || !data[row][col].editable;
249
- if (notEditable) {
249
+ var allowPaste = data[row][col].allowPaste;
250
+ if (notEditable && !allowPaste) {
250
251
  return false;
251
252
  }
252
253
  if (editor && editor.checker) {
@@ -114,7 +114,7 @@ export var formatGroupData = function formatGroupData(param) {
114
114
  groupList = [item].concat(_toConsumableArray(item.children));
115
115
  }
116
116
  groupList.forEach(function (itemRow) {
117
- var _columns$, _columns$2, _columns$3, _columns$4;
117
+ var _columns$, _columns$2, _columns$3, _columns$4, _columns$5, _columns$6;
118
118
  var dataRow = [];
119
119
  var rowId = itemRow.id || itemRow.key || String(currentIndex);
120
120
  if (rowKey) {
@@ -129,6 +129,7 @@ export var formatGroupData = function formatGroupData(param) {
129
129
  row: currentIndex,
130
130
  col: -2,
131
131
  editable: false,
132
+ allowPaste: false,
132
133
  readonly: true,
133
134
  fixed: 'left',
134
135
  valueViewer: function valueViewer() {
@@ -141,14 +142,15 @@ export var formatGroupData = function formatGroupData(param) {
141
142
  row: currentIndex,
142
143
  col: -1,
143
144
  editable: !((columns === null || columns === void 0 ? void 0 : columns[0].editable) instanceof Function) ? columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.editable : columns === null || columns === void 0 || (_columns$2 = columns[0]) === null || _columns$2 === void 0 ? void 0 : _columns$2.editable('', itemRow, currentIndex),
144
- readonly: !((columns === null || columns === void 0 ? void 0 : columns[0].readonly) instanceof Function) ? columns === null || columns === void 0 || (_columns$3 = columns[0]) === null || _columns$3 === void 0 ? void 0 : _columns$3.readonly : columns === null || columns === void 0 || (_columns$4 = columns[0]) === null || _columns$4 === void 0 ? void 0 : _columns$4.readonly('', itemRow, currentIndex),
145
+ allowPaste: !((columns === null || columns === void 0 ? void 0 : columns[0].allowPaste) instanceof Function) ? columns === null || columns === void 0 || (_columns$3 = columns[0]) === null || _columns$3 === void 0 ? void 0 : _columns$3.allowPaste : columns === null || columns === void 0 || (_columns$4 = columns[0]) === null || _columns$4 === void 0 ? void 0 : _columns$4.allowPaste('', itemRow, currentIndex),
146
+ readonly: !((columns === null || columns === void 0 ? void 0 : columns[0].readonly) instanceof Function) ? columns === null || columns === void 0 || (_columns$5 = columns[0]) === null || _columns$5 === void 0 ? void 0 : _columns$5.readonly : columns === null || columns === void 0 || (_columns$6 = columns[0]) === null || _columns$6 === void 0 ? void 0 : _columns$6.readonly('', itemRow, currentIndex),
145
147
  align: 'center',
146
148
  // fixed: 'unset',
147
149
  valueViewer: GroupViewer,
148
150
  className: 'sheet-control'
149
151
  });
150
152
  columns.forEach(function (colInfo, col) {
151
- var _itemRow$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
153
+ var _itemRow$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$allowPaste, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
152
154
  var value = itemRow[colInfo.dataIndex || ''];
153
155
  var hasRemark = showRemark && (itemRow === null || itemRow === void 0 || (_itemRow$remarks = itemRow.remarks) === null || _itemRow$remarks === void 0 ? void 0 : _itemRow$remarks.includes(colInfo.dataIndex));
154
156
  dataRow.push({
@@ -159,6 +161,7 @@ export var formatGroupData = function formatGroupData(param) {
159
161
  align: colInfo.align,
160
162
  fixed: colInfo.fixed,
161
163
  editable: !(colInfo.editable instanceof Function) ? (_colInfo$editable = colInfo.editable) !== null && _colInfo$editable !== void 0 ? _colInfo$editable : true : colInfo.editable(value, itemRow, currentIndex, col),
164
+ allowPaste: !(colInfo.allowPaste instanceof Function) ? (_colInfo$allowPaste = colInfo.allowPaste) !== null && _colInfo$allowPaste !== void 0 ? _colInfo$allowPaste : true : colInfo.allowPaste(value, itemRow, currentIndex, col),
162
165
  valueViewer: colInfo.render ? colInfo.render : undefined,
163
166
  dataEditor: colInfo.editor ? colInfo.editor : undefined,
164
167
  searchKey: colInfo.searchKey,
@@ -46,6 +46,7 @@ export var formatSelectionData = function formatSelectionData(param) {
46
46
  row: row,
47
47
  col: -2,
48
48
  editable: false,
49
+ allowPaste: false,
49
50
  readonly: true,
50
51
  fixed: 'left',
51
52
  valueViewer: function valueViewer() {
@@ -66,7 +67,7 @@ export var formatSelectionData = function formatSelectionData(param) {
66
67
  });
67
68
  }
68
69
  columns.forEach(function (colInfo, col) {
69
- var _item$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
70
+ var _item$remarks, _colInfo$readonly, _colInfo$editable, _colInfo$allowPaste, _colInfo$cellConfig, _colInfo$cellConfig2, _colInfo$cellConfig3;
70
71
  var value = item[colInfo.dataIndex || ''];
71
72
  var hasRemark = showRemark && (item === null || item === void 0 || (_item$remarks = item.remarks) === null || _item$remarks === void 0 ? void 0 : _item$remarks.includes(colInfo.dataIndex));
72
73
  rows.push({
@@ -77,6 +78,7 @@ export var formatSelectionData = function formatSelectionData(param) {
77
78
  align: colInfo.align,
78
79
  fixed: colInfo.fixed,
79
80
  editable: !(colInfo.editable instanceof Function) ? (_colInfo$editable = colInfo.editable) !== null && _colInfo$editable !== void 0 ? _colInfo$editable : true : colInfo.editable(value, item, row),
81
+ allowPaste: !(colInfo.allowPaste instanceof Function) ? (_colInfo$allowPaste = colInfo.allowPaste) !== null && _colInfo$allowPaste !== void 0 ? _colInfo$allowPaste : true : colInfo.allowPaste(value, item, row),
80
82
  valueViewer: colInfo.render ? colInfo.render : undefined,
81
83
  dataEditor: colInfo.editor ? colInfo.editor : undefined,
82
84
  searchKey: colInfo.searchKey,
@@ -16,6 +16,7 @@ export type Cell = {
16
16
  readonly?: boolean;
17
17
  component?: CellViewer;
18
18
  editable?: boolean;
19
+ allowPaste?: boolean;
19
20
  colSpan?: number;
20
21
  rowSpan?: number;
21
22
  width?: number;
@@ -34,6 +34,7 @@ export type ColumnProps = {
34
34
  };
35
35
  key?: string;
36
36
  editable?: boolean | RecordRowMap<boolean>;
37
+ allowPaste?: boolean | RecordRowMap<boolean>;
37
38
  readonly?: boolean | RecordRowMap<boolean>;
38
39
  allowClear?: boolean;
39
40
  render?: SheetType.CellViewer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.94",
3
+ "version": "0.1.95",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",