react-table-edit 1.4.13 → 1.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -42264,7 +42264,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
42264
42264
  return ((item.align === 'center') ? jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
42265
42265
  }) }), jsxRuntime.jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42266
42266
  return ((item.align === 'right') ? jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
42267
- }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" })] }) })] }) })] })] }) }));
42267
+ }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsxRuntime.jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxRuntime.jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsxRuntime.jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsxRuntime.jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsxRuntime.jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxRuntime.jsxs("ul", { className: "mb-0 pe-50", children: [jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + D \u0111\u1EC3 nh\u00E2n b\u1EA3n" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + C \u0111\u1EC3 sao ch\u00E9p h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n v\u00E0o c\u1ED9t STT \u0111\u1EC3 ch\u1ECDn h\u00E0ng v\u00E0 nh\u1EA5n Ctrl + V \u0111\u1EC3 d\u00E1n h\u00E0ng" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2193 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng d\u01B0\u1EDBi" }), jsxRuntime.jsx("li", { style: { fontSize: 13 }, children: "Nh\u1EA5n Ctrl + Shift + \u2191 \u0111\u1EC3 sao ch\u00E9p d\u1EEF li\u1EC7u \u00F4 cho c\u00E1c d\u00F2ng tr\u00EAn" })] }) })] }) })] })] }) }));
42268
42268
  };
42269
42269
 
42270
42270
  const handleArrowRight = (e, params) => {
@@ -42301,19 +42301,40 @@ const isSelectMenuOpen = (element) => {
42301
42301
  return element && ["select__control--menu-is-open", "select-100__control--menu-is-open", "select-200__control--menu-is-open", "select-300__control--menu-is-open", "select-400__control--menu-is-open", "select-500__control--menu-is-open"].some(className => element.getElementsByClassName(className).length > 0);
42302
42302
  };
42303
42303
  const handleArrowUp = (e, params) => {
42304
- const { idElement, indexCol, indexRow, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
42305
- const element = document.getElementById(idElement);
42306
- if (!isSelectMenuOpen(element)) {
42307
- if (indexRow > 1) {
42308
- if (pagingClient && (pagingSetting?.currentPage ?? 0) !== 1 && (indexRow % (pagingSetting?.pageSize ?? 0)) === 1 && pagingSetting?.setCurrentPage) {
42309
- pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) - 1);
42310
- }
42311
- setIndexFocus(indexRow - 2);
42312
- focusNewElement(indexCol, indexRow - 1, true);
42304
+ const { idElement, indexCol, indexRow, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, contentColumns, dataSource, row } = params;
42305
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
42306
+ if (indexRow > 0) {
42307
+ const column = contentColumns[indexCol - 1];
42308
+ for (let index = indexRow - 1; index > 0; index--) {
42309
+ const element = dataSource[index];
42310
+ element[column.field ?? ''] = row[column.field ?? ''];
42311
+ if (column.callback && column.callbackValue) {
42312
+ const value = column.callbackValue(row);
42313
+ column.callback(value, index, element);
42314
+ }
42315
+ if (rowChange) {
42316
+ rowChange(element, indexRow, column.field);
42317
+ }
42318
+ }
42319
+ changeDataSource(dataSource);
42313
42320
  e.preventDefault();
42314
42321
  return e.code;
42315
42322
  }
42316
42323
  }
42324
+ else {
42325
+ const element = document.getElementById(idElement);
42326
+ if (!isSelectMenuOpen(element)) {
42327
+ if (indexRow > 1) {
42328
+ if (pagingClient && (pagingSetting?.currentPage ?? 0) !== 1 && (indexRow % (pagingSetting?.pageSize ?? 0)) === 1 && pagingSetting?.setCurrentPage) {
42329
+ pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) - 1);
42330
+ }
42331
+ setIndexFocus(indexRow - 2);
42332
+ focusNewElement(indexCol, indexRow - 1, true);
42333
+ e.preventDefault();
42334
+ return e.code;
42335
+ }
42336
+ }
42337
+ }
42317
42338
  };
42318
42339
  const handleArrowDown = (e, params) => {
42319
42340
  const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
@@ -42332,9 +42353,9 @@ const handleArrowDown = (e, params) => {
42332
42353
  }
42333
42354
  }
42334
42355
  changeDataSource(dataSource);
42356
+ e.preventDefault();
42357
+ return e.code;
42335
42358
  }
42336
- e.preventDefault();
42337
- return e.code;
42338
42359
  }
42339
42360
  else {
42340
42361
  const element = document.getElementById(idElement);
@@ -43066,7 +43087,6 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43066
43087
  }
43067
43088
  });
43068
43089
  const column = getColumn(indexCol, index);
43069
- console.log(column);
43070
43090
  if (column) {
43071
43091
  if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
43072
43092
  const rs = await column.onPasteValidate(stringData.join(','), currenRowIndex + 0, dataSource[currenRowIndex + 0]);
@@ -43100,7 +43120,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43100
43120
  dataRow[column.field] = stringData;
43101
43121
  }
43102
43122
  if (column.callback) {
43103
- column.callback(rs, currenRowIndex + indexRow);
43123
+ column.callback(rs, currenRowIndex + indexRow, dataRow);
43104
43124
  }
43105
43125
  }
43106
43126
  else {
@@ -43118,7 +43138,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43118
43138
  dataRow[column.field] = date;
43119
43139
  }
43120
43140
  if (column.callback) {
43121
- column.callback(date, currenRowIndex + indexRow);
43141
+ column.callback(date, currenRowIndex + indexRow, dataRow);
43122
43142
  }
43123
43143
  }
43124
43144
  else {
@@ -43135,7 +43155,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43135
43155
  dataRow[column.field] = number;
43136
43156
  }
43137
43157
  if (column.callback) {
43138
- column.callback(number, currenRowIndex + indexRow);
43158
+ column.callback(number, currenRowIndex + indexRow, dataRow);
43139
43159
  }
43140
43160
  }
43141
43161
  else {
@@ -43151,7 +43171,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43151
43171
  dataRow[column.field] = stringData;
43152
43172
  }
43153
43173
  if (column.callback) {
43154
- column.callback(stringData, currenRowIndex + indexRow);
43174
+ column.callback(stringData, currenRowIndex + indexRow, dataRow);
43155
43175
  }
43156
43176
  }
43157
43177
  else {
@@ -43164,7 +43184,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43164
43184
  dataRow[column.field] = stringData;
43165
43185
  }
43166
43186
  if (column.callback) {
43167
- column.callback(rs, currenRowIndex + indexRow);
43187
+ column.callback(rs, currenRowIndex + indexRow, dataRow);
43168
43188
  }
43169
43189
  }
43170
43190
  else {
@@ -43180,7 +43200,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
43180
43200
  dataRow[column.field] = stringData;
43181
43201
  }
43182
43202
  if (column.callback) {
43183
- column.callback(stringData, currenRowIndex + indexRow);
43203
+ column.callback(stringData, currenRowIndex + indexRow, dataRow);
43184
43204
  }
43185
43205
  }
43186
43206
  }