@telus-uds/components-community.data-grid 1.0.0 → 1.1.0
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/CHANGELOG.md +25 -2
- package/lib/cjs/DataGrid.js +12 -2
- package/lib/cjs/DataGridCell.js +23 -8
- package/lib/esm/DataGrid.js +12 -2
- package/lib/esm/DataGridCell.js +23 -8
- package/package.json +4 -4
- package/src/DataGrid.jsx +21 -4
- package/src/DataGridCell.jsx +25 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
# Change Log - @telus-uds/components-community.data-grid
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 14 Feb 2025 18:59:39 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.1.0
|
|
8
|
+
|
|
9
|
+
Fri, 14 Feb 2025 18:59:39 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `DataGrid`: enhancement to make the grid header optional (mike.taylor@telus.com)
|
|
14
|
+
- Bump @telus-uds/components-web to v4.2.0
|
|
15
|
+
- Bump @telus-uds/components-base to v3.2.0
|
|
16
|
+
- Bump @telus-uds/system-theme-tokens to v4.2.0
|
|
17
|
+
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
18
|
+
|
|
19
|
+
## 1.0.1
|
|
20
|
+
|
|
21
|
+
Mon, 10 Feb 2025 17:36:47 GMT
|
|
22
|
+
|
|
23
|
+
### Patches
|
|
24
|
+
|
|
25
|
+
- Bump @telus-uds/components-web to v4.1.0
|
|
26
|
+
- Bump @telus-uds/components-base to v3.1.0
|
|
27
|
+
- Bump @telus-uds/system-theme-tokens to v4.1.0
|
|
28
|
+
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
29
|
+
|
|
7
30
|
## 1.0.0
|
|
8
31
|
|
|
9
|
-
Fri, 31 Jan 2025 20:
|
|
32
|
+
Fri, 31 Jan 2025 20:53:28 GMT
|
|
10
33
|
|
|
11
34
|
### Major changes
|
|
12
35
|
|
package/lib/cjs/DataGrid.js
CHANGED
|
@@ -32,7 +32,8 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
32
32
|
tokens,
|
|
33
33
|
variant,
|
|
34
34
|
copy = 'en',
|
|
35
|
-
testID = 'data-grid'
|
|
35
|
+
testID = 'data-grid',
|
|
36
|
+
isHeaderVisible
|
|
36
37
|
} = _ref;
|
|
37
38
|
const themeTokens = (0, _componentsBase.useThemeTokens)('DataGrid', tokens, variant);
|
|
38
39
|
const getCopy = (0, _componentsBase.useCopy)({
|
|
@@ -153,12 +154,14 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
153
154
|
children: [shouldDisplayIconColumn(data, _showCheckbox) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DataGridCell.default, {
|
|
154
155
|
tokens: themeTokens,
|
|
155
156
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
157
|
+
isHeaderVisible: isHeaderVisible,
|
|
156
158
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledIconContainer, {
|
|
157
159
|
children: [CheckBoxDisplay, DisplayCaret]
|
|
158
160
|
})
|
|
159
161
|
}), columnsData.map(column => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DataGridCell.default, {
|
|
160
162
|
tokens: themeTokens,
|
|
161
163
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
164
|
+
isHeaderVisible: isHeaderVisible,
|
|
162
165
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
163
166
|
block: true,
|
|
164
167
|
variant: {
|
|
@@ -212,6 +215,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
212
215
|
type: _utility.CELL_TYPE.SUBHEADING,
|
|
213
216
|
tokens: themeTokens,
|
|
214
217
|
columnsLength: columnsData.length,
|
|
218
|
+
isHeaderVisible: isHeaderVisible,
|
|
215
219
|
children: data[group].groupHeaderComponent || DefaultSubHeading
|
|
216
220
|
})
|
|
217
221
|
}, group);
|
|
@@ -240,11 +244,13 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
240
244
|
type: _utility.CELL_TYPE.HEADING,
|
|
241
245
|
tokens: themeTokens,
|
|
242
246
|
isFirstCol: true,
|
|
247
|
+
isHeaderVisible: isHeaderVisible,
|
|
243
248
|
children: HeaderCheckBoxDisplay
|
|
244
249
|
}), columnsData.map(column => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_DataGridCell.default, {
|
|
245
250
|
type: _utility.CELL_TYPE.HEADING,
|
|
246
251
|
tokens: themeTokens,
|
|
247
252
|
isSortable: isSortable,
|
|
253
|
+
isHeaderVisible: isHeaderVisible,
|
|
248
254
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
249
255
|
block: true,
|
|
250
256
|
variant: {
|
|
@@ -364,6 +370,10 @@ DataGrid.propTypes = {
|
|
|
364
370
|
/**
|
|
365
371
|
* Use in tests if the datagrid test cases need to find the element with the id.
|
|
366
372
|
*/
|
|
367
|
-
testID: _propTypes.default.string
|
|
373
|
+
testID: _propTypes.default.string,
|
|
374
|
+
/**
|
|
375
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
376
|
+
*/
|
|
377
|
+
isHeaderVisible: _propTypes.default.bool
|
|
368
378
|
};
|
|
369
379
|
var _default = exports.default = DataGrid;
|
package/lib/cjs/DataGridCell.js
CHANGED
|
@@ -22,31 +22,37 @@ const StyledHeaderCellDiv = /*#__PURE__*/_styledComponents.default.div.withConfi
|
|
|
22
22
|
displayName: "DataGridCell__StyledHeaderCellDiv",
|
|
23
23
|
componentId: "[object Object]__sc-6nkvhz-1"
|
|
24
24
|
})(["display:flex;align-items:center;"]);
|
|
25
|
+
const StyledHeaderCellHiddenHeader = /*#__PURE__*/_styledComponents.default.th.withConfig({
|
|
26
|
+
displayName: "DataGridCell__StyledHeaderCellHiddenHeader",
|
|
27
|
+
componentId: "[object Object]__sc-6nkvhz-2"
|
|
28
|
+
})(["", ""], props => {
|
|
29
|
+
return (0, _styledComponents.css)(["background-color:", ";border-bottom:solid ", "px ", ";padding:0px;width:", ";height:1px;"], props.headerRowBackgroundColor, props.headerBorderBottomWidth, props.cellBorderBottomColor, props.firstColWidth);
|
|
30
|
+
});
|
|
25
31
|
const StyledGroupHeaderCell = /*#__PURE__*/_styledComponents.default.td.withConfig({
|
|
26
32
|
displayName: "DataGridCell__StyledGroupHeaderCell",
|
|
27
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
33
|
+
componentId: "[object Object]__sc-6nkvhz-3"
|
|
28
34
|
})(["", ""], props => {
|
|
29
35
|
return (0, _styledComponents.css)(["background-color:", ";padding:", "px;border-top:solid ", "px ", ";text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.subHeadingBackgroundColor, props.cellPadding, props.cellBorderBottomWidth, props.cellBorderBottomColor, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
30
36
|
});
|
|
31
37
|
const StyledGroupHeaderCellDiv = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
32
38
|
displayName: "DataGridCell__StyledGroupHeaderCellDiv",
|
|
33
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
39
|
+
componentId: "[object Object]__sc-6nkvhz-4"
|
|
34
40
|
})(["display:flex;align-items:center;justify-content:start;"]);
|
|
35
41
|
const StyledExpandedCell = /*#__PURE__*/_styledComponents.default.td.withConfig({
|
|
36
42
|
displayName: "DataGridCell__StyledExpandedCell",
|
|
37
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
43
|
+
componentId: "[object Object]__sc-6nkvhz-5"
|
|
38
44
|
})(["", ""], props => {
|
|
39
45
|
return (0, _styledComponents.css)(["padding:", "px;border-bottom:", " text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.cellPadding, props.isExpandedRowOpen ? `solid ${props.cellBorderBottomWidth}px ${props.headerBorderBottomColor};` : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor};`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
40
46
|
});
|
|
41
47
|
const StyledExpandedCellDiv = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
42
48
|
displayName: "DataGridCell__StyledExpandedCellDiv",
|
|
43
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
49
|
+
componentId: "[object Object]__sc-6nkvhz-6"
|
|
44
50
|
})(["", ""], props => {
|
|
45
51
|
return (0, _styledComponents.css)(["display:flex;align-items:center;justify-content:", ";padding-left:", ";"], props.expandedContentAlignment ? props.expandedContentAlignment : 'start', props.showCheckbox ? `${props.expandedContentLeftPadding}px` : `${props.expandedContentDefaultLeftPadding}px`);
|
|
46
52
|
});
|
|
47
53
|
const StyledCell = exports.StyledCell = /*#__PURE__*/_styledComponents.default.td.withConfig({
|
|
48
54
|
displayName: "DataGridCell__StyledCell",
|
|
49
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
55
|
+
componentId: "[object Object]__sc-6nkvhz-7"
|
|
50
56
|
})(["", ""], props => {
|
|
51
57
|
if (props.isExpandedRowOpen) {
|
|
52
58
|
return (0, _styledComponents.css)(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:solid ", "px ", ";"], props.cellPadding, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily, props.headerBorderTopWidth, props.headerBorderTopColor);
|
|
@@ -61,16 +67,21 @@ const DataGridCell = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
61
67
|
columnsLength,
|
|
62
68
|
showCheckbox = false,
|
|
63
69
|
isFirstCol = false,
|
|
64
|
-
isExpandedRowOpen = false
|
|
70
|
+
isExpandedRowOpen = false,
|
|
71
|
+
isHeaderVisible = true
|
|
65
72
|
} = _ref;
|
|
66
73
|
if (type === _utility.CELL_TYPE.HEADING) {
|
|
67
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
74
|
+
return isHeaderVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
68
75
|
...tokens,
|
|
69
76
|
firstColWidth: isFirstCol ? tokens.firstColWidth : 'auto',
|
|
70
77
|
ref: ref,
|
|
71
78
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCellDiv, {
|
|
72
79
|
children: children
|
|
73
80
|
})
|
|
81
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCellHiddenHeader, {
|
|
82
|
+
...tokens,
|
|
83
|
+
firstColWidth: isFirstCol ? tokens.firstColWidth : 'auto',
|
|
84
|
+
ref: ref
|
|
74
85
|
});
|
|
75
86
|
}
|
|
76
87
|
if (type === _utility.CELL_TYPE.SUBHEADING) {
|
|
@@ -133,6 +144,10 @@ DataGridCell.propTypes = {
|
|
|
133
144
|
/**
|
|
134
145
|
* isExpandedRowOpen passed to the component to determine if cell is displaying additional data
|
|
135
146
|
*/
|
|
136
|
-
isExpandedRowOpen: _propTypes.default.bool
|
|
147
|
+
isExpandedRowOpen: _propTypes.default.bool,
|
|
148
|
+
/**
|
|
149
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
150
|
+
*/
|
|
151
|
+
isHeaderVisible: _propTypes.default.bool
|
|
137
152
|
};
|
|
138
153
|
var _default = exports.default = DataGridCell;
|
package/lib/esm/DataGrid.js
CHANGED
|
@@ -25,7 +25,8 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
25
25
|
tokens,
|
|
26
26
|
variant,
|
|
27
27
|
copy = 'en',
|
|
28
|
-
testID = 'data-grid'
|
|
28
|
+
testID = 'data-grid',
|
|
29
|
+
isHeaderVisible
|
|
29
30
|
} = _ref;
|
|
30
31
|
const themeTokens = useThemeTokens('DataGrid', tokens, variant);
|
|
31
32
|
const getCopy = useCopy({
|
|
@@ -146,12 +147,14 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
146
147
|
children: [shouldDisplayIconColumn(data, _showCheckbox) && /*#__PURE__*/_jsx(DataGridCell, {
|
|
147
148
|
tokens: themeTokens,
|
|
148
149
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
150
|
+
isHeaderVisible: isHeaderVisible,
|
|
149
151
|
children: /*#__PURE__*/_jsxs(StyledIconContainer, {
|
|
150
152
|
children: [CheckBoxDisplay, DisplayCaret]
|
|
151
153
|
})
|
|
152
154
|
}), columnsData.map(column => /*#__PURE__*/_jsx(DataGridCell, {
|
|
153
155
|
tokens: themeTokens,
|
|
154
156
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
157
|
+
isHeaderVisible: isHeaderVisible,
|
|
155
158
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
156
159
|
block: true,
|
|
157
160
|
variant: {
|
|
@@ -205,6 +208,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
205
208
|
type: CELL_TYPE.SUBHEADING,
|
|
206
209
|
tokens: themeTokens,
|
|
207
210
|
columnsLength: columnsData.length,
|
|
211
|
+
isHeaderVisible: isHeaderVisible,
|
|
208
212
|
children: data[group].groupHeaderComponent || DefaultSubHeading
|
|
209
213
|
})
|
|
210
214
|
}, group);
|
|
@@ -233,11 +237,13 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
233
237
|
type: CELL_TYPE.HEADING,
|
|
234
238
|
tokens: themeTokens,
|
|
235
239
|
isFirstCol: true,
|
|
240
|
+
isHeaderVisible: isHeaderVisible,
|
|
236
241
|
children: HeaderCheckBoxDisplay
|
|
237
242
|
}), columnsData.map(column => /*#__PURE__*/_jsxs(DataGridCell, {
|
|
238
243
|
type: CELL_TYPE.HEADING,
|
|
239
244
|
tokens: themeTokens,
|
|
240
245
|
isSortable: isSortable,
|
|
246
|
+
isHeaderVisible: isHeaderVisible,
|
|
241
247
|
children: [/*#__PURE__*/_jsx(Typography, {
|
|
242
248
|
block: true,
|
|
243
249
|
variant: {
|
|
@@ -357,6 +363,10 @@ DataGrid.propTypes = {
|
|
|
357
363
|
/**
|
|
358
364
|
* Use in tests if the datagrid test cases need to find the element with the id.
|
|
359
365
|
*/
|
|
360
|
-
testID: PropTypes.string
|
|
366
|
+
testID: PropTypes.string,
|
|
367
|
+
/**
|
|
368
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
369
|
+
*/
|
|
370
|
+
isHeaderVisible: PropTypes.bool
|
|
361
371
|
};
|
|
362
372
|
export default DataGrid;
|
package/lib/esm/DataGridCell.js
CHANGED
|
@@ -13,31 +13,37 @@ const StyledHeaderCellDiv = /*#__PURE__*/styled.div.withConfig({
|
|
|
13
13
|
displayName: "DataGridCell__StyledHeaderCellDiv",
|
|
14
14
|
componentId: "[object Object]__sc-6nkvhz-1"
|
|
15
15
|
})(["display:flex;align-items:center;"]);
|
|
16
|
+
const StyledHeaderCellHiddenHeader = /*#__PURE__*/styled.th.withConfig({
|
|
17
|
+
displayName: "DataGridCell__StyledHeaderCellHiddenHeader",
|
|
18
|
+
componentId: "[object Object]__sc-6nkvhz-2"
|
|
19
|
+
})(["", ""], props => {
|
|
20
|
+
return css(["background-color:", ";border-bottom:solid ", "px ", ";padding:0px;width:", ";height:1px;"], props.headerRowBackgroundColor, props.headerBorderBottomWidth, props.cellBorderBottomColor, props.firstColWidth);
|
|
21
|
+
});
|
|
16
22
|
const StyledGroupHeaderCell = /*#__PURE__*/styled.td.withConfig({
|
|
17
23
|
displayName: "DataGridCell__StyledGroupHeaderCell",
|
|
18
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
24
|
+
componentId: "[object Object]__sc-6nkvhz-3"
|
|
19
25
|
})(["", ""], props => {
|
|
20
26
|
return css(["background-color:", ";padding:", "px;border-top:solid ", "px ", ";text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.subHeadingBackgroundColor, props.cellPadding, props.cellBorderBottomWidth, props.cellBorderBottomColor, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
21
27
|
});
|
|
22
28
|
const StyledGroupHeaderCellDiv = /*#__PURE__*/styled.div.withConfig({
|
|
23
29
|
displayName: "DataGridCell__StyledGroupHeaderCellDiv",
|
|
24
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
30
|
+
componentId: "[object Object]__sc-6nkvhz-4"
|
|
25
31
|
})(["display:flex;align-items:center;justify-content:start;"]);
|
|
26
32
|
const StyledExpandedCell = /*#__PURE__*/styled.td.withConfig({
|
|
27
33
|
displayName: "DataGridCell__StyledExpandedCell",
|
|
28
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
34
|
+
componentId: "[object Object]__sc-6nkvhz-5"
|
|
29
35
|
})(["", ""], props => {
|
|
30
36
|
return css(["padding:", "px;border-bottom:", " text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.cellPadding, props.isExpandedRowOpen ? `solid ${props.cellBorderBottomWidth}px ${props.headerBorderBottomColor};` : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor};`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
31
37
|
});
|
|
32
38
|
const StyledExpandedCellDiv = /*#__PURE__*/styled.div.withConfig({
|
|
33
39
|
displayName: "DataGridCell__StyledExpandedCellDiv",
|
|
34
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
40
|
+
componentId: "[object Object]__sc-6nkvhz-6"
|
|
35
41
|
})(["", ""], props => {
|
|
36
42
|
return css(["display:flex;align-items:center;justify-content:", ";padding-left:", ";"], props.expandedContentAlignment ? props.expandedContentAlignment : 'start', props.showCheckbox ? `${props.expandedContentLeftPadding}px` : `${props.expandedContentDefaultLeftPadding}px`);
|
|
37
43
|
});
|
|
38
44
|
export const StyledCell = /*#__PURE__*/styled.td.withConfig({
|
|
39
45
|
displayName: "DataGridCell__StyledCell",
|
|
40
|
-
componentId: "[object Object]__sc-6nkvhz-
|
|
46
|
+
componentId: "[object Object]__sc-6nkvhz-7"
|
|
41
47
|
})(["", ""], props => {
|
|
42
48
|
if (props.isExpandedRowOpen) {
|
|
43
49
|
return css(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:solid ", "px ", ";"], props.cellPadding, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily, props.headerBorderTopWidth, props.headerBorderTopColor);
|
|
@@ -52,16 +58,21 @@ const DataGridCell = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
52
58
|
columnsLength,
|
|
53
59
|
showCheckbox = false,
|
|
54
60
|
isFirstCol = false,
|
|
55
|
-
isExpandedRowOpen = false
|
|
61
|
+
isExpandedRowOpen = false,
|
|
62
|
+
isHeaderVisible = true
|
|
56
63
|
} = _ref;
|
|
57
64
|
if (type === CELL_TYPE.HEADING) {
|
|
58
|
-
return /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
65
|
+
return isHeaderVisible ? /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
59
66
|
...tokens,
|
|
60
67
|
firstColWidth: isFirstCol ? tokens.firstColWidth : 'auto',
|
|
61
68
|
ref: ref,
|
|
62
69
|
children: /*#__PURE__*/_jsx(StyledHeaderCellDiv, {
|
|
63
70
|
children: children
|
|
64
71
|
})
|
|
72
|
+
}) : /*#__PURE__*/_jsx(StyledHeaderCellHiddenHeader, {
|
|
73
|
+
...tokens,
|
|
74
|
+
firstColWidth: isFirstCol ? tokens.firstColWidth : 'auto',
|
|
75
|
+
ref: ref
|
|
65
76
|
});
|
|
66
77
|
}
|
|
67
78
|
if (type === CELL_TYPE.SUBHEADING) {
|
|
@@ -124,6 +135,10 @@ DataGridCell.propTypes = {
|
|
|
124
135
|
/**
|
|
125
136
|
* isExpandedRowOpen passed to the component to determine if cell is displaying additional data
|
|
126
137
|
*/
|
|
127
|
-
isExpandedRowOpen: PropTypes.bool
|
|
138
|
+
isExpandedRowOpen: PropTypes.bool,
|
|
139
|
+
/**
|
|
140
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
141
|
+
*/
|
|
142
|
+
isHeaderVisible: PropTypes.bool
|
|
128
143
|
};
|
|
129
144
|
export default DataGridCell;
|
package/package.json
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"prop-types": "^15.7.2",
|
|
8
|
-
"@telus-uds/components-web": "^4.
|
|
9
|
-
"@telus-uds/components-base": "^3.
|
|
10
|
-
"@telus-uds/system-theme-tokens": "^4.
|
|
8
|
+
"@telus-uds/components-web": "^4.2.0",
|
|
9
|
+
"@telus-uds/components-base": "^3.2.0",
|
|
10
|
+
"@telus-uds/system-theme-tokens": "^4.2.0",
|
|
11
11
|
"styled-components": "6.1.13",
|
|
12
12
|
"smooth-scrollbar": "8.8.4",
|
|
13
13
|
"smooth-scrollbar-react": "2.4.1"
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"standard-engine": {
|
|
47
47
|
"skip": true
|
|
48
48
|
},
|
|
49
|
-
"version": "1.
|
|
49
|
+
"version": "1.1.0"
|
|
50
50
|
}
|
package/src/DataGrid.jsx
CHANGED
|
@@ -48,7 +48,8 @@ const DataGrid = React.forwardRef(
|
|
|
48
48
|
tokens,
|
|
49
49
|
variant,
|
|
50
50
|
copy = 'en',
|
|
51
|
-
testID = 'data-grid'
|
|
51
|
+
testID = 'data-grid',
|
|
52
|
+
isHeaderVisible
|
|
52
53
|
},
|
|
53
54
|
ref
|
|
54
55
|
) => {
|
|
@@ -188,7 +189,11 @@ const DataGrid = React.forwardRef(
|
|
|
188
189
|
onClick={toggleRowExpansion}
|
|
189
190
|
>
|
|
190
191
|
{shouldDisplayIconColumn(data, _showCheckbox) && (
|
|
191
|
-
<DataGridCell
|
|
192
|
+
<DataGridCell
|
|
193
|
+
tokens={themeTokens}
|
|
194
|
+
isExpandedRowOpen={row.isExpandedRowOpen}
|
|
195
|
+
isHeaderVisible={isHeaderVisible}
|
|
196
|
+
>
|
|
192
197
|
<StyledIconContainer>
|
|
193
198
|
{CheckBoxDisplay}
|
|
194
199
|
{DisplayCaret}
|
|
@@ -199,6 +204,7 @@ const DataGrid = React.forwardRef(
|
|
|
199
204
|
<DataGridCell
|
|
200
205
|
tokens={themeTokens}
|
|
201
206
|
isExpandedRowOpen={row.isExpandedRowOpen}
|
|
207
|
+
isHeaderVisible={isHeaderVisible}
|
|
202
208
|
key={`${rowId}-${column.key}`}
|
|
203
209
|
>
|
|
204
210
|
<Typography
|
|
@@ -257,6 +263,7 @@ const DataGrid = React.forwardRef(
|
|
|
257
263
|
type={CELL_TYPE.SUBHEADING}
|
|
258
264
|
tokens={themeTokens}
|
|
259
265
|
columnsLength={columnsData.length}
|
|
266
|
+
isHeaderVisible={isHeaderVisible}
|
|
260
267
|
>
|
|
261
268
|
{data[group].groupHeaderComponent || DefaultSubHeading}
|
|
262
269
|
</DataGridCell>
|
|
@@ -305,7 +312,12 @@ const DataGrid = React.forwardRef(
|
|
|
305
312
|
HeaderContent = (
|
|
306
313
|
<>
|
|
307
314
|
{shouldDisplayIconColumn(data, showCheckbox) && (
|
|
308
|
-
<DataGridCell
|
|
315
|
+
<DataGridCell
|
|
316
|
+
type={CELL_TYPE.HEADING}
|
|
317
|
+
tokens={themeTokens}
|
|
318
|
+
isFirstCol={true}
|
|
319
|
+
isHeaderVisible={isHeaderVisible}
|
|
320
|
+
>
|
|
309
321
|
{HeaderCheckBoxDisplay}
|
|
310
322
|
</DataGridCell>
|
|
311
323
|
)}
|
|
@@ -316,6 +328,7 @@ const DataGrid = React.forwardRef(
|
|
|
316
328
|
key={column.key}
|
|
317
329
|
tokens={themeTokens}
|
|
318
330
|
isSortable={isSortable}
|
|
331
|
+
isHeaderVisible={isHeaderVisible}
|
|
319
332
|
>
|
|
320
333
|
<Typography
|
|
321
334
|
block
|
|
@@ -457,7 +470,11 @@ DataGrid.propTypes = {
|
|
|
457
470
|
/**
|
|
458
471
|
* Use in tests if the datagrid test cases need to find the element with the id.
|
|
459
472
|
*/
|
|
460
|
-
testID: PropTypes.string
|
|
473
|
+
testID: PropTypes.string,
|
|
474
|
+
/**
|
|
475
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
476
|
+
*/
|
|
477
|
+
isHeaderVisible: PropTypes.bool
|
|
461
478
|
}
|
|
462
479
|
|
|
463
480
|
export default DataGrid
|
package/src/DataGridCell.jsx
CHANGED
|
@@ -25,6 +25,17 @@ const StyledHeaderCellDiv = styled.div`
|
|
|
25
25
|
display: flex;
|
|
26
26
|
align-items: center;
|
|
27
27
|
`
|
|
28
|
+
const StyledHeaderCellHiddenHeader = styled.th`
|
|
29
|
+
${(props) => {
|
|
30
|
+
return css`
|
|
31
|
+
background-color: ${props.headerRowBackgroundColor};
|
|
32
|
+
border-bottom: solid ${props.headerBorderBottomWidth}px ${props.cellBorderBottomColor};
|
|
33
|
+
padding: 0px;
|
|
34
|
+
width: ${props.firstColWidth};
|
|
35
|
+
height: 1px;
|
|
36
|
+
`
|
|
37
|
+
}}
|
|
38
|
+
`
|
|
28
39
|
|
|
29
40
|
const StyledGroupHeaderCell = styled.td`
|
|
30
41
|
${(props) => {
|
|
@@ -118,12 +129,13 @@ const DataGridCell = React.forwardRef(
|
|
|
118
129
|
columnsLength,
|
|
119
130
|
showCheckbox = false,
|
|
120
131
|
isFirstCol = false,
|
|
121
|
-
isExpandedRowOpen = false
|
|
132
|
+
isExpandedRowOpen = false,
|
|
133
|
+
isHeaderVisible = true
|
|
122
134
|
},
|
|
123
135
|
ref
|
|
124
136
|
) => {
|
|
125
137
|
if (type === CELL_TYPE.HEADING) {
|
|
126
|
-
return (
|
|
138
|
+
return isHeaderVisible ? (
|
|
127
139
|
<StyledHeaderCell
|
|
128
140
|
{...tokens}
|
|
129
141
|
firstColWidth={isFirstCol ? tokens.firstColWidth : 'auto'}
|
|
@@ -131,6 +143,12 @@ const DataGridCell = React.forwardRef(
|
|
|
131
143
|
>
|
|
132
144
|
<StyledHeaderCellDiv>{children}</StyledHeaderCellDiv>
|
|
133
145
|
</StyledHeaderCell>
|
|
146
|
+
) : (
|
|
147
|
+
<StyledHeaderCellHiddenHeader
|
|
148
|
+
{...tokens}
|
|
149
|
+
firstColWidth={isFirstCol ? tokens.firstColWidth : 'auto'}
|
|
150
|
+
ref={ref}
|
|
151
|
+
/>
|
|
134
152
|
)
|
|
135
153
|
}
|
|
136
154
|
if (type === CELL_TYPE.SUBHEADING) {
|
|
@@ -192,7 +210,11 @@ DataGridCell.propTypes = {
|
|
|
192
210
|
/**
|
|
193
211
|
* isExpandedRowOpen passed to the component to determine if cell is displaying additional data
|
|
194
212
|
*/
|
|
195
|
-
isExpandedRowOpen: PropTypes.bool
|
|
213
|
+
isExpandedRowOpen: PropTypes.bool,
|
|
214
|
+
/**
|
|
215
|
+
* Passed to the component to determine if header is displayed. Set to false to hide header of datagrid. Set to true by default
|
|
216
|
+
*/
|
|
217
|
+
isHeaderVisible: PropTypes.bool
|
|
196
218
|
}
|
|
197
219
|
|
|
198
220
|
export default DataGridCell
|