react-table-edit 1.4.12 → 1.4.14
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/component/edit-form/index.d.ts +1 -10
- package/dist/component/select-table/index.d.ts +1 -22
- package/dist/component/table/key-handlers.d.ts +6 -4
- package/dist/component/type/index.d.ts +194 -2
- package/dist/index.d.ts +228 -67
- package/dist/index.js +68 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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" })] }) })] }) })] })] }) }));
|
|
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" })] }) })] }) })] })] }) }));
|
|
42240
42240
|
};
|
|
42241
42241
|
|
|
42242
42242
|
const handleArrowRight = (e, params) => {
|
|
@@ -42273,31 +42273,73 @@ 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
|
-
|
|
42278
|
-
|
|
42279
|
-
|
|
42280
|
-
|
|
42281
|
-
|
|
42282
|
-
|
|
42283
|
-
|
|
42284
|
-
|
|
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
|
-
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement } = params;
|
|
42292
|
-
|
|
42293
|
-
|
|
42294
|
-
|
|
42295
|
-
|
|
42296
|
-
|
|
42297
|
-
|
|
42298
|
-
|
|
42299
|
-
|
|
42300
|
-
|
|
42312
|
+
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
|
|
42313
|
+
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
42314
|
+
if (indexRow < totalCount) {
|
|
42315
|
+
const column = contentColumns[indexCol - 1];
|
|
42316
|
+
for (let index = indexRow; index < totalCount; index++) {
|
|
42317
|
+
const element = dataSource[index];
|
|
42318
|
+
element[column.field ?? ''] = row[column.field ?? ''];
|
|
42319
|
+
if (column.callback && column.callbackValue) {
|
|
42320
|
+
const value = column.callbackValue(row);
|
|
42321
|
+
column.callback(value, index, element);
|
|
42322
|
+
}
|
|
42323
|
+
if (rowChange) {
|
|
42324
|
+
rowChange(element, indexRow, column.field);
|
|
42325
|
+
}
|
|
42326
|
+
}
|
|
42327
|
+
changeDataSource(dataSource);
|
|
42328
|
+
e.preventDefault();
|
|
42329
|
+
return e.code;
|
|
42330
|
+
}
|
|
42331
|
+
}
|
|
42332
|
+
else {
|
|
42333
|
+
const element = document.getElementById(idElement);
|
|
42334
|
+
if (!isSelectMenuOpen(element) && indexRow < totalCount) {
|
|
42335
|
+
if (pagingClient && (indexRow % (pagingSetting?.pageSize ?? 0)) === 0 && pagingSetting?.setCurrentPage) {
|
|
42336
|
+
pagingSetting?.setCurrentPage((pagingSetting?.currentPage ?? 1) + 1);
|
|
42337
|
+
}
|
|
42338
|
+
setIndexFocus(indexRow);
|
|
42339
|
+
focusNewElement(indexCol, indexRow + 1, true);
|
|
42340
|
+
e.preventDefault();
|
|
42341
|
+
return e.code;
|
|
42342
|
+
}
|
|
42301
42343
|
}
|
|
42302
42344
|
};
|
|
42303
42345
|
const handleTab = (e, params) => {
|
|
@@ -42676,9 +42718,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42676
42718
|
}
|
|
42677
42719
|
handleDataChange(row, col, indexRow);
|
|
42678
42720
|
}, dateFormat: "dd/MM/yyyy HH:mm", onKeyDown: (e) => {
|
|
42679
|
-
|
|
42680
|
-
return true;
|
|
42681
|
-
}
|
|
42721
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42682
42722
|
} }));
|
|
42683
42723
|
case 'select':
|
|
42684
42724
|
let valueSelect;
|
|
@@ -42724,7 +42764,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42724
42764
|
}
|
|
42725
42765
|
handleDataChange(row, col, indexRow);
|
|
42726
42766
|
}, fieldValue: col.selectSettings?.fieldValue, fieldLabel: col.selectSettings?.fieldLabel, component: gridRef, columns: col.selectSettings?.columns, isClearable: col.selectSettings?.isClearable ?? false, formatSetting: formatSetting, placeholder: t('Select'), loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, invalid: (col.validate && !isNullOrUndefined$1(col.validate(row[col.field], row))), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', allowCreate: col.selectSettings?.allowCreate, onKeyDown: (e) => {
|
|
42727
|
-
|
|
42767
|
+
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42728
42768
|
}, onOpenMenu: () => {
|
|
42729
42769
|
if (col.selectSettings?.onOpenMenu) {
|
|
42730
42770
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
@@ -42780,7 +42820,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42780
42820
|
col.selectSettings?.onOpenMenu(row, col, indexRow);
|
|
42781
42821
|
}
|
|
42782
42822
|
}, loadOptions: col.selectSettings?.loadOptions, handleAdd: col.selectSettings?.handAddNew ? (e) => col.selectSettings?.handAddNew(e, indexRow, row) : undefined, fieldChildren: col.selectSettings?.fieldChild ?? 'children', selectChilds: col.selectSettings?.selectChilds, showFooter: col.selectSettings?.showFooter, formatOptionLabel: col.selectSettings?.formatOptionLabel, footerComponent: col.selectSettings?.footerComponent, width: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, isMulti: col.selectSettings?.isMulti, noHeader: col.selectSettings?.noHeader, invalid: col.validate && col.validate(row[col.field], row), maxHeight: col.selectSettings?.heightPopup ? Number(col.selectSettings?.heightPopup) : undefined, menuWidth: col.selectSettings?.widthPopup ? Number(col.selectSettings?.widthPopup) : undefined, textAlign: col.textAlign ?? 'left', onKeyDown: (e) => {
|
|
42783
|
-
|
|
42823
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42784
42824
|
}, onPaste: (e) => {
|
|
42785
42825
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
42786
42826
|
pasteDataFromExcel(indexRow, indexCol, e);
|
|
@@ -42795,7 +42835,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42795
42835
|
}
|
|
42796
42836
|
handleDataChange(row, col, indexRow);
|
|
42797
42837
|
}, onKeyDown: (e) => {
|
|
42798
|
-
|
|
42838
|
+
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
42799
42839
|
} }));
|
|
42800
42840
|
case 'numeric':
|
|
42801
42841
|
const numericFormatProps = {
|
|
@@ -42945,6 +42985,8 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42945
42985
|
addDisable,
|
|
42946
42986
|
editDisable,
|
|
42947
42987
|
focusNewElement,
|
|
42988
|
+
changeDataSource,
|
|
42989
|
+
rowChange,
|
|
42948
42990
|
handleDuplicate: () => handleDuplicate(dataSource, indexFocus, fieldKey, defaultValue, fieldUniKey, changeDataSource, tableElement, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate),
|
|
42949
42991
|
idElement,
|
|
42950
42992
|
indexCol,
|