lightning-base-components 1.14.3-alpha → 1.14.7-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 (144) hide show
  1. package/metadata/raptor.json +37 -4
  2. package/package.json +11 -4
  3. package/scopedImports/@salesforce-label-LightningModalBase.cancelandclose.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningProgressBar.progressBar.js +1 -0
  5. package/src/lightning/alert/__docs__/alert.md +101 -0
  6. package/src/lightning/alert/__examples__disabled/basic/basic.css +7 -0
  7. package/src/lightning/alert/__examples__disabled/basic/basic.html +8 -0
  8. package/src/lightning/alert/__examples__disabled/basic/basic.js +14 -0
  9. package/src/lightning/alert/alert.html +3 -0
  10. package/src/lightning/alert/alert.js +78 -0
  11. package/src/lightning/alert/alert.js-meta.xml +6 -0
  12. package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +9 -0
  13. package/src/lightning/ariaObserver/ariaObserver.js +24 -35
  14. package/src/lightning/baseFormattedText/baseFormattedText.html +6 -1
  15. package/src/lightning/baseFormattedText/baseFormattedText.js +5 -0
  16. package/src/lightning/buttonMenu/buttonMenu.js +12 -0
  17. package/src/lightning/confirm/__docs__/confirm.md +100 -0
  18. package/src/lightning/confirm/__examples__disabled/basic/basic.css +7 -0
  19. package/src/lightning/confirm/__examples__disabled/basic/basic.html +8 -0
  20. package/src/lightning/confirm/__examples__disabled/basic/basic.js +14 -0
  21. package/src/lightning/confirm/confirm.html +3 -0
  22. package/src/lightning/confirm/confirm.js +80 -0
  23. package/src/lightning/confirm/confirm.js-meta.xml +6 -0
  24. package/src/lightning/datatable/__examples__/withInfiniteLoading/fetchDataHelper.js +21 -0
  25. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.html +13 -0
  26. package/src/lightning/datatable/__examples__/withInfiniteLoading/withInfiniteLoading.js +42 -0
  27. package/src/lightning/datatable/autoWidthStrategy.js +170 -61
  28. package/src/lightning/datatable/{resizer.js → columnResizer.js} +0 -0
  29. package/src/lightning/datatable/columnWidthManager.js +226 -44
  30. package/src/lightning/datatable/columns.js +166 -71
  31. package/src/lightning/datatable/datatable.js +132 -60
  32. package/src/lightning/datatable/fixedWidthStrategy.js +43 -8
  33. package/src/lightning/datatable/headerActions.js +2 -2
  34. package/src/lightning/datatable/infiniteLoading.js +100 -28
  35. package/src/lightning/datatable/inlineEdit.js +21 -30
  36. package/src/lightning/datatable/keyboard.js +166 -131
  37. package/src/lightning/datatable/renderManager.js +117 -122
  38. package/src/lightning/datatable/{datatableResizeObserver.js → resizeObserver.js} +46 -29
  39. package/src/lightning/datatable/resizeSensor.js +19 -3
  40. package/src/lightning/datatable/rowSelection.js +1 -1
  41. package/src/lightning/datatable/rowSelectionShared.js +33 -20
  42. package/src/lightning/datatable/rows.js +7 -8
  43. package/src/lightning/datatable/sort.js +8 -8
  44. package/src/lightning/datatable/state.js +14 -2
  45. package/src/lightning/datatable/templates/div/div.html +127 -117
  46. package/src/lightning/datatable/templates/table/table.html +5 -0
  47. package/src/lightning/datatable/tree.js +25 -0
  48. package/src/lightning/datatable/types.js +77 -9
  49. package/src/lightning/datatable/utils.js +51 -24
  50. package/src/lightning/datatable/virtualization.js +319 -0
  51. package/src/lightning/datatable/widthManagerShared.js +27 -3
  52. package/src/lightning/datatable/wrapText.js +115 -48
  53. package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +36 -3
  54. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.html +2 -2
  55. package/src/lightning/formattedDateTime/__examples__/datetime/datetime.js +3 -1
  56. package/src/lightning/formattedDateTime/__examples__/time/time.html +1 -1
  57. package/src/lightning/formattedDateTime/__examples__/time/time.js +3 -1
  58. package/src/lightning/formattedDateTime/formattedDateTime.js +1 -0
  59. package/src/lightning/iconSvgTemplates/buildTemplates/standard/dashboard_component.html +7 -0
  60. package/src/lightning/iconSvgTemplates/buildTemplates/standard/slack.html +7 -0
  61. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tableau.html +7 -0
  62. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  63. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +8 -1
  64. package/src/lightning/iconSvgTemplates/buildTemplates/utility/data_model.html +7 -0
  65. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product.html +1 -1
  66. package/src/lightning/iconSvgTemplates/buildTemplates/utility/serialized_product_transaction.html +2 -1
  67. package/src/lightning/iconSvgTemplates/buildTemplates/utility/slack.html +7 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tableau.html +7 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/utility/video_off.html +7 -0
  70. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/dashboard_component.html +7 -0
  71. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/slack.html +7 -0
  72. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tableau.html +7 -0
  73. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  74. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +8 -1
  75. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/data_model.html +7 -0
  76. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product.html +1 -1
  77. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  78. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/slack.html +7 -0
  79. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tableau.html +7 -0
  80. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/video_off.html +7 -0
  81. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/dashboard_component.html +7 -0
  82. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/slack.html +7 -0
  83. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tableau.html +7 -0
  84. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  85. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +4 -1
  86. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/dashboard_component.html +7 -0
  87. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/slack.html +7 -0
  88. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tableau.html +7 -0
  89. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  90. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +4 -1
  91. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +5 -1
  92. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/data_model.html +7 -0
  93. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product.html +1 -1
  94. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/serialized_product_transaction.html +2 -1
  95. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/slack.html +7 -0
  96. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tableau.html +7 -0
  97. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/video_off.html +7 -0
  98. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +5 -1
  99. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/data_model.html +7 -0
  100. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product.html +1 -1
  101. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/serialized_product_transaction.html +2 -1
  102. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/slack.html +7 -0
  103. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tableau.html +7 -0
  104. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/video_off.html +7 -0
  105. package/src/lightning/input/__docs__/input.md +2 -0
  106. package/src/lightning/input/input.html +2 -5
  107. package/src/lightning/interactiveDialogBase/interactiveDialogBase.css +494 -0
  108. package/src/lightning/interactiveDialogBase/interactiveDialogBase.html +63 -0
  109. package/src/lightning/interactiveDialogBase/interactiveDialogBase.js +200 -0
  110. package/src/lightning/menuItem/menuItem.js +4 -1
  111. package/src/lightning/modalBase/modalBase.css +20 -0
  112. package/src/lightning/modalBase/modalBase.html +54 -0
  113. package/src/lightning/modalBase/modalBase.js +1039 -0
  114. package/src/lightning/overlay/__docs__/overlay.md +90 -0
  115. package/src/lightning/overlay/__examples__/alert/alert.html +27 -0
  116. package/src/lightning/overlay/__examples__/alert/alert.js +33 -0
  117. package/src/lightning/overlay/__examples__/basic/basic.css +7 -0
  118. package/src/lightning/overlay/__examples__/basic/basic.html +18 -0
  119. package/src/lightning/overlay/__examples__/basic/basic.js +61 -0
  120. package/src/lightning/overlay/__examples__/demo/demo.html +29 -0
  121. package/src/lightning/overlay/__examples__/demo/demo.js +40 -0
  122. package/src/lightning/overlay/__examples__/panel/panel.html +17 -0
  123. package/src/lightning/overlay/__examples__/panel/panel.js +21 -0
  124. package/src/lightning/overlay/overlay.html +3 -0
  125. package/src/lightning/overlay/overlay.js +45 -0
  126. package/src/lightning/overlayContainer/__docs__/overlayContainer.md +0 -0
  127. package/src/lightning/overlayContainer/overlayContainer.html +3 -0
  128. package/src/lightning/overlayContainer/overlayContainer.js +138 -0
  129. package/src/lightning/overlayManager/overlayManager.js +54 -0
  130. package/src/lightning/overlayUtils/overlayUtils.js +17 -0
  131. package/src/lightning/progressBar/progressBar.html +2 -1
  132. package/src/lightning/progressBar/progressBar.js +18 -1
  133. package/src/lightning/prompt/__docs__/prompt.md +102 -0
  134. package/src/lightning/prompt/__examples__disabled/basic/basic.css +7 -0
  135. package/src/lightning/prompt/__examples__disabled/basic/basic.html +8 -0
  136. package/src/lightning/prompt/__examples__disabled/basic/basic.js +15 -0
  137. package/src/lightning/prompt/prompt.css +81 -0
  138. package/src/lightning/prompt/prompt.html +8 -0
  139. package/src/lightning/prompt/prompt.js +92 -0
  140. package/src/lightning/prompt/prompt.js-meta.xml +6 -0
  141. package/src/lightning/spinner/spinner.html +1 -1
  142. package/src/lightning/spinner/spinner.js +12 -0
  143. package/src/lightning/utilsPrivate/phonify.js +1 -1
  144. 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,7 @@ export function updateRowsAndCellIndexes() {
135
133
 
136
134
  state.indexes[row.key] = { rowIndex };
137
135
 
136
+ row.rowIndex = rowIndex;
138
137
  row.inputType = getRowSelectionInputType(state);
139
138
  row.isSelected = isSelectedRow(state, row.key);
140
139
  row.ariaSelected = row.isSelected ? 'true' : false;
@@ -142,10 +141,10 @@ export function updateRowsAndCellIndexes() {
142
141
  row.classnames = resolveRowClassNames(row);
143
142
  Object.assign(row, getRowStateForTree(rowData, state));
144
143
  row.tabIndex = -1;
145
- if (_virtualize) {
144
+ if (virtualize) {
146
145
  row.style = styleToString({
147
146
  position: 'absolute',
148
- top: `${rowIndex * DEFAULT_ROW_HEIGHT}px`,
147
+ top: `${rowIndex * rowHeight}px`,
149
148
  });
150
149
  }
151
150
 
@@ -402,7 +401,7 @@ function computeCellEditable(row, column) {
402
401
  * @param {object} row - a row data object stored in datatable state. Must be truthy.
403
402
  * @param {object} column - a column data object stored in datatable state. Must be truthy.
404
403
  */
405
- function isCellEditable(row, column) {
404
+ export function isCellEditable(row, column) {
406
405
  return !!resolveAttributeValue(column.editable, row);
407
406
  }
408
407
 
@@ -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: {
@@ -41,13 +41,16 @@
41
41
  </template>
42
42
  <template if:true={hasValidKeyField}>
43
43
  <!-- Corresponds to <thead> -->
44
- <div role="rowgroup">
44
+ <div
45
+ data-rowgroup-header
46
+ role="rowgroup">
45
47
  <!-- TODO: Fix aria-rowindex to not be hardcoded -->
46
48
  <!-- TODO: might need to move the table-header class out or rename -->
47
49
  <!-- Column Header Row -->
48
50
  <div class="slds-line-height_reset table-header"
49
51
  role="row"
50
52
  aria-rowindex="1"
53
+ data-row-key-value="HEADER"
51
54
  onprivateresizestart={handleResizeStart}
52
55
  onprivateresizeend={handleResizeEnd}>
53
56
  <template for:each={state.columns} for:item="def" for:index="colIndex">
@@ -58,6 +61,7 @@
58
61
  tabindex={def.tabIndex}
59
62
  aria-label={def.ariaLabel}
60
63
  aria-sort={def.sortAriaLabel}
64
+ data-col-key-value={def.colKeyValue}
61
65
  key={def.colKeyValue}>
62
66
 
63
67
  <template if:true={def.fixedWidth}>
@@ -106,8 +110,11 @@
106
110
  </div>
107
111
  </div>
108
112
  <!-- Corresponds to <tbody> -->
109
- <div style={computedTbodyStyle} role="rowgroup">
110
- <template for:each={renderedRows} for:item="row" for:index="rowIndex">
113
+ <div
114
+ data-rowgroup-body
115
+ role="rowgroup"
116
+ style={computedTbodyStyle}>
117
+ <template for:each={renderedRows} for:item="row">
111
118
  <!-- Data Rows -->
112
119
  <div class={row.classnames}
113
120
  role="row"
@@ -122,125 +129,128 @@
122
129
  aria-rowindex={row.ariaRowIndex}
123
130
  style={row.style}
124
131
  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}
132
+ <template for:each={row.cells} for:item="cell">
133
+ <template if:true={cell.isCheckbox}>
134
+ <!-- Checkbox Cell -->
135
+ <div class={cell.class}
136
+ style={cell.style}
137
+ role="gridcell"
138
+ tabindex={cell.tabIndex}
137
139
  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}
140
+ data-col-key-value={cell.colKeyValue}
141
+ key={cell.colKeyValue}>
142
+ <lightning-primitive-cell-checkbox
143
+ dt-context-id={_datatableId}
144
+ has-focus={cell.hasFocus}
145
+ data-label={cell.dataLabel}
146
+ key={cell.key}
147
+ row-key-value={row.key}
148
+ col-key-value={cell.colKeyValue}
149
+ row-index={row.rowIndex}
150
+ type={row.inputType}
151
+ is-selected={row.isSelected}
152
+ is-disabled={row.isDisabled}
153
+ column-header-id={computedCheckboxColumnHeaderId}>
154
+ </lightning-primitive-cell-checkbox>
155
+ </div>
156
+ </template>
157
+ <template if:true={cell.isDataTypeScope}>
158
+ <!-- Row Header Cell -->
159
+ <div class={cell.class}
160
+ role="rowheader"
161
+ style={cell.style}
161
162
  aria-selected={cell.ariaSelected}
163
+ aria-readonly={cell.ariaReadOnly}
164
+ tabindex={cell.tabIndex}
162
165
  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}
166
+ data-col-key-value={cell.colKeyValue}
167
+ key={cell.colKeyValue}>
168
+ <lightning-primitive-cell-factory
169
+ types={privateTypes}
170
+ aria-selected={cell.ariaSelected}
171
+ data-label={cell.dataLabel}
172
+ alignment={cell.alignment}
173
+ has-error={cell.hasError}
174
+ has-focus={cell.hasFocus}
175
+ column-label={cell.dataLabel}
176
+ column-type={cell.columnType}
177
+ column-sub-type={cell.columnSubType}
178
+ wrap-text={cell.wrapText}
179
+ wrap-text-max-lines={cell.wrapTextMaxLines}
180
+ key={cell.columnType}
181
+ row-key-value={row.key}
182
+ col-key-value={cell.colKeyValue}
183
+ value={cell.value}
184
+ icon-name={cell.iconName}
185
+ icon-label={cell.iconLabel}
186
+ icon-position={cell.iconPosition}
187
+ icon-alternative-text={cell.iconAlternativeText}
188
+ editable={cell.editable}
189
+ display-read-only-icon={cell.displayReadOnlyIcon}
190
+ type-attribute-0={cell.typeAttribute0}
191
+ type-attribute-1={cell.typeAttribute1}
192
+ type-attribute-2={cell.typeAttribute2}
193
+ type-attribute-3={cell.typeAttribute3}
194
+ type-attribute-4={cell.typeAttribute4}
195
+ type-attribute-5={cell.typeAttribute5}
196
+ type-attribute-6={cell.typeAttribute6}
197
+ type-attribute-7={cell.typeAttribute7}
198
+ type-attribute-8={cell.typeAttribute8}
199
+ type-attribute-9={cell.typeAttribute9}
200
+ type-attribute-10={cell.typeAttribute10}
201
+ type-attribute-21={cell.typeAttribute21}
202
+ type-attribute-22={cell.typeAttribute22}>
203
+ </lightning-primitive-cell-factory>
204
+ </div>
205
+ </template>
206
+ <template if:true={cell.isDataType}>
207
+ <!-- Non-Header Cells (Regular Data Cells) -->
208
+ <div class={cell.class}
209
+ role="gridcell"
210
+ style={cell.style}
209
211
  aria-selected={cell.ariaSelected}
212
+ aria-readonly={cell.ariaReadOnly}
213
+ tabindex={cell.tabIndex}
210
214
  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>
215
+ data-col-key-value={cell.colKeyValue}
216
+ key={cell.colKeyValue}>
217
+ <lightning-primitive-cell-factory
218
+ types={privateTypes}
219
+ aria-selected={cell.ariaSelected}
220
+ data-label={cell.dataLabel}
221
+ alignment={cell.alignment}
222
+ has-focus={cell.hasFocus}
223
+ has-error={cell.hasError}
224
+ column-label={cell.dataLabel}
225
+ column-type={cell.columnType}
226
+ column-sub-type={cell.columnSubType}
227
+ wrap-text={cell.wrapText}
228
+ wrap-text-max-lines={cell.wrapTextMaxLines}
229
+ key={cell.columnType}
230
+ row-key-value={row.key}
231
+ col-key-value={cell.colKeyValue}
232
+ value={cell.value}
233
+ icon-name={cell.iconName}
234
+ icon-label={cell.iconLabel}
235
+ icon-position={cell.iconPosition}
236
+ icon-alternative-text={cell.iconAlternativeText}
237
+ editable={cell.editable}
238
+ display-read-only-icon={cell.displayReadOnlyIcon}
239
+ type-attribute-0={cell.typeAttribute0}
240
+ type-attribute-1={cell.typeAttribute1}
241
+ type-attribute-2={cell.typeAttribute2}
242
+ type-attribute-3={cell.typeAttribute3}
243
+ type-attribute-4={cell.typeAttribute4}
244
+ type-attribute-5={cell.typeAttribute5}
245
+ type-attribute-6={cell.typeAttribute6}
246
+ type-attribute-7={cell.typeAttribute7}
247
+ type-attribute-8={cell.typeAttribute8}
248
+ type-attribute-9={cell.typeAttribute9}
249
+ type-attribute-10={cell.typeAttribute10}
250
+ type-attribute-21={cell.typeAttribute21}
251
+ type-attribute-22={cell.typeAttribute22}>
252
+ </lightning-primitive-cell-factory>
253
+ </div>
244
254
  </template>
245
255
  </template>
246
256
  </div>
@@ -41,6 +41,7 @@
41
41
  <thead>
42
42
  <!-- Column Header Row -->
43
43
  <tr class="slds-line-height_reset"
44
+ data-row-key-value="HEADER"
44
45
  onprivateresizestart={handleResizeStart}
45
46
  onprivateresizeend={handleResizeEnd}>
46
47
  <template for:each={state.columns} for:item="def" for:index="colIndex">
@@ -50,6 +51,7 @@
50
51
  tabindex={def.tabIndex}
51
52
  aria-label={def.ariaLabel}
52
53
  aria-sort={def.sortAriaLabel}
54
+ data-col-key-value={def.colKeyValue}
53
55
  key={def.colKeyValue}>
54
56
 
55
57
  <template if:true={def.fixedWidth}>
@@ -117,6 +119,7 @@
117
119
  role="gridcell"
118
120
  tabindex={cell.tabIndex}
119
121
  data-label={cell.dataLabel}
122
+ data-col-key-value={cell.colKeyValue}
120
123
  key={cell.colKeyValue}>
121
124
  <lightning-primitive-cell-checkbox
122
125
  dt-context-id={_datatableId}
@@ -142,6 +145,7 @@
142
145
  scope="row"
143
146
  tabindex={cell.tabIndex}
144
147
  data-label={cell.dataLabel}
148
+ data-col-key-value={cell.colKeyValue}
145
149
  key={cell.colKeyValue}>
146
150
  <lightning-primitive-cell-factory
147
151
  types={privateTypes}
@@ -190,6 +194,7 @@
190
194
  aria-readonly={cell.ariaReadOnly}
191
195
  tabindex={cell.tabIndex}
192
196
  data-label={cell.dataLabel}
197
+ data-col-key-value={cell.colKeyValue}
193
198
  key={cell.colKeyValue}>
194
199
  <lightning-primitive-cell-factory
195
200
  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,