react-table-edit 1.5.34 → 1.5.36
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/modal-import-excel/index.d.ts +2 -2
- package/dist/component/table-view/index.d.ts +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +50 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -49147,13 +49147,13 @@ const TabHandleErrorImportExcel = (props) => {
|
|
|
49147
49147
|
const TabMergeImportExcel = (props) => {
|
|
49148
49148
|
const { setValue, watch, windowSize, optionField, formatNumber } = props;
|
|
49149
49149
|
const { t } = useTranslation();
|
|
49150
|
-
return (jsxs("div", { className:
|
|
49150
|
+
return (jsxs("div", { className: "box form-box__border", children: [jsx("h5", { className: "m-0 form-box__border--title", children: t('Merge data fields') }), jsx(TableEdit, { formatSetting: {
|
|
49151
49151
|
decimalSeparator: formatNumber?.decimalSeparator,
|
|
49152
49152
|
thousandSeparator: formatNumber?.thousandSeparator,
|
|
49153
49153
|
colorNegative: formatNumber?.colorNegative,
|
|
49154
49154
|
prefixNegative: formatNumber?.prefixNegative,
|
|
49155
49155
|
suffixNegative: formatNumber?.suffixNegative
|
|
49156
|
-
}, idTable:
|
|
49156
|
+
}, idTable: "MapColumnImportExcel", columns: [
|
|
49157
49157
|
{
|
|
49158
49158
|
headerText: 'Required Information',
|
|
49159
49159
|
field: 'isRequired',
|
|
@@ -49161,7 +49161,7 @@ const TabMergeImportExcel = (props) => {
|
|
|
49161
49161
|
editEnable: true,
|
|
49162
49162
|
textAlign: 'center',
|
|
49163
49163
|
template: (data) => {
|
|
49164
|
-
return jsx(Fragment$1, { children: data.isRequired ? jsx(SvgCheckSquare, { color:
|
|
49164
|
+
return jsx(Fragment$1, { children: data.isRequired ? jsx(SvgCheckSquare, { color: "green", fontSize: 18 }) : jsx(SvgXSquare, { color: "red", fontSize: 18 }) });
|
|
49165
49165
|
},
|
|
49166
49166
|
disabledCondition: (row) => {
|
|
49167
49167
|
return row.disableEdit ?? false;
|
|
@@ -49183,15 +49183,18 @@ const TabMergeImportExcel = (props) => {
|
|
|
49183
49183
|
type: 'select',
|
|
49184
49184
|
editEnable: true,
|
|
49185
49185
|
selectSettings: {
|
|
49186
|
-
options: optionField
|
|
49186
|
+
options: optionField,
|
|
49187
|
+
isClearable: true
|
|
49187
49188
|
},
|
|
49188
49189
|
callback(value, indexRow, item) {
|
|
49189
|
-
if (!item.headerDefault.includes(value
|
|
49190
|
-
item.headerDefault.push(value
|
|
49190
|
+
if (!item.headerDefault.includes(value?.label)) {
|
|
49191
|
+
item.headerDefault.push(value?.label ? value?.label?.trim() : '');
|
|
49191
49192
|
}
|
|
49192
49193
|
},
|
|
49193
49194
|
visible: watch('dataMap').length > 0,
|
|
49194
|
-
template: (row) => {
|
|
49195
|
+
template: (row) => {
|
|
49196
|
+
return optionField.find((e) => e.value === row.column)?.label;
|
|
49197
|
+
},
|
|
49195
49198
|
width: 300,
|
|
49196
49199
|
minWidth: 250,
|
|
49197
49200
|
maxWidth: 350
|
|
@@ -68369,7 +68372,7 @@ const ModalImportComponent = (props) => {
|
|
|
68369
68372
|
const [checkInitValidate, setCheckInitValidate] = useState(false);
|
|
68370
68373
|
const [validateExcelColumns, setValidateExcelColumns] = useState(mapColumn);
|
|
68371
68374
|
const [dataError, setDataError] = useState([]);
|
|
68372
|
-
const [isSaveSetting, setIsSaveSetting] = useState(
|
|
68375
|
+
const [isSaveSetting, setIsSaveSetting] = useState(!!getGeneralSettingApi && !!updateGeneralSettingApi);
|
|
68373
68376
|
const formSchema = create().shape({
|
|
68374
68377
|
step: create$1(),
|
|
68375
68378
|
sheetId: create$2().when('step', {
|
|
@@ -68422,7 +68425,7 @@ const ModalImportComponent = (props) => {
|
|
|
68422
68425
|
mapDataImportExcel(dataMerge, getValues('headerRow') ?? 0, data.dataMap, handleValidate).then((arr) => {
|
|
68423
68426
|
setCheckInitValidate(true);
|
|
68424
68427
|
if (isSaveSetting) {
|
|
68425
|
-
updateGeneralSettingApi(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68428
|
+
updateGeneralSettingApi?.(data.dataMap.map((x) => ({ ...x, column: undefined })));
|
|
68426
68429
|
}
|
|
68427
68430
|
validateExcelApi(arr)
|
|
68428
68431
|
.then((rs) => {
|
|
@@ -68433,7 +68436,8 @@ const ModalImportComponent = (props) => {
|
|
|
68433
68436
|
setDataValid(list.filter((x) => x.error || x.errors?.length === 0));
|
|
68434
68437
|
setValue('step', 3);
|
|
68435
68438
|
})
|
|
68436
|
-
.catch(() => {
|
|
68439
|
+
.catch((ex) => {
|
|
68440
|
+
console.log(ex);
|
|
68437
68441
|
notificationError(t('GetFail'));
|
|
68438
68442
|
setCheckInitValidate(false);
|
|
68439
68443
|
});
|
|
@@ -68499,24 +68503,26 @@ const ModalImportComponent = (props) => {
|
|
|
68499
68503
|
}
|
|
68500
68504
|
}
|
|
68501
68505
|
];
|
|
68502
|
-
useEffect(() => {
|
|
68503
|
-
console.log(watch('dataMap'));
|
|
68504
|
-
}, [watch('dataMap')]);
|
|
68505
68506
|
const handleFormOpened = () => {
|
|
68506
|
-
getGeneralSettingApi
|
|
68507
|
-
|
|
68508
|
-
|
|
68509
|
-
|
|
68510
|
-
|
|
68511
|
-
|
|
68512
|
-
|
|
68513
|
-
|
|
68514
|
-
|
|
68515
|
-
|
|
68516
|
-
|
|
68517
|
-
|
|
68507
|
+
if (getGeneralSettingApi) {
|
|
68508
|
+
getGeneralSettingApi()
|
|
68509
|
+
.then((rs) => {
|
|
68510
|
+
const arr = rs?.value ? JSON.parse(rs.value) : [];
|
|
68511
|
+
setValue('dataMap', [...mapColumn].map((x) => {
|
|
68512
|
+
const ele = arr.find((y) => x.field === y.field);
|
|
68513
|
+
if (ele) {
|
|
68514
|
+
x.headerDefault = ele.headerDefault;
|
|
68515
|
+
}
|
|
68516
|
+
return x;
|
|
68517
|
+
}));
|
|
68518
|
+
})
|
|
68519
|
+
.catch(() => {
|
|
68520
|
+
setValue('dataMap', [...mapColumn]);
|
|
68521
|
+
});
|
|
68522
|
+
}
|
|
68523
|
+
else {
|
|
68518
68524
|
setValue('dataMap', [...mapColumn]);
|
|
68519
|
-
}
|
|
68525
|
+
}
|
|
68520
68526
|
if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
|
|
68521
68527
|
setValidateExcelColumns(headerValidateExcelColumns);
|
|
68522
68528
|
}
|
|
@@ -68567,7 +68573,7 @@ const ModalImportComponent = (props) => {
|
|
|
68567
68573
|
visible: !!headerErrorExcelColumns,
|
|
68568
68574
|
content: jsx(TabHandleErrorImportExcel, { formatNumber: formatNumber, dataError: dataError, headerHandleErrorExcelColumns: headerErrorExcelColumns ?? [], windowSize: windowSize })
|
|
68569
68575
|
}
|
|
68570
|
-
] }) }) }) }), 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) => {
|
|
68576
|
+
] }) }) }) }), 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 && getGeneralSettingApi && updateGeneralSettingApi && (jsxs(Fragment$1, { children: [jsx(Input$1, { checked: isSaveSetting, type: "checkbox", className: "me-50", onChange: (val) => {
|
|
68571
68577
|
setIsSaveSetting(val.target.checked);
|
|
68572
68578
|
} }), 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') })] })] })] }) }));
|
|
68573
68579
|
};
|
|
@@ -68709,7 +68715,17 @@ const RenderContentCol = (props) => {
|
|
|
68709
68715
|
return element && element.scrollWidth > element.clientWidth;
|
|
68710
68716
|
};
|
|
68711
68717
|
const RenderElement = () => {
|
|
68712
|
-
if (col.
|
|
68718
|
+
if (col.field === '#' || col.type === '#') {
|
|
68719
|
+
return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer text-center', { 'r-active-cell': isSelected }), style: {
|
|
68720
|
+
fontWeight: row.sortOrder < 0 || row.sortOrder > 100000 || row.haveBoldType ? 600 : 400,
|
|
68721
|
+
fontStyle: row.haveItalicType ? 'italic' : 'normal'
|
|
68722
|
+
}, onDoubleClick: (e) => {
|
|
68723
|
+
e.preventDefault();
|
|
68724
|
+
handleCloseContext();
|
|
68725
|
+
handleDoubleClick?.(row, col);
|
|
68726
|
+
}, children: indexRow + 1 }));
|
|
68727
|
+
}
|
|
68728
|
+
else if (col.type === 'checkbox' || col.field === 'checkbox') {
|
|
68713
68729
|
return (jsx("div", { className: classNames$1('r-rowcell-div cursor-pointer', { 'r-active-cell': isSelected }), style: { display: 'flex', justifyContent: col.textAlign === 'center' ? 'center' : col.textAlign === 'right' ? 'flex-end' : 'flex-start', alignItems: 'center' }, onClick: (e) => {
|
|
68714
68730
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
68715
68731
|
if (index > -1) {
|
|
@@ -68772,7 +68788,10 @@ const RenderContentCol = (props) => {
|
|
|
68772
68788
|
textOverflow: 'ellipsis',
|
|
68773
68789
|
whiteSpace: 'pre',
|
|
68774
68790
|
maxWidth: '100%'
|
|
68775
|
-
}, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor },
|
|
68791
|
+
}, children: displayText }) }), checkOverflow() && (jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: cellId, placement: "top", children: jsx("div", { style: { color: textColor }, onClick: (e) => {
|
|
68792
|
+
e.stopPropagation();
|
|
68793
|
+
e.preventDefault();
|
|
68794
|
+
}, children: displayText }) }))] }));
|
|
68776
68795
|
}
|
|
68777
68796
|
};
|
|
68778
68797
|
return (jsx(Fragment$1, { children: col.visible !== false && col.isGroup !== true && (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: {
|
|
@@ -68803,7 +68822,7 @@ const RenderContentCol = (props) => {
|
|
|
68803
68822
|
}, children: RenderElement() }, `col-${indexRow}-${indexCol}`)) }));
|
|
68804
68823
|
};
|
|
68805
68824
|
|
|
68806
|
-
const TableView = ({ idTable, dataSource, height = 400, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, contextMenuItems, handleContextMenuClick }) => {
|
|
68825
|
+
const TableView = ({ idTable, dataSource, height = 400, haveSum, columns, isLoading, formatSetting, querySetting, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent, groupSetting, zeroVisiable, isMulti, handleDoubleClick, contextMenuItems, handleContextMenuClick }) => {
|
|
68807
68826
|
const { t } = useTranslation();
|
|
68808
68827
|
const gridRef = useRef(null);
|
|
68809
68828
|
const [openPopupSetupColumn, setOpenPopupSetupColumn] = useState(false);
|
|
@@ -69152,7 +69171,7 @@ const TableView = ({ idTable, dataSource, height = 400, columns, isLoading, form
|
|
|
69152
69171
|
querySetting.changeOrder(val);
|
|
69153
69172
|
}
|
|
69154
69173
|
}, columns: contentColumns, setContentColumns: setContentColumns, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, totalCount: dataSource?.length ?? 0 }, `header-${indexParent}-${index}`))) }, `header-${-indexParent}`));
|
|
69155
|
-
}) }), 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) => {
|
|
69174
|
+
}) }), jsx("tbody", { className: "r-gridcontent", role: "rowgroup", children: jsx(RenderContent, { datas: viewData }) }), jsx("tfoot", { className: "r-gridfoot", children: ((columnsAggregate?.length ?? 0) > 0 || haveSum) && (jsx("tr", { className: "r-row", children: contentColumns.map((col, indexCol) => {
|
|
69156
69175
|
if (col.visible === false || col.isGroup === true) {
|
|
69157
69176
|
return;
|
|
69158
69177
|
}
|