react-table-edit 1.4.39 → 1.4.41
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/sidebar-setting-column/index.d.ts +2 -0
- package/dist/component/table/index.d.ts +4 -15
- package/dist/component/type/index.d.ts +13 -0
- package/dist/index.d.ts +17 -15
- package/dist/index.js +92 -49
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ export interface IFPropsDetail {
|
|
|
4
4
|
setColumn: any;
|
|
5
5
|
openSidebar: boolean;
|
|
6
6
|
handleSidebar: any;
|
|
7
|
+
resetDefaultColumns?: () => void;
|
|
8
|
+
formatSetting?: any;
|
|
7
9
|
}
|
|
8
10
|
declare const SidebarSetColumn: (props: IFPropsDetail) => import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export default SidebarSetColumn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import { IColumnTable, IFTableEditButton, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from "../type";
|
|
2
|
+
import { IColumnTable, IFSettingColumns, IFTableEditButton, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from "../type";
|
|
3
3
|
export type IFTableEditProps = {
|
|
4
4
|
idTable?: string;
|
|
5
5
|
dataSource: any[];
|
|
@@ -24,26 +24,15 @@ export type IFTableEditProps = {
|
|
|
24
24
|
allowFilter?: boolean;
|
|
25
25
|
allowOrder?: boolean;
|
|
26
26
|
optionsFilter?: any;
|
|
27
|
-
settingColumns?:
|
|
28
|
-
field: string;
|
|
29
|
-
headerText?: string;
|
|
30
|
-
visible?: boolean;
|
|
31
|
-
fixedType?: "left" | "right";
|
|
32
|
-
width?: number | string;
|
|
33
|
-
}[];
|
|
27
|
+
settingColumns?: IFSettingColumns[];
|
|
34
28
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
35
29
|
commandClick?: (data: any) => void;
|
|
36
30
|
handleSelect?: (data: any) => void;
|
|
37
31
|
dataSourceChange?: (data: any[]) => void;
|
|
38
32
|
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
39
33
|
onDuplicate?: (newData: any, index: number) => void;
|
|
40
|
-
saveSettingColumn?: (data:
|
|
41
|
-
|
|
42
|
-
headerText?: string;
|
|
43
|
-
visible?: boolean;
|
|
44
|
-
fixedType?: "left" | "right";
|
|
45
|
-
width?: number | string;
|
|
46
|
-
}[]) => void;
|
|
34
|
+
saveSettingColumn?: (data: IFSettingColumns[]) => void;
|
|
35
|
+
resetDefaultColumns?: () => void;
|
|
47
36
|
};
|
|
48
37
|
type IFRef = {
|
|
49
38
|
refeshFocusRow: any;
|
|
@@ -31,6 +31,19 @@ export type IFToolbarOptions = {
|
|
|
31
31
|
/** Template toolbar */
|
|
32
32
|
template: any;
|
|
33
33
|
};
|
|
34
|
+
/** Cấu hình thiết lập bảng */
|
|
35
|
+
export type IFSettingColumns = {
|
|
36
|
+
/** Tên thuộc tính */
|
|
37
|
+
field: string;
|
|
38
|
+
/** Tiêu đề hiển thị ở header */
|
|
39
|
+
headerText?: string;
|
|
40
|
+
/** Có hiển thị không */
|
|
41
|
+
visible?: boolean;
|
|
42
|
+
/** Cố định trái/phải */
|
|
43
|
+
fixedType?: "left" | "right";
|
|
44
|
+
/** Chiều rộng cột */
|
|
45
|
+
width?: number | string;
|
|
46
|
+
};
|
|
34
47
|
/** Cấu hình phần tử form khi dùng loại cột `form` */
|
|
35
48
|
export type ISettingFormElement = {
|
|
36
49
|
/** Schema định nghĩa cấu trúc form */
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,19 @@ type IFToolbarOptions = {
|
|
|
35
35
|
/** Template toolbar */
|
|
36
36
|
template: any;
|
|
37
37
|
};
|
|
38
|
+
/** Cấu hình thiết lập bảng */
|
|
39
|
+
type IFSettingColumns = {
|
|
40
|
+
/** Tên thuộc tính */
|
|
41
|
+
field: string;
|
|
42
|
+
/** Tiêu đề hiển thị ở header */
|
|
43
|
+
headerText?: string;
|
|
44
|
+
/** Có hiển thị không */
|
|
45
|
+
visible?: boolean;
|
|
46
|
+
/** Cố định trái/phải */
|
|
47
|
+
fixedType?: "left" | "right";
|
|
48
|
+
/** Chiều rộng cột */
|
|
49
|
+
width?: number | string;
|
|
50
|
+
};
|
|
38
51
|
/** Cấu hình phần tử form khi dùng loại cột `form` */
|
|
39
52
|
type ISettingFormElement = {
|
|
40
53
|
/** Schema định nghĩa cấu trúc form */
|
|
@@ -412,26 +425,15 @@ type IFTableEditProps = {
|
|
|
412
425
|
allowFilter?: boolean;
|
|
413
426
|
allowOrder?: boolean;
|
|
414
427
|
optionsFilter?: any;
|
|
415
|
-
settingColumns?:
|
|
416
|
-
field: string;
|
|
417
|
-
headerText?: string;
|
|
418
|
-
visible?: boolean;
|
|
419
|
-
fixedType?: "left" | "right";
|
|
420
|
-
width?: number | string;
|
|
421
|
-
}[];
|
|
428
|
+
settingColumns?: IFSettingColumns[];
|
|
422
429
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
423
430
|
commandClick?: (data: any) => void;
|
|
424
431
|
handleSelect?: (data: any) => void;
|
|
425
432
|
dataSourceChange?: (data: any[]) => void;
|
|
426
433
|
rowChange?: (row: any, indexRow: number, field: string) => void;
|
|
427
434
|
onDuplicate?: (newData: any, index: number) => void;
|
|
428
|
-
saveSettingColumn?: (data:
|
|
429
|
-
|
|
430
|
-
headerText?: string;
|
|
431
|
-
visible?: boolean;
|
|
432
|
-
fixedType?: "left" | "right";
|
|
433
|
-
width?: number | string;
|
|
434
|
-
}[]) => void;
|
|
435
|
+
saveSettingColumn?: (data: IFSettingColumns[]) => void;
|
|
436
|
+
resetDefaultColumns?: () => void;
|
|
435
437
|
};
|
|
436
438
|
type IFRef = {
|
|
437
439
|
refeshFocusRow: any;
|
|
@@ -743,4 +745,4 @@ type TableViewProps = {
|
|
|
743
745
|
declare const TableView: React__default.FC<TableViewProps>;
|
|
744
746
|
|
|
745
747
|
export { ExportExcelComponent, FindNodeByPath, ImportExcelComponent, InputStyleComponent, SelectTable, SelectTableTree, TableView, TabsMenuComponent, Wizard, calculateTableStructure, checkDecimalSeparator, checkThousandSeparator, TableEdit as default, formartNumberic, formatDateTime, generateUUID, isNullOrUndefined, messageBoxConfirm, messageBoxConfirm2, messageBoxConfirmDelete, messageBoxError, messageHtmlBoxConfirm, messageHtmlBoxError, notificationError, notificationSuccess, roundNumber, useOnClickOutside };
|
|
746
|
-
export type { FromItemsField, IColumnTable, IColumnsAgg, ICommandItem, IFColumnSelectTable, IFColumnSelectTableTree, IFCurrentPage, IFCurrentPageConfig, IFFilterTable, IFOrderTable, IFPageSize, IFPropsDetail, IFTableEditButton, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar, IFTableSelectFormat, IFTableTreeSelectFormat, IFToolbarOptions, IHeaderColumnTable, ISettingFormElement, ISettingNumericElement, ISettingSelectElement };
|
|
748
|
+
export type { FromItemsField, IColumnTable, IColumnsAgg, ICommandItem, IFColumnSelectTable, IFColumnSelectTableTree, IFCurrentPage, IFCurrentPageConfig, IFFilterTable, IFOrderTable, IFPageSize, IFPropsDetail, IFSettingColumns, IFTableEditButton, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar, IFTableSelectFormat, IFTableTreeSelectFormat, IFToolbarOptions, IHeaderColumnTable, ISettingFormElement, ISettingNumericElement, ISettingSelectElement };
|
package/dist/index.js
CHANGED
|
@@ -17724,12 +17724,15 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
17724
17724
|
const column = settingColumns.find((y) => y.field === cell.field);
|
|
17725
17725
|
if (column) {
|
|
17726
17726
|
cell.visible = column.visible;
|
|
17727
|
-
if (column.fixedType) {
|
|
17727
|
+
if (column.fixedType !== undefined && column.fixedType !== null) {
|
|
17728
17728
|
cell.fixedType = column.fixedType;
|
|
17729
17729
|
}
|
|
17730
|
-
if (column.width) {
|
|
17730
|
+
if (column.width !== undefined && column.width !== null) {
|
|
17731
17731
|
cell.width = column.width;
|
|
17732
17732
|
}
|
|
17733
|
+
if (column.headerText !== undefined && column.headerText !== null) {
|
|
17734
|
+
cell.headerText = column.headerText;
|
|
17735
|
+
}
|
|
17733
17736
|
}
|
|
17734
17737
|
else {
|
|
17735
17738
|
cell.visible = false;
|
|
@@ -17737,24 +17740,24 @@ const calculateTableStructure = (columns, settingColumns) => {
|
|
|
17737
17740
|
}
|
|
17738
17741
|
levels[level].push(cell);
|
|
17739
17742
|
const headerKey = `${level}-${indexCol}`;
|
|
17740
|
-
if (
|
|
17743
|
+
if (cell.fixedType === "left" && cell.visible !== false) {
|
|
17741
17744
|
objHeaderWidthFixLeft[headerKey] = leftTotal;
|
|
17742
17745
|
}
|
|
17743
17746
|
if (!hasChildren) {
|
|
17744
17747
|
const index = flat.length;
|
|
17745
|
-
const width =
|
|
17748
|
+
const width = cell.width ?? 40;
|
|
17746
17749
|
cell.index = index;
|
|
17747
17750
|
flat.push(cell);
|
|
17748
|
-
if (
|
|
17751
|
+
if (cell.fixedType === "left" && cell.visible !== false) {
|
|
17749
17752
|
objWidthFixLeft[index] = leftTotal;
|
|
17750
17753
|
leftTotal += width;
|
|
17751
17754
|
}
|
|
17752
|
-
if (
|
|
17755
|
+
if (cell.fixedType === "right" && cell.visible !== false) {
|
|
17753
17756
|
rightTotal -= width;
|
|
17754
17757
|
objWidthFixRight[index] = rightTotal;
|
|
17755
17758
|
}
|
|
17756
17759
|
}
|
|
17757
|
-
if (
|
|
17760
|
+
if (cell.fixedType === "right" && cell.visible !== false) {
|
|
17758
17761
|
objHeaderWidthFixRight[headerKey] = rightTotal;
|
|
17759
17762
|
}
|
|
17760
17763
|
return colspanSum + colspan;
|
|
@@ -40369,7 +40372,7 @@ const Sidebar = (props) => {
|
|
|
40369
40372
|
};
|
|
40370
40373
|
|
|
40371
40374
|
const SidebarSetColumn = (props) => {
|
|
40372
|
-
const { column, setColumn, openSidebar, handleSidebar } = props;
|
|
40375
|
+
const { column, setColumn, openSidebar, handleSidebar, resetDefaultColumns, formatSetting } = props;
|
|
40373
40376
|
const { t } = reactI18next.useTranslation();
|
|
40374
40377
|
const [dataSource, setDataSource] = React$5.useState([]);
|
|
40375
40378
|
const [indexFocus, setIndexFocus] = React$5.useState();
|
|
@@ -40400,46 +40403,83 @@ const SidebarSetColumn = (props) => {
|
|
|
40400
40403
|
window.removeEventListener("resize", handleWindowResize);
|
|
40401
40404
|
};
|
|
40402
40405
|
}, []);
|
|
40406
|
+
const handleResetColumns = () => {
|
|
40407
|
+
if (resetDefaultColumns) {
|
|
40408
|
+
resetDefaultColumns();
|
|
40409
|
+
}
|
|
40410
|
+
handleSidebar();
|
|
40411
|
+
setDataSource([]);
|
|
40412
|
+
};
|
|
40403
40413
|
const renderFooterButtons = () => {
|
|
40404
|
-
return (jsxRuntime.jsxs(React$5.Fragment, { children: [jsxRuntime.jsx(Button$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }), jsxRuntime.jsx(Button$1, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })] }));
|
|
40414
|
+
return (jsxRuntime.jsxs(React$5.Fragment, { children: [resetDefaultColumns && jsxRuntime.jsx(Button$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, { color: "primary", onClick: handleSubmit, className: "me-1", children: t("Confirm") }), jsxRuntime.jsx(Button$1, { color: "secondary", onClick: handleCancel, outline: true, children: t("Close") })] }));
|
|
40405
40415
|
};
|
|
40406
40416
|
const visibleTemplate = (item, index) => {
|
|
40407
|
-
return (jsxRuntime.jsx(Input$1, { defaultChecked: item.visible ?? true,
|
|
40417
|
+
return (jsxRuntime.jsx("div", { className: "r-cell-text", children: jsxRuntime.jsx(Input$1, { defaultChecked: item.visible ?? true, type: "checkbox", style: { height: 18 }, className: " cursor-pointer", onChange: (e) => {
|
|
40418
|
+
if (dataSource) {
|
|
40419
|
+
dataSource[index].visible = e.target.checked;
|
|
40420
|
+
setDataSource(dataSource);
|
|
40421
|
+
}
|
|
40422
|
+
} }) }));
|
|
40423
|
+
};
|
|
40424
|
+
const headerTextTemplate = (item, index) => {
|
|
40425
|
+
let textValue = t(item.headerText);
|
|
40426
|
+
return (jsxRuntime.jsx(Input$1, { defaultValue: textValue, className: classNames$2("border-0 rounded-0 input-element"), onChange: (e) => {
|
|
40427
|
+
textValue = e.target?.value;
|
|
40428
|
+
}, onBlur: () => {
|
|
40408
40429
|
if (dataSource) {
|
|
40409
|
-
dataSource[index].
|
|
40430
|
+
dataSource[index].headerText = textValue;
|
|
40410
40431
|
setDataSource(dataSource);
|
|
40411
40432
|
}
|
|
40412
40433
|
} }));
|
|
40413
40434
|
};
|
|
40414
40435
|
const fixColumnTemplate = (item, index) => {
|
|
40415
|
-
|
|
40436
|
+
const optionsFix = [{ label: 'Trái', value: 'left' }, { label: 'Phải', value: 'right' }];
|
|
40437
|
+
return (jsxRuntime.jsx(SelectTable, { options: optionsFix, textAlign: "left", isClearable: true, onChange: (val) => {
|
|
40416
40438
|
if (dataSource) {
|
|
40417
|
-
|
|
40418
|
-
|
|
40419
|
-
|
|
40420
|
-
|
|
40421
|
-
|
|
40422
|
-
|
|
40423
|
-
|
|
40424
|
-
|
|
40425
|
-
|
|
40426
|
-
|
|
40439
|
+
dataSource[index].fixedType = val?.value;
|
|
40440
|
+
setDataSource([...dataSource]);
|
|
40441
|
+
}
|
|
40442
|
+
}, value: item.fixedType ? optionsFix.find(x => x.value === item.fixedType) : undefined }));
|
|
40443
|
+
};
|
|
40444
|
+
const widthColumnTemplate = (item, index) => {
|
|
40445
|
+
const numericFormatProps = {
|
|
40446
|
+
value: !isNullOrUndefined(item.width) ? item.width.toString() : "",
|
|
40447
|
+
thousandSeparator: checkThousandSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
40448
|
+
decimalSeparator: checkDecimalSeparator(formatSetting?.thousandSeparator, formatSetting?.decimalSeparator),
|
|
40449
|
+
allowNegative: false,
|
|
40450
|
+
decimalScale: 0
|
|
40451
|
+
};
|
|
40452
|
+
let floatValue = parseFloat(item.width ?? "0");
|
|
40453
|
+
return (jsxRuntime.jsx(NumericFormat, { style: { textAlign: 'right', height: 29 }, ...numericFormatProps, defaultValue: formartNumberic(item.width, formatSetting?.decimalSeparator ?? ",", formatSetting?.thousandSeparator ?? ".", 0), className: classNames$2("form-control border-0 rounded-0 input-numeric"), onValueChange: (values) => {
|
|
40454
|
+
floatValue = values?.floatValue;
|
|
40455
|
+
}, onFocus: (e) => {
|
|
40456
|
+
e.target.setSelectionRange(0, e.target.innerText.length - 1);
|
|
40457
|
+
}, onBlur: () => {
|
|
40458
|
+
if (floatValue !== item.width) {
|
|
40459
|
+
if (dataSource) {
|
|
40460
|
+
dataSource[index].width = !isNaN(floatValue) ? floatValue : 0;
|
|
40461
|
+
setDataSource(dataSource);
|
|
40427
40462
|
}
|
|
40428
|
-
setDataSource(dataSource);
|
|
40429
40463
|
}
|
|
40430
40464
|
} }));
|
|
40431
40465
|
};
|
|
40432
40466
|
const columns = [
|
|
40467
|
+
{
|
|
40468
|
+
field: "",
|
|
40469
|
+
headerText: "STT",
|
|
40470
|
+
template: (row, index) => {
|
|
40471
|
+
return index + 1;
|
|
40472
|
+
},
|
|
40473
|
+
textAlign: 'center',
|
|
40474
|
+
visible: true,
|
|
40475
|
+
width: 50
|
|
40476
|
+
},
|
|
40433
40477
|
{
|
|
40434
40478
|
field: "headerText",
|
|
40435
40479
|
headerText: "Column name",
|
|
40436
|
-
template:
|
|
40437
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: t(e.headerText) });
|
|
40438
|
-
},
|
|
40480
|
+
template: headerTextTemplate,
|
|
40439
40481
|
visible: true,
|
|
40440
|
-
width:
|
|
40441
|
-
maxWidth: 200,
|
|
40442
|
-
minWidth: 150
|
|
40482
|
+
width: 200
|
|
40443
40483
|
},
|
|
40444
40484
|
{
|
|
40445
40485
|
field: "",
|
|
@@ -40447,9 +40487,7 @@ const SidebarSetColumn = (props) => {
|
|
|
40447
40487
|
headerText: "Display",
|
|
40448
40488
|
textAlign: "center",
|
|
40449
40489
|
visible: true,
|
|
40450
|
-
width:
|
|
40451
|
-
maxWidth: 120,
|
|
40452
|
-
minWidth: 80
|
|
40490
|
+
width: 80
|
|
40453
40491
|
},
|
|
40454
40492
|
{
|
|
40455
40493
|
field: "",
|
|
@@ -40457,18 +40495,15 @@ const SidebarSetColumn = (props) => {
|
|
|
40457
40495
|
headerText: "Fix the column",
|
|
40458
40496
|
textAlign: "center",
|
|
40459
40497
|
visible: true,
|
|
40460
|
-
width:
|
|
40461
|
-
maxWidth: 120,
|
|
40462
|
-
minWidth: 80
|
|
40498
|
+
width: 80
|
|
40463
40499
|
},
|
|
40464
40500
|
{
|
|
40465
40501
|
field: "width",
|
|
40466
40502
|
headerText: "Column width",
|
|
40467
40503
|
textAlign: "right",
|
|
40468
40504
|
visible: true,
|
|
40469
|
-
|
|
40470
|
-
|
|
40471
|
-
minWidth: 80
|
|
40505
|
+
template: widthColumnTemplate,
|
|
40506
|
+
width: 100
|
|
40472
40507
|
}
|
|
40473
40508
|
];
|
|
40474
40509
|
const renderHeaderCol = (col, indexCol) => {
|
|
@@ -40486,10 +40521,6 @@ const SidebarSetColumn = (props) => {
|
|
|
40486
40521
|
return renderHeaderCol(col, index);
|
|
40487
40522
|
}) }) }), jsxRuntime.jsx("tbody", { className: "r-gridcontent", children: dataSource?.map((row, indexRow) => {
|
|
40488
40523
|
return (jsxRuntime.jsx("tr", { className: classNames$2("r-row", { "last-row": indexRow === dataSource.length - 1 }, { "fisrt-row": indexRow === 0 }), children: columns.map((col, indexCol) => {
|
|
40489
|
-
let value = row[col.field];
|
|
40490
|
-
if (col.type === "numeric" || (col.typeCondition && col.typeCondition(row) === "numeric")) {
|
|
40491
|
-
value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
|
|
40492
|
-
}
|
|
40493
40524
|
return (jsxRuntime.jsx(React$5.Fragment, { children: col.visible !== false && (jsxRuntime.jsx("td", { className: classNames$2(`r-rowcell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }, { "r-active": indexFocus === indexRow }), style: {
|
|
40494
40525
|
padding: 0,
|
|
40495
40526
|
textAlign: col.textAlign ? col.textAlign : "left"
|
|
@@ -40507,7 +40538,7 @@ const SidebarSetColumn = (props) => {
|
|
|
40507
40538
|
}
|
|
40508
40539
|
}, children: jsxRuntime.jsx("div", { className: classNames$2("r-rowcell-div"), style: {
|
|
40509
40540
|
width: col.fixedType ? Number(col.maxWidth ? col.maxWidth : col.width ? col.width : col.minWidth ?? "auto") : "auto"
|
|
40510
|
-
}, children: jsxRuntime.jsx("div", { className: classNames$2("r-rowcell-content"), children:
|
|
40541
|
+
}, children: jsxRuntime.jsx("div", { className: classNames$2("r-rowcell-content"), children: col.template && col.template(row, indexRow) }) }) }, `col-${indexRow}-${indexCol}`)) }, indexCol));
|
|
40511
40542
|
}) }, `row-${indexRow}`));
|
|
40512
40543
|
}) })] }) }) }) }), jsxRuntime.jsx("div", { className: "d-flex justify-content-end p-1 ", style: { boxShadow: "0 4px 24px 0 rgb(34 41 47 / 10%)" }, children: renderFooterButtons() })] }));
|
|
40513
40544
|
};
|
|
@@ -42839,7 +42870,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
|
|
|
42839
42870
|
|
|
42840
42871
|
const TableEdit = React$5.forwardRef((props, ref) => {
|
|
42841
42872
|
const { t } = reactI18next.useTranslation();
|
|
42842
|
-
const { idTable, dataSource, columns, pagingSetting, setDataSource, height, maxHeight, minHeight, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFilter = true, allowOrder, settingColumns, optionsFilter } = props;
|
|
42873
|
+
const { idTable, dataSource, columns, pagingSetting, setDataSource, height, maxHeight, minHeight, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFilter = true, allowOrder, settingColumns, optionsFilter, resetDefaultColumns } = props;
|
|
42843
42874
|
React$5.useImperativeHandle(ref, () => {
|
|
42844
42875
|
return {
|
|
42845
42876
|
refeshFocusRow: handleRefeshRow
|
|
@@ -43135,15 +43166,27 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43135
43166
|
}
|
|
43136
43167
|
} }));
|
|
43137
43168
|
default:
|
|
43138
|
-
|
|
43139
|
-
|
|
43140
|
-
|
|
43169
|
+
let textValue = row[col.field] ?? '';
|
|
43170
|
+
return (jsxRuntime.jsx(Input$1, { id: `${idTable}-col${indexCol + 1}-row${indexRow + 1}`, style: { textAlign: col.textAlign, height: 29 }, defaultValue: textValue, className: classNames$2("border-0 rounded-0 input-element", { "is-invalid": col.validate && col.validate(row[col.field], row) }), onChange: (val) => {
|
|
43171
|
+
textValue = val.target?.value;
|
|
43172
|
+
}, onBlur: () => {
|
|
43173
|
+
if (row[col.field] != textValue) {
|
|
43174
|
+
row[col.field] = textValue;
|
|
43141
43175
|
if (col.callback) {
|
|
43142
|
-
col.callback(
|
|
43176
|
+
col.callback(textValue, indexRow, row);
|
|
43143
43177
|
}
|
|
43144
43178
|
handleDataChange(row, col, indexRow);
|
|
43145
43179
|
}
|
|
43146
43180
|
}, onKeyDown: (e) => {
|
|
43181
|
+
if (e.key === "ArrowDown" || e.key === "NumpadEnter" || e.key === "ArrowUp" || e.key === "Enter" || e.key === "Tab") {
|
|
43182
|
+
if (row[col.field] != textValue) {
|
|
43183
|
+
row[col.field] = textValue;
|
|
43184
|
+
if (col.callback) {
|
|
43185
|
+
col.callback(textValue, indexRow, row);
|
|
43186
|
+
}
|
|
43187
|
+
handleDataChange(row, col, indexRow);
|
|
43188
|
+
}
|
|
43189
|
+
}
|
|
43147
43190
|
checkKeyDown(e, row, col, indexRow + 1, indexCol + 1);
|
|
43148
43191
|
}, onPaste: (e) => {
|
|
43149
43192
|
if (toolbarSetting?.showBottomToolbar && !editDisable && !addDisable && !col.disablePaste) {
|
|
@@ -43732,7 +43775,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
43732
43775
|
handleDeleteAll(t, messageBoxConfirmDelete, setIndexFocus, changeDataSource, editDisable, addDisable, toolbarSetting, buttonSetting);
|
|
43733
43776
|
}, setOpenPopupSetupColumn: setOpenPopupSetupColumn, indexFocus: indexFocus, editDisable: editDisable, addDisable: addDisable, buttonSetting: buttonSetting, toolbarSetting: toolbarSetting, headerColumns: headerColumns, t: t }))] }), pagingSetting?.allowPaging ? (jsxRuntime.jsx(PagingComponent, { onChangePage: onChangePage, pageSize: pagingSetting?.pageSize ?? 0, currentPage: pagingSetting?.currentPage ?? 0, pageOptions: pagingSetting?.pageOptions ?? [20, 30, 50, 100], totalItem: pagingClient ? totalCount : pagingSetting?.totalItem ?? 0, onChangePageSize: onChangePageSize })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}))] }), jsxRuntime.jsx(SidebarSetColumn, { handleSidebar: () => {
|
|
43734
43777
|
setOpenPopupSetupColumn(!openPopupSetupColumn);
|
|
43735
|
-
}, openSidebar: openPopupSetupColumn, column: [...contentColumns], setColumn: (newColumns) => {
|
|
43778
|
+
}, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
|
|
43736
43779
|
if (saveSettingColumn) {
|
|
43737
43780
|
saveSettingColumn(newColumns.map((x) => ({ field: x.field, headerText: x.headerText, visible: x.visible, fixedType: x.fixedType, width: x.width })));
|
|
43738
43781
|
}
|