react-table-edit 1.4.68 → 1.5.0
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/type.d.ts +1 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, Dispatch, SetStateAction, JSX
|
|
2
|
+
import React__default, { ReactNode, Dispatch, SetStateAction, JSX } from 'react';
|
|
3
3
|
import { UseFormSetValue, UseFormGetValues, UseFormReset } from 'react-hook-form';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { TFunction } from 'react-i18next';
|
|
@@ -77,7 +77,7 @@ type ISettingFormElement = {
|
|
|
77
77
|
/** Sự kiện submit form */
|
|
78
78
|
onFormSubmit?: (rowData: any, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>, reset: UseFormReset<any>) => void;
|
|
79
79
|
/** Footer tùy chỉnh trong form */
|
|
80
|
-
footerTemplate?: (rowData: any) => JSX
|
|
80
|
+
footerTemplate?: (rowData: any) => JSX.Element;
|
|
81
81
|
/** Sự kiện thay đổi trường dữ liệu */
|
|
82
82
|
onChangeField?: (rowData: any, field: string, setValue: UseFormSetValue<any>, getValues: UseFormGetValues<any>) => void;
|
|
83
83
|
/** Sự kiện thay đổi form */
|
|
@@ -122,9 +122,9 @@ type ISettingSelectElement = {
|
|
|
122
122
|
/** Danh sách cột hiển thị trong bảng chọn */
|
|
123
123
|
columns?: IFColumnSelectTable[];
|
|
124
124
|
/** Tuỳ chỉnh hiển thị option */
|
|
125
|
-
formatOptionLabel?: (ele: any) => JSX
|
|
125
|
+
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
126
126
|
/** Component footer trong menu chọn */
|
|
127
|
-
footerComponent?: () => JSX
|
|
127
|
+
footerComponent?: () => JSX.Element;
|
|
128
128
|
/** Load options động */
|
|
129
129
|
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
130
130
|
/** Sự kiện mở menu */
|
|
@@ -204,7 +204,7 @@ type IColumnTable = {
|
|
|
204
204
|
/** Callback khi thay đổi giá trị */
|
|
205
205
|
callback?: (value: any, indexRow: number, item: any) => void;
|
|
206
206
|
/** Template hiển thị khi không ở chế độ edit */
|
|
207
|
-
template?: (row: any, indexRow: number) => JSX
|
|
207
|
+
template?: (row: any, indexRow: number) => JSX.Element | string | number | undefined;
|
|
208
208
|
/** Xác định loại edit dựa trên điều kiện */
|
|
209
209
|
typeCondition?: (row: any) => IColumnType;
|
|
210
210
|
/** Sự kiện khi paste dữ liệu */
|
|
@@ -610,14 +610,14 @@ type Props$1 = {
|
|
|
610
610
|
showFooter?: boolean;
|
|
611
611
|
formatSetting?: IFTableSelectFormat;
|
|
612
612
|
component?: string | HTMLElement | React__default.RefObject<HTMLElement> | undefined;
|
|
613
|
-
formatOptionLabel?: (ele: any) => JSX
|
|
613
|
+
formatOptionLabel?: (ele: any) => JSX.Element;
|
|
614
614
|
loadOptions?: (keyword: string, callback: (rs: any[]) => void) => void;
|
|
615
615
|
onKeyDown?: (e: React__default.KeyboardEvent<HTMLInputElement>) => any;
|
|
616
616
|
onOpenMenu?: () => void;
|
|
617
617
|
handleAdd?: (e?: any) => void;
|
|
618
618
|
onPaste?: (e: React__default.ClipboardEvent<HTMLInputElement>) => void;
|
|
619
619
|
onCloseMenu?: () => void;
|
|
620
|
-
footerComponent?: () => JSX
|
|
620
|
+
footerComponent?: () => JSX.Element;
|
|
621
621
|
onChange: (val: any) => void;
|
|
622
622
|
compareFunction?: (row?: any) => boolean | undefined;
|
|
623
623
|
};
|
|
@@ -774,10 +774,10 @@ declare const calculateTableStructure: (columns: any[], settingColumns?: IFSetti
|
|
|
774
774
|
|
|
775
775
|
type IFSteps = {
|
|
776
776
|
id: string;
|
|
777
|
-
content: JSX
|
|
778
|
-
subtitle?: JSX
|
|
779
|
-
title: JSX
|
|
780
|
-
icon?: JSX
|
|
777
|
+
content: JSX.Element;
|
|
778
|
+
subtitle?: JSX.Element | string;
|
|
779
|
+
title: JSX.Element | string;
|
|
780
|
+
icon?: JSX.Element | string;
|
|
781
781
|
done?: boolean;
|
|
782
782
|
loading?: boolean;
|
|
783
783
|
disable?: boolean;
|
|
@@ -794,7 +794,7 @@ type IFProps = {
|
|
|
794
794
|
heightContent?: number | string;
|
|
795
795
|
widthContent?: number | string;
|
|
796
796
|
type?: 'vertical' | 'horizontal' | 'modern-horizontal' | 'modern-vertical';
|
|
797
|
-
separator?: JSX
|
|
797
|
+
separator?: JSX.Element;
|
|
798
798
|
};
|
|
799
799
|
declare const Wizard: React.ForwardRefExoticComponent<IFProps & React.RefAttributes<unknown>>;
|
|
800
800
|
|
package/dist/index.js
CHANGED
|
@@ -19960,7 +19960,9 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19960
19960
|
}, 0);
|
|
19961
19961
|
};
|
|
19962
19962
|
calcTotalRightWidth(columns);
|
|
19963
|
-
|
|
19963
|
+
if ((settingColumns?.length ?? 0) > 0) {
|
|
19964
|
+
applySetting(columns);
|
|
19965
|
+
}
|
|
19964
19966
|
traverse(columns);
|
|
19965
19967
|
// Danh sách các cột được hiển thị
|
|
19966
19968
|
const flatVisble = flat.filter((e) => e.visible !== false);
|
|
@@ -19971,7 +19973,6 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
19971
19973
|
// Tính toán vị trí đầu tiên và cuối cùng của các cột có thể sửa
|
|
19972
19974
|
const indexFirstEdit = flat.findIndex((item) => item.editEnable && item.visible !== false && !item.disabledCondition);
|
|
19973
19975
|
const indexLastEdit = flat.map((item, idx) => (item.editEnable && item.visible !== false && !item.disabledCondition ? idx : -1)).reduce((acc, val) => (val > acc ? val : acc), -1);
|
|
19974
|
-
console.log(flatVisble);
|
|
19975
19976
|
return {
|
|
19976
19977
|
levels,
|
|
19977
19978
|
flat,
|
|
@@ -73030,7 +73031,7 @@ const ModalImportComponent = (props) => {
|
|
|
73030
73031
|
const [dataInvalid, setDataInvalid] = React$5.useState([]);
|
|
73031
73032
|
const [checkInit, setCheckInit] = React$5.useState(false);
|
|
73032
73033
|
const [checkInitValidate, setCheckInitValidate] = React$5.useState(false);
|
|
73033
|
-
const [validateExcelColumns, setValidateExcelColumns] = React$5.useState(
|
|
73034
|
+
const [validateExcelColumns, setValidateExcelColumns] = React$5.useState(mapColumn);
|
|
73034
73035
|
const [dataError, setDataError] = React$5.useState([]);
|
|
73035
73036
|
const [isSaveSetting, setIsSaveSetting] = React$5.useState(true);
|
|
73036
73037
|
const formSchema = create().shape({
|
|
@@ -73163,10 +73164,13 @@ const ModalImportComponent = (props) => {
|
|
|
73163
73164
|
}
|
|
73164
73165
|
}
|
|
73165
73166
|
];
|
|
73167
|
+
React$5.useEffect(() => {
|
|
73168
|
+
console.log(watch('dataMap'));
|
|
73169
|
+
}, [watch('dataMap')]);
|
|
73166
73170
|
const handleFormOpened = () => {
|
|
73167
73171
|
getGeneralSettingApi().then((rs) => {
|
|
73168
73172
|
const arr = rs?.value ? JSON.parse(rs.value) : [];
|
|
73169
|
-
setValue('dataMap', mapColumn.map((x) => {
|
|
73173
|
+
setValue('dataMap', [...mapColumn].map((x) => {
|
|
73170
73174
|
const ele = arr.find(y => x.field === y.field);
|
|
73171
73175
|
if (ele) {
|
|
73172
73176
|
x.headerDefault = ele.headerDefault;
|
|
@@ -73174,7 +73178,7 @@ const ModalImportComponent = (props) => {
|
|
|
73174
73178
|
return x;
|
|
73175
73179
|
}));
|
|
73176
73180
|
}).catch(() => {
|
|
73177
|
-
setValue('dataMap', mapColumn);
|
|
73181
|
+
setValue('dataMap', [...mapColumn]);
|
|
73178
73182
|
});
|
|
73179
73183
|
if (headerValidateExcelColumns && headerValidateExcelColumns.length > 0) {
|
|
73180
73184
|
setValidateExcelColumns(headerValidateExcelColumns);
|
|
@@ -73813,7 +73817,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73813
73817
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
73814
73818
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
73815
73819
|
}, children: jsxRuntime.jsxs("div", { className: "r-footer-div", children: [(item || (col.haveSum === true && col.type === "numeric")) && col.type === "numeric" && (Number(sumValue) >= 0) && jsxRuntime.jsx(jsxRuntime.Fragment, { children: formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false) }), (item || (col.haveSum === true && col.type === "numeric")) && col.type === "numeric" && (Number(sumValue) < 0) && jsxRuntime.jsxs("div", { style: { color: formatSetting?.colorNegative ?? 'red' }, children: [" ", `${formatSetting?.prefixNegative ?? '-'}${formartNumberic(sumValue, formatSetting?.decimalSeparator ?? ',', formatSetting?.thousandSeparator ?? '.', col.numericSettings?.fraction, true, false)}${formatSetting?.suffixNegative ?? ''}`] })] }) }, `summarycell-${indexCol}`);
|
|
73816
|
-
}) }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxRuntime.jsxs("div", { className: "r-no-data", children: [jsxRuntime.jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsxRuntime.jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxRuntime.jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsxRuntime.jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsxRuntime.jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }), isLoading && jsxRuntime.jsx("div", { className: "r-loading-overlay", children: jsxRuntime.jsxs("div", { className: "r-loading", children: [jsxRuntime.jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging ? jsxRuntime.jsx(PagingComponent, { onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: (pagingSetting?.pagingClient ? viewData.length : pagingSetting?.totalItem ?? 0), onChangePageSize: onChangePageSize }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
73820
|
+
}) }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}) })] }), (((viewData.length ?? 0) === 0) && !isLoading) && jsxRuntime.jsxs("div", { className: "r-no-data", children: [jsxRuntime.jsx("svg", { width: "64", height: "41", viewBox: "0 0 64 41", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsxs("g", { transform: "translate(0 1)", fill: "none", fillRule: "evenodd", children: [jsxRuntime.jsx("ellipse", { fill: "#f5f5f5", cx: "32", cy: "33", rx: "32", ry: "7" }), jsxRuntime.jsxs("g", { fillRule: "nonzero", stroke: "#d9d9d9", children: [jsxRuntime.jsx("path", { d: "M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z" }), jsxRuntime.jsx("path", { d: "M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z", fill: "#fafafa" })] })] }) }), t('No data available.')] }), isLoading && jsxRuntime.jsx("div", { className: "r-loading-overlay", children: jsxRuntime.jsxs("div", { className: "r-loading", children: [jsxRuntime.jsx(Spinner$1, { className: "me-1" }), t('Loading...')] }) })] })] }), pagingSetting?.allowPaging ? jsxRuntime.jsx(PagingComponent, { gridRef: gridRef, onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: (pagingSetting?.pagingClient ? viewData.length : pagingSetting?.totalItem ?? 0), onChangePageSize: onChangePageSize }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
73817
73821
|
};
|
|
73818
73822
|
|
|
73819
73823
|
exports.ExportExcelComponent = ExportExcelComponent;
|