es-grid-template 1.8.57 → 1.8.58
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/es/grid-component/InternalTable.js +12 -5
- package/es/grid-component/TableGrid.js +2 -2
- package/es/grid-component/hooks/useColumns.d.ts +3 -1
- package/es/grid-component/hooks/useColumns.js +2 -1
- package/es/grid-component/hooks/utils.d.ts +1 -1
- package/es/grid-component/hooks/utils.js +4 -9
- package/es/grid-component/type.d.ts +6 -1
- package/es/table-component/InternalTable.js +0 -5
- package/es/table-component/TableContainer.js +4 -11
- package/es/table-component/body/TableBodyCell.js +6 -4
- package/es/table-component/footer/TableFooterCell.js +0 -4
- package/es/table-component/style.d.ts +22 -0
- package/es/table-component/style.js +48 -0
- package/es/table-component/style.scss +28 -67
- package/es/table-component/table/Grid.js +14 -7
- package/es/table-component/type.d.ts +6 -1
- package/lib/grid-component/InternalTable.js +11 -5
- package/lib/grid-component/TableGrid.js +2 -2
- package/lib/grid-component/hooks/useColumns.js +2 -1
- package/lib/grid-component/hooks/utils.d.ts +1 -1
- package/lib/grid-component/hooks/utils.js +4 -9
- package/lib/grid-component/type.d.ts +6 -1
- package/lib/table-component/InternalTable.js +0 -6
- package/lib/table-component/TableContainer.js +4 -14
- package/lib/table-component/body/TableBodyCell.js +6 -4
- package/lib/table-component/footer/TableFooterCell.js +0 -6
- package/lib/table-component/style.d.ts +22 -0
- package/lib/table-component/style.js +55 -0
- package/lib/table-component/style.scss +28 -67
- package/lib/table-component/table/Grid.js +14 -7
- package/lib/table-component/type.d.ts +6 -1
- package/package.json +1 -1
|
@@ -8,7 +8,10 @@ updateOrInsert } from "./hooks";
|
|
|
8
8
|
import dayjs from "dayjs";
|
|
9
9
|
import 'dayjs/locale/es';
|
|
10
10
|
import 'dayjs/locale/vi';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// import GridEdit from "./table/GridEdit"
|
|
13
|
+
// import InfiniteTable from "./table/InfiniteTable";
|
|
14
|
+
|
|
12
15
|
import Grid from "./table/Grid";
|
|
13
16
|
import en from "rc-master-ui/es/date-picker/locale/en_US";
|
|
14
17
|
import vi from "rc-master-ui/es/date-picker/locale/vi_VN";
|
|
@@ -37,7 +40,6 @@ import { arrayMove, horizontalListSortingStrategy, SortableContext, useSortable
|
|
|
37
40
|
// import {CSS} from "@dnd-kit/utilities";
|
|
38
41
|
import { Resizable } from "react-resizable";
|
|
39
42
|
import { faker } from "@faker-js/faker";
|
|
40
|
-
import InfiniteTable from "./table/InfiniteTable";
|
|
41
43
|
import useMergedState from "rc-util/es/hooks/useMergedState";
|
|
42
44
|
import Modal from 'antd/es/modal/Modal';
|
|
43
45
|
dayjs.extend(customParseFormat);
|
|
@@ -186,6 +188,7 @@ const InternalTable = props => {
|
|
|
186
188
|
onFilter,
|
|
187
189
|
onSorter,
|
|
188
190
|
defaultSorter,
|
|
191
|
+
toolbarItems,
|
|
189
192
|
...rest
|
|
190
193
|
} = props;
|
|
191
194
|
const id = React.useMemo(() => {
|
|
@@ -293,7 +296,7 @@ const InternalTable = props => {
|
|
|
293
296
|
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (header ? header.offsetHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? summaryE.offsetHeight : 0) - (scrollbar ? scrollbar.offsetHeight : 0);
|
|
294
297
|
setHeight1(hhh > 0 ? hhh : 0);
|
|
295
298
|
}
|
|
296
|
-
}, [id, isFullScreen, windowSize.innerHeight]);
|
|
299
|
+
}, [id, isFullScreen, windowSize.innerHeight, toolbarItems]);
|
|
297
300
|
const tableRef = React.useRef(null);
|
|
298
301
|
React.useEffect(() => {
|
|
299
302
|
setColumns(propsColumns);
|
|
@@ -442,7 +445,8 @@ const InternalTable = props => {
|
|
|
442
445
|
wrapSettings: wrapSettings
|
|
443
446
|
})),
|
|
444
447
|
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
445
|
-
ellipsis: column.ellipsis !== false
|
|
448
|
+
ellipsis: column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
449
|
+
// ellipsis: false,
|
|
446
450
|
// ellipsis: column.ellipsis !== false,
|
|
447
451
|
|
|
448
452
|
align: column.textAlign ?? column.align,
|
|
@@ -910,7 +914,9 @@ const InternalTable = props => {
|
|
|
910
914
|
const handleFullScreen = () => {
|
|
911
915
|
setIsFullScreen(!isFullScreen);
|
|
912
916
|
};
|
|
913
|
-
|
|
917
|
+
|
|
918
|
+
// const TableComponent = infiniteScroll ? InfiniteTable : (groupAble ? Group : editAble ? GridEdit : Grid)
|
|
919
|
+
const TableComponent = groupAble ? Group : Grid;
|
|
914
920
|
return /*#__PURE__*/React.createElement(Fragment, null, true && /*#__PURE__*/React.createElement(DndContext, {
|
|
915
921
|
sensors: sensors,
|
|
916
922
|
modifiers: [restrictToHorizontalAxis],
|
|
@@ -1069,6 +1075,7 @@ const InternalTable = props => {
|
|
|
1069
1075
|
commandClick: triggerCommandClick,
|
|
1070
1076
|
summary: summary,
|
|
1071
1077
|
pagination: pagination,
|
|
1078
|
+
toolbarItems: toolbarItems,
|
|
1072
1079
|
scroll: scrollHeight1 - (summary ? 1 : 1) < 0 ? {
|
|
1073
1080
|
y: 500
|
|
1074
1081
|
} : {
|
|
@@ -62,7 +62,7 @@ const TableGrid = props => {
|
|
|
62
62
|
rowHoverable,
|
|
63
63
|
title,
|
|
64
64
|
format,
|
|
65
|
-
virtual = true,
|
|
65
|
+
// virtual = true,
|
|
66
66
|
t,
|
|
67
67
|
lang,
|
|
68
68
|
contextMenuOpen,
|
|
@@ -322,7 +322,7 @@ const TableGrid = props => {
|
|
|
322
322
|
'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
|
|
323
323
|
}, styles.customTable),
|
|
324
324
|
bordered: true,
|
|
325
|
-
virtual:
|
|
325
|
+
virtual: true,
|
|
326
326
|
columns: columns,
|
|
327
327
|
rowKey: rowKey,
|
|
328
328
|
rowHoverable: rowHoverable,
|
|
@@ -15,5 +15,7 @@ interface UseColumnsConfig<RecordType> {
|
|
|
15
15
|
rowKey?: any;
|
|
16
16
|
onMouseHover?: any;
|
|
17
17
|
}
|
|
18
|
-
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
|
|
18
|
+
declare const useColumns: <RecordType extends AnyObject = AnyObject>(config: UseColumnsConfig<RecordType>) => readonly [
|
|
19
|
+
any
|
|
20
|
+
];
|
|
19
21
|
export default useColumns;
|
|
@@ -80,7 +80,8 @@ const useColumns = config => {
|
|
|
80
80
|
const type = getTypeFilter(column);
|
|
81
81
|
// const operatorOptions = !type || type === 'Text' ? stringOperator : numberOperator
|
|
82
82
|
// const operatorOptions = type === 'Checkbox' || type === 'Dropdown' || type === 'DropTree' || ty
|
|
83
|
-
const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator
|
|
83
|
+
// const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : (!type || type === 'Text' ? stringOperator : numberOperator)
|
|
84
|
+
const operatorOptions = ['Checkbox', 'Dropdown', 'DropTree', 'CheckboxDropdown'].includes(type) ? booleanOperator : !type || type === 'Text' ? stringOperator : numberOperator;
|
|
84
85
|
return /*#__PURE__*/React.createElement("div", {
|
|
85
86
|
style: {
|
|
86
87
|
padding: 8,
|
|
@@ -160,7 +160,7 @@ export declare const showDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
|
160
160
|
export declare const hideDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
161
161
|
export declare const isRangeCell: (selectedCells: any, type: string, rowIndex: number, colIndex: number) => boolean;
|
|
162
162
|
export declare const isSelectedCell: (selectedCells: any, rowIndex: number, colIndex: number) => any;
|
|
163
|
-
export declare function groupArrayByColumns(
|
|
163
|
+
export declare function groupArrayByColumns(data: any[], columns: string[] | undefined): any;
|
|
164
164
|
export declare const isFormattedNumber: (str: string) => boolean;
|
|
165
165
|
export declare const detectSeparators: (str: string) => {
|
|
166
166
|
thousandSeparator: string;
|
|
@@ -2341,13 +2341,13 @@ export const isSelectedCell = (selectedCells, rowIndex, colIndex) => {
|
|
|
2341
2341
|
const key = `${rowIndex}-${colIndex}`;
|
|
2342
2342
|
return selectedCells.has(key);
|
|
2343
2343
|
};
|
|
2344
|
-
export function groupArrayByColumns(
|
|
2344
|
+
export function groupArrayByColumns(data, columns) {
|
|
2345
2345
|
const result = [];
|
|
2346
2346
|
const checkEmpty = d => {
|
|
2347
2347
|
return d === null || d === undefined || d === '';
|
|
2348
2348
|
};
|
|
2349
2349
|
if (columns) {
|
|
2350
|
-
|
|
2350
|
+
data.forEach(item => {
|
|
2351
2351
|
let currentLevel = result;
|
|
2352
2352
|
columns.forEach((column, index) => {
|
|
2353
2353
|
const value = item[column];
|
|
@@ -2355,15 +2355,12 @@ export function groupArrayByColumns(arr, columns) {
|
|
|
2355
2355
|
if (existingItem) {
|
|
2356
2356
|
currentLevel = existingItem.children;
|
|
2357
2357
|
} else {
|
|
2358
|
-
// const newItem = {[column]: value, field: column, rowId: !isEmpty(value) ? (value) : newGuid(), parentId: !isEmpty(item[columns[index - 1]]) ? (item[columns[index - 1]]) : null, indent: index, children: [] }
|
|
2359
2358
|
const newItem = {
|
|
2360
2359
|
[column]: value,
|
|
2361
2360
|
field: column,
|
|
2362
2361
|
rowId: newGuid(),
|
|
2363
|
-
// rowId: item[column],
|
|
2364
2362
|
parentId: !isEmpty(item[columns[index - 1]]) ? item[columns[index - 1]] : null,
|
|
2365
|
-
//
|
|
2366
|
-
// indent: index,
|
|
2363
|
+
// tự tính tổng rồi điền thuộc tính vào
|
|
2367
2364
|
children: []
|
|
2368
2365
|
};
|
|
2369
2366
|
currentLevel.push(newItem);
|
|
@@ -2374,13 +2371,11 @@ export function groupArrayByColumns(arr, columns) {
|
|
|
2374
2371
|
...item,
|
|
2375
2372
|
rowId: item.id ?? item.rowId,
|
|
2376
2373
|
parentId: !checkEmpty(columns[columns.length - 1]) ? item[columns[columns.length - 1]] : null
|
|
2377
|
-
// parentId: item.rowId[columns.length - 1],
|
|
2378
|
-
// indent: columns.length
|
|
2379
2374
|
});
|
|
2380
2375
|
});
|
|
2381
2376
|
return result;
|
|
2382
2377
|
} else {
|
|
2383
|
-
return
|
|
2378
|
+
return data;
|
|
2384
2379
|
}
|
|
2385
2380
|
}
|
|
2386
2381
|
export const isFormattedNumber = str => {
|
|
@@ -136,6 +136,7 @@ export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>,
|
|
|
136
136
|
editFromSettings?: IEditFromSettings;
|
|
137
137
|
fixedType?: FixedType;
|
|
138
138
|
headerTextWrap?: boolean;
|
|
139
|
+
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
139
140
|
onCellStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Cell<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
140
141
|
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
141
142
|
onCellFooterStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
@@ -197,7 +198,11 @@ export type Sort = {
|
|
|
197
198
|
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary' | 'pagination' | 'locale'> {
|
|
198
199
|
editAble?: boolean;
|
|
199
200
|
infiniteScroll?: boolean;
|
|
200
|
-
theme?:
|
|
201
|
+
theme?: {
|
|
202
|
+
theme?: 'dark' | 'light';
|
|
203
|
+
backgroundColor?: string;
|
|
204
|
+
color?: string;
|
|
205
|
+
};
|
|
201
206
|
next?: () => void;
|
|
202
207
|
locale?: Locale;
|
|
203
208
|
groupAble?: boolean;
|
|
@@ -34,14 +34,9 @@ import { addRowIdArray, convertFlatColumn1, convertToObj, convertToObjTrue,
|
|
|
34
34
|
filterDataByColumns, findAllChildrenKeys2, flatColumns2,
|
|
35
35
|
// filterDataByColumns,
|
|
36
36
|
getAllRowKey, getDiffent2Array, getFixedFields, getInvisibleColumns, groupArrayByColumns, isTreeArray, updateWidthsByOther } from "./hook/utils";
|
|
37
|
-
// import GridEdit from './table/GridEdit'
|
|
38
37
|
import { convertToTanStackColumns } from "./hook/useColumns";
|
|
39
38
|
import { convertColumns } from "./hook/convert";
|
|
40
39
|
import { removeInvisibleColumns } from "../grid-component/hooks";
|
|
41
|
-
// import { Modal } from 'antd'
|
|
42
|
-
// import { findAllChildrenKeys2 } from '../grid-component/hooks'
|
|
43
|
-
// import { columns111 } from '../test-2/columns'
|
|
44
|
-
|
|
45
40
|
dayjs.extend(customParseFormat);
|
|
46
41
|
|
|
47
42
|
// const MySwal = withReactContent(Swal)
|
|
@@ -1,23 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
// import type { Dispatch, SetStateAction } from "react";
|
|
3
|
-
|
|
4
2
|
import React from 'react';
|
|
5
|
-
// import TableHead from './header/TableHead'
|
|
6
|
-
// import { sumSize } from './hook/utils'
|
|
7
|
-
|
|
8
|
-
// import { useVirtualizer } from '@tanstack/react-virtual'
|
|
9
|
-
|
|
10
3
|
import classNames from 'classnames';
|
|
11
|
-
// import TableBody from './body/TableBody'
|
|
12
4
|
import { TableContext } from "./useContext";
|
|
13
5
|
import Pagination from 'rc-master-ui/es/pagination';
|
|
14
6
|
import { Toolbar } from 'rc-master-ui';
|
|
15
7
|
import { Maximize, Minimize } from 'becoxy-icons';
|
|
16
8
|
import { ColumnsChoose } from "./ColumnsChoose";
|
|
17
|
-
// import TableFooter from './footer/TableFooter'
|
|
18
|
-
// import TableBody from './body/TableBody'
|
|
19
9
|
import { numericFormatter } from 'react-numeric-component';
|
|
20
|
-
// import ComponentSpinner from '../grid-component/LoadingSpinner'
|
|
21
10
|
import TableWrapper from "./table/TableWrapper";
|
|
22
11
|
import { getTableHeight, sumSize, updateColumnWidthsRecursive } from "./hook/utils";
|
|
23
12
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
@@ -99,6 +88,10 @@ const TableContainer = props => {
|
|
|
99
88
|
React.useEffect(() => {
|
|
100
89
|
const handleClickOutside = () => {
|
|
101
90
|
setFocusedCell(undefined);
|
|
91
|
+
setIsSelectionChange(prev => ({
|
|
92
|
+
...prev,
|
|
93
|
+
isChange: false
|
|
94
|
+
}));
|
|
102
95
|
};
|
|
103
96
|
document.addEventListener('mousedown', handleClickOutside);
|
|
104
97
|
return () => {
|
|
@@ -181,6 +181,7 @@ const TableBodyCell = props => {
|
|
|
181
181
|
const isPinned = cell.column.getIsPinned();
|
|
182
182
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
183
183
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
184
|
+
const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
|
|
184
185
|
|
|
185
186
|
// const selectRowIds = React.useMemo(() => {
|
|
186
187
|
|
|
@@ -423,16 +424,17 @@ const TableBodyCell = props => {
|
|
|
423
424
|
// })
|
|
424
425
|
// }
|
|
425
426
|
}
|
|
426
|
-
}
|
|
427
|
-
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// onKeyUp={() => {
|
|
428
430
|
|
|
429
|
-
//
|
|
431
|
+
// }}
|
|
430
432
|
,
|
|
431
433
|
|
|
432
434
|
onClick: e => {
|
|
433
435
|
const selection = window.getSelection();
|
|
434
436
|
const text = selection ? selection.toString() : "";
|
|
435
|
-
if (text.length > 0) {} else {
|
|
437
|
+
if (text.length > 0 || enableClick === false) {} else {
|
|
436
438
|
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
437
439
|
toggleRowSelection({
|
|
438
440
|
e,
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
// import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
2
1
|
import React, { useContext } from "react";
|
|
3
|
-
// import type { Person } from "../makeData";
|
|
4
2
|
import { checkDecimalSeparator, checkThousandSeparator, getCommonPinningStyles, getFormat, isEmpty } from "../hook/utils";
|
|
5
3
|
import { TableContext } from "../useContext";
|
|
6
4
|
import classNames from "classnames";
|
|
7
5
|
import { sumByField } from "../../grid-component/hooks";
|
|
8
6
|
import { numericFormatter } from "react-numeric-component";
|
|
9
|
-
// import type { Person } from "../../tanstack-table/makeData";
|
|
10
|
-
|
|
11
7
|
const TableFooterCell = ({
|
|
12
8
|
column
|
|
13
9
|
}) => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type GridProps = {
|
|
3
|
+
$theme: {
|
|
4
|
+
theme?: 'light' | 'dark';
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
$prefix: string;
|
|
9
|
+
$borderColor?: string;
|
|
10
|
+
$cellFontSize?: number;
|
|
11
|
+
$cellPaddingInline?: number;
|
|
12
|
+
$cellPaddingBlock?: number;
|
|
13
|
+
$headerBg?: string;
|
|
14
|
+
$headerColor?: string;
|
|
15
|
+
$footerBg?: string;
|
|
16
|
+
$footerColor?: string;
|
|
17
|
+
$rowHoverBg?: string;
|
|
18
|
+
$rowSelectedBg?: string;
|
|
19
|
+
$rowSelectedHoverBg?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
// const prefix = "ui-rc";
|
|
3
|
+
// const antdPrefix = "ant";
|
|
4
|
+
// const fontFamily = "Montserrat, Helvetica, Arial, serif ";
|
|
5
|
+
// const borderRadius = "6px";
|
|
6
|
+
|
|
7
|
+
// const boxShadowColor = "rgba(220, 0, 0, 0.09)";
|
|
8
|
+
const color = "#000000de";
|
|
9
|
+
const BgColor = "#ffffff ";
|
|
10
|
+
|
|
11
|
+
// const primary = "#eb4619";
|
|
12
|
+
|
|
13
|
+
// const rowHoverBg = "#FBDED6";
|
|
14
|
+
// const rowSelectedBg = "#FEF2EF";
|
|
15
|
+
|
|
16
|
+
const tableBorderColor = "#e0e0e0";
|
|
17
|
+
|
|
18
|
+
// const borderSelectedColor = "#0550C5";
|
|
19
|
+
// const cellSelectedBg = "#F3F8FF";
|
|
20
|
+
// const cellIndexSelectedBg = "#1869E6";
|
|
21
|
+
// const cellIndexFocusBg = "#E6EFFD";
|
|
22
|
+
|
|
23
|
+
// 404071
|
|
24
|
+
|
|
25
|
+
// dark
|
|
26
|
+
const tableBorderColorDark = "#44485E";
|
|
27
|
+
|
|
28
|
+
// const rowHoverBgDark = "#404071 ";
|
|
29
|
+
|
|
30
|
+
// const rowSelectedBgDark = "#25293C";
|
|
31
|
+
|
|
32
|
+
// const borderSelectedColorDark = "#538ff1 ";
|
|
33
|
+
// const cellIndexSelectedBgDark = "#1869E6 ";
|
|
34
|
+
|
|
35
|
+
// const bodyColorDark = "#343e59";
|
|
36
|
+
|
|
37
|
+
const BgColorDark = "#343e59 ";
|
|
38
|
+
const colorDark = "#e6e4f3e6 ";
|
|
39
|
+
|
|
40
|
+
// const cellSelectedBgDark = " #F3F8FF ";
|
|
41
|
+
// const cellIndexFocusBgDark = "#E6EFFD ";
|
|
42
|
+
|
|
43
|
+
/* height: const {props => (props.const heightTable ? `const {props.const heightTable}px` : undefined)}; */
|
|
44
|
+
|
|
45
|
+
export const GridStyle = styled.div.withConfig({
|
|
46
|
+
displayName: "GridStyle",
|
|
47
|
+
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
48
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -27,7 +27,7 @@ $rowSelectedBg-Dark: #25293C !default;
|
|
|
27
27
|
$border-selected-color-Dark: #538ff1 !default;
|
|
28
28
|
$cell-index-selected-bg-Dark: #1869E6 !default;
|
|
29
29
|
|
|
30
|
-
$body-color-Dark: #
|
|
30
|
+
$body-color-Dark: #343e59 !default;
|
|
31
31
|
|
|
32
32
|
$cell-selected-bg-Dark: #F3F8FF !default;
|
|
33
33
|
$cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
@@ -46,6 +46,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
46
46
|
// border: 1px solid $tableBorderColor;
|
|
47
47
|
|
|
48
48
|
color: #000000de;
|
|
49
|
+
background-color: #ffffff;
|
|
49
50
|
|
|
50
51
|
font-size: 14px;
|
|
51
52
|
|
|
@@ -59,22 +60,20 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
59
60
|
|
|
60
61
|
.#{$prefix}-grid-container {
|
|
61
62
|
|
|
62
|
-
border: 1px solid $tableBorderColor;
|
|
63
|
-
// border-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
z-index: 1;
|
|
77
|
-
}
|
|
63
|
+
// border: 1px solid $tableBorderColor;
|
|
64
|
+
// border-right: 0;
|
|
65
|
+
// font-size: 13px;
|
|
66
|
+
|
|
67
|
+
// &::after {
|
|
68
|
+
// content: "";
|
|
69
|
+
// position: absolute;
|
|
70
|
+
// top: 0px;
|
|
71
|
+
// right: 0;
|
|
72
|
+
// height: 100%;
|
|
73
|
+
// border-right: 1px solid $tableBorderColor;
|
|
74
|
+
// pointer-events: none;
|
|
75
|
+
// z-index: 1;
|
|
76
|
+
// }
|
|
78
77
|
|
|
79
78
|
.#{$prefix}-grid-cell {
|
|
80
79
|
|
|
@@ -92,8 +91,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
92
91
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
94
|
&.#{$prefix}-grid-cell-ellipsis {
|
|
98
95
|
|
|
99
96
|
|
|
@@ -132,8 +129,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
132
129
|
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
132
|
&.#{$prefix}-grid-cell-wrap {
|
|
138
133
|
white-space: normal;
|
|
139
134
|
// overflow: hidden;
|
|
@@ -141,7 +136,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
141
136
|
word-break: break-word;
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
|
|
145
139
|
.#{$prefix}-grid-header-text-wrap {
|
|
146
140
|
white-space: normal;
|
|
147
141
|
overflow: hidden;
|
|
@@ -151,29 +145,19 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
151
145
|
|
|
152
146
|
}
|
|
153
147
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
148
|
.#{$prefix}-grid-thead {
|
|
158
|
-
background-color: #ffffff;
|
|
149
|
+
// background-color: #ffffff;
|
|
150
|
+
background-color: inherit;
|
|
151
|
+
font-weight: 500;
|
|
159
152
|
|
|
160
153
|
.#{$prefix}-grid-cell {
|
|
161
|
-
font-weight:
|
|
154
|
+
font-weight: inherit;
|
|
162
155
|
color: #000000E0;
|
|
163
156
|
|
|
164
157
|
background-color: inherit;
|
|
165
158
|
border-inline-end: 1px solid $tableBorderColor;
|
|
166
159
|
border-bottom: 1px solid $tableBorderColor;
|
|
167
160
|
|
|
168
|
-
// &::before {
|
|
169
|
-
// content: "";
|
|
170
|
-
// position: absolute;
|
|
171
|
-
// inset-block: 0;
|
|
172
|
-
// right: 0;
|
|
173
|
-
// inset-inline-start: 0px;
|
|
174
|
-
// border-inline-end: 1px solid #e0e0e0;
|
|
175
|
-
// }
|
|
176
|
-
|
|
177
161
|
&.ui-rc-grid-cell-ellipsis {
|
|
178
162
|
|
|
179
163
|
.ui-rc-table-column-title,
|
|
@@ -192,7 +176,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
192
176
|
.ui-rc-table-column-title,
|
|
193
177
|
.#{$prefix}-grid-cell-text-wrap {
|
|
194
178
|
white-space: normal;
|
|
195
|
-
// text-overflow: ellipsis;
|
|
196
179
|
word-break: break-word;
|
|
197
180
|
overflow: hidden;
|
|
198
181
|
}
|
|
@@ -282,7 +265,8 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
282
265
|
display: flex;
|
|
283
266
|
position: absolute;
|
|
284
267
|
width: 100%;
|
|
285
|
-
background-color: #ffffff;
|
|
268
|
+
// background-color: #ffffff;
|
|
269
|
+
background-color: inherit;
|
|
286
270
|
|
|
287
271
|
&:hover {
|
|
288
272
|
.#{$prefix}-grid-cell:not(.editable) {
|
|
@@ -657,39 +641,15 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
657
641
|
|
|
658
642
|
|
|
659
643
|
&.cell-border-top {
|
|
660
|
-
|
|
661
|
-
//border-bottom: 1px solid $border-selected-color;
|
|
662
|
-
// &::after {
|
|
663
|
-
// content: "";
|
|
664
|
-
// position: absolute;
|
|
665
|
-
// top: 0px;
|
|
666
|
-
// left: 0;
|
|
667
|
-
// //right: 0;
|
|
668
|
-
// //bottom: 0;
|
|
669
|
-
// height: 1px;
|
|
670
|
-
// width: 100%;
|
|
671
|
-
// border-top: 1px solid $border-selected-color;
|
|
672
|
-
// /* line đè lên border gốc */
|
|
673
|
-
// pointer-events: none;
|
|
674
|
-
// /* không ảnh hưởng đến tương tác */
|
|
675
|
-
// z-index: 1;
|
|
676
|
-
// }
|
|
677
|
-
|
|
644
|
+
|
|
678
645
|
&.ui-rc-grid-cell-fix-left-last {
|
|
679
646
|
&::after {
|
|
680
647
|
left: -100%;
|
|
681
648
|
}
|
|
682
649
|
}
|
|
683
650
|
|
|
684
|
-
// &.ui-rc-grid-cell-fix-right-first {
|
|
685
|
-
// &::after {
|
|
686
|
-
// left: 100%;
|
|
687
|
-
// }
|
|
688
|
-
// }
|
|
689
|
-
|
|
690
651
|
}
|
|
691
652
|
|
|
692
|
-
|
|
693
653
|
&.cell-paste-border-top {
|
|
694
654
|
|
|
695
655
|
|
|
@@ -706,7 +666,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
706
666
|
}
|
|
707
667
|
}
|
|
708
668
|
|
|
709
|
-
|
|
710
669
|
}
|
|
711
670
|
|
|
712
671
|
|
|
@@ -739,8 +698,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
739
698
|
|
|
740
699
|
.#{$prefix}-grid-cell {
|
|
741
700
|
|
|
742
|
-
|
|
743
|
-
|
|
744
701
|
&.#{$prefix}-grid-cell-fix-right-first {
|
|
745
702
|
&::after {
|
|
746
703
|
position: absolute;
|
|
@@ -1380,9 +1337,13 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
1380
1337
|
}
|
|
1381
1338
|
}
|
|
1382
1339
|
|
|
1340
|
+
&.ui-rc-grid .ui-rc-grid-container::after {
|
|
1341
|
+
border-right-color: $tableBorderColorDark;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1383
1344
|
&.ui-rc-grid {
|
|
1384
1345
|
.ui-rc-grid-container {
|
|
1385
|
-
border-bottom: 0;
|
|
1346
|
+
// border-bottom: 0;
|
|
1386
1347
|
border-color: $tableBorderColorDark;
|
|
1387
1348
|
|
|
1388
1349
|
.ui-rc-grid-tbody {
|
|
@@ -22,9 +22,10 @@ import { OperatorFeature } from "../features/operator";
|
|
|
22
22
|
import { convertFilters, convertToObjTrue, filterByIds, filterDataByColumns, getAllRowKey, isObjEqual } from "../hook/utils";
|
|
23
23
|
import TableContainerEdit from "../TableContainerEdit";
|
|
24
24
|
import classNames from 'classnames';
|
|
25
|
+
import { GridStyle } from "../style";
|
|
25
26
|
const Grid = props => {
|
|
26
27
|
const {
|
|
27
|
-
theme
|
|
28
|
+
theme,
|
|
28
29
|
t,
|
|
29
30
|
id,
|
|
30
31
|
prefix,
|
|
@@ -255,14 +256,20 @@ const Grid = props => {
|
|
|
255
256
|
}
|
|
256
257
|
const sensors = useSensors(useSensor(MouseSensor, {}), useSensor(TouchSensor, {}), useSensor(KeyboardSensor, {}));
|
|
257
258
|
const ContainerComponent = editAble ? TableContainerEdit : TableContainer;
|
|
258
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
259
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(GridStyle, {
|
|
260
|
+
$prefix: prefix,
|
|
261
|
+
$theme: {
|
|
262
|
+
theme: theme?.theme,
|
|
263
|
+
...theme
|
|
264
|
+
},
|
|
259
265
|
className: classNames(`${prefix}-grid`, {
|
|
260
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
261
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
266
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
267
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
262
268
|
}),
|
|
263
269
|
style: {
|
|
264
270
|
minHeight: minHeight ?? undefined,
|
|
265
|
-
maxHeight: height ?? undefined
|
|
271
|
+
maxHeight: height ?? undefined,
|
|
272
|
+
backgroundColor: theme?.backgroundColor ?? undefined
|
|
266
273
|
}
|
|
267
274
|
}, /*#__PURE__*/React.createElement(DndContext, {
|
|
268
275
|
collisionDetection: closestCenter,
|
|
@@ -333,8 +340,8 @@ const Grid = props => {
|
|
|
333
340
|
}
|
|
334
341
|
}, /*#__PURE__*/React.createElement("div", {
|
|
335
342
|
className: classNames(`${prefix}-grid`, {
|
|
336
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
337
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
343
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
344
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
338
345
|
}),
|
|
339
346
|
style: {
|
|
340
347
|
// minHeight: minHeight ?? undefined,
|
|
@@ -154,6 +154,7 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
154
154
|
headerTextWrap?: boolean;
|
|
155
155
|
ellipsis?: boolean;
|
|
156
156
|
allowResizing?: boolean;
|
|
157
|
+
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
157
158
|
onCellStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Cell<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
158
159
|
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
159
160
|
onCellFooterStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
@@ -191,7 +192,11 @@ export type Locale = TableLocale & {
|
|
|
191
192
|
};
|
|
192
193
|
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
193
194
|
export type TableProps<RecordType = AnyObject> = {
|
|
194
|
-
theme?:
|
|
195
|
+
theme?: {
|
|
196
|
+
theme?: 'dark' | 'light';
|
|
197
|
+
backgroundColor?: string;
|
|
198
|
+
color?: string;
|
|
199
|
+
};
|
|
195
200
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
196
201
|
editAble?: boolean;
|
|
197
202
|
infiniteScroll?: boolean;
|
|
@@ -13,7 +13,6 @@ var _hooks = require("./hooks");
|
|
|
13
13
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
14
14
|
require("dayjs/locale/es");
|
|
15
15
|
require("dayjs/locale/vi");
|
|
16
|
-
var _GridEdit = _interopRequireDefault(require("./table/GridEdit"));
|
|
17
16
|
var _Grid = _interopRequireDefault(require("./table/Grid"));
|
|
18
17
|
var _en_US = _interopRequireDefault(require("rc-master-ui/es/date-picker/locale/en_US"));
|
|
19
18
|
var _vi_VN = _interopRequireDefault(require("rc-master-ui/es/date-picker/locale/vi_VN"));
|
|
@@ -36,11 +35,13 @@ var _core = require("@dnd-kit/core");
|
|
|
36
35
|
var _sortable = require("@dnd-kit/sortable");
|
|
37
36
|
var _reactResizable = require("react-resizable");
|
|
38
37
|
var _faker = require("@faker-js/faker");
|
|
39
|
-
var _InfiniteTable = _interopRequireDefault(require("./table/InfiniteTable"));
|
|
40
38
|
var _useMergedState = _interopRequireDefault(require("rc-util/lib/hooks/useMergedState"));
|
|
41
39
|
var _Modal = _interopRequireDefault(require("antd/es/modal/Modal"));
|
|
42
40
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
43
41
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
42
|
+
// import GridEdit from "./table/GridEdit"
|
|
43
|
+
// import InfiniteTable from "./table/InfiniteTable";
|
|
44
|
+
|
|
44
45
|
// import useColumns from "./hooks/useColumns";
|
|
45
46
|
|
|
46
47
|
// import 'rc-master-ui/es/date-range-picker/styles/index.less'
|
|
@@ -194,6 +195,7 @@ const InternalTable = props => {
|
|
|
194
195
|
onFilter,
|
|
195
196
|
onSorter,
|
|
196
197
|
defaultSorter,
|
|
198
|
+
toolbarItems,
|
|
197
199
|
...rest
|
|
198
200
|
} = props;
|
|
199
201
|
const id = _react.default.useMemo(() => {
|
|
@@ -301,7 +303,7 @@ const InternalTable = props => {
|
|
|
301
303
|
const hhh = (totalHeight ?? 0) - (title ? title.offsetHeight : 0) - (header ? header.offsetHeight : 0) - (paginationE ? paginationE.offsetHeight : 0) - (toolbar ? toolbar.offsetHeight : 0) - (summaryE ? summaryE.offsetHeight : 0) - (scrollbar ? scrollbar.offsetHeight : 0);
|
|
302
304
|
setHeight1(hhh > 0 ? hhh : 0);
|
|
303
305
|
}
|
|
304
|
-
}, [id, isFullScreen, windowSize.innerHeight]);
|
|
306
|
+
}, [id, isFullScreen, windowSize.innerHeight, toolbarItems]);
|
|
305
307
|
const tableRef = _react.default.useRef(null);
|
|
306
308
|
_react.default.useEffect(() => {
|
|
307
309
|
setColumns(propsColumns);
|
|
@@ -450,7 +452,8 @@ const InternalTable = props => {
|
|
|
450
452
|
wrapSettings: wrapSettings
|
|
451
453
|
})),
|
|
452
454
|
// ellipsis: editAble || column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
453
|
-
ellipsis: column.ellipsis !== false
|
|
455
|
+
ellipsis: column.ellipsis !== false && wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
|
|
456
|
+
// ellipsis: false,
|
|
454
457
|
// ellipsis: column.ellipsis !== false,
|
|
455
458
|
|
|
456
459
|
align: column.textAlign ?? column.align,
|
|
@@ -918,7 +921,9 @@ const InternalTable = props => {
|
|
|
918
921
|
const handleFullScreen = () => {
|
|
919
922
|
setIsFullScreen(!isFullScreen);
|
|
920
923
|
};
|
|
921
|
-
|
|
924
|
+
|
|
925
|
+
// const TableComponent = infiniteScroll ? InfiniteTable : (groupAble ? Group : editAble ? GridEdit : Grid)
|
|
926
|
+
const TableComponent = groupAble ? _Group.default : _Grid.default;
|
|
922
927
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, true && /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
923
928
|
sensors: sensors,
|
|
924
929
|
modifiers: [_modifiers.restrictToHorizontalAxis],
|
|
@@ -1077,6 +1082,7 @@ const InternalTable = props => {
|
|
|
1077
1082
|
commandClick: triggerCommandClick,
|
|
1078
1083
|
summary: summary,
|
|
1079
1084
|
pagination: pagination,
|
|
1085
|
+
toolbarItems: toolbarItems,
|
|
1080
1086
|
scroll: scrollHeight1 - (summary ? 1 : 1) < 0 ? {
|
|
1081
1087
|
y: 500
|
|
1082
1088
|
} : {
|
|
@@ -62,7 +62,7 @@ const TableGrid = props => {
|
|
|
62
62
|
rowHoverable,
|
|
63
63
|
title,
|
|
64
64
|
format,
|
|
65
|
-
virtual = true,
|
|
65
|
+
// virtual = true,
|
|
66
66
|
t,
|
|
67
67
|
lang,
|
|
68
68
|
contextMenuOpen,
|
|
@@ -322,7 +322,7 @@ const TableGrid = props => {
|
|
|
322
322
|
'table-none-column-select': selectionSettings?.mode === undefined && selectionSettings?.type !== 'multiple'
|
|
323
323
|
}, styles.customTable),
|
|
324
324
|
bordered: true,
|
|
325
|
-
virtual:
|
|
325
|
+
virtual: true,
|
|
326
326
|
columns: columns,
|
|
327
327
|
rowKey: rowKey,
|
|
328
328
|
rowHoverable: rowHoverable,
|
|
@@ -91,7 +91,8 @@ const useColumns = config => {
|
|
|
91
91
|
const type = (0, _utils.getTypeFilter)(column);
|
|
92
92
|
// const operatorOptions = !type || type === 'Text' ? stringOperator : numberOperator
|
|
93
93
|
// const operatorOptions = type === 'Checkbox' || type === 'Dropdown' || type === 'DropTree' || ty
|
|
94
|
-
const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ?
|
|
94
|
+
// const operatorOptions = type === ('Checkbox' || 'Dropdown' || 'DropTree' || 'CheckboxDropdown') ? booleanOperator : (!type || type === 'Text' ? stringOperator : numberOperator)
|
|
95
|
+
const operatorOptions = ['Checkbox', 'Dropdown', 'DropTree', 'CheckboxDropdown'].includes(type) ? _constant.booleanOperator : !type || type === 'Text' ? _constant.stringOperator : _constant.numberOperator;
|
|
95
96
|
return /*#__PURE__*/React.createElement("div", {
|
|
96
97
|
style: {
|
|
97
98
|
padding: 8,
|
|
@@ -160,7 +160,7 @@ export declare const showDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
|
160
160
|
export declare const hideDraggingPoint: (selectedCells: any, id?: any) => void;
|
|
161
161
|
export declare const isRangeCell: (selectedCells: any, type: string, rowIndex: number, colIndex: number) => boolean;
|
|
162
162
|
export declare const isSelectedCell: (selectedCells: any, rowIndex: number, colIndex: number) => any;
|
|
163
|
-
export declare function groupArrayByColumns(
|
|
163
|
+
export declare function groupArrayByColumns(data: any[], columns: string[] | undefined): any;
|
|
164
164
|
export declare const isFormattedNumber: (str: string) => boolean;
|
|
165
165
|
export declare const detectSeparators: (str: string) => {
|
|
166
166
|
thousandSeparator: string;
|
|
@@ -2473,13 +2473,13 @@ const isSelectedCell = (selectedCells, rowIndex, colIndex) => {
|
|
|
2473
2473
|
return selectedCells.has(key);
|
|
2474
2474
|
};
|
|
2475
2475
|
exports.isSelectedCell = isSelectedCell;
|
|
2476
|
-
function groupArrayByColumns(
|
|
2476
|
+
function groupArrayByColumns(data, columns) {
|
|
2477
2477
|
const result = [];
|
|
2478
2478
|
const checkEmpty = d => {
|
|
2479
2479
|
return d === null || d === undefined || d === '';
|
|
2480
2480
|
};
|
|
2481
2481
|
if (columns) {
|
|
2482
|
-
|
|
2482
|
+
data.forEach(item => {
|
|
2483
2483
|
let currentLevel = result;
|
|
2484
2484
|
columns.forEach((column, index) => {
|
|
2485
2485
|
const value = item[column];
|
|
@@ -2487,15 +2487,12 @@ function groupArrayByColumns(arr, columns) {
|
|
|
2487
2487
|
if (existingItem) {
|
|
2488
2488
|
currentLevel = existingItem.children;
|
|
2489
2489
|
} else {
|
|
2490
|
-
// const newItem = {[column]: value, field: column, rowId: !isEmpty(value) ? (value) : newGuid(), parentId: !isEmpty(item[columns[index - 1]]) ? (item[columns[index - 1]]) : null, indent: index, children: [] }
|
|
2491
2490
|
const newItem = {
|
|
2492
2491
|
[column]: value,
|
|
2493
2492
|
field: column,
|
|
2494
2493
|
rowId: newGuid(),
|
|
2495
|
-
// rowId: item[column],
|
|
2496
2494
|
parentId: !isEmpty(item[columns[index - 1]]) ? item[columns[index - 1]] : null,
|
|
2497
|
-
//
|
|
2498
|
-
// indent: index,
|
|
2495
|
+
// tự tính tổng rồi điền thuộc tính vào
|
|
2499
2496
|
children: []
|
|
2500
2497
|
};
|
|
2501
2498
|
currentLevel.push(newItem);
|
|
@@ -2506,13 +2503,11 @@ function groupArrayByColumns(arr, columns) {
|
|
|
2506
2503
|
...item,
|
|
2507
2504
|
rowId: item.id ?? item.rowId,
|
|
2508
2505
|
parentId: !checkEmpty(columns[columns.length - 1]) ? item[columns[columns.length - 1]] : null
|
|
2509
|
-
// parentId: item.rowId[columns.length - 1],
|
|
2510
|
-
// indent: columns.length
|
|
2511
2506
|
});
|
|
2512
2507
|
});
|
|
2513
2508
|
return result;
|
|
2514
2509
|
} else {
|
|
2515
|
-
return
|
|
2510
|
+
return data;
|
|
2516
2511
|
}
|
|
2517
2512
|
}
|
|
2518
2513
|
const isFormattedNumber = str => {
|
|
@@ -136,6 +136,7 @@ export type ColumnTable<RecordType = AnyObject> = Omit<RcColumnType<RecordType>,
|
|
|
136
136
|
editFromSettings?: IEditFromSettings;
|
|
137
137
|
fixedType?: FixedType;
|
|
138
138
|
headerTextWrap?: boolean;
|
|
139
|
+
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
139
140
|
onCellStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Cell<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
140
141
|
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
141
142
|
onCellFooterStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
@@ -197,7 +198,11 @@ export type Sort = {
|
|
|
197
198
|
export interface TableProps<RecordType = AnyObject> extends Omit<RcTableProps<RecordType>, 'columns' | 'rowSelection' | 'loading' | 'dataSource' | 'summary' | 'pagination' | 'locale'> {
|
|
198
199
|
editAble?: boolean;
|
|
199
200
|
infiniteScroll?: boolean;
|
|
200
|
-
theme?:
|
|
201
|
+
theme?: {
|
|
202
|
+
theme?: 'dark' | 'light';
|
|
203
|
+
backgroundColor?: string;
|
|
204
|
+
color?: string;
|
|
205
|
+
};
|
|
201
206
|
next?: () => void;
|
|
202
207
|
locale?: Locale;
|
|
203
208
|
groupAble?: boolean;
|
|
@@ -42,12 +42,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
42
42
|
// import { Tooltip } from 'react-tooltip'
|
|
43
43
|
// import ContextMenu from './ContextMenu'
|
|
44
44
|
|
|
45
|
-
// import GridEdit from './table/GridEdit'
|
|
46
|
-
|
|
47
|
-
// import { Modal } from 'antd'
|
|
48
|
-
// import { findAllChildrenKeys2 } from '../grid-component/hooks'
|
|
49
|
-
// import { columns111 } from '../test-2/columns'
|
|
50
|
-
|
|
51
45
|
_dayjs.default.extend(_customParseFormat.default);
|
|
52
46
|
|
|
53
47
|
// const MySwal = withReactContent(Swal)
|
|
@@ -17,20 +17,6 @@ var _reactNumericComponent = require("react-numeric-component");
|
|
|
17
17
|
var _TableWrapper = _interopRequireDefault(require("./table/TableWrapper"));
|
|
18
18
|
var _utils = require("./hook/utils");
|
|
19
19
|
var _reactVirtual = require("@tanstack/react-virtual");
|
|
20
|
-
// import type { Dispatch, SetStateAction } from "react";
|
|
21
|
-
|
|
22
|
-
// import TableHead from './header/TableHead'
|
|
23
|
-
// import { sumSize } from './hook/utils'
|
|
24
|
-
|
|
25
|
-
// import { useVirtualizer } from '@tanstack/react-virtual'
|
|
26
|
-
|
|
27
|
-
// import TableBody from './body/TableBody'
|
|
28
|
-
|
|
29
|
-
// import TableFooter from './footer/TableFooter'
|
|
30
|
-
// import TableBody from './body/TableBody'
|
|
31
|
-
|
|
32
|
-
// import ComponentSpinner from '../grid-component/LoadingSpinner'
|
|
33
|
-
|
|
34
20
|
const TableContainer = props => {
|
|
35
21
|
const {
|
|
36
22
|
t,
|
|
@@ -109,6 +95,10 @@ const TableContainer = props => {
|
|
|
109
95
|
_react.default.useEffect(() => {
|
|
110
96
|
const handleClickOutside = () => {
|
|
111
97
|
setFocusedCell(undefined);
|
|
98
|
+
setIsSelectionChange(prev => ({
|
|
99
|
+
...prev,
|
|
100
|
+
isChange: false
|
|
101
|
+
}));
|
|
112
102
|
};
|
|
113
103
|
document.addEventListener('mousedown', handleClickOutside);
|
|
114
104
|
return () => {
|
|
@@ -188,6 +188,7 @@ const TableBodyCell = props => {
|
|
|
188
188
|
const isPinned = cell.column.getIsPinned();
|
|
189
189
|
const isLastLeftPinnedColumn = isPinned === "left" && cell.column.getIsLastColumn("left");
|
|
190
190
|
const isFirstRightPinnedColumn = isPinned === "right" && cell.column.getIsFirstColumn("right");
|
|
191
|
+
const enableClick = typeof columnMeta.allowSelection === 'function' ? columnMeta.allowSelection(record) : columnMeta.allowSelection;
|
|
191
192
|
|
|
192
193
|
// const selectRowIds = React.useMemo(() => {
|
|
193
194
|
|
|
@@ -430,16 +431,17 @@ const TableBodyCell = props => {
|
|
|
430
431
|
// })
|
|
431
432
|
// }
|
|
432
433
|
}
|
|
433
|
-
}
|
|
434
|
-
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// onKeyUp={() => {
|
|
435
437
|
|
|
436
|
-
//
|
|
438
|
+
// }}
|
|
437
439
|
,
|
|
438
440
|
|
|
439
441
|
onClick: e => {
|
|
440
442
|
const selection = window.getSelection();
|
|
441
443
|
const text = selection ? selection.toString() : "";
|
|
442
|
-
if (text.length > 0) {} else {
|
|
444
|
+
if (text.length > 0 || enableClick === false) {} else {
|
|
443
445
|
if (!selectionSettings || selectionSettings.checkboxOnly !== true) {
|
|
444
446
|
(0, _useColumns.toggleRowSelection)({
|
|
445
447
|
e,
|
|
@@ -13,12 +13,6 @@ var _hooks = require("../../grid-component/hooks");
|
|
|
13
13
|
var _reactNumericComponent = require("react-numeric-component");
|
|
14
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
// import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
|
|
17
|
-
|
|
18
|
-
// import type { Person } from "../makeData";
|
|
19
|
-
|
|
20
|
-
// import type { Person } from "../../tanstack-table/makeData";
|
|
21
|
-
|
|
22
16
|
const TableFooterCell = ({
|
|
23
17
|
column
|
|
24
18
|
}) => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type GridProps = {
|
|
3
|
+
$theme: {
|
|
4
|
+
theme?: 'light' | 'dark';
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
$prefix: string;
|
|
9
|
+
$borderColor?: string;
|
|
10
|
+
$cellFontSize?: number;
|
|
11
|
+
$cellPaddingInline?: number;
|
|
12
|
+
$cellPaddingBlock?: number;
|
|
13
|
+
$headerBg?: string;
|
|
14
|
+
$headerColor?: string;
|
|
15
|
+
$footerBg?: string;
|
|
16
|
+
$footerColor?: string;
|
|
17
|
+
$rowHoverBg?: string;
|
|
18
|
+
$rowSelectedBg?: string;
|
|
19
|
+
$rowSelectedHoverBg?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const GridStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, GridProps>> & string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.GridStyle = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
// const prefix = "ui-rc";
|
|
10
|
+
// const antdPrefix = "ant";
|
|
11
|
+
// const fontFamily = "Montserrat, Helvetica, Arial, serif ";
|
|
12
|
+
// const borderRadius = "6px";
|
|
13
|
+
|
|
14
|
+
// const boxShadowColor = "rgba(220, 0, 0, 0.09)";
|
|
15
|
+
const color = "#000000de";
|
|
16
|
+
const BgColor = "#ffffff ";
|
|
17
|
+
|
|
18
|
+
// const primary = "#eb4619";
|
|
19
|
+
|
|
20
|
+
// const rowHoverBg = "#FBDED6";
|
|
21
|
+
// const rowSelectedBg = "#FEF2EF";
|
|
22
|
+
|
|
23
|
+
const tableBorderColor = "#e0e0e0";
|
|
24
|
+
|
|
25
|
+
// const borderSelectedColor = "#0550C5";
|
|
26
|
+
// const cellSelectedBg = "#F3F8FF";
|
|
27
|
+
// const cellIndexSelectedBg = "#1869E6";
|
|
28
|
+
// const cellIndexFocusBg = "#E6EFFD";
|
|
29
|
+
|
|
30
|
+
// 404071
|
|
31
|
+
|
|
32
|
+
// dark
|
|
33
|
+
const tableBorderColorDark = "#44485E";
|
|
34
|
+
|
|
35
|
+
// const rowHoverBgDark = "#404071 ";
|
|
36
|
+
|
|
37
|
+
// const rowSelectedBgDark = "#25293C";
|
|
38
|
+
|
|
39
|
+
// const borderSelectedColorDark = "#538ff1 ";
|
|
40
|
+
// const cellIndexSelectedBgDark = "#1869E6 ";
|
|
41
|
+
|
|
42
|
+
// const bodyColorDark = "#343e59";
|
|
43
|
+
|
|
44
|
+
const BgColorDark = "#343e59 ";
|
|
45
|
+
const colorDark = "#e6e4f3e6 ";
|
|
46
|
+
|
|
47
|
+
// const cellSelectedBgDark = " #F3F8FF ";
|
|
48
|
+
// const cellIndexFocusBgDark = "#E6EFFD ";
|
|
49
|
+
|
|
50
|
+
/* height: const {props => (props.const heightTable ? `const {props.const heightTable}px` : undefined)}; */
|
|
51
|
+
|
|
52
|
+
const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
|
|
53
|
+
displayName: "GridStyle",
|
|
54
|
+
componentId: "es-grid-template__sc-hdqm5k-0"
|
|
55
|
+
})(["&.", "-grid{color:", ";font-size:13px;background-color:", ";table{table-layout:fixed;border-collapse:separate;border-spacing:0;}.", "-grid-container{border:1px solid ", ";border-right:0;&::after{position:absolute;top:0px;right:0;z-index:1;height:100%;border-right:1px solid ", ";content:\"\";pointer-events:none;}.", "-grid-tbody{.", "-grid-row{}}}&.", "-grid-light{.", "-grid-container{.", "-grid-thead{background-color:", ";font-weight:500;.", "-grid-cell{font-weight:inherit;color:", ";background-color:inherit;border-inline-end:1px solid ", ";border-bottom:1px solid ", ";&.ui-rc-grid-cell-ellipsis{.ui-rc-table-column-title,.", "-grid-cell-ellipsis{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:keep-all;}}&.ui-rc-grid-cell-wrap{.ui-rc-table-column-title,.", "-grid-cell-text-wrap{white-space:normal;word-break:break-word;overflow:hidden;}}&:hover{.ui-rc-header-trigger{.ui-rc-table-column-sorter-cancel{opacity:1;}}}.", "-grid-filter-column{display:flex;justify-content:space-between;width:100%;align-items:center;position:relative;z-index:3;}.ui-rc-header-trigger{padding-left:6px;display:flex;align-items:center;.ui-rc-table-column-sorter-cancel{opacity:0;}}.resizer{cursor:col-resize;height:100%;position:absolute;right:0;top:0;z-index:3;touch-action:none;user-select:none;width:5px;}.resizer.isResizing{opacity:1;}}}.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";}}.", "-grid-tfoot{.", "-grid-footer-row{border-bottom-width:1px;border-bottom-color:", ";border-bottom-style:solid;border-top-width:1px;border-top-color:", ";border-top-style:solid;background-color:#fafafa;}.", "-grid-cell{background-color:inherit;border-inline-end:1px solid ", ";}}}}&.", "-grid-dark{background-color:", ";color:", ";.", "-grid-container{border-color:", ";&::after{border-right-color:", ";}}}}"], props => props.$prefix, color, BgColor, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => props.$prefix, props => `${props.$theme.color ? props.$theme.color : color}`, tableBorderColor, tableBorderColor, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => props.$prefix, props => `${props.$theme.backgroundColor ? props.$theme.backgroundColor : BgColor}`, props => `${props.$theme.color ? props.$theme.color : color}`, props => props.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
|
|
@@ -27,7 +27,7 @@ $rowSelectedBg-Dark: #25293C !default;
|
|
|
27
27
|
$border-selected-color-Dark: #538ff1 !default;
|
|
28
28
|
$cell-index-selected-bg-Dark: #1869E6 !default;
|
|
29
29
|
|
|
30
|
-
$body-color-Dark: #
|
|
30
|
+
$body-color-Dark: #343e59 !default;
|
|
31
31
|
|
|
32
32
|
$cell-selected-bg-Dark: #F3F8FF !default;
|
|
33
33
|
$cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
@@ -46,6 +46,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
46
46
|
// border: 1px solid $tableBorderColor;
|
|
47
47
|
|
|
48
48
|
color: #000000de;
|
|
49
|
+
background-color: #ffffff;
|
|
49
50
|
|
|
50
51
|
font-size: 14px;
|
|
51
52
|
|
|
@@ -59,22 +60,20 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
59
60
|
|
|
60
61
|
.#{$prefix}-grid-container {
|
|
61
62
|
|
|
62
|
-
border: 1px solid $tableBorderColor;
|
|
63
|
-
// border-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
z-index: 1;
|
|
77
|
-
}
|
|
63
|
+
// border: 1px solid $tableBorderColor;
|
|
64
|
+
// border-right: 0;
|
|
65
|
+
// font-size: 13px;
|
|
66
|
+
|
|
67
|
+
// &::after {
|
|
68
|
+
// content: "";
|
|
69
|
+
// position: absolute;
|
|
70
|
+
// top: 0px;
|
|
71
|
+
// right: 0;
|
|
72
|
+
// height: 100%;
|
|
73
|
+
// border-right: 1px solid $tableBorderColor;
|
|
74
|
+
// pointer-events: none;
|
|
75
|
+
// z-index: 1;
|
|
76
|
+
// }
|
|
78
77
|
|
|
79
78
|
.#{$prefix}-grid-cell {
|
|
80
79
|
|
|
@@ -92,8 +91,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
92
91
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
|
|
97
94
|
&.#{$prefix}-grid-cell-ellipsis {
|
|
98
95
|
|
|
99
96
|
|
|
@@ -132,8 +129,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
132
129
|
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
|
|
136
|
-
|
|
137
132
|
&.#{$prefix}-grid-cell-wrap {
|
|
138
133
|
white-space: normal;
|
|
139
134
|
// overflow: hidden;
|
|
@@ -141,7 +136,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
141
136
|
word-break: break-word;
|
|
142
137
|
}
|
|
143
138
|
|
|
144
|
-
|
|
145
139
|
.#{$prefix}-grid-header-text-wrap {
|
|
146
140
|
white-space: normal;
|
|
147
141
|
overflow: hidden;
|
|
@@ -151,29 +145,19 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
151
145
|
|
|
152
146
|
}
|
|
153
147
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
148
|
.#{$prefix}-grid-thead {
|
|
158
|
-
background-color: #ffffff;
|
|
149
|
+
// background-color: #ffffff;
|
|
150
|
+
background-color: inherit;
|
|
151
|
+
font-weight: 500;
|
|
159
152
|
|
|
160
153
|
.#{$prefix}-grid-cell {
|
|
161
|
-
font-weight:
|
|
154
|
+
font-weight: inherit;
|
|
162
155
|
color: #000000E0;
|
|
163
156
|
|
|
164
157
|
background-color: inherit;
|
|
165
158
|
border-inline-end: 1px solid $tableBorderColor;
|
|
166
159
|
border-bottom: 1px solid $tableBorderColor;
|
|
167
160
|
|
|
168
|
-
// &::before {
|
|
169
|
-
// content: "";
|
|
170
|
-
// position: absolute;
|
|
171
|
-
// inset-block: 0;
|
|
172
|
-
// right: 0;
|
|
173
|
-
// inset-inline-start: 0px;
|
|
174
|
-
// border-inline-end: 1px solid #e0e0e0;
|
|
175
|
-
// }
|
|
176
|
-
|
|
177
161
|
&.ui-rc-grid-cell-ellipsis {
|
|
178
162
|
|
|
179
163
|
.ui-rc-table-column-title,
|
|
@@ -192,7 +176,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
192
176
|
.ui-rc-table-column-title,
|
|
193
177
|
.#{$prefix}-grid-cell-text-wrap {
|
|
194
178
|
white-space: normal;
|
|
195
|
-
// text-overflow: ellipsis;
|
|
196
179
|
word-break: break-word;
|
|
197
180
|
overflow: hidden;
|
|
198
181
|
}
|
|
@@ -282,7 +265,8 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
282
265
|
display: flex;
|
|
283
266
|
position: absolute;
|
|
284
267
|
width: 100%;
|
|
285
|
-
background-color: #ffffff;
|
|
268
|
+
// background-color: #ffffff;
|
|
269
|
+
background-color: inherit;
|
|
286
270
|
|
|
287
271
|
&:hover {
|
|
288
272
|
.#{$prefix}-grid-cell:not(.editable) {
|
|
@@ -657,39 +641,15 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
657
641
|
|
|
658
642
|
|
|
659
643
|
&.cell-border-top {
|
|
660
|
-
|
|
661
|
-
//border-bottom: 1px solid $border-selected-color;
|
|
662
|
-
// &::after {
|
|
663
|
-
// content: "";
|
|
664
|
-
// position: absolute;
|
|
665
|
-
// top: 0px;
|
|
666
|
-
// left: 0;
|
|
667
|
-
// //right: 0;
|
|
668
|
-
// //bottom: 0;
|
|
669
|
-
// height: 1px;
|
|
670
|
-
// width: 100%;
|
|
671
|
-
// border-top: 1px solid $border-selected-color;
|
|
672
|
-
// /* line đè lên border gốc */
|
|
673
|
-
// pointer-events: none;
|
|
674
|
-
// /* không ảnh hưởng đến tương tác */
|
|
675
|
-
// z-index: 1;
|
|
676
|
-
// }
|
|
677
|
-
|
|
644
|
+
|
|
678
645
|
&.ui-rc-grid-cell-fix-left-last {
|
|
679
646
|
&::after {
|
|
680
647
|
left: -100%;
|
|
681
648
|
}
|
|
682
649
|
}
|
|
683
650
|
|
|
684
|
-
// &.ui-rc-grid-cell-fix-right-first {
|
|
685
|
-
// &::after {
|
|
686
|
-
// left: 100%;
|
|
687
|
-
// }
|
|
688
|
-
// }
|
|
689
|
-
|
|
690
651
|
}
|
|
691
652
|
|
|
692
|
-
|
|
693
653
|
&.cell-paste-border-top {
|
|
694
654
|
|
|
695
655
|
|
|
@@ -706,7 +666,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
706
666
|
}
|
|
707
667
|
}
|
|
708
668
|
|
|
709
|
-
|
|
710
669
|
}
|
|
711
670
|
|
|
712
671
|
|
|
@@ -739,8 +698,6 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
739
698
|
|
|
740
699
|
.#{$prefix}-grid-cell {
|
|
741
700
|
|
|
742
|
-
|
|
743
|
-
|
|
744
701
|
&.#{$prefix}-grid-cell-fix-right-first {
|
|
745
702
|
&::after {
|
|
746
703
|
position: absolute;
|
|
@@ -1380,9 +1337,13 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
|
|
|
1380
1337
|
}
|
|
1381
1338
|
}
|
|
1382
1339
|
|
|
1340
|
+
&.ui-rc-grid .ui-rc-grid-container::after {
|
|
1341
|
+
border-right-color: $tableBorderColorDark;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1383
1344
|
&.ui-rc-grid {
|
|
1384
1345
|
.ui-rc-grid-container {
|
|
1385
|
-
border-bottom: 0;
|
|
1346
|
+
// border-bottom: 0;
|
|
1386
1347
|
border-color: $tableBorderColorDark;
|
|
1387
1348
|
|
|
1388
1349
|
.ui-rc-grid-tbody {
|
|
@@ -18,6 +18,7 @@ var _operator = require("../features/operator");
|
|
|
18
18
|
var _utils = require("../hook/utils");
|
|
19
19
|
var _TableContainerEdit = _interopRequireDefault(require("../TableContainerEdit"));
|
|
20
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
var _style = require("../style");
|
|
21
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
24
|
// import { makeData } from "../default/makeData";
|
|
@@ -28,7 +29,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
28
29
|
|
|
29
30
|
const Grid = props => {
|
|
30
31
|
const {
|
|
31
|
-
theme
|
|
32
|
+
theme,
|
|
32
33
|
t,
|
|
33
34
|
id,
|
|
34
35
|
prefix,
|
|
@@ -259,14 +260,20 @@ const Grid = props => {
|
|
|
259
260
|
}
|
|
260
261
|
const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.MouseSensor, {}), (0, _core.useSensor)(_core.TouchSensor, {}), (0, _core.useSensor)(_core.KeyboardSensor, {}));
|
|
261
262
|
const ContainerComponent = editAble ? _TableContainerEdit.default : _TableContainer.default;
|
|
262
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
263
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_style.GridStyle, {
|
|
264
|
+
$prefix: prefix,
|
|
265
|
+
$theme: {
|
|
266
|
+
theme: theme?.theme,
|
|
267
|
+
...theme
|
|
268
|
+
},
|
|
263
269
|
className: (0, _classnames.default)(`${prefix}-grid`, {
|
|
264
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
265
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
270
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
271
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
266
272
|
}),
|
|
267
273
|
style: {
|
|
268
274
|
minHeight: minHeight ?? undefined,
|
|
269
|
-
maxHeight: height ?? undefined
|
|
275
|
+
maxHeight: height ?? undefined,
|
|
276
|
+
backgroundColor: theme?.backgroundColor ?? undefined
|
|
270
277
|
}
|
|
271
278
|
}, /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
272
279
|
collisionDetection: _core.closestCenter,
|
|
@@ -337,8 +344,8 @@ const Grid = props => {
|
|
|
337
344
|
}
|
|
338
345
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
339
346
|
className: (0, _classnames.default)(`${prefix}-grid`, {
|
|
340
|
-
[`${prefix}-grid-light`]: theme === 'light',
|
|
341
|
-
[`${prefix}-grid-dark`]: theme === 'dark'
|
|
347
|
+
[`${prefix}-grid-light`]: !theme || theme.theme === 'light',
|
|
348
|
+
[`${prefix}-grid-dark`]: theme?.theme === 'dark'
|
|
342
349
|
}),
|
|
343
350
|
style: {
|
|
344
351
|
// minHeight: minHeight ?? undefined,
|
|
@@ -154,6 +154,7 @@ export type ColumnTable<RecordType = AnyObject> = {
|
|
|
154
154
|
headerTextWrap?: boolean;
|
|
155
155
|
ellipsis?: boolean;
|
|
156
156
|
allowResizing?: boolean;
|
|
157
|
+
allowSelection?: boolean | ((rowData: RecordType) => boolean);
|
|
157
158
|
onCellStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Cell<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
158
159
|
onCellHeaderStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
159
160
|
onCellFooterStyles?: Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'> | ((cellValue: any, cell: Header<RecordType, unknown>) => Omit<React.CSSProperties, 'display' | 'width' | 'minWidth' | 'left' | 'right' | 'position'>);
|
|
@@ -191,7 +192,11 @@ export type Locale = TableLocale & {
|
|
|
191
192
|
};
|
|
192
193
|
export type ColumnsTable<RecordType = AnyObject> = ColumnTable<RecordType>[];
|
|
193
194
|
export type TableProps<RecordType = AnyObject> = {
|
|
194
|
-
theme?:
|
|
195
|
+
theme?: {
|
|
196
|
+
theme?: 'dark' | 'light';
|
|
197
|
+
backgroundColor?: string;
|
|
198
|
+
color?: string;
|
|
199
|
+
};
|
|
195
200
|
title?: ReactNode | ((data: RecordType) => ReactNode);
|
|
196
201
|
editAble?: boolean;
|
|
197
202
|
infiniteScroll?: boolean;
|