react-table-edit 1.5.21 → 1.5.22
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-view/content.d.ts +2 -0
- package/dist/component/table-view/index.d.ts +1 -0
- package/dist/component/utils.d.ts +0 -1
- package/dist/component/wizard/index.d.ts +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +80 -57
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +80 -57
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -19957,8 +19957,8 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19957
19957
|
}
|
|
19958
19958
|
traverse(columns);
|
|
19959
19959
|
// Danh sách các cột được hiển thị
|
|
19960
|
-
const flatVisble = flat.filter((e) => e.visible !== false)
|
|
19961
|
-
const flatVisbleContent =
|
|
19960
|
+
// const flatVisble = flat.filter((e) => e.visible !== false)
|
|
19961
|
+
const flatVisbleContent = flat.filter((x) => x.visible !== false && x.field !== 'command' && x.field !== '#' && x.field !== 'checkbox');
|
|
19962
19962
|
// Tính toán vị trí đầu tiên và cuối cùng của các cột cố định
|
|
19963
19963
|
const lastObjWidthFixLeft = Math.max(...Object.keys(objWidthFixLeft).map(Number), 0);
|
|
19964
19964
|
const fisrtObjWidthFixRight = Math.min(...Object.keys(objWidthFixRight).map(Number), flat.length);
|
|
@@ -19968,7 +19968,7 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19968
19968
|
return {
|
|
19969
19969
|
levels,
|
|
19970
19970
|
flat,
|
|
19971
|
-
flatVisble,
|
|
19971
|
+
// flatVisble,
|
|
19972
19972
|
flatVisbleContent,
|
|
19973
19973
|
objWidthFixLeft,
|
|
19974
19974
|
objWidthFixRight,
|
|
@@ -20556,12 +20556,6 @@ editDisable, addDisable, toolbarSetting, buttonSetting) => {
|
|
|
20556
20556
|
}
|
|
20557
20557
|
};
|
|
20558
20558
|
|
|
20559
|
-
const RenderColGroup = ({ contentColumns }) => (jsx("colgroup", { children: contentColumns.map((col, index) => (jsx("col", { style: {
|
|
20560
|
-
width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
|
|
20561
|
-
minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
|
|
20562
|
-
maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
|
|
20563
|
-
} }, index))) }));
|
|
20564
|
-
|
|
20565
20559
|
const IconCustom = (props) => {
|
|
20566
20560
|
const { iconName, size } = props;
|
|
20567
20561
|
if (iconName === '') {
|
|
@@ -36783,6 +36777,15 @@ const FooterCol = ({ col, indexCol, dataSource, objWidthFix, formatSetting }) =>
|
|
|
36783
36777
|
}, children: jsx("div", { className: "r-footer-div", children: col.haveSum === true && col.type === "numeric" && (jsx(Fragment$1, { children: Number(sumValue) >= 0 ? (jsx(Fragment$1, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", col.numericSettings?.fraction, true, false) })) : (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}`));
|
|
36784
36778
|
};
|
|
36785
36779
|
|
|
36780
|
+
const RenderColGroup = ({ contentColumns, groupColumns, visibleGroupColumn }) => (jsx("colgroup", { children: contentColumns.map((col, index) => {
|
|
36781
|
+
return (col.visible !== false &&
|
|
36782
|
+
(visibleGroupColumn || !groupColumns?.includes(col.field)) && (jsx("col", { style: {
|
|
36783
|
+
width: typeof col.width === 'number' ? `${col.width}px` : col.width || undefined,
|
|
36784
|
+
minWidth: typeof col.minWidth === 'number' ? `${col.minWidth}px` : col.minWidth || undefined,
|
|
36785
|
+
maxWidth: typeof col.maxWidth === 'number' ? `${col.maxWidth}px` : col.maxWidth || undefined
|
|
36786
|
+
} }, index)));
|
|
36787
|
+
}) }));
|
|
36788
|
+
|
|
36786
36789
|
var reactResizable = {exports: {}};
|
|
36787
36790
|
|
|
36788
36791
|
var Resizable$2 = {};
|
|
@@ -38955,7 +38958,7 @@ const DateRangeFilterComponent = ({ fieldFilter, filterBy, handleSave }) => {
|
|
|
38955
38958
|
};
|
|
38956
38959
|
|
|
38957
38960
|
const HeaderTableCol = (props) => {
|
|
38958
|
-
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;
|
|
38961
|
+
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;
|
|
38959
38962
|
const { t } = useTranslation();
|
|
38960
38963
|
const headerRef = useRef(null);
|
|
38961
38964
|
const order = orderBy.find((item) => item.key === col.field);
|
|
@@ -38974,7 +38977,7 @@ const HeaderTableCol = (props) => {
|
|
|
38974
38977
|
const checkOverflow = () => {
|
|
38975
38978
|
return headerRef.current && headerRef.current.scrollHeight > headerRef.current.clientHeight;
|
|
38976
38979
|
};
|
|
38977
|
-
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: true }, children: 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: {
|
|
38980
|
+
return (jsx(Fragment, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (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: 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: {
|
|
38978
38981
|
top: `${indexParent * 42}px`,
|
|
38979
38982
|
left: col.fixedType === 'left' ? objHeaderWidthFixLeft[`${indexParent}-${indexCol ?? 0}`] : undefined,
|
|
38980
38983
|
right: col.fixedType === 'right' ? objHeaderWidthFixRight[`${indexParent}-${indexCol ?? 0}`] : undefined
|
|
@@ -39017,7 +39020,7 @@ const HeaderTableCol = (props) => {
|
|
|
39017
39020
|
}, children: jsx(DropdownItem$1, { className: "p-1", style: { borderRadius: '6px' }, tag: "div", header: true, children: jsx(FilterComponent, { setOpenFilter: setOpenFilter, filterBy: filterBy, optionsFilter: optionsFilter, formatSetting: formatSetting, changeFilter: changeFilter, column: col }) }) })] }))] }))] }))] }) }) })) }, `header-${indexCol}`));
|
|
39018
39021
|
};
|
|
39019
39022
|
|
|
39020
|
-
const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns,
|
|
39023
|
+
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 }) => {
|
|
39021
39024
|
const filteredData = useMemo(() => {
|
|
39022
39025
|
const arr = dataSource.map((row, index) => ({ data: row, indexRow: index }));
|
|
39023
39026
|
if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && searchClient) {
|
|
@@ -39053,7 +39056,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
|
|
|
39053
39056
|
}
|
|
39054
39057
|
};
|
|
39055
39058
|
}, []);
|
|
39056
|
-
return (jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsx(RenderColGroup, { contentColumns:
|
|
39059
|
+
return (jsx("div", { ref: containerRef, className: "r-gridtable", style: { maxHeight: `${height ? `${height}px` : 'auto'}` }, children: jsxs("table", { style: { width: '100%' }, role: "presentation", children: [jsx(RenderColGroup, { contentColumns: contentColumns }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
|
|
39057
39060
|
return (jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
39058
39061
|
return (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) => {
|
|
39059
39062
|
setFilterBy([...val]);
|
|
@@ -39810,7 +39813,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
39810
39813
|
const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
|
|
39811
39814
|
const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? 'id';
|
|
39812
39815
|
const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
|
|
39813
|
-
const { levels: headerColumns,
|
|
39816
|
+
const { levels: headerColumns, flatVisbleContent: visibleContentColumns, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight, objHeaderWidthFixLeft, objHeaderWidthFixRight, indexFirstEdit, indexLastEdit } = useMemo(() => {
|
|
39814
39817
|
const rs = calculateTableStructure(columns, settingColumns?.value);
|
|
39815
39818
|
setContentColumns(rs.flat);
|
|
39816
39819
|
return rs;
|
|
@@ -40184,7 +40187,7 @@ const TableEdit = forwardRef((props, ref) => {
|
|
|
40184
40187
|
}
|
|
40185
40188
|
}
|
|
40186
40189
|
};
|
|
40187
|
-
return (jsx(Fragment, { children: jsxs("div", { className: "r-table-edit", children: [jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), jsx(TableComponent, { idTable: idTable, height: height, dataSource: dataSource, contentColumns: contentColumns, headerColumns: headerColumns,
|
|
40190
|
+
return (jsx(Fragment, { children: jsxs("div", { className: "r-table-edit", children: [jsxs("div", { className: "r-grid", ref: gridRef, children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), 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: () => {
|
|
40188
40191
|
handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
|
|
40189
40192
|
}, setContentColumns: (newColumns) => {
|
|
40190
40193
|
setContentColumns(newColumns);
|
|
@@ -49030,12 +49033,14 @@ const Wizard = forwardRef((props, ref) => {
|
|
|
49030
49033
|
const { steps, activeStep, setActiveStep, className = '', headerClassName = '', contentClassName = '', contentWrapperClassName = '', type = 'horizontal', heightContent = 'auto', widthContent = '100%', separator = jsx(SvgChevronRight, { fontSize: 17 }) } = props;
|
|
49031
49034
|
// ** Renders Wizard Header
|
|
49032
49035
|
const renderHeader = () => {
|
|
49033
|
-
return steps
|
|
49034
|
-
|
|
49035
|
-
|
|
49036
|
+
return steps
|
|
49037
|
+
.filter((x) => x.visible !== false)
|
|
49038
|
+
.map((step, index) => {
|
|
49039
|
+
return (jsxs(Fragment, { children: [index !== 0 && index !== steps.length ? jsx("div", { className: "line", children: separator }) : null, jsx("div", { className: classNames$1('step', {
|
|
49040
|
+
crossed: step.done !== undefined ? step.done : activeStep > index + 1,
|
|
49036
49041
|
disable: step.disable,
|
|
49037
|
-
active:
|
|
49038
|
-
}), "data-target": `#${step.id}`, children: jsxs("button", { type:
|
|
49042
|
+
active: index + 1 === activeStep
|
|
49043
|
+
}), "data-target": `#${step.id}`, children: jsxs("button", { type: "button", disabled: step.disable, className: "step-trigger", onClick: () => setActiveStep?.(index + 1), children: [jsx("span", { className: "bs-stepper-box", children: step.icon ? step.icon : index + 1 }), jsxs("span", { className: "bs-stepper-label", children: [jsxs("span", { className: "bs-stepper-title", children: [step.title, " "] }), step.loading && jsx(Spinner$1, { className: "text-info", style: { borderWidth: 2, height: 15, width: 15, marginRight: 3 } }), " ", step.subtitle ? jsx("span", { className: "bs-stepper-subtitle", children: step.subtitle }) : null] })] }) })] }, step.id));
|
|
49039
49044
|
});
|
|
49040
49045
|
};
|
|
49041
49046
|
// ** Renders Wizard Content
|
|
@@ -49043,7 +49048,7 @@ const Wizard = forwardRef((props, ref) => {
|
|
|
49043
49048
|
return steps.map((step, index) => {
|
|
49044
49049
|
return (jsx("div", { className: classNames$1('content', {
|
|
49045
49050
|
[contentClassName]: contentClassName,
|
|
49046
|
-
'active dstepper-block': activeStep ===
|
|
49051
|
+
'active dstepper-block': activeStep === index + 1
|
|
49047
49052
|
}), id: step.id, children: step.content }, step.id));
|
|
49048
49053
|
});
|
|
49049
49054
|
};
|
|
@@ -68305,13 +68310,11 @@ const ModalImportComponent = (props) => {
|
|
|
68305
68310
|
const [isSaveSetting, setIsSaveSetting] = useState(true);
|
|
68306
68311
|
const formSchema = create().shape({
|
|
68307
68312
|
step: create$1(),
|
|
68308
|
-
sheetId: create$2()
|
|
68309
|
-
.when('step', {
|
|
68313
|
+
sheetId: create$2().when('step', {
|
|
68310
68314
|
is: 1,
|
|
68311
68315
|
then: create$2().required(`${t('Sheet name')} ${t('is required')}`)
|
|
68312
68316
|
}),
|
|
68313
|
-
headerRow: create$1()
|
|
68314
|
-
.when('step', {
|
|
68317
|
+
headerRow: create$1().when('step', {
|
|
68315
68318
|
is: 1,
|
|
68316
68319
|
then: create$1().required(`${t('Header row')} ${t('is required')}`)
|
|
68317
68320
|
})
|
|
@@ -68346,29 +68349,29 @@ const ModalImportComponent = (props) => {
|
|
|
68346
68349
|
};
|
|
68347
68350
|
const onSubmit = (data) => {
|
|
68348
68351
|
if (getValues('step') === 1) {
|
|
68349
|
-
getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ??
|
|
68352
|
+
getColumnsSheetExcel(data.file, data.headerRow ?? 0, data.sheetId ?? '', handleSetColumns);
|
|
68350
68353
|
}
|
|
68351
68354
|
else if (getValues('step') === 2) {
|
|
68352
|
-
const check = data.dataMap.find(x => x.isRequired && !x.column);
|
|
68355
|
+
const check = data.dataMap.find((x) => x.isRequired && !x.column);
|
|
68353
68356
|
if (check) {
|
|
68354
68357
|
messageBoxError(t, `Vui lòng chọn trường ghép cho cột <<${check.header}>>`);
|
|
68355
68358
|
return;
|
|
68356
68359
|
}
|
|
68357
|
-
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate)
|
|
68358
|
-
.then((arr) => {
|
|
68360
|
+
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
|
|
68359
68361
|
setCheckInitValidate(true);
|
|
68360
68362
|
if (isSaveSetting) {
|
|
68361
|
-
updateGeneralSettingApi(data.dataMap.map(x => ({ ...x, column: undefined })));
|
|
68363
|
+
updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68362
68364
|
}
|
|
68363
68365
|
validateExcelApi(arr)
|
|
68364
68366
|
.then((rs) => {
|
|
68365
68367
|
setCheckInitValidate(false);
|
|
68366
|
-
const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) =>
|
|
68368
|
+
const list = rs.map((item) => ({ ...item, errors: item.errors.map((x) => connectString(t, x)) }));
|
|
68367
68369
|
setDataValidate(list);
|
|
68368
68370
|
setDataInvalid(list.filter((x) => x.errors?.length > 0));
|
|
68369
68371
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
68370
68372
|
setValue('step', 3);
|
|
68371
|
-
})
|
|
68373
|
+
})
|
|
68374
|
+
.catch(() => {
|
|
68372
68375
|
notificationError(t('GetFail'));
|
|
68373
68376
|
setCheckInitValidate(false);
|
|
68374
68377
|
});
|
|
@@ -68376,7 +68379,7 @@ const ModalImportComponent = (props) => {
|
|
|
68376
68379
|
}
|
|
68377
68380
|
else if (getValues('step') === 3) {
|
|
68378
68381
|
if (dataInvalid.length > 0) {
|
|
68379
|
-
messageBoxConfirm(t, handleAdd, dataValid,
|
|
68382
|
+
messageBoxConfirm(t, handleAdd, dataValid, 'The data from your excel file still has invalid rows. Please double check or import only valid lines now.');
|
|
68380
68383
|
}
|
|
68381
68384
|
else {
|
|
68382
68385
|
handleAdd(dataValid);
|
|
@@ -68396,34 +68399,35 @@ const ModalImportComponent = (props) => {
|
|
|
68396
68399
|
else {
|
|
68397
68400
|
setDataError([]);
|
|
68398
68401
|
}
|
|
68399
|
-
})
|
|
68402
|
+
})
|
|
68403
|
+
.catch(() => {
|
|
68400
68404
|
setCheckInit(false);
|
|
68401
68405
|
notificationError(t('AddFail'));
|
|
68402
68406
|
});
|
|
68403
68407
|
};
|
|
68404
68408
|
const getDataType = (e) => {
|
|
68405
|
-
return
|
|
68409
|
+
return e.dataType === 'numeric' || e.dataType === 'datetime' || e.dataType === 'date' ? e.dataType : e.dataType === 'boolean' ? 'checkbox' : 'text';
|
|
68406
68410
|
};
|
|
68407
68411
|
const defaultValidateExcelColumns = [
|
|
68408
68412
|
{
|
|
68409
68413
|
field: 'row',
|
|
68410
|
-
headerText:
|
|
68414
|
+
headerText: 'Row',
|
|
68411
68415
|
fixedType: 'left',
|
|
68412
68416
|
textAlign: 'center',
|
|
68413
68417
|
width: 80
|
|
68414
68418
|
},
|
|
68415
68419
|
{
|
|
68416
68420
|
field: 'result',
|
|
68417
|
-
headerText:
|
|
68421
|
+
headerText: 'Result',
|
|
68418
68422
|
fixedType: 'left',
|
|
68419
68423
|
width: 140,
|
|
68420
68424
|
template: (props) => {
|
|
68421
|
-
return
|
|
68425
|
+
return props.errors?.length === 0 ? jsx("span", { className: "text-success", children: t('Valid') }) : jsx("span", { className: "text-danger", children: t('Invalid') });
|
|
68422
68426
|
}
|
|
68423
68427
|
},
|
|
68424
68428
|
{
|
|
68425
68429
|
field: 'errorDetail',
|
|
68426
|
-
headerText:
|
|
68430
|
+
headerText: 'Error detail',
|
|
68427
68431
|
fixedType: 'left',
|
|
68428
68432
|
width: 550,
|
|
68429
68433
|
template: (props) => {
|
|
@@ -68437,16 +68441,18 @@ const ModalImportComponent = (props) => {
|
|
|
68437
68441
|
console.log(watch('dataMap'));
|
|
68438
68442
|
}, [watch('dataMap')]);
|
|
68439
68443
|
const handleFormOpened = () => {
|
|
68440
|
-
getGeneralSettingApi()
|
|
68444
|
+
getGeneralSettingApi()
|
|
68445
|
+
.then((rs) => {
|
|
68441
68446
|
const arr = rs?.value ? JSON.parse(rs.value) : [];
|
|
68442
68447
|
setValue('dataMap', [...mapColumn].map((x) => {
|
|
68443
|
-
const ele = arr.find(y => x.field === y.field);
|
|
68448
|
+
const ele = arr.find((y) => x.field === y.field);
|
|
68444
68449
|
if (ele) {
|
|
68445
68450
|
x.headerDefault = ele.headerDefault;
|
|
68446
68451
|
}
|
|
68447
68452
|
return x;
|
|
68448
68453
|
}));
|
|
68449
|
-
})
|
|
68454
|
+
})
|
|
68455
|
+
.catch(() => {
|
|
68450
68456
|
setValue('dataMap', [...mapColumn]);
|
|
68451
68457
|
});
|
|
68452
68458
|
if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
|
|
@@ -68455,7 +68461,7 @@ const ModalImportComponent = (props) => {
|
|
|
68455
68461
|
else {
|
|
68456
68462
|
setValidateExcelColumns([
|
|
68457
68463
|
...defaultValidateExcelColumns,
|
|
68458
|
-
...mapColumn.map(e => ({
|
|
68464
|
+
...mapColumn.map((e) => ({
|
|
68459
68465
|
field: e.field,
|
|
68460
68466
|
headerText: e.header,
|
|
68461
68467
|
width: e.width ?? 150,
|
|
@@ -68477,7 +68483,7 @@ const ModalImportComponent = (props) => {
|
|
|
68477
68483
|
setValue('step', 2);
|
|
68478
68484
|
}
|
|
68479
68485
|
};
|
|
68480
|
-
return (jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop:
|
|
68486
|
+
return (jsx(Modal$1, { isOpen: openModal, toggle: handleModal, backdrop: "static", className: "modal-dialog-centered modal-xl", contentClassName: "p-0", onOpened: handleFormOpened, onClosed: handleModalClosed, children: jsxs(Form$1, { id: "form-modal-globalzone", className: "todo-modal modal-form-content", children: [jsx(ModalHeader, { typeModal: 'Import', handleModal: handleModal, title: "Import Excel" }), jsx(Scrollbars, { autoHide: true, autoHeight: true, autoHeightMax: windowSize.innerHeight - 120, children: jsx(ModalBody$1, { children: jsx("div", { style: { marginTop: '-25px' }, className: "modern-horizontal-wizard", children: jsx(Wizard, { activeStep: watch('step'), type: "modern-horizontal", steps: [
|
|
68481
68487
|
{
|
|
68482
68488
|
id: 'upload-file',
|
|
68483
68489
|
title: t('Upload file'),
|
|
@@ -68496,12 +68502,12 @@ const ModalImportComponent = (props) => {
|
|
|
68496
68502
|
{
|
|
68497
68503
|
id: 'handle-error',
|
|
68498
68504
|
title: t('Error result'),
|
|
68499
|
-
|
|
68505
|
+
visible: !!headerErrorExcelColumns,
|
|
68500
68506
|
content: jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68501
68507
|
}
|
|
68502
|
-
] }) }) }) }), jsxs("div", { className: "d-flex justify-content-between align-items-center p-1", style: { boxShadow:
|
|
68508
|
+
] }) }) }) }), 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: [jsx("div", { className: "d-flex align-items-center", children: watch('step') === 2 && (jsxs(Fragment$1, { children: [jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68503
68509
|
setIsSaveSetting(val.target.checked);
|
|
68504
|
-
} }), jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] }) }), jsxs("div", { className: "d-flex align-items-center", children: [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') }), 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') }), 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') }), jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68510
|
+
} }), jsx("span", { children: "L\u01B0u th\u00F4ng tin gh\u00E9p tr\u01B0\u1EDDng d\u1EEF li\u1EC7u" })] })) }), jsxs("div", { className: "d-flex align-items-center", children: [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') }), 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') }), 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') }), jsx(Button$1$1, { color: "secondary", onClick: handleModal, outline: true, children: t('Close') })] })] })] }) }));
|
|
68505
68511
|
};
|
|
68506
68512
|
|
|
68507
68513
|
const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParent, resources, resourceCode, windowSize, renderModal }) => {
|
|
@@ -68634,7 +68640,7 @@ const UnExpandAllIcon = ({ className, color = '#7F7F7F', size = 24, onClick, sty
|
|
|
68634
68640
|
};
|
|
68635
68641
|
|
|
68636
68642
|
const RenderContentCol = (props) => {
|
|
68637
|
-
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
|
|
68643
|
+
const { col, indexCol, indexRow, isSelected, row, zeroVisiable, groupColumns, visibleGroupColumn, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
|
|
68638
68644
|
const cellId = `content-${idTable}-row${indexRow}col-${indexCol}`;
|
|
68639
68645
|
const checkOverflow = () => {
|
|
68640
68646
|
const element = document.getElementById(cellId);
|
|
@@ -68704,7 +68710,7 @@ const RenderContentCol = (props) => {
|
|
|
68704
68710
|
}, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, children: displayText }) }))] }));
|
|
68705
68711
|
}
|
|
68706
68712
|
};
|
|
68707
|
-
return (jsx(Fragment$1, { children: col.visible !== false && (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: {
|
|
68713
|
+
return (jsx(Fragment$1, { children: col.visible !== false && (visibleGroupColumn || !groupColumns?.includes(col.field)) && (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: {
|
|
68708
68714
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol] : undefined,
|
|
68709
68715
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined
|
|
68710
68716
|
}, onClick: (e) => {
|
|
@@ -68752,12 +68758,27 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68752
68758
|
}
|
|
68753
68759
|
setExpandsAll(true);
|
|
68754
68760
|
}, [groupSetting?.groupColumns]);
|
|
68755
|
-
const { levels: headerColumns,
|
|
68761
|
+
const { levels: headerColumns, objHeaderWidthFixLeft, objHeaderWidthFixRight, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = useMemo(() => {
|
|
68756
68762
|
const rs = calculateTableStructure(columns, settingColumns?.value);
|
|
68757
68763
|
setContentColumns(rs.flat);
|
|
68758
68764
|
return rs;
|
|
68759
68765
|
}, [columns, settingColumns]);
|
|
68760
68766
|
const optionGroupColumns = useMemo(() => contentColumns.filter((x) => !groupColumns.includes(x.field)).map((x) => ({ ...x, headerDisplay: t(x.headerDisplay ?? x.headerText) })), [groupColumns, contentColumns]);
|
|
68767
|
+
const firstColSpan = useMemo(() => {
|
|
68768
|
+
let count = 0;
|
|
68769
|
+
let index = 3;
|
|
68770
|
+
for (let i = 0; i < contentColumns.length; i++) {
|
|
68771
|
+
const col = contentColumns[i];
|
|
68772
|
+
if (col.visible !== false && (groupSetting?.visibleGroupColumn || !groupColumns?.includes(col.field))) {
|
|
68773
|
+
count++;
|
|
68774
|
+
}
|
|
68775
|
+
if (count === 3) {
|
|
68776
|
+
index = i;
|
|
68777
|
+
break;
|
|
68778
|
+
}
|
|
68779
|
+
}
|
|
68780
|
+
return index;
|
|
68781
|
+
}, [contentColumns, groupColumns]);
|
|
68761
68782
|
// 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
|
|
68762
68783
|
const viewData = useMemo(() => {
|
|
68763
68784
|
if (!dataSource || dataSource.length === 0) {
|
|
@@ -68966,7 +68987,6 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68966
68987
|
}
|
|
68967
68988
|
}
|
|
68968
68989
|
}, [selectedItem]);
|
|
68969
|
-
const firstColSpan = flatVisble.length > 6 ? 3 : Math.floor(flatVisble.length / 2);
|
|
68970
68990
|
const RenderContent = ({ datas, level = 0 }) => {
|
|
68971
68991
|
return (jsx(Fragment$1, { children: datas.map((row, indexRow) => {
|
|
68972
68992
|
const [expand, setExpand] = useState(row.expand ?? true);
|
|
@@ -68991,12 +69011,15 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
68991
69011
|
if (col.template) {
|
|
68992
69012
|
value = col.template(row, indexRow) ?? '';
|
|
68993
69013
|
}
|
|
68994
|
-
return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan:
|
|
69014
|
+
return (jsxs(Fragment$1, { children: [jsxs("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: [jsx("td", { className: "r-rowcell r-cell-group", colSpan: 3, children: jsxs("div", { className: "r-rowcell-div", children: [jsx(SvgChevronRight, { style: { marginLeft: level * 20, transform: expand ? 'rotate(90deg)' : 'rotate(0deg)' }, fontSize: 15, onClick: () => {
|
|
68995
69015
|
setExpand(!expand);
|
|
68996
69016
|
setExpandsAll(undefined);
|
|
68997
69017
|
row.expand = !expand;
|
|
68998
69018
|
} }), t(col.headerDisplay ?? col.headerText), ": ", value, " (", row.children.length, ")"] }) }), contentColumns.map((colSum, indexCol) => {
|
|
68999
|
-
|
|
69019
|
+
console.log(indexCol < firstColSpan || colSum.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns?.includes(colSum.field)));
|
|
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))) {
|
|
69000
69023
|
return;
|
|
69001
69024
|
}
|
|
69002
69025
|
let sumValue = row[colSum.field];
|
|
@@ -69017,11 +69040,11 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69017
69040
|
}
|
|
69018
69041
|
else {
|
|
69019
69042
|
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
69020
|
-
return (jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (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}`));
|
|
69043
|
+
return (jsx("tr", { "aria-rowindex": indexRow + 1, role: "row", className: "r-row", children: contentColumns.map((column, indexCol) => (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}`));
|
|
69021
69044
|
}
|
|
69022
69045
|
}) }));
|
|
69023
69046
|
};
|
|
69024
|
-
return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns:
|
|
69047
|
+
return (jsxs("div", { className: "r-table-edit r-virtualized-table", children: [jsxs("div", { className: "r-grid", children: [toolbarSetting?.showTopToolbar && jsx(RenderToolbarTop, { toolbarTopOption: toolbarTopOption }), headerComponent && headerComponent(), jsxs("div", { ref: gridRef, className: "r-gridtable", style: { height: `${height ? `${height}px` : 'auto'}` }, children: [jsxs("table", { role: "presentation", style: { width: '100%' }, children: [jsx(RenderColGroup, { contentColumns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn }), jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => {
|
|
69025
69048
|
return (jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((col, index) => (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) => {
|
|
69026
69049
|
setFilterBy([...val]);
|
|
69027
69050
|
if (querySetting?.changeFilter) {
|
|
@@ -69032,9 +69055,9 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false
|
|
|
69032
69055
|
if (querySetting?.changeOrder) {
|
|
69033
69056
|
querySetting.changeOrder(val);
|
|
69034
69057
|
}
|
|
69035
|
-
}, columns: contentColumns, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
|
|
69058
|
+
}, columns: contentColumns, groupColumns: groupColumns, visibleGroupColumn: groupSetting?.visibleGroupColumn, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
|
|
69036
69059
|
}) }), jsx("tbody", { className: "r-gridcontent", role: "rowgroup", children: jsx(RenderContent, { datas: viewData }) }), jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 && (jsx("tr", { className: "r-row", children: contentColumns.map((col, indexCol) => {
|
|
69037
|
-
if (col.visible === false) {
|
|
69060
|
+
if (col.visible === false || (!groupSetting?.visibleGroupColumn && groupColumns.includes(col.field))) {
|
|
69038
69061
|
return;
|
|
69039
69062
|
}
|
|
69040
69063
|
const item = columnsAggregate?.find((x) => x.field === col.field);
|