react-table-edit 1.4.5 → 1.4.7
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 +10 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -42139,7 +42139,7 @@ pagingClient, pagingSetting
|
|
|
42139
42139
|
await onDuplicate(newData, indexFocus);
|
|
42140
42140
|
}
|
|
42141
42141
|
if (pagingClient) {
|
|
42142
|
-
dataSource.splice((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0) + indexFocus) + 1, 0, newData);
|
|
42142
|
+
dataSource.splice(((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0)) + indexFocus) + 1, 0, newData);
|
|
42143
42143
|
}
|
|
42144
42144
|
else {
|
|
42145
42145
|
dataSource.splice(indexFocus + 1, 0, newData);
|
|
@@ -42159,7 +42159,7 @@ changeDataSource,
|
|
|
42159
42159
|
tableElement, totalCount, pagingClient, pagingSetting, toolbarSetting, buttonSetting, editDisable, addDisable) => {
|
|
42160
42160
|
if (toolbarSetting?.showBottomToolbar && !buttonSetting?.insertAfterDisable && !editDisable && !addDisable) {
|
|
42161
42161
|
if (pagingClient) {
|
|
42162
|
-
dataSource.splice((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0) + (indexFocus ?? -1) + 1), 0, { ...{ ...defaultValue } });
|
|
42162
|
+
dataSource.splice(((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0)) + (indexFocus ?? -1) + 1), 0, { ...{ ...defaultValue } });
|
|
42163
42163
|
}
|
|
42164
42164
|
else {
|
|
42165
42165
|
dataSource.splice((indexFocus ?? -1) + 1, 0, { ...defaultValue });
|
|
@@ -42179,7 +42179,7 @@ changeDataSource,
|
|
|
42179
42179
|
pagingClient, pagingSetting, toolbarSetting, buttonSetting, editDisable, addDisable) => {
|
|
42180
42180
|
if (toolbarSetting?.showBottomToolbar && !buttonSetting?.insertBeforeDisable && !editDisable && !addDisable) {
|
|
42181
42181
|
if (pagingClient) {
|
|
42182
|
-
dataSource.splice((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0) + (indexFocus ?? -1)), 0, { ...{ ...defaultValue } });
|
|
42182
|
+
dataSource.splice(((((pagingSetting?.currentPage ?? 1) - 1) * (pagingSetting?.pageSize ?? 0)) + (indexFocus ?? -1)), 0, { ...{ ...defaultValue } });
|
|
42183
42183
|
}
|
|
42184
42184
|
else {
|
|
42185
42185
|
dataSource.splice((indexFocus ?? -1), 0, { ...defaultValue });
|
|
@@ -42204,14 +42204,11 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
|
|
|
42204
42204
|
|
|
42205
42205
|
const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, indexFocus, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns, t }) => {
|
|
42206
42206
|
return (jsx("div", { id: "table_custom_bottom_toolbar", className: "r-toolbar r-toolbar-bottom", role: "toolbar", "aria-disabled": "false", "aria-haspopup": "false", "aria-orientation": "horizontal", children: jsxs("div", { className: "r-toolbar-items", children: [jsxs("div", { className: "r-toolbar-left", children: [jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleAdd, className: 'd-flex', children: t('Add item') }) }), (indexFocus ?? -1) > -1 ? jsxs(Fragment$1, { children: [jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.duplicateDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: () => { handleDuplicate(); }, className: 'd-flex', children: t('Duplicate') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertBeforeDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertBefore, className: 'd-flex', children: t('Insert item before') }) }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || addDisable || buttonSetting?.insertAfterDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'success', outline: true, onClick: handleInsertAfter, className: 'd-flex', children: t('Insert item after') }) })] }) : jsx(Fragment$1, { children: " " }), jsx("div", { className: classnames('r-toolbar-item', { 'd-none': editDisable || buttonSetting?.deleteAllDisable }), "aria-disabled": "false", children: jsx(Button$1, { color: 'primary', outline: true, onClick: handleDeleteAll, className: 'd-flex', children: t('Delete all item') }) }), toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42207
|
-
return ((item.align === 'left') ?
|
|
42208
|
-
jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : '');
|
|
42207
|
+
return ((item.align === 'left') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-left-${index}`) : '');
|
|
42209
42208
|
})] }), jsx("div", { className: "r-toolbar-center", children: toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42210
|
-
return ((item.align === 'center') ?
|
|
42211
|
-
jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
|
|
42209
|
+
return ((item.align === 'center') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-center-${index}`) : '');
|
|
42212
42210
|
}) }), jsxs("div", { className: "r-toolbar-right", children: [toolbarSetting?.toolbarBottomOptions?.map((item, index) => {
|
|
42213
|
-
return ((item.align === 'right') ?
|
|
42214
|
-
jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
|
|
42211
|
+
return ((item.align === 'right') ? jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template() }, `toolbar-bottom-right-${index}`) : '');
|
|
42215
42212
|
}), 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" })] }) })] }) })] })] }) }));
|
|
42216
42213
|
};
|
|
42217
42214
|
|
|
@@ -42343,7 +42340,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42343
42340
|
const [searchTerm, setSearchTerm] = useState('');
|
|
42344
42341
|
const tableElement = useRef(null);
|
|
42345
42342
|
const gridRef = useRef(null);
|
|
42346
|
-
|
|
42343
|
+
const totalCount = dataSource.length;
|
|
42347
42344
|
const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
|
|
42348
42345
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
42349
42346
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
|
|
@@ -42646,13 +42643,13 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42646
42643
|
} }));
|
|
42647
42644
|
case 'numeric':
|
|
42648
42645
|
const numericFormatProps = {
|
|
42649
|
-
value: !isNullOrUndefined$1(row[col.field]) ? row[col.field] : '',
|
|
42646
|
+
value: !isNullOrUndefined$1(row[col.field]) ? row[col.field].toString() : '',
|
|
42650
42647
|
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
42651
42648
|
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
42652
42649
|
allowNegative: col.numericSettings?.allowNegative ?? false,
|
|
42653
42650
|
decimalScale: col.numericSettings?.fraction ?? 0
|
|
42654
42651
|
};
|
|
42655
|
-
let floatValue = parseFloat(row[col.field]);
|
|
42652
|
+
let floatValue = parseFloat(row[col.field] ?? '0');
|
|
42656
42653
|
return (jsx(NumericFormat, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, style: { textAlign: col.textAlign, height: 29 }, ...numericFormatProps, defaultValue: formartNumberic(row[col.field], formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction), className: classnames('form-control border-0 rounded-0 input-numeric', { 'is-invalid': col.validate && col.validate(row[col.field], row) }), onValueChange: (values) => {
|
|
42657
42654
|
floatValue = values?.floatValue;
|
|
42658
42655
|
}, onFocus: (e) => {
|
|
@@ -42696,7 +42693,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
42696
42693
|
} }, `col-${indexRow}-${indexCol}`) }));
|
|
42697
42694
|
case 'form':
|
|
42698
42695
|
return (jsx(EditForm, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, ...col.formSettings, field: col.field, displayValue: col.formSettings?.displayValue ? col.formSettings?.displayValue(row) : '', placeholder: col.placeholder ? t(col.placeholder) : '', rowData: row, indexRow: indexRow, onChange: (val) => {
|
|
42699
|
-
row
|
|
42696
|
+
Object.assign(row, val);
|
|
42700
42697
|
handleDataChange(row, col, indexRow);
|
|
42701
42698
|
}, invalid: col.validate && col.validate(row[col.field], row), textAlign: col.textAlign, onKeyDown: (e) => {
|
|
42702
42699
|
return checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|