es-grid-template 1.8.57 → 1.8.59

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.
Files changed (35) hide show
  1. package/es/grid-component/InternalTable.js +12 -5
  2. package/es/grid-component/TableGrid.js +2 -2
  3. package/es/grid-component/hooks/useColumns.js +2 -1
  4. package/es/grid-component/hooks/utils.d.ts +1 -1
  5. package/es/grid-component/hooks/utils.js +4 -9
  6. package/es/grid-component/type.d.ts +6 -1
  7. package/es/table-component/InternalTable.js +0 -5
  8. package/es/table-component/TableContainer.js +4 -11
  9. package/es/table-component/body/TableBody.js +0 -27
  10. package/es/table-component/body/TableBodyCell.js +6 -4
  11. package/es/table-component/footer/TableFooterCell.js +0 -4
  12. package/es/table-component/hook/useColumns.js +6 -3
  13. package/es/table-component/style.d.ts +22 -0
  14. package/es/table-component/style.js +48 -0
  15. package/es/table-component/style.scss +28 -67
  16. package/es/table-component/table/Grid.js +14 -7
  17. package/es/table-component/type.d.ts +6 -1
  18. package/lib/grid-component/InternalTable.js +11 -5
  19. package/lib/grid-component/TableGrid.js +2 -2
  20. package/lib/grid-component/hooks/useColumns.js +2 -1
  21. package/lib/grid-component/hooks/utils.d.ts +1 -1
  22. package/lib/grid-component/hooks/utils.js +4 -9
  23. package/lib/grid-component/type.d.ts +6 -1
  24. package/lib/table-component/InternalTable.js +0 -6
  25. package/lib/table-component/TableContainer.js +4 -14
  26. package/lib/table-component/body/TableBody.js +0 -27
  27. package/lib/table-component/body/TableBodyCell.js +6 -4
  28. package/lib/table-component/footer/TableFooterCell.js +0 -6
  29. package/lib/table-component/hook/useColumns.js +6 -3
  30. package/lib/table-component/style.d.ts +22 -0
  31. package/lib/table-component/style.js +55 -0
  32. package/lib/table-component/style.scss +28 -67
  33. package/lib/table-component/table/Grid.js +14 -7
  34. package/lib/table-component/type.d.ts +6 -1
  35. 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
- import GridEdit from "./table/GridEdit";
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 || wrapSettings && wrapSettings.wrapMode !== 'Content' && wrapSettings.wrapMode !== 'Both',
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
- const TableComponent = infiniteScroll ? InfiniteTable : groupAble ? Group : editAble ? GridEdit : Grid;
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: virtual,
325
+ virtual: true,
326
326
  columns: columns,
327
327
  rowKey: rowKey,
328
328
  rowHoverable: rowHoverable,
@@ -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(arr: any[], columns: string[] | undefined): any;
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(arr, columns) {
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
- arr.forEach(item => {
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
- // parentId: item.rowId[index - 1],
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 arr;
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?: 'dark' | 'light';
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 () => {
@@ -65,33 +65,6 @@ const TableBody = ({
65
65
  })))) : /*#__PURE__*/React.createElement(Fragment, null, virtualRows.map(virtualRow => {
66
66
  const row = rows[virtualRow.index];
67
67
  const isEditing = row.id === editingKey;
68
-
69
- // return (
70
- // <tr key={row.id}>
71
- // {row.getVisibleCells().map((cell) => (
72
- // <td
73
- // key={cell.id}
74
- // style={{
75
- // padding: '12px',
76
- // whiteSpace: 'nowrap',
77
- // fontSize: '0.875rem',
78
- // color: '#6b7280',
79
- // border: '1px solid #e5e7eb',
80
- // width: cell.column.getSize(),
81
- // maxWidth: cell.column.getSize(),
82
- // overflow: "hidden",
83
- // ...getCommonPinningStyles(cell.column)
84
- // }}>
85
-
86
- // {cell.column.id}
87
-
88
- // {/* {flexRender(cell.column.columnDef.cell, cell.getContext())} */}
89
-
90
- // </td>
91
- // ))}
92
- // </tr>
93
- // )
94
-
95
68
  return /*#__PURE__*/React.createElement(TableBodyRow, _extends({}, rest, {
96
69
  table: table,
97
70
  tableId: tableId,
@@ -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
- onKeyUp: () => {}
427
+ }
428
+
429
+ // onKeyUp={() => {
428
430
 
429
- // onDoubleClick={() => { }}
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
  }) => {
@@ -208,7 +208,7 @@ export const toggleRowSelection = props => {
208
208
  isChange: true,
209
209
  type: 'rowSelected',
210
210
  rowData: row.original,
211
- rowsData: checkedRows
211
+ rowsData: selectionSettings?.type === 'single' ? [row] : checkedRows
212
212
  });
213
213
  }
214
214
  return;
@@ -284,8 +284,11 @@ export const toggleRowSelection = props => {
284
284
  } else {
285
285
  // chỉ thêm vào row hiện tại
286
286
 
287
- const isInclude = prevSelected.find(it => it.id === cell.row.id);
288
- if (isInclude) {
287
+ const isInclude = prevSelected.findIndex(it => it.id === cell.row.id);
288
+ if (isInclude > -1) {
289
+ // cập nhật data row hiện tại
290
+
291
+ prevSelected[isInclude] = row;
289
292
  checkedRows = [...prevSelected];
290
293
  } else {
291
294
  checkedRows = [...prevSelected, row];
@@ -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: #2F3349 !default;
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-bottom: 0;
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
- // width: 100%;
74
- border-right: 1px solid $tableBorderColor;
75
- pointer-events: none;
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: 500;
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 = 'light',
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("div", {
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,