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,41 +1,28 @@
1
1
  import {
2
2
  startPositioning,
3
3
  stopPositioning,
4
- Direction,
4
+ Direction as DIRECTION,
5
5
  } from 'lightning/positionLibrary';
6
6
  import {
7
7
  setFocusActiveCell,
8
8
  reactToTabBackward,
9
9
  reactToTabForward,
10
10
  getActiveCellElement,
11
- updateActiveCell,
12
11
  isActiveCellEditable,
12
+ NAVIGATION_DIR,
13
13
  isValidCell,
14
14
  } from './keyboard';
15
+ import { updateRowsAndCellIndexes, isCellEditable } from './rows';
16
+ import { getStateColumnIndex } from './columns';
17
+ import { resetErrors } from './errors';
18
+ import { setAriaSelectedOnCell, unsetAriaSelectedOnCell } from './rowSelection';
15
19
  import {
16
- updateRowsAndCellIndexes,
17
- getRowByKey,
18
- getKeyField,
19
- getUserRowByCellKeys,
20
- isCellEditable,
21
- } from './rows';
22
- import {
23
- getColumnIndexByColumnKey,
24
- getColumns,
25
- getStateColumnIndex,
26
- getEditableColumns,
27
- } from './columns';
28
- import { setErrors } from './errors';
29
- import {
30
- setAriaSelectedOnCell,
31
- unsetAriaSelectedOnCell,
32
- isSelectedRow,
33
20
  getCurrentSelectionLength,
34
21
  getSelectedRowsKeys,
35
- } from './rowSelection';
36
- import { isObjectLike } from './utils';
37
-
38
- export { getDirtyValueFromCell } from './inlineEditShared';
22
+ isSelectedRow,
23
+ } from './rowSelectionShared';
24
+ import { hasOwnProperties } from 'lightning/utilsPrivate';
25
+ import { getRowByKey, getUserRowByCellKeys } from './indexes';
39
26
 
40
27
  const IEDIT_PANEL_SELECTOR = '[data-iedit-panel="true"]';
41
28
  const HIDE_PANEL_THRESHOLD = 5; // hide panel on scroll
@@ -62,6 +49,8 @@ export function handleInlineEditFinish(event) {
62
49
  stopPanelPositioning(this);
63
50
  const { reason, rowKeyValue, colKeyValue } = event.detail;
64
51
  processInlineEditFinish(this, reason, rowKeyValue, colKeyValue);
52
+ // Set private draftValues var to new value
53
+ this._draftValues = this.draftValues;
65
54
  }
66
55
 
67
56
  /**
@@ -108,22 +97,22 @@ export function handleInlineEditPanelScroll(event) {
108
97
  let delta = 0;
109
98
  const { target: scroller } = event;
110
99
 
111
- // When user scrolls horizontally
112
- if (scroller.classList.contains('slds-scrollable_x')) {
113
- const scrollX = scroller.scrollLeft;
114
- if (this._lastScrollX == null) {
115
- this._lastScrollX = scrollX;
116
- } else {
117
- delta = Math.abs(this._lastScrollX - scrollX);
118
- }
119
- } else {
120
- // When user scrolls vertically
100
+ // When user scrolls vertically.
101
+ if (scroller.classList.contains('slds-scrollable_y')) {
121
102
  const scrollY = scroller.scrollTop;
122
103
  if (this._lastScrollY == null) {
123
104
  this._lastScrollY = scrollY;
124
105
  } else {
125
106
  delta = Math.abs(this._lastScrollY - scrollY);
126
107
  }
108
+ } else {
109
+ // When user scrolls horizontally.
110
+ const scrollX = scroller.scrollLeft;
111
+ if (this._lastScrollX == null) {
112
+ this._lastScrollX = scrollX;
113
+ } else {
114
+ delta = Math.abs(this._lastScrollX - scrollX);
115
+ }
127
116
  }
128
117
 
129
118
  // If user has scrolled past threshold,
@@ -148,14 +137,14 @@ export function handleInlineEditPanelScroll(event) {
148
137
  * Dispatches the `cellchange` event with the `draftValues` in the
149
138
  * detail object.
150
139
  *
151
- * @param {Object} dt - datatable instance
152
- * @param {Object} cellChange - object containing cell changes
140
+ * @param {Object} dt - The datatable instance
141
+ * @param {Object} changes - Object containing cell changes
153
142
  */
154
- function dispatchCellChangeEvent(dt, cellChange) {
143
+ function dispatchCellChangeEvent(dt, changes) {
155
144
  dt.dispatchEvent(
156
145
  new CustomEvent('cellchange', {
157
146
  detail: {
158
- draftValues: getResolvedCellChanges(dt.state, cellChange),
147
+ draftValues: getResolvedCellChanges(dt.state, changes),
159
148
  },
160
149
  })
161
150
  );
@@ -164,13 +153,15 @@ function dispatchCellChangeEvent(dt, cellChange) {
164
153
  /************************** INLINE EDIT STATE MANAGEMENT **************************/
165
154
 
166
155
  export function isInlineEditTriggered(state) {
167
- return Object.keys(state.inlineEdit.dirtyValues).length > 0;
156
+ return hasOwnProperties(state.inlineEdit.dirtyValues);
168
157
  }
169
158
 
170
159
  export function cancelInlineEdit(dt) {
171
- dt.state.inlineEdit.dirtyValues = {};
172
- setErrors(dt.state, {});
173
- updateRowsAndCellIndexes.call(dt);
160
+ const { state, _privateTypes } = dt;
161
+ resetErrors(state);
162
+ state.inlineEdit.dirtyValues = {};
163
+ dt._draftValues = [];
164
+ updateRowsAndCellIndexes(state, _privateTypes);
174
165
  }
175
166
 
176
167
  export function closeInlineEdit(dt) {
@@ -224,7 +215,7 @@ function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
224
215
  const shouldSaveData =
225
216
  isValidCell(state, rowKeyValue, colKeyValue) &&
226
217
  reason !== 'edit-canceled' &&
227
- !(inlineEditState.massEditEnabled && reason === 'lost-focus');
218
+ !(reason === 'lost-focus' && inlineEditState.massEditEnabled);
228
219
 
229
220
  if (shouldSaveData) {
230
221
  const panel = template.querySelector(IEDIT_PANEL_SELECTOR);
@@ -242,7 +233,6 @@ function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
242
233
  [colKeyValue]: editValue,
243
234
  },
244
235
  };
245
-
246
236
  if (updateAllSelectedRows) {
247
237
  const selectedRowsKeys = getSelectedRowsKeys(state);
248
238
  for (let i = 0; i < selectedRowsKeys.length; i += 1) {
@@ -257,17 +247,17 @@ function processInlineEditFinish(dt, reason, rowKeyValue, colKeyValue) {
257
247
  dispatchCellChangeEvent(dt, changes);
258
248
 
259
249
  // TODO: do we need to update all rows in the dt or just the one that was modified?
260
- updateRowsAndCellIndexes.call(dt);
250
+ updateRowsAndCellIndexes(state, dt._privateTypes);
261
251
  }
262
252
  }
263
253
 
264
254
  if (reason !== 'lost-focus') {
265
255
  if (reason === 'tab-pressed-next') {
266
- reactToTabForward(template, state);
256
+ reactToTabForward(state, template);
267
257
  } else if (reason === 'tab-pressed-prev') {
268
- reactToTabBackward(template, state);
258
+ reactToTabBackward(state, template);
269
259
  } else {
270
- setFocusActiveCell(template, state, 0);
260
+ setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
271
261
  }
272
262
  }
273
263
 
@@ -314,7 +304,7 @@ function openInlineEdit(dt, target) {
314
304
 
315
305
  const { rowKeyValue, colKeyValue } = target;
316
306
  const colIndex = getStateColumnIndex(state, colKeyValue);
317
- const col = getColumns(state)[colIndex];
307
+ const col = state.columns[colIndex];
318
308
 
319
309
  inlineEditState.isPanelVisible = true;
320
310
  inlineEditState.rowKeyValue = rowKeyValue;
@@ -328,8 +318,8 @@ function openInlineEdit(dt, target) {
328
318
 
329
319
  const { typeAttributes } = col || {};
330
320
  if (typeAttributes) {
331
- // Ehen the inline edit panel is opened resolve the typeAttributes if available
332
- // then assign the resolved values to inlineEdit.resolvedTypeAttributes
321
+ // When the inline edit panel is opened resolve the typeAttributes if available
322
+ // then assign the resolved values to inlineEdit.resolvedTypeAttributes.
333
323
  inlineEditState.resolvedTypeAttributes = resolveNestedTypeAttributes(
334
324
  state,
335
325
  rowKeyValue,
@@ -378,15 +368,14 @@ export function openInlineEditOnActiveCell(dt) {
378
368
  if (!isActiveCellEditable(state)) {
379
369
  const firstEditableCell = getFirstEditableCell(dt);
380
370
  if (firstEditableCell) {
381
- updateActiveCell(
382
- state,
383
- firstEditableCell.rowKeyValue,
384
- firstEditableCell.colKeyValue
385
- );
386
- setFocusAndOpenInlineEdit(dt, state.activeCell);
371
+ state.activeCell = {
372
+ rowKeyValue: firstEditableCell.rowKeyValue,
373
+ colKeyValue: firstEditableCell.colKeyValue,
374
+ };
375
+ setFocusAndOpenInlineEdit(dt);
387
376
  }
388
377
  } else {
389
- setFocusAndOpenInlineEdit(dt, state.activeCell);
378
+ setFocusAndOpenInlineEdit(dt);
390
379
  }
391
380
  }
392
381
  }
@@ -399,9 +388,9 @@ export function openInlineEditOnActiveCell(dt) {
399
388
  // eslint-disable-next-line @lwc/lwc/no-async-await
400
389
  async function setFocusAndOpenInlineEdit(dt) {
401
390
  const { state, template } = dt;
402
- await setFocusActiveCell(template, state, 0);
403
- const cell = getActiveCellElement(template, state);
404
- openInlineEdit(dt, cell);
391
+ await setFocusActiveCell(state, template, NAVIGATION_DIR.USE_CURRENT);
392
+ const cellElement = getActiveCellElement(template, state);
393
+ openInlineEdit(dt, cellElement);
405
394
  }
406
395
 
407
396
  /************************** PANEL POSITIONING **************************/
@@ -418,10 +407,10 @@ async function setFocusAndOpenInlineEdit(dt) {
418
407
  * - horizontal - Left -> align panel to left edge of cell
419
408
  * - vertical - Top -> align panel to top of the cell
420
409
  *
421
- * @param {Object} dt - datatable instance
422
- * @param {HTMLElement} target - cell on which inline edit should open
410
+ * @param {Object} dt - The datatable instance
411
+ * @param {HTMLElement} cellElement - The cell element on which inline edit should open
423
412
  */
424
- function startPanelPositioning(dt, target) {
413
+ function startPanelPositioning(dt, cellElement) {
425
414
  // eslint-disable-next-line @lwc/lwc/no-async-operation
426
415
  requestAnimationFrame(() => {
427
416
  // we need to discard previous binding otherwise the panel
@@ -429,19 +418,19 @@ function startPanelPositioning(dt, target) {
429
418
  stopPanelPositioning(dt);
430
419
 
431
420
  dt._positionRelationship = startPositioning(dt, {
432
- target,
421
+ target: cellElement,
433
422
  element() {
434
423
  const panel = dt.template.querySelector(IEDIT_PANEL_SELECTOR);
435
424
  return panel.getPositionedElement();
436
425
  },
437
426
  autoFlip: true,
438
427
  align: {
439
- horizontal: Direction.Left,
440
- vertical: Direction.Top,
428
+ horizontal: DIRECTION.Left,
429
+ vertical: DIRECTION.Top,
441
430
  },
442
431
  targetAlign: {
443
- horizontal: Direction.Left,
444
- vertical: Direction.Top,
432
+ horizontal: DIRECTION.Left,
433
+ vertical: DIRECTION.Top,
445
434
  },
446
435
  });
447
436
  });
@@ -474,7 +463,7 @@ function repositionPanel(dt) {
474
463
  /************************** DIRTY/UNSAVED VALUES **************************/
475
464
 
476
465
  /**
477
- * @param {Object} state - Datatable state object.
466
+ * @param {Object} state - The datatable state
478
467
  * @returns {Array} - An array of objects, each object describing the dirty values in the form { colName : dirtyValue }.
479
468
  * A special key is the { [keyField]: value } pair used to identify the row containing this changed values.
480
469
  * The returned array will be in the form - [{colName : dirtyValue, ... , [keyField]: value }, {...}, {...}]
@@ -486,18 +475,36 @@ export function getDirtyValues(state) {
486
475
  /**
487
476
  * Sets the dirty values in the datatable.
488
477
  *
489
- * @param {Object} state Datatable state object.
478
+ * @param {Object} state The datatable state
490
479
  * @param {Array} values An untracked array of objects, each object describing the dirty values in the form { colName : dirtyValue }.
491
480
  * A special key is the { [keyField]: value } pair used to identify the row containing this changed values.
492
481
  */
493
482
  export function setDirtyValues(state, values) {
494
- const keyField = getKeyField(state);
483
+ const { columns, keyField } = state;
495
484
  const dirtyValues = Array.isArray(values) ? values : [];
496
-
497
485
  const result = {};
498
486
  for (let dirtyIndex = 0; dirtyIndex < dirtyValues.length; dirtyIndex += 1) {
499
487
  const rowValues = dirtyValues[dirtyIndex];
500
- const colChanges = getCellChangesFromCustomer(state, rowValues);
488
+ const colKeys = Object.keys(rowValues);
489
+ const colChanges = {};
490
+ for (
491
+ let colKeysIndex = 0, { length: colKeysLength } = colKeys;
492
+ colKeysIndex < colKeysLength;
493
+ colKeysIndex += 1
494
+ ) {
495
+ const externalColKeyValue = colKeys[colKeysIndex];
496
+ for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
497
+ const col = columns[colIndex];
498
+ if (
499
+ col.columnKey === externalColKeyValue ||
500
+ (!col.columnKey && col.fieldName === externalColKeyValue)
501
+ ) {
502
+ colChanges[col.colKeyValue] =
503
+ rowValues[externalColKeyValue];
504
+ break;
505
+ }
506
+ }
507
+ }
501
508
  delete colChanges[keyField];
502
509
  result[rowValues[keyField]] = colChanges;
503
510
  }
@@ -505,9 +512,9 @@ export function setDirtyValues(state, values) {
505
512
  }
506
513
 
507
514
  /**
508
- * Updates the dirty values specified in rowColKeyValues
515
+ * Updates the dirty values specified in the `changes` object.
509
516
  *
510
- * @param {Object} state - state of the datatable
517
+ * @param {Object} state - The datatable state
511
518
  * @param {Object} changes - An object in the form of { rowKeyValue: { colKeyValue1: value, ..., colKeyValueN: value } ... }
512
519
  */
513
520
  function updateDirtyValues(state, changes) {
@@ -523,64 +530,6 @@ function updateDirtyValues(state, changes) {
523
530
  }
524
531
  }
525
532
 
526
- /**
527
- * Constructs and returns an object that contains the cell changes which can
528
- * be referenced by the column key value. It follows this format:
529
- * { <colKeyValue: "<editedValue>"> }; Ex. { "name-text-2": "My changes" }
530
- *
531
- * @param {Object} state - datatable's state object
532
- * @param {Object} rowValues - internal representation of changes in a row
533
- * @returns {Object} - changes in a column that can be referenced by the column key
534
- */
535
- function getCellChangesFromCustomer(state, rowValues) {
536
- const columns = getColumns(state);
537
- const colKeys = Object.keys(rowValues);
538
- const colChanges = {};
539
- for (
540
- let colKeysIndex = 0, { length: colKeysLength } = colKeys;
541
- colKeysIndex < colKeysLength;
542
- colKeysIndex += 1
543
- ) {
544
- const externalColKeyValue = colKeys[colKeysIndex];
545
- const colIndex = getColumnIndexByColumnKey(state, externalColKeyValue);
546
- if (colIndex >= 0) {
547
- const colKey = columns[colIndex].colKeyValue;
548
- colChanges[colKey] = rowValues[externalColKeyValue];
549
- }
550
- }
551
- return colChanges;
552
- }
553
-
554
- /**
555
- * Retrieves the changes in cells in a particular column
556
- * Returns an object where each item follows this format:
557
- * { <columnName>: "<changes>"} -> Ex. { name: "My changes" }
558
- *
559
- * @param {Object} state - Datatable state
560
- * @param {Object} colChanges - The internal representation of changes in a row
561
- * @returns {Object} - the list of customer changes in a column
562
- */
563
- function getCellChangesByColumn(state, colChanges) {
564
- const columns = getColumns(state);
565
- const changeColKeys = Object.keys(colChanges);
566
- const { length: changeColCount } = changeColKeys;
567
- const cellChanges = {};
568
- for (
569
- let changeColIndex = 0;
570
- changeColIndex < changeColCount;
571
- changeColIndex += 1
572
- ) {
573
- const colKeyValue = changeColKeys[changeColIndex];
574
- const colIndex = getStateColumnIndex(state, colKeyValue);
575
- if (colIndex !== -1) {
576
- const col = columns[colIndex];
577
- cellChanges[col.columnKey || col.fieldName] =
578
- colChanges[colKeyValue];
579
- }
580
- }
581
- return cellChanges;
582
- }
583
-
584
533
  /**
585
534
  * Constructs an array of resolved cell changes made via inline edit
586
535
  * Each array item consists of an identifier of the row and column in order to locate
@@ -590,13 +539,13 @@ function getCellChangesByColumn(state, colChanges) {
590
539
  * Ex. [{ name: "My changes", id: "2" }]; where column name is 'name' and 'id' is the keyField
591
540
  * The keyField can be used to identify the row.
592
541
  *
593
- * @param {Object} state - datatable state object
542
+ * @param {Object} state - The datatable state
594
543
  * @param {Object} rowChanges - list of cell changes to be resolved
595
544
  * @returns {Array} - array containing changes and identifiers of column and row where the changes
596
545
  * should be applied
597
546
  */
598
547
  function getResolvedCellChanges(state, rowChanges) {
599
- const keyField = getKeyField(state);
548
+ const { columns, keyField } = state;
600
549
  const result = [];
601
550
  const changeRowKeys = Object.keys(rowChanges);
602
551
  for (
@@ -606,12 +555,27 @@ function getResolvedCellChanges(state, rowChanges) {
606
555
  ) {
607
556
  const rowKeyValue = changeRowKeys[changeRowIndex];
608
557
  const colChanges = rowChanges[rowKeyValue];
609
-
610
- // Get the changes made by column
611
- const cellChanges = getCellChangesByColumn(state, colChanges);
612
- if (Object.keys(cellChanges).length > 0) {
613
- // Add identifier for which row has change
614
- cellChanges[keyField] = rowKeyValue;
558
+ const changeColKeys = Object.keys(colChanges);
559
+ const { length: changeColCount } = changeColKeys;
560
+ if (changeColCount) {
561
+ const cellChanges = {
562
+ // Add identifier for which row has change
563
+ [keyField]: rowKeyValue,
564
+ };
565
+ // Get the changes made by column
566
+ for (
567
+ let changeColIndex = 0;
568
+ changeColIndex < changeColCount;
569
+ changeColIndex += 1
570
+ ) {
571
+ const colKeyValue = changeColKeys[changeColIndex];
572
+ const colIndex = getStateColumnIndex(state, colKeyValue);
573
+ if (colIndex !== -1) {
574
+ const col = columns[colIndex];
575
+ cellChanges[col.columnKey || col.fieldName] =
576
+ colChanges[colKeyValue];
577
+ }
578
+ }
615
579
  result.push(cellChanges);
616
580
  }
617
581
  }
@@ -623,14 +587,14 @@ function getResolvedCellChanges(state, rowChanges) {
623
587
  /**
624
588
  * Returns the resolved typeAttributes
625
589
  *
626
- * @param {Object} state - state of the datatable
627
- * @param {String} rowKeyValue - row key
628
- * @param {String} colKeyValue - column key
629
- * @param {object} types - types
630
- * @param {object} typeAttributes - values of typeAttributes from column definition
631
- * @param {number} colIndex - The column index
590
+ * @param {Object} state - The datatable state
591
+ * @param {String} rowKeyValue - The row key
592
+ * @param {String} colKeyValue - The column key
593
+ * @param {Object} types - The type handling factory
594
+ * @param {Object} typeAttributes - values of typeAttributes from column definition
595
+ * @param {Number} colIndex - The column index
632
596
  *
633
- * @returns {Object} the resolved typeAttributes.
597
+ * @returns {Object} The resolved typeAttributes.
634
598
  */
635
599
  export function resolveNestedTypeAttributes(
636
600
  state,
@@ -649,7 +613,7 @@ export function resolveNestedTypeAttributes(
649
613
  const { length: attributeNamesLength } = attributeNames;
650
614
  const _rowData = getUserRowByCellKeys(state, rowKeyValue, colKeyValue);
651
615
  // We only want to resolve typeAttributes based on the custom types configuration
652
- // If the attribute is not in that configuration, the value of typeAttributesValues
616
+ // If the attribute is not in that configuration, the value of attrValue
653
617
  // for that will be undefined. This behavior is consistent with view cell.
654
618
  for (let i = 0; i < attributeNamesLength; i += 1) {
655
619
  const attrName = attributeNames[i];
@@ -665,7 +629,7 @@ export function resolveNestedTypeAttributes(
665
629
  }
666
630
 
667
631
  /**
668
- * Helper function to recursively traverse and resolve the nested typeAttributesValues object.
632
+ * Helper function to recursively traverse and resolve the nested attrValue object.
669
633
  * For example, resolve {
670
634
  * editTypeAttributes: {
671
635
  * value: {
@@ -682,7 +646,7 @@ export function resolveNestedTypeAttributes(
682
646
  */
683
647
  function resolveNestedTypeAttributesHelper(rowData, attrValue) {
684
648
  let resolvedTypeAttributes = {};
685
- if (!isObjectLike(attrValue)) {
649
+ if (!(typeof attrValue === 'object' && attrValue !== null)) {
686
650
  // Primitive value.
687
651
  // For example, if the typeAttributes is { count: 5},
688
652
  // 5 will be the attrValue passed in to the function.
@@ -702,7 +666,7 @@ function resolveNestedTypeAttributesHelper(rowData, attrValue) {
702
666
  // so we need to check if key is 'fieldName' or not and resolve it immediately.
703
667
  if (name === 'fieldName') {
704
668
  resolvedTypeAttributes = rowData[value];
705
- } else if (isObjectLike(value)) {
669
+ } else if (typeof value === 'object' && value !== null) {
706
670
  // This is the case when attrValue is something like {label: {fieldName: 'name'}}.
707
671
  // It's an object but the value maps a field name
708
672
  const { fieldName } = value;
@@ -734,8 +698,14 @@ function resolveNestedTypeAttributesHelper(rowData, attrValue) {
734
698
  */
735
699
  function getFirstEditableCell(dt) {
736
700
  const { state } = dt;
737
- const columns = getColumns(dt.state);
738
- const editableColumns = getEditableColumns(columns);
701
+ const { columns } = state;
702
+ const editableColumns = [];
703
+ for (let i = 0, { length } = columns; i < length; i += 1) {
704
+ const col = columns[i];
705
+ if (col.editable) {
706
+ editableColumns.push(col);
707
+ }
708
+ }
739
709
  const { length: editableColumnsLength } = editableColumns;
740
710
  if (editableColumnsLength > 0) {
741
711
  const { rows } = state;
@@ -783,7 +753,7 @@ function getCellValue(state, rowKeyValue, colKeyValue) {
783
753
  */
784
754
  function setAriaSelectedOnAllSelectedRows(state) {
785
755
  const { colKeyValue } = state.inlineEdit;
786
- const selectedRowsKeys = getSelectedRowsKeys(state);
756
+ const { selectedRowsKeys } = state;
787
757
  const keys = Object.keys(selectedRowsKeys);
788
758
  for (let i = 0, { length } = keys; i < length; i += 1) {
789
759
  const rowKeyValue = keys[i];
@@ -801,7 +771,7 @@ function setAriaSelectedOnAllSelectedRows(state) {
801
771
  */
802
772
  function unsetAriaSelectedOnAllSelectedRows(state) {
803
773
  const { colKeyValue } = state.inlineEdit;
804
- const selectedRowsKeys = getSelectedRowsKeys(state);
774
+ const { selectedRowsKeys } = state;
805
775
  const keys = Object.keys(selectedRowsKeys);
806
776
  for (let i = 0, { length } = keys; i < length; i += 1) {
807
777
  const rowKeyValue = keys[i];