react-table-edit 1.5.7 → 1.5.8
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 +2 -2
- package/dist/component/table/header.d.ts +2 -2
- package/dist/component/table/index.d.ts +2 -2
- package/dist/component/table/toolbar-top.d.ts +1 -4
- package/dist/component/table-view/content.d.ts +0 -1
- package/dist/component/table-view/header.d.ts +3 -3
- package/dist/component/table-view/index.d.ts +23 -9
- package/dist/component/type/index.d.ts +3 -2
- package/dist/index.d.ts +28 -13
- package/dist/index.js +58 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -91
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -40,8 +40,8 @@ interface TableComponentProps {
|
|
|
40
40
|
filterBy: IFFilterTable[];
|
|
41
41
|
orderBy: IFOrderTable[];
|
|
42
42
|
optionsFilter: any;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
allowFiltering?: boolean;
|
|
44
|
+
allowSorting?: boolean;
|
|
45
45
|
searchSetting?: any;
|
|
46
46
|
searchTerm?: string;
|
|
47
47
|
haveSum?: boolean;
|
|
@@ -17,8 +17,8 @@ type IFDataProps = {
|
|
|
17
17
|
fisrtObjWidthFixRight: number;
|
|
18
18
|
selectedRows: any[];
|
|
19
19
|
isMulti: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
allowFiltering?: boolean;
|
|
21
|
+
allowSorting?: boolean;
|
|
22
22
|
filterBy: IFFilterTable[];
|
|
23
23
|
orderBy: IFOrderTable[];
|
|
24
24
|
container: any;
|
|
@@ -19,8 +19,8 @@ export type IFTableEditProps = {
|
|
|
19
19
|
searchSetting?: IFTableEditSearchSetting;
|
|
20
20
|
selectedItem?: any;
|
|
21
21
|
setDataSource?: any;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
allowFiltering?: boolean;
|
|
23
|
+
allowSorting?: boolean;
|
|
24
24
|
optionsFilter?: any;
|
|
25
25
|
settingColumns?: {
|
|
26
26
|
id?: string;
|
|
@@ -16,7 +16,6 @@ type IContentColProps = {
|
|
|
16
16
|
isMulti?: boolean;
|
|
17
17
|
fieldKey: string;
|
|
18
18
|
setSelectedRows: (value: any[]) => void;
|
|
19
|
-
handleCommandClick: (id: string, rowData: any, index: number) => void;
|
|
20
19
|
};
|
|
21
20
|
export declare const RenderContentCol: (props: IContentColProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
21
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { IColumnTable, IFFilterTable, IFOrderTable, IFTableEditFormat } from "../type";
|
|
3
2
|
import 'react-resizable/css/styles.css';
|
|
3
|
+
import { IColumnTable, IFFilterTable, IFOrderTable, IFTableEditFormat } from "../type";
|
|
4
4
|
type IFDataProps = {
|
|
5
5
|
idTable: string;
|
|
6
6
|
selectEnable: boolean;
|
|
@@ -20,8 +20,8 @@ type IFDataProps = {
|
|
|
20
20
|
fisrtObjWidthFixRight: number;
|
|
21
21
|
selectedRows: any[];
|
|
22
22
|
isMulti: boolean;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
allowFiltering?: boolean;
|
|
24
|
+
allowSorting?: boolean;
|
|
25
25
|
filterBy: IFFilterTable[];
|
|
26
26
|
orderBy: IFOrderTable[];
|
|
27
27
|
container: any;
|
|
@@ -1,29 +1,43 @@
|
|
|
1
1
|
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { IColumnsAgg, IColumnTable, IFFilterTable, IFOrderTable, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from '../type';
|
|
2
|
+
import { IColumnsAgg, IColumnTable, IFFilterTable, IFOrderTable, IFSettingColumns, IFTableEditFormat, IFTableEditPaging, IFTableEditSearchSetting, IFTableEditToolbar } from '../type';
|
|
3
3
|
type TableViewProps = {
|
|
4
4
|
idTable: string;
|
|
5
5
|
dataSource: any[];
|
|
6
|
-
rowHeight?: number;
|
|
7
6
|
height?: number;
|
|
8
7
|
columns: IColumnTable[];
|
|
9
8
|
selectEnable?: boolean;
|
|
10
9
|
isMutil?: boolean;
|
|
11
10
|
isLoading?: boolean;
|
|
12
11
|
formatSetting?: IFTableEditFormat;
|
|
13
|
-
allowFilter?: boolean;
|
|
14
|
-
allowOrder?: boolean;
|
|
15
|
-
optionsFilter?: any;
|
|
16
12
|
pagingSetting?: IFTableEditPaging;
|
|
17
13
|
toolbarSetting?: IFTableEditToolbar;
|
|
18
14
|
searchSetting?: IFTableEditSearchSetting;
|
|
19
15
|
columnsAggregate?: IColumnsAgg[];
|
|
20
16
|
selectedItem?: any;
|
|
21
|
-
|
|
17
|
+
headerComponent?: any;
|
|
18
|
+
settingColumns?: {
|
|
19
|
+
id?: string;
|
|
20
|
+
updatedDate?: Date;
|
|
21
|
+
updatedByName?: string;
|
|
22
|
+
value: IFSettingColumns[];
|
|
23
|
+
};
|
|
24
|
+
groupSetting?: {
|
|
25
|
+
client?: boolean;
|
|
26
|
+
groupColumns: string[];
|
|
27
|
+
onGroup: (props: any) => void;
|
|
28
|
+
};
|
|
29
|
+
querySetting: {
|
|
30
|
+
client?: boolean;
|
|
31
|
+
allowFiltering?: boolean;
|
|
32
|
+
allowSorting?: boolean;
|
|
33
|
+
optionsFilter?: any;
|
|
34
|
+
changeFilter?: (data: IFFilterTable[]) => void;
|
|
35
|
+
changeOrder?: (data: IFOrderTable[]) => void;
|
|
36
|
+
};
|
|
37
|
+
resetDefaultColumns?: () => void;
|
|
38
|
+
saveSettingColumn?: (data: IFSettingColumns[]) => void;
|
|
22
39
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
23
40
|
setColumns?: (columns: IColumnTable[]) => void;
|
|
24
|
-
commandClick?: (data: any) => void;
|
|
25
|
-
changeFilter?: (data: IFFilterTable[]) => void;
|
|
26
|
-
changeOrder?: (data: IFOrderTable[]) => void;
|
|
27
41
|
handleSelect?: (data: any) => void;
|
|
28
42
|
};
|
|
29
43
|
declare const TableView: React.FC<TableViewProps>;
|
|
@@ -32,10 +32,11 @@ export type ICommandItem = {
|
|
|
32
32
|
};
|
|
33
33
|
/** Cấu hình thanh công cụ (toolbar) */
|
|
34
34
|
export type IFToolbarOptions = {
|
|
35
|
+
id?: string;
|
|
35
36
|
/** Vị trí hiển thị (trái, phải, giữa) */
|
|
36
37
|
align: "left" | "right" | "center";
|
|
37
38
|
/** Template toolbar */
|
|
38
|
-
template
|
|
39
|
+
template?: () => JSX.Element;
|
|
39
40
|
};
|
|
40
41
|
/** Cấu hình thiết lập bảng */
|
|
41
42
|
export type IFSettingColumns = {
|
|
@@ -142,7 +143,7 @@ export type ISettingNumericElement = {
|
|
|
142
143
|
/** Định nghĩa cột bảng */
|
|
143
144
|
export type IColumnTable = {
|
|
144
145
|
/** Tên thuộc tính */
|
|
145
|
-
field:
|
|
146
|
+
field: "#" | "checkbox" | "command" | string;
|
|
146
147
|
/** Tên thuộc tính lọc*/
|
|
147
148
|
fieldFilter?: string;
|
|
148
149
|
/** Tiêu đề cột */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode, Dispatch, SetStateAction
|
|
2
|
+
import React__default, { ReactNode, JSX, Dispatch, SetStateAction } 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';
|
|
@@ -36,10 +36,11 @@ type ICommandItem = {
|
|
|
36
36
|
};
|
|
37
37
|
/** Cấu hình thanh công cụ (toolbar) */
|
|
38
38
|
type IFToolbarOptions = {
|
|
39
|
+
id?: string;
|
|
39
40
|
/** Vị trí hiển thị (trái, phải, giữa) */
|
|
40
41
|
align: "left" | "right" | "center";
|
|
41
42
|
/** Template toolbar */
|
|
42
|
-
template
|
|
43
|
+
template?: () => JSX.Element;
|
|
43
44
|
};
|
|
44
45
|
/** Cấu hình thiết lập bảng */
|
|
45
46
|
type IFSettingColumns = {
|
|
@@ -146,7 +147,7 @@ type ISettingNumericElement = {
|
|
|
146
147
|
/** Định nghĩa cột bảng */
|
|
147
148
|
type IColumnTable = {
|
|
148
149
|
/** Tên thuộc tính */
|
|
149
|
-
field:
|
|
150
|
+
field: "#" | "checkbox" | "command" | string;
|
|
150
151
|
/** Tên thuộc tính lọc*/
|
|
151
152
|
fieldFilter?: string;
|
|
152
153
|
/** Tiêu đề cột */
|
|
@@ -426,8 +427,8 @@ type IFTableEditProps = {
|
|
|
426
427
|
searchSetting?: IFTableEditSearchSetting;
|
|
427
428
|
selectedItem?: any;
|
|
428
429
|
setDataSource?: any;
|
|
429
|
-
|
|
430
|
-
|
|
430
|
+
allowFiltering?: boolean;
|
|
431
|
+
allowSorting?: boolean;
|
|
431
432
|
optionsFilter?: any;
|
|
432
433
|
settingColumns?: {
|
|
433
434
|
id?: string;
|
|
@@ -682,27 +683,41 @@ declare const TabsMenuComponent: ({ buttonWidth, tabParent, tabChild, resourceCo
|
|
|
682
683
|
type TableViewProps = {
|
|
683
684
|
idTable: string;
|
|
684
685
|
dataSource: any[];
|
|
685
|
-
rowHeight?: number;
|
|
686
686
|
height?: number;
|
|
687
687
|
columns: IColumnTable[];
|
|
688
688
|
selectEnable?: boolean;
|
|
689
689
|
isMutil?: boolean;
|
|
690
690
|
isLoading?: boolean;
|
|
691
691
|
formatSetting?: IFTableEditFormat;
|
|
692
|
-
allowFilter?: boolean;
|
|
693
|
-
allowOrder?: boolean;
|
|
694
|
-
optionsFilter?: any;
|
|
695
692
|
pagingSetting?: IFTableEditPaging;
|
|
696
693
|
toolbarSetting?: IFTableEditToolbar;
|
|
697
694
|
searchSetting?: IFTableEditSearchSetting;
|
|
698
695
|
columnsAggregate?: IColumnsAgg[];
|
|
699
696
|
selectedItem?: any;
|
|
700
|
-
|
|
697
|
+
headerComponent?: any;
|
|
698
|
+
settingColumns?: {
|
|
699
|
+
id?: string;
|
|
700
|
+
updatedDate?: Date;
|
|
701
|
+
updatedByName?: string;
|
|
702
|
+
value: IFSettingColumns[];
|
|
703
|
+
};
|
|
704
|
+
groupSetting?: {
|
|
705
|
+
client?: boolean;
|
|
706
|
+
groupColumns: string[];
|
|
707
|
+
onGroup: (props: any) => void;
|
|
708
|
+
};
|
|
709
|
+
querySetting: {
|
|
710
|
+
client?: boolean;
|
|
711
|
+
allowFiltering?: boolean;
|
|
712
|
+
allowSorting?: boolean;
|
|
713
|
+
optionsFilter?: any;
|
|
714
|
+
changeFilter?: (data: IFFilterTable[]) => void;
|
|
715
|
+
changeOrder?: (data: IFOrderTable[]) => void;
|
|
716
|
+
};
|
|
717
|
+
resetDefaultColumns?: () => void;
|
|
718
|
+
saveSettingColumn?: (data: IFSettingColumns[]) => void;
|
|
701
719
|
setSelectedItem?: Dispatch<SetStateAction<any>>;
|
|
702
720
|
setColumns?: (columns: IColumnTable[]) => void;
|
|
703
|
-
commandClick?: (data: any) => void;
|
|
704
|
-
changeFilter?: (data: IFFilterTable[]) => void;
|
|
705
|
-
changeOrder?: (data: IFOrderTable[]) => void;
|
|
706
721
|
handleSelect?: (data: any) => void;
|
|
707
722
|
};
|
|
708
723
|
declare const TableView: React__default.FC<TableViewProps>;
|
package/dist/index.js
CHANGED
|
@@ -20516,13 +20516,25 @@ const ReactInput = (props) => {
|
|
|
20516
20516
|
|
|
20517
20517
|
const RenderToolbarTop = ({ toolbarTopOption }) => {
|
|
20518
20518
|
return (jsxRuntime.jsx("div", { id: "table_custom_top_toolbar", className: "r-toolbar r-toolbar-top", "aria-orientation": "horizontal", children: jsxRuntime.jsxs("div", { className: "r-toolbar-items", children: [jsxRuntime.jsx("div", { className: "r-toolbar-left", children: toolbarTopOption?.map((item, index) => {
|
|
20519
|
-
return ((item.align === 'left') ? jsxRuntime.jsx(
|
|
20519
|
+
return ((item.align === 'left') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
|
|
20520
20520
|
}) }), jsxRuntime.jsx("div", { className: "r-toolbar-center", children: toolbarTopOption?.map((item, index) => {
|
|
20521
|
-
return ((item.align === 'center') ? jsxRuntime.jsx(
|
|
20521
|
+
return ((item.align === 'center') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
|
|
20522
20522
|
}) }), jsxRuntime.jsx("div", { className: "r-toolbar-right", children: toolbarTopOption?.map((item, index) => {
|
|
20523
|
-
return ((item.align === 'right') ? jsxRuntime.jsx(
|
|
20523
|
+
return ((item.align === 'right') ? jsxRuntime.jsx(ToolBarElement, { item: item, index: index }) : '');
|
|
20524
20524
|
}) })] }) }));
|
|
20525
20525
|
};
|
|
20526
|
+
const ToolBarElement = ({ item, index }) => {
|
|
20527
|
+
if (item.id === 'GROUP') {
|
|
20528
|
+
return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsxRuntime.jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "stroke-width": "1.5", id: "toolbar-columns-group", "font-size": "20", color: "#7F7F7F", className: "cursor-pointer", children: [jsxRuntime.jsxs("g", { "clip-path": "url(#group_svg__a)", fill: "#7F7F7F", children: [jsxRuntime.jsx("path", { d: "M22.167 0h-7.334c-.486 0-.952.181-1.295.503A1.662 1.662 0 0 0 13 1.714v20.572c0 .454.194.89.538 1.211.343.322.81.503 1.295.503h7.334c.486 0 .952-.181 1.295-.503.344-.321.537-.757.538-1.211V1.714c0-.454-.194-.89-.538-1.211A1.902 1.902 0 0 0 22.167 0Zm0 1.714v6h-7.334v-6h7.334Zm0 7.715v5.142h-7.334V9.43h7.334Zm-7.334 12.857v-6h7.334v6h-7.334ZM7.502 11.25h-1.5v-1.5h-1.5v1.5h-1.5v1.5h1.5v1.5h1.5v-1.5h1.5v-1.5Z" }), jsxRuntime.jsx("path", { d: "M10.502 4.5V3h-4.5a1.502 1.502 0 0 0-1.5 1.5v2.31a5.242 5.242 0 0 0 0 10.38v2.31a1.502 1.502 0 0 0 1.5 1.5h4.5v-1.5h-4.5v-2.31a5.243 5.243 0 0 0 0-10.38V4.5h4.5Zm-1.5 7.5a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" })] }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "group_svg__a", children: jsxRuntime.jsx("path", { fill: "#fff", d: "M0 0h24v24H0z" }) }) })] }) }, `toolbar-top-${index}`));
|
|
20529
|
+
}
|
|
20530
|
+
if (item.id === 'EXPAND') {
|
|
20531
|
+
return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false" }, `toolbar-top-${index}`));
|
|
20532
|
+
}
|
|
20533
|
+
if (item.id === 'COLUMN_CHOOSE') {
|
|
20534
|
+
return (jsxRuntime.jsx("div", { className: "r-toolbar-item cursor-pointer", "aria-disabled": "false", children: jsxRuntime.jsx(SvgSettings, { className: "me-1", fontSize: 20, color: "#7F7F7F" }) }, `toolbar-top-${index}`));
|
|
20535
|
+
}
|
|
20536
|
+
return (jsxRuntime.jsx("div", { className: "r-toolbar-item", "aria-disabled": "false", children: item.template?.() }, `toolbar-top-${index}`));
|
|
20537
|
+
};
|
|
20526
20538
|
|
|
20527
20539
|
const handleAdd = (dataSource, containerRef, indexFirstEdit,
|
|
20528
20540
|
/*eslint-disable*/
|
|
@@ -43652,7 +43664,7 @@ var css_248z$1 = ".react-resizable {\n position: relative;\n}\n.react-resizable
|
|
|
43652
43664
|
styleInject(css_248z$1);
|
|
43653
43665
|
|
|
43654
43666
|
const HeaderTableCol$1 = (props) => {
|
|
43655
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objHeaderWidthFixLeft, objHeaderWidthFixRight, totalCount, selectedRows, columns, orderBy, changeFilter, filterBy, changeOrder,
|
|
43667
|
+
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;
|
|
43656
43668
|
const { t } = reactI18next.useTranslation();
|
|
43657
43669
|
const headerRef = React$5.useRef(null);
|
|
43658
43670
|
const order = orderBy.find((item) => item.key === col.field);
|
|
@@ -43689,7 +43701,7 @@ const HeaderTableCol$1 = (props) => {
|
|
|
43689
43701
|
orderBy.push({ direction: 'asc', key: col.field });
|
|
43690
43702
|
changeOrder(orderBy);
|
|
43691
43703
|
}
|
|
43692
|
-
}, className: classNames$1('r-headercell-div', { 'cursor-pointer':
|
|
43704
|
+
}, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [col.field === 'checkbox' && (jsxRuntime.jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
|
|
43693
43705
|
if (selectEnable) {
|
|
43694
43706
|
if (e.target.checked) {
|
|
43695
43707
|
setSelectedRows(dataSource.map((item) => { return item; }));
|
|
@@ -43698,7 +43710,7 @@ const HeaderTableCol$1 = (props) => {
|
|
|
43698
43710
|
setSelectedRows([]);
|
|
43699
43711
|
}
|
|
43700
43712
|
}
|
|
43701
|
-
} })), col.field !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxRuntime.jsxs("div", { className: 'd-flex', children: [
|
|
43713
|
+
} })), col.field !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(herderContent) }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(herderContent) })] }), col.field !== '#' && col.field !== 'command' && jsxRuntime.jsxs("div", { className: 'd-flex', children: [allowSorting && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
|
|
43702
43714
|
setOpenFilter(!openFilter);
|
|
43703
43715
|
e.stopPropagation();
|
|
43704
43716
|
}, onClick: (e) => {
|
|
@@ -43784,7 +43796,7 @@ const RenderFilterElement$1 = ({ filter, optionsFilter, formatSetting, filterBy,
|
|
|
43784
43796
|
}, children: t('Clear') })] })] }));
|
|
43785
43797
|
};
|
|
43786
43798
|
|
|
43787
|
-
const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, visibleColumns, 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,
|
|
43799
|
+
const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, visibleColumns, 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 }) => {
|
|
43788
43800
|
let filteredData = dataSource.map((row, index) => ({ data: row, indexRow: index }));
|
|
43789
43801
|
if (((filterBy && filterBy.length > 0) || (searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm)) && !searchClient) {
|
|
43790
43802
|
filteredData = filteredData.filter(({ data }) => CheckRowMatch(data, filterBy, searchSetting?.searchTerm !== undefined ? searchSetting?.searchTerm : searchTerm, searchSetting?.keyField ?? []));
|
|
@@ -43819,7 +43831,7 @@ const TableComponent = ({ idTable, dataSource, contentColumns, headerColumns, vi
|
|
|
43819
43831
|
}, []);
|
|
43820
43832
|
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: visibleColumns }), jsxRuntime.jsx("thead", { className: "r-gridheader", role: "rowgroup", children: headerColumns.map((element, indexParent) => {
|
|
43821
43833
|
return (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: element?.map((col, index) => {
|
|
43822
|
-
return (jsxRuntime.jsx(HeaderTableCol$1, { 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,
|
|
43834
|
+
return (jsxRuntime.jsx(HeaderTableCol$1, { 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) => {
|
|
43823
43835
|
setFilterBy([...val]);
|
|
43824
43836
|
}, changeOrder: (val) => {
|
|
43825
43837
|
setOrderBy([...val]);
|
|
@@ -44546,7 +44558,7 @@ const ToolbarBottom = ({ handleAdd, handleDuplicate, handleInsertBefore, handleI
|
|
|
44546
44558
|
|
|
44547
44559
|
const TableEdit = React$5.forwardRef((props, ref) => {
|
|
44548
44560
|
const { t } = reactI18next.useTranslation();
|
|
44549
|
-
const { idTable, dataSource, columns, setDataSource, height = 400, rowHeight = 31.3, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn,
|
|
44561
|
+
const { idTable, dataSource, columns, setDataSource, height = 400, rowHeight = 31.3, defaultValue, toolbarSetting, searchSetting, selectedItem, selectEnable, editDisable, addDisable, buttonSetting, formatSetting, haveSum, isMulti, disableAutoKey, commandClick, dataSourceChange, rowChange, setSelectedItem, handleSelect, onDuplicate, saveSettingColumn, allowFiltering = true, allowSorting, settingColumns, optionsFilter, pagingSetting, resetDefaultColumns } = props;
|
|
44550
44562
|
React$5.useImperativeHandle(ref, () => {
|
|
44551
44563
|
return {
|
|
44552
44564
|
refeshFocusRow: handleRefeshRow
|
|
@@ -44951,7 +44963,7 @@ const TableEdit = React$5.forwardRef((props, ref) => {
|
|
|
44951
44963
|
}
|
|
44952
44964
|
}
|
|
44953
44965
|
};
|
|
44954
|
-
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, visibleColumns: visibleColumns, 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,
|
|
44966
|
+
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, visibleColumns: visibleColumns, 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: () => {
|
|
44955
44967
|
handleDuplicate(dataSource, startCell.row, fieldKey, defaultValue, fieldUniKey, changeDataSource, containerRef, totalCount, toolbarSetting, buttonSetting, editDisable, addDisable, onDuplicate);
|
|
44956
44968
|
}, setContentColumns: (newColumns) => {
|
|
44957
44969
|
setContentColumns(newColumns);
|
|
@@ -73380,15 +73392,9 @@ const TabsMenuComponent = ({ buttonWidth, tabParent, tabChild, resourceCodeParen
|
|
|
73380
73392
|
};
|
|
73381
73393
|
|
|
73382
73394
|
const RenderContentCol = (props) => {
|
|
73383
|
-
const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows,
|
|
73395
|
+
const { col, indexCol, indexRow, isSelected, row, formatSetting, idTable, fisrtObjWidthFixRight, lastObjWidthFixLeft, objWidthFixLeft, objWidthFixRight, selectedRows, selectEnable, setSelectedRows, fieldKey, isMulti } = props;
|
|
73384
73396
|
const RenderElement = () => {
|
|
73385
|
-
if (col.type === '
|
|
73386
|
-
return jsxRuntime.jsx("div", { className: "r-rowcell-div command", children: jsxRuntime.jsx(CommandElement, { commandItems: col.commandItems ?? [], handleCommandClick: handleCommandClick, indexRow: indexRow, rowData: row }) });
|
|
73387
|
-
}
|
|
73388
|
-
else if (col.type === '#' && !col.field) {
|
|
73389
|
-
jsxRuntime.jsx("div", { className: "r-rowcell-div", children: indexRow + 1 });
|
|
73390
|
-
}
|
|
73391
|
-
else if (col.type === 'checkbox' && !col.field) {
|
|
73397
|
+
if (col.type === 'checkbox' && !col.field) {
|
|
73392
73398
|
return (jsxRuntime.jsx("div", { className: "r-rowcell-div cursor-pointer", style: { alignItems: 'center' }, onClick: (e) => {
|
|
73393
73399
|
if (selectEnable) {
|
|
73394
73400
|
const index = selectedRows?.findIndex((x) => x[fieldKey] === row[fieldKey]);
|
|
@@ -73463,7 +73469,7 @@ const RenderContentCol = (props) => {
|
|
|
73463
73469
|
};
|
|
73464
73470
|
|
|
73465
73471
|
const HeaderTableCol = (props) => {
|
|
73466
|
-
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, columns, setColumns, orderBy, changeFilter, filterBy, changeOrder,
|
|
73472
|
+
const { selectEnable, dataSource, setSelectedRows, col, indexCol, indexParent, objWidthFixLeft, objWidthFixRight, totalCount, selectedRows, columns, setColumns, orderBy, changeFilter, filterBy, changeOrder, allowFiltering, allowSorting, container, fisrtObjWidthFixRight, lastObjWidthFixLeft, formatSetting, optionsFilter, idTable, isMulti } = props;
|
|
73467
73473
|
const { t } = reactI18next.useTranslation();
|
|
73468
73474
|
const headerRef = React$5.useRef(null);
|
|
73469
73475
|
const order = orderBy.find((item) => item.key === col.field);
|
|
@@ -73494,20 +73500,22 @@ const HeaderTableCol = (props) => {
|
|
|
73494
73500
|
left: col.fixedType === 'left' ? objWidthFixLeft[indexCol ?? 0] : undefined,
|
|
73495
73501
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol ?? 0] : undefined
|
|
73496
73502
|
}, children: jsxRuntime.jsxs("div", { style: { justifyContent: 'space-between' }, onClick: () => {
|
|
73497
|
-
if (
|
|
73498
|
-
if (order
|
|
73499
|
-
order.direction
|
|
73500
|
-
|
|
73503
|
+
if (!!allowSorting && (col.columns?.length ?? 0) === 0) {
|
|
73504
|
+
if (order) {
|
|
73505
|
+
if (order.direction === 'asc') {
|
|
73506
|
+
order.direction = 'desc';
|
|
73507
|
+
changeOrder(orderBy);
|
|
73508
|
+
}
|
|
73509
|
+
else {
|
|
73510
|
+
changeOrder(orderBy.filter((x) => x.key !== col.field));
|
|
73511
|
+
}
|
|
73501
73512
|
}
|
|
73502
73513
|
else {
|
|
73503
|
-
|
|
73514
|
+
orderBy.push({ direction: 'asc', key: col.field });
|
|
73515
|
+
changeOrder(orderBy);
|
|
73504
73516
|
}
|
|
73505
73517
|
}
|
|
73506
|
-
|
|
73507
|
-
orderBy.push({ direction: 'asc', key: col.field });
|
|
73508
|
-
changeOrder(orderBy);
|
|
73509
|
-
}
|
|
73510
|
-
}, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowOrder }), children: [(col.type === 'checkbox' && !col.field) && (jsxRuntime.jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
|
|
73518
|
+
}, className: classNames$1('r-headercell-div', { 'cursor-pointer': allowSorting }), children: [(col.type === 'checkbox' && !col.field) && (jsxRuntime.jsx(Input$1, { checked: !!(totalCount > 0 && selectedRows?.length >= totalCount), type: "checkbox", className: classNames$1('cursor-pointer', { 'd-none': !isMulti }), style: { textAlign: col.textAlign ?? 'left', marginTop: 6 }, onChange: (e) => {
|
|
73511
73519
|
if (selectEnable) {
|
|
73512
73520
|
if (e.target.checked) {
|
|
73513
73521
|
setSelectedRows(dataSource.map((item) => { return item; }));
|
|
@@ -73516,7 +73524,7 @@ const HeaderTableCol = (props) => {
|
|
|
73516
73524
|
setSelectedRows([]);
|
|
73517
73525
|
}
|
|
73518
73526
|
}
|
|
73519
|
-
} })), col.type !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }),
|
|
73527
|
+
} })), col.type !== 'checkbox' && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'header-content', style: { justifyContent: col.textAlign ?? 'left' }, children: [jsxRuntime.jsx("span", { id: `header-${idTable}-${indexParent}-${indexCol}`, ref: headerRef, className: 'text-content', children: t(col.headerText ?? '') }), checkOverflow() && jsxRuntime.jsx(UncontrolledTooltip, { className: "r-tooltip", autohide: false, target: `header-${idTable}-${indexParent}-${indexCol}`, children: t(col.headerText ?? '') })] }), jsxRuntime.jsxs("div", { className: 'd-flex align-items-center', children: [allowSorting && order?.direction === 'asc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_6)", children: jsxRuntime.jsx("path", { d: "M8.70711 0.292893C8.31658 -0.0976311 7.68342 -0.0976311 7.29289 0.292893L0.928932 6.65685C0.538408 7.04738 0.538408 7.68054 0.928932 8.07107C1.31946 8.46159 1.95262 8.46159 2.34315 8.07107L8 2.41421L13.6569 8.07107C14.0474 8.46159 14.6805 8.46159 15.0711 8.07107C15.4616 7.68054 15.4616 7.04738 15.0711 6.65685L8.70711 0.292893ZM8 18H9L9 1H8H7L7 18H8Z", fill: "black" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_6", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowSorting && order?.direction === 'desc' && jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", className: 'ms-25', width: "10", height: "10", viewBox: "0 0 16 18", fill: "none", children: [jsxRuntime.jsx("g", { "clip-path": "url(#clip0_520_2)", children: jsxRuntime.jsx("path", { d: "M7.29289 17.7071C7.68342 18.0976 8.31658 18.0976 8.70711 17.7071L15.0711 11.3431C15.4616 10.9526 15.4616 10.3195 15.0711 9.92893C14.6805 9.53841 14.0474 9.53841 13.6569 9.92893L8 15.5858L2.34315 9.92893C1.95262 9.53841 1.31946 9.53841 0.928932 9.92893C0.538408 10.3195 0.538408 10.9526 0.928932 11.3431L7.29289 17.7071ZM8 0L7 0L7 17H8H9L9 0L8 0Z", fill: "black" }) }), jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("clipPath", { id: "clip0_520_2", children: jsxRuntime.jsx("rect", { width: "16", height: "18", fill: "white" }) }) })] }), allowFiltering && (col.columns?.length ?? 0) === 0 && col.allowFilter !== false && jsxRuntime.jsxs(Dropdown$1, { isOpen: openFilter, toggle: (e) => {
|
|
73520
73528
|
setOpenFilter(!openFilter);
|
|
73521
73529
|
e.stopPropagation();
|
|
73522
73530
|
}, onClick: (e) => {
|
|
@@ -73604,18 +73612,15 @@ const RenderFilterElement = ({ filter, optionsFilter, formatSetting, filterBy, s
|
|
|
73604
73612
|
}, children: t('Clear') })] })] }));
|
|
73605
73613
|
};
|
|
73606
73614
|
|
|
73607
|
-
const TableView = ({ idTable, dataSource,
|
|
73615
|
+
const TableView = ({ idTable, dataSource, height = 400, columns, isMutil = false, isLoading, selectEnable, formatSetting, querySetting, setColumns, pagingSetting, searchSetting, columnsAggregate, toolbarSetting, selectedItem, setSelectedItem, handleSelect, saveSettingColumn, resetDefaultColumns, settingColumns, headerComponent }) => {
|
|
73608
73616
|
const { t } = reactI18next.useTranslation();
|
|
73609
73617
|
const gridRef = React$5.useRef(null);
|
|
73618
|
+
const [openPopupSetupColumn, setOpenPopupSetupColumn] = React$5.useState(false);
|
|
73610
73619
|
const [selectedRows, setSelectedRows] = React$5.useState([]);
|
|
73611
73620
|
const [orderBy, setOrderBy] = React$5.useState([]);
|
|
73612
73621
|
const [filterBy, setFilterBy] = React$5.useState([]);
|
|
73613
73622
|
const [searchTerm, setSearchTerm] = React$5.useState('');
|
|
73614
73623
|
const fieldKey = (columns.find((item) => item.isPrimarykey === true)?.field) ?? 'id';
|
|
73615
|
-
const [startIndex, setStartIndex] = React$5.useState(0);
|
|
73616
|
-
//trường liên quan đến virtul loading
|
|
73617
|
-
const buffer = 10; // số dòng dự phòng phía trên và dưới
|
|
73618
|
-
const visibleRowCount = Math.ceil(height / rowHeight) + 5;
|
|
73619
73624
|
// 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
|
|
73620
73625
|
const viewData = React$5.useMemo(() => {
|
|
73621
73626
|
if (!dataSource || dataSource.length === 0) {
|
|
@@ -73629,7 +73634,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73629
73634
|
});
|
|
73630
73635
|
});
|
|
73631
73636
|
}
|
|
73632
|
-
if (filterBy && filterBy.length > 0) {
|
|
73637
|
+
if (querySetting?.client === true && filterBy && filterBy.length > 0) {
|
|
73633
73638
|
datas = datas.filter((row) => {
|
|
73634
73639
|
return filterBy.every((filter) => {
|
|
73635
73640
|
const { key, value, ope } = filter;
|
|
@@ -73666,7 +73671,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73666
73671
|
});
|
|
73667
73672
|
});
|
|
73668
73673
|
}
|
|
73669
|
-
if (orderBy && orderBy.length > 0) {
|
|
73674
|
+
if (querySetting?.client === true && orderBy && orderBy.length > 0) {
|
|
73670
73675
|
datas = datas.sort((a, b) => {
|
|
73671
73676
|
for (const order of orderBy) {
|
|
73672
73677
|
const { key, direction } = order;
|
|
@@ -73684,50 +73689,7 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73684
73689
|
}
|
|
73685
73690
|
return datas;
|
|
73686
73691
|
}, [searchTerm, filterBy, orderBy, dataSource]);
|
|
73687
|
-
// Tính toán chỉ số bắt đầu và kết thúc của dữ liệu hiển thị
|
|
73688
|
-
const { adjustedStartIndex, adjustedEndIndex } = React$5.useMemo(() => {
|
|
73689
|
-
if (!viewData || viewData.length === 0 || !isVirtualList) {
|
|
73690
|
-
return { adjustedStartIndex: 0, adjustedEndIndex: 0 };
|
|
73691
|
-
}
|
|
73692
|
-
return {
|
|
73693
|
-
adjustedStartIndex: Math.max(startIndex - buffer, 0),
|
|
73694
|
-
adjustedEndIndex: Math.min(startIndex + visibleRowCount + buffer, dataSource.length)
|
|
73695
|
-
};
|
|
73696
|
-
}, [startIndex, viewData]);
|
|
73697
|
-
const visibleData = React$5.useMemo(() => {
|
|
73698
|
-
if (!viewData || viewData.length === 0) {
|
|
73699
|
-
return [];
|
|
73700
|
-
}
|
|
73701
|
-
return isVirtualList ? viewData.slice(adjustedStartIndex, adjustedEndIndex) : viewData;
|
|
73702
|
-
}, [viewData]);
|
|
73703
73692
|
const { levels: headerColumns, flat: contentColumns, flatVisble, objWidthFixLeft, objWidthFixRight, lastObjWidthFixLeft, fisrtObjWidthFixRight } = React$5.useMemo(() => calculateTableStructure(columns), [columns]);
|
|
73704
|
-
const scrollTimeoutRef = React$5.useRef(null);
|
|
73705
|
-
const lastScrollTop = React$5.useRef(0);
|
|
73706
|
-
const handleScroll = (e) => {
|
|
73707
|
-
if (!gridRef.current || !isVirtualList) {
|
|
73708
|
-
return;
|
|
73709
|
-
}
|
|
73710
|
-
// Nếu không có sự thay đổi về scrollTop => người dùng chỉ scroll ngang => không xử lý
|
|
73711
|
-
if (e.target.scrollTop === lastScrollTop.current) {
|
|
73712
|
-
return;
|
|
73713
|
-
}
|
|
73714
|
-
lastScrollTop.current = e.target.scrollTop;
|
|
73715
|
-
if (scrollTimeoutRef.current !== null) {
|
|
73716
|
-
cancelAnimationFrame(scrollTimeoutRef.current);
|
|
73717
|
-
}
|
|
73718
|
-
scrollTimeoutRef.current = requestAnimationFrame(() => {
|
|
73719
|
-
const scrollTop = gridRef.current.scrollTop;
|
|
73720
|
-
const newStartIndex = Math.floor(scrollTop / rowHeight);
|
|
73721
|
-
if (newStartIndex !== startIndex) {
|
|
73722
|
-
setStartIndex(newStartIndex);
|
|
73723
|
-
}
|
|
73724
|
-
});
|
|
73725
|
-
};
|
|
73726
|
-
const handleCommandClick = (id, rowData, index) => {
|
|
73727
|
-
if (commandClick) {
|
|
73728
|
-
commandClick({ id, rowData, index });
|
|
73729
|
-
}
|
|
73730
|
-
};
|
|
73731
73693
|
const handleKeyPress = (e) => {
|
|
73732
73694
|
if ((e.code === 'Enter' || e.code === 'NumpadEnter')) {
|
|
73733
73695
|
if (searchSetting?.setSearchTerm) {
|
|
@@ -73816,21 +73778,20 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73816
73778
|
}
|
|
73817
73779
|
}
|
|
73818
73780
|
}, [selectedItem]);
|
|
73819
|
-
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 }), jsxRuntime.jsxs("div", { ref: gridRef, className: "r-gridtable",
|
|
73781
|
+
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: flatVisble }), jsxRuntime.jsx("thead", { className: 'r-gridheader', role: "rowgroup", children: headerColumns.map((rowColumn, indexParent) => (jsxRuntime.jsx("tr", { className: "r-row", role: "row", children: rowColumn.map((column, indexColumn) => (jsxRuntime.jsx(HeaderTableCol, { idTable: idTable, col: column, dataSource: dataSource, indexCol: indexColumn, indexParent: indexParent, isMulti: isMutil ?? false, selectEnable: selectEnable ?? false, selectedRows: selectedRows, setSelectedRows: setSelectedRows, columns: contentColumns, setColumns: setColumns, objWidthFixLeft: objWidthFixLeft, objWidthFixRight: objWidthFixRight, fisrtObjWidthFixRight: fisrtObjWidthFixRight, lastObjWidthFixLeft: lastObjWidthFixLeft, orderBy: orderBy, allowFiltering: querySetting?.allowFiltering, allowSorting: querySetting?.allowSorting, filterBy: filterBy, optionsFilter: querySetting?.optionsFilter, changeFilter: (val) => {
|
|
73820
73782
|
setFilterBy([...val]);
|
|
73821
|
-
if (changeFilter) {
|
|
73822
|
-
changeFilter(val);
|
|
73783
|
+
if (querySetting?.changeFilter) {
|
|
73784
|
+
querySetting.changeFilter(val);
|
|
73823
73785
|
}
|
|
73824
73786
|
}, changeOrder: (val) => {
|
|
73825
73787
|
setOrderBy([...val]);
|
|
73826
|
-
if (changeOrder) {
|
|
73827
|
-
changeOrder(val);
|
|
73788
|
+
if (querySetting?.changeOrder) {
|
|
73789
|
+
querySetting.changeOrder(val);
|
|
73828
73790
|
}
|
|
73829
|
-
}, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxRuntime.
|
|
73830
|
-
|
|
73831
|
-
|
|
73832
|
-
|
|
73833
|
-
}), adjustedEndIndex > 0 && viewData.length > adjustedEndIndex && (jsxRuntime.jsx("tr", { style: { height: (viewData.length - adjustedEndIndex) * rowHeight }, children: jsxRuntime.jsx("td", { style: { padding: 0 }, colSpan: flatVisble.length }) }))] }), viewData.length > 0 && jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
|
|
73791
|
+
}, container: gridRef, totalCount: dataSource.length }, `header-${indexParent}-${indexColumn}`))) }, `header-${-indexParent}`))) }), jsxRuntime.jsx("tbody", { className: 'r-gridcontent', role: "rowgroup", children: viewData.map((row, indexRow) => {
|
|
73792
|
+
const isSelected = selectedRows?.some((x) => x[fieldKey] === row[fieldKey]);
|
|
73793
|
+
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 }, indexCol))) }, `row-content-${indexRow}`));
|
|
73794
|
+
}) }), viewData.length > 0 && jsxRuntime.jsx("tfoot", { className: "r-gridfoot", children: (columnsAggregate?.length ?? 0) > 0 ? jsxRuntime.jsx("tr", { className: 'r-row', children: contentColumns.map((col, indexCol) => {
|
|
73834
73795
|
const item = columnsAggregate?.find((x) => x.field === col.field);
|
|
73835
73796
|
let sumValue = item?.value;
|
|
73836
73797
|
if (!item && col.haveSum === true && col.type === "numeric") {
|
|
@@ -73841,7 +73802,13 @@ const TableView = ({ idTable, dataSource, rowHeight = 33, height = 400, columns,
|
|
|
73841
73802
|
right: col.fixedType === 'right' ? objWidthFixRight[indexCol] : undefined,
|
|
73842
73803
|
textAlign: col.textAlign ? col.textAlign : 'left'
|
|
73843
73804
|
}, 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}`);
|
|
73844
|
-
}) }) : 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
|
|
73805
|
+
}) }) : 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?.totalItem ?? 0, onChangePageSize: onChangePageSize }), jsxRuntime.jsx(SettingColumn, { gridRef: gridRef, handleSidebar: () => {
|
|
73806
|
+
setOpenPopupSetupColumn(!openPopupSetupColumn);
|
|
73807
|
+
}, settingColumns: settingColumns, openSidebar: openPopupSetupColumn, column: [...contentColumns], resetDefaultColumns: resetDefaultColumns, setColumn: (newColumns) => {
|
|
73808
|
+
if (saveSettingColumn) {
|
|
73809
|
+
saveSettingColumn(newColumns.map((x, index) => ({ field: x.field, headerText: x.headerDisplay, visible: x.visible, fixedType: x.fixedType, width: x.width, sortOrder: index + 1 })));
|
|
73810
|
+
}
|
|
73811
|
+
} })] }));
|
|
73845
73812
|
};
|
|
73846
73813
|
|
|
73847
73814
|
exports.CheckRowMatch = CheckRowMatch;
|