lightning-base-components 1.21.5-alpha → 1.21.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 (379) hide show
  1. package/metadata/raptor.json +46 -4
  2. package/package.json +125 -3
  3. package/scopedImports/@salesforce-label-LightningColorPicker.a11yDefaultText.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningDatatable.multiColumnSortingToast.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuColumns.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuMultiColumnSort.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuRows.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningDatatable.sortingMenuTooltip.js +1 -0
  9. package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -1
  10. package/scopedImports/@salesforce-label-LightningLookup.advancedSearchMobile.js +1 -1
  11. package/scopedImports/@salesforce-label-LightningLookup.modalTitle.js +1 -0
  12. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.addRule.js +1 -0
  13. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.applyButton.js +1 -0
  14. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.cancelButton.js +1 -0
  15. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.clearButton.js +1 -0
  16. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.duplicateValueValidation.js +1 -0
  17. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.firstRuleHeading.js +1 -0
  18. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.modalTitle.js +1 -0
  19. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.otherRuleHeading.js +1 -0
  20. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.ruleLimit.js +1 -0
  21. package/scopedImports/@salesforce-label-LightningMultiColumnSortingModal.ruleLimitReached.js +1 -0
  22. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.ascending.js +1 -0
  23. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.descending.js +1 -0
  24. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.dropdownPlaceholder.js +1 -0
  25. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.missingValueValidation.js +1 -0
  26. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.moveDownTooltip.js +1 -0
  27. package/scopedImports/@salesforce-label-LightningPrimitiveColumnSorter.moveUpTooltip.js +1 -0
  28. package/scopedImports/@salesforce-label-LightningProgressIndicator.pathCurrentStage.js +1 -0
  29. package/scopedImports/@salesforce-label-LightningRecordPicker.emptyStateNoResultText.js +1 -0
  30. package/scopedImports/@salesforce-label-LightningRecordPicker.messageWhenSearchTermTooShort.js +1 -0
  31. package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForMoreThanOneHundredRecords.js +1 -0
  32. package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForMultipleRecords.js +1 -0
  33. package/scopedImports/@salesforce-label-LightningRecordPicker.resultCountDescriptionForOneRecord.js +1 -0
  34. package/scopedImports/@salesforce-label-LightningRecordPicker.resultsLoading.js +1 -0
  35. package/scopedImports/@salesforce-label-LightningRecordPicker.searchInputHelp.js +1 -0
  36. package/src/lightning/accordion/accordion.js +21 -14
  37. package/src/lightning/accordionSection/button.slds.css +16 -15
  38. package/src/lightning/alert/alert.js +10 -8
  39. package/src/lightning/ariaObserver/ariaObserver.js +19 -5
  40. package/src/lightning/badge/badge.slds.css +1 -1
  41. package/src/lightning/baseCombobox/base-combobox.slds.css +1 -1
  42. package/src/lightning/baseCombobox/baseCombobox.html +2 -1
  43. package/src/lightning/baseCombobox/baseCombobox.js +21 -0
  44. package/src/lightning/baseCombobox/input-text.slds.css +5 -5
  45. package/src/lightning/button/button.js +5 -0
  46. package/src/lightning/button/button.slds.css +16 -15
  47. package/src/lightning/buttonIcon/__docs__/buttonIcon.md +4 -0
  48. package/src/lightning/buttonIcon/__examples__/basic/basic.html +17 -1
  49. package/src/lightning/buttonIcon/button-icon.slds.css +41 -25
  50. package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +33 -229
  51. package/src/lightning/buttonIconStateful/button-icon.slds.css +41 -25
  52. package/src/lightning/buttonIconStateful/button.slds.css +16 -15
  53. package/src/lightning/buttonMenu/button-icon.slds.css +41 -25
  54. package/src/lightning/buttonMenu/button-menu.slds.css +41 -15
  55. package/src/lightning/buttonMenu/button.slds.css +16 -15
  56. package/src/lightning/buttonMenu/buttonMenu.css +1 -1
  57. package/src/lightning/buttonMenu/buttonMenu.html +1 -1
  58. package/src/lightning/buttonMenu/buttonMenu.js +44 -4
  59. package/src/lightning/buttonStateful/button-stateful.slds.css +1 -4
  60. package/src/lightning/buttonStateful/button.slds.css +16 -15
  61. package/src/lightning/calendar/calendar.html +3 -4
  62. package/src/lightning/card/card.html +1 -1
  63. package/src/lightning/colorPickerCustom/colorPickerCustom.html +1 -1
  64. package/src/lightning/colorPickerCustom/colorPickerCustom.js +0 -9
  65. package/src/lightning/colorPickerCustom/input-text.slds.css +5 -5
  66. package/src/lightning/combobox/form-element.slds.css +5 -1
  67. package/src/lightning/confirm/confirm.js +10 -8
  68. package/src/lightning/datatable/__docs__/datatable.md +0 -3
  69. package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/README.md +17 -0
  70. package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/customComponentPopupTableWrapper.html +11 -0
  71. package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/customComponentPopupTableWrapper.js +25 -0
  72. package/src/lightning/datatable/__examples__disabled/customComponentPopupTableWrapper/generateData.js +15 -0
  73. package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/customInput.html +4 -0
  74. package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/myCustomTypePopupTable.js +17 -0
  75. package/src/lightning/datatable/__examples__disabled/myCustomTypePopupTable/nestedSimpleComponentParent.html +7 -0
  76. package/src/lightning/datatable/__examples__disabled/simpleComponentPopupNested/simpleComponentPopupNested.html +31 -0
  77. package/src/lightning/datatable/__examples__disabled/simpleComponentPopupNested/simpleComponentPopupNested.js +36 -0
  78. package/src/lightning/datatable/columnWidthManager.js +19 -16
  79. package/src/lightning/datatable/columns.js +90 -42
  80. package/src/lightning/datatable/datatable.js +571 -148
  81. package/src/lightning/datatable/errors.js +1 -1
  82. package/src/lightning/datatable/indexes.js +32 -21
  83. package/src/lightning/datatable/infiniteLoading.js +7 -6
  84. package/src/lightning/datatable/inlineEdit.js +52 -64
  85. package/src/lightning/datatable/keyboard.js +583 -195
  86. package/src/lightning/datatable/renderManager.js +21 -27
  87. package/src/lightning/datatable/rowLevelActions.js +5 -14
  88. package/src/lightning/datatable/rowSelection.js +36 -17
  89. package/src/lightning/datatable/rowSelectionShared.js +1 -0
  90. package/src/lightning/datatable/rows.js +224 -132
  91. package/src/lightning/datatable/rowsInlining.js +473 -0
  92. package/src/lightning/datatable/sort.js +40 -15
  93. package/src/lightning/datatable/state.js +17 -4
  94. package/src/lightning/datatable/templates/div/div.html +807 -91
  95. package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +29 -3
  96. package/src/lightning/datatable/templates/table/table.css +29 -1
  97. package/src/lightning/datatable/templates/table/table.html +786 -87
  98. package/src/lightning/datatable/tree.js +0 -33
  99. package/src/lightning/datatable/utils.js +50 -0
  100. package/src/lightning/datatable/virtualization.js +44 -19
  101. package/src/lightning/datatable/wrapText.js +7 -10
  102. package/src/lightning/datepicker/datepicker.html +3 -1
  103. package/src/lightning/datepicker/datepicker.js +43 -4
  104. package/src/lightning/datepicker/form-element.slds.css +5 -1
  105. package/src/lightning/datepicker/input-text.slds.css +5 -5
  106. package/src/lightning/datetimepicker/datetimepicker.html +7 -1
  107. package/src/lightning/datetimepicker/datetimepicker.js +30 -2
  108. package/src/lightning/datetimepicker/form-element.slds.css +5 -1
  109. package/src/lightning/datetimepicker/input-text.slds.css +5 -5
  110. package/src/lightning/dualListbox/form-element.slds.css +5 -1
  111. package/src/lightning/focusTrap/focusTrap.css +7 -0
  112. package/src/lightning/groupedCombobox/form-element.slds.css +5 -1
  113. package/src/lightning/groupedCombobox/input-text.slds.css +5 -5
  114. package/src/lightning/helptext/button-icon.slds.css +41 -25
  115. package/src/lightning/helptext/form-element.slds.css +5 -1
  116. package/src/lightning/icon/__docs__/icon.md +0 -2
  117. package/src/lightning/iconSvgTemplates/buildTemplates/standard/account_score.html +8 -0
  118. package/src/lightning/iconSvgTemplates/buildTemplates/standard/aggregate.html +8 -0
  119. package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_participant.html +11 -0
  120. package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_product_participant.html +12 -0
  121. package/src/lightning/iconSvgTemplates/buildTemplates/standard/cost_model.html +7 -0
  122. package/src/lightning/iconSvgTemplates/buildTemplates/standard/labels.html +8 -0
  123. package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_fee.html +7 -0
  124. package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_rate.html +7 -0
  125. package/src/lightning/iconSvgTemplates/buildTemplates/standard/party_profile.html +8 -0
  126. package/src/lightning/iconSvgTemplates/buildTemplates/standard/path_experiment.html +7 -0
  127. package/src/lightning/iconSvgTemplates/buildTemplates/standard/people_score.html +8 -0
  128. package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  129. package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_tier.html +7 -0
  130. package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort.html +7 -0
  131. package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort_member.html +7 -0
  132. package/src/lightning/iconSvgTemplates/buildTemplates/standard/rate_adjustment.html +7 -0
  133. package/src/lightning/iconSvgTemplates/buildTemplates/standard/record_consent.html +7 -0
  134. package/src/lightning/iconSvgTemplates/buildTemplates/standard/whatsapp.html +7 -0
  135. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +40 -1
  136. package/src/lightning/iconSvgTemplates/buildTemplates/utility/aggregate.html +8 -0
  137. package/src/lightning/iconSvgTemplates/buildTemplates/utility/array.html +7 -0
  138. package/src/lightning/iconSvgTemplates/buildTemplates/utility/bottom_group_alignment.html +7 -0
  139. package/src/lightning/iconSvgTemplates/buildTemplates/utility/cant_sync.html +7 -0
  140. package/src/lightning/iconSvgTemplates/buildTemplates/utility/center_group_alignment.html +8 -0
  141. package/src/lightning/iconSvgTemplates/buildTemplates/utility/columns.html +7 -0
  142. package/src/lightning/iconSvgTemplates/buildTemplates/utility/fully_synced.html +8 -0
  143. package/src/lightning/iconSvgTemplates/buildTemplates/utility/inner_join.html +7 -0
  144. package/src/lightning/iconSvgTemplates/buildTemplates/utility/join.html +8 -0
  145. package/src/lightning/iconSvgTemplates/buildTemplates/utility/left_join.html +14 -0
  146. package/src/lightning/iconSvgTemplates/buildTemplates/utility/macros.html +2 -2
  147. package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_in_sync.html +7 -0
  148. package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_saved.html +9 -0
  149. package/src/lightning/iconSvgTemplates/buildTemplates/utility/outer_join.html +7 -0
  150. package/src/lightning/iconSvgTemplates/buildTemplates/utility/path_experiment.html +7 -0
  151. package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort.html +7 -0
  152. package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort_member.html +7 -0
  153. package/src/lightning/iconSvgTemplates/buildTemplates/utility/record_consent.html +7 -0
  154. package/src/lightning/iconSvgTemplates/buildTemplates/utility/right_join.html +7 -0
  155. package/src/lightning/iconSvgTemplates/buildTemplates/utility/skill.html +8 -0
  156. package/src/lightning/iconSvgTemplates/buildTemplates/utility/sync_in_progress.html +7 -0
  157. package/src/lightning/iconSvgTemplates/buildTemplates/utility/top_group_alignment.html +7 -0
  158. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/account_score.html +8 -0
  159. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/aggregate.html +8 -0
  160. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_participant.html +11 -0
  161. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
  162. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/cost_model.html +7 -0
  163. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/labels.html +8 -0
  164. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_fee.html +7 -0
  165. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_rate.html +7 -0
  166. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/party_profile.html +8 -0
  167. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/path_experiment.html +7 -0
  168. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/people_score.html +8 -0
  169. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  170. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
  171. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort.html +7 -0
  172. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort_member.html +7 -0
  173. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/rate_adjustment.html +7 -0
  174. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/record_consent.html +7 -0
  175. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/whatsapp.html +7 -0
  176. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +40 -1
  177. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/aggregate.html +8 -0
  178. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/array.html +7 -0
  179. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
  180. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/cant_sync.html +7 -0
  181. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/center_group_alignment.html +8 -0
  182. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/columns.html +7 -0
  183. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/fully_synced.html +8 -0
  184. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/inner_join.html +7 -0
  185. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/join.html +8 -0
  186. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/left_join.html +14 -0
  187. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/macros.html +2 -2
  188. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_in_sync.html +7 -0
  189. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_saved.html +9 -0
  190. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/outer_join.html +7 -0
  191. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/path_experiment.html +7 -0
  192. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort.html +7 -0
  193. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort_member.html +7 -0
  194. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/record_consent.html +7 -0
  195. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/right_join.html +7 -0
  196. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/skill.html +8 -0
  197. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/sync_in_progress.html +7 -0
  198. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/top_group_alignment.html +7 -0
  199. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/account_score.html +8 -0
  200. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/aggregate.html +8 -0
  201. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_participant.html +11 -0
  202. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_product_participant.html +12 -0
  203. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/cost_model.html +7 -0
  204. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/labels.html +8 -0
  205. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_fee.html +7 -0
  206. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_rate.html +7 -0
  207. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/party_profile.html +8 -0
  208. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/path_experiment.html +7 -0
  209. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/people_score.html +8 -0
  210. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  211. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_tier.html +7 -0
  212. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort.html +7 -0
  213. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort_member.html +7 -0
  214. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/rate_adjustment.html +7 -0
  215. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/record_consent.html +7 -0
  216. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/whatsapp.html +7 -0
  217. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +19 -1
  218. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/account_score.html +8 -0
  219. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/aggregate.html +8 -0
  220. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_participant.html +11 -0
  221. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
  222. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/cost_model.html +7 -0
  223. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/labels.html +8 -0
  224. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_fee.html +7 -0
  225. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_rate.html +7 -0
  226. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/party_profile.html +8 -0
  227. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/path_experiment.html +7 -0
  228. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/people_score.html +8 -0
  229. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  230. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
  231. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort.html +7 -0
  232. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort_member.html +7 -0
  233. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/rate_adjustment.html +7 -0
  234. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/record_consent.html +7 -0
  235. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/whatsapp.html +7 -0
  236. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +19 -1
  237. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +22 -1
  238. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/aggregate.html +8 -0
  239. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/array.html +7 -0
  240. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/bottom_group_alignment.html +7 -0
  241. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/cant_sync.html +7 -0
  242. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/center_group_alignment.html +8 -0
  243. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/columns.html +7 -0
  244. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/fully_synced.html +8 -0
  245. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/inner_join.html +7 -0
  246. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/join.html +8 -0
  247. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/left_join.html +14 -0
  248. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/macros.html +2 -2
  249. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_in_sync.html +7 -0
  250. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_saved.html +9 -0
  251. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/outer_join.html +7 -0
  252. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/path_experiment.html +7 -0
  253. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort.html +7 -0
  254. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort_member.html +7 -0
  255. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/record_consent.html +7 -0
  256. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/right_join.html +7 -0
  257. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/skill.html +8 -0
  258. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/sync_in_progress.html +7 -0
  259. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/top_group_alignment.html +7 -0
  260. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +22 -1
  261. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/aggregate.html +8 -0
  262. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/array.html +7 -0
  263. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
  264. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/cant_sync.html +7 -0
  265. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/center_group_alignment.html +8 -0
  266. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/columns.html +7 -0
  267. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/fully_synced.html +8 -0
  268. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/inner_join.html +7 -0
  269. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/join.html +8 -0
  270. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/left_join.html +14 -0
  271. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/macros.html +2 -2
  272. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_in_sync.html +7 -0
  273. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_saved.html +9 -0
  274. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/outer_join.html +7 -0
  275. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/path_experiment.html +7 -0
  276. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort.html +7 -0
  277. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort_member.html +7 -0
  278. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/record_consent.html +7 -0
  279. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/right_join.html +7 -0
  280. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/skill.html +8 -0
  281. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/sync_in_progress.html +7 -0
  282. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/top_group_alignment.html +7 -0
  283. package/src/lightning/iconUtils/iconColors.js +1 -1
  284. package/src/lightning/input/form-element.slds.css +5 -1
  285. package/src/lightning/input/input.html +16 -2
  286. package/src/lightning/input/input.js +91 -3
  287. package/src/lightning/input/input.js-meta.xml +3 -0
  288. package/src/lightning/inputAddress/addressFormat.js +25 -11
  289. package/src/lightning/inputAddress/fieldsLayout.js +3 -0
  290. package/src/lightning/inputAddress/form-element.slds.css +5 -1
  291. package/src/lightning/inputAddress/input-text.slds.css +5 -5
  292. package/src/lightning/inputAddress/inputAddress.html +1 -1
  293. package/src/lightning/inputAddress/inputAddress.js +27 -11
  294. package/src/lightning/inputLocation/form-element.slds.css +5 -1
  295. package/src/lightning/inputLocation/input-text.slds.css +5 -5
  296. package/src/lightning/inputName/form-element.slds.css +5 -1
  297. package/src/lightning/inputName/input-text.slds.css +5 -5
  298. package/src/lightning/internationalizationLibrary/address/AddressFormat.js +2 -0
  299. package/src/lightning/layout/__docs__/layout.md +0 -2
  300. package/src/lightning/lookupAddress/form-element.slds.css +5 -1
  301. package/src/lightning/menuItem/menu-item.slds.css +3 -1
  302. package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +7 -3
  303. package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +18 -11
  304. package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
  305. package/src/lightning/modalBase/modalBase.css +4 -0
  306. package/src/lightning/modalBase/modalBase.html +16 -21
  307. package/src/lightning/modalBase/modalBase.js +51 -87
  308. package/src/lightning/modalHeader/modalHeader.html +3 -15
  309. package/src/lightning/modalHeader/modalHeader.js +14 -61
  310. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.css +14 -0
  311. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.html +55 -0
  312. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js +430 -0
  313. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js-meta.xml +4 -0
  314. package/src/lightning/overlayManager/overlayManager.js +16 -0
  315. package/src/lightning/pill/pill.js +19 -13
  316. package/src/lightning/pillContainer/button.slds.css +16 -15
  317. package/src/lightning/pillContainer/pillContainer.js +2 -1
  318. package/src/lightning/pillContainer/standardPillContainer.html +6 -2
  319. package/src/lightning/positionLibrary/direction.js +19 -0
  320. package/src/lightning/primitiveBubble/primitiveBubble.js +33 -11
  321. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.html +2 -2
  322. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +8 -0
  323. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.css +34 -0
  324. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +60 -0
  325. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +107 -0
  326. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +37 -4
  327. package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.css +5 -0
  328. package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +9 -0
  329. package/src/lightning/primitiveInputCheckbox/form-element.slds.css +5 -1
  330. package/src/lightning/primitiveInputCheckbox/input-checkbox.slds.css +3 -3
  331. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +1 -1
  332. package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +5 -1
  333. package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -5
  334. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +1 -1
  335. package/src/lightning/primitiveInputColor/form-element.slds.css +5 -1
  336. package/src/lightning/primitiveInputColor/input-text.slds.css +5 -5
  337. package/src/lightning/primitiveInputColor/primitiveInputColor.html +5 -2
  338. package/src/lightning/primitiveInputColor/primitiveInputColor.js +2 -0
  339. package/src/lightning/primitiveInputFile/button.slds.css +16 -15
  340. package/src/lightning/primitiveInputFile/form-element.slds.css +5 -1
  341. package/src/lightning/primitiveInputFile/primitiveInputFile.html +1 -1
  342. package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +1 -1
  343. package/src/lightning/primitiveInputSimple/form-element.slds.css +5 -1
  344. package/src/lightning/primitiveInputSimple/input-text.slds.css +5 -5
  345. package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +3 -2
  346. package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +15 -0
  347. package/src/lightning/primitiveInputToggle/form-element.slds.css +5 -1
  348. package/src/lightning/primitiveInputToggle/input-toggle.slds.css +16 -14
  349. package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +1 -1
  350. package/src/lightning/progressBar/progress-bar.slds.css +1 -1
  351. package/src/lightning/progressIndicator/path.html +8 -2
  352. package/src/lightning/progressIndicator/progressIndicator.js +26 -2
  353. package/src/lightning/progressRing/progress-ring.slds.css +1 -1
  354. package/src/lightning/progressStep/progressStep.js +2 -1
  355. package/src/lightning/prompt/prompt.js +11 -9
  356. package/src/lightning/radioGroup/form-element.slds.css +5 -1
  357. package/src/lightning/radioGroup/input-radio-group.slds.css +4 -10
  358. package/src/lightning/select/form-element.slds.css +5 -1
  359. package/src/lightning/select/select.js +89 -7
  360. package/src/lightning/tabBar/tab-bar.slds.css +11 -0
  361. package/src/lightning/tabset/tabset.slds.css +1 -1
  362. package/src/lightning/textarea/__examples__/various/various.html +18 -1
  363. package/src/lightning/textarea/form-element.slds.css +5 -1
  364. package/src/lightning/textarea/textarea.html +1 -0
  365. package/src/lightning/textarea/textarea.js +25 -0
  366. package/src/lightning/textarea/textarea.slds.css +2 -2
  367. package/src/lightning/timepicker/form-element.slds.css +5 -1
  368. package/src/lightning/timepicker/timepicker.html +4 -1
  369. package/src/lightning/timepicker/timepicker.js +3 -0
  370. package/src/lightning/toast/button-icon.slds.css +41 -25
  371. package/src/lightning/tooltipLibrary/tooltipLibrary.js +4 -15
  372. package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +1 -1
  373. package/src/lightning/verticalNavigationItemBadge/badge.slds.css +1 -1
  374. package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +1 -1
  375. package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +1 -1
  376. package/src/lightning/verticalNavigationOverflow/button.slds.css +16 -15
  377. package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +1 -1
  378. package/scopedImports/@salesforce-label-LightningLookup.messageWhenSearchTermTooShort.js +0 -1
  379. package/src/lightning/datatable/columns-shared.js +0 -12
@@ -5,6 +5,12 @@ import labelAriaLiveActionMode from '@salesforce/label/LightningDatatable.ariaLi
5
5
  import labelAriaLiveNavigationMode from '@salesforce/label/LightningDatatable.ariaLiveNavigationMode';
6
6
  import { EVENTS as FORMATTED_LOOKUP_EVENTS } from 'lightning/formattedLookup';
7
7
  import { generateUniqueId } from 'lightning/inputUtils';
8
+ import MultiColumnSortingModal from 'lightning/multiColumnSortingModal';
9
+ import {
10
+ getLinkInfo,
11
+ hasLinkProvider,
12
+ updateRawLinkInfo,
13
+ } from 'lightning/routingService';
8
14
  import {
9
15
  classSetToString,
10
16
  isSafari,
@@ -15,7 +21,7 @@ import {
15
21
  import { LightningDatatableResizeObserver } from './resizeObserver';
16
22
  import { ColumnWidthManager } from './columnWidthManager';
17
23
  import { getDefaultState } from './state';
18
- import { normalizeColumns, generateHeaderIndexes } from './columns';
24
+ import { setColumns } from './columns';
19
25
  import {
20
26
  getCustomerColumnWidths,
21
27
  getResizerDefaultState,
@@ -29,9 +35,10 @@ import {
29
35
  import { setErrors } from './errors';
30
36
  import {
31
37
  setKeyField,
32
- updateRowsAndCellIndexes,
33
- updateCellClassForRoleBasedMode,
34
38
  recomputeCellStyles,
39
+ updateCells,
40
+ updateCellClassForRoleBasedMode,
41
+ updateRowsAndCells,
35
42
  } from './rows';
36
43
  import {
37
44
  handleCellButtonClick,
@@ -56,10 +63,11 @@ import {
56
63
  } from './rowSelectionShared';
57
64
  import {
58
65
  handleHeaderActionMenuClosed,
59
- handleHeaderActionTriggered,
60
66
  handleHeaderActionMenuOpening,
67
+ handleHeaderActionTriggered,
61
68
  updateHeaderInternalActions,
62
69
  } from './headerActions';
70
+ import { getCellByKeys, getRowByKey } from './indexes';
63
71
  import {
64
72
  handleLoadMoreCheck,
65
73
  handlePrefetch,
@@ -85,12 +93,15 @@ import {
85
93
  datatableHasFocus,
86
94
  FOCUS_CLASS,
87
95
  getActiveCellElement,
88
- getIndexesActiveCell,
89
- getIndexesByKeys,
96
+ getCellElementChild,
97
+ getCellElementFromEventTarget,
90
98
  handleDatatableFocusIn,
91
99
  handleDatatableFocusOut,
92
100
  handleKeydownOnCell,
93
101
  handleKeydownOnTable,
102
+ handlePrimitiveDatatableCellClick,
103
+ handlePrimitiveDatatableCellFocus,
104
+ handlePrimitiveDatatableCellKeydown,
94
105
  isActiveCell,
95
106
  isCellElement,
96
107
  KEYBOARD_ACTION_MODE,
@@ -111,12 +122,7 @@ import {
111
122
  updateRowNavigationMode,
112
123
  updateRowTabIndex,
113
124
  } from './keyboard';
114
- import {
115
- isViewportRenderingEnabled,
116
- setViewportRendering,
117
- setVirtualize,
118
- RenderManager,
119
- } from './renderManager';
125
+ import { setVirtualize, RenderManager } from './renderManager';
120
126
  import {
121
127
  setDefaultSortDirection,
122
128
  setSortedBy,
@@ -128,17 +134,22 @@ import {
128
134
  getRowDataSelector,
129
135
  getScrollerX,
130
136
  getScrollerY,
137
+ isLoadMore,
138
+ isObjectLike,
139
+ isRenderModeInline,
140
+ isRenderModeRoleBased,
131
141
  } from './utils';
132
142
  import { setWrapTextMaxLines } from './wrapText';
133
143
  import {
134
144
  handleVariableRowHeights,
135
145
  resetRowHeights,
136
- resetTableHeight,
137
146
  findFirstVisibleIndex,
147
+ addTableHeight,
138
148
  } from './virtualization';
139
- import { hasTreeDataType } from './tree';
140
149
  import DatatableTypes from './types';
141
150
 
151
+ const { PrivateLookupItemPickedEvent } = FORMATTED_LOOKUP_EVENTS;
152
+
142
153
  const i18n = {
143
154
  ariaLiveNavigationMode: labelAriaLiveNavigationMode,
144
155
  ariaLiveActionMode: labelAriaLiveActionMode,
@@ -188,14 +199,18 @@ export default class LightningDatatable extends LightningElement {
188
199
  _draftValues = [];
189
200
  _isResizing = false; // Whether resizing is in progress
190
201
  _lastRenderedRow = null; // last rendered row, used for UTAM
202
+ _positionRelationship;
191
203
  _privateTypes = {};
192
204
  _rawColumns = [];
193
205
  _renderConfig;
194
206
  _renderManager;
195
207
  _renderMode = 'default';
208
+ _renderedTemplate = tableTemplate;
196
209
  _shouldResetFocus = false; // used to ensure focus isn't lost from changes in renderedRows
197
210
  _suppressBottomBar = false;
198
- _widthObserver = null; // Instance of LightningDatatableResizeObserver
211
+ _widthObserver; // Instance of LightningDatatableResizeObserver
212
+ _hasSetInitialCustomTypes = false;
213
+ _shouldResetCustomTypes = false;
199
214
 
200
215
  /************************* PUBLIC PROPERTIES *************************/
201
216
 
@@ -255,7 +270,7 @@ export default class LightningDatatable extends LightningElement {
255
270
  set columns(value) {
256
271
  const _rawColumns = Array.isArray(value) ? value : [];
257
272
  this._rawColumns = _rawColumns;
258
- this.updateColumns(this._rawColumns);
273
+ this.updateColumns(_rawColumns);
259
274
  this._columnWidthManager.handleColumnsChange(this.state.columns);
260
275
  }
261
276
 
@@ -270,25 +285,35 @@ export default class LightningDatatable extends LightningElement {
270
285
  }
271
286
 
272
287
  set data(value) {
273
- const { state } = this;
274
- const { data: previousData } = state;
288
+ const { _customerSelectedRows, state } = this;
289
+ const { data: previousData, columns } = state;
275
290
  const data = Array.isArray(value) ? value : [];
291
+ const isInfiniteLoading = isLoadMore(previousData, data);
276
292
 
277
293
  // Untracked state change.
278
294
  state.data = data;
279
- this._columnWidthManager.handleDataChange(
280
- previousData,
281
- data,
282
- state.columns
283
- );
295
+ if (!isInfiniteLoading && data.length && columns.length) {
296
+ this._columnWidthManager.handleDataChange(columns);
297
+ }
284
298
 
285
299
  // do necessary updates since rows have changed
286
300
  if (this.hasValidKeyField) {
287
- this.updateRowsState();
288
- resetTableHeight(state);
301
+ if (this.isConnected) {
302
+ this.updateRows();
303
+ }
304
+ if (isInfiniteLoading) {
305
+ addTableHeight(state, previousData, data);
306
+ } else {
307
+ // if data is new, reset all virtualization data
308
+ state.heightCache = {};
309
+ state.offsets = [0];
310
+ state.offsetRanges = [{ start: 0, end: 0 }];
311
+ state.firstVisibleIndex = 0;
312
+ state.tableHeight = state.rowHeight * state.rows.length;
313
+ }
289
314
  }
290
- if (this._customerSelectedRows) {
291
- this.setSelectedRows(this._customerSelectedRows);
315
+ if (_customerSelectedRows) {
316
+ this.setSelectedRows(_customerSelectedRows);
292
317
  }
293
318
  }
294
319
 
@@ -324,7 +349,7 @@ export default class LightningDatatable extends LightningElement {
324
349
  this._draftValues = value;
325
350
  setDirtyValues(state, value);
326
351
 
327
- if (this.hasValidKeyField) {
352
+ if (this.isConnected && this.hasValidKeyField) {
328
353
  this.updateRowsAndCells();
329
354
  }
330
355
 
@@ -361,8 +386,11 @@ export default class LightningDatatable extends LightningElement {
361
386
  }
362
387
 
363
388
  set errors(value) {
364
- setErrors(this.state, value);
365
- this.updateRowsState();
389
+ const { state } = this;
390
+ setErrors(state, value);
391
+ if (this.isConnected) {
392
+ updateCells(state);
393
+ }
366
394
  }
367
395
 
368
396
  /**
@@ -376,7 +404,7 @@ export default class LightningDatatable extends LightningElement {
376
404
  }
377
405
 
378
406
  set hideCheckboxColumn(value) {
379
- const { state } = this;
407
+ const { _rawColumns, state } = this;
380
408
  const normalizedValue = normalizeBoolean(value);
381
409
 
382
410
  this._columnWidthManager.handleCheckboxColumnChange(
@@ -387,6 +415,41 @@ export default class LightningDatatable extends LightningElement {
387
415
  // Untracked state changes.
388
416
  state.hideCheckboxColumn = normalizedValue;
389
417
  // update the columns metadata again to update the status.
418
+
419
+ if (this.isConnected) {
420
+ this.updateColumns(_rawColumns);
421
+ } else if (_rawColumns) {
422
+ // Component has not yet rendered so
423
+ // tree state should be reset to default
424
+ state.hadTreeDataTypePreviously = false;
425
+ state.treeColumn = undefined;
426
+ // Tracked state change.
427
+ setColumns(state, _rawColumns, this._privateTypes);
428
+ }
429
+ }
430
+
431
+ /**
432
+ * If present, the actions menu is displayed to enable users to do advanced sorting.
433
+ * @type {Boolean}
434
+ * @default false
435
+ */
436
+ @api
437
+ get showActionsMenu() {
438
+ return this.state.showActionsMenu;
439
+ }
440
+
441
+ set showActionsMenu(value) {
442
+ const { state } = this;
443
+ const normalizedValue = normalizeBoolean(value);
444
+
445
+ this._columnWidthManager.handleActionsColumnChange(
446
+ state.showActionsMenu,
447
+ normalizedValue,
448
+ state.columns
449
+ );
450
+
451
+ state.showActionsMenu = normalizedValue;
452
+ // update the columns metadata again to update the status.
390
453
  this.updateColumns(this._rawColumns);
391
454
  }
392
455
 
@@ -452,7 +515,9 @@ export default class LightningDatatable extends LightningElement {
452
515
  setKeyField(state, value);
453
516
  // Tracked state change.
454
517
  setDirtyValues(state, this._draftValues);
455
- this.updateRowsState();
518
+ if (this.isConnected) {
519
+ this.updateRows();
520
+ }
456
521
  }
457
522
 
458
523
  /**
@@ -503,9 +568,13 @@ export default class LightningDatatable extends LightningElement {
503
568
 
504
569
  set maxRowSelection(value) {
505
570
  const { state } = this;
571
+ if (!state.hasCalledUpdateRowsAndCells) {
572
+ // Tracked state changes.
573
+ this.updateRowsAndCells();
574
+ }
506
575
  const previousSelectionLength = getCurrentSelectionLength(state);
507
576
  // A mix of tracked and untracked state changes.
508
- setMaxRowSelection(state, value);
577
+ setMaxRowSelection(state, value, this._datatableId);
509
578
  if (previousSelectionLength > 0) {
510
579
  this.fireSelectedRowsChange(this.getSelectedRows());
511
580
  }
@@ -550,9 +619,7 @@ export default class LightningDatatable extends LightningElement {
550
619
  }
551
620
 
552
621
  set renderConfig(value) {
553
- if (typeof value === 'object') {
554
- setViewportRendering(this.state, value.viewportRendering);
555
-
622
+ if (isObjectLike(value)) {
556
623
  this._renderManager.configure(
557
624
  this.state,
558
625
  this.getWrapperHeight,
@@ -586,11 +653,28 @@ export default class LightningDatatable extends LightningElement {
586
653
 
587
654
  set renderMode(value) {
588
655
  const { _renderConfig, state } = this;
589
- this._renderMode = normalizeString(value, {
656
+ const renderMode = normalizeString(value, {
590
657
  fallbackValue: 'default',
591
- validValues: ['default', 'role-based'],
658
+ validValues: [
659
+ 'default',
660
+ 'inline',
661
+ 'role-based',
662
+ 'role-based-inline',
663
+ ],
592
664
  });
593
- state.renderModeRoleBased = this._renderMode === 'role-based';
665
+ const renderModeInline = isRenderModeInline(renderMode);
666
+ const renderModeRoleBased = isRenderModeRoleBased(renderMode);
667
+
668
+ this._renderMode = renderMode;
669
+ // Untracked state changes.
670
+ state.hasRenderedFirstTime = false;
671
+ state.hasRenderedTable = false;
672
+ state.renderModeInline = renderModeInline;
673
+ state.renderModeRoleBased = renderModeRoleBased;
674
+ if (this.isConnected) {
675
+ // Tracked state changes.
676
+ this.updateRowsAndCells();
677
+ }
594
678
  if (_renderConfig) {
595
679
  setVirtualize(state, _renderConfig.virtualize);
596
680
  }
@@ -660,6 +744,9 @@ export default class LightningDatatable extends LightningElement {
660
744
  }
661
745
 
662
746
  set selectedRows(value) {
747
+ if (!this.state.hasCalledUpdateRowsAndCells) {
748
+ this.updateRowsAndCells();
749
+ }
663
750
  this._customerSelectedRows = value;
664
751
  this.setSelectedRows(value);
665
752
  }
@@ -684,13 +771,23 @@ export default class LightningDatatable extends LightningElement {
684
771
  );
685
772
  // Untracked state change.
686
773
  state.showRowNumberColumn = normalizeBoolean(value);
687
- this.updateColumns(_rawColumns);
774
+
775
+ if (this.isConnected) {
776
+ this.updateColumns(_rawColumns);
777
+ } else if (_rawColumns) {
778
+ // Component has not yet rendered so
779
+ // tree state should be reset to default
780
+ state.hadTreeDataTypePreviously = false;
781
+ state.treeColumn = undefined;
782
+ // Tracked state change.
783
+ setColumns(state, _rawColumns, this._privateTypes);
784
+ }
688
785
  }
689
786
 
690
787
  /**
691
- * The column key or fieldName that controls the sorting order.
788
+ * The column key or fieldName(s) that controls the sorting order.
692
789
  * Sort the data using the onsort event handler.
693
- * @type {String}
790
+ * @type {String|String[]}
694
791
  */
695
792
  @api
696
793
  get sortedBy() {
@@ -706,8 +803,8 @@ export default class LightningDatatable extends LightningElement {
706
803
  /**
707
804
  * Specifies the sorting direction.
708
805
  * Sort the data using the onsort event handler.
709
- * Valid options include 'asc' and 'desc'.
710
- * @type {String}
806
+ * Valid options include a single value of 'asc' or 'desc' or an array of such values.
807
+ * @type {String|String[]}
711
808
  */
712
809
  @api
713
810
  get sortedDirection() {
@@ -750,7 +847,9 @@ export default class LightningDatatable extends LightningElement {
750
847
  // Untracked state changes.
751
848
  setWrapTextMaxLines(state, value);
752
849
  this._columnWidthManager.wrapTextMaxLines = state.wrapTextMaxLines;
753
- this.updateRowsAndCells();
850
+ if (this.isConnected) {
851
+ updateCells(state);
852
+ }
754
853
  }
755
854
 
756
855
  /************************** PUBLIC METHODS ***************************/
@@ -762,6 +861,9 @@ export default class LightningDatatable extends LightningElement {
762
861
  @api
763
862
  getSelectedRows() {
764
863
  const { state } = this;
864
+ if (!state.hasCalledUpdateRowsAndCells) {
865
+ this.updateRowsAndCells();
866
+ }
765
867
  const data = unwrap(state.data);
766
868
  const { rows } = state;
767
869
  const selectedRows = [];
@@ -788,22 +890,16 @@ export default class LightningDatatable extends LightningElement {
788
890
  */
789
891
  @api
790
892
  openInlineEdit() {
893
+ if (!this.state.hasCalledUpdateRowsAndCells) {
894
+ this.updateRowsAndCells();
895
+ }
791
896
  openInlineEditOnActiveCell(this);
792
897
  }
793
898
 
794
899
  /************************** PRIVATE GETTERS **************************/
795
900
 
796
- /**
797
- * Retrieves the grid container:
798
- * 1. For a table-based table, it will retrieve the <table role="grid"> element
799
- * 2. For a role-based table, it will retrieve the <div role="grid"> element
800
- * 3. If it is a tree grid, it will retrieve the <table role="treegrid"> element
801
- */
802
901
  get gridContainer() {
803
- return (
804
- this.template.querySelector('[role="grid"]') ||
805
- this.template.querySelector('[role="treegrid"]')
806
- );
902
+ return getGridContainerFromScrollerY(getScrollerY(this.template));
807
903
  }
808
904
 
809
905
  get computedTableContainerClass() {
@@ -822,12 +918,12 @@ export default class LightningDatatable extends LightningElement {
822
918
  'slds-table_bordered': true,
823
919
  'slds-table_edit': true,
824
920
  'slds-table_resizable-cols': !this.widthsData.resizeColumnDisabled,
825
- 'slds-tree slds-table_tree': hasTreeDataType(state),
921
+ 'slds-tree slds-table_tree': !!state.treeColumn,
826
922
  });
827
923
  }
828
924
 
829
925
  get computedTableRole() {
830
- return hasTreeDataType(this.state) ? 'treegrid' : 'grid';
926
+ return this.state.treeColumn ? 'treegrid' : 'grid';
831
927
  }
832
928
 
833
929
  get computedTableStyle() {
@@ -935,7 +1031,11 @@ export default class LightningDatatable extends LightningElement {
935
1031
  * A table with no rows of data still has an aria-rowcount of 1
936
1032
  */
937
1033
  get ariaRowCount() {
938
- return this.state.rows.length + 1;
1034
+ const { state } = this;
1035
+ if (!state.hasCalledUpdateRowsAndCells) {
1036
+ this.updateRowsAndCells();
1037
+ }
1038
+ return state.rows.length + 1;
939
1039
  }
940
1040
 
941
1041
  get hasValidKeyField() {
@@ -953,16 +1053,11 @@ export default class LightningDatatable extends LightningElement {
953
1053
  return !this.widthsData.resizeColumnDisabled;
954
1054
  }
955
1055
 
956
- get privateTypes() {
957
- return this._privateTypes;
958
- }
959
-
960
- get viewportRendering() {
961
- return isViewportRenderingEnabled(this.state);
962
- }
963
-
964
1056
  get renderedRows() {
965
1057
  const { state } = this;
1058
+ if (!state.hasCalledUpdateRowsAndCells) {
1059
+ this.updateRowsAndCells();
1060
+ }
966
1061
  const { virtualize, rows, renderedRowCount } = state;
967
1062
  if (virtualize) {
968
1063
  const { firstIndex, lastIndex } =
@@ -972,7 +1067,7 @@ export default class LightningDatatable extends LightningElement {
972
1067
  this._shouldResetFocus = true;
973
1068
  return rows.slice(firstIndex, lastIndex);
974
1069
  }
975
- if (this.viewportRendering) {
1070
+ if (state.enableViewportRendering) {
976
1071
  this._lastRenderedRow = renderedRowCount;
977
1072
  return rows.slice(0, renderedRowCount);
978
1073
  }
@@ -1054,6 +1149,16 @@ export default class LightningDatatable extends LightningElement {
1054
1149
  template.addEventListener('privatecellfalseblurred', (event) => {
1055
1150
  this.handleFalseCellBlur(event);
1056
1151
  });
1152
+ // Inlined cell interaction
1153
+ template.addEventListener('click', (event) => {
1154
+ this.handlePrimitiveDatatableCellClick(event);
1155
+ });
1156
+ template.addEventListener('focus', (event) => {
1157
+ this.handlePrimitiveDatatableCellFocus(event);
1158
+ });
1159
+ template.addEventListener('keydown', (event) => {
1160
+ this.handlePrimitiveDatatableCellKeydown(event);
1161
+ });
1057
1162
  // Row level actions
1058
1163
  template.addEventListener('privatecellactiontriggered', (event) => {
1059
1164
  this.handleRowActionTriggered(event);
@@ -1064,7 +1169,6 @@ export default class LightningDatatable extends LightningElement {
1064
1169
  template.addEventListener('privatecellbuttonclicked', (event) => {
1065
1170
  this.handleCellButtonClick(event);
1066
1171
  });
1067
-
1068
1172
  // Header actions
1069
1173
  template.addEventListener(
1070
1174
  'privatecellheaderactionmenuopening',
@@ -1084,32 +1188,69 @@ export default class LightningDatatable extends LightningElement {
1084
1188
  this.handleHeaderActionTriggered(event);
1085
1189
  }
1086
1190
  );
1191
+ // Open sorting modal
1192
+ template.addEventListener('privateopensortingmodal', (event) => {
1193
+ this.handleOpenSortingModal(event);
1194
+ });
1087
1195
  // Inline edit
1088
1196
  template.addEventListener('privateeditcell', (event) => {
1089
1197
  this.handleEditCell(event);
1090
1198
  });
1199
+
1200
+ this.updateColumnsAndRows();
1091
1201
  }
1092
1202
 
1093
1203
  /**
1094
1204
  * Renders the appropriate template - div.html or table.html,
1095
- * based on the `render-mode` value passed in.
1205
+ * based on the `render-mode` value passed in and whether or not
1206
+ * an auto resize is queued since auto mode requires table template.
1207
+ * If template is changed, resize observers are disconnected.
1208
+ *
1096
1209
  * By default, table.html is rendered
1097
1210
  */
1098
1211
  render() {
1099
- return this.state.renderModeRoleBased ? divTemplate : tableTemplate;
1212
+ const requireTableTemplate =
1213
+ this._columnWidthManager.isAutoResizingUpdateQueued;
1214
+ const templateToRender =
1215
+ this.state.renderModeRoleBased && !requireTableTemplate
1216
+ ? divTemplate
1217
+ : tableTemplate;
1218
+ if (templateToRender !== this._renderedTemplate) {
1219
+ const { _widthObserver } = this;
1220
+ if (_widthObserver) {
1221
+ _widthObserver.disconnect();
1222
+ }
1223
+ this._renderManager.disconnectResizeObserver();
1224
+ this._renderedTemplate = templateToRender;
1225
+ }
1226
+ return templateToRender;
1100
1227
  }
1101
1228
 
1102
1229
  renderedCallback() {
1103
- const { _columnWidthManager, state, template, widthsData } = this;
1230
+ const {
1231
+ _columnWidthManager,
1232
+ gridContainer,
1233
+ state,
1234
+ template,
1235
+ widthsData,
1236
+ } = this;
1237
+
1238
+ // Initial set of custom types should be set in renderedCallback
1239
+ // To avoid extra calls to renderedCallback after first slotchange
1240
+ if (!this._hasSetInitialCustomTypes) {
1241
+ this.setCustomTypes();
1242
+ this._hasSetInitialCustomTypes = true;
1243
+ }
1104
1244
 
1105
1245
  // This keeps underlying table element up to date if the aria-* properties on this element is dynamically changed.
1106
1246
  // It does the work of removing and adding the attribute if the value is empty(ish) or a normal string.
1107
- synchronizeAttrs(this.gridContainer, {
1247
+ synchronizeAttrs(gridContainer, {
1108
1248
  'aria-label': this.ariaLabel,
1109
1249
  'aria-labelledby': this.ariaLabelledBy,
1110
1250
  'aria-describedby': this.ariaDescribedBy,
1111
1251
  });
1112
1252
 
1253
+ const { renderModeInline } = state;
1113
1254
  if (_columnWidthManager.isResizingUpdateQueued) {
1114
1255
  const { columns } = state;
1115
1256
  const fireResizeEvent = _columnWidthManager.shouldFireResizeEvent(
@@ -1122,6 +1263,10 @@ export default class LightningDatatable extends LightningElement {
1122
1263
  columns,
1123
1264
  widthsData
1124
1265
  );
1266
+ // Managing cell widths is required for role-based render mode.
1267
+ if (state.renderModeRoleBased) {
1268
+ recomputeCellStyles(state);
1269
+ }
1125
1270
  if (fireResizeEvent) {
1126
1271
  this.fireOnResize(false);
1127
1272
  }
@@ -1140,6 +1285,10 @@ export default class LightningDatatable extends LightningElement {
1140
1285
  state.columns,
1141
1286
  widthsData
1142
1287
  );
1288
+ // Managing cell widths is required for role-based render mode.
1289
+ if (state.renderModeRoleBased) {
1290
+ recomputeCellStyles(state);
1291
+ }
1143
1292
  }
1144
1293
  );
1145
1294
  this._widthObserver = _widthObserver;
@@ -1147,12 +1296,6 @@ export default class LightningDatatable extends LightningElement {
1147
1296
  _widthObserver.observe(template);
1148
1297
  }
1149
1298
 
1150
- // Managing the cell widths is only required for the role-based table
1151
- if (state.renderModeRoleBased) {
1152
- // TODO: Look to further optimize - Do this only when required
1153
- recomputeCellStyles(this.privateTypes, state);
1154
- }
1155
-
1156
1299
  handlePrefetch.call(this);
1157
1300
 
1158
1301
  // customerSelectedRows is only valid till render, after it, the one
@@ -1169,14 +1312,16 @@ export default class LightningDatatable extends LightningElement {
1169
1312
  const { activeCell } = state;
1170
1313
  if (
1171
1314
  activeCell &&
1172
- activeCell.focused &&
1315
+ activeCell.hasFocus &&
1173
1316
  !state.inlineEdit.isPanelVisible
1174
1317
  ) {
1175
1318
  const cellElement = getActiveCellElement(template, state);
1319
+ const cellElementChild = getCellElementChild(cellElement);
1176
1320
  if (
1321
+ !renderModeInline &&
1177
1322
  cellElement &&
1178
- cellElement.parentElement &&
1179
- !cellElement.parentElement.classList.contains(FOCUS_CLASS)
1323
+ cellElementChild &&
1324
+ !cellElementChild.classList.contains(FOCUS_CLASS)
1180
1325
  ) {
1181
1326
  // Tracked state change.
1182
1327
  setFocusActiveCell(state, template, null, null, false);
@@ -1184,28 +1329,50 @@ export default class LightningDatatable extends LightningElement {
1184
1329
  }
1185
1330
  }
1186
1331
 
1187
- this.updateVirtualizedRowHeights();
1332
+ const { hasRenderedFirstTime, hasRenderedTable } = state;
1333
+ const virtualize = !!state.virtualize;
1334
+ const { length: rowCount } = state.rows;
1188
1335
 
1189
- if (this.viewportRendering || state.virtualize) {
1190
- const resizeTarget = this.template.querySelector(
1191
- 'div.dt-outer-container'
1192
- );
1193
- this._renderManager.connectResizeObserver(resizeTarget);
1194
- if (!this._renderManager.hasWrapperHeight()) {
1195
- this._renderManager.updateWrapperHeight(this.getWrapperHeight);
1336
+ // Untracked state changes.
1337
+ // Set rendered flags BEFORE handlePrefetch() is called.
1338
+ state.hasRenderedFirstTime = true;
1339
+ state.hasRenderedTable = true;
1340
+
1341
+ if (virtualize || state.enableViewportRendering) {
1342
+ const { _renderManager } = this;
1343
+ if (rowCount) {
1344
+ if (virtualize) {
1345
+ this.updateVirtualizedRowHeights();
1346
+ }
1347
+ }
1348
+ if (!hasRenderedFirstTime) {
1349
+ _renderManager.connectResizeObserver(
1350
+ template.querySelector('div.dt-outer-container')
1351
+ );
1352
+ }
1353
+ if (!_renderManager.hasWrapperHeight()) {
1354
+ _renderManager.updateWrapperHeight(this.getWrapperHeight);
1196
1355
 
1197
1356
  // Reset the row count if we already had one before updating the wrapper height.
1198
1357
  // This can happen if the number of rows was calculated before the datatable
1199
1358
  // was rendered.
1200
- if (this.state.renderedRowCount) {
1201
- this._renderManager.updateViewportRendering(
1202
- this.state,
1203
- this.gridContainer,
1359
+ if (state.renderedRowCount) {
1360
+ _renderManager.updateViewportRendering(
1361
+ state,
1362
+ gridContainer,
1204
1363
  true
1205
1364
  );
1206
1365
  }
1207
1366
  }
1208
1367
  }
1368
+
1369
+ if (rowCount && renderModeInline && !hasRenderedTable) {
1370
+ this.updateCheckboxCellsAriaAttrs();
1371
+ if (hasLinkProvider(template)) {
1372
+ this.updateLookupCellsLinkInfo();
1373
+ this.updateUrlCellsLinkInfo();
1374
+ }
1375
+ }
1209
1376
  }
1210
1377
 
1211
1378
  updateTableAndScrollerStyleOnRender() {
@@ -1244,22 +1411,23 @@ export default class LightningDatatable extends LightningElement {
1244
1411
 
1245
1412
  handleLoadDynamicActions = handleLoadDynamicActions;
1246
1413
 
1414
+ handlePrimitiveDatatableCellClick = handlePrimitiveDatatableCellClick;
1415
+
1416
+ handlePrimitiveDatatableCellFocus = handlePrimitiveDatatableCellFocus;
1417
+
1418
+ handlePrimitiveDatatableCellKeydown = handlePrimitiveDatatableCellKeydown;
1419
+
1247
1420
  handleRowSelectionChange = handleRowSelectionChange;
1248
1421
 
1249
1422
  handleRowActionTriggered = handleRowActionTriggered;
1250
1423
 
1251
1424
  handleCustomTypesChange() {
1252
- const assignedNodes = this.template
1253
- .querySelector('slot[name="customdatatypes"]')
1254
- .assignedNodes();
1255
- if (assignedNodes.length) {
1256
- const provider = assignedNodes[0];
1257
- if (typeof provider.getDataTypes === 'function') {
1258
- this._privateTypes = new DatatableTypes(
1259
- provider.getDataTypes()
1260
- );
1261
- this.updateColumns(this._rawColumns);
1262
- }
1425
+ if (this._shouldResetCustomTypes) {
1426
+ this.setCustomTypes();
1427
+ } else {
1428
+ // On first call, custom types have already been set
1429
+ // in renderedCallback. Subsequent calls
1430
+ this._shouldResetCustomTypes = true;
1263
1431
  }
1264
1432
  }
1265
1433
 
@@ -1324,39 +1492,43 @@ export default class LightningDatatable extends LightningElement {
1324
1492
  this.state,
1325
1493
  event.target.scrollTop
1326
1494
  );
1327
- } else if (this.viewportRendering) {
1495
+ } else if (state.enableViewportRendering) {
1328
1496
  this._renderManager.handleScroll(state, event);
1329
1497
  }
1330
1498
  }
1331
1499
 
1332
1500
  /**
1333
- * Handles the `click` event on the <table> element and
1501
+ * Handles the 'click' event on the <table> element and
1334
1502
  * the corresponding <div> in the role-based table
1335
1503
  *
1336
- * @param {MouseEvent} event - `click`
1504
+ * @param {MouseEvent} event - 'click'
1337
1505
  */
1338
1506
  handleTableCellClick(event) {
1339
1507
  // handles the case when clicking on the margin/pading of the td/th
1340
1508
  const { target } = event;
1341
1509
  if (isCellElement(target)) {
1342
1510
  // get the row/col key value from the primitive cell.
1343
- const { rowKeyValue, colKeyValue } =
1344
- target.querySelector(':first-child');
1345
-
1346
- const { state, template } = this;
1511
+ // const { rowKeyValue, colKeyValue } =
1512
+ // target.querySelector(':first-child');
1513
+ const cellElement = target;
1514
+ const { state } = this;
1515
+ const { rowKeyValue } = cellElement.parentElement.dataset;
1516
+ const { colKeyValue } = cellElement.dataset;
1347
1517
  if (
1348
1518
  state.rowMode ||
1349
1519
  !isActiveCell(state, rowKeyValue, colKeyValue)
1350
1520
  ) {
1351
- if (state.rowMode && state.activeCell) {
1521
+ const { activeCell } = state;
1522
+ if (activeCell && state.rowMode) {
1523
+ // Untracked state change.
1352
1524
  unsetRowNavigationMode(state);
1353
- const { rowIndex } = getIndexesActiveCell(state);
1354
- updateRowTabIndex(state, rowIndex, -1);
1525
+ // Tracked state change.
1526
+ updateRowTabIndex(state, activeCell.rowIndex, -1);
1355
1527
  }
1356
1528
  this.setActiveCell(rowKeyValue, colKeyValue);
1357
1529
  }
1358
-
1359
- if (!datatableHasFocus(state, template)) {
1530
+ if (!datatableHasFocus(state, this.template)) {
1531
+ // Untracked state change.
1360
1532
  setCellClickedForFocus(state);
1361
1533
  }
1362
1534
  }
@@ -1364,12 +1536,13 @@ export default class LightningDatatable extends LightningElement {
1364
1536
 
1365
1537
  /**
1366
1538
  * Handles the 'privateupdatecolsort' event on lightning-datatable
1367
- *
1539
+ * Used only for single column sorting from column header clicking
1368
1540
  * @param {CustomEvent} event - 'privateupdatecolsort'
1369
1541
  */
1370
1542
  handleUpdateColumnSort(event) {
1371
1543
  event.stopPropagation();
1372
1544
  const { fieldName, columnKey, sortDirection } = event.detail;
1545
+
1373
1546
  this.fireSortedColumnChange(fieldName, columnKey, sortDirection);
1374
1547
  }
1375
1548
 
@@ -1377,6 +1550,19 @@ export default class LightningDatatable extends LightningElement {
1377
1550
  this._checkboxColumnHeaderId = event.detail;
1378
1551
  }
1379
1552
 
1553
+ handleOpenSortingModal(event) {
1554
+ event.stopPropagation();
1555
+ MultiColumnSortingModal.open({
1556
+ dtInstance: this,
1557
+ }).then((response) => {
1558
+ if (response && response.event.defaultPrevented) {
1559
+ response.failure();
1560
+ } else if (response) {
1561
+ response.success();
1562
+ }
1563
+ });
1564
+ }
1565
+
1380
1566
  /**
1381
1567
  * Handles the 'resizecol' event on lightning-datatable
1382
1568
  *
@@ -1393,6 +1579,10 @@ export default class LightningDatatable extends LightningElement {
1393
1579
  colIndex,
1394
1580
  delta
1395
1581
  );
1582
+ // Managing cell widths is required for role-based render mode.
1583
+ if (state.renderModeRoleBased) {
1584
+ recomputeCellStyles(state);
1585
+ }
1396
1586
  this.fireOnResize(true);
1397
1587
  this.fixHeaderForSafari();
1398
1588
  }
@@ -1452,10 +1642,10 @@ export default class LightningDatatable extends LightningElement {
1452
1642
  const { rowKeyValue, colKeyValue, needsRefocusOnCellElement } =
1453
1643
  event.detail;
1454
1644
  if (!isActiveCell(state, rowKeyValue, colKeyValue)) {
1455
- if (state.rowMode && state.activeCell) {
1645
+ const { activeCell } = state;
1646
+ if (activeCell && state.rowMode) {
1456
1647
  unsetRowNavigationMode(state);
1457
- const { rowIndex } = getIndexesActiveCell(state);
1458
- updateRowTabIndex(state, rowIndex, -1);
1648
+ updateRowTabIndex(state, activeCell.rowIndex, -1);
1459
1649
  }
1460
1650
  this.setActiveCell(rowKeyValue, colKeyValue);
1461
1651
  refocusCellElement(state, this.template, needsRefocusOnCellElement);
@@ -1494,7 +1684,7 @@ export default class LightningDatatable extends LightningElement {
1494
1684
  * and when the active cell loses focus after renderedRows changes
1495
1685
  * on a virtualized table, in which case we don't want to lose focus.
1496
1686
  *
1497
- * We account for this by setting activeCell.focused to the value of
1687
+ * We account for this by setting activeCell.hasFocus to the value of
1498
1688
  * _shouldResetFocus, which will be true if and only if focus was
1499
1689
  * lost due to a renderedRows change for a virtualized table.
1500
1690
  *
@@ -1504,7 +1694,7 @@ export default class LightningDatatable extends LightningElement {
1504
1694
  handleDatatableFocusOut.call(this, event);
1505
1695
  const { activeCell } = this.state;
1506
1696
  if (activeCell) {
1507
- activeCell.focused = this._shouldResetFocus;
1697
+ activeCell.hasFocus = this._shouldResetFocus;
1508
1698
  }
1509
1699
  }
1510
1700
 
@@ -1611,8 +1801,99 @@ export default class LightningDatatable extends LightningElement {
1611
1801
  );
1612
1802
  }
1613
1803
 
1804
+ /**
1805
+ * We control the checkbox behavior with the state and we handle it in the container,
1806
+ * but we need to prevent default in order to avoid the checkbox to change state
1807
+ * with the click and the generated click in the input from the label
1808
+ *
1809
+ * @param {Object} event - click event of the checkbox
1810
+ */
1811
+ handleInlinedCheckboxClick(event) {
1812
+ const { state } = this;
1813
+
1814
+ // Click was catch on the input, stop propagation to avoid to be handled in container.
1815
+ // ideally you can let it bubble and be handled in there, but there is a raptor issue:
1816
+ // https://git.soma.salesforce.com/raptor/raptor/issues/838
1817
+ event.stopPropagation();
1818
+
1819
+ const { currentTarget: checkboxElement } = event;
1820
+ const { parentElement: checkboxContainer } = checkboxElement;
1821
+ const { parentElement: cellElement } = checkboxContainer;
1822
+ const { colKeyValue } = cellElement.dataset;
1823
+ const { rowKeyValue } = cellElement.parentElement.dataset;
1824
+ const row = getRowByKey(state, rowKeyValue);
1825
+ this.fireInlinedCheckboxSelection(checkboxElement, row.isSelected, {
1826
+ rowKeyValue,
1827
+ colKeyValue,
1828
+ isMultiple: event.shiftKey,
1829
+ });
1830
+ }
1831
+
1832
+ handleInlinedCheckboxContainerClick(event) {
1833
+ const { state } = this;
1834
+ const { currentTarget: checkboxContainer } = event;
1835
+ const { parentElement: cellElement } = checkboxContainer;
1836
+ const { rowKeyValue } = cellElement.parentElement.dataset;
1837
+ const row = getRowByKey(state, rowKeyValue);
1838
+ if (row.isDisabled) {
1839
+ return;
1840
+ }
1841
+ // Click was catch in the label, the default its to activate the checkbox,
1842
+ // lets prevent it to avoid to send a double event.
1843
+ event.preventDefault();
1844
+
1845
+ const { colKeyValue } = cellElement.dataset;
1846
+ const { firstElementChild: checkboxElement } = checkboxContainer;
1847
+ this.fireInlinedCheckboxSelection(checkboxElement, row.isSelected, {
1848
+ rowKeyValue,
1849
+ colKeyValue,
1850
+ isMultiple: event.shiftKey,
1851
+ });
1852
+ }
1853
+
1854
+ handleInlinedCheckboxContainerMouseDown(event) {
1855
+ // Prevent selecting text by Shift+click
1856
+ if (this.state.renderModeInline && event.shiftKey) {
1857
+ event.preventDefault();
1858
+ }
1859
+ }
1860
+
1861
+ handleInlinedEditButtonClick(event) {
1862
+ const { state } = this;
1863
+ const cellElement = state.renderModeInline
1864
+ ? getCellElementFromEventTarget(event.target)
1865
+ : undefined;
1866
+
1867
+ if (cellElement) {
1868
+ const cellElementChild = getCellElementChild(cellElement);
1869
+ cellElementChild.dispatchEvent(
1870
+ new CustomEvent('privateeditcell', {
1871
+ bubbles: true,
1872
+ composed: true,
1873
+ detail: {
1874
+ rowKeyValue:
1875
+ cellElement.parentElement.dataset.rowKeyValue,
1876
+ colKeyValue: cellElement.dataset.colKeyValue,
1877
+ },
1878
+ })
1879
+ );
1880
+ }
1881
+ }
1882
+
1614
1883
  /************************ EVENT DISPATCHERS **************************/
1615
1884
 
1885
+ fireInlinedCheckboxSelection(checkboxElement, isSelected, detail) {
1886
+ const actionName = isSelected ? 'deselectrow' : 'selectrow';
1887
+ checkboxElement.dispatchEvent(
1888
+ // eslint-disable-next-line lightning-global/no-custom-event-identifier-arguments
1889
+ new CustomEvent(actionName, {
1890
+ bubbles: true,
1891
+ composed: true,
1892
+ detail,
1893
+ })
1894
+ );
1895
+ }
1896
+
1616
1897
  fireSelectedRowsChange(selectedRows, config = {}) {
1617
1898
  this.dispatchEvent(
1618
1899
  new CustomEvent('rowselection', {
@@ -1622,11 +1903,17 @@ export default class LightningDatatable extends LightningElement {
1622
1903
  }
1623
1904
 
1624
1905
  fireSortedColumnChange(fieldName, columnKey, sortDirection) {
1625
- this.dispatchEvent(
1626
- new CustomEvent('sort', {
1627
- detail: { fieldName, columnKey, sortDirection },
1628
- })
1629
- );
1906
+ const sortEvent = new CustomEvent('sort', {
1907
+ detail: {
1908
+ fieldNames: [fieldName],
1909
+ sortDirections: [sortDirection],
1910
+ isMultiColumnSort: false,
1911
+ fieldName,
1912
+ columnKey,
1913
+ sortDirection,
1914
+ },
1915
+ });
1916
+ this.dispatchEvent(sortEvent);
1630
1917
  }
1631
1918
 
1632
1919
  fireOnResize(isUserTriggered) {
@@ -1645,7 +1932,7 @@ export default class LightningDatatable extends LightningElement {
1645
1932
 
1646
1933
  /************************* HELPER FUNCTIONS **************************/
1647
1934
 
1648
- updateRowsState() {
1935
+ updateRows() {
1649
1936
  this.updateRowsBeforeIndexes();
1650
1937
  this.updateRowsAndCells();
1651
1938
  this.updateRowsAfterIndexes();
@@ -1658,7 +1945,7 @@ export default class LightningDatatable extends LightningElement {
1658
1945
 
1659
1946
  updateRowsAfterIndexes() {
1660
1947
  const { state, widthsData } = this;
1661
- if (this.viewportRendering || state.virtualize) {
1948
+ if (state.enableViewportRendering || state.virtualize) {
1662
1949
  this._renderManager.updateViewportRendering(
1663
1950
  state,
1664
1951
  this.gridContainer,
@@ -1701,24 +1988,24 @@ export default class LightningDatatable extends LightningElement {
1701
1988
  }
1702
1989
 
1703
1990
  updateColumns(columns) {
1704
- const { state } = this;
1705
- this.updateColumnsBeforeIndexes(columns);
1706
- state.headerIndexes = generateHeaderIndexes(state.columns);
1707
- this.updateRowsAndCells();
1708
- this.updateColumnsAfterIndexes();
1991
+ setColumns(this.state, columns, this._privateTypes);
1992
+ if (this.isConnected) {
1993
+ this.updateColumnsBeforeIndexes();
1994
+ this.updateRowsAndCells();
1995
+ this.updateColumnsAfterIndexes();
1996
+ }
1709
1997
  }
1710
1998
 
1711
- updateColumnsBeforeIndexes(columns) {
1999
+ updateColumnsBeforeIndexes() {
1712
2000
  const { state } = this;
1713
- const hadTreeDataTypePreviously = hasTreeDataType(state);
1714
2001
  // Untracked state changes.
1715
2002
  // Calculate cell to focus next before indexes are updated.
1716
2003
  setCellToFocusFromPrev(state, this.template);
1717
- normalizeColumns(state, columns, this.privateTypes);
1718
- updateRowNavigationMode(hadTreeDataTypePreviously, state);
2004
+ updateRowNavigationMode(state);
1719
2005
  // Tracked state changes.
1720
2006
  setDirtyValues(state, this._draftValues);
1721
- // Updates state.wrapText and when isWrappableType, sets internal header actions
2007
+ // Update state.wrapText and when type is not in NON_WRAPPABLE_TYPES
2008
+ // and sets internal header actions.
1722
2009
  updateHeaderInternalActions(state);
1723
2010
  }
1724
2011
 
@@ -1752,8 +2039,20 @@ export default class LightningDatatable extends LightningElement {
1752
2039
  }
1753
2040
  }
1754
2041
 
2042
+ updateColumnsAndRows() {
2043
+ this.updateColumnsBeforeIndexes(this._rawColumns);
2044
+ this.updateRowsBeforeIndexes();
2045
+ this.updateRowsAndCells();
2046
+ this.updateRowsAfterIndexes();
2047
+ this.updateColumnsAfterIndexes();
2048
+ }
2049
+
1755
2050
  updateRowsAndCells() {
1756
- updateRowsAndCellIndexes(this.state, this._privateTypes);
2051
+ const { state } = this;
2052
+ // Untracked state change.
2053
+ state.hasRenderedTable = false;
2054
+ // Tracked state changes.
2055
+ updateRowsAndCells(state, this._privateTypes, this._datatableId);
1757
2056
  }
1758
2057
 
1759
2058
  updateVirtualizedRowHeights() {
@@ -1779,7 +2078,7 @@ export default class LightningDatatable extends LightningElement {
1779
2078
  const height = rowElement.getBoundingClientRect().height + 1;
1780
2079
  if (state.rowHeight !== height) {
1781
2080
  state.rowHeight = height;
1782
- resetTableHeight(state);
2081
+ state.tableHeight = state.rowHeight * state.rows.length;
1783
2082
  state.rows.forEach((row) => {
1784
2083
  row.style = `position:absolute;top:${
1785
2084
  row.rowIndex * height
@@ -1791,24 +2090,44 @@ export default class LightningDatatable extends LightningElement {
1791
2090
  }
1792
2091
 
1793
2092
  setSelectedRows(value) {
2093
+ // A mix of tracked and untracked state changes.
1794
2094
  setSelectedRowsKeys(this.state, value);
1795
2095
  this.handleRowSelectionChange();
1796
2096
  }
1797
2097
 
1798
2098
  setActiveCell(rowKeyValue, colKeyValue) {
1799
2099
  const { state, template } = this;
1800
- const { rowIndex, colIndex } = getIndexesByKeys(
1801
- state,
1802
- rowKeyValue,
1803
- colKeyValue
1804
- );
2100
+ const newActiveCell = getCellByKeys(state, rowKeyValue, colKeyValue);
1805
2101
  // Tracked state change.
1806
2102
  setBlurActiveCell(state, template);
1807
2103
  // Untracked state change.
1808
- state.activeCell = { rowKeyValue, colKeyValue };
2104
+ state.activeCell = newActiveCell;
1809
2105
  // Tracked state changes.
1810
2106
  addFocusStylesToActiveCell(state, template);
1811
- updateCellTabIndex(state, rowIndex, colIndex, 0);
2107
+ updateCellTabIndex(
2108
+ state,
2109
+ newActiveCell.rowIndex,
2110
+ newActiveCell.colIndex,
2111
+ 0
2112
+ );
2113
+ }
2114
+
2115
+ setCustomTypes() {
2116
+ const customTypesSlot = this.template.querySelector(
2117
+ 'slot[name="customdatatypes"]'
2118
+ );
2119
+ if (customTypesSlot) {
2120
+ const assignedNodes = customTypesSlot.assignedNodes();
2121
+ if (assignedNodes.length) {
2122
+ const provider = assignedNodes[0];
2123
+ if (typeof provider.getDataTypes === 'function') {
2124
+ this._privateTypes = new DatatableTypes(
2125
+ provider.getDataTypes()
2126
+ );
2127
+ this.updateColumns(this._rawColumns);
2128
+ }
2129
+ }
2130
+ }
1812
2131
  }
1813
2132
 
1814
2133
  /**
@@ -1855,4 +2174,108 @@ export default class LightningDatatable extends LightningElement {
1855
2174
  const { rowKeyValue } = dataset;
1856
2175
  return { rowIndex, rowKeyValue };
1857
2176
  }
2177
+
2178
+ updateCheckboxCellsAriaAttrs() {
2179
+ const { _checkboxColumnHeaderId, state, template } = this;
2180
+ const { checkboxCells } = state;
2181
+ let { length: cellCount } = checkboxCells;
2182
+ // To avoid a critical performance penalty we query the template ONCE
2183
+ // instead of for EVERY cell.
2184
+ const checkboxElements = cellCount
2185
+ ? template.querySelectorAll(
2186
+ '[data-inline-type="primitive-cell-checkbox"]'
2187
+ )
2188
+ : [];
2189
+ let scopedIdPostfix;
2190
+ for (let i = 0, { length } = checkboxElements; i < length; i += 1) {
2191
+ const cell = checkboxCells[i];
2192
+ const checkboxElem = checkboxElements[i];
2193
+ const { firstElementChild: inputElem } = checkboxElem;
2194
+ if (scopedIdPostfix === undefined) {
2195
+ const { lastElementChild: labelElem } = checkboxElem;
2196
+ const { id } = labelElem;
2197
+ scopedIdPostfix = id.slice(id.lastIndexOf('-'));
2198
+ }
2199
+ inputElem.setAttribute(
2200
+ 'aria-labelledby',
2201
+ `${cell.checkboxLabelId}${scopedIdPostfix} ${_checkboxColumnHeaderId}`
2202
+ );
2203
+ }
2204
+ }
2205
+
2206
+ updateLookupCellsLinkInfo() {
2207
+ const { state, template } = this;
2208
+ const { lookupCells } = state;
2209
+ const { length: cellCount } = lookupCells;
2210
+ // To avoid a critical performance penalty we query the template ONCE
2211
+ // instead of for EVERY cell.
2212
+ const lookupElements = cellCount
2213
+ ? template.querySelectorAll('[data-inline-type="formatted-lookup"]')
2214
+ : [];
2215
+ for (let i = 0, { length } = lookupElements; i < length; i += 1) {
2216
+ const cell = lookupCells[i];
2217
+ const lookupElem = lookupElements[i];
2218
+ const { value: recordId } = cell;
2219
+ // Set _handleLookupAnchorClick to untracked _cell.
2220
+ cell._handleLookupAnchorClick = () => {
2221
+ lookupElem.dispatchEvent(
2222
+ new PrivateLookupItemPickedEvent({ recordId })
2223
+ );
2224
+ };
2225
+ if (lookupElem.getAttribute('data-navigation') === 'enable') {
2226
+ lookupElem.removeAttribute('data-navigation');
2227
+ }
2228
+ if (recordId) {
2229
+ getLinkInfo(lookupElem, {
2230
+ stateType: 'standard__recordPage',
2231
+ attributes: {
2232
+ recordId,
2233
+ actionName: 'view',
2234
+ },
2235
+ }).then((linkInfo) => {
2236
+ const { dispatcher, url } = linkInfo;
2237
+ const lookupIsNavigable = !!(dispatcher && url);
2238
+ cell.lookupIsNavigable = lookupIsNavigable;
2239
+ cell.lookupLink = url;
2240
+ cell._handleLookupAnchorClick = (event) => {
2241
+ lookupElem.dispatchEvent(
2242
+ new PrivateLookupItemPickedEvent({ recordId })
2243
+ );
2244
+ dispatcher.call(lookupElem, event);
2245
+ };
2246
+ if (lookupIsNavigable) {
2247
+ lookupElem.setAttribute('data-navigation', 'enable');
2248
+ } else {
2249
+ lookupElem.removeAttribute('data-navigation');
2250
+ }
2251
+ });
2252
+ }
2253
+ }
2254
+ }
2255
+
2256
+ updateUrlCellsLinkInfo() {
2257
+ const { state, template } = this;
2258
+ const { shownUrlCells } = state;
2259
+ const { length: cellCount } = shownUrlCells;
2260
+ // To avoid a critical performance penalty we query the template ONCE
2261
+ // instead of for EVERY cell.
2262
+ const urlElements = cellCount
2263
+ ? template.querySelectorAll('[data-inline-type="formatted-url"]')
2264
+ : [];
2265
+ for (let i = 0, { length } = urlElements; i < length; i += 1) {
2266
+ const cell = shownUrlCells[i];
2267
+ const urlElem = urlElements[i];
2268
+ updateRawLinkInfo(urlElem, {
2269
+ url: cell.urlLink,
2270
+ target: cell.urlTarget,
2271
+ }).then((linkInfo) => {
2272
+ const { dispatcher, url } = linkInfo;
2273
+ // Set _handleUrlAnchorClick to untracked _cell.
2274
+ cell._handleUrlAnchorClick = (event) => {
2275
+ dispatcher.call(urlElem, event);
2276
+ };
2277
+ cell.urlLink = url;
2278
+ });
2279
+ }
2280
+ }
1858
2281
  }