lightning-base-components 1.21.3-alpha → 1.21.5-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 (233) hide show
  1. package/metadata/raptor.json +49 -0
  2. package/package.json +96 -21
  3. package/scopedImports/@salesforce-label-LightningDatatable.showActions.js +1 -1
  4. package/scopedImports/@salesforce-label-LightningForm.controllerFieldsMessage.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningForm.dependentFieldsHeader.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningForm.dependentFieldsListHeading.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningForm.generalDependentFieldsMessage.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningForm.learnMore.js +1 -0
  9. package/scopedImports/@salesforce-label-LightningForm.okButton.js +1 -0
  10. package/scopedImports/@salesforce-label-LightningLookup.messageWhenSearchTermTooShort.js +1 -0
  11. package/scopedImports/@salesforce-label-LightningLookup.modalCancel.js +1 -0
  12. package/scopedImports/@salesforce-label-LightningLookup.modalSelect.js +1 -0
  13. package/scopedImports/@salesforce-label-LightningProgressIndicator.currentStage.js +1 -1
  14. package/scopedImports/@salesforce-label-LightningProgressIndicator.errorStage.js +1 -0
  15. package/scopedImports/@salesforce-label-LightningProgressIndicator.stageComplete.js +1 -1
  16. package/scopedImports/@salesforce-label-LightningProgressIndicator.stageNotStarted.js +1 -1
  17. package/src/lightning/accordion/__docs__/accordion.md +0 -4
  18. package/src/lightning/accordionSection/__docs__/accordionSection.md +0 -4
  19. package/src/lightning/avatar/__docs__/avatar.md +0 -4
  20. package/src/lightning/avatar/avatar.html +1 -0
  21. package/src/lightning/badge/__docs__/badge.md +0 -4
  22. package/src/lightning/badge/badge.html +3 -3
  23. package/src/lightning/barcodeScanner/__docs__/barcodeScanner.md +0 -4
  24. package/src/lightning/baseCombobox/baseCombobox.html +4 -1
  25. package/src/lightning/baseCombobox/baseCombobox.js +5 -18
  26. package/src/lightning/baseComboboxItem/baseComboboxItem.js +6 -10
  27. package/src/lightning/button/__docs__/button.md +5 -8
  28. package/src/lightning/button/button.js +3 -4
  29. package/src/lightning/buttonGroup/__docs__/buttonGroup.md +0 -4
  30. package/src/lightning/buttonIcon/__docs__/buttonIcon.md +1 -4
  31. package/src/lightning/buttonIcon/buttonIcon.html +1 -1
  32. package/src/lightning/buttonIcon/buttonIcon.js +18 -17
  33. package/src/lightning/buttonIconStateful/__docs__/buttonIconStateful.md +0 -4
  34. package/src/lightning/buttonMenu/__docs__/buttonMenu.md +0 -4
  35. package/src/lightning/buttonMenu/buttonMenu.css +5 -0
  36. package/src/lightning/buttonMenu/buttonMenu.js +2 -0
  37. package/src/lightning/buttonStateful/__docs__/buttonStateful.md +0 -4
  38. package/src/lightning/buttonStateful/buttonStateful.html +5 -3
  39. package/src/lightning/buttonStateful/buttonStateful.js +4 -0
  40. package/src/lightning/card/__docs__/card.md +0 -4
  41. package/src/lightning/card/card.js-meta.xml +3 -0
  42. package/src/lightning/carousel/__docs__/carousel.md +0 -4
  43. package/src/lightning/checkboxGroup/__docs__/checkboxGroup.md +0 -4
  44. package/src/lightning/colorPickerCustom/colorPickerCustom.js +12 -0
  45. package/src/lightning/colorPickerPanel/colorPickerPanel.js +11 -1
  46. package/src/lightning/combobox/__docs__/combobox.md +0 -4
  47. package/src/lightning/combobox/combobox.html +1 -0
  48. package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.html +11 -0
  49. package/src/lightning/datatable/__examples__disabled/customComponentWrapper/customComponentWrapper.js +25 -0
  50. package/src/lightning/datatable/__examples__disabled/customComponentWrapper/generateData.js +15 -0
  51. package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/customInput.html +4 -0
  52. package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/myCustomTypeDatatable.js +17 -0
  53. package/src/lightning/datatable/__examples__disabled/myCustomTypeDatatable/nestedSimpleComponentParent.html +7 -0
  54. package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.html +9 -0
  55. package/src/lightning/datatable/__examples__disabled/simpleComponentNested/simpleComponentNested.js +6 -0
  56. package/src/lightning/datatable/autoWidthStrategy.js +8 -36
  57. package/src/lightning/datatable/columnResizer.js +51 -161
  58. package/src/lightning/datatable/columnWidthManager.js +25 -81
  59. package/src/lightning/datatable/columns.js +180 -302
  60. package/src/lightning/datatable/datatable.js +454 -441
  61. package/src/lightning/datatable/errors.js +17 -29
  62. package/src/lightning/datatable/fixedWidthStrategy.js +7 -22
  63. package/src/lightning/datatable/headerActions.js +8 -38
  64. package/src/lightning/datatable/indexes.js +42 -0
  65. package/src/lightning/datatable/infiniteLoading.js +16 -35
  66. package/src/lightning/datatable/inlineEdit.js +126 -156
  67. package/src/lightning/datatable/keyboard.js +226 -282
  68. package/src/lightning/datatable/renderManager.js +0 -4
  69. package/src/lightning/datatable/resizeObserver.js +4 -13
  70. package/src/lightning/datatable/rowLevelActions.js +2 -2
  71. package/src/lightning/datatable/rowNumber.js +21 -59
  72. package/src/lightning/datatable/rowSelection.js +95 -178
  73. package/src/lightning/datatable/rowSelectionShared.js +13 -27
  74. package/src/lightning/datatable/rows.js +171 -418
  75. package/src/lightning/datatable/sort.js +16 -75
  76. package/src/lightning/datatable/templates/div/div.html +12 -4
  77. package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +10 -16
  78. package/src/lightning/datatable/templates/table/table.html +15 -5
  79. package/src/lightning/datatable/tree.js +17 -35
  80. package/src/lightning/datatable/types.js +10 -31
  81. package/src/lightning/datatable/utils.js +48 -24
  82. package/src/lightning/datatable/virtualization.js +2 -5
  83. package/src/lightning/datatable/widthManagerShared.js +0 -20
  84. package/src/lightning/datatable/wrapText.js +29 -60
  85. package/src/lightning/dualListbox/__docs__/dualListbox.md +0 -4
  86. package/src/lightning/dualListbox/dualListbox.js +7 -8
  87. package/src/lightning/dynamicIcon/__docs__/dynamicIcon.md +0 -4
  88. package/src/lightning/formattedDateTime/__docs__/formattedDateTime.md +0 -4
  89. package/src/lightning/formattedLocation/__docs__/formattedLocation.md +0 -4
  90. package/src/lightning/formattedName/__docs__/formattedName.md +0 -4
  91. package/src/lightning/formattedName/formattedName.js +3 -2
  92. package/src/lightning/formattedName/formattedName.js-meta.xml +3 -0
  93. package/src/lightning/formattedNumber/__docs__/formattedNumber.md +0 -4
  94. package/src/lightning/formattedNumber/formattedNumber.js +3 -2
  95. package/src/lightning/formattedNumber/formattedNumber.js-meta.xml +3 -0
  96. package/src/lightning/formattedPhone/__docs__/formattedPhone.md +0 -4
  97. package/src/lightning/formattedRichText/richTextConfig.js +1 -0
  98. package/src/lightning/formattedText/__docs__/formattedText.md +0 -4
  99. package/src/lightning/formattedTime/__docs__/formattedTime.md +0 -4
  100. package/src/lightning/formattedUrl/__docs__/formattedUrl.md +0 -4
  101. package/src/lightning/helptext/helptext.css +7 -0
  102. package/src/lightning/helptext/helptext.js +3 -4
  103. package/src/lightning/icon/__docs__/icon.md +0 -4
  104. package/src/lightning/icon/icon.html +1 -1
  105. package/src/lightning/input/input.html +5 -0
  106. package/src/lightning/inputAddress/addressFormat.js +31 -4
  107. package/src/lightning/inputAddress/fieldsLayout.js +6 -0
  108. package/src/lightning/inputAddress/inputAddress.html +19 -1
  109. package/src/lightning/inputAddress/inputAddress.js +80 -3
  110. package/src/lightning/inputLocation/__docs__/inputLocation.md +0 -4
  111. package/src/lightning/internationalizationLibrary/address/AddressFormat.js +553 -610
  112. package/src/lightning/layout/__docs__/layout.md +0 -4
  113. package/src/lightning/layoutItem/__docs__/layoutItem.md +0 -4
  114. package/src/lightning/lookupAddress/lookupAddress.html +6 -1
  115. package/src/lightning/lookupAddress/lookupAddress.js +25 -0
  116. package/src/lightning/menuItem/__docs__/menuItem.md +0 -4
  117. package/src/lightning/menuSubheader/menu-subheader.slds.css +1 -1
  118. package/src/lightning/modal/__docs__/modal.md +10 -1
  119. package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +3 -7
  120. package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +39 -133
  121. package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +1 -1
  122. package/src/lightning/modal/modal.js +1 -1
  123. package/src/lightning/modalBase/modalBase.html +15 -10
  124. package/src/lightning/modalBase/modalBase.js +132 -147
  125. package/src/lightning/modalBody/modalBody.css +6 -0
  126. package/src/lightning/modalHeader/modalHeader.html +16 -4
  127. package/src/lightning/modalHeader/modalHeader.js +61 -14
  128. package/src/lightning/pill/__docs__/pill.md +0 -4
  129. package/src/lightning/pill/link.html +1 -0
  130. package/src/lightning/pill/plain.html +1 -0
  131. package/src/lightning/pill/plainLink.html +1 -0
  132. package/src/lightning/pillContainer/__docs__/pillContainer.md +0 -4
  133. package/src/lightning/primitiveBubble/primitiveBubble.js +42 -0
  134. package/src/lightning/primitiveDatatableCell/primitiveDatatableCell.js +1 -1
  135. package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -1
  136. package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +13 -0
  137. package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +19 -6
  138. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +3 -1
  139. package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.css +11 -0
  140. package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +2 -1
  141. package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +1 -0
  142. package/src/lightning/progressStep/base.html +5 -6
  143. package/src/lightning/progressStep/progressStep.js +14 -9
  144. package/src/lightning/prompt/__docs__/prompt.md +1 -1
  145. package/src/lightning/radioGroup/__docs__/radioGroup.md +0 -4
  146. package/src/lightning/relativeDateTime/__docs__/relativeDateTime.md +0 -4
  147. package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +0 -2
  148. package/src/lightning/sldsCommon/sldsCommon.css +134 -98
  149. package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +1 -1
  150. package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +14 -13
  151. package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +95 -92
  152. package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +1 -1
  153. package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +77 -75
  154. package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +73 -73
  155. package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +552 -558
  156. package/src/lightning/sldsUtilsVisibility/sldsUtilsVisibility.css +2 -2
  157. package/src/lightning/slider/__docs__/slider.md +0 -4
  158. package/src/lightning/spinner/__docs__/spinner.md +0 -4
  159. package/src/lightning/staticMap/staticMap.js +3 -2
  160. package/src/lightning/tab/__docs__/tab.md +0 -4
  161. package/src/lightning/tab/tab.js +6 -3
  162. package/src/lightning/tab/tab.js-meta.xml +3 -0
  163. package/src/lightning/tabBar/tabBar.js +10 -5
  164. package/src/lightning/tabset/__docs__/tabset.md +0 -4
  165. package/src/lightning/tabset/tabset.html +2 -0
  166. package/src/lightning/tabset/tabset.js-meta.xml +3 -0
  167. package/src/lightning/textarea/__docs__/textarea.md +0 -4
  168. package/src/lightning/textarea/textarea.js +6 -1
  169. package/src/lightning/tile/__docs__/tile.md +0 -4
  170. package/src/lightning/toastContainer/__docs__/toastContainer.md +3 -2
  171. package/src/lightning/tooltipLibrary/tooltipLibrary.js +24 -15
  172. package/src/lightning/tree/__docs__/tree.md +0 -4
  173. package/src/lightning/tree/tree.js +5 -1
  174. package/src/lightning/verticalNavigation/__docs__/verticalNavigation.md +0 -4
  175. package/src/lightning/verticalNavigation/vertical-navigation.slds.css +14 -0
  176. package/src/lightning/verticalNavigation/verticalNavigation.css +1 -1
  177. package/src/lightning/verticalNavigation/verticalNavigation.html +1 -1
  178. package/src/lightning/verticalNavigation/verticalNavigation.js +66 -28
  179. package/src/lightning/verticalNavigation/verticalNavigation.js-meta.xml +3 -0
  180. package/src/lightning/verticalNavigationItem/__docs__/verticalNavigationItem.md +0 -4
  181. package/src/lightning/verticalNavigationItem/vertical-navigation-item.slds.css +63 -0
  182. package/src/lightning/verticalNavigationItem/verticalNavigationItem.css +2 -3
  183. package/src/lightning/verticalNavigationItem/verticalNavigationItem.js +29 -15
  184. package/src/lightning/verticalNavigationItem/verticalNavigationItem.js-meta.xml +3 -0
  185. package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.native.css +2 -0
  186. package/src/lightning/verticalNavigationItem/verticalNavigationItem.lbc.synthetic.css +3 -0
  187. package/src/lightning/verticalNavigationItemBadge/__docs__/verticalNavigationItemBadge.md +0 -4
  188. package/src/lightning/verticalNavigationItemBadge/badge.slds.css +76 -0
  189. package/src/lightning/verticalNavigationItemBadge/vertical-navigation-item.slds.css +63 -0
  190. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.css +2 -3
  191. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.html +1 -1
  192. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js +28 -15
  193. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.js-meta.xml +3 -0
  194. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.native.css +5 -0
  195. package/src/lightning/verticalNavigationItemBadge/verticalNavigationItemBadge.lbc.synthetic.css +3 -0
  196. package/src/lightning/verticalNavigationItemIcon/__docs__/verticalNavigationItemIcon.md +0 -4
  197. package/src/lightning/verticalNavigationItemIcon/vertical-navigation-item.slds.css +63 -0
  198. package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.css +2 -3
  199. package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js +29 -15
  200. package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.js-meta.xml +3 -0
  201. package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.native.css +3 -0
  202. package/src/lightning/verticalNavigationItemIcon/verticalNavigationItemIcon.lbc.synthetic.css +3 -0
  203. package/src/lightning/verticalNavigationOverflow/button.slds.css +503 -0
  204. package/src/lightning/verticalNavigationOverflow/vertical-navigation-item.slds.css +63 -0
  205. package/src/lightning/verticalNavigationOverflow/vertical-navigation-section.slds.css +17 -0
  206. package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.css +2 -1
  207. package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.html +2 -0
  208. package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js +18 -13
  209. package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.js-meta.xml +3 -0
  210. package/src/lightning/verticalNavigationOverflow/verticalNavigationOverflow.lbc.native.css +5 -0
  211. package/src/lightning/verticalNavigationSection/vertical-navigation-section.slds.css +14 -14
  212. package/src/lightning/verticalNavigationSection/verticalNavigationSection.js-meta.xml +3 -0
  213. package/src/lightning/datatable/inlineEditShared.js +0 -26
  214. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.html +0 -0
  215. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatableWrapper/customDatatableWrapper.js +0 -0
  216. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.html +0 -0
  217. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeDeleteRowBtn/customDatatypeDeleteRowBtn.js +0 -0
  218. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.html +0 -0
  219. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeLink/customDatatypeLink.js +0 -0
  220. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.html +0 -0
  221. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeNumber/customDatatypeNumber.js +0 -0
  222. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.html +0 -0
  223. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeRowOrderingBtn/customDatatypeRowOrderingBtn.js +0 -0
  224. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customDatatypeTable.js +0 -0
  225. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customLink.html +0 -0
  226. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customName.html +0 -0
  227. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumber.html +0 -0
  228. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/customNumberEdit.html +0 -0
  229. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/deleteRow.html +0 -0
  230. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/iconPill.html +0 -0
  231. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customDatatypeTable/orderingButtons.html +0 -0
  232. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.html +0 -0
  233. /package/src/lightning/datatable/{__examples__ → __examples__disabled}/customNestedComponent/customNestedComponent.js +0 -0
@@ -1,39 +1,27 @@
1
- // Default empty error state
2
- const DEFAULT_ERROR_STATE = {
3
- rows: {},
4
- table: {},
5
- };
6
-
7
- /**
8
- * Retrieves the errors object from datatable's state object
9
- * Returns the set of row-level errors and table-level errors
10
- */
11
- export function getErrors(state) {
12
- return state.errors;
13
- }
14
-
15
1
  /**
16
- * Sets the row-level errors and table-level errors in datatable's state object
17
- * Errors being set here overwrite the previous error object in the state
18
- *
2
+ * Sets row-level and table-level errors in datatable state object.
3
+ * Errors being set here overwrite the previous error object in the state.
19
4
  *
20
5
  * @param {Object} state - The untracked datatable state
21
6
  */
22
7
  export function setErrors(state, errors) {
23
- return (state.errors = Object.assign({}, DEFAULT_ERROR_STATE, errors));
8
+ state.errors = Object.assign(
9
+ {
10
+ rows: {},
11
+ table: {},
12
+ },
13
+ errors
14
+ );
24
15
  }
25
16
 
26
17
  /**
27
- * Retrieves the row-level errors of a particular row from datatable's state object
28
- */
29
- export function getRowError(state, rowKey) {
30
- const { rows } = state.errors;
31
- return (rows && rows[rowKey]) || {};
32
- }
33
-
34
- /**
35
- * Retrieves the table-level errors from the datatable's state object
18
+ * Resets row-level and table-level errors in datatable state object.
19
+ *
20
+ * @param {Object} _state - The untracked datatable state
36
21
  */
37
- export function getTableError(state) {
38
- return state.errors.table || {};
22
+ export function resetErrors(state) {
23
+ state.errors = {
24
+ rows: {},
25
+ table: {},
26
+ };
39
27
  }
@@ -8,27 +8,18 @@ import { getColumnWidth, getTotalWidthsData } from './widthManagerShared';
8
8
  * @returns {Number} The expected width of the table
9
9
  */
10
10
  function getExpectedTableWidth(availableWidth, widthsData) {
11
- const minExpectedTableWidth = getMinExpectedTableWidth(widthsData);
12
- return widthsData.totalFlexibleColumns === 0
13
- ? minExpectedTableWidth
14
- : Math.max(minExpectedTableWidth, availableWidth);
15
- }
16
-
17
- /**
18
- * Determines the minimum expected table width
19
- *
20
- * @param {Object} widthsMetadata The widths metadata object
21
- * @returns {Number} The minimum expected table width
22
- */
23
- function getMinExpectedTableWidth(widthsMetadata) {
24
11
  const {
25
12
  totalFixedWidth,
26
13
  totalResizedWidth,
27
14
  totalFlexibleColumns,
28
15
  minColumnWidth,
29
- } = widthsMetadata;
16
+ } = widthsData;
30
17
  const minTotalFlexibleWidth = totalFlexibleColumns * minColumnWidth;
31
- return minTotalFlexibleWidth + totalFixedWidth + totalResizedWidth;
18
+ const minExpectedTableWidth =
19
+ minTotalFlexibleWidth + totalFixedWidth + totalResizedWidth;
20
+ return widthsData.totalFlexibleColumns === 0
21
+ ? minExpectedTableWidth
22
+ : Math.max(minExpectedTableWidth, availableWidth);
32
23
  }
33
24
 
34
25
  /**
@@ -37,14 +28,10 @@ function getMinExpectedTableWidth(widthsMetadata) {
37
28
  export class FixedWidthStrategy {
38
29
  widthsData = {};
39
30
 
40
- /************************** LIFECYCLE HOOKS **************************/
41
-
42
31
  constructor(minColumnWidth, maxColumnWidth) {
43
32
  this.widthsData = { minColumnWidth, maxColumnWidth };
44
33
  }
45
34
 
46
- /************************** PRIVATE SETTERS **************************/
47
-
48
35
  /**
49
36
  * Sets the minimum column width
50
37
  *
@@ -82,7 +69,6 @@ export class FixedWidthStrategy {
82
69
  totalWidthsData,
83
70
  expectedTableWidth
84
71
  );
85
-
86
72
  const columnWidths = [];
87
73
  for (let colIndex = 0; colIndex < _columns.length; colIndex += 1) {
88
74
  const width =
@@ -90,8 +76,7 @@ export class FixedWidthStrategy {
90
76
  expectedFlexibleColumnWidth;
91
77
  columnWidths[colIndex] = width;
92
78
  }
93
-
94
- return { columnWidths, expectedTableWidth };
79
+ return { columnWidths };
95
80
  }
96
81
 
97
82
  /**
@@ -1,6 +1,6 @@
1
1
  import { unwrap } from 'lwc';
2
- import { getUserColumnIndex, getColumns } from './columns';
3
- import { getActions, handleTriggeredAction } from './wrapText';
2
+ import { getUserColumnIndex } from './columns';
3
+ import { getInternalActions, handleTriggeredAction } from './wrapText';
4
4
 
5
5
  // Height of a clickable menu item
6
6
  const ACTION_REM_HEIGHT = 2.125;
@@ -10,32 +10,17 @@ const DIVIDER_REM_HEIGHT = 1.0625;
10
10
 
11
11
  /************************** PUBLIC METHODS ***************************/
12
12
 
13
- /**
14
- * Merges wrapText internal actions.
15
- * If there are new internal actions in the future, they may be added here.
16
- *
17
- * @param {Object} state The state of the datatable
18
- * @param {Object} columnDefinition The column definition to extract internal actions from
19
- * @returns {Array} All wrapText internal actions
20
- */
21
- export function getInternalActions(state, columnDefinition) {
22
- return [...getActions(state, columnDefinition)];
23
- }
24
-
25
13
  /**
26
14
  * Overrides the actions with the internal ones, plus the customer ones.
27
15
  *
28
16
  * @param {Object} state The state of the datatable
29
17
  */
30
- export function updateHeaderActions(state) {
31
- const columns = getColumns(state);
32
- for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
18
+ export function updateHeaderInternalActions(state) {
19
+ const { columns } = state;
20
+ const { length: colCount } = columns;
21
+ for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
33
22
  const col = columns[colIndex];
34
- col.actions = {
35
- menuAlignment: getMenuAlignment(columns, colIndex),
36
- customerActions: Array.isArray(col.actions) ? col.actions : [],
37
- internalActions: getInternalActions(state, col),
38
- };
23
+ col.actions.internalActions = getInternalActions(state, col);
39
24
  }
40
25
  }
41
26
 
@@ -51,7 +36,7 @@ export function handleHeaderActionTriggered(event) {
51
36
  const { action, actionType, colKeyValue } = event.detail;
52
37
 
53
38
  if (actionType !== 'customer') {
54
- handleTriggeredAction(this.state, action, colKeyValue);
39
+ handleTriggeredAction(this, action, colKeyValue);
55
40
  }
56
41
 
57
42
  dispatchHeaderActionEvent(this, action, colKeyValue);
@@ -105,18 +90,3 @@ function dispatchHeaderActionEvent(dt, action, colKeyValue) {
105
90
  })
106
91
  );
107
92
  }
108
-
109
- /**
110
- * Determines the menu alignment based on column placement.
111
- *
112
- * @param {Array} columns Array of all the columns
113
- * @param {Integer} index The current column index to check
114
- * @returns {String} The computed alignment
115
- */
116
- function getMenuAlignment(columns, index) {
117
- const isLastColumn = index === columns.length - 1;
118
-
119
- return isLastColumn || columns[index + 1].type === 'action'
120
- ? 'auto-right'
121
- : 'auto-left';
122
- }
@@ -0,0 +1,42 @@
1
+ import { generateColKeyValue } from './columns';
2
+
3
+ export const HEADER_ROW_INDEX = -1;
4
+ export const HEADER_ROW_KEY = 'HEADER';
5
+
6
+ export function getCellFromIndexes(state, rowIndex, colIndex) {
7
+ const { columns, rows } = state;
8
+ if (columns.length > 0) {
9
+ return {
10
+ rowKeyValue:
11
+ rowIndex === HEADER_ROW_INDEX
12
+ ? HEADER_ROW_KEY
13
+ : rows[rowIndex].key,
14
+ colKeyValue: generateColKeyValue(columns[colIndex], colIndex),
15
+ };
16
+ }
17
+ return undefined;
18
+ }
19
+
20
+ export function getRowIndexByKey(state, rowKeyValue) {
21
+ const row = state.indexes[rowKeyValue];
22
+ return row ? row.rowIndex : undefined;
23
+ }
24
+
25
+ export function getRowByKey(state, key) {
26
+ return state.rows[getRowIndexByKey(state, key)];
27
+ }
28
+
29
+ export function getUserRowByCellKeys(state, rowKeyValue, colKeyValue) {
30
+ const rowIndex = state.indexes[rowKeyValue][colKeyValue][0];
31
+ return state.data[rowIndex];
32
+ }
33
+
34
+ export function isValidCell(state, rowKeyValue, colKeyValue) {
35
+ if (rowKeyValue === HEADER_ROW_KEY) {
36
+ return state.headerIndexes[colKeyValue] !== undefined;
37
+ }
38
+ const row = getRowByKey(state, rowKeyValue);
39
+ const colIndex = state.headerIndexes[colKeyValue];
40
+
41
+ return row && row.cells[colIndex];
42
+ }
@@ -1,5 +1,9 @@
1
1
  import { normalizeBoolean } from 'lightning/utilsPrivate';
2
- import { getScrollOffsetFromTableEnd, isNonNegativeInteger } from './utils';
2
+ import {
3
+ getScrollOffsetFromTableEnd,
4
+ getScrollerY,
5
+ isNonNegativeInteger,
6
+ } from './utils';
3
7
 
4
8
  const SCROLL_ALLOWANCE = 2;
5
9
  export const DEFAULT_LOAD_MORE_OFFSET = 20;
@@ -7,17 +11,7 @@ export const DEFAULT_LOAD_MORE_OFFSET = 20;
7
11
  /*********************** STATE MANAGEMENT ************************/
8
12
 
9
13
  /**
10
- * Returns whether the datatable is in a loading state
11
- *
12
- * @param {Object} state The datatable state object
13
- * @returns {Boolean} The loading state
14
- */
15
- export function isLoading(state) {
16
- return state.isLoading;
17
- }
18
-
19
- /**
20
- * Sets the loading state of the datatable
14
+ * Sets the loading state of the datatable.
21
15
  *
22
16
  * @param {Object} state The datatable state object
23
17
  * @param {Boolean} value The loading state to set
@@ -27,17 +21,7 @@ export function setLoading(state, value) {
27
21
  }
28
22
 
29
23
  /**
30
- * Returns whether infinite loading is enabled on the datatable
31
- *
32
- * @param {Object} state The datatable state object
33
- * @returns {Boolean} The infinite loading state
34
- */
35
- export function isInfiniteLoadingEnabled(state) {
36
- return state.enableInfiniteLoading;
37
- }
38
-
39
- /**
40
- * Sets the infinite loading option on the datatable
24
+ * Sets the infinite loading option on the datatable.
41
25
  *
42
26
  * @param {Object} state The datatable state object
43
27
  * @param {Boolean} value The infinite loading state to set
@@ -79,7 +63,7 @@ export function setLoadMoreOffset(state, value) {
79
63
 
80
64
  /**
81
65
  * Checks whether the datatable should begin loading more content
82
- * and then dispatches the `loadmore` event indicating that directive.
66
+ * and then dispatches the 'loadmore' event indicating that directive.
83
67
  *
84
68
  * @param {Event} event
85
69
  */
@@ -104,25 +88,22 @@ export function handleLoadMoreCheck(event) {
104
88
  /**
105
89
  * Determines whether or not to prefetch data. If so,
106
90
  * dispatches the `loadmore` event.
107
- *
108
- * @param {Object} root The datatable
109
- * @param {Object} state The datatable state object
110
91
  */
111
- export function handlePrefetch(root, state) {
92
+ export function handlePrefetch() {
93
+ const { state, template } = this;
112
94
  if (
113
95
  state.isLoading ||
114
96
  !state.enableInfiniteLoading ||
115
97
  (this.viewportRendering &&
116
98
  this._renderManager &&
117
99
  !this._renderManager.hasWrapperHeight()) ||
118
- !hasData(root)
100
+ !hasData(template)
119
101
  ) {
120
- // Don't prefetch if already loading or data is not set yet
102
+ // Don't prefetch if already loading or data is not set yet.
121
103
  return;
122
104
  }
123
105
 
124
- const scrollerY = root.querySelector('.slds-scrollable_y');
125
-
106
+ const scrollerY = getScrollerY(template);
126
107
  if (scrollerY && isScrollerVisible(scrollerY) && !isScrollable(scrollerY)) {
127
108
  this.dispatchEvent(new CustomEvent('loadmore'));
128
109
  }
@@ -134,7 +115,7 @@ export function handlePrefetch(root, state) {
134
115
  * Determines if a scroller element is scrollable.
135
116
  *
136
117
  * @param {Element} scroller The scroller element to check
137
- * @returns {Boolean} Whether or not the element is scrollable
118
+ * @returns {Boolean} Whether the element is scrollable
138
119
  */
139
120
  function isScrollable(scroller) {
140
121
  // scrollHeight should be greater than clientHeight by some allowance
@@ -144,8 +125,8 @@ function isScrollable(scroller) {
144
125
  /**
145
126
  * Determines if a scroller element's scroll bars are visible.
146
127
  *
147
- * @param {Element} scroller The DOM element to check
148
- * @returns {Boolean} Whether or not the scroller element's scroll bars are visible
128
+ * @param {Element} scroller The scroller element to check
129
+ * @returns {Boolean} Whether the scroller element's scroll bars are visible
149
130
  */
150
131
  function isScrollerVisible(scroller) {
151
132
  return !!(