react-table-edit 1.5.22 → 1.5.23
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/setting-column.d.ts +1 -1
- package/dist/component/type/index.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -39685,7 +39685,7 @@ const SettingColumn = (props) => {
|
|
|
39685
39685
|
// const [indexFocus, setIndexFocus] = useState<number>()
|
|
39686
39686
|
useEffect(() => {
|
|
39687
39687
|
if (openSidebar) {
|
|
39688
|
-
setDataSource([...column.map(x => ({ ...x }))]);
|
|
39688
|
+
setDataSource([...column.map((x) => ({ ...x }))]);
|
|
39689
39689
|
}
|
|
39690
39690
|
}, [openSidebar]);
|
|
39691
39691
|
const handleCancel = () => {
|
|
@@ -39705,9 +39705,9 @@ const SettingColumn = (props) => {
|
|
|
39705
39705
|
const handleWindowResize = () => {
|
|
39706
39706
|
setWindowSize(getWindowSize());
|
|
39707
39707
|
};
|
|
39708
|
-
window.addEventListener(
|
|
39708
|
+
window.addEventListener('resize', handleWindowResize);
|
|
39709
39709
|
return () => {
|
|
39710
|
-
window.removeEventListener(
|
|
39710
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
39711
39711
|
};
|
|
39712
39712
|
}, []);
|
|
39713
39713
|
const handleResetColumns = () => {
|
|
@@ -39717,7 +39717,7 @@ const SettingColumn = (props) => {
|
|
|
39717
39717
|
handleSidebar();
|
|
39718
39718
|
setDataSource([]);
|
|
39719
39719
|
};
|
|
39720
|
-
const
|
|
39720
|
+
const VisibleTemplate = ({ index, item }) => {
|
|
39721
39721
|
return (jsx(Input$1, { defaultChecked: item.visible ?? true, disabled: item.field === 'command' || item.field === '#' || item.field === 'checkbox' || item.visibleLocked, type: "checkbox", style: { height: 18 }, className: " cursor-pointer", onChange: (e) => {
|
|
39722
39722
|
if (dataSource) {
|
|
39723
39723
|
dataSource[index].visible = e.target.checked;
|
|
@@ -39725,9 +39725,9 @@ const SettingColumn = (props) => {
|
|
|
39725
39725
|
}
|
|
39726
39726
|
} }));
|
|
39727
39727
|
};
|
|
39728
|
-
const
|
|
39729
|
-
let textValue = t(item.headerDisplay ??
|
|
39730
|
-
return (jsx(Input$1, { defaultValue: textValue, className: classNames$1(
|
|
39728
|
+
const HeaderDisplayTemplate = ({ index, item }) => {
|
|
39729
|
+
let textValue = t(item.headerDisplay ?? item.headerText ?? '');
|
|
39730
|
+
return (jsx(Input$1, { defaultValue: textValue, className: classNames$1(''), onChange: (e) => {
|
|
39731
39731
|
textValue = e.target?.value;
|
|
39732
39732
|
}, onBlur: () => {
|
|
39733
39733
|
if (dataSource) {
|
|
@@ -39736,25 +39736,28 @@ const SettingColumn = (props) => {
|
|
|
39736
39736
|
}
|
|
39737
39737
|
} }));
|
|
39738
39738
|
};
|
|
39739
|
-
const
|
|
39740
|
-
const optionsFix = [
|
|
39741
|
-
|
|
39739
|
+
const FixColumnTemplate = ({ index, item }) => {
|
|
39740
|
+
const optionsFix = [
|
|
39741
|
+
{ label: 'Trái', value: 'left' },
|
|
39742
|
+
{ label: 'Phải', value: 'right' }
|
|
39743
|
+
];
|
|
39744
|
+
return (jsx(SelectTable, { component: gridRef, options: optionsFix, textAlign: 'left', isClearable: true, onChange: (val) => {
|
|
39742
39745
|
if (dataSource) {
|
|
39743
39746
|
dataSource[index].fixedType = val?.value;
|
|
39744
39747
|
setDataSource([...dataSource]);
|
|
39745
39748
|
}
|
|
39746
|
-
}, value: item.fixedType ? optionsFix.find(x => x.value === item.fixedType) : undefined }));
|
|
39749
|
+
}, value: item.fixedType ? optionsFix.find((x) => x.value === item.fixedType) : undefined }));
|
|
39747
39750
|
};
|
|
39748
|
-
const
|
|
39751
|
+
const WidthColumnTemplate = ({ index, item }) => {
|
|
39749
39752
|
const numericFormatProps = {
|
|
39750
|
-
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() :
|
|
39753
|
+
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() : '',
|
|
39751
39754
|
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39752
39755
|
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39753
39756
|
allowNegative: false,
|
|
39754
39757
|
decimalScale: 0
|
|
39755
39758
|
};
|
|
39756
|
-
let floatValue = parseFloat(item.width?.toString() ??
|
|
39757
|
-
return (jsx(NumericFormat, { style: { textAlign: 'right', height: 29, width: '100%' }, ...numericFormatProps, defaultValue: formartNumberic(item.width?.toString() ?? '0', formatSetting?.decimalSeparator ??
|
|
39759
|
+
let floatValue = parseFloat(item.width?.toString() ?? '0');
|
|
39760
|
+
return (jsx(NumericFormat, { style: { textAlign: 'right', height: 29, width: '100%' }, ...numericFormatProps, defaultValue: formartNumberic(item.width?.toString() ?? '0', formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', 0), className: classNames$1('form-control'), onValueChange: (values) => {
|
|
39758
39761
|
floatValue = values?.floatValue;
|
|
39759
39762
|
}, onFocus: (e) => {
|
|
39760
39763
|
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
@@ -39767,9 +39770,9 @@ const SettingColumn = (props) => {
|
|
|
39767
39770
|
}
|
|
39768
39771
|
} }));
|
|
39769
39772
|
};
|
|
39770
|
-
return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal:
|
|
39771
|
-
return jsx(Fragment$1, { children: jsxs("div", { className:
|
|
39772
|
-
}) }) })] }), jsxs("div", { style: { boxShadow:
|
|
39773
|
+
return (jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsx(ModalHeader, { typeModal: 'Edit', handleModal: handleCancel, title: 'Column setup' }), jsxs("div", { className: "r-setting-container", children: [jsxs("div", { style: { fontWeight: 700, color: '#000' }, className: "r-setting-row r-setting-header me-75", children: [jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsx("div", { className: "r-setting-content", style: { height: windowSize.innerHeight - 140 }, children: jsx(dist.exports.ReactSortable, { tag: "div", list: dataSource, handle: ".drag-icon", setList: (newState) => setDataSource(newState), children: dataSource.map((item, index) => {
|
|
39774
|
+
return (jsx(Fragment$1, { children: jsxs("div", { className: "r-setting-row", children: [jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsx(SvgDragDrop, { fontSize: 12, className: "drag-icon cursor-move" }) }), jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: jsx(HeaderDisplayTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: jsx(VisibleTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: jsx(FixColumnTemplate, { item: item, index: index }) }), jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: jsx(WidthColumnTemplate, { item: item, index: index }) })] }) }));
|
|
39775
|
+
}) }) })] }), jsxs("div", { style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, className: "d-flex justify-content-between align-items-center w-100 py-75 px-1", children: [jsx("div", { children: settingColumns?.updatedDate && (jsxs("p", { children: [jsxs("strong", { children: [t('Update date'), ": "] }), " ", jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, 'DD/MM/yyyy HH:mm') : '' }), jsxs("strong", { className: "ms-2", children: [t('Editor'), ": "] }), " ", jsx("span", { children: settingColumns.updatedByName })] })) }), jsxs("div", { children: [resetDefaultColumns && (jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t('Reset') })), jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t('Confirm') }), jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t('Close') })] })] })] }));
|
|
39773
39776
|
};
|
|
39774
39777
|
|
|
39775
39778
|
const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }) => {
|
|
@@ -68763,7 +68766,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68763
68766
|
setContentColumns(rs.flat);
|
|
68764
68767
|
return rs;
|
|
68765
68768
|
}, [columns, settingColumns]);
|
|
68766
|
-
const optionGroupColumns = useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
|
|
68769
|
+
const optionGroupColumns = useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.columnGroupText ?? x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
|
|
68767
68770
|
const firstColSpan = useMemo(() => {
|
|
68768
68771
|
let count = 0;
|
|
68769
68772
|
let index = 3;
|
|
@@ -69016,10 +69019,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69016
69019
|
setExpandsAll(undefined);
|
|
69017
69020
|
row.expand = !expand;
|
|
69018
69021
|
} }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
|
|
69019
|
-
|
|
69020
|
-
console.log(firstColSpan);
|
|
69021
|
-
console.log(!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field));
|
|
69022
|
-
if (indexCol < firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
|
|
69022
|
+
if (indexCol <= firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
|
|
69023
69023
|
return;
|
|
69024
69024
|
}
|
|
69025
69025
|
let sumValue = row[colSum.field];
|