lightning-base-components 1.21.6-alpha → 1.21.8-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 (369) hide show
  1. package/metadata/raptor.json +45 -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/baseCombobox/base-combobox.slds.css +1 -1
  41. package/src/lightning/baseCombobox/baseCombobox.html +2 -1
  42. package/src/lightning/baseCombobox/baseCombobox.js +21 -0
  43. package/src/lightning/baseCombobox/input-text.slds.css +5 -5
  44. package/src/lightning/breadcrumbs/breadcrumbs.slds.css +1 -1
  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 +1 -0
  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 +74 -25
  80. package/src/lightning/datatable/datatable.js +493 -133
  81. package/src/lightning/datatable/errors.js +1 -1
  82. package/src/lightning/datatable/indexes.js +32 -19
  83. package/src/lightning/datatable/infiniteLoading.js +6 -5
  84. package/src/lightning/datatable/inlineEdit.js +45 -59
  85. package/src/lightning/datatable/keyboard.js +571 -160
  86. package/src/lightning/datatable/renderManager.js +12 -9
  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 +132 -24
  91. package/src/lightning/datatable/rowsInlining.js +473 -0
  92. package/src/lightning/datatable/sort.js +8 -4
  93. package/src/lightning/datatable/state.js +12 -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/utils.js +39 -0
  99. package/src/lightning/datatable/virtualization.js +44 -19
  100. package/src/lightning/datatable/wrapText.js +7 -10
  101. package/src/lightning/datepicker/datepicker.html +3 -1
  102. package/src/lightning/datepicker/datepicker.js +31 -1
  103. package/src/lightning/datepicker/form-element.slds.css +1 -0
  104. package/src/lightning/datepicker/input-text.slds.css +5 -5
  105. package/src/lightning/datetimepicker/datetimepicker.html +7 -1
  106. package/src/lightning/datetimepicker/datetimepicker.js +30 -2
  107. package/src/lightning/datetimepicker/form-element.slds.css +1 -0
  108. package/src/lightning/datetimepicker/input-text.slds.css +5 -5
  109. package/src/lightning/dualListbox/form-element.slds.css +1 -0
  110. package/src/lightning/focusTrap/focusTrap.css +7 -0
  111. package/src/lightning/groupedCombobox/form-element.slds.css +1 -0
  112. package/src/lightning/groupedCombobox/input-text.slds.css +5 -5
  113. package/src/lightning/helptext/button-icon.slds.css +41 -25
  114. package/src/lightning/helptext/form-element.slds.css +1 -0
  115. package/src/lightning/icon/__docs__/icon.md +0 -2
  116. package/src/lightning/iconSvgTemplates/buildTemplates/standard/account_score.html +8 -0
  117. package/src/lightning/iconSvgTemplates/buildTemplates/standard/aggregate.html +8 -0
  118. package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_participant.html +11 -0
  119. package/src/lightning/iconSvgTemplates/buildTemplates/standard/app_form_product_participant.html +12 -0
  120. package/src/lightning/iconSvgTemplates/buildTemplates/standard/cost_model.html +7 -0
  121. package/src/lightning/iconSvgTemplates/buildTemplates/standard/labels.html +8 -0
  122. package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_fee.html +7 -0
  123. package/src/lightning/iconSvgTemplates/buildTemplates/standard/list_rate.html +7 -0
  124. package/src/lightning/iconSvgTemplates/buildTemplates/standard/party_profile.html +8 -0
  125. package/src/lightning/iconSvgTemplates/buildTemplates/standard/path_experiment.html +7 -0
  126. package/src/lightning/iconSvgTemplates/buildTemplates/standard/people_score.html +8 -0
  127. package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  128. package/src/lightning/iconSvgTemplates/buildTemplates/standard/price_adjustment_tier.html +7 -0
  129. package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort.html +7 -0
  130. package/src/lightning/iconSvgTemplates/buildTemplates/standard/program_cohort_member.html +7 -0
  131. package/src/lightning/iconSvgTemplates/buildTemplates/standard/rate_adjustment.html +7 -0
  132. package/src/lightning/iconSvgTemplates/buildTemplates/standard/record_consent.html +7 -0
  133. package/src/lightning/iconSvgTemplates/buildTemplates/standard/whatsapp.html +7 -0
  134. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +40 -1
  135. package/src/lightning/iconSvgTemplates/buildTemplates/utility/aggregate.html +8 -0
  136. package/src/lightning/iconSvgTemplates/buildTemplates/utility/array.html +7 -0
  137. package/src/lightning/iconSvgTemplates/buildTemplates/utility/bottom_group_alignment.html +7 -0
  138. package/src/lightning/iconSvgTemplates/buildTemplates/utility/cant_sync.html +7 -0
  139. package/src/lightning/iconSvgTemplates/buildTemplates/utility/center_group_alignment.html +8 -0
  140. package/src/lightning/iconSvgTemplates/buildTemplates/utility/columns.html +7 -0
  141. package/src/lightning/iconSvgTemplates/buildTemplates/utility/fully_synced.html +8 -0
  142. package/src/lightning/iconSvgTemplates/buildTemplates/utility/inner_join.html +7 -0
  143. package/src/lightning/iconSvgTemplates/buildTemplates/utility/join.html +8 -0
  144. package/src/lightning/iconSvgTemplates/buildTemplates/utility/left_join.html +14 -0
  145. package/src/lightning/iconSvgTemplates/buildTemplates/utility/macros.html +2 -2
  146. package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_in_sync.html +7 -0
  147. package/src/lightning/iconSvgTemplates/buildTemplates/utility/not_saved.html +9 -0
  148. package/src/lightning/iconSvgTemplates/buildTemplates/utility/outer_join.html +7 -0
  149. package/src/lightning/iconSvgTemplates/buildTemplates/utility/path_experiment.html +7 -0
  150. package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort.html +7 -0
  151. package/src/lightning/iconSvgTemplates/buildTemplates/utility/program_cohort_member.html +7 -0
  152. package/src/lightning/iconSvgTemplates/buildTemplates/utility/record_consent.html +7 -0
  153. package/src/lightning/iconSvgTemplates/buildTemplates/utility/right_join.html +7 -0
  154. package/src/lightning/iconSvgTemplates/buildTemplates/utility/skill.html +8 -0
  155. package/src/lightning/iconSvgTemplates/buildTemplates/utility/sync_in_progress.html +7 -0
  156. package/src/lightning/iconSvgTemplates/buildTemplates/utility/top_group_alignment.html +7 -0
  157. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/account_score.html +8 -0
  158. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/aggregate.html +8 -0
  159. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_participant.html +11 -0
  160. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
  161. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/cost_model.html +7 -0
  162. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/labels.html +8 -0
  163. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_fee.html +7 -0
  164. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/list_rate.html +7 -0
  165. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/party_profile.html +8 -0
  166. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/path_experiment.html +7 -0
  167. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/people_score.html +8 -0
  168. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  169. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
  170. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort.html +7 -0
  171. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/program_cohort_member.html +7 -0
  172. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/rate_adjustment.html +7 -0
  173. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/record_consent.html +7 -0
  174. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/whatsapp.html +7 -0
  175. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +40 -1
  176. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/aggregate.html +8 -0
  177. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/array.html +7 -0
  178. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
  179. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/cant_sync.html +7 -0
  180. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/center_group_alignment.html +8 -0
  181. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/columns.html +7 -0
  182. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/fully_synced.html +8 -0
  183. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/inner_join.html +7 -0
  184. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/join.html +8 -0
  185. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/left_join.html +14 -0
  186. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/macros.html +2 -2
  187. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_in_sync.html +7 -0
  188. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/not_saved.html +9 -0
  189. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/outer_join.html +7 -0
  190. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/path_experiment.html +7 -0
  191. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort.html +7 -0
  192. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/program_cohort_member.html +7 -0
  193. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/record_consent.html +7 -0
  194. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/right_join.html +7 -0
  195. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/skill.html +8 -0
  196. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/sync_in_progress.html +7 -0
  197. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/top_group_alignment.html +7 -0
  198. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/account_score.html +8 -0
  199. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/aggregate.html +8 -0
  200. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_participant.html +11 -0
  201. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/app_form_product_participant.html +12 -0
  202. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/cost_model.html +7 -0
  203. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/labels.html +8 -0
  204. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_fee.html +7 -0
  205. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/list_rate.html +7 -0
  206. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/party_profile.html +8 -0
  207. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/path_experiment.html +7 -0
  208. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/people_score.html +8 -0
  209. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  210. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/price_adjustment_tier.html +7 -0
  211. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort.html +7 -0
  212. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/program_cohort_member.html +7 -0
  213. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/rate_adjustment.html +7 -0
  214. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/record_consent.html +7 -0
  215. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/whatsapp.html +7 -0
  216. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +19 -1
  217. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/account_score.html +8 -0
  218. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/aggregate.html +8 -0
  219. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_participant.html +11 -0
  220. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/app_form_product_participant.html +12 -0
  221. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/cost_model.html +7 -0
  222. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/labels.html +8 -0
  223. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_fee.html +7 -0
  224. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/list_rate.html +7 -0
  225. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/party_profile.html +8 -0
  226. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/path_experiment.html +7 -0
  227. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/people_score.html +8 -0
  228. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_schedule.html +8 -0
  229. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/price_adjustment_tier.html +7 -0
  230. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort.html +7 -0
  231. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/program_cohort_member.html +7 -0
  232. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/rate_adjustment.html +7 -0
  233. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/record_consent.html +7 -0
  234. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/whatsapp.html +7 -0
  235. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +19 -1
  236. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +22 -1
  237. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/aggregate.html +8 -0
  238. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/array.html +7 -0
  239. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/bottom_group_alignment.html +7 -0
  240. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/cant_sync.html +7 -0
  241. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/center_group_alignment.html +8 -0
  242. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/columns.html +7 -0
  243. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/fully_synced.html +8 -0
  244. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/inner_join.html +7 -0
  245. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/join.html +8 -0
  246. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/left_join.html +14 -0
  247. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/macros.html +2 -2
  248. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_in_sync.html +7 -0
  249. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/not_saved.html +9 -0
  250. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/outer_join.html +7 -0
  251. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/path_experiment.html +7 -0
  252. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort.html +7 -0
  253. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/program_cohort_member.html +7 -0
  254. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/record_consent.html +7 -0
  255. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/right_join.html +7 -0
  256. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/skill.html +8 -0
  257. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/sync_in_progress.html +7 -0
  258. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/top_group_alignment.html +7 -0
  259. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +22 -1
  260. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/aggregate.html +8 -0
  261. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/array.html +7 -0
  262. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/bottom_group_alignment.html +7 -0
  263. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/cant_sync.html +7 -0
  264. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/center_group_alignment.html +8 -0
  265. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/columns.html +7 -0
  266. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/fully_synced.html +8 -0
  267. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/inner_join.html +7 -0
  268. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/join.html +8 -0
  269. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/left_join.html +14 -0
  270. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/macros.html +2 -2
  271. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_in_sync.html +7 -0
  272. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/not_saved.html +9 -0
  273. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/outer_join.html +7 -0
  274. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/path_experiment.html +7 -0
  275. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort.html +7 -0
  276. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/program_cohort_member.html +7 -0
  277. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/record_consent.html +7 -0
  278. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/right_join.html +7 -0
  279. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/skill.html +8 -0
  280. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/sync_in_progress.html +7 -0
  281. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/top_group_alignment.html +7 -0
  282. package/src/lightning/iconUtils/iconColors.js +1 -1
  283. package/src/lightning/input/form-element.slds.css +1 -0
  284. package/src/lightning/input/input.html +16 -2
  285. package/src/lightning/input/input.js +91 -3
  286. package/src/lightning/input/input.js-meta.xml +3 -0
  287. package/src/lightning/inputAddress/addressFormat.js +25 -11
  288. package/src/lightning/inputAddress/fieldsLayout.js +3 -0
  289. package/src/lightning/inputAddress/form-element.slds.css +1 -0
  290. package/src/lightning/inputAddress/input-text.slds.css +5 -5
  291. package/src/lightning/inputAddress/inputAddress.html +1 -1
  292. package/src/lightning/inputAddress/inputAddress.js +27 -11
  293. package/src/lightning/inputLocation/form-element.slds.css +1 -0
  294. package/src/lightning/inputLocation/input-text.slds.css +5 -5
  295. package/src/lightning/inputName/form-element.slds.css +1 -0
  296. package/src/lightning/inputName/input-text.slds.css +5 -5
  297. package/src/lightning/internationalizationLibrary/address/AddressFormat.js +2 -0
  298. package/src/lightning/layout/__docs__/layout.md +0 -2
  299. package/src/lightning/lookupAddress/form-element.slds.css +1 -0
  300. package/src/lightning/menuItem/menu-item.slds.css +3 -1
  301. package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +7 -3
  302. package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +18 -11
  303. package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
  304. package/src/lightning/modalBase/modalBase.css +4 -0
  305. package/src/lightning/modalBase/modalBase.html +16 -21
  306. package/src/lightning/modalBase/modalBase.js +46 -65
  307. package/src/lightning/modalHeader/modalHeader.html +3 -15
  308. package/src/lightning/modalHeader/modalHeader.js +14 -61
  309. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.css +14 -0
  310. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.html +55 -0
  311. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js +430 -0
  312. package/src/lightning/multiColumnSortingModal/multiColumnSortingModal.js-meta.xml +4 -0
  313. package/src/lightning/overlayManager/overlayManager.js +16 -0
  314. package/src/lightning/pill/pill.js +19 -13
  315. package/src/lightning/pillContainer/button.slds.css +16 -15
  316. package/src/lightning/pillContainer/pillContainer.js +2 -1
  317. package/src/lightning/pillContainer/standardPillContainer.html +6 -2
  318. package/src/lightning/positionLibrary/direction.js +19 -0
  319. package/src/lightning/primitiveBubble/primitiveBubble.js +7 -0
  320. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.html +2 -2
  321. package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +8 -0
  322. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.css +34 -0
  323. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +60 -0
  324. package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +107 -0
  325. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +36 -3
  326. package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.css +5 -0
  327. package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +9 -0
  328. package/src/lightning/primitiveInputCheckbox/form-element.slds.css +1 -0
  329. package/src/lightning/primitiveInputCheckbox/input-checkbox.slds.css +3 -3
  330. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +1 -1
  331. package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +1 -0
  332. package/src/lightning/primitiveInputCheckboxButton/input-checkbox-button.slds.css +6 -5
  333. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +1 -1
  334. package/src/lightning/primitiveInputColor/form-element.slds.css +1 -0
  335. package/src/lightning/primitiveInputColor/input-text.slds.css +5 -5
  336. package/src/lightning/primitiveInputColor/primitiveInputColor.html +5 -2
  337. package/src/lightning/primitiveInputColor/primitiveInputColor.js +2 -0
  338. package/src/lightning/primitiveInputFile/button.slds.css +16 -15
  339. package/src/lightning/primitiveInputFile/form-element.slds.css +1 -0
  340. package/src/lightning/primitiveInputFile/primitiveInputFile.html +1 -1
  341. package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +1 -1
  342. package/src/lightning/primitiveInputSimple/form-element.slds.css +1 -0
  343. package/src/lightning/primitiveInputSimple/input-text.slds.css +5 -5
  344. package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +3 -2
  345. package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +15 -0
  346. package/src/lightning/primitiveInputToggle/form-element.slds.css +1 -0
  347. package/src/lightning/primitiveInputToggle/input-toggle.slds.css +16 -14
  348. package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +1 -1
  349. package/src/lightning/progressIndicator/path.html +8 -2
  350. package/src/lightning/progressIndicator/progressIndicator.js +26 -2
  351. package/src/lightning/progressRing/progress-ring.slds.css +1 -1
  352. package/src/lightning/progressStep/progressStep.js +2 -1
  353. package/src/lightning/prompt/prompt.js +11 -9
  354. package/src/lightning/radioGroup/form-element.slds.css +1 -0
  355. package/src/lightning/radioGroup/input-radio-group.slds.css +4 -10
  356. package/src/lightning/select/form-element.slds.css +1 -0
  357. package/src/lightning/select/select.js +89 -7
  358. package/src/lightning/tabBar/tab-bar.slds.css +11 -0
  359. package/src/lightning/tabset/tabset.slds.css +1 -1
  360. package/src/lightning/textarea/form-element.slds.css +1 -0
  361. package/src/lightning/textarea/textarea.html +1 -0
  362. package/src/lightning/textarea/textarea.slds.css +2 -2
  363. package/src/lightning/timepicker/form-element.slds.css +1 -0
  364. package/src/lightning/timepicker/timepicker.html +4 -1
  365. package/src/lightning/timepicker/timepicker.js +3 -0
  366. package/src/lightning/toast/button-icon.slds.css +41 -25
  367. package/src/lightning/tooltipLibrary/tooltipLibrary.js +4 -15
  368. package/src/lightning/verticalNavigationOverflow/button.slds.css +16 -15
  369. package/scopedImports/@salesforce-label-LightningLookup.messageWhenSearchTermTooShort.js +0 -1
@@ -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 { setColumns, 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
- updateRowsAndCells,
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,
@@ -123,18 +134,22 @@ import {
123
134
  getRowDataSelector,
124
135
  getScrollerX,
125
136
  getScrollerY,
137
+ isLoadMore,
126
138
  isObjectLike,
139
+ isRenderModeInline,
127
140
  isRenderModeRoleBased,
128
141
  } from './utils';
129
142
  import { setWrapTextMaxLines } from './wrapText';
130
143
  import {
131
144
  handleVariableRowHeights,
132
145
  resetRowHeights,
133
- resetTableHeight,
134
146
  findFirstVisibleIndex,
147
+ addTableHeight,
135
148
  } from './virtualization';
136
149
  import DatatableTypes from './types';
137
150
 
151
+ const { PrivateLookupItemPickedEvent } = FORMATTED_LOOKUP_EVENTS;
152
+
138
153
  const i18n = {
139
154
  ariaLiveNavigationMode: labelAriaLiveNavigationMode,
140
155
  ariaLiveActionMode: labelAriaLiveActionMode,
@@ -190,9 +205,12 @@ export default class LightningDatatable extends LightningElement {
190
205
  _renderConfig;
191
206
  _renderManager;
192
207
  _renderMode = 'default';
208
+ _renderedTemplate = tableTemplate;
193
209
  _shouldResetFocus = false; // used to ensure focus isn't lost from changes in renderedRows
194
210
  _suppressBottomBar = false;
195
211
  _widthObserver; // Instance of LightningDatatableResizeObserver
212
+ _hasSetInitialCustomTypes = false;
213
+ _shouldResetCustomTypes = false;
196
214
 
197
215
  /************************* PUBLIC PROPERTIES *************************/
198
216
 
@@ -252,7 +270,7 @@ export default class LightningDatatable extends LightningElement {
252
270
  set columns(value) {
253
271
  const _rawColumns = Array.isArray(value) ? value : [];
254
272
  this._rawColumns = _rawColumns;
255
- this.updateColumns(this._rawColumns);
273
+ this.updateColumns(_rawColumns);
256
274
  this._columnWidthManager.handleColumnsChange(this.state.columns);
257
275
  }
258
276
 
@@ -267,25 +285,35 @@ export default class LightningDatatable extends LightningElement {
267
285
  }
268
286
 
269
287
  set data(value) {
270
- const { state } = this;
271
- const { data: previousData } = state;
288
+ const { _customerSelectedRows, state } = this;
289
+ const { data: previousData, columns } = state;
272
290
  const data = Array.isArray(value) ? value : [];
291
+ const isInfiniteLoading = isLoadMore(previousData, data);
273
292
 
274
293
  // Untracked state change.
275
294
  state.data = data;
276
- this._columnWidthManager.handleDataChange(
277
- previousData,
278
- data,
279
- state.columns
280
- );
295
+ if (!isInfiniteLoading && data.length && columns.length) {
296
+ this._columnWidthManager.handleDataChange(columns);
297
+ }
281
298
 
282
299
  // do necessary updates since rows have changed
283
300
  if (this.hasValidKeyField) {
284
- this.updateRows();
285
- 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
+ }
286
314
  }
287
- if (this._customerSelectedRows) {
288
- this.setSelectedRows(this._customerSelectedRows);
315
+ if (_customerSelectedRows) {
316
+ this.setSelectedRows(_customerSelectedRows);
289
317
  }
290
318
  }
291
319
 
@@ -321,7 +349,7 @@ export default class LightningDatatable extends LightningElement {
321
349
  this._draftValues = value;
322
350
  setDirtyValues(state, value);
323
351
 
324
- if (this.hasValidKeyField) {
352
+ if (this.isConnected && this.hasValidKeyField) {
325
353
  this.updateRowsAndCells();
326
354
  }
327
355
 
@@ -358,8 +386,11 @@ export default class LightningDatatable extends LightningElement {
358
386
  }
359
387
 
360
388
  set errors(value) {
361
- setErrors(this.state, value);
362
- this.updateRows();
389
+ const { state } = this;
390
+ setErrors(state, value);
391
+ if (this.isConnected) {
392
+ updateCells(state);
393
+ }
363
394
  }
364
395
 
365
396
  /**
@@ -373,7 +404,7 @@ export default class LightningDatatable extends LightningElement {
373
404
  }
374
405
 
375
406
  set hideCheckboxColumn(value) {
376
- const { state } = this;
407
+ const { _rawColumns, state } = this;
377
408
  const normalizedValue = normalizeBoolean(value);
378
409
 
379
410
  this._columnWidthManager.handleCheckboxColumnChange(
@@ -384,6 +415,41 @@ export default class LightningDatatable extends LightningElement {
384
415
  // Untracked state changes.
385
416
  state.hideCheckboxColumn = normalizedValue;
386
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.
387
453
  this.updateColumns(this._rawColumns);
388
454
  }
389
455
 
@@ -449,7 +515,9 @@ export default class LightningDatatable extends LightningElement {
449
515
  setKeyField(state, value);
450
516
  // Tracked state change.
451
517
  setDirtyValues(state, this._draftValues);
452
- this.updateRows();
518
+ if (this.isConnected) {
519
+ this.updateRows();
520
+ }
453
521
  }
454
522
 
455
523
  /**
@@ -500,9 +568,13 @@ export default class LightningDatatable extends LightningElement {
500
568
 
501
569
  set maxRowSelection(value) {
502
570
  const { state } = this;
571
+ if (!state.hasCalledUpdateRowsAndCells) {
572
+ // Tracked state changes.
573
+ this.updateRowsAndCells();
574
+ }
503
575
  const previousSelectionLength = getCurrentSelectionLength(state);
504
576
  // A mix of tracked and untracked state changes.
505
- setMaxRowSelection(state, value);
577
+ setMaxRowSelection(state, value, this._datatableId);
506
578
  if (previousSelectionLength > 0) {
507
579
  this.fireSelectedRowsChange(this.getSelectedRows());
508
580
  }
@@ -583,20 +655,25 @@ export default class LightningDatatable extends LightningElement {
583
655
  const { _renderConfig, state } = this;
584
656
  const renderMode = normalizeString(value, {
585
657
  fallbackValue: 'default',
586
- validValues: ['default', 'role-based'],
658
+ validValues: [
659
+ 'default',
660
+ 'inline',
661
+ 'role-based',
662
+ 'role-based-inline',
663
+ ],
587
664
  });
665
+ const renderModeInline = isRenderModeInline(renderMode);
588
666
  const renderModeRoleBased = isRenderModeRoleBased(renderMode);
589
667
 
590
668
  this._renderMode = renderMode;
591
669
  // Untracked state changes.
592
670
  state.hasRenderedFirstTime = false;
671
+ state.hasRenderedTable = false;
672
+ state.renderModeInline = renderModeInline;
593
673
  state.renderModeRoleBased = renderModeRoleBased;
594
674
  if (this.isConnected) {
595
- const { _widthObserver } = this;
596
- if (_widthObserver) {
597
- _widthObserver.disconnect();
598
- }
599
- this._renderManager.disconnectResizeObserver();
675
+ // Tracked state changes.
676
+ this.updateRowsAndCells();
600
677
  }
601
678
  if (_renderConfig) {
602
679
  setVirtualize(state, _renderConfig.virtualize);
@@ -667,6 +744,9 @@ export default class LightningDatatable extends LightningElement {
667
744
  }
668
745
 
669
746
  set selectedRows(value) {
747
+ if (!this.state.hasCalledUpdateRowsAndCells) {
748
+ this.updateRowsAndCells();
749
+ }
670
750
  this._customerSelectedRows = value;
671
751
  this.setSelectedRows(value);
672
752
  }
@@ -691,7 +771,17 @@ export default class LightningDatatable extends LightningElement {
691
771
  );
692
772
  // Untracked state change.
693
773
  state.showRowNumberColumn = normalizeBoolean(value);
694
- 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
+ }
695
785
  }
696
786
 
697
787
  /**
@@ -757,7 +847,9 @@ export default class LightningDatatable extends LightningElement {
757
847
  // Untracked state changes.
758
848
  setWrapTextMaxLines(state, value);
759
849
  this._columnWidthManager.wrapTextMaxLines = state.wrapTextMaxLines;
760
- this.updateRowsAndCells();
850
+ if (this.isConnected) {
851
+ updateCells(state);
852
+ }
761
853
  }
762
854
 
763
855
  /************************** PUBLIC METHODS ***************************/
@@ -769,6 +861,9 @@ export default class LightningDatatable extends LightningElement {
769
861
  @api
770
862
  getSelectedRows() {
771
863
  const { state } = this;
864
+ if (!state.hasCalledUpdateRowsAndCells) {
865
+ this.updateRowsAndCells();
866
+ }
772
867
  const data = unwrap(state.data);
773
868
  const { rows } = state;
774
869
  const selectedRows = [];
@@ -795,6 +890,9 @@ export default class LightningDatatable extends LightningElement {
795
890
  */
796
891
  @api
797
892
  openInlineEdit() {
893
+ if (!this.state.hasCalledUpdateRowsAndCells) {
894
+ this.updateRowsAndCells();
895
+ }
798
896
  openInlineEditOnActiveCell(this);
799
897
  }
800
898
 
@@ -933,7 +1031,11 @@ export default class LightningDatatable extends LightningElement {
933
1031
  * A table with no rows of data still has an aria-rowcount of 1
934
1032
  */
935
1033
  get ariaRowCount() {
936
- return this.state.rows.length + 1;
1034
+ const { state } = this;
1035
+ if (!state.hasCalledUpdateRowsAndCells) {
1036
+ this.updateRowsAndCells();
1037
+ }
1038
+ return state.rows.length + 1;
937
1039
  }
938
1040
 
939
1041
  get hasValidKeyField() {
@@ -951,12 +1053,11 @@ export default class LightningDatatable extends LightningElement {
951
1053
  return !this.widthsData.resizeColumnDisabled;
952
1054
  }
953
1055
 
954
- get privateTypes() {
955
- return this._privateTypes;
956
- }
957
-
958
1056
  get renderedRows() {
959
1057
  const { state } = this;
1058
+ if (!state.hasCalledUpdateRowsAndCells) {
1059
+ this.updateRowsAndCells();
1060
+ }
960
1061
  const { virtualize, rows, renderedRowCount } = state;
961
1062
  if (virtualize) {
962
1063
  const { firstIndex, lastIndex } =
@@ -1048,6 +1149,16 @@ export default class LightningDatatable extends LightningElement {
1048
1149
  template.addEventListener('privatecellfalseblurred', (event) => {
1049
1150
  this.handleFalseCellBlur(event);
1050
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
+ });
1051
1162
  // Row level actions
1052
1163
  template.addEventListener('privatecellactiontriggered', (event) => {
1053
1164
  this.handleRowActionTriggered(event);
@@ -1058,7 +1169,6 @@ export default class LightningDatatable extends LightningElement {
1058
1169
  template.addEventListener('privatecellbuttonclicked', (event) => {
1059
1170
  this.handleCellButtonClick(event);
1060
1171
  });
1061
-
1062
1172
  // Header actions
1063
1173
  template.addEventListener(
1064
1174
  'privatecellheaderactionmenuopening',
@@ -1078,19 +1188,42 @@ export default class LightningDatatable extends LightningElement {
1078
1188
  this.handleHeaderActionTriggered(event);
1079
1189
  }
1080
1190
  );
1191
+ // Open sorting modal
1192
+ template.addEventListener('privateopensortingmodal', (event) => {
1193
+ this.handleOpenSortingModal(event);
1194
+ });
1081
1195
  // Inline edit
1082
1196
  template.addEventListener('privateeditcell', (event) => {
1083
1197
  this.handleEditCell(event);
1084
1198
  });
1199
+
1200
+ this.updateColumnsAndRows();
1085
1201
  }
1086
1202
 
1087
1203
  /**
1088
1204
  * Renders the appropriate template - div.html or table.html,
1089
- * 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
+ *
1090
1209
  * By default, table.html is rendered
1091
1210
  */
1092
1211
  render() {
1093
- 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;
1094
1227
  }
1095
1228
 
1096
1229
  renderedCallback() {
@@ -1102,6 +1235,13 @@ export default class LightningDatatable extends LightningElement {
1102
1235
  widthsData,
1103
1236
  } = this;
1104
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
+ }
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
1247
  synchronizeAttrs(gridContainer, {
@@ -1110,6 +1250,7 @@ export default class LightningDatatable extends LightningElement {
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(
@@ -1175,10 +1316,12 @@ export default class LightningDatatable extends LightningElement {
1175
1316
  !state.inlineEdit.isPanelVisible
1176
1317
  ) {
1177
1318
  const cellElement = getActiveCellElement(template, state);
1319
+ const cellElementChild = getCellElementChild(cellElement);
1178
1320
  if (
1321
+ !renderModeInline &&
1179
1322
  cellElement &&
1180
- cellElement.parentElement &&
1181
- !cellElement.parentElement.classList.contains(FOCUS_CLASS)
1323
+ cellElementChild &&
1324
+ !cellElementChild.classList.contains(FOCUS_CLASS)
1182
1325
  ) {
1183
1326
  // Tracked state change.
1184
1327
  setFocusActiveCell(state, template, null, null, false);
@@ -1186,13 +1329,14 @@ export default class LightningDatatable extends LightningElement {
1186
1329
  }
1187
1330
  }
1188
1331
 
1189
- const { hasRenderedFirstTime } = state;
1332
+ const { hasRenderedFirstTime, hasRenderedTable } = state;
1190
1333
  const virtualize = !!state.virtualize;
1191
1334
  const { length: rowCount } = state.rows;
1192
1335
 
1193
1336
  // Untracked state changes.
1194
1337
  // Set rendered flags BEFORE handlePrefetch() is called.
1195
1338
  state.hasRenderedFirstTime = true;
1339
+ state.hasRenderedTable = true;
1196
1340
 
1197
1341
  if (virtualize || state.enableViewportRendering) {
1198
1342
  const { _renderManager } = this;
@@ -1202,7 +1346,7 @@ export default class LightningDatatable extends LightningElement {
1202
1346
  }
1203
1347
  }
1204
1348
  if (!hasRenderedFirstTime) {
1205
- this._renderManager.connectResizeObserver(
1349
+ _renderManager.connectResizeObserver(
1206
1350
  template.querySelector('div.dt-outer-container')
1207
1351
  );
1208
1352
  }
@@ -1221,6 +1365,14 @@ export default class LightningDatatable extends LightningElement {
1221
1365
  }
1222
1366
  }
1223
1367
  }
1368
+
1369
+ if (rowCount && renderModeInline && !hasRenderedTable) {
1370
+ this.updateCheckboxCellsAriaAttrs();
1371
+ if (hasLinkProvider(template)) {
1372
+ this.updateLookupCellsLinkInfo();
1373
+ this.updateUrlCellsLinkInfo();
1374
+ }
1375
+ }
1224
1376
  }
1225
1377
 
1226
1378
  updateTableAndScrollerStyleOnRender() {
@@ -1259,22 +1411,23 @@ export default class LightningDatatable extends LightningElement {
1259
1411
 
1260
1412
  handleLoadDynamicActions = handleLoadDynamicActions;
1261
1413
 
1414
+ handlePrimitiveDatatableCellClick = handlePrimitiveDatatableCellClick;
1415
+
1416
+ handlePrimitiveDatatableCellFocus = handlePrimitiveDatatableCellFocus;
1417
+
1418
+ handlePrimitiveDatatableCellKeydown = handlePrimitiveDatatableCellKeydown;
1419
+
1262
1420
  handleRowSelectionChange = handleRowSelectionChange;
1263
1421
 
1264
1422
  handleRowActionTriggered = handleRowActionTriggered;
1265
1423
 
1266
1424
  handleCustomTypesChange() {
1267
- const assignedNodes = this.template
1268
- .querySelector('slot[name="customdatatypes"]')
1269
- .assignedNodes();
1270
- if (assignedNodes.length) {
1271
- const provider = assignedNodes[0];
1272
- if (typeof provider.getDataTypes === 'function') {
1273
- this._privateTypes = new DatatableTypes(
1274
- provider.getDataTypes()
1275
- );
1276
- this.updateColumns(this._rawColumns);
1277
- }
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;
1278
1431
  }
1279
1432
  }
1280
1433
 
@@ -1355,25 +1508,27 @@ export default class LightningDatatable extends LightningElement {
1355
1508
  const { target } = event;
1356
1509
  if (isCellElement(target)) {
1357
1510
  // get the row/col key value from the primitive cell.
1358
- const { rowKeyValue, colKeyValue } =
1359
- target.querySelector(':first-child');
1360
-
1511
+ // const { rowKeyValue, colKeyValue } =
1512
+ // target.querySelector(':first-child');
1513
+ const cellElement = target;
1361
1514
  const { state } = this;
1515
+ const { rowKeyValue } = cellElement.parentElement.dataset;
1516
+ const { colKeyValue } = cellElement.dataset;
1362
1517
  if (
1363
1518
  state.rowMode ||
1364
1519
  !isActiveCell(state, rowKeyValue, colKeyValue)
1365
1520
  ) {
1366
- if (state.activeCell && state.rowMode) {
1521
+ const { activeCell } = state;
1522
+ if (activeCell && state.rowMode) {
1367
1523
  // Untracked state change.
1368
1524
  unsetRowNavigationMode(state);
1369
- const { rowIndex } = getIndexesActiveCell(state);
1370
1525
  // Tracked state change.
1371
- updateRowTabIndex(state, rowIndex, -1);
1526
+ updateRowTabIndex(state, activeCell.rowIndex, -1);
1372
1527
  }
1373
1528
  this.setActiveCell(rowKeyValue, colKeyValue);
1374
1529
  }
1375
-
1376
1530
  if (!datatableHasFocus(state, this.template)) {
1531
+ // Untracked state change.
1377
1532
  setCellClickedForFocus(state);
1378
1533
  }
1379
1534
  }
@@ -1381,47 +1536,33 @@ export default class LightningDatatable extends LightningElement {
1381
1536
 
1382
1537
  /**
1383
1538
  * Handles the 'privateupdatecolsort' event on lightning-datatable
1384
- *
1539
+ * Used only for single column sorting from column header clicking
1385
1540
  * @param {CustomEvent} event - 'privateupdatecolsort'
1386
1541
  */
1387
1542
  handleUpdateColumnSort(event) {
1388
1543
  event.stopPropagation();
1389
- const {
1390
- fieldNames,
1391
- sortDirections,
1392
- isMultiColumnSort,
1393
- fieldName,
1394
- columnKey,
1395
- sortDirection,
1396
- } = event.detail;
1397
-
1398
- if (isMultiColumnSort) {
1399
- // multi-column sort
1400
- this.fireSortedColumnChange(
1401
- fieldNames,
1402
- sortDirections,
1403
- isMultiColumnSort,
1404
- fieldName,
1405
- columnKey,
1406
- sortDirection
1407
- );
1408
- } else {
1409
- // single-column sort
1410
- this.fireSortedColumnChange(
1411
- [fieldName],
1412
- [sortDirection],
1413
- false,
1414
- fieldName,
1415
- columnKey,
1416
- sortDirection
1417
- );
1418
- }
1544
+ const { fieldName, columnKey, sortDirection } = event.detail;
1545
+
1546
+ this.fireSortedColumnChange(fieldName, columnKey, sortDirection);
1419
1547
  }
1420
1548
 
1421
1549
  handleCheckboxHeaderId(event) {
1422
1550
  this._checkboxColumnHeaderId = event.detail;
1423
1551
  }
1424
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
+
1425
1566
  /**
1426
1567
  * Handles the 'resizecol' event on lightning-datatable
1427
1568
  *
@@ -1501,10 +1642,10 @@ export default class LightningDatatable extends LightningElement {
1501
1642
  const { rowKeyValue, colKeyValue, needsRefocusOnCellElement } =
1502
1643
  event.detail;
1503
1644
  if (!isActiveCell(state, rowKeyValue, colKeyValue)) {
1504
- if (state.activeCell && state.rowMode) {
1645
+ const { activeCell } = state;
1646
+ if (activeCell && state.rowMode) {
1505
1647
  unsetRowNavigationMode(state);
1506
- const { rowIndex } = getIndexesActiveCell(state);
1507
- updateRowTabIndex(state, rowIndex, -1);
1648
+ updateRowTabIndex(state, activeCell.rowIndex, -1);
1508
1649
  }
1509
1650
  this.setActiveCell(rowKeyValue, colKeyValue);
1510
1651
  refocusCellElement(state, this.template, needsRefocusOnCellElement);
@@ -1660,8 +1801,99 @@ export default class LightningDatatable extends LightningElement {
1660
1801
  );
1661
1802
  }
1662
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
+
1663
1883
  /************************ EVENT DISPATCHERS **************************/
1664
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
+
1665
1897
  fireSelectedRowsChange(selectedRows, config = {}) {
1666
1898
  this.dispatchEvent(
1667
1899
  new CustomEvent('rowselection', {
@@ -1670,26 +1902,18 @@ export default class LightningDatatable extends LightningElement {
1670
1902
  );
1671
1903
  }
1672
1904
 
1673
- fireSortedColumnChange(
1674
- fieldNames,
1675
- sortDirections,
1676
- isMultiColumnSort,
1677
- fieldName,
1678
- columnKey,
1679
- sortDirection
1680
- ) {
1681
- this.dispatchEvent(
1682
- new CustomEvent('sort', {
1683
- detail: {
1684
- fieldNames,
1685
- sortDirections,
1686
- isMultiColumnSort,
1687
- fieldName,
1688
- columnKey,
1689
- sortDirection,
1690
- },
1691
- })
1692
- );
1905
+ fireSortedColumnChange(fieldName, columnKey, sortDirection) {
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);
1693
1917
  }
1694
1918
 
1695
1919
  fireOnResize(isUserTriggered) {
@@ -1764,19 +1988,19 @@ export default class LightningDatatable extends LightningElement {
1764
1988
  }
1765
1989
 
1766
1990
  updateColumns(columns) {
1767
- const { state } = this;
1768
- this.updateColumnsBeforeIndexes(columns);
1769
- state.headerIndexes = generateHeaderIndexes(state.columns);
1770
- this.updateRowsAndCells();
1771
- this.updateColumnsAfterIndexes();
1991
+ setColumns(this.state, columns, this._privateTypes);
1992
+ if (this.isConnected) {
1993
+ this.updateColumnsBeforeIndexes();
1994
+ this.updateRowsAndCells();
1995
+ this.updateColumnsAfterIndexes();
1996
+ }
1772
1997
  }
1773
1998
 
1774
- updateColumnsBeforeIndexes(columns) {
1999
+ updateColumnsBeforeIndexes() {
1775
2000
  const { state } = this;
1776
2001
  // Untracked state changes.
1777
2002
  // Calculate cell to focus next before indexes are updated.
1778
2003
  setCellToFocusFromPrev(state, this.template);
1779
- setColumns(state, columns, this.privateTypes);
1780
2004
  updateRowNavigationMode(state);
1781
2005
  // Tracked state changes.
1782
2006
  setDirtyValues(state, this._draftValues);
@@ -1815,8 +2039,20 @@ export default class LightningDatatable extends LightningElement {
1815
2039
  }
1816
2040
  }
1817
2041
 
2042
+ updateColumnsAndRows() {
2043
+ this.updateColumnsBeforeIndexes(this._rawColumns);
2044
+ this.updateRowsBeforeIndexes();
2045
+ this.updateRowsAndCells();
2046
+ this.updateRowsAfterIndexes();
2047
+ this.updateColumnsAfterIndexes();
2048
+ }
2049
+
1818
2050
  updateRowsAndCells() {
1819
- updateRowsAndCells(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);
1820
2056
  }
1821
2057
 
1822
2058
  updateVirtualizedRowHeights() {
@@ -1842,7 +2078,7 @@ export default class LightningDatatable extends LightningElement {
1842
2078
  const height = rowElement.getBoundingClientRect().height + 1;
1843
2079
  if (state.rowHeight !== height) {
1844
2080
  state.rowHeight = height;
1845
- resetTableHeight(state);
2081
+ state.tableHeight = state.rowHeight * state.rows.length;
1846
2082
  state.rows.forEach((row) => {
1847
2083
  row.style = `position:absolute;top:${
1848
2084
  row.rowIndex * height
@@ -1854,24 +2090,44 @@ export default class LightningDatatable extends LightningElement {
1854
2090
  }
1855
2091
 
1856
2092
  setSelectedRows(value) {
2093
+ // A mix of tracked and untracked state changes.
1857
2094
  setSelectedRowsKeys(this.state, value);
1858
2095
  this.handleRowSelectionChange();
1859
2096
  }
1860
2097
 
1861
2098
  setActiveCell(rowKeyValue, colKeyValue) {
1862
2099
  const { state, template } = this;
1863
- const { rowIndex, colIndex } = getIndexesByKeys(
1864
- state,
1865
- rowKeyValue,
1866
- colKeyValue
1867
- );
2100
+ const newActiveCell = getCellByKeys(state, rowKeyValue, colKeyValue);
1868
2101
  // Tracked state change.
1869
2102
  setBlurActiveCell(state, template);
1870
2103
  // Untracked state change.
1871
- state.activeCell = { rowKeyValue, colKeyValue };
2104
+ state.activeCell = newActiveCell;
1872
2105
  // Tracked state changes.
1873
2106
  addFocusStylesToActiveCell(state, template);
1874
- 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
+ }
1875
2131
  }
1876
2132
 
1877
2133
  /**
@@ -1918,4 +2174,108 @@ export default class LightningDatatable extends LightningElement {
1918
2174
  const { rowKeyValue } = dataset;
1919
2175
  return { rowIndex, rowKeyValue };
1920
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
+ }
1921
2281
  }