lightning-base-components 1.13.6-alpha → 1.13.10-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 (189) hide show
  1. package/metadata/raptor.json +104 -2
  2. package/package.json +37 -1
  3. package/scopedImports/@salesforce-label-LightningAlert.defaultLabel.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningConfirm.defaultLabel.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningDateTimePicker.selectDateFor.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.cancel.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.ok.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
  9. package/scopedImports/@salesforce-label-LightningModalBase.close.js +1 -0
  10. package/scopedImports/@salesforce-label-LightningModalBase.waitstate.js +1 -0
  11. package/scopedImports/@salesforce-label-LightningPrompt.defaultLabel.js +1 -0
  12. package/src/lightning/baseCombobox/baseCombobox.html +50 -24
  13. package/src/lightning/baseCombobox/baseCombobox.js +53 -28
  14. package/src/lightning/card/card.html +7 -1
  15. package/src/lightning/card/card.js +30 -2
  16. package/src/lightning/card/utils.js +14 -0
  17. package/src/lightning/combobox/combobox.css +12 -0
  18. package/src/lightning/combobox/combobox.html +1 -0
  19. package/src/lightning/datatable/__docs__/datatable.md +40 -13
  20. package/src/lightning/datatable/columnWidthManager.js +8 -4
  21. package/src/lightning/datatable/columns-shared.js +8 -7
  22. package/src/lightning/datatable/columns.js +38 -4
  23. package/src/lightning/datatable/datatable.js +932 -727
  24. package/src/lightning/datatable/datatableResizeObserver.js +1 -1
  25. package/src/lightning/datatable/inlineEdit.js +15 -3
  26. package/src/lightning/datatable/keyboard.js +1078 -935
  27. package/src/lightning/datatable/resizer.js +92 -109
  28. package/src/lightning/datatable/rows.js +245 -59
  29. package/src/lightning/datatable/sort.js +83 -28
  30. package/src/lightning/datatable/{normalizer.js → state.js} +16 -28
  31. package/src/lightning/datatable/templates/div/div.css +53 -0
  32. package/src/lightning/datatable/templates/div/div.html +272 -0
  33. package/src/lightning/datatable/{datatable.css → templates/table/table.css} +0 -0
  34. package/src/lightning/datatable/templates/table/table.html +260 -0
  35. package/src/lightning/datatable/widthManagerShared.js +1 -1
  36. package/src/lightning/datepicker/datepicker.html +3 -3
  37. package/src/lightning/datepicker/datepicker.js +6 -2
  38. package/src/lightning/datetimepicker/datetimepicker.html +3 -4
  39. package/src/lightning/datetimepicker/datetimepicker.js +0 -2
  40. package/src/lightning/formattedRichText/__docs__/formattedRichText.md +1 -0
  41. package/src/lightning/helptext/helptext.js +8 -0
  42. package/src/lightning/iconSvgTemplates/buildTemplates/standard/asset_audit.html +7 -0
  43. package/src/lightning/iconSvgTemplates/buildTemplates/standard/attach.html +7 -0
  44. package/src/lightning/iconSvgTemplates/buildTemplates/standard/contract_payment.html +10 -0
  45. package/src/lightning/iconSvgTemplates/buildTemplates/standard/field_sales.html +8 -0
  46. package/src/lightning/iconSvgTemplates/buildTemplates/standard/historical_adherence.html +9 -0
  47. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_recommendation.html +8 -0
  48. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  49. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_dispense.html +11 -0
  50. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_reconciliation.html +7 -0
  51. package/src/lightning/iconSvgTemplates/buildTemplates/standard/report_type.html +9 -0
  52. package/src/lightning/iconSvgTemplates/buildTemplates/standard/story.html +2 -4
  53. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour.html +9 -0
  54. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour_check.html +8 -0
  55. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  56. package/src/lightning/iconSvgTemplates/buildTemplates/standard/unified_health_score.html +7 -0
  57. package/src/lightning/iconSvgTemplates/buildTemplates/standard/workforce_engagement.html +8 -0
  58. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +26 -1
  59. package/src/lightning/iconSvgTemplates/buildTemplates/utility/asset_audit.html +9 -0
  60. package/src/lightning/iconSvgTemplates/buildTemplates/utility/collection_alt.html +8 -0
  61. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
  62. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_payment.html +10 -0
  63. package/src/lightning/iconSvgTemplates/buildTemplates/utility/einstein.html +2 -1
  64. package/src/lightning/iconSvgTemplates/buildTemplates/utility/entitlement.html +7 -0
  65. package/src/lightning/iconSvgTemplates/buildTemplates/utility/field_sales.html +8 -0
  66. package/src/lightning/iconSvgTemplates/buildTemplates/utility/signature.html +9 -0
  67. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour.html +9 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour_check.html +8 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/utility/truck.html +10 -0
  70. package/src/lightning/iconSvgTemplates/buildTemplates/utility/workforce_engagement.html +8 -0
  71. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/asset_audit.html +7 -0
  72. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/attach.html +7 -0
  73. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/contract_payment.html +10 -0
  74. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/field_sales.html +8 -0
  75. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/historical_adherence.html +9 -0
  76. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  77. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  78. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_dispense.html +11 -0
  79. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  80. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/report_type.html +9 -0
  81. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/story.html +2 -4
  82. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour.html +9 -0
  83. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour_check.html +8 -0
  84. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  85. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/unified_health_score.html +7 -0
  86. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  87. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +26 -1
  88. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/asset_audit.html +9 -0
  89. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/collection_alt.html +8 -0
  90. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
  91. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_payment.html +10 -0
  92. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/einstein.html +2 -1
  93. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/entitlement.html +7 -0
  94. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/field_sales.html +8 -0
  95. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/signature.html +9 -0
  96. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour.html +9 -0
  97. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour_check.html +8 -0
  98. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/truck.html +10 -0
  99. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  100. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/asset_audit.html +7 -0
  101. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/attach.html +7 -0
  102. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/contract_payment.html +10 -0
  103. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/field_sales.html +8 -0
  104. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/historical_adherence.html +9 -0
  105. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_recommendation.html +8 -0
  106. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  107. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_dispense.html +11 -0
  108. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_reconciliation.html +7 -0
  109. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/report_type.html +9 -0
  110. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/story.html +2 -4
  111. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour.html +9 -0
  112. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour_check.html +8 -0
  113. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  114. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/unified_health_score.html +7 -0
  115. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/workforce_engagement.html +8 -0
  116. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +15 -1
  117. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/asset_audit.html +7 -0
  118. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/attach.html +7 -0
  119. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/contract_payment.html +10 -0
  120. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/field_sales.html +8 -0
  121. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/historical_adherence.html +9 -0
  122. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  123. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  124. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_dispense.html +11 -0
  125. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  126. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/report_type.html +9 -0
  127. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/story.html +2 -4
  128. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour.html +9 -0
  129. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour_check.html +8 -0
  130. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  131. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/unified_health_score.html +7 -0
  132. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  133. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +15 -1
  134. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +12 -1
  135. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/asset_audit.html +9 -0
  136. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/collection_alt.html +8 -0
  137. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
  138. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_payment.html +10 -0
  139. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/einstein.html +2 -1
  140. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/entitlement.html +7 -0
  141. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/field_sales.html +8 -0
  142. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/signature.html +9 -0
  143. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour.html +9 -0
  144. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour_check.html +8 -0
  145. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/truck.html +10 -0
  146. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/workforce_engagement.html +8 -0
  147. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +12 -1
  148. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/asset_audit.html +9 -0
  149. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/collection_alt.html +8 -0
  150. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
  151. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_payment.html +10 -0
  152. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/einstein.html +2 -1
  153. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/entitlement.html +7 -0
  154. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/field_sales.html +8 -0
  155. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/signature.html +9 -0
  156. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour.html +9 -0
  157. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour_check.html +8 -0
  158. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/truck.html +10 -0
  159. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  160. package/src/lightning/input/__docs__/input.md +4 -0
  161. package/src/lightning/input/input.js +11 -6
  162. package/src/lightning/pill/link.html +1 -1
  163. package/src/lightning/pill/pill.js +18 -0
  164. package/src/lightning/pill/plainLink.html +2 -0
  165. package/src/lightning/pillContainer/barePillContainer.html +5 -5
  166. package/src/lightning/pillContainer/pillContainer.js +5 -4
  167. package/src/lightning/pillContainer/standardPillContainer.html +5 -5
  168. package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +8 -6
  169. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +1 -1
  170. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +6 -9
  171. package/src/lightning/positionLibrary/direction.js +17 -5
  172. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +20 -0
  173. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +10 -0
  174. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +17 -3
  175. package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -0
  176. package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +5 -4
  177. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +255 -94
  178. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
  179. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
  180. package/src/lightning/progressIndicator/progressIndicator.js +30 -9
  181. package/src/lightning/progressRing/progressRing.html +6 -0
  182. package/src/lightning/progressRing/progressRing.js +98 -3
  183. package/src/lightning/progressStep/progressStep.js +6 -3
  184. package/src/lightning/timepicker/timepicker.html +1 -0
  185. package/src/lightning/utilsPrivate/aria.js +30 -0
  186. package/src/lightning/utilsPrivate/contentMutation.js +24 -2
  187. package/src/lightning/utilsPrivate/utilsPrivate.js +1 -1
  188. package/src/lightning/datatable/datatable.html +0 -237
  189. package/src/lightning/datatable/keys.js +0 -32
@@ -200,9 +200,10 @@ aspects of your columns.
200
200
  | fieldName | string | Required. The name that binds the columns attributes to the associated data. Each columns attribute must correspond to an item in the data array. |
201
201
  | fixedWidth | integer | Specifies the width of a column in pixels and makes the column non-resizable.If both `fixedWidth` and `initialWidth` values are provided, `initialWidth` is ignored. |
202
202
  | hideDefaultActions | boolean | Specifies whether to hide the default header actions on a column. The default is false. For more information, see **Creating Header Actions**. |
203
- | iconName | string | The Lightning Design System name of the icon. Names are written in the format standard:opportunity. The icon is appended to the left of the header label. |
203
+ | hideLabel | boolean | Specifies whether to hide the label on a column. The default is false. For more information, see **Displaying an Icon Instead of a Column Label**. |
204
+ | iconName | string | The Lightning Design System name of the icon. Names are written in the format standard:opportunity. The icon is appended to the left of the header label. If `hideLabel` is provided, only the icon displays in the column header. |
204
205
  | initialWidth | integer | The width of the column when it's initialized, which must be within the `min-column-width` and` max-column-width` values, or within 50px and 1000px if they are not provided. |
205
- | label | string | Required. The text label displayed in the column header. |
206
+ | label | string | Required. The text label displayed in the column header. If `hideLabel` and `iconName` are set, the label is used as hover text for the icon and as the value of `aria-label`. |
206
207
  | sortable | boolean | Specifies whether the column can be sorted. The default is false. |
207
208
  | type | string | Required. The data type to be used for data formatting. For more information, see **Formatting with Data Types**. |
208
209
  | typeAttributes | object | Provides custom formatting with component attributes for the data type. For example, currency-code for the currency type. For more information, see **Formatting with Data Types**. |
@@ -410,6 +411,26 @@ The `action` type aligns to the center and cannot be overridden by the `alignmen
410
411
 
411
412
  To override the alignment of the `action` type, consider using custom types and provide your own markup. See [Create a Custom Data Type](docs/component-library/documentation/lwc/lwc.data_table_custom_types).
412
413
 
414
+ #### Displaying an Icon Instead of a Column Label
415
+
416
+ To display an icon instead of a label in the column header, specify the properties `iconName` and `hideLabel` in the column definition. Specify `iconName` as a [utility icon](https://www.lightningdesignsystem.com/icons/#utility).
417
+
418
+ ```javascript
419
+ const columns = [
420
+ {
421
+ label: 'Ordering',
422
+ fieldName: 'id',
423
+ type: 'orderingButtons',
424
+ fixedWidth: 90,
425
+ iconName: 'utility:trending',
426
+ hideLabel: true,
427
+ },
428
+ // other column data
429
+ ];
430
+ ```
431
+
432
+ To support assistive technologies, set the `label` property for the column even though the label is hidden. Use standard header text that you'd use without an icon. The label text is used to set values for the icon's `title` and `alternativeText` attributes. The text is displayed as hover text. If the column has header controls the label text is used in `aria-label` for the header.
433
+
413
434
  #### Appending an Icon to Column Data
414
435
 
415
436
  To append an icon to your data output, use `cellAttributes` and pass in these
@@ -480,10 +501,13 @@ when users scroll to the end of the table. To enable infinite scrolling, specify
480
501
  `enable-infinite-loading` and provide an event handler using
481
502
  `onloadmore`. By default, data loading is triggered when you scroll down to
482
503
  20px from the bottom of the table, but the offset can be changed using the
483
- `load-more-offset` attribute.
504
+ `load-more-offset` attribute. Place the table in a container with a defined height
505
+ to establish the bottom of the table. This limit enables the datatable to calculate
506
+ when to load more and prevents infinite looping.
484
507
 
485
- This example loads 50 more rows from the database when you reach the end of
486
- the table until there are no more data to load.
508
+ This example places the datatable in a container with a height of 500px. The table
509
+ loads 50 more rows from the database when you reach the end of the table until
510
+ there are no more data to load.
487
511
 
488
512
  ```html
489
513
  <template>
@@ -844,9 +868,9 @@ Resizing a column fires the `resize` event. For more information, See the **Cust
844
868
  ```html
845
869
  <lightning-datatable
846
870
  key-field="id"
847
- data={data}
848
- columns={columns}
849
- onresize={handleResize}
871
+ data="{data}"
872
+ columns="{columns}"
873
+ onresize="{handleResize}"
850
874
  >
851
875
  </lightning-datatable>
852
876
  ```
@@ -1106,8 +1130,8 @@ This example displays three lines of text and hides the rest; the text on line 3
1106
1130
 
1107
1131
  ```html
1108
1132
  <lightning-datatable
1109
- data={data}
1110
- columns={columns}
1133
+ data="{data}"
1134
+ columns="{columns}"
1111
1135
  key-field="id"
1112
1136
  wrap-text-max-lines="3"
1113
1137
  >
@@ -1149,11 +1173,14 @@ Set the attribute in `lightning-datatable` in your template.
1149
1173
  Change the ARIA label dynamically using the `ariaLabel` property.
1150
1174
 
1151
1175
  ```javascript
1152
- const myLightningDataTableElement = this.template.querySelector('lightning-datatable');
1153
- myLightningDataTableElement.ariaLabel = 'Account Details by Revenue for EMEA Region';
1176
+ const myLightningDataTableElement = this.template.querySelector(
1177
+ 'lightning-datatable'
1178
+ );
1179
+ myLightningDataTableElement.ariaLabel =
1180
+ 'Account Details by Revenue for EMEA Region';
1154
1181
  ```
1155
1182
 
1156
- The `aria-label` attribute doesn't support empty strings. If you set `aria-label=""` in the HTML or `.ariaLabel = ""` in JavaScript, the table's `aria-label`
1183
+ The `aria-label` attribute doesn't support empty strings. If you set `aria-label=""` in the HTML or `.ariaLabel = ""` in JavaScript, the table's `aria-label`
1157
1184
  attribute is hidden, not rendered with an empty string. An empty label string can confuse screen readers.
1158
1185
 
1159
1186
  ##### Provide an Accessible Caption for the Table
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  getColumnWidthFromDef,
15
15
  getDomWidth,
16
- getWidthStyle,
16
+ buildCSSWidthStyle,
17
17
  } from './widthManagerShared';
18
18
  import { isRTL } from 'lightning/utilsPrivate';
19
19
 
@@ -35,7 +35,7 @@ export function computeColumnWidths(adjustedWidths, columnDefs, widthsData) {
35
35
  const newWidth = columnWidths[index];
36
36
  widthsData.columnWidths[index] = newWidth;
37
37
  columnDef.columnWidth = newWidth;
38
- columnDef.style = getWidthStyle(newWidth);
38
+ columnDef.style = buildCSSWidthStyle(newWidth);
39
39
 
40
40
  // In RTL, we need to explicitly position the column headers.
41
41
  // We do this by providing the offset (in pixels) from the start of the table.
@@ -272,7 +272,7 @@ export class ColumnWidthManager {
272
272
  // can resize from dom when table is visible
273
273
  // otherwise only when ResizeObserver is available in browser
274
274
  return (
275
- isTableRenderedVisible(root) || this._resizeObserverAvailable
275
+ this._resizeObserverAvailable || isTableRenderedVisible(root)
276
276
  );
277
277
  }
278
278
  return true;
@@ -312,7 +312,11 @@ export class ColumnWidthManager {
312
312
  return [];
313
313
  },
314
314
  getTableElementWidth() {
315
- const tableElement = root.querySelector(TABLE_SEL);
315
+ // TODO: Figure out a clean way to retrieve and use the correct selectors
316
+ // Currently outside scope of this work. Should be addressed in W-8540110
317
+ const tableElement =
318
+ root.querySelector(TABLE_SEL) ||
319
+ root.querySelector('[role="grid"]');
316
320
  return getDomWidth(tableElement);
317
321
  },
318
322
  };
@@ -1,10 +1,11 @@
1
- export function isCustomerColumn(column) {
2
- return column.internal !== true;
3
- }
4
-
5
- export function getColumns(state) {
6
- return state.columns;
7
- }
1
+ /**
2
+ * This file exists in order to get around circular dependencies.
3
+ * For ex. the `columns.js` file has a dependency on `sort.js`,
4
+ * which also has a dependency on `columns.js` for `getColumnName()`.
5
+ *
6
+ * We split out some of the functions that could cause circular dependencies with
7
+ * `column.js` into the `*-shared.js` files. `inlineEdit-shared.js` is another.
8
+ */
8
9
 
9
10
  export function getColumnName(column) {
10
11
  return column.columnKey || column.fieldName;
@@ -7,11 +7,7 @@ import {
7
7
  } from './rowNumber';
8
8
  import { isTreeType, isValidTypeForTree } from './types';
9
9
  import { updateColumnSortingState } from './sort';
10
- import { generateColKeyValue } from './keys';
11
10
  import rowActionsDefaultAriaLabel from '@salesforce/label/LightningDatatable.rowActionsDefaultAriaLabel';
12
- import { getColumns, isCustomerColumn } from './columns-shared';
13
-
14
- export { getColumns, isCustomerColumn } from './columns-shared';
15
11
 
16
12
  const i18n = {
17
13
  rowActionsDefaultAriaLabel,
@@ -27,6 +23,14 @@ export function hasColumns(state) {
27
23
  return getColumns(state).length > 0;
28
24
  }
29
25
 
26
+ export function isCustomerColumn(column) {
27
+ return column.internal !== true;
28
+ }
29
+
30
+ export function getColumns(state) {
31
+ return state.columns;
32
+ }
33
+
30
34
  export const SELECTABLE_ROW_CHECKBOX = 'SELECTABLE_CHECKBOX';
31
35
 
32
36
  const SELECTABLE_COLUMN = {
@@ -219,6 +223,19 @@ export function getCellAttributesValues(column) {
219
223
  return {};
220
224
  }
221
225
 
226
+ /**
227
+ * Generates a unique column key value.
228
+ *
229
+ * @param {object} columnMetadata - the object for an specific column metadata
230
+ * @param {int} index - optionally, the index of the column.
231
+ * @returns {string} It generate the column key value based on the column field name and type.
232
+ */
233
+ export function generateColKeyValue(columnMetadata, index) {
234
+ const { columnKey, fieldName, type } = columnMetadata;
235
+ const prefix = columnKey || fieldName || index;
236
+ return `${prefix}-${type}-${index}`;
237
+ }
238
+
222
239
  /**
223
240
  * Return the index in dt.columns (user definition) related to colKeyValue.
224
241
  * -1 if no column with that key exist or if its internal.
@@ -243,6 +260,23 @@ export function getUserColumnIndex(state, colKeyValue) {
243
260
  return stateColumnIndex - internalColumns;
244
261
  }
245
262
 
263
+ /**
264
+ * It generate headerIndexes based in the current metadata
265
+ * headerIndexes represent the position of the header(column)
266
+ * based on the unique colKeyValue
267
+ *
268
+ * These indexes are set in the state object - `state.headerIndexes`
269
+ *
270
+ * @param {object} columns - the current normalized column metadata
271
+ * @returns {object} headerIndexes e.g. { 'name-text': 0, 'amount-number': 1 }
272
+ */
273
+ export const generateHeaderIndexes = function (columns) {
274
+ return columns.reduce((prev, col, index) => {
275
+ prev[generateColKeyValue(col, index)] = index;
276
+ return prev;
277
+ }, {});
278
+ };
279
+
246
280
  /**
247
281
  * Return the index in state.columns (internal definition) related to colKeyValue.
248
282
  *