react-table-edit 1.4.14 → 1.4.16
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/table/header.d.ts +2 -0
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -41708,7 +41708,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
|
|
|
41708
41708
|
styleInject(css_248z$1);
|
|
41709
41709
|
|
|
41710
41710
|
const HeaderTableCol = (props) => {
|
|
41711
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, column, setColumn, isMulti } = props;
|
|
41711
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, column, setColumn, fisrtObjWidthFixRight, lastObjWidthFixLeft, isMulti } = props;
|
|
41712
41712
|
const { t } = useTranslation();
|
|
41713
41713
|
const handleResize = (e, { size }) => {
|
|
41714
41714
|
// Update the column width here
|
|
@@ -41725,7 +41725,7 @@ const HeaderTableCol = (props) => {
|
|
|
41725
41725
|
setColumn(newColumns);
|
|
41726
41726
|
}
|
|
41727
41727
|
};
|
|
41728
|
-
return (jsx(Fragment, { children: col.visible !== false && (jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: false }, children: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : undefined, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classnames(`r-headercell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }), style: {
|
|
41728
|
+
return (jsx(Fragment, { children: col.visible !== false && (jsx(Resizable, { className: "r-resize", width: typeof col.width === 'number' ? col.width : Number((col.width ?? "").replaceAll(new RegExp(`[^0-9]`, "g"), '')), height: 0, onResize: handleResize, draggableOpts: { enableUserSelectHack: false }, children: jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : undefined, colSpan: col.columns?.filter(x => x.visible !== false)?.length ?? 1, className: classnames(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
|
|
41729
41729
|
top: `${indexParent * 42}px`,
|
|
41730
41730
|
left: col.fixedType === 'left' ? objWidthFixLeft[col.index ?? 0] : undefined,
|
|
41731
41731
|
right: col.fixedType === 'right' ? objWidthFixRight[col.index ?? 0] : undefined,
|
|
@@ -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) => {
|
|
@@ -42274,10 +42274,10 @@ const isSelectMenuOpen = (element) => {
|
|
|
42274
42274
|
};
|
|
42275
42275
|
const handleArrowUp = (e, params) => {
|
|
42276
42276
|
const { idElement, indexCol, indexRow, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, contentColumns, dataSource, row } = params;
|
|
42277
|
-
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
42277
|
+
if ((e.ctrlKey || e.metaKey || e.altKey) && e.shiftKey) {
|
|
42278
42278
|
if (indexRow > 0) {
|
|
42279
42279
|
const column = contentColumns[indexCol - 1];
|
|
42280
|
-
for (let index = indexRow -
|
|
42280
|
+
for (let index = indexRow - 2; index >= 0; index--) {
|
|
42281
42281
|
const element = dataSource[index];
|
|
42282
42282
|
element[column.field ?? ''] = row[column.field ?? ''];
|
|
42283
42283
|
if (column.callback && column.callbackValue) {
|
|
@@ -42285,7 +42285,7 @@ const handleArrowUp = (e, params) => {
|
|
|
42285
42285
|
column.callback(value, index, element);
|
|
42286
42286
|
}
|
|
42287
42287
|
if (rowChange) {
|
|
42288
|
-
rowChange(element,
|
|
42288
|
+
rowChange(element, index, column.field);
|
|
42289
42289
|
}
|
|
42290
42290
|
}
|
|
42291
42291
|
changeDataSource(dataSource);
|
|
@@ -42310,7 +42310,7 @@ const handleArrowUp = (e, params) => {
|
|
|
42310
42310
|
};
|
|
42311
42311
|
const handleArrowDown = (e, params) => {
|
|
42312
42312
|
const { idElement, indexCol, indexRow, totalCount, pagingClient, pagingSetting, setIndexFocus, focusNewElement, rowChange, changeDataSource, dataSource, contentColumns, row } = params;
|
|
42313
|
-
if ((e.ctrlKey || e.metaKey) && e.shiftKey) {
|
|
42313
|
+
if ((e.ctrlKey || e.metaKey || e.altKey) && e.shiftKey) {
|
|
42314
42314
|
if (indexRow < totalCount) {
|
|
42315
42315
|
const column = contentColumns[indexCol - 1];
|
|
42316
42316
|
for (let index = indexRow; index < totalCount; index++) {
|
|
@@ -42321,7 +42321,7 @@ const handleArrowDown = (e, params) => {
|
|
|
42321
42321
|
column.callback(value, index, element);
|
|
42322
42322
|
}
|
|
42323
42323
|
if (rowChange) {
|
|
42324
|
-
rowChange(element,
|
|
42324
|
+
rowChange(element, index, column.field);
|
|
42325
42325
|
}
|
|
42326
42326
|
}
|
|
42327
42327
|
changeDataSource(dataSource);
|
|
@@ -43059,7 +43059,6 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43059
43059
|
}
|
|
43060
43060
|
});
|
|
43061
43061
|
const column = getColumn(indexCol, index);
|
|
43062
|
-
console.log(column);
|
|
43063
43062
|
if (column) {
|
|
43064
43063
|
if ((!column.disabledCondition || !column.disabledCondition(dataSource[currenRowIndex + 0])) && column.editEnable && column.onPasteValidate) {
|
|
43065
43064
|
const rs = await column.onPasteValidate(stringData.join(','), currenRowIndex + 0, dataSource[currenRowIndex + 0]);
|
|
@@ -43093,7 +43092,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43093
43092
|
dataRow[column.field] = stringData;
|
|
43094
43093
|
}
|
|
43095
43094
|
if (column.callback) {
|
|
43096
|
-
column.callback(rs, currenRowIndex + indexRow);
|
|
43095
|
+
column.callback(rs, currenRowIndex + indexRow, dataRow);
|
|
43097
43096
|
}
|
|
43098
43097
|
}
|
|
43099
43098
|
else {
|
|
@@ -43111,7 +43110,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43111
43110
|
dataRow[column.field] = date;
|
|
43112
43111
|
}
|
|
43113
43112
|
if (column.callback) {
|
|
43114
|
-
column.callback(date, currenRowIndex + indexRow);
|
|
43113
|
+
column.callback(date, currenRowIndex + indexRow, dataRow);
|
|
43115
43114
|
}
|
|
43116
43115
|
}
|
|
43117
43116
|
else {
|
|
@@ -43128,7 +43127,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43128
43127
|
dataRow[column.field] = number;
|
|
43129
43128
|
}
|
|
43130
43129
|
if (column.callback) {
|
|
43131
|
-
column.callback(number, currenRowIndex + indexRow);
|
|
43130
|
+
column.callback(number, currenRowIndex + indexRow, dataRow);
|
|
43132
43131
|
}
|
|
43133
43132
|
}
|
|
43134
43133
|
else {
|
|
@@ -43144,7 +43143,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43144
43143
|
dataRow[column.field] = stringData;
|
|
43145
43144
|
}
|
|
43146
43145
|
if (column.callback) {
|
|
43147
|
-
column.callback(stringData, currenRowIndex + indexRow);
|
|
43146
|
+
column.callback(stringData, currenRowIndex + indexRow, dataRow);
|
|
43148
43147
|
}
|
|
43149
43148
|
}
|
|
43150
43149
|
else {
|
|
@@ -43157,7 +43156,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43157
43156
|
dataRow[column.field] = stringData;
|
|
43158
43157
|
}
|
|
43159
43158
|
if (column.callback) {
|
|
43160
|
-
column.callback(rs, currenRowIndex + indexRow);
|
|
43159
|
+
column.callback(rs, currenRowIndex + indexRow, dataRow);
|
|
43161
43160
|
}
|
|
43162
43161
|
}
|
|
43163
43162
|
else {
|
|
@@ -43173,7 +43172,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43173
43172
|
dataRow[column.field] = stringData;
|
|
43174
43173
|
}
|
|
43175
43174
|
if (column.callback) {
|
|
43176
|
-
column.callback(stringData, currenRowIndex + indexRow);
|
|
43175
|
+
column.callback(stringData, currenRowIndex + indexRow, dataRow);
|
|
43177
43176
|
}
|
|
43178
43177
|
}
|
|
43179
43178
|
}
|
|
@@ -43426,7 +43425,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
43426
43425
|
}, [searchTerm, searchSetting?.searchTerm]);
|
|
43427
43426
|
return (jsxs(Fragment, { children: [jsxs("div", { className: "react-table-edit", children: [jsxs("div", { className: 'r-grid', ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx("div", { ref: tableElement, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}`, minHeight: `${minHeight ? `${minHeight}px` : ''}`, maxHeight: `${maxHeight ? `${maxHeight}px` : '400px'}` }, children: jsxs("table", { style: { width: '100%' }, children: [jsx("thead", { className: 'r-gridheader', children: headerColumns.map((element, indexParent) => {
|
|
43428
43427
|
return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43429
|
-
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, column: contentColumns, setColumn: setContentColumns, totalCount: totalCount }, `header-${indexParent}-${index}`));
|
|
43428
|
+
return (jsx(HeaderTableCol, { col: col, dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, column: contentColumns, setColumn: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: totalCount }, `header-${indexParent}-${index}`));
|
|
43430
43429
|
}) }, `header-${-indexParent}`));
|
|
43431
43430
|
}) }), jsx("tbody", { className: 'r-gridcontent', children: renderData() }), jsx("tfoot", { className: "r-gridfoot", children: haveSum == true ? jsx("tr", { className: 'r-row', children: contentColumns.map((col, index) => {
|
|
43432
43431
|
return (renderFooterCol(col, index));
|