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
|
@@ -151,6 +151,8 @@ export type IColumnTable = {
|
|
|
151
151
|
headerText?: string;
|
|
152
152
|
/** Tiêu đề hiển thị trên giao diện */
|
|
153
153
|
headerDisplay?: string;
|
|
154
|
+
/** Tiêu đề hiển thị trên giao diện nhóm*/
|
|
155
|
+
columnGroupText?: string;
|
|
154
156
|
/** Khóa chính */
|
|
155
157
|
isPrimarykey?: boolean;
|
|
156
158
|
/** Duy nhất trong bảng */
|
package/dist/index.d.ts
CHANGED
|
@@ -155,6 +155,8 @@ type IColumnTable = {
|
|
|
155
155
|
headerText?: string;
|
|
156
156
|
/** Tiêu đề hiển thị trên giao diện */
|
|
157
157
|
headerDisplay?: string;
|
|
158
|
+
/** Tiêu đề hiển thị trên giao diện nhóm*/
|
|
159
|
+
columnGroupText?: string;
|
|
158
160
|
/** Khóa chính */
|
|
159
161
|
isPrimarykey?: boolean;
|
|
160
162
|
/** Duy nhất trong bảng */
|
package/dist/index.js
CHANGED
|
@@ -39714,7 +39714,7 @@ const SettingColumn = (props) => {
|
|
|
39714
39714
|
// const [indexFocus, setIndexFocus] = useState<number>()
|
|
39715
39715
|
React$5.useEffect(() => {
|
|
39716
39716
|
if (openSidebar) {
|
|
39717
|
-
setDataSource([...column.map(x => ({ ...x }))]);
|
|
39717
|
+
setDataSource([...column.map((x) => ({ ...x }))]);
|
|
39718
39718
|
}
|
|
39719
39719
|
}, [openSidebar]);
|
|
39720
39720
|
const handleCancel = () => {
|
|
@@ -39734,9 +39734,9 @@ const SettingColumn = (props) => {
|
|
|
39734
39734
|
const handleWindowResize = () => {
|
|
39735
39735
|
setWindowSize(getWindowSize());
|
|
39736
39736
|
};
|
|
39737
|
-
window.addEventListener(
|
|
39737
|
+
window.addEventListener('resize', handleWindowResize);
|
|
39738
39738
|
return () => {
|
|
39739
|
-
window.removeEventListener(
|
|
39739
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
39740
39740
|
};
|
|
39741
39741
|
}, []);
|
|
39742
39742
|
const handleResetColumns = () => {
|
|
@@ -39746,7 +39746,7 @@ const SettingColumn = (props) => {
|
|
|
39746
39746
|
handleSidebar();
|
|
39747
39747
|
setDataSource([]);
|
|
39748
39748
|
};
|
|
39749
|
-
const
|
|
39749
|
+
const VisibleTemplate = ({ index, item }) => {
|
|
39750
39750
|
return (jsxRuntime.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) => {
|
|
39751
39751
|
if (dataSource) {
|
|
39752
39752
|
dataSource[index].visible = e.target.checked;
|
|
@@ -39754,9 +39754,9 @@ const SettingColumn = (props) => {
|
|
|
39754
39754
|
}
|
|
39755
39755
|
} }));
|
|
39756
39756
|
};
|
|
39757
|
-
const
|
|
39758
|
-
let textValue = t(item.headerDisplay ??
|
|
39759
|
-
return (jsxRuntime.jsx(Input$1, { defaultValue: textValue, className: classNames$1(
|
|
39757
|
+
const HeaderDisplayTemplate = ({ index, item }) => {
|
|
39758
|
+
let textValue = t(item.headerDisplay ?? item.headerText ?? '');
|
|
39759
|
+
return (jsxRuntime.jsx(Input$1, { defaultValue: textValue, className: classNames$1(''), onChange: (e) => {
|
|
39760
39760
|
textValue = e.target?.value;
|
|
39761
39761
|
}, onBlur: () => {
|
|
39762
39762
|
if (dataSource) {
|
|
@@ -39765,25 +39765,28 @@ const SettingColumn = (props) => {
|
|
|
39765
39765
|
}
|
|
39766
39766
|
} }));
|
|
39767
39767
|
};
|
|
39768
|
-
const
|
|
39769
|
-
const optionsFix = [
|
|
39770
|
-
|
|
39768
|
+
const FixColumnTemplate = ({ index, item }) => {
|
|
39769
|
+
const optionsFix = [
|
|
39770
|
+
{ label: 'Trái', value: 'left' },
|
|
39771
|
+
{ label: 'Phải', value: 'right' }
|
|
39772
|
+
];
|
|
39773
|
+
return (jsxRuntime.jsx(SelectTable, { component: gridRef, options: optionsFix, textAlign: 'left', isClearable: true, onChange: (val) => {
|
|
39771
39774
|
if (dataSource) {
|
|
39772
39775
|
dataSource[index].fixedType = val?.value;
|
|
39773
39776
|
setDataSource([...dataSource]);
|
|
39774
39777
|
}
|
|
39775
|
-
}, value: item.fixedType ? optionsFix.find(x => x.value === item.fixedType) : undefined }));
|
|
39778
|
+
}, value: item.fixedType ? optionsFix.find((x) => x.value === item.fixedType) : undefined }));
|
|
39776
39779
|
};
|
|
39777
|
-
const
|
|
39780
|
+
const WidthColumnTemplate = ({ index, item }) => {
|
|
39778
39781
|
const numericFormatProps = {
|
|
39779
|
-
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() :
|
|
39782
|
+
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() : '',
|
|
39780
39783
|
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39781
39784
|
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39782
39785
|
allowNegative: false,
|
|
39783
39786
|
decimalScale: 0
|
|
39784
39787
|
};
|
|
39785
|
-
let floatValue = parseFloat(item.width?.toString() ??
|
|
39786
|
-
return (jsxRuntime.jsx(NumericFormat, { style: { textAlign: 'right', height: 29, width: '100%' }, ...numericFormatProps, defaultValue: formartNumberic(item.width?.toString() ?? '0', formatSetting?.decimalSeparator ??
|
|
39788
|
+
let floatValue = parseFloat(item.width?.toString() ?? '0');
|
|
39789
|
+
return (jsxRuntime.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) => {
|
|
39787
39790
|
floatValue = values?.floatValue;
|
|
39788
39791
|
}, onFocus: (e) => {
|
|
39789
39792
|
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
@@ -39796,9 +39799,9 @@ const SettingColumn = (props) => {
|
|
|
39796
39799
|
}
|
|
39797
39800
|
} }));
|
|
39798
39801
|
};
|
|
39799
|
-
return (jsxRuntime.jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsxRuntime.jsx(ModalHeader, { typeModal:
|
|
39800
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className:
|
|
39801
|
-
}) }) })] }), jsxRuntime.jsxs("div", { style: { boxShadow:
|
|
39802
|
+
return (jsxRuntime.jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Edit', handleModal: handleCancel, title: 'Column setup' }), jsxRuntime.jsxs("div", { className: "r-setting-container", children: [jsxRuntime.jsxs("div", { style: { fontWeight: 700, color: '#000' }, className: "r-setting-row r-setting-header me-75", children: [jsxRuntime.jsx("span", { className: "r-setting-cell", style: { width: 30 } }), jsxRuntime.jsx("span", { className: "r-setting-cell", style: { width: 200 }, children: t('Column name') }), jsxRuntime.jsx("span", { className: "r-setting-cell", style: { flex: 1 }, children: t('Column name display') }), jsxRuntime.jsx("span", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: t('Display') }), jsxRuntime.jsx("span", { className: "r-setting-cell", style: { width: 100 }, children: t('Fix the column') }), jsxRuntime.jsx("span", { className: "r-setting-cell", style: { width: 110 }, children: t('Column width(px)') })] }), jsxRuntime.jsx("div", { className: "r-setting-content", style: { height: windowSize.innerHeight - 140 }, children: jsxRuntime.jsx(dist.exports.ReactSortable, { tag: "div", list: dataSource, handle: ".drag-icon", setList: (newState) => setDataSource(newState), children: dataSource.map((item, index) => {
|
|
39803
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className: "r-setting-row", children: [jsxRuntime.jsx("div", { className: "r-setting-cell", style: { width: 30 }, children: jsxRuntime.jsx(SvgDragDrop, { fontSize: 12, className: "drag-icon cursor-move" }) }), jsxRuntime.jsx("div", { className: "r-setting-cell", style: { width: 200 }, children: t(item.headerText ?? '') }), jsxRuntime.jsx("div", { className: "r-setting-cell", style: { flex: 1 }, children: jsxRuntime.jsx(HeaderDisplayTemplate, { item: item, index: index }) }), jsxRuntime.jsx("div", { className: "r-setting-cell", style: { width: 80, textAlign: 'center' }, children: jsxRuntime.jsx(VisibleTemplate, { item: item, index: index }) }), jsxRuntime.jsx("div", { className: "r-setting-cell", style: { width: 100 }, children: jsxRuntime.jsx(FixColumnTemplate, { item: item, index: index }) }), jsxRuntime.jsx("div", { className: "r-setting-cell", style: { width: 110 }, children: jsxRuntime.jsx(WidthColumnTemplate, { item: item, index: index }) })] }) }));
|
|
39804
|
+
}) }) })] }), jsxRuntime.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: [jsxRuntime.jsx("div", { children: settingColumns?.updatedDate && (jsxRuntime.jsxs("p", { children: [jsxRuntime.jsxs("strong", { children: [t('Update date'), ": "] }), " ", jsxRuntime.jsx("span", { children: settingColumns.updatedDate ? formatDateTime(settingColumns.updatedDate, 'DD/MM/yyyy HH:mm') : '' }), jsxRuntime.jsxs("strong", { className: "ms-2", children: [t('Editor'), ": "] }), " ", jsxRuntime.jsx("span", { children: settingColumns.updatedByName })] })) }), jsxRuntime.jsxs("div", { children: [resetDefaultColumns && (jsxRuntime.jsx(Button$1$1, { color: "primary", onClick: () => messageBoxConfirm(t, handleResetColumns, {}, 'Do you want to reset the default settings?'), className: "me-1", children: t('Reset') })), jsxRuntime.jsx(Button$1$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t('Confirm') }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleCancel, outline: true, children: t('Close') })] })] })] }));
|
|
39802
39805
|
};
|
|
39803
39806
|
|
|
39804
39807
|
const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }) => {
|
|
@@ -68792,7 +68795,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68792
68795
|
setContentColumns(rs.flat);
|
|
68793
68796
|
return rs;
|
|
68794
68797
|
}, [columns, settingColumns]);
|
|
68795
|
-
const optionGroupColumns = React$5.useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
|
|
68798
|
+
const optionGroupColumns = React$5.useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.columnGroupText ?? x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
|
|
68796
68799
|
const firstColSpan = React$5.useMemo(() => {
|
|
68797
68800
|
let count = 0;
|
|
68798
68801
|
let index = 3;
|
|
@@ -69045,10 +69048,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69045
69048
|
setExpandsAll(undefined);
|
|
69046
69049
|
row.expand = !expand;
|
|
69047
69050
|
} }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
|
|
69048
|
-
|
|
69049
|
-
console.log(firstColSpan);
|
|
69050
|
-
console.log(!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field));
|
|
69051
|
-
if (indexCol < firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
|
|
69051
|
+
if (indexCol <= firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
|
|
69052
69052
|
return;
|
|
69053
69053
|
}
|
|
69054
69054
|
let sumValue = row[colSum.field];
|