es-grid-template 1.9.25 → 1.9.26

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.
@@ -322,6 +322,10 @@ export type TableProps<RecordType = AnyObject> = {
322
322
  showHeader?: boolean;
323
323
  /** CSS class cho container table */
324
324
  className?: string;
325
+ /** striped class odd/even row table
326
+ * mặc định : true
327
+ */
328
+ striped?: boolean;
325
329
  /** Tiêu đề table */
326
330
  title?: ReactNode | ((data: RecordType) => ReactNode);
327
331
  /** Tiêu đề khi table ở chế độ fullscreen */
@@ -388,11 +392,6 @@ export type TableProps<RecordType = AnyObject> = {
388
392
  fullScreen?: boolean;
389
393
  /** Cấu hình phân trang, false để tắt */
390
394
  pagination?: false | PaginationConfig;
391
- /**
392
- * @deprecated
393
- * @since 1.9.25
394
- */
395
- showCustomTooltip?: boolean;
396
395
  /** Context Menu */
397
396
  /** Danh sách menu chuột phải */
398
397
  contextMenuItems?: ContextMenuItem[];
@@ -77,6 +77,7 @@ const TableContainer = props => {
77
77
  onExpandClick,
78
78
  setIsExpandClick,
79
79
  recordClick,
80
+ striped = true,
80
81
  ...rest
81
82
  } = props;
82
83
  const [paginationLocal] = useLocale('Pagination');
@@ -278,6 +279,7 @@ const TableContainer = props => {
278
279
  value: {
279
280
  t,
280
281
  locale,
282
+ striped,
281
283
  lang,
282
284
  prefix,
283
285
  id,
@@ -399,13 +399,12 @@ const TableBodyCell = props => {
399
399
  if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
400
400
  setIsOpenTooltip(true);
401
401
  }
402
- }
403
-
404
- // onMouseLeave={() => {
405
- // setIsOpenTooltip(false)
406
- // }}
407
- ,
408
-
402
+ },
403
+ onMouseLeave: () => {
404
+ if (isOpenTooltip) {
405
+ setIsOpenTooltip(false);
406
+ }
407
+ },
409
408
  onKeyDown: e => {
410
409
  const flatRows = table.getRowModel().flatRows;
411
410
  if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
@@ -28,7 +28,8 @@ const TableBodyRow = ({
28
28
  focusedCell,
29
29
  rowClassName,
30
30
  rowEditable,
31
- onRowStyles
31
+ onRowStyles,
32
+ striped
32
33
  } = React.useContext(TableContext);
33
34
  const visibleCells = row.getVisibleCells();
34
35
  const virtualColumns = columnVirtualizer.getVirtualItems();
@@ -53,7 +54,9 @@ const TableBodyRow = ({
53
54
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
54
55
  [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble,
55
56
  // [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0 || (Array.isArray(row.originalSubRows) && row.originalSubRows.length > 0),
56
- [`${prefix}-grid-row-parent`]: row.getCanExpand()
57
+ [`${prefix}-grid-row-parent`]: row.getCanExpand(),
58
+ [`${prefix}-grid-row-odd`]: striped && virtualRow.index % 2 === 1,
59
+ [`${prefix}-grid-row-even`]: striped && virtualRow.index % 2 === 0
57
60
  }),
58
61
  style: {
59
62
  // display: 'flex',
@@ -45,4 +45,4 @@ const colorDark = "#e6e4f3e6 ";
45
45
  export const GridStyle = styled.div.withConfig({
46
46
  displayName: "GridStyle",
47
47
  componentId: "es-grid-template__sc-hdqm5k-0"
48
- })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}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{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-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{}}.", "-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, 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, 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, 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.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
48
+ })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}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{background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#F9F8FD;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-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{}}.", "-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, 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, 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, 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.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
@@ -272,7 +272,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
272
272
  position: absolute;
273
273
  width: 100%;
274
274
  // background-color: #ffffff;
275
- background-color: inherit;
275
+ // background-color: inherit;
276
276
 
277
277
  &:hover {
278
278
  .#{$prefix}-grid-cell:not(.editable) {
@@ -13,6 +13,7 @@ export interface IContext<T> {
13
13
  rowKey: string;
14
14
  originData: any[];
15
15
  dataSource: any[];
16
+ striped?: boolean;
16
17
  format?: IFormat;
17
18
  expandable?: ExpandableConfig<T>;
18
19
  wrapSettings?: IWrapSettings;
@@ -322,6 +322,10 @@ export type TableProps<RecordType = AnyObject> = {
322
322
  showHeader?: boolean;
323
323
  /** CSS class cho container table */
324
324
  className?: string;
325
+ /** striped class odd/even row table
326
+ * mặc định : true
327
+ */
328
+ striped?: boolean;
325
329
  /** Tiêu đề table */
326
330
  title?: ReactNode | ((data: RecordType) => ReactNode);
327
331
  /** Tiêu đề khi table ở chế độ fullscreen */
@@ -388,11 +392,6 @@ export type TableProps<RecordType = AnyObject> = {
388
392
  fullScreen?: boolean;
389
393
  /** Cấu hình phân trang, false để tắt */
390
394
  pagination?: false | PaginationConfig;
391
- /**
392
- * @deprecated
393
- * @since 1.9.25
394
- */
395
- showCustomTooltip?: boolean;
396
395
  /** Context Menu */
397
396
  /** Danh sách menu chuột phải */
398
397
  contextMenuItems?: ContextMenuItem[];
@@ -84,6 +84,7 @@ const TableContainer = props => {
84
84
  onExpandClick,
85
85
  setIsExpandClick,
86
86
  recordClick,
87
+ striped = true,
87
88
  ...rest
88
89
  } = props;
89
90
  const [paginationLocal] = (0, _locale.useLocale)('Pagination');
@@ -285,6 +286,7 @@ const TableContainer = props => {
285
286
  value: {
286
287
  t,
287
288
  locale,
289
+ striped,
288
290
  lang,
289
291
  prefix,
290
292
  id,
@@ -406,13 +406,12 @@ const TableBodyCell = props => {
406
406
  if (e.target.firstChild?.clientWidth < e.target.firstChild?.scrollWidth) {
407
407
  setIsOpenTooltip(true);
408
408
  }
409
- }
410
-
411
- // onMouseLeave={() => {
412
- // setIsOpenTooltip(false)
413
- // }}
414
- ,
415
-
409
+ },
410
+ onMouseLeave: () => {
411
+ if (isOpenTooltip) {
412
+ setIsOpenTooltip(false);
413
+ }
414
+ },
416
415
  onKeyDown: e => {
417
416
  const flatRows = table.getRowModel().flatRows;
418
417
  if (e.key === 'ArrowDown' && rowNumber < flatRows.length - 1) {
@@ -35,7 +35,8 @@ const TableBodyRow = ({
35
35
  focusedCell,
36
36
  rowClassName,
37
37
  rowEditable,
38
- onRowStyles
38
+ onRowStyles,
39
+ striped
39
40
  } = _react.default.useContext(_useContext.TableContext);
40
41
  const visibleCells = row.getVisibleCells();
41
42
  const virtualColumns = columnVirtualizer.getVirtualItems();
@@ -60,7 +61,9 @@ const TableBodyRow = ({
60
61
  [`${prefix}-grid-row-selected`]: row.getIsSelected(),
61
62
  [`${prefix}-grid-row-focus`]: row.id === focusedCell?.rowId && !editAble,
62
63
  // [`${prefix}-grid-row-parent`]: row.subRows && row.subRows.length > 0 || (Array.isArray(row.originalSubRows) && row.originalSubRows.length > 0),
63
- [`${prefix}-grid-row-parent`]: row.getCanExpand()
64
+ [`${prefix}-grid-row-parent`]: row.getCanExpand(),
65
+ [`${prefix}-grid-row-odd`]: striped && virtualRow.index % 2 === 1,
66
+ [`${prefix}-grid-row-even`]: striped && virtualRow.index % 2 === 0
64
67
  }),
65
68
  style: {
66
69
  // display: 'flex',
@@ -52,4 +52,4 @@ const colorDark = "#e6e4f3e6 ";
52
52
  const GridStyle = exports.GridStyle = _styledComponents.default.div.withConfig({
53
53
  displayName: "GridStyle",
54
54
  componentId: "es-grid-template__sc-hdqm5k-0"
55
- })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}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{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-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{}}.", "-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, 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, 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, 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.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
55
+ })(["&.", "-grid{color:", ";font-size:13px;background-color:", ";&.", "-grid-editable{.", "-grid-container{.", "-grid-tbody{.", "-grid-row{background-color:", ";color:", ";&.", "-grid-row-parent{background-color:#ffffff;font-weight:500;}}}}}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{background-color:", ";color:", ";&.", "-grid-row-odd{background-color:#F9F8FD;}&.", "-grid-row-even{}&.", "-grid-row-parent{background-color:#f5f5f5;font-weight:500;}}}}&.", "-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{}}.", "-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, 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, 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, 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.$prefix, props => props.$prefix, tableBorderColor, tableBorderColor, props => props.$prefix, tableBorderColor, props => props.$prefix, BgColorDark, colorDark, props => props.$prefix, tableBorderColorDark, tableBorderColorDark);
@@ -272,7 +272,7 @@ $cell-index-focus-bg-Dark: #E6EFFD !default;
272
272
  position: absolute;
273
273
  width: 100%;
274
274
  // background-color: #ffffff;
275
- background-color: inherit;
275
+ // background-color: inherit;
276
276
 
277
277
  &:hover {
278
278
  .#{$prefix}-grid-cell:not(.editable) {
@@ -13,6 +13,7 @@ export interface IContext<T> {
13
13
  rowKey: string;
14
14
  originData: any[];
15
15
  dataSource: any[];
16
+ striped?: boolean;
16
17
  format?: IFormat;
17
18
  expandable?: ExpandableConfig<T>;
18
19
  wrapSettings?: IWrapSettings;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.9.25",
3
+ "version": "1.9.26",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",