@telus-uds/components-community.data-grid 1.6.6 → 1.7.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 +17 -5
- package/LICENSE +21 -0
- package/jest.config.cjs +6 -1
- package/lib/cjs/DataGrid.js +7 -4
- package/lib/cjs/DataGridCell.js +12 -5
- package/lib/cjs/DataGridTable.js +2 -2
- package/lib/esm/DataGrid.js +7 -4
- package/lib/esm/DataGridCell.js +12 -5
- package/lib/esm/DataGridTable.js +2 -2
- package/package.json +4 -4
- package/src/DataGrid.jsx +16 -4
- package/src/DataGridCell.jsx +21 -8
- package/src/DataGridTable.jsx +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
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, 03 Oct 2025 20:34:06 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 1.
|
|
7
|
+
## 1.7.0
|
|
8
8
|
|
|
9
|
-
Fri,
|
|
9
|
+
Fri, 03 Oct 2025 20:34:06 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- `Datagrid`: Added borders to datagrid header (vishal.jindal@telus.com)
|
|
14
|
+
- Bump @telus-uds/components-web to v4.12.3
|
|
15
|
+
- Bump @telus-uds/components-base to v3.19.0
|
|
16
|
+
- Bump @telus-uds/system-theme-tokens to v4.15.0
|
|
17
|
+
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
18
|
+
|
|
19
|
+
## 1.6.7
|
|
20
|
+
|
|
21
|
+
Tue, 16 Sep 2025 21:19:36 GMT
|
|
10
22
|
|
|
11
23
|
### Patches
|
|
12
24
|
|
|
13
|
-
- Bump @telus-uds/components-web to v4.12.
|
|
14
|
-
- Bump @telus-uds/components-base to v3.
|
|
25
|
+
- Bump @telus-uds/components-web to v4.12.2
|
|
26
|
+
- Bump @telus-uds/components-base to v3.18.0
|
|
15
27
|
- Bump @telus-uds/browserslist-config to v1.0.5
|
|
16
28
|
|
|
17
29
|
## 1.5.4
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TELUS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/jest.config.cjs
CHANGED
|
@@ -9,7 +9,12 @@ module.exports = () => ({
|
|
|
9
9
|
'.+\\.(otf|png|jpg)$': 'identity-obj-proxy',
|
|
10
10
|
'\\.icon.svg': '<rootDir>/__mocks__/iconMock.jsx',
|
|
11
11
|
'\\.css': '<rootDir>/__mocks__/styleMock.js',
|
|
12
|
-
'
|
|
12
|
+
'^react-native$': 'react-native-web',
|
|
13
|
+
'^@telus-uds/components-base/server$': '<rootDir>/../../../components-base/src/server.js',
|
|
14
|
+
'^@telus-uds/components-base$': '<rootDir>/../../../components-base/src',
|
|
15
|
+
'^@telus-uds/components-web$': '<rootDir>/../../../components-web/src',
|
|
16
|
+
'^@telus-uds/system-constants$': '<rootDir>/../../../system-constants/src',
|
|
17
|
+
'^@telus-uds/system-theme-tokens$': '<rootDir>/../../../system-theme-tokens/src'
|
|
13
18
|
},
|
|
14
19
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
15
20
|
transformIgnorePatterns: [
|
package/lib/cjs/DataGrid.js
CHANGED
|
@@ -188,7 +188,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
188
188
|
children: row.expandedRowChildComponent.component
|
|
189
189
|
})
|
|
190
190
|
});
|
|
191
|
-
const buildRowContent = (row, rowId, shouldShowCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {
|
|
191
|
+
const buildRowContent = (row, rowId, shouldShowCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow, rowIndex) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {
|
|
192
192
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_DataGridRow.default, {
|
|
193
193
|
tokens: themeTokens,
|
|
194
194
|
rowId: rowId,
|
|
@@ -200,6 +200,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
200
200
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
201
201
|
hidePreviousRowBorder: row.hidePreviousRowBorder,
|
|
202
202
|
isHeaderVisible: isHeaderVisible,
|
|
203
|
+
rowIndex: rowIndex,
|
|
203
204
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledIconContainer, {
|
|
204
205
|
checkboxChevronIconGap: checkboxChevronIconGap,
|
|
205
206
|
children: [CheckBoxDisplay, DisplayCaret]
|
|
@@ -221,6 +222,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
221
222
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
222
223
|
hidePreviousRowBorder: row.hidePreviousRowBorder,
|
|
223
224
|
isHeaderVisible: isHeaderVisible,
|
|
225
|
+
rowIndex: rowIndex,
|
|
224
226
|
children: columnContent
|
|
225
227
|
}, `${rowId}-${column.key}`);
|
|
226
228
|
})]
|
|
@@ -252,7 +254,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
252
254
|
let HeaderContent = null;
|
|
253
255
|
let BodyContent = null;
|
|
254
256
|
if (groupedRows) {
|
|
255
|
-
BodyContent = Object.keys(data).map(group => {
|
|
257
|
+
BodyContent = Object.keys(data).map((group, index) => {
|
|
256
258
|
const DefaultSubHeading = /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
257
259
|
variant: {
|
|
258
260
|
size: 'h3'
|
|
@@ -267,6 +269,7 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
267
269
|
tokens: themeTokens,
|
|
268
270
|
columnsLength: columnsData.length,
|
|
269
271
|
isHeaderVisible: isHeaderVisible,
|
|
272
|
+
rowIndex: index,
|
|
270
273
|
children: data[group].groupHeaderComponent || DefaultSubHeading
|
|
271
274
|
})
|
|
272
275
|
}, group);
|
|
@@ -284,12 +287,12 @@ const DataGrid = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
|
284
287
|
});
|
|
285
288
|
} else {
|
|
286
289
|
const modifiedData = (0, _utility.hideRowBottomBorder)([...data]);
|
|
287
|
-
BodyContent = modifiedData.map(row => {
|
|
290
|
+
BodyContent = modifiedData.map((row, index) => {
|
|
288
291
|
const rowId = row.id;
|
|
289
292
|
const CheckBoxDisplay = buildCheckBoxDisplay(showCheckbox, row, rowId);
|
|
290
293
|
const DisplayCaret = buildDisplayCaret(row, rowId);
|
|
291
294
|
const ExpandedRow = buildExpandedRow(row, rowId);
|
|
292
|
-
return buildRowContent(row, rowId, showCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow);
|
|
295
|
+
return buildRowContent(row, rowId, showCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow, index);
|
|
293
296
|
});
|
|
294
297
|
}
|
|
295
298
|
const isFirstRowExpanded = data[0]?.isExpandedRowOpen;
|
package/lib/cjs/DataGridCell.js
CHANGED
|
@@ -16,7 +16,7 @@ const StyledHeaderCell = /*#__PURE__*/_styledComponents.default.th.withConfig({
|
|
|
16
16
|
displayName: "DataGridCell__StyledHeaderCell",
|
|
17
17
|
componentId: "[object Object]__sc-6nkvhz-0"
|
|
18
18
|
})(["", ""], props => {
|
|
19
|
-
return (0, _styledComponents.css)(["background-color:", ";border-top:solid ", "px ", ";border-bottom:", ";padding:", "px;padding-left:", "px;padding-right:", "px;text-align:", ";box-sizing:border-box;font-size:", "px;font-weight:bold;line-height:", "px;color:", ";width:", ";font-family:", ";"], props.headerRowBackgroundColor, props.headerBorderTopWidth, props.headerBorderTopColor,
|
|
19
|
+
return (0, _styledComponents.css)(["background-color:", ";border-top:solid ", "px ", ";border-bottom:", ";padding:", "px;padding-left:", "px;padding-right:", "px;text-align:", ";box-sizing:border-box;font-size:", "px;font-weight:bold;line-height:", "px;color:", ";width:", ";font-family:", ";"], props.headerRowBackgroundColor, props.headerBorderTopWidth, props.headerBorderTopColor, `solid ${props.headerBorderBottomWidth}px ${props.headerBorderBottomColor}`, props.headerPadding, props.headerCellHorizontalPadding, props.headerCellHorizontalPadding, props.headerTextAlign, props.headerFontSize, props.headerLineHeight * props.headerFontSize, props.headerTextColor, props.firstColWidth, props.headerFontFamily);
|
|
20
20
|
});
|
|
21
21
|
const StyledHeaderCellDiv = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
22
22
|
displayName: "DataGridCell__StyledHeaderCellDiv",
|
|
@@ -37,7 +37,7 @@ const StyledGroupHeaderCell = /*#__PURE__*/_styledComponents.default.td.withConf
|
|
|
37
37
|
displayName: "DataGridCell__StyledGroupHeaderCell",
|
|
38
38
|
componentId: "[object Object]__sc-6nkvhz-3"
|
|
39
39
|
})(["", ""], props => {
|
|
40
|
-
return (0, _styledComponents.css)(["background-color:", ";padding:", "px;border-top:
|
|
40
|
+
return (0, _styledComponents.css)(["background-color:", ";padding:", "px;border-top:", ";text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.subHeadingBackgroundColor, props.cellPadding, props.rowIndex === 0 ? 'none' : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor}`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
41
41
|
});
|
|
42
42
|
const StyledGroupHeaderCellDiv = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
43
43
|
displayName: "DataGridCell__StyledGroupHeaderCellDiv",
|
|
@@ -60,7 +60,7 @@ const StyledCell = exports.StyledCell = /*#__PURE__*/_styledComponents.default.t
|
|
|
60
60
|
componentId: "[object Object]__sc-6nkvhz-7"
|
|
61
61
|
})(["", ""], props => {
|
|
62
62
|
if (props.isExpandedRowOpen) {
|
|
63
|
-
return (0, _styledComponents.css)(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:
|
|
63
|
+
return (0, _styledComponents.css)(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:", ";"], props.cellPadding, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily, props.rowIndex === 0 ? 'none' : `solid ${props.headerBorderTopWidth}px ${props.headerBorderTopColor}`);
|
|
64
64
|
}
|
|
65
65
|
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.hideRowBottomBorder === 1 || props.hidePreviousRowBorder ? `none` : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor}`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
66
66
|
});
|
|
@@ -75,7 +75,8 @@ const DataGridCell = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
75
75
|
isExpandedRowOpen = false,
|
|
76
76
|
isHeaderVisible = true,
|
|
77
77
|
hidePreviousRowBorder = false,
|
|
78
|
-
textAlign = 'start'
|
|
78
|
+
textAlign = 'start',
|
|
79
|
+
rowIndex = null
|
|
79
80
|
} = _ref2;
|
|
80
81
|
if (type === _utility.CELL_TYPE.HEADING) {
|
|
81
82
|
return isHeaderVisible ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledHeaderCell, {
|
|
@@ -96,6 +97,7 @@ const DataGridCell = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
96
97
|
if (type === _utility.CELL_TYPE.SUBHEADING) {
|
|
97
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledGroupHeaderCell, {
|
|
98
99
|
colSpan: columnsLength + 1,
|
|
100
|
+
rowIndex: rowIndex,
|
|
99
101
|
...tokens,
|
|
100
102
|
ref: ref,
|
|
101
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledGroupHeaderCellDiv, {
|
|
@@ -122,6 +124,7 @@ const DataGridCell = /*#__PURE__*/_react.default.forwardRef((_ref2, ref) => {
|
|
|
122
124
|
isExpandedRowOpen: isExpandedRowOpen,
|
|
123
125
|
hidePreviousRowBorder: hidePreviousRowBorder,
|
|
124
126
|
ref: ref,
|
|
127
|
+
rowIndex: rowIndex,
|
|
125
128
|
children: children
|
|
126
129
|
});
|
|
127
130
|
});
|
|
@@ -166,6 +169,10 @@ DataGridCell.propTypes = {
|
|
|
166
169
|
/**
|
|
167
170
|
* Passed to the component to determine the header text alignment
|
|
168
171
|
*/
|
|
169
|
-
textAlign: _propTypes.default.oneOf(['start', 'center', 'end'])
|
|
172
|
+
textAlign: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
173
|
+
/**
|
|
174
|
+
* rowIndex passed to the component for certain scenarios in which row index is required
|
|
175
|
+
*/
|
|
176
|
+
rowIndex: _propTypes.default.number
|
|
170
177
|
};
|
|
171
178
|
var _default = exports.default = DataGridCell;
|
package/lib/cjs/DataGridTable.js
CHANGED
|
@@ -14,11 +14,11 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
14
14
|
const StyledWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
15
15
|
displayName: "DataGridTable__StyledWrapper",
|
|
16
16
|
componentId: "[object Object]__sc-aw7n7n-0"
|
|
17
|
-
})(["display:flex;width:100%;margin:0px;padding:
|
|
17
|
+
})(["display:flex;width:100%;margin:0px;padding:9px;", " box-sizing:border-box;border:0px solid #000000;overflow-y:auto;"], props => props.tokens.maxHeight && (0, _styledComponents.css)(["max-height:", "px;"], props.tokens.maxHeight));
|
|
18
18
|
const StyledTable = /*#__PURE__*/_styledComponents.default.table.withConfig({
|
|
19
19
|
displayName: "DataGridTable__StyledTable",
|
|
20
20
|
componentId: "[object Object]__sc-aw7n7n-1"
|
|
21
|
-
})(["width:100%;border-spacing:0;"]);
|
|
21
|
+
})(["width:100%;border-spacing:0;border-collapse:separate;"]);
|
|
22
22
|
const DataGridTable = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
|
|
23
23
|
let {
|
|
24
24
|
children,
|
package/lib/esm/DataGrid.js
CHANGED
|
@@ -179,7 +179,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
179
179
|
children: row.expandedRowChildComponent.component
|
|
180
180
|
})
|
|
181
181
|
});
|
|
182
|
-
const buildRowContent = (row, rowId, shouldShowCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow) => /*#__PURE__*/_jsxs(React.Fragment, {
|
|
182
|
+
const buildRowContent = (row, rowId, shouldShowCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow, rowIndex) => /*#__PURE__*/_jsxs(React.Fragment, {
|
|
183
183
|
children: [/*#__PURE__*/_jsxs(DataGridRow, {
|
|
184
184
|
tokens: themeTokens,
|
|
185
185
|
rowId: rowId,
|
|
@@ -191,6 +191,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
191
191
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
192
192
|
hidePreviousRowBorder: row.hidePreviousRowBorder,
|
|
193
193
|
isHeaderVisible: isHeaderVisible,
|
|
194
|
+
rowIndex: rowIndex,
|
|
194
195
|
children: /*#__PURE__*/_jsxs(StyledIconContainer, {
|
|
195
196
|
checkboxChevronIconGap: checkboxChevronIconGap,
|
|
196
197
|
children: [CheckBoxDisplay, DisplayCaret]
|
|
@@ -212,6 +213,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
212
213
|
isExpandedRowOpen: row.isExpandedRowOpen,
|
|
213
214
|
hidePreviousRowBorder: row.hidePreviousRowBorder,
|
|
214
215
|
isHeaderVisible: isHeaderVisible,
|
|
216
|
+
rowIndex: rowIndex,
|
|
215
217
|
children: columnContent
|
|
216
218
|
}, `${rowId}-${column.key}`);
|
|
217
219
|
})]
|
|
@@ -243,7 +245,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
243
245
|
let HeaderContent = null;
|
|
244
246
|
let BodyContent = null;
|
|
245
247
|
if (groupedRows) {
|
|
246
|
-
BodyContent = Object.keys(data).map(group => {
|
|
248
|
+
BodyContent = Object.keys(data).map((group, index) => {
|
|
247
249
|
const DefaultSubHeading = /*#__PURE__*/_jsx(Typography, {
|
|
248
250
|
variant: {
|
|
249
251
|
size: 'h3'
|
|
@@ -258,6 +260,7 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
258
260
|
tokens: themeTokens,
|
|
259
261
|
columnsLength: columnsData.length,
|
|
260
262
|
isHeaderVisible: isHeaderVisible,
|
|
263
|
+
rowIndex: index,
|
|
261
264
|
children: data[group].groupHeaderComponent || DefaultSubHeading
|
|
262
265
|
})
|
|
263
266
|
}, group);
|
|
@@ -275,12 +278,12 @@ const DataGrid = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
275
278
|
});
|
|
276
279
|
} else {
|
|
277
280
|
const modifiedData = hideRowBottomBorder([...data]);
|
|
278
|
-
BodyContent = modifiedData.map(row => {
|
|
281
|
+
BodyContent = modifiedData.map((row, index) => {
|
|
279
282
|
const rowId = row.id;
|
|
280
283
|
const CheckBoxDisplay = buildCheckBoxDisplay(showCheckbox, row, rowId);
|
|
281
284
|
const DisplayCaret = buildDisplayCaret(row, rowId);
|
|
282
285
|
const ExpandedRow = buildExpandedRow(row, rowId);
|
|
283
|
-
return buildRowContent(row, rowId, showCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow);
|
|
286
|
+
return buildRowContent(row, rowId, showCheckbox, CheckBoxDisplay, DisplayCaret, ExpandedRow, index);
|
|
284
287
|
});
|
|
285
288
|
}
|
|
286
289
|
const isFirstRowExpanded = data[0]?.isExpandedRowOpen;
|
package/lib/esm/DataGridCell.js
CHANGED
|
@@ -7,7 +7,7 @@ const StyledHeaderCell = /*#__PURE__*/styled.th.withConfig({
|
|
|
7
7
|
displayName: "DataGridCell__StyledHeaderCell",
|
|
8
8
|
componentId: "[object Object]__sc-6nkvhz-0"
|
|
9
9
|
})(["", ""], props => {
|
|
10
|
-
return css(["background-color:", ";border-top:solid ", "px ", ";border-bottom:", ";padding:", "px;padding-left:", "px;padding-right:", "px;text-align:", ";box-sizing:border-box;font-size:", "px;font-weight:bold;line-height:", "px;color:", ";width:", ";font-family:", ";"], props.headerRowBackgroundColor, props.headerBorderTopWidth, props.headerBorderTopColor,
|
|
10
|
+
return css(["background-color:", ";border-top:solid ", "px ", ";border-bottom:", ";padding:", "px;padding-left:", "px;padding-right:", "px;text-align:", ";box-sizing:border-box;font-size:", "px;font-weight:bold;line-height:", "px;color:", ";width:", ";font-family:", ";"], props.headerRowBackgroundColor, props.headerBorderTopWidth, props.headerBorderTopColor, `solid ${props.headerBorderBottomWidth}px ${props.headerBorderBottomColor}`, props.headerPadding, props.headerCellHorizontalPadding, props.headerCellHorizontalPadding, props.headerTextAlign, props.headerFontSize, props.headerLineHeight * props.headerFontSize, props.headerTextColor, props.firstColWidth, props.headerFontFamily);
|
|
11
11
|
});
|
|
12
12
|
const StyledHeaderCellDiv = /*#__PURE__*/styled.div.withConfig({
|
|
13
13
|
displayName: "DataGridCell__StyledHeaderCellDiv",
|
|
@@ -28,7 +28,7 @@ const StyledGroupHeaderCell = /*#__PURE__*/styled.td.withConfig({
|
|
|
28
28
|
displayName: "DataGridCell__StyledGroupHeaderCell",
|
|
29
29
|
componentId: "[object Object]__sc-6nkvhz-3"
|
|
30
30
|
})(["", ""], props => {
|
|
31
|
-
return css(["background-color:", ";padding:", "px;border-top:
|
|
31
|
+
return css(["background-color:", ";padding:", "px;border-top:", ";text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.subHeadingBackgroundColor, props.cellPadding, props.rowIndex === 0 ? 'none' : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor}`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
32
32
|
});
|
|
33
33
|
const StyledGroupHeaderCellDiv = /*#__PURE__*/styled.div.withConfig({
|
|
34
34
|
displayName: "DataGridCell__StyledGroupHeaderCellDiv",
|
|
@@ -51,7 +51,7 @@ export const StyledCell = /*#__PURE__*/styled.td.withConfig({
|
|
|
51
51
|
componentId: "[object Object]__sc-6nkvhz-7"
|
|
52
52
|
})(["", ""], props => {
|
|
53
53
|
if (props.isExpandedRowOpen) {
|
|
54
|
-
return css(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:
|
|
54
|
+
return css(["padding:", "px;text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";border-top:", ";"], props.cellPadding, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily, props.rowIndex === 0 ? 'none' : `solid ${props.headerBorderTopWidth}px ${props.headerBorderTopColor}`);
|
|
55
55
|
}
|
|
56
56
|
return css(["padding:", "px;border-bottom:", ";text-align:", ";font-size:", "px;font-weight:normal;line-height:", "px;color:", ";font-family:", ";"], props.cellPadding, props.hideRowBottomBorder === 1 || props.hidePreviousRowBorder ? `none` : `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor}`, props.cellTextAlign, props.cellFontSize, props.cellLineHeight * props.cellFontSize, props.cellTextColor, props.cellFontFamily);
|
|
57
57
|
});
|
|
@@ -66,7 +66,8 @@ const DataGridCell = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
66
66
|
isExpandedRowOpen = false,
|
|
67
67
|
isHeaderVisible = true,
|
|
68
68
|
hidePreviousRowBorder = false,
|
|
69
|
-
textAlign = 'start'
|
|
69
|
+
textAlign = 'start',
|
|
70
|
+
rowIndex = null
|
|
70
71
|
} = _ref2;
|
|
71
72
|
if (type === CELL_TYPE.HEADING) {
|
|
72
73
|
return isHeaderVisible ? /*#__PURE__*/_jsx(StyledHeaderCell, {
|
|
@@ -87,6 +88,7 @@ const DataGridCell = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
87
88
|
if (type === CELL_TYPE.SUBHEADING) {
|
|
88
89
|
return /*#__PURE__*/_jsx(StyledGroupHeaderCell, {
|
|
89
90
|
colSpan: columnsLength + 1,
|
|
91
|
+
rowIndex: rowIndex,
|
|
90
92
|
...tokens,
|
|
91
93
|
ref: ref,
|
|
92
94
|
children: /*#__PURE__*/_jsx(StyledGroupHeaderCellDiv, {
|
|
@@ -113,6 +115,7 @@ const DataGridCell = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
113
115
|
isExpandedRowOpen: isExpandedRowOpen,
|
|
114
116
|
hidePreviousRowBorder: hidePreviousRowBorder,
|
|
115
117
|
ref: ref,
|
|
118
|
+
rowIndex: rowIndex,
|
|
116
119
|
children: children
|
|
117
120
|
});
|
|
118
121
|
});
|
|
@@ -157,6 +160,10 @@ DataGridCell.propTypes = {
|
|
|
157
160
|
/**
|
|
158
161
|
* Passed to the component to determine the header text alignment
|
|
159
162
|
*/
|
|
160
|
-
textAlign: PropTypes.oneOf(['start', 'center', 'end'])
|
|
163
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
164
|
+
/**
|
|
165
|
+
* rowIndex passed to the component for certain scenarios in which row index is required
|
|
166
|
+
*/
|
|
167
|
+
rowIndex: PropTypes.number
|
|
161
168
|
};
|
|
162
169
|
export default DataGridCell;
|
package/lib/esm/DataGridTable.js
CHANGED
|
@@ -5,11 +5,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
const StyledWrapper = /*#__PURE__*/styled.div.withConfig({
|
|
6
6
|
displayName: "DataGridTable__StyledWrapper",
|
|
7
7
|
componentId: "[object Object]__sc-aw7n7n-0"
|
|
8
|
-
})(["display:flex;width:100%;margin:0px;padding:
|
|
8
|
+
})(["display:flex;width:100%;margin:0px;padding:9px;", " box-sizing:border-box;border:0px solid #000000;overflow-y:auto;"], props => props.tokens.maxHeight && css(["max-height:", "px;"], props.tokens.maxHeight));
|
|
9
9
|
const StyledTable = /*#__PURE__*/styled.table.withConfig({
|
|
10
10
|
displayName: "DataGridTable__StyledTable",
|
|
11
11
|
componentId: "[object Object]__sc-aw7n7n-1"
|
|
12
|
-
})(["width:100%;border-spacing:0;"]);
|
|
12
|
+
})(["width:100%;border-spacing:0;border-collapse:separate;"]);
|
|
13
13
|
const DataGridTable = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
14
14
|
let {
|
|
15
15
|
children,
|
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.12.
|
|
9
|
-
"@telus-uds/components-base": "^3.
|
|
10
|
-
"@telus-uds/system-theme-tokens": "^4.
|
|
8
|
+
"@telus-uds/components-web": "^4.12.3",
|
|
9
|
+
"@telus-uds/components-base": "^3.19.0",
|
|
10
|
+
"@telus-uds/system-theme-tokens": "^4.15.0",
|
|
11
11
|
"styled-components": "6.1.13"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"standard-engine": {
|
|
45
45
|
"skip": true
|
|
46
46
|
},
|
|
47
|
-
"version": "1.
|
|
47
|
+
"version": "1.7.0"
|
|
48
48
|
}
|
package/src/DataGrid.jsx
CHANGED
|
@@ -242,7 +242,8 @@ const DataGrid = React.forwardRef(
|
|
|
242
242
|
shouldShowCheckbox,
|
|
243
243
|
CheckBoxDisplay,
|
|
244
244
|
DisplayCaret,
|
|
245
|
-
ExpandedRow
|
|
245
|
+
ExpandedRow,
|
|
246
|
+
rowIndex
|
|
246
247
|
) => (
|
|
247
248
|
<React.Fragment key={rowId}>
|
|
248
249
|
<DataGridRow
|
|
@@ -259,6 +260,7 @@ const DataGrid = React.forwardRef(
|
|
|
259
260
|
isExpandedRowOpen={row.isExpandedRowOpen}
|
|
260
261
|
hidePreviousRowBorder={row.hidePreviousRowBorder}
|
|
261
262
|
isHeaderVisible={isHeaderVisible}
|
|
263
|
+
rowIndex={rowIndex}
|
|
262
264
|
>
|
|
263
265
|
<StyledIconContainer checkboxChevronIconGap={checkboxChevronIconGap}>
|
|
264
266
|
{CheckBoxDisplay}
|
|
@@ -287,6 +289,7 @@ const DataGrid = React.forwardRef(
|
|
|
287
289
|
hidePreviousRowBorder={row.hidePreviousRowBorder}
|
|
288
290
|
isHeaderVisible={isHeaderVisible}
|
|
289
291
|
key={`${rowId}-${column.key}`}
|
|
292
|
+
rowIndex={rowIndex}
|
|
290
293
|
>
|
|
291
294
|
{columnContent}
|
|
292
295
|
</DataGridCell>
|
|
@@ -335,7 +338,7 @@ const DataGrid = React.forwardRef(
|
|
|
335
338
|
let HeaderContent = null
|
|
336
339
|
let BodyContent = null
|
|
337
340
|
if (groupedRows) {
|
|
338
|
-
BodyContent = Object.keys(data).map((group) => {
|
|
341
|
+
BodyContent = Object.keys(data).map((group, index) => {
|
|
339
342
|
const DefaultSubHeading = (
|
|
340
343
|
<Typography variant={{ size: 'h3' }}>{data[group].name}</Typography>
|
|
341
344
|
)
|
|
@@ -346,6 +349,7 @@ const DataGrid = React.forwardRef(
|
|
|
346
349
|
tokens={themeTokens}
|
|
347
350
|
columnsLength={columnsData.length}
|
|
348
351
|
isHeaderVisible={isHeaderVisible}
|
|
352
|
+
rowIndex={index}
|
|
349
353
|
>
|
|
350
354
|
{data[group].groupHeaderComponent || DefaultSubHeading}
|
|
351
355
|
</DataGridCell>
|
|
@@ -379,7 +383,7 @@ const DataGrid = React.forwardRef(
|
|
|
379
383
|
})
|
|
380
384
|
} else {
|
|
381
385
|
const modifiedData = hideRowBottomBorder([...data])
|
|
382
|
-
BodyContent = modifiedData.map((row) => {
|
|
386
|
+
BodyContent = modifiedData.map((row, index) => {
|
|
383
387
|
const rowId = row.id
|
|
384
388
|
|
|
385
389
|
const CheckBoxDisplay = buildCheckBoxDisplay(showCheckbox, row, rowId)
|
|
@@ -388,7 +392,15 @@ const DataGrid = React.forwardRef(
|
|
|
388
392
|
|
|
389
393
|
const ExpandedRow = buildExpandedRow(row, rowId)
|
|
390
394
|
|
|
391
|
-
return buildRowContent(
|
|
395
|
+
return buildRowContent(
|
|
396
|
+
row,
|
|
397
|
+
rowId,
|
|
398
|
+
showCheckbox,
|
|
399
|
+
CheckBoxDisplay,
|
|
400
|
+
DisplayCaret,
|
|
401
|
+
ExpandedRow,
|
|
402
|
+
index
|
|
403
|
+
)
|
|
392
404
|
})
|
|
393
405
|
}
|
|
394
406
|
|
package/src/DataGridCell.jsx
CHANGED
|
@@ -8,9 +8,7 @@ const StyledHeaderCell = styled.th`
|
|
|
8
8
|
return css`
|
|
9
9
|
background-color: ${props.headerRowBackgroundColor};
|
|
10
10
|
border-top: solid ${props.headerBorderTopWidth}px ${props.headerBorderTopColor};
|
|
11
|
-
border-bottom: ${props.
|
|
12
|
-
? `none`
|
|
13
|
-
: `solid ${props.headerBorderBottomWidth}px ${props.headerBorderBottomColor}`};
|
|
11
|
+
border-bottom: ${`solid ${props.headerBorderBottomWidth}px ${props.headerBorderBottomColor}`};
|
|
14
12
|
padding: ${props.headerPadding}px;
|
|
15
13
|
padding-left: ${props.headerCellHorizontalPadding}px;
|
|
16
14
|
padding-right: ${props.headerCellHorizontalPadding}px;
|
|
@@ -47,7 +45,9 @@ const StyledGroupHeaderCell = styled.td`
|
|
|
47
45
|
return css`
|
|
48
46
|
background-color: ${props.subHeadingBackgroundColor};
|
|
49
47
|
padding: ${props.cellPadding}px;
|
|
50
|
-
border-top:
|
|
48
|
+
border-top: ${props.rowIndex === 0
|
|
49
|
+
? 'none'
|
|
50
|
+
: `solid ${props.cellBorderBottomWidth}px ${props.cellBorderBottomColor}`};
|
|
51
51
|
text-align: ${props.cellTextAlign};
|
|
52
52
|
font-size: ${props.cellFontSize}px;
|
|
53
53
|
font-weight: normal;
|
|
@@ -106,7 +106,9 @@ export const StyledCell = styled.td`
|
|
|
106
106
|
line-height: ${props.cellLineHeight * props.cellFontSize}px;
|
|
107
107
|
color: ${props.cellTextColor};
|
|
108
108
|
font-family: ${props.cellFontFamily};
|
|
109
|
-
border-top:
|
|
109
|
+
border-top: ${props.rowIndex === 0
|
|
110
|
+
? 'none'
|
|
111
|
+
: `solid ${props.headerBorderTopWidth}px ${props.headerBorderTopColor}`};
|
|
110
112
|
`
|
|
111
113
|
}
|
|
112
114
|
return css`
|
|
@@ -136,7 +138,8 @@ const DataGridCell = React.forwardRef(
|
|
|
136
138
|
isExpandedRowOpen = false,
|
|
137
139
|
isHeaderVisible = true,
|
|
138
140
|
hidePreviousRowBorder = false,
|
|
139
|
-
textAlign = 'start'
|
|
141
|
+
textAlign = 'start',
|
|
142
|
+
rowIndex = null
|
|
140
143
|
},
|
|
141
144
|
ref
|
|
142
145
|
) => {
|
|
@@ -160,7 +163,12 @@ const DataGridCell = React.forwardRef(
|
|
|
160
163
|
}
|
|
161
164
|
if (type === CELL_TYPE.SUBHEADING) {
|
|
162
165
|
return (
|
|
163
|
-
<StyledGroupHeaderCell
|
|
166
|
+
<StyledGroupHeaderCell
|
|
167
|
+
colSpan={columnsLength + 1}
|
|
168
|
+
rowIndex={rowIndex}
|
|
169
|
+
{...tokens}
|
|
170
|
+
ref={ref}
|
|
171
|
+
>
|
|
164
172
|
<StyledGroupHeaderCellDiv {...tokens}>{children}</StyledGroupHeaderCellDiv>
|
|
165
173
|
</StyledGroupHeaderCell>
|
|
166
174
|
)
|
|
@@ -185,6 +193,7 @@ const DataGridCell = React.forwardRef(
|
|
|
185
193
|
isExpandedRowOpen={isExpandedRowOpen}
|
|
186
194
|
hidePreviousRowBorder={hidePreviousRowBorder}
|
|
187
195
|
ref={ref}
|
|
196
|
+
rowIndex={rowIndex}
|
|
188
197
|
>
|
|
189
198
|
{children}
|
|
190
199
|
</StyledCell>
|
|
@@ -234,7 +243,11 @@ DataGridCell.propTypes = {
|
|
|
234
243
|
/**
|
|
235
244
|
* Passed to the component to determine the header text alignment
|
|
236
245
|
*/
|
|
237
|
-
textAlign: PropTypes.oneOf(['start', 'center', 'end'])
|
|
246
|
+
textAlign: PropTypes.oneOf(['start', 'center', 'end']),
|
|
247
|
+
/**
|
|
248
|
+
* rowIndex passed to the component for certain scenarios in which row index is required
|
|
249
|
+
*/
|
|
250
|
+
rowIndex: PropTypes.number
|
|
238
251
|
}
|
|
239
252
|
|
|
240
253
|
export default DataGridCell
|
package/src/DataGridTable.jsx
CHANGED
|
@@ -6,7 +6,7 @@ const StyledWrapper = styled.div`
|
|
|
6
6
|
display: flex;
|
|
7
7
|
width: 100%;
|
|
8
8
|
margin: 0px;
|
|
9
|
-
padding:
|
|
9
|
+
padding: 9px;
|
|
10
10
|
${(props) =>
|
|
11
11
|
props.tokens.maxHeight &&
|
|
12
12
|
css`
|
|
@@ -20,6 +20,7 @@ const StyledWrapper = styled.div`
|
|
|
20
20
|
const StyledTable = styled.table`
|
|
21
21
|
width: 100%;
|
|
22
22
|
border-spacing: 0;
|
|
23
|
+
border-collapse: separate;
|
|
23
24
|
`
|
|
24
25
|
|
|
25
26
|
const DataGridTable = React.forwardRef(({ children, tokens, testID }, ref) => {
|