react-table-edit 1.5.21 → 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/data-table.d.ts +0 -1
- package/dist/component/table/gourp-col.d.ts +8 -0
- package/dist/component/table/header.d.ts +2 -0
- package/dist/component/table/setting-column.d.ts +1 -1
- package/dist/component/table-view/content.d.ts +2 -0
- package/dist/component/table-view/index.d.ts +1 -0
- package/dist/component/type/index.d.ts +2 -0
- package/dist/component/utils.d.ts +0 -1
- package/dist/component/wizard/index.d.ts +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +99 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -76
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19986,8 +19986,8 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19986
19986
|
}
|
|
19987
19987
|
traverse(columns);
|
|
19988
19988
|
// Danh sách các cột được hiển thị
|
|
19989
|
-
const flatVisble = flat.filter((e) => e.visible !== false)
|
|
19990
|
-
const flatVisbleContent =
|
|
19989
|
+
// const flatVisble = flat.filter((e) => e.visible !== false)
|
|
19990
|
+
const flatVisbleContent = flat.filter((x) => x.visible !== false && x.field !== 'command' && x.field !== '#' && x.field !== 'checkbox');
|
|
19991
19991
|
// Tính toán vị trí đầu tiên và cuối cùng của các cột cố định
|
|
19992
19992
|
const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
|
|
19993
19993
|
const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
|
|
@@ -19997,7 +19997,7 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19997
19997
|
return {
|
|
19998
19998
|
levels,
|
|
19999
19999
|
flat,
|
|
20000
|
-
flatVisble,
|
|
20000
|
+
// flatVisble,
|
|
20001
20001
|
flatVisbleContent,
|
|
20002
20002
|
objWidthFixLeft,
|
|
20003
20003
|
objWidthFixRight,
|
|
@@ -20585,12 +20585,6 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
|
|
|
20585
20585
|
}
|
|
20586
20586
|
};
|
|
20587
20587
|
|
|
20588
|
-
const RenderColGroup = ({ contentColumns }) => (jsxRuntime.jsx("colgroup", { children: contentColumns.map((col, index) => (jsxRuntime.jsx("col", { style: {
|
|
20589
|
-
width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
|
|
20590
|
-
minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
|
|
20591
|
-
maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
|
|
20592
|
-
} }, index))) }));
|
|
20593
|
-
|
|
20594
20588
|
const IconCustom = (props) => {
|
|
20595
20589
|
const { iconName, size } = props;
|
|
20596
20590
|
if (iconName === '') {
|
|
@@ -36812,6 +36806,15 @@ const FooterCol = ({ col, indexCol, dataSource, objWidthFix, formatSetting }) =>
|
|
|
36812
36806
|
}, children: jsxRuntime.jsx("div", { className: "r-footer-div", children: col.haveSum === true && col.type === "numeric" && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Number(sumValue) >= 0 ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) })) : (jsxRuntime.jsx("div", { style: { color: formatSetting?.colorNegative ?? "red" }, children: `${formatSetting?.prefixNegative ?? "-"}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ""}` })) })) }) })) }, `summarycell-${indexCol}`));
|
|
36813
36807
|
};
|
|
36814
36808
|
|
|
36809
|
+
const RenderColGroup = ({ contentColumns, groupColumns, visibleGroupColumn }) => (jsxRuntime.jsx("colgroup", { children: contentColumns.map((col, index) => {
|
|
36810
|
+
return (col.visible !== false &&
|
|
36811
|
+
(visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsxRuntime.jsx("col", { style: {
|
|
36812
|
+
width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
|
|
36813
|
+
minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
|
|
36814
|
+
maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
|
|
36815
|
+
} }, index)));
|
|
36816
|
+
}) }));
|
|
36817
|
+
|
|
36815
36818
|
var reactResizable = {exports: {}};
|
|
36816
36819
|
|
|
36817
36820
|
var Resizable$2 = {};
|
|
@@ -38984,7 +38987,7 @@ const DateRangeFilterComponent = ({ fieldFilter, filterBy, handleSave }) => {
|
|
|
38984
38987
|
};
|
|
38985
38988
|
|
|
38986
38989
|
const HeaderTableCol = (props) => {
|
|
38987
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, setContentColumns, formatSetting, optionsFilter, idTable, isMulti } = props;
|
|
38990
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, setContentColumns, formatSetting, optionsFilter, idTable, isMulti, groupColumns, visibleGroupColumn } = props;
|
|
38988
38991
|
const { t } = reactI18next.useTranslation();
|
|
38989
38992
|
const headerRef = React$5.useRef(null);
|
|
38990
38993
|
const order = orderBy.find((item) => item.key === col.field);
|
|
@@ -39003,7 +39006,7 @@ const HeaderTableCol = (props) => {
|
|
|
39003
39006
|
const checkOverflow = () => {
|
|
39004
39007
|
return headerRef.current && headerRef.current.scrollHeight > headerRef.current.clientHeight;
|
|
39005
39008
|
};
|
|
39006
|
-
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && (jsxRuntime.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: true }, children: jsxRuntime.jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : 1, colSpan: col.columns?.filter((x) => x.visible !== false)?.length ?? 1, className: classNames$1(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
|
|
39009
|
+
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsxRuntime.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: true }, children: jsxRuntime.jsx("th", { rowSpan: col.rowspan !== 1 ? col.rowspan : 1, colSpan: col.columns?.filter((x) => x.visible !== false)?.length ?? 1, className: classNames$1(`r-headercell fix-${col.fixedType}`, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'cell-fixed': col.fixedType }), style: {
|
|
39007
39010
|
top: `${indexParent * 42}px`,
|
|
39008
39011
|
left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
|
|
39009
39012
|
right: col.fixedType === 'right' ? objHeaderWidthFixRight[`${indexParent}-${indexCol ?? 0}`] : undefined
|
|
@@ -39046,7 +39049,7 @@ const HeaderTableCol = (props) => {
|
|
|
39046
39049
|
}, children: jsxRuntime.jsx(DropdownItem$1, { className: "p-1", style: { borderRadius: '6px' }, tag: "div", header: true, children: jsxRuntime.jsx(FilterComponent, { setOpenFilter: setOpenFilter, filterBy: filterBy, optionsFilter: optionsFilter, formatSetting: formatSetting, changeFilter: changeFilter, column: col }) }) })] }))] }))] }))] }) }) })) }, `header-${indexCol}`));
|
|
39047
39050
|
};
|
|
39048
39051
|
|
|
39049
|
-
const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns,
|
|
39052
|
+
const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, selectedRows, setSelectedRows, selectedCell, startCell, editCell, gridRef, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, totalCount, isMulti, selectEnable, editDisable, addDisable, defaultValue, fieldKey, fieldUniKey, formatSetting, toolbarSetting, buttonSetting, containerRef, handleDataChange, changeDataSource, handleCommandClick, handleDuplicate, handleKeyDown, onDuplicate, setSelectedCell, setStartCell, focusEditElementCell, setContentColumns, handeCopyCell, isCopying, typeDragging, rowChange, visibleContentColumns, filterBy, setFilterBy, orderBy, setOrderBy, optionsFilter, allowFiltering, allowSorting, searchSetting, searchTerm, searchClient, height, rowHeight, haveSum }) => {
|
|
39050
39053
|
const filteredData = React$5.useMemo(() => {
|
|
39051
39054
|
const arr = dataSource.map((row, index) => ({ data: row, indexRow: index }));
|
|
39052
39055
|
if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && searchClient) {
|
|
@@ -39082,7 +39085,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
|
|
|
39082
39085
|
}
|
|
39083
39086
|
};
|
|
39084
39087
|
}, []);
|
|
39085
|
-
return (jsxRuntime.jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxRuntime.jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsxRuntime.jsx(RenderColGroup, { contentColumns:
|
|
39088
|
+
return (jsxRuntime.jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxRuntime.jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: contentColumns }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
|
|
39086
39089
|
return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
39087
39090
|
return (jsxRuntime.jsx(HeaderTableCol, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: containerRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
|
|
39088
39091
|
setFilterBy([...val]);
|
|
@@ -39711,7 +39714,7 @@ const SettingColumn = (props) => {
|
|
|
39711
39714
|
// const [indexFocus, setIndexFocus] = useState<number>()
|
|
39712
39715
|
React$5.useEffect(() => {
|
|
39713
39716
|
if (openSidebar) {
|
|
39714
|
-
setDataSource([...column.map(x => ({ ...x }))]);
|
|
39717
|
+
setDataSource([...column.map((x) => ({ ...x }))]);
|
|
39715
39718
|
}
|
|
39716
39719
|
}, [openSidebar]);
|
|
39717
39720
|
const handleCancel = () => {
|
|
@@ -39731,9 +39734,9 @@ const SettingColumn = (props) => {
|
|
|
39731
39734
|
const handleWindowResize = () => {
|
|
39732
39735
|
setWindowSize(getWindowSize());
|
|
39733
39736
|
};
|
|
39734
|
-
window.addEventListener(
|
|
39737
|
+
window.addEventListener('resize', handleWindowResize);
|
|
39735
39738
|
return () => {
|
|
39736
|
-
window.removeEventListener(
|
|
39739
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
39737
39740
|
};
|
|
39738
39741
|
}, []);
|
|
39739
39742
|
const handleResetColumns = () => {
|
|
@@ -39743,7 +39746,7 @@ const SettingColumn = (props) => {
|
|
|
39743
39746
|
handleSidebar();
|
|
39744
39747
|
setDataSource([]);
|
|
39745
39748
|
};
|
|
39746
|
-
const
|
|
39749
|
+
const VisibleTemplate = ({ index, item }) => {
|
|
39747
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) => {
|
|
39748
39751
|
if (dataSource) {
|
|
39749
39752
|
dataSource[index].visible = e.target.checked;
|
|
@@ -39751,9 +39754,9 @@ const SettingColumn = (props) => {
|
|
|
39751
39754
|
}
|
|
39752
39755
|
} }));
|
|
39753
39756
|
};
|
|
39754
|
-
const
|
|
39755
|
-
let textValue = t(item.headerDisplay ??
|
|
39756
|
-
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) => {
|
|
39757
39760
|
textValue = e.target?.value;
|
|
39758
39761
|
}, onBlur: () => {
|
|
39759
39762
|
if (dataSource) {
|
|
@@ -39762,25 +39765,28 @@ const SettingColumn = (props) => {
|
|
|
39762
39765
|
}
|
|
39763
39766
|
} }));
|
|
39764
39767
|
};
|
|
39765
|
-
const
|
|
39766
|
-
const optionsFix = [
|
|
39767
|
-
|
|
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) => {
|
|
39768
39774
|
if (dataSource) {
|
|
39769
39775
|
dataSource[index].fixedType = val?.value;
|
|
39770
39776
|
setDataSource([...dataSource]);
|
|
39771
39777
|
}
|
|
39772
|
-
}, value: item.fixedType ? optionsFix.find(x => x.value === item.fixedType) : undefined }));
|
|
39778
|
+
}, value: item.fixedType ? optionsFix.find((x) => x.value === item.fixedType) : undefined }));
|
|
39773
39779
|
};
|
|
39774
|
-
const
|
|
39780
|
+
const WidthColumnTemplate = ({ index, item }) => {
|
|
39775
39781
|
const numericFormatProps = {
|
|
39776
|
-
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() :
|
|
39782
|
+
value: !isNullOrUndefined$1(item.width) ? item.width?.toString() : '',
|
|
39777
39783
|
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39778
39784
|
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
39779
39785
|
allowNegative: false,
|
|
39780
39786
|
decimalScale: 0
|
|
39781
39787
|
};
|
|
39782
|
-
let floatValue = parseFloat(item.width?.toString() ??
|
|
39783
|
-
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) => {
|
|
39784
39790
|
floatValue = values?.floatValue;
|
|
39785
39791
|
}, onFocus: (e) => {
|
|
39786
39792
|
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
@@ -39793,9 +39799,9 @@ const SettingColumn = (props) => {
|
|
|
39793
39799
|
}
|
|
39794
39800
|
} }));
|
|
39795
39801
|
};
|
|
39796
|
-
return (jsxRuntime.jsxs(Sidebar, { open: openSidebar, toggleSidebar: handleCancel, width: 900, children: [jsxRuntime.jsx(ModalHeader, { typeModal:
|
|
39797
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { className:
|
|
39798
|
-
}) }) })] }), 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') })] })] })] }));
|
|
39799
39805
|
};
|
|
39800
39806
|
|
|
39801
39807
|
const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleInsertAfter, handleDeleteAll, setOpenPopupSetupColumn, focusRow, editDisable, addDisable, buttonSetting, toolbarSetting, headerColumns }) => {
|
|
@@ -39839,7 +39845,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
39839
39845
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
39840
39846
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
|
|
39841
39847
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
39842
|
-
const { levels: headerColumns,
|
|
39848
|
+
const { levels: headerColumns, flatVisbleContent: visibleContentColumns, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit, indexLastEdit } = React$5.useMemo(() => {
|
|
39843
39849
|
const rs = calculateTableStructure(columns, settingColumns?.value);
|
|
39844
39850
|
setContentColumns(rs.flat);
|
|
39845
39851
|
return rs;
|
|
@@ -40213,7 +40219,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
40213
40219
|
}
|
|
40214
40220
|
}
|
|
40215
40221
|
};
|
|
40216
|
-
return (jsxRuntime.jsx(React$5.Fragment, { children: jsxRuntime.jsxs("div", { className: "r-table-edit", children: [jsxRuntime.jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns,
|
|
40222
|
+
return (jsxRuntime.jsx(React$5.Fragment, { children: jsxRuntime.jsxs("div", { className: "r-table-edit", children: [jsxRuntime.jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsxRuntime.jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns, selectedRows: selectedRows, setSelectedRows: setSelectedRows, selectedCell: selectedCell, startCell: startCell, editCell: editCell, gridRef: gridRef, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, fisrtObjWidthFixRight: fisrtObjWidthFixRight, totalCount: totalCount, isMulti: isMulti, selectEnable: selectEnable, editDisable: editDisable, addDisable: addDisable, defaultValue: defaultValue, fieldKey: fieldKey, fieldUniKey: fieldUniKey, formatSetting: formatSetting, toolbarSetting: toolbarSetting, buttonSetting: buttonSetting, containerRef: containerRef, optionsFilter: optionsFilter, allowFiltering: allowFiltering, allowSorting: allowSorting, searchSetting: searchSetting, searchTerm: searchTerm, haveSum: haveSum, isCopying: isCopying, typeDragging: typeDragging, visibleContentColumns: visibleContentColumns, rowHeight: rowHeight, changeDataSource: changeDataSource, handleCommandClick: handleCommandClick, handleKeyDown: handleKeyDown, handeCopyCell: handeCopyCell, onDuplicate: onDuplicate, setSelectedCell: setSelectedCell, setStartCell: setStartCell, focusEditElementCell: focusEditElementCell, rowChange: rowChange, filterBy: filterBy, setFilterBy: setFilterBy, orderBy: orderBy, setOrderBy: setOrderBy, searchClient: searchClient, handleDataChange: handleDataChange, handleDuplicate: () => {
|
|
40217
40223
|
handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
|
|
40218
40224
|
}, setContentColumns: (newColumns) => {
|
|
40219
40225
|
setContentColumns(newColumns);
|
|
@@ -49059,12 +49065,14 @@ const Wizard = React$5.forwardRef((props, ref) => {
|
|
|
49059
49065
|
const { steps, activeStep, setActiveStep, className = '', headerClassName = '', contentClassName = '', contentWrapperClassName = '', type = 'horizontal', heightContent = 'auto', widthContent = '100%', separator = jsxRuntime.jsx(SvgChevronRight, { fontSize: 17 }) } = props;
|
|
49060
49066
|
// ** Renders Wizard Header
|
|
49061
49067
|
const renderHeader = () => {
|
|
49062
|
-
return steps
|
|
49063
|
-
|
|
49064
|
-
|
|
49068
|
+
return steps
|
|
49069
|
+
.filter((x) => x.visible !== false)
|
|
49070
|
+
.map((step, index) => {
|
|
49071
|
+
return (jsxRuntime.jsxs(React$5.Fragment, { children: [index !== 0 && index !== steps.length ? jsxRuntime.jsx("div", { className: "line", children: separator }) : null, jsxRuntime.jsx("div", { className: classNames$1('step', {
|
|
49072
|
+
crossed: step.done !== undefined ? step.done : activeStep > index + 1,
|
|
49065
49073
|
disable: step.disable,
|
|
49066
|
-
active:
|
|
49067
|
-
}), "data-target": `#${step.id}`, children: jsxRuntime.jsxs("button", { type:
|
|
49074
|
+
active: index + 1 === activeStep
|
|
49075
|
+
}), "data-target": `#${step.id}`, children: jsxRuntime.jsxs("button", { type: "button", disabled: step.disable, className: "step-trigger", onClick: () => setActiveStep?.(index + 1), children: [jsxRuntime.jsx("span", { className: "bs-stepper-box", children: step.icon ? step.icon : index + 1 }), jsxRuntime.jsxs("span", { className: "bs-stepper-label", children: [jsxRuntime.jsxs("span", { className: "bs-stepper-title", children: [step.title, " "] }), step.loading && jsxRuntime.jsx(Spinner$1, { className: "text-info", style: { borderWidth: 2, height: 15, width: 15, marginRight: 3 } }), " ", step.subtitle ? jsxRuntime.jsx("span", { className: "bs-stepper-subtitle", children: step.subtitle }) : null] })] }) })] }, step.id));
|
|
49068
49076
|
});
|
|
49069
49077
|
};
|
|
49070
49078
|
// ** Renders Wizard Content
|
|
@@ -49072,7 +49080,7 @@ const Wizard = React$5.forwardRef((props, ref) => {
|
|
|
49072
49080
|
return steps.map((step, index) => {
|
|
49073
49081
|
return (jsxRuntime.jsx("div", { className: classNames$1('content', {
|
|
49074
49082
|
[contentClassName]: contentClassName,
|
|
49075
|
-
'active dstepper-block': activeStep ===
|
|
49083
|
+
'active dstepper-block': activeStep === index + 1
|
|
49076
49084
|
}), id: step.id, children: step.content }, step.id));
|
|
49077
49085
|
});
|
|
49078
49086
|
};
|
|
@@ -68334,13 +68342,11 @@ const ModalImportComponent = (props) => {
|
|
|
68334
68342
|
const [isSaveSetting, setIsSaveSetting] = React$5.useState(true);
|
|
68335
68343
|
const formSchema = create().shape({
|
|
68336
68344
|
step: create$1(),
|
|
68337
|
-
sheetId: create$2()
|
|
68338
|
-
.when('step', {
|
|
68345
|
+
sheetId: create$2().when('step', {
|
|
68339
68346
|
is: 1,
|
|
68340
68347
|
then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
|
|
68341
68348
|
}),
|
|
68342
|
-
headerRow: create$1()
|
|
68343
|
-
.when('step', {
|
|
68349
|
+
headerRow: create$1().when('step', {
|
|
68344
68350
|
is: 1,
|
|
68345
68351
|
then: create$1().required(`${t('Header row')} ${t('is required')}`)
|
|
68346
68352
|
})
|
|
@@ -68375,29 +68381,29 @@ const ModalImportComponent = (props) => {
|
|
|
68375
68381
|
};
|
|
68376
68382
|
const onSubmit = (data) => {
|
|
68377
68383
|
if (getValues('step') === 1) {
|
|
68378
|
-
getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ??
|
|
68384
|
+
getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? '', handleSetColumns);
|
|
68379
68385
|
}
|
|
68380
68386
|
else if (getValues('step') === 2) {
|
|
68381
|
-
const check = data.dataMap.find(x => x.isRequired && !x.column);
|
|
68387
|
+
const check = data.dataMap.find((x) => x.isRequired && !x.column);
|
|
68382
68388
|
if (check) {
|
|
68383
68389
|
messageBoxError(t, `Vui lòng chọn trường ghép cho cột <<${check.header}>>`);
|
|
68384
68390
|
return;
|
|
68385
68391
|
}
|
|
68386
|
-
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate)
|
|
68387
|
-
.then((arr) => {
|
|
68392
|
+
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
|
|
68388
68393
|
setCheckInitValidate(true);
|
|
68389
68394
|
if (isSaveSetting) {
|
|
68390
|
-
updateGeneralSettingApi(data.dataMap.map(x => ({ ...x, column: undefined })));
|
|
68395
|
+
updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68391
68396
|
}
|
|
68392
68397
|
validateExcelApi(arr)
|
|
68393
68398
|
.then((rs) => {
|
|
68394
68399
|
setCheckInitValidate(false);
|
|
68395
|
-
const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) =>
|
|
68400
|
+
const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) => connectString(t, x)) }));
|
|
68396
68401
|
setDataValidate(list);
|
|
68397
68402
|
setDataInvalid(list.filter((x) => x.errors?.length > 0));
|
|
68398
68403
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
68399
68404
|
setValue('step', 3);
|
|
68400
|
-
})
|
|
68405
|
+
})
|
|
68406
|
+
.catch(() => {
|
|
68401
68407
|
notificationError(t('GetFail'));
|
|
68402
68408
|
setCheckInitValidate(false);
|
|
68403
68409
|
});
|
|
@@ -68405,7 +68411,7 @@ const ModalImportComponent = (props) => {
|
|
|
68405
68411
|
}
|
|
68406
68412
|
else if (getValues('step') === 3) {
|
|
68407
68413
|
if (dataInvalid.length > 0) {
|
|
68408
|
-
messageBoxConfirm(t, handleAdd, dataValid,
|
|
68414
|
+
messageBoxConfirm(t, handleAdd, dataValid, 'The data from your excel file still has invalid rows. Please double check or import only valid lines now.');
|
|
68409
68415
|
}
|
|
68410
68416
|
else {
|
|
68411
68417
|
handleAdd(dataValid);
|
|
@@ -68425,34 +68431,35 @@ const ModalImportComponent = (props) => {
|
|
|
68425
68431
|
else {
|
|
68426
68432
|
setDataError([]);
|
|
68427
68433
|
}
|
|
68428
|
-
})
|
|
68434
|
+
})
|
|
68435
|
+
.catch(() => {
|
|
68429
68436
|
setCheckInit(false);
|
|
68430
68437
|
notificationError(t('AddFail'));
|
|
68431
68438
|
});
|
|
68432
68439
|
};
|
|
68433
68440
|
const getDataType = (e) => {
|
|
68434
|
-
return
|
|
68441
|
+
return e.dataType === 'numeric' || e.dataType === 'datetime' || e.dataType === 'date' ? e.dataType : e.dataType === 'boolean' ? 'checkbox' : 'text';
|
|
68435
68442
|
};
|
|
68436
68443
|
const defaultValidateExcelColumns = [
|
|
68437
68444
|
{
|
|
68438
68445
|
field: 'row',
|
|
68439
|
-
headerText:
|
|
68446
|
+
headerText: 'Row',
|
|
68440
68447
|
fixedType: 'left',
|
|
68441
68448
|
textAlign: 'center',
|
|
68442
68449
|
width: 80
|
|
68443
68450
|
},
|
|
68444
68451
|
{
|
|
68445
68452
|
field: 'result',
|
|
68446
|
-
headerText:
|
|
68453
|
+
headerText: 'Result',
|
|
68447
68454
|
fixedType: 'left',
|
|
68448
68455
|
width: 140,
|
|
68449
68456
|
template: (props) => {
|
|
68450
|
-
return
|
|
68457
|
+
return props.errors?.length === 0 ? jsxRuntime.jsx("span", { className: "text-success", children: t('Valid') }) : jsxRuntime.jsx("span", { className: "text-danger", children: t('Invalid') });
|
|
68451
68458
|
}
|
|
68452
68459
|
},
|
|
68453
68460
|
{
|
|
68454
68461
|
field: 'errorDetail',
|
|
68455
|
-
headerText:
|
|
68462
|
+
headerText: 'Error detail',
|
|
68456
68463
|
fixedType: 'left',
|
|
68457
68464
|
width: 550,
|
|
68458
68465
|
template: (props) => {
|
|
@@ -68466,16 +68473,18 @@ const ModalImportComponent = (props) => {
|
|
|
68466
68473
|
console.log(watch('dataMap'));
|
|
68467
68474
|
}, [watch('dataMap')]);
|
|
68468
68475
|
const handleFormOpened = () => {
|
|
68469
|
-
getGeneralSettingApi()
|
|
68476
|
+
getGeneralSettingApi()
|
|
68477
|
+
.then((rs) => {
|
|
68470
68478
|
const arr = rs?.value ? JSON.parse(rs.value) : [];
|
|
68471
68479
|
setValue('dataMap', [...mapColumn].map((x) => {
|
|
68472
|
-
const ele = arr.find(y => x.field === y.field);
|
|
68480
|
+
const ele = arr.find((y) => x.field === y.field);
|
|
68473
68481
|
if (ele) {
|
|
68474
68482
|
x.headerDefault = ele.headerDefault;
|
|
68475
68483
|
}
|
|
68476
68484
|
return x;
|
|
68477
68485
|
}));
|
|
68478
|
-
})
|
|
68486
|
+
})
|
|
68487
|
+
.catch(() => {
|
|
68479
68488
|
setValue('dataMap', [...mapColumn]);
|
|
68480
68489
|
});
|
|
68481
68490
|
if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
|
|
@@ -68484,7 +68493,7 @@ const ModalImportComponent = (props) => {
|
|
|
68484
68493
|
else {
|
|
68485
68494
|
setValidateExcelColumns([
|
|
68486
68495
|
...defaultValidateExcelColumns,
|
|
68487
|
-
...mapColumn.map(e => ({
|
|
68496
|
+
...mapColumn.map((e) => ({
|
|
68488
68497
|
field: e.field,
|
|
68489
68498
|
headerText: e.header,
|
|
68490
68499
|
width: e.width ?? 150,
|
|
@@ -68506,7 +68515,7 @@ const ModalImportComponent = (props) => {
|
|
|
68506
68515
|
setValue('step', 2);
|
|
68507
68516
|
}
|
|
68508
68517
|
};
|
|
68509
|
-
return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop:
|
|
68518
|
+
return (jsxRuntime.jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxRuntime.jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsxRuntime.jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsxRuntime.jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsxRuntime.jsx(ModalBody$1, { children: jsxRuntime.jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsxRuntime.jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68510
68519
|
{
|
|
68511
68520
|
id: 'upload-file',
|
|
68512
68521
|
title: t('Upload file'),
|
|
@@ -68525,12 +68534,12 @@ const ModalImportComponent = (props) => {
|
|
|
68525
68534
|
{
|
|
68526
68535
|
id: 'handle-error',
|
|
68527
68536
|
title: t('Error result'),
|
|
68528
|
-
|
|
68537
|
+
visible: !!headerErrorExcelColumns,
|
|
68529
68538
|
content: jsxRuntime.jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68530
68539
|
}
|
|
68531
|
-
] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow:
|
|
68540
|
+
] }) }) }) }), jsxRuntime.jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow: '0 4px 24px 0 rgb(34 41 47 / 10%)' }, children: [jsxRuntime.jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68532
68541
|
setIsSaveSetting(val.target.checked);
|
|
68533
|
-
} }), jsxRuntime.jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] }) }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx(Button$1$1, { disabled: !getValues('file'), color: "primary", outline: true, className: `update-btn update-todo-item me-1 ${watch('step') !== 1 ? '' : 'd-none'}`, onClick: handleBackStep, children: t('Back') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') !== 3 ? '' : 'd-none'}`, disabled: !watch('file') || checkInitValidate, color: "primary", onClick: handleSubmit(onSubmit), children: t('Next') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') === 3 ? '' : 'd-none'}`, disabled: dataValid.length === 0 || !getValues('file') || checkInit, color: "primary", onClick: handleSubmit(onSubmit), children: t('Import') }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68542
|
+
} }), jsxRuntime.jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] })) }), jsxRuntime.jsxs("div", { className: "d-flex align-items-center", children: [jsxRuntime.jsx(Button$1$1, { disabled: !getValues('file'), color: "primary", outline: true, className: `update-btn update-todo-item me-1 ${watch('step') !== 1 ? '' : 'd-none'}`, onClick: handleBackStep, children: t('Back') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') !== 3 ? '' : 'd-none'}`, disabled: !watch('file') || checkInitValidate, color: "primary", onClick: handleSubmit(onSubmit), children: t('Next') }), jsxRuntime.jsx(Button$1$1, { className: `update-btn update-todo-item me-1 ${watch('step') === 3 ? '' : 'd-none'}`, disabled: dataValid.length === 0 || !getValues('file') || checkInit, color: "primary", onClick: handleSubmit(onSubmit), children: t('Import') }), jsxRuntime.jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68534
68543
|
};
|
|
68535
68544
|
|
|
68536
68545
|
const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }) => {
|
|
@@ -68663,7 +68672,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
|
|
|
68663
68672
|
};
|
|
68664
68673
|
|
|
68665
68674
|
const RenderContentCol = (props) => {
|
|
68666
|
-
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
|
|
68675
|
+
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, groupColumns, visibleGroupColumn, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
|
|
68667
68676
|
const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
|
|
68668
68677
|
const checkOverflow = () => {
|
|
68669
68678
|
const element = document.getElementById(cellId);
|
|
@@ -68733,7 +68742,7 @@ const RenderContentCol = (props) => {
|
|
|
68733
68742
|
}, children: displayText }) }), checkOverflow() && (jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsxRuntime.jsx("div", { style: { color: textColor }, children: displayText }) }))] }));
|
|
68734
68743
|
}
|
|
68735
68744
|
};
|
|
68736
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: col.visible !== false && (jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': isSelected }), style: {
|
|
68745
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsxRuntime.jsx("td", { className: classNames$1(`r-rowcell fix-${col.fixedType}`, { 'cell-fixed': col.fixedType }, { 'fixed-last': (col.fixedType === 'left' && indexCol === lastObjWidthFixLeft) || (col.fixedType === 'right' && indexCol === fisrtObjWidthFixRight) }, { 'r-active': isSelected }), style: {
|
|
68737
68746
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
68738
68747
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
|
|
68739
68748
|
}, onClick: (e) => {
|
|
@@ -68781,12 +68790,27 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68781
68790
|
}
|
|
68782
68791
|
setExpandsAll(true);
|
|
68783
68792
|
}, [groupSetting?.groupColumns]);
|
|
68784
|
-
const { levels: headerColumns,
|
|
68793
|
+
const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = React$5.useMemo(() => {
|
|
68785
68794
|
const rs = calculateTableStructure(columns, settingColumns?.value);
|
|
68786
68795
|
setContentColumns(rs.flat);
|
|
68787
68796
|
return rs;
|
|
68788
68797
|
}, [columns, settingColumns]);
|
|
68789
|
-
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]);
|
|
68799
|
+
const firstColSpan = React$5.useMemo(() => {
|
|
68800
|
+
let count = 0;
|
|
68801
|
+
let index = 3;
|
|
68802
|
+
for (let i = 0; i < contentColumns.length; i++) {
|
|
68803
|
+
const col = contentColumns[i];
|
|
68804
|
+
if (col.visible !== false && (groupSetting?.visibleGroupColumn || !groupColumns?.includes(col.field))) {
|
|
68805
|
+
count++;
|
|
68806
|
+
}
|
|
68807
|
+
if (count === 3) {
|
|
68808
|
+
index = i;
|
|
68809
|
+
break;
|
|
68810
|
+
}
|
|
68811
|
+
}
|
|
68812
|
+
return index;
|
|
68813
|
+
}, [contentColumns, groupColumns]);
|
|
68790
68814
|
// Tính toán dữ liệu hiển thị dựa trên các điều kiện lọc, tìm kiếm và sắp xếp
|
|
68791
68815
|
const viewData = React$5.useMemo(() => {
|
|
68792
68816
|
if (!dataSource || dataSource.length === 0) {
|
|
@@ -68995,7 +69019,6 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68995
69019
|
}
|
|
68996
69020
|
}
|
|
68997
69021
|
}, [selectedItem]);
|
|
68998
|
-
const firstColSpan = flatVisble.length > 6 ? 3 : Math.floor(flatVisble.length / 2);
|
|
68999
69022
|
const RenderContent = ({ datas, level = 0 }) => {
|
|
69000
69023
|
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: datas.map((row, indexRow) => {
|
|
69001
69024
|
const [expand, setExpand] = React$5.useState(row.expand ?? true);
|
|
@@ -69020,12 +69043,12 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69020
69043
|
if (col.template) {
|
|
69021
69044
|
value = col.template(row, indexRow) ?? '';
|
|
69022
69045
|
}
|
|
69023
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsxRuntime.jsx("td", { className: "r-rowcell r-cell-group", colSpan:
|
|
69046
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsxRuntime.jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxRuntime.jsxs("div", { className: "r-rowcell-div", children: [jsxRuntime.jsx(SvgChevronRight, { style: { marginLeft: level * 20, transform: expand ? 'rotate(90deg)' : 'rotate(0deg)' }, fontSize: 15, onClick: () => {
|
|
69024
69047
|
setExpand(!expand);
|
|
69025
69048
|
setExpandsAll(undefined);
|
|
69026
69049
|
row.expand = !expand;
|
|
69027
69050
|
} }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
|
|
69028
|
-
if (indexCol
|
|
69051
|
+
if (indexCol <= firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field))) {
|
|
69029
69052
|
return;
|
|
69030
69053
|
}
|
|
69031
69054
|
let sumValue = row[colSum.field];
|
|
@@ -69046,11 +69069,11 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69046
69069
|
}
|
|
69047
69070
|
else {
|
|
69048
69071
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
69049
|
-
return (jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable }, indexCol))) }, `row-content-${indexRow}`));
|
|
69072
|
+
return (jsxRuntime.jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (jsxRuntime.jsx(RenderContentCol, { idTable: idTable, col: column, fieldKey: fieldKey, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, formatSetting: formatSetting, indexCol: indexCol, indexRow: indexRow, isSelected: isSelected, row: row, zeroVisiable: zeroVisiable, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn }, indexCol))) }, `row-content-${indexRow}`));
|
|
69050
69073
|
}
|
|
69051
69074
|
}) }));
|
|
69052
69075
|
};
|
|
69053
|
-
return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns:
|
|
69076
|
+
return (jsxRuntime.jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxRuntime.jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsxRuntime.jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxRuntime.jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsxRuntime.jsx(RenderColGroup, { contentColumns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
|
|
69054
69077
|
return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (jsxRuntime.jsx(HeaderTableCol, { col: col, idTable: idTable ?? '', dataSource: dataSource, indexCol: index, indexParent: indexParent, isMulti: isMulti ?? false, objHeaderWidthFixLeft: objHeaderWidthFixLeft, objHeaderWidthFixRight: objHeaderWidthFixRight, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, container: gridRef, filterBy: filterBy, orderBy: orderBy, optionsFilter: querySetting.optionsFilter, allowFiltering: querySetting.allowFiltering, allowSorting: querySetting.allowSorting, formatSetting: formatSetting, changeFilter: (val) => {
|
|
69055
69078
|
setFilterBy([...val]);
|
|
69056
69079
|
if (querySetting?.changeFilter) {
|
|
@@ -69061,9 +69084,9 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69061
69084
|
if (querySetting?.changeOrder) {
|
|
69062
69085
|
querySetting.changeOrder(val);
|
|
69063
69086
|
}
|
|
69064
|
-
}, columns: contentColumns, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
|
|
69087
|
+
}, columns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
|
|
69065
69088
|
}) }), jsxRuntime.jsx("tbody", { className: "r-gridcontent", role: "rowgroup", children: jsxRuntime.jsx(RenderContent, { datas: viewData }) }), jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 && (jsxRuntime.jsx("tr", { className: "r-row", children: contentColumns.map((col, indexCol) => {
|
|
69066
|
-
if (col.visible === false) {
|
|
69089
|
+
if (col.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns.includes(col.field))) {
|
|
69067
69090
|
return;
|
|
69068
69091
|
}
|
|
69069
69092
|
const item = columnsAggregate?.find((x) => x.field === col.field);
|