es-grid-template 1.8.0 → 1.8.2

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.
@@ -582,7 +582,7 @@ const TableContainerEdit = props => {
582
582
  marginBottom: '.25rem',
583
583
  fontSize: 14
584
584
  }
585
- }, "D\u1EEF li\u1EC7u sao ch\xE9p v\u01B0\u1EE3t qu\xE1 s\u1ED1 d\xF2ng cho ph\xE9p (500 d\xF2ng).Ph\u1EA7n m\u1EC1n s\u1EBD ch\u1EC9 l\u1EA5y 500 d\xF2ng \u0111\u1EA7u ti\xEAn."), /*#__PURE__*/React.createElement(Title, {
585
+ }, "D\u1EEF li\u1EC7u sao ch\xE9p v\u01B0\u1EE3t qu\xE1 s\u1ED1 d\xF2ng cho ph\xE9p (", onCellPaste?.maxRowsPaste ?? 200, " d\xF2ng).Ph\u1EA7n m\u1EC1n s\u1EBD ch\u1EC9 l\u1EA5y 500 d\xF2ng \u0111\u1EA7u ti\xEAn."), /*#__PURE__*/React.createElement(Title, {
586
586
  level: 5,
587
587
  style: {
588
588
  marginTop: '.75rem'
@@ -267,6 +267,7 @@ const TableBodyCell = props => {
267
267
  style: {
268
268
  display: 'flex',
269
269
  // height: '36px',
270
+ minHeight: 36,
270
271
  width: cell.column.getSize(),
271
272
  minWidth: cell.column.getSize(),
272
273
  // flex: 1,
@@ -351,6 +352,7 @@ const TableBodyCell = props => {
351
352
  display: 'flex',
352
353
  width: cell.column.getSize(),
353
354
  minWidth: cell.column.getSize(),
355
+ minHeight: 36,
354
356
  // flex: 1,
355
357
  // maxWidth: cell.column.getSize(),
356
358
  // height: '36px',
@@ -28,7 +28,7 @@ const TableHead = ({
28
28
  zIndex: 1,
29
29
  // gridTemplateRows: `repeat(${table.getHeaderGroups().length}, auto)`,
30
30
  // gridTemplateColumns: `repeat(${table.getVisibleLeafColumns().length}, 1fr)`,
31
- gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
31
+ gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}px`).join(" ")}`
32
32
  }
33
33
  }, leafColumns.map(column => {
34
34
  const depth = column.depth ?? 0;
@@ -226,17 +226,17 @@ const TableHeadCell2 = props => {
226
226
  // rowSpan={rowSpan}
227
227
  ,
228
228
 
229
- key: column.id,
229
+ key: header.id,
230
230
  style: {
231
231
  // display: 'flex',
232
232
  // width: column.getSize(),
233
- minWidth: column.getSize(),
233
+ minWidth: header.getSize(),
234
234
  // flex: 1,
235
- flexGrow: column.getSize(),
235
+ flexGrow: header.getSize(),
236
236
  gridRow: `${depth + 1} / span ${rowSpan}`,
237
237
  gridColumn: `span ${colSpan}`,
238
238
  // maxWidth: header.getSize(),
239
- ...getCommonPinningStyles(column),
239
+ ...getCommonPinningStyles(header.column),
240
240
  width: 'auto',
241
241
  ...style
242
242
  },
@@ -9,7 +9,7 @@ import { ArrowDown, ArrowUp, FilterFill, SortCancel } from 'becoxy-icons';
9
9
  import classNames from 'classnames';
10
10
  import { Checkbox, Dropdown, Select } from 'rc-master-ui';
11
11
  import { booleanOperator, nonActionColumn, numberOperator, stringOperator, translateOption } from "../hook/constant";
12
- import { extendsObject, getCommonPinningStyles, getDefaultOperator, getTypeFilter } from "../hook/utils";
12
+ import { extendsObject, getCommonPinningStyles2, getDefaultOperator, getTypeFilter } from "../hook/utils";
13
13
  import { TableContext } from "../useContext";
14
14
  import { renderFilter } from "./renderFilter";
15
15
  import ReactDOMServer from 'react-dom/server';
@@ -224,7 +224,8 @@ const TableHeadGroupCell = props => {
224
224
  // rowSpan={rowSpan}
225
225
  ,
226
226
 
227
- key: column.id,
227
+ "data-col-span": colSpan,
228
+ key: header.id,
228
229
  style: {
229
230
  // display: 'flex',
230
231
  // width: column.getSize(),
@@ -233,7 +234,7 @@ const TableHeadGroupCell = props => {
233
234
  gridRow: `${depth + 1} / span ${rowSpan}`,
234
235
  gridColumn: `span ${colSpan}`,
235
236
  // maxWidth: header.getSize(),
236
- ...getCommonPinningStyles(column),
237
+ ...getCommonPinningStyles2(header),
237
238
  width: 'auto',
238
239
  ...style
239
240
  },
@@ -11,6 +11,7 @@ export declare const newGuid: () => any;
11
11
  export declare const convertDayjsToDate: (dateString: string, format?: string) => Date;
12
12
  export declare const convertDateToDayjs: (date: Date | undefined, format?: string) => dayjs.Dayjs;
13
13
  export declare const getCommonPinningStyles: (column: Column<any>) => CSSProperties;
14
+ export declare const getCommonPinningStyles2: (header: any) => CSSProperties;
14
15
  export declare const sumSize: (items: any) => number;
15
16
  export declare const appendIfNotExists: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
16
17
  export declare const getNewItemsOnly: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
@@ -50,6 +50,29 @@ export const getCommonPinningStyles = column => {
50
50
  // borderBottom: 0
51
51
  };
52
52
  };
53
+ export const getCommonPinningStyles2 = header => {
54
+ const isPinned = header.column.getIsPinned();
55
+ // const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
56
+ // const isFirstRightPinnedColumn =isPinned === "right" && column.getIsFirstColumn("right");
57
+
58
+ return {
59
+ // boxShadow: isFirstRightPinnedColumn
60
+ // ? "#e0e0e0 2px 0px 1px -1px inset"
61
+ // : undefined,
62
+
63
+ left: isPinned === "left" ? `${header.getStart("left")}px` : undefined,
64
+ right: isPinned === "right" ? `${header.getAfter("right")}px` : undefined,
65
+ // opacity: isPinned ? 0.5 : 1,
66
+ opacity: 1,
67
+ position: isPinned ? "sticky" : "relative",
68
+ // width: column.getSize(),
69
+ width: 'auto',
70
+ zIndex: isPinned ? 2 : 0
71
+ // border: '1px solid #e5e7eb',
72
+ // borderTop: 0,
73
+ // borderBottom: 0
74
+ };
75
+ };
53
76
  export const sumSize = items => {
54
77
  return items.reduce((total, item) => total + item.size, 0);
55
78
  };
@@ -589,7 +589,7 @@ const TableContainerEdit = props => {
589
589
  marginBottom: '.25rem',
590
590
  fontSize: 14
591
591
  }
592
- }, "D\u1EEF li\u1EC7u sao ch\xE9p v\u01B0\u1EE3t qu\xE1 s\u1ED1 d\xF2ng cho ph\xE9p (500 d\xF2ng).Ph\u1EA7n m\u1EC1n s\u1EBD ch\u1EC9 l\u1EA5y 500 d\xF2ng \u0111\u1EA7u ti\xEAn."), /*#__PURE__*/_react.default.createElement(Title, {
592
+ }, "D\u1EEF li\u1EC7u sao ch\xE9p v\u01B0\u1EE3t qu\xE1 s\u1ED1 d\xF2ng cho ph\xE9p (", onCellPaste?.maxRowsPaste ?? 200, " d\xF2ng).Ph\u1EA7n m\u1EC1n s\u1EBD ch\u1EC9 l\u1EA5y 500 d\xF2ng \u0111\u1EA7u ti\xEAn."), /*#__PURE__*/_react.default.createElement(Title, {
593
593
  level: 5,
594
594
  style: {
595
595
  marginTop: '.75rem'
@@ -274,6 +274,7 @@ const TableBodyCell = props => {
274
274
  style: {
275
275
  display: 'flex',
276
276
  // height: '36px',
277
+ minHeight: 36,
277
278
  width: cell.column.getSize(),
278
279
  minWidth: cell.column.getSize(),
279
280
  // flex: 1,
@@ -358,6 +359,7 @@ const TableBodyCell = props => {
358
359
  display: 'flex',
359
360
  width: cell.column.getSize(),
360
361
  minWidth: cell.column.getSize(),
362
+ minHeight: 36,
361
363
  // flex: 1,
362
364
  // maxWidth: cell.column.getSize(),
363
365
  // height: '36px',
@@ -38,7 +38,7 @@ const TableHead = ({
38
38
  zIndex: 1,
39
39
  // gridTemplateRows: `repeat(${table.getHeaderGroups().length}, auto)`,
40
40
  // gridTemplateColumns: `repeat(${table.getVisibleLeafColumns().length}, 1fr)`,
41
- gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}fr`).join(" ")}`
41
+ gridTemplateColumns: `${table.getVisibleLeafColumns().map(n => `${n.getSize()}px`).join(" ")}`
42
42
  }
43
43
  }, leafColumns.map(column => {
44
44
  const depth = column.depth ?? 0;
@@ -235,17 +235,17 @@ const TableHeadCell2 = props => {
235
235
  // rowSpan={rowSpan}
236
236
  ,
237
237
 
238
- key: column.id,
238
+ key: header.id,
239
239
  style: {
240
240
  // display: 'flex',
241
241
  // width: column.getSize(),
242
- minWidth: column.getSize(),
242
+ minWidth: header.getSize(),
243
243
  // flex: 1,
244
- flexGrow: column.getSize(),
244
+ flexGrow: header.getSize(),
245
245
  gridRow: `${depth + 1} / span ${rowSpan}`,
246
246
  gridColumn: `span ${colSpan}`,
247
247
  // maxWidth: header.getSize(),
248
- ...(0, _utils.getCommonPinningStyles)(column),
248
+ ...(0, _utils.getCommonPinningStyles)(header.column),
249
249
  width: 'auto',
250
250
  ...style
251
251
  },
@@ -233,7 +233,8 @@ const TableHeadGroupCell = props => {
233
233
  // rowSpan={rowSpan}
234
234
  ,
235
235
 
236
- key: column.id,
236
+ "data-col-span": colSpan,
237
+ key: header.id,
237
238
  style: {
238
239
  // display: 'flex',
239
240
  // width: column.getSize(),
@@ -242,7 +243,7 @@ const TableHeadGroupCell = props => {
242
243
  gridRow: `${depth + 1} / span ${rowSpan}`,
243
244
  gridColumn: `span ${colSpan}`,
244
245
  // maxWidth: header.getSize(),
245
- ...(0, _utils.getCommonPinningStyles)(column),
246
+ ...(0, _utils.getCommonPinningStyles2)(header),
246
247
  width: 'auto',
247
248
  ...style
248
249
  },
@@ -11,6 +11,7 @@ export declare const newGuid: () => any;
11
11
  export declare const convertDayjsToDate: (dateString: string, format?: string) => Date;
12
12
  export declare const convertDateToDayjs: (date: Date | undefined, format?: string) => dayjs.Dayjs;
13
13
  export declare const getCommonPinningStyles: (column: Column<any>) => CSSProperties;
14
+ export declare const getCommonPinningStyles2: (header: any) => CSSProperties;
14
15
  export declare const sumSize: (items: any) => number;
15
16
  export declare const appendIfNotExists: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
16
17
  export declare const getNewItemsOnly: (a: VirtualItem[], b: VirtualItem[]) => VirtualItem[];
@@ -25,7 +25,7 @@ exports.findFirst = findFirst;
25
25
  exports.getAllVisibleKeys1 = exports.getAllVisibleKeys = exports.getAllRowKey = exports.genPresets = exports.flattenData = exports.flattenArray = exports.flatColumns2 = exports.findItemByKey = void 0;
26
26
  exports.getCellsByPosition = getCellsByPosition;
27
27
  exports.getColIdsBetween = getColIdsBetween;
28
- exports.getFormat = exports.getFixedFields = exports.getEditType = exports.getDiffent2Array = exports.getDefaultValue = exports.getDefaultOperator = exports.getDatepickerFormat = exports.getDateRangeFormat = exports.getCommonPinningStyles = void 0;
28
+ exports.getFormat = exports.getFixedFields = exports.getEditType = exports.getDiffent2Array = exports.getDefaultValue = exports.getDefaultOperator = exports.getDatepickerFormat = exports.getDateRangeFormat = exports.getCommonPinningStyles2 = exports.getCommonPinningStyles = void 0;
29
29
  exports.getHiddenParentKeys = getHiddenParentKeys;
30
30
  exports.getHiddenParentKeys1 = getHiddenParentKeys1;
31
31
  exports.getInvisibleColumns = getInvisibleColumns;
@@ -103,6 +103,30 @@ const getCommonPinningStyles = column => {
103
103
  };
104
104
  };
105
105
  exports.getCommonPinningStyles = getCommonPinningStyles;
106
+ const getCommonPinningStyles2 = header => {
107
+ const isPinned = header.column.getIsPinned();
108
+ // const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
109
+ // const isFirstRightPinnedColumn =isPinned === "right" && column.getIsFirstColumn("right");
110
+
111
+ return {
112
+ // boxShadow: isFirstRightPinnedColumn
113
+ // ? "#e0e0e0 2px 0px 1px -1px inset"
114
+ // : undefined,
115
+
116
+ left: isPinned === "left" ? `${header.getStart("left")}px` : undefined,
117
+ right: isPinned === "right" ? `${header.getAfter("right")}px` : undefined,
118
+ // opacity: isPinned ? 0.5 : 1,
119
+ opacity: 1,
120
+ position: isPinned ? "sticky" : "relative",
121
+ // width: column.getSize(),
122
+ width: 'auto',
123
+ zIndex: isPinned ? 2 : 0
124
+ // border: '1px solid #e5e7eb',
125
+ // borderTop: 0,
126
+ // borderBottom: 0
127
+ };
128
+ };
129
+ exports.getCommonPinningStyles2 = getCommonPinningStyles2;
106
130
  const sumSize = items => {
107
131
  return items.reduce((total, item) => total + item.size, 0);
108
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",