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.mjs CHANGED
@@ -42236,7 +42236,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
42236
42236
  return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
42237
42237
  }) }), jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
42238
42238
  return ((item.align === 'right') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
42239
- }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [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" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), 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" }), 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" }), 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" })] }) })] }) })] })] }) }));
42239
+ }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': headerColumns.length > 1 }), "aria-disabled": "false", children: jsx(SvgSettings, { className: "text-primary cursor-pointer", onClick: () => setOpenPopupSetupColumn(true) }) }), jsx("div", { className: classnames('r-toolbar-item me-25', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsxs(UncontrolledDropdown, { className: 'dropdown-user nav-item', children: [jsx(DropdownToggle$1, { tag: 'div', color: "primary", onClick: (e) => e.preventDefault(), children: jsx(SvgInfo, { className: "cursor-pointer text-primary" }) }), jsx(DropdownMenu$1, { className: 'formula-dropdown icon-dropdown', children: jsxs("ul", { className: "mb-0 pe-50", children: [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" }), jsx("li", { style: { fontSize: 13 }, children: "Ch\u1ECDn \u00F4 v\u00E0 Ctrl + V \u0111\u1EC3 d\u00E1n th\u00F4ng tin t\u1EEB excel" }), 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" }), 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" }), 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" }), 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" })] }) })] }) })] })] }) }));
42240
42240
  };
42241
42241
 
42242
42242
  const handleArrowRight = (e, params) => {
@@ -42273,19 +42273,40 @@ const isSelectMenuOpen = (element) => {
42273
42273
  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);
42274
42274
  };
42275
42275
  const handleArrowUp = (e, params) => {
42276
- const { idElement, indexCol, indexRow, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
42277
- const element = document.getElementById(idElement);
42278
- if (!isSelectMenuOpen(element)) {
42279
- if (indexRow > 1) {
42280
- if (pagingClient && (pagingSetting?.currentPage ?? 0) !== 1 && (indexRow % (pagingSetting?.pageSize ?? 0)) === 1 && pagingSetting?.setCurrentPage) {
42281
- pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) - 1);
42282
- }
42283
- setIndexFocus(indexRow - 2);
42284
- focusNewElement(indexCol, indexRow - 1, true);
42276
+ const { idElement, indexCol, indexRow, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, contentColumns, dataSource, row } = params;
42277
+ if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
42278
+ if (indexRow > 0) {
42279
+ const column = contentColumns[indexCol - 1];
42280
+ for (let index = indexRow - 1; index > 0; index--) {
42281
+ const element = dataSource[index];
42282
+ element[column.field ?? ''] = row[column.field ?? ''];
42283
+ if (column.callback && column.callbackValue) {
42284
+ const value = column.callbackValue(row);
42285
+ column.callback(value, index, element);
42286
+ }
42287
+ if (rowChange) {
42288
+ rowChange(element, indexRow, column.field);
42289
+ }
42290
+ }
42291
+ changeDataSource(dataSource);
42285
42292
  e.preventDefault();
42286
42293
  return e.code;
42287
42294
  }
42288
42295
  }
42296
+ else {
42297
+ const element = document.getElementById(idElement);
42298
+ if (!isSelectMenuOpen(element)) {
42299
+ if (indexRow > 1) {
42300
+ if (pagingClient && (pagingSetting?.currentPage ?? 0) !== 1 && (indexRow % (pagingSetting?.pageSize ?? 0)) === 1 && pagingSetting?.setCurrentPage) {
42301
+ pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) - 1);
42302
+ }
42303
+ setIndexFocus(indexRow - 2);
42304
+ focusNewElement(indexCol, indexRow - 1, true);
42305
+ e.preventDefault();
42306
+ return e.code;
42307
+ }
42308
+ }
42309
+ }
42289
42310
  };
42290
42311
  const handleArrowDown = (e, params) => {
42291
42312
  const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
@@ -42304,9 +42325,9 @@ const handleArrowDown = (e, params) => {
42304
42325
  }
42305
42326
  }
42306
42327
  changeDataSource(dataSource);
42328
+ e.preventDefault();
42329
+ return e.code;
42307
42330
  }
42308
- e.preventDefault();
42309
- return e.code;
42310
42331
  }
42311
42332
  else {
42312
42333
  const element = document.getElementById(idElement);
@@ -43038,7 +43059,6 @@ const TableEdit = forwardRef((props, ref) => {
43038
43059
  }
43039
43060
  });
43040
43061
  const column = getColumn(indexCol, index);
43041
- console.log(column);
43042
43062
  if (column) {
43043
43063
  if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
43044
43064
  const rs = await column.onPasteValidate(stringData.join(','), currenRowIndex + 0, dataSource[currenRowIndex + 0]);
@@ -43072,7 +43092,7 @@ const TableEdit = forwardRef((props, ref) => {
43072
43092
  dataRow[column.field] = stringData;
43073
43093
  }
43074
43094
  if (column.callback) {
43075
- column.callback(rs, currenRowIndex + indexRow);
43095
+ column.callback(rs, currenRowIndex + indexRow, dataRow);
43076
43096
  }
43077
43097
  }
43078
43098
  else {
@@ -43090,7 +43110,7 @@ const TableEdit = forwardRef((props, ref) => {
43090
43110
  dataRow[column.field] = date;
43091
43111
  }
43092
43112
  if (column.callback) {
43093
- column.callback(date, currenRowIndex + indexRow);
43113
+ column.callback(date, currenRowIndex + indexRow, dataRow);
43094
43114
  }
43095
43115
  }
43096
43116
  else {
@@ -43107,7 +43127,7 @@ const TableEdit = forwardRef((props, ref) => {
43107
43127
  dataRow[column.field] = number;
43108
43128
  }
43109
43129
  if (column.callback) {
43110
- column.callback(number, currenRowIndex + indexRow);
43130
+ column.callback(number, currenRowIndex + indexRow, dataRow);
43111
43131
  }
43112
43132
  }
43113
43133
  else {
@@ -43123,7 +43143,7 @@ const TableEdit = forwardRef((props, ref) => {
43123
43143
  dataRow[column.field] = stringData;
43124
43144
  }
43125
43145
  if (column.callback) {
43126
- column.callback(stringData, currenRowIndex + indexRow);
43146
+ column.callback(stringData, currenRowIndex + indexRow, dataRow);
43127
43147
  }
43128
43148
  }
43129
43149
  else {
@@ -43136,7 +43156,7 @@ const TableEdit = forwardRef((props, ref) => {
43136
43156
  dataRow[column.field] = stringData;
43137
43157
  }
43138
43158
  if (column.callback) {
43139
- column.callback(rs, currenRowIndex + indexRow);
43159
+ column.callback(rs, currenRowIndex + indexRow, dataRow);
43140
43160
  }
43141
43161
  }
43142
43162
  else {
@@ -43152,7 +43172,7 @@ const TableEdit = forwardRef((props, ref) => {
43152
43172
  dataRow[column.field] = stringData;
43153
43173
  }
43154
43174
  if (column.callback) {
43155
- column.callback(stringData, currenRowIndex + indexRow);
43175
+ column.callback(stringData, currenRowIndex + indexRow, dataRow);
43156
43176
  }
43157
43177
  }
43158
43178
  }