lightning-base-components 1.14.3-alpha → 1.15.1-alpha

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 (152) hide show
  1. package/metadata/raptor.json +37 -4
  2. package/package.json +11 -4
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/scopedImports/@salesforce-label-LightningModalBase.cancelandclose.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningProgressBar.progressBar.js +1 -0
  6. package/src/lightning/alert/__docs__/alert.md +101 -0
  7. package/src/lightning/alert/__examples__disabled/basic/basic.css +7 -0
  8. package/src/lightning/alert/__examples__disabled/basic/basic.html +8 -0
  9. package/src/lightning/alert/__examples__disabled/basic/basic.js +14 -0
  10. package/src/lightning/alert/alert.html +3 -0
  11. package/src/lightning/alert/alert.js +78 -0
  12. package/src/lightning/alert/alert.js-meta.xml +6 -0
  13. package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +9 -0
  14. package/src/lightning/ariaObserver/ariaObserver.js +24 -35
  15. package/src/lightning/baseFormattedText/baseFormattedText.html +6 -1
  16. package/src/lightning/baseFormattedText/baseFormattedText.js +5 -0
  17. package/src/lightning/button/__wdio__/utam/utam.html +3 -0
  18. package/src/lightning/button/__wdio__/utam/utam.js +3 -0
  19. package/src/lightning/button/__wdio__/utam/utam.spec.js +20 -0
  20. package/src/lightning/buttonMenu/buttonMenu.js +12 -0
  21. package/src/lightning/confirm/__docs__/confirm.md +100 -0
  22. package/src/lightning/confirm/__examples__disabled/basic/basic.css +7 -0
  23. package/src/lightning/confirm/__examples__disabled/basic/basic.html +8 -0
  24. package/src/lightning/confirm/__examples__disabled/basic/basic.js +14 -0
  25. package/src/lightning/confirm/confirm.html +3 -0
  26. package/src/lightning/confirm/confirm.js +80 -0
  27. package/src/lightning/confirm/confirm.js-meta.xml +6 -0
  28. package/src/lightning/datatable/__examples__/withInfiniteLoading/fetchDataHelper.js +21 -0
  29. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.html +13 -0
  30. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.js +42 -0
  31. package/src/lightning/datatable/__wdio__/utam/utam.html +17 -0
  32. package/src/lightning/datatable/__wdio__/utam/utam.js +91 -0
  33. package/src/lightning/datatable/__wdio__/utam/utam.spec.js +189 -0
  34. package/src/lightning/datatable/autoWidthStrategy.js +170 -61
  35. package/src/lightning/datatable/{resizer.js → columnResizer.js} +0 -0
  36. package/src/lightning/datatable/columnWidthManager.js +226 -44
  37. package/src/lightning/datatable/columns.js +166 -71
  38. package/src/lightning/datatable/datatable.js +136 -60
  39. package/src/lightning/datatable/fixedWidthStrategy.js +43 -8
  40. package/src/lightning/datatable/headerActions.js +2 -2
  41. package/src/lightning/datatable/infiniteLoading.js +100 -28
  42. package/src/lightning/datatable/inlineEdit.js +21 -30
  43. package/src/lightning/datatable/keyboard.js +166 -131
  44. package/src/lightning/datatable/renderManager.js +117 -122
  45. package/src/lightning/datatable/{datatableResizeObserver.js → resizeObserver.js} +46 -29
  46. package/src/lightning/datatable/resizeSensor.js +19 -3
  47. package/src/lightning/datatable/rowSelection.js +1 -1
  48. package/src/lightning/datatable/rowSelectionShared.js +33 -20
  49. package/src/lightning/datatable/rows.js +9 -8
  50. package/src/lightning/datatable/sort.js +8 -8
  51. package/src/lightning/datatable/state.js +14 -2
  52. package/src/lightning/datatable/templates/div/div.html +133 -119
  53. package/src/lightning/datatable/templates/table/table.html +10 -2
  54. package/src/lightning/datatable/tree.js +25 -0
  55. package/src/lightning/datatable/types.js +77 -9
  56. package/src/lightning/datatable/utils.js +51 -24
  57. package/src/lightning/datatable/virtualization.js +319 -0
  58. package/src/lightning/datatable/widthManagerShared.js +27 -3
  59. package/src/lightning/datatable/wrapText.js +115 -48
  60. package/src/lightning/datepicker/__perf__DISABLED/datepickerWithCalendarOpen.perf.js +55 -0
  61. package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +36 -3
  62. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.html +2 -2
  63. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.js +3 -1
  64. package/src/lightning/formattedDateTime/__examples__/time/time.html +1 -1
  65. package/src/lightning/formattedDateTime/__examples__/time/time.js +3 -1
  66. package/src/lightning/formattedDateTime/formattedDateTime.js +1 -0
  67. package/src/lightning/iconSvgTemplates/buildTemplates/standard/dashboard_component.html +7 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/standard/slack.html +7 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tableau.html +7 -0
  70. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  71. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +8 -1
  72. package/src/lightning/iconSvgTemplates/buildTemplates/utility/data_model.html +7 -0
  73. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product.html +1 -1
  74. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product_transaction.html +2 -1
  75. package/src/lightning/iconSvgTemplates/buildTemplates/utility/slack.html +7 -0
  76. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tableau.html +7 -0
  77. package/src/lightning/iconSvgTemplates/buildTemplates/utility/video_off.html +7 -0
  78. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/dashboard_component.html +7 -0
  79. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/slack.html +7 -0
  80. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tableau.html +7 -0
  81. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  82. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +8 -1
  83. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/data_model.html +7 -0
  84. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product.html +1 -1
  85. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  86. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/slack.html +7 -0
  87. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tableau.html +7 -0
  88. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/video_off.html +7 -0
  89. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/dashboard_component.html +7 -0
  90. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/slack.html +7 -0
  91. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tableau.html +7 -0
  92. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  93. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +4 -1
  94. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/dashboard_component.html +7 -0
  95. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/slack.html +7 -0
  96. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tableau.html +7 -0
  97. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  98. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +4 -1
  99. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +5 -1
  100. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/data_model.html +7 -0
  101. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product.html +1 -1
  102. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product_transaction.html +2 -1
  103. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/slack.html +7 -0
  104. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tableau.html +7 -0
  105. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/video_off.html +7 -0
  106. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +5 -1
  107. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/data_model.html +7 -0
  108. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product.html +1 -1
  109. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  110. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/slack.html +7 -0
  111. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tableau.html +7 -0
  112. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/video_off.html +7 -0
  113. package/src/lightning/input/__docs__/input.md +2 -0
  114. package/src/lightning/input/input.html +2 -5
  115. package/src/lightning/interactiveDialogBase/interactiveDialogBase.css +494 -0
  116. package/src/lightning/interactiveDialogBase/interactiveDialogBase.html +63 -0
  117. package/src/lightning/interactiveDialogBase/interactiveDialogBase.js +200 -0
  118. package/src/lightning/menuItem/menuItem.js +4 -1
  119. package/src/lightning/modalBase/modalBase.css +20 -0
  120. package/src/lightning/modalBase/modalBase.html +54 -0
  121. package/src/lightning/modalBase/modalBase.js +1039 -0
  122. package/src/lightning/overlay/__docs__/overlay.md +90 -0
  123. package/src/lightning/overlay/__examples__/alert/alert.html +27 -0
  124. package/src/lightning/overlay/__examples__/alert/alert.js +33 -0
  125. package/src/lightning/overlay/__examples__/basic/basic.css +7 -0
  126. package/src/lightning/overlay/__examples__/basic/basic.html +18 -0
  127. package/src/lightning/overlay/__examples__/basic/basic.js +61 -0
  128. package/src/lightning/overlay/__examples__/demo/demo.html +29 -0
  129. package/src/lightning/overlay/__examples__/demo/demo.js +40 -0
  130. package/src/lightning/overlay/__examples__/panel/panel.html +17 -0
  131. package/src/lightning/overlay/__examples__/panel/panel.js +21 -0
  132. package/src/lightning/overlay/overlay.html +3 -0
  133. package/src/lightning/overlay/overlay.js +45 -0
  134. package/src/lightning/overlayContainer/__docs__/overlayContainer.md +0 -0
  135. package/src/lightning/overlayContainer/overlayContainer.html +3 -0
  136. package/src/lightning/overlayContainer/overlayContainer.js +138 -0
  137. package/src/lightning/overlayManager/overlayManager.js +54 -0
  138. package/src/lightning/overlayUtils/overlayUtils.js +17 -0
  139. package/src/lightning/progressBar/progressBar.html +2 -1
  140. package/src/lightning/progressBar/progressBar.js +18 -1
  141. package/src/lightning/prompt/__docs__/prompt.md +102 -0
  142. package/src/lightning/prompt/__examples__disabled/basic/basic.css +7 -0
  143. package/src/lightning/prompt/__examples__disabled/basic/basic.html +8 -0
  144. package/src/lightning/prompt/__examples__disabled/basic/basic.js +15 -0
  145. package/src/lightning/prompt/prompt.css +81 -0
  146. package/src/lightning/prompt/prompt.html +8 -0
  147. package/src/lightning/prompt/prompt.js +92 -0
  148. package/src/lightning/prompt/prompt.js-meta.xml +6 -0
  149. package/src/lightning/spinner/spinner.html +1 -1
  150. package/src/lightning/spinner/spinner.js +12 -0
  151. package/src/lightning/utilsPrivate/phonify.js +1 -1
  152. package/scopedImports/@salesforce-label-LightningModalBase.close.js +0 -1
@@ -18,7 +18,6 @@ import {
18
18
  import { isRowNumberColumn, getRowNumberErrorColumnDef } from './rowNumber';
19
19
  import { getRowError } from './errors';
20
20
  import { getDirtyValueFromCell } from './inlineEditShared';
21
- import { DEFAULT_ROW_HEIGHT } from './renderManager';
22
21
 
23
22
  export function getData(state) {
24
23
  return state.data;
@@ -77,8 +76,7 @@ export function resolveRowClassNames(row) {
77
76
  * @param {object} state - data table state
78
77
  * @param {string} rowKeyValue - computed id for the row
79
78
  * @param {string} colKeyValue - computed id for the column
80
- *
81
- * @return {object} The user row that its related to the action.
79
+ * @returns {object} The user row that its related to the action.
82
80
  */
83
81
  export function getUserRowByCellKeys(state, rowKeyValue, colKeyValue) {
84
82
  const rowIndex = state.indexes[rowKeyValue][colKeyValue][0];
@@ -115,8 +113,8 @@ export function uniqueRowKeyGenerator(keyField) {
115
113
  * @param {object} state - the current datatable state
116
114
  */
117
115
  export function updateRowsAndCellIndexes() {
118
- const { state, privateTypes: types, _virtualize } = this;
119
- const { keyField, renderModeRoleBased } = state;
116
+ const { state, privateTypes: types } = this;
117
+ const { keyField, renderModeRoleBased, virtualize, rowHeight } = state;
120
118
  const data = getData(state);
121
119
  const columns = getColumns(state);
122
120
  const computeUniqueRowKey = uniqueRowKeyGenerator(keyField);
@@ -135,6 +133,9 @@ export function updateRowsAndCellIndexes() {
135
133
 
136
134
  state.indexes[row.key] = { rowIndex };
137
135
 
136
+ row.rowIndex = rowIndex;
137
+ row.rowNumber = rowIndex + 1; // for UTAM since methods are base-1
138
+ row.ariaRowIndex = rowIndex + 2; // aria attrs are base-1 and also count header as a row
138
139
  row.inputType = getRowSelectionInputType(state);
139
140
  row.isSelected = isSelectedRow(state, row.key);
140
141
  row.ariaSelected = row.isSelected ? 'true' : false;
@@ -142,10 +143,10 @@ export function updateRowsAndCellIndexes() {
142
143
  row.classnames = resolveRowClassNames(row);
143
144
  Object.assign(row, getRowStateForTree(rowData, state));
144
145
  row.tabIndex = -1;
145
- if (_virtualize) {
146
+ if (virtualize) {
146
147
  row.style = styleToString({
147
148
  position: 'absolute',
148
- top: `${rowIndex * DEFAULT_ROW_HEIGHT}px`,
149
+ top: `${rowIndex * rowHeight}px`,
149
150
  });
150
151
  }
151
152
 
@@ -402,7 +403,7 @@ function computeCellEditable(row, column) {
402
403
  * @param {object} row - a row data object stored in datatable state. Must be truthy.
403
404
  * @param {object} column - a column data object stored in datatable state. Must be truthy.
404
405
  */
405
- function isCellEditable(row, column) {
406
+ export function isCellEditable(row, column) {
406
407
  return !!resolveAttributeValue(column.editable, row);
407
408
  }
408
409
 
@@ -10,8 +10,8 @@ const VALID_SORT_DIRECTIONS = {
10
10
  * Determines if the supplied sort direction is valid.
11
11
  * Refer to `VALID_SORT_DIRECTIONS` for valid solid directions.
12
12
  *
13
- * @param {string} value The sort direction to validate
14
- * @return {boolean} Whether the supplied sort direction is valid
13
+ * @param {String} value The sort direction to validate
14
+ * @returns {Boolean} Whether the supplied sort direction is valid
15
15
  */
16
16
  export function isValidSortDirection(value) {
17
17
  return !!VALID_SORT_DIRECTIONS[value];
@@ -22,7 +22,7 @@ export function isValidSortDirection(value) {
22
22
  * the default sort direction is applied first. Clicking again reverses it
23
23
  *
24
24
  * @param {Object} state The current datatable state
25
- * @return {string} The default sort direction
25
+ * @returns {String} The default sort direction
26
26
  */
27
27
  export function getDefaultSortDirection(state) {
28
28
  return state.defaultSortDirection;
@@ -33,7 +33,7 @@ export function getDefaultSortDirection(state) {
33
33
  * the default sort direction is applied first. Clicking again reverses it
34
34
  *
35
35
  * @param {Object} state The current datatable state
36
- * @param {string} value The value to update the default sort direction to
36
+ * @param {String} value The value to update the default sort direction to
37
37
  */
38
38
  export function setDefaultSortDirection(state, value) {
39
39
  assert(
@@ -51,7 +51,7 @@ export function setDefaultSortDirection(state, value) {
51
51
  * Gets the current sort direction
52
52
  *
53
53
  * @param {Object} state The current datatable state
54
- * @return {string} The current sort direction
54
+ * @returns {String} The current sort direction
55
55
  */
56
56
  export function getSortedDirection(state) {
57
57
  return state.sortedDirection;
@@ -64,7 +64,7 @@ export function getSortedDirection(state) {
64
64
  * `sortedDirection` will be `undefined`
65
65
  *
66
66
  * @param {Object} state The current datatable state
67
- * @param {string} value The value to update the sort direction to
67
+ * @param {String} value The value to update the sort direction to
68
68
  */
69
69
  export function setSortedDirection(state, value) {
70
70
  assert(
@@ -81,7 +81,7 @@ export function setSortedDirection(state, value) {
81
81
  * of a given column in the datatable
82
82
  *
83
83
  * @param {Object} state The current datatable state
84
- * @return {string} The current sort value
84
+ * @returns {String} The current sort value
85
85
  */
86
86
  export function getSortedBy(state) {
87
87
  return state.sortedBy;
@@ -94,7 +94,7 @@ export function getSortedBy(state) {
94
94
  * to `undefined`
95
95
  *
96
96
  * @param {Object} state The current datatable state
97
- * @param {string} value The value to update the sort state to
97
+ * @param {String} value The value to update the sort state to
98
98
  */
99
99
  export function setSortedBy(state, value) {
100
100
  if (typeof value === 'string') {
@@ -3,7 +3,8 @@
3
3
  * The state object is further manipulated while it is passed around by datatable
4
4
  *
5
5
  * TODO: Check to see if there are other items that need to be added to the default state
6
- * @returns {Object} - intial state of the datatable
6
+ *
7
+ * @returns {Object} Intial state of the datatable
7
8
  */
8
9
  export const getDefaultState = function () {
9
10
  return {
@@ -55,8 +56,19 @@ export const getDefaultState = function () {
55
56
  // table render mode
56
57
  renderModeRoleBased: false,
57
58
 
58
- // viewport rendering
59
+ // viewport rendering and virtualization
59
60
  enableViewportRendering: undefined,
61
+ virtualize: '',
62
+ bufferSize: 5, // number of extra rows rendered on each side outside of viewport
63
+ rowHeight: 30.5,
64
+ renderedRowCount: 0,
65
+ firstVisibleIndex: 0, // first row that should be visible in viewport
66
+ fixedHeight: false, // by default, assume that not all rows are same height
67
+ heightCache: {}, // cache of row heights
68
+ offsets: [0],
69
+ offsetRanges: [],
70
+ firstRowOffset: 0, // how many pixels scrollTop is from top of first visible row
71
+ tableHeight: 0,
60
72
 
61
73
  // inline edit
62
74
  inlineEdit: {
@@ -35,19 +35,25 @@
35
35
  aria-label={ariaLabel}
36
36
  aria-labelledby={ariaLabelledBy}
37
37
  aria-rowcount={ariaRowCount}
38
- aria-colcount={ariaColCount}>
38
+ aria-colcount={ariaColCount}
39
+ data-num-rows={data.length}
40
+ data-num-selected-rows={selectedRows.length}
41
+ data-last-rendered-row={_lastRenderedRow}>
39
42
  <template if:false={hasValidKeyField}>
40
43
  <!-- empty since keyField wasn't provided -->
41
44
  </template>
42
45
  <template if:true={hasValidKeyField}>
43
46
  <!-- Corresponds to <thead> -->
44
- <div role="rowgroup">
47
+ <div
48
+ data-rowgroup-header
49
+ role="rowgroup">
45
50
  <!-- TODO: Fix aria-rowindex to not be hardcoded -->
46
51
  <!-- TODO: might need to move the table-header class out or rename -->
47
52
  <!-- Column Header Row -->
48
53
  <div class="slds-line-height_reset table-header"
49
54
  role="row"
50
55
  aria-rowindex="1"
56
+ data-row-key-value="HEADER"
51
57
  onprivateresizestart={handleResizeStart}
52
58
  onprivateresizeend={handleResizeEnd}>
53
59
  <template for:each={state.columns} for:item="def" for:index="colIndex">
@@ -58,6 +64,7 @@
58
64
  tabindex={def.tabIndex}
59
65
  aria-label={def.ariaLabel}
60
66
  aria-sort={def.sortAriaLabel}
67
+ data-col-key-value={def.colKeyValue}
61
68
  key={def.colKeyValue}>
62
69
 
63
70
  <template if:true={def.fixedWidth}>
@@ -106,8 +113,11 @@
106
113
  </div>
107
114
  </div>
108
115
  <!-- Corresponds to <tbody> -->
109
- <div style={computedTbodyStyle} role="rowgroup">
110
- <template for:each={renderedRows} for:item="row" for:index="rowIndex">
116
+ <div
117
+ data-rowgroup-body
118
+ role="rowgroup"
119
+ style={computedTbodyStyle}>
120
+ <template for:each={renderedRows} for:item="row">
111
121
  <!-- Data Rows -->
112
122
  <div class={row.classnames}
113
123
  role="row"
@@ -121,126 +131,130 @@
121
131
  aria-posinset={row.posInSet}
122
132
  aria-rowindex={row.ariaRowIndex}
123
133
  style={row.style}
124
- tabindex={row.tabIndex}>
125
- <template for:each={row.cells} for:item="cell">
126
- <template if:true={cell.isCheckbox}>
127
- <!-- Checkbox Cell -->
128
- <div class={cell.class}
129
- style={cell.style}
130
- role="gridcell"
131
- tabindex={cell.tabIndex}
132
- data-label={cell.dataLabel}
133
- key={cell.colKeyValue}>
134
- <lightning-primitive-cell-checkbox
135
- dt-context-id={_datatableId}
136
- has-focus={cell.hasFocus}
134
+ tabindex={row.tabIndex}
135
+ data-row-number={row.rowNumber}>
136
+ <template for:each={row.cells} for:item="cell">
137
+ <template if:true={cell.isCheckbox}>
138
+ <!-- Checkbox Cell -->
139
+ <div class={cell.class}
140
+ style={cell.style}
141
+ role="gridcell"
142
+ tabindex={cell.tabIndex}
137
143
  data-label={cell.dataLabel}
138
- key={cell.key}
139
- row-key-value={row.key}
140
- col-key-value={cell.colKeyValue}
141
- row-index={rowIndex}
142
- type={row.inputType}
143
- is-selected={row.isSelected}
144
- is-disabled={row.isDisabled}
145
- column-header-id={computedCheckboxColumnHeaderId}>
146
- </lightning-primitive-cell-checkbox>
147
- </div>
148
- </template>
149
- <template if:true={cell.isDataTypeScope}>
150
- <!-- Row Header Cell -->
151
- <div class={cell.class}
152
- role="rowheader"
153
- style={cell.style}
154
- aria-selected={cell.ariaSelected}
155
- aria-readonly={cell.ariaReadOnly}
156
- tabindex={cell.tabIndex}
157
- data-label={cell.dataLabel}
158
- key={cell.colKeyValue}>
159
- <lightning-primitive-cell-factory
160
- types={privateTypes}
144
+ data-col-key-value={cell.colKeyValue}
145
+ key={cell.colKeyValue}>
146
+ <lightning-primitive-cell-checkbox
147
+ dt-context-id={_datatableId}
148
+ has-focus={cell.hasFocus}
149
+ data-label={cell.dataLabel}
150
+ key={cell.key}
151
+ row-key-value={row.key}
152
+ col-key-value={cell.colKeyValue}
153
+ row-index={row.rowIndex}
154
+ type={row.inputType}
155
+ is-selected={row.isSelected}
156
+ is-disabled={row.isDisabled}
157
+ column-header-id={computedCheckboxColumnHeaderId}>
158
+ </lightning-primitive-cell-checkbox>
159
+ </div>
160
+ </template>
161
+ <template if:true={cell.isDataTypeScope}>
162
+ <!-- Row Header Cell -->
163
+ <div class={cell.class}
164
+ role="rowheader"
165
+ style={cell.style}
161
166
  aria-selected={cell.ariaSelected}
167
+ aria-readonly={cell.ariaReadOnly}
168
+ tabindex={cell.tabIndex}
162
169
  data-label={cell.dataLabel}
163
- alignment={cell.alignment}
164
- has-error={cell.hasError}
165
- has-focus={cell.hasFocus}
166
- column-label={cell.dataLabel}
167
- column-type={cell.columnType}
168
- column-sub-type={cell.columnSubType}
169
- wrap-text={cell.wrapText}
170
- wrap-text-max-lines={cell.wrapTextMaxLines}
171
- key={cell.columnType}
172
- row-key-value={row.key}
173
- col-key-value={cell.colKeyValue}
174
- value={cell.value}
175
- icon-name={cell.iconName}
176
- icon-label={cell.iconLabel}
177
- icon-position={cell.iconPosition}
178
- icon-alternative-text={cell.iconAlternativeText}
179
- editable={cell.editable}
180
- display-read-only-icon={cell.displayReadOnlyIcon}
181
- type-attribute-0={cell.typeAttribute0}
182
- type-attribute-1={cell.typeAttribute1}
183
- type-attribute-2={cell.typeAttribute2}
184
- type-attribute-3={cell.typeAttribute3}
185
- type-attribute-4={cell.typeAttribute4}
186
- type-attribute-5={cell.typeAttribute5}
187
- type-attribute-6={cell.typeAttribute6}
188
- type-attribute-7={cell.typeAttribute7}
189
- type-attribute-8={cell.typeAttribute8}
190
- type-attribute-9={cell.typeAttribute9}
191
- type-attribute-10={cell.typeAttribute10}
192
- type-attribute-21={cell.typeAttribute21}
193
- type-attribute-22={cell.typeAttribute22}>
194
- </lightning-primitive-cell-factory>
195
- </div>
196
- </template>
197
- <template if:true={cell.isDataType}>
198
- <!-- Non-Header Cells (Regular Data Cells) -->
199
- <div class={cell.class}
200
- role="gridcell"
201
- style={cell.style}
202
- aria-selected={cell.ariaSelected}
203
- aria-readonly={cell.ariaReadOnly}
204
- tabindex={cell.tabIndex}
205
- data-label={cell.dataLabel}
206
- key={cell.colKeyValue}>
207
- <lightning-primitive-cell-factory
208
- types={privateTypes}
170
+ data-col-key-value={cell.colKeyValue}
171
+ key={cell.colKeyValue}>
172
+ <lightning-primitive-cell-factory
173
+ types={privateTypes}
174
+ aria-selected={cell.ariaSelected}
175
+ data-label={cell.dataLabel}
176
+ alignment={cell.alignment}
177
+ has-error={cell.hasError}
178
+ has-focus={cell.hasFocus}
179
+ column-label={cell.dataLabel}
180
+ column-type={cell.columnType}
181
+ column-sub-type={cell.columnSubType}
182
+ wrap-text={cell.wrapText}
183
+ wrap-text-max-lines={cell.wrapTextMaxLines}
184
+ key={cell.columnType}
185
+ row-key-value={row.key}
186
+ col-key-value={cell.colKeyValue}
187
+ value={cell.value}
188
+ icon-name={cell.iconName}
189
+ icon-label={cell.iconLabel}
190
+ icon-position={cell.iconPosition}
191
+ icon-alternative-text={cell.iconAlternativeText}
192
+ editable={cell.editable}
193
+ display-read-only-icon={cell.displayReadOnlyIcon}
194
+ type-attribute-0={cell.typeAttribute0}
195
+ type-attribute-1={cell.typeAttribute1}
196
+ type-attribute-2={cell.typeAttribute2}
197
+ type-attribute-3={cell.typeAttribute3}
198
+ type-attribute-4={cell.typeAttribute4}
199
+ type-attribute-5={cell.typeAttribute5}
200
+ type-attribute-6={cell.typeAttribute6}
201
+ type-attribute-7={cell.typeAttribute7}
202
+ type-attribute-8={cell.typeAttribute8}
203
+ type-attribute-9={cell.typeAttribute9}
204
+ type-attribute-10={cell.typeAttribute10}
205
+ type-attribute-21={cell.typeAttribute21}
206
+ type-attribute-22={cell.typeAttribute22}>
207
+ </lightning-primitive-cell-factory>
208
+ </div>
209
+ </template>
210
+ <template if:true={cell.isDataType}>
211
+ <!-- Non-Header Cells (Regular Data Cells) -->
212
+ <div class={cell.class}
213
+ role="gridcell"
214
+ style={cell.style}
209
215
  aria-selected={cell.ariaSelected}
216
+ aria-readonly={cell.ariaReadOnly}
217
+ tabindex={cell.tabIndex}
210
218
  data-label={cell.dataLabel}
211
- alignment={cell.alignment}
212
- has-focus={cell.hasFocus}
213
- has-error={cell.hasError}
214
- column-label={cell.dataLabel}
215
- column-type={cell.columnType}
216
- column-sub-type={cell.columnSubType}
217
- wrap-text={cell.wrapText}
218
- wrap-text-max-lines={cell.wrapTextMaxLines}
219
- key={cell.columnType}
220
- row-key-value={row.key}
221
- col-key-value={cell.colKeyValue}
222
- value={cell.value}
223
- icon-name={cell.iconName}
224
- icon-label={cell.iconLabel}
225
- icon-position={cell.iconPosition}
226
- icon-alternative-text={cell.iconAlternativeText}
227
- editable={cell.editable}
228
- display-read-only-icon={cell.displayReadOnlyIcon}
229
- type-attribute-0={cell.typeAttribute0}
230
- type-attribute-1={cell.typeAttribute1}
231
- type-attribute-2={cell.typeAttribute2}
232
- type-attribute-3={cell.typeAttribute3}
233
- type-attribute-4={cell.typeAttribute4}
234
- type-attribute-5={cell.typeAttribute5}
235
- type-attribute-6={cell.typeAttribute6}
236
- type-attribute-7={cell.typeAttribute7}
237
- type-attribute-8={cell.typeAttribute8}
238
- type-attribute-9={cell.typeAttribute9}
239
- type-attribute-10={cell.typeAttribute10}
240
- type-attribute-21={cell.typeAttribute21}
241
- type-attribute-22={cell.typeAttribute22}>
242
- </lightning-primitive-cell-factory>
243
- </div>
219
+ data-col-key-value={cell.colKeyValue}
220
+ key={cell.colKeyValue}>
221
+ <lightning-primitive-cell-factory
222
+ types={privateTypes}
223
+ aria-selected={cell.ariaSelected}
224
+ data-label={cell.dataLabel}
225
+ alignment={cell.alignment}
226
+ has-focus={cell.hasFocus}
227
+ has-error={cell.hasError}
228
+ column-label={cell.dataLabel}
229
+ column-type={cell.columnType}
230
+ column-sub-type={cell.columnSubType}
231
+ wrap-text={cell.wrapText}
232
+ wrap-text-max-lines={cell.wrapTextMaxLines}
233
+ key={cell.columnType}
234
+ row-key-value={row.key}
235
+ col-key-value={cell.colKeyValue}
236
+ value={cell.value}
237
+ icon-name={cell.iconName}
238
+ icon-label={cell.iconLabel}
239
+ icon-position={cell.iconPosition}
240
+ icon-alternative-text={cell.iconAlternativeText}
241
+ editable={cell.editable}
242
+ display-read-only-icon={cell.displayReadOnlyIcon}
243
+ type-attribute-0={cell.typeAttribute0}
244
+ type-attribute-1={cell.typeAttribute1}
245
+ type-attribute-2={cell.typeAttribute2}
246
+ type-attribute-3={cell.typeAttribute3}
247
+ type-attribute-4={cell.typeAttribute4}
248
+ type-attribute-5={cell.typeAttribute5}
249
+ type-attribute-6={cell.typeAttribute6}
250
+ type-attribute-7={cell.typeAttribute7}
251
+ type-attribute-8={cell.typeAttribute8}
252
+ type-attribute-9={cell.typeAttribute9}
253
+ type-attribute-10={cell.typeAttribute10}
254
+ type-attribute-21={cell.typeAttribute21}
255
+ type-attribute-22={cell.typeAttribute22}>
256
+ </lightning-primitive-cell-factory>
257
+ </div>
244
258
  </template>
245
259
  </template>
246
260
  </div>
@@ -33,7 +33,9 @@
33
33
  onfocusout={handleTableFocusOut}
34
34
  aria-label={ariaLabel}
35
35
  aria-labelledby={ariaLabelledBy}
36
- aria-rowcount={ariaRowCount}>
36
+ data-num-rows={data.length}
37
+ data-num-selected-rows={selectedRows.length}
38
+ data-last-rendered-row={_lastRenderedRow}>
37
39
  <template if:false={hasValidKeyField}>
38
40
  <!-- empty since keyField wasn't provided TODO: Why is this here? Test and remove! -->
39
41
  </template>
@@ -41,6 +43,7 @@
41
43
  <thead>
42
44
  <!-- Column Header Row -->
43
45
  <tr class="slds-line-height_reset"
46
+ data-row-key-value="HEADER"
44
47
  onprivateresizestart={handleResizeStart}
45
48
  onprivateresizeend={handleResizeEnd}>
46
49
  <template for:each={state.columns} for:item="def" for:index="colIndex">
@@ -50,6 +53,7 @@
50
53
  tabindex={def.tabIndex}
51
54
  aria-label={def.ariaLabel}
52
55
  aria-sort={def.sortAriaLabel}
56
+ data-col-key-value={def.colKeyValue}
53
57
  key={def.colKeyValue}>
54
58
 
55
59
  <template if:true={def.fixedWidth}>
@@ -109,7 +113,8 @@
109
113
  aria-expanded={row.isExpanded}
110
114
  aria-setsize={row.setSize}
111
115
  aria-posinset={row.posInSet}
112
- tabindex={row.tabIndex}>
116
+ tabindex={row.tabIndex}
117
+ data-row-number={row.rowNumber}>
113
118
  <template for:each={row.cells} for:item="cell">
114
119
  <template if:true={cell.isCheckbox}>
115
120
  <!-- Checkbox Cell -->
@@ -117,6 +122,7 @@
117
122
  role="gridcell"
118
123
  tabindex={cell.tabIndex}
119
124
  data-label={cell.dataLabel}
125
+ data-col-key-value={cell.colKeyValue}
120
126
  key={cell.colKeyValue}>
121
127
  <lightning-primitive-cell-checkbox
122
128
  dt-context-id={_datatableId}
@@ -142,6 +148,7 @@
142
148
  scope="row"
143
149
  tabindex={cell.tabIndex}
144
150
  data-label={cell.dataLabel}
151
+ data-col-key-value={cell.colKeyValue}
145
152
  key={cell.colKeyValue}>
146
153
  <lightning-primitive-cell-factory
147
154
  types={privateTypes}
@@ -190,6 +197,7 @@
190
197
  aria-readonly={cell.ariaReadOnly}
191
198
  tabindex={cell.tabIndex}
192
199
  data-label={cell.dataLabel}
200
+ data-col-key-value={cell.colKeyValue}
193
201
  key={cell.colKeyValue}>
194
202
  <lightning-primitive-cell-factory
195
203
  types={privateTypes}
@@ -1,6 +1,13 @@
1
1
  import { getColumns } from './columns';
2
2
  import { isTreeType } from './types';
3
3
 
4
+ /**
5
+ * Retrieves the default values for the tree state indicator field names.
6
+ * These values are used to make logic decisions later and may be updated
7
+ * during normal operation.
8
+ *
9
+ * @returns {Object} The default tree state indicator field names
10
+ */
4
11
  export function getTreeStateIndicatorFieldNames() {
5
12
  return {
6
13
  children: 'hasChildren',
@@ -11,6 +18,12 @@ export function getTreeStateIndicatorFieldNames() {
11
18
  };
12
19
  }
13
20
 
21
+ /**
22
+ * Determines if any of the columns in the datatable are of a tree-type.
23
+ *
24
+ * @param {Object} state The datatable state
25
+ * @returns {Boolean} Whether any of the columns are of a tree-type
26
+ */
14
27
  export function hasTreeDataType(state) {
15
28
  const columns = getColumns(state);
16
29
  return columns.some((column) => {
@@ -18,6 +31,12 @@ export function hasTreeDataType(state) {
18
31
  });
19
32
  }
20
33
 
34
+ /**
35
+ * Retrieves the first tree-type column from the state.
36
+ *
37
+ * @param {Object} state The datatable state
38
+ * @returns {Object} The first tree-type column, else `null`
39
+ */
21
40
  export function getStateTreeColumn(state) {
22
41
  const columns = getColumns(state);
23
42
  for (let i = 0; i < columns.length; i++) {
@@ -28,6 +47,12 @@ export function getStateTreeColumn(state) {
28
47
  return null;
29
48
  }
30
49
 
50
+ /**
51
+ * Dispatches an event when a row is toggled to be expanded or collapsed.
52
+ *
53
+ * @param {String} rowKeyValue The row key being acted upon
54
+ * @param {Boolean} expanded The current expand/collapse state of the row
55
+ */
31
56
  export function fireRowToggleEvent(rowKeyValue, expanded) {
32
57
  const customEvent = new CustomEvent('privatetogglecell', {
33
58
  bubbles: true,