lightning-base-components 1.17.1-alpha → 1.17.3-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 (64) hide show
  1. package/metadata/raptor.json +32 -17
  2. package/package.json +15 -11
  3. package/scopedImports/@salesforce-label-AddressAutocomplete.LookupButton.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningDatatable.chooseARowSelectAll.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningLookup.noAccess.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningToast.close.js +1 -0
  7. package/src/lightning/accordionSection/accordionSection.html +2 -2
  8. package/src/lightning/accordionSection/accordionSection.js +21 -2
  9. package/src/lightning/baseCombobox/baseCombobox.html +1 -1
  10. package/src/lightning/baseCombobox/baseCombobox.js +56 -3
  11. package/src/lightning/baseCombobox/keyboard.js +26 -0
  12. package/src/lightning/breadcrumb/__docs__/breadcrumb.md +5 -6
  13. package/src/lightning/buttonGroup/buttonGroup.css +9 -0
  14. package/src/lightning/buttonGroup/buttonGroup.html +1 -1
  15. package/src/lightning/buttonStateful/buttonStateful.html +2 -1
  16. package/src/lightning/buttonStateful/buttonStateful.js +10 -0
  17. package/src/lightning/card/__docs__/card.md +2 -2
  18. package/src/lightning/card/card.html +3 -1
  19. package/src/lightning/card/card.js +51 -15
  20. package/src/lightning/card/utils.js +0 -14
  21. package/src/lightning/checkboxGroup/checkboxGroup.html +1 -1
  22. package/src/lightning/datatable/datatable.js +6 -15
  23. package/src/lightning/datatable/renderManager.js +14 -5
  24. package/src/lightning/datatable/rowSelection.js +4 -4
  25. package/src/lightning/datatable/rows.js +1 -0
  26. package/src/lightning/datatable/templates/div/div.html +4 -2
  27. package/src/lightning/datatable/templates/table/table.html +6 -2
  28. package/src/lightning/dialog/README.md +1 -1
  29. package/src/lightning/focusUtils/focus.js +42 -0
  30. package/src/lightning/focusUtils/focusUtils.js +1 -0
  31. package/src/lightning/formattedAddress/formattedAddress.js +1 -1
  32. package/src/lightning/input/__docs__/input.md +1 -1
  33. package/src/lightning/input/input.html +5 -2
  34. package/src/lightning/input/input.js +14 -2
  35. package/src/lightning/modal/__docs__/modal.md +187 -20
  36. package/src/lightning/modalBase/modalBase.js +7 -6
  37. package/src/lightning/positionLibrary/overlayDetector.js +10 -1
  38. package/src/lightning/primitiveBubble/primitiveBubble.css +9 -0
  39. package/src/lightning/primitiveBubble/primitiveBubble.js +3 -1
  40. package/src/lightning/primitiveCellActions/primitiveCellActions.html +1 -0
  41. package/src/lightning/primitiveCellActions/primitiveCellActions.js +1 -1
  42. package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +15 -1
  43. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +3 -1
  44. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +1 -0
  45. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +29 -0
  46. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -6
  47. package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.js +8 -3
  48. package/src/lightning/progressIndicator/progressIndicator.js +1 -1
  49. package/src/lightning/radioGroup/radioGroup.html +1 -1
  50. package/src/lightning/textarea/textarea.js +13 -1
  51. package/src/lightning/tooltipLibrary/tooltipLibrary.js +7 -0
  52. package/src/lightning/tree/tree.html +1 -1
  53. package/src/lightning/tree/tree.js +25 -1
  54. package/src/lightning/treeGrid/__docs__/treeGrid.md +15 -0
  55. package/src/lightning/treeGrid/treeGrid.js +25 -22
  56. package/src/lightning/utilsPrivate/ariaLevelHeadingUtils.js +11 -0
  57. package/src/lightning/utilsPrivate/normalize.js +22 -6
  58. package/src/lightning/utilsPrivate/os.js +36 -0
  59. package/src/lightning/utilsPrivate/utilsPrivate.js +7 -0
  60. package/src/lightning/verticalNavigationSection/verticalNavigationSection.html +1 -1
  61. package/src/lightning/verticalNavigationSection/verticalNavigationSection.js +22 -1
  62. package/scopedImports/@salesforce-label-LightningToast.missingToastLabel.js +0 -1
  63. package/scopedImports/@salesforce-label-LightningToastContainer.missingToastConfig.js +0 -1
  64. package/scopedImports/@salesforce-label-LightningToastContainer.missingToastProperty.js +0 -1
@@ -30,7 +30,7 @@
30
30
  </div>
31
31
 
32
32
  <template if:true={_helpMessage}>
33
- <div id="helptext" data-helptext class="slds-form-element__help">{_helpMessage}</div>
33
+ <div id="helptext" data-helptext role="alert" class="slds-form-element__help">{_helpMessage}</div>
34
34
  </template>
35
35
 
36
36
  </fieldset>
@@ -213,6 +213,7 @@ export default class LightningDatatable extends LightningElement {
213
213
  _renderMode = 'table';
214
214
  _shouldResetFocus = false; // used to ensure focus isn't lost from changes in renderedRows
215
215
  _suppressBottomBar = false;
216
+ _checkboxColumnHeaderId;
216
217
 
217
218
  /************************* PUBLIC PROPERTIES *************************/
218
219
 
@@ -864,27 +865,13 @@ export default class LightningDatatable extends LightningElement {
864
865
  return styleToString(styles);
865
866
  }
866
867
 
867
- /**
868
- * Private method to get datatable header element
869
- * used when getting checkboxColumnHeaderId for
870
- * aria-labelledby in checkbox column
871
- * @returns {(HTMLElement|null)}
872
- */
873
- get checkboxColumnHeaderElement() {
874
- return this.template.querySelector(
875
- 'lightning-primitive-header-factory'
876
- );
877
- }
878
-
879
868
  /**
880
869
  * Private method to get computedCheckboxColumnHeaderId
881
870
  * from checkboxColumnHeaderElement for
882
871
  * aria-labelledby in checkbox column
883
872
  */
884
873
  get computedCheckboxColumnHeaderId() {
885
- return this.checkboxColumnHeaderElement
886
- ? this.checkboxColumnHeaderElement.computedColumnHeaderId
887
- : '';
874
+ return this._checkboxColumnHeaderId;
888
875
  }
889
876
 
890
877
  get computedAriaLiveClassForNavMode() {
@@ -1344,6 +1331,10 @@ export default class LightningDatatable extends LightningElement {
1344
1331
  this.fireSortedColumnChange(fieldName, columnKey, sortDirection);
1345
1332
  }
1346
1333
 
1334
+ handleCheckboxHeaderId(event) {
1335
+ this._checkboxColumnHeaderId = event.detail;
1336
+ }
1337
+
1347
1338
  /**
1348
1339
  * Handles the `resizecol` event on lightning-datatable
1349
1340
  *
@@ -83,9 +83,11 @@ export class RenderManager {
83
83
  if (normalizeBoolean(viewportRendering) || state.virtualize) {
84
84
  this.initializeResizeObserver(state, getWrapperHeight);
85
85
  }
86
+ let computedBufferSize =
87
+ typeof bufferSize != 'undefined' ? bufferSize : DEFAULT_BUFFER_SIZE;
86
88
  state.bufferSize = normalizeNumberAttribute(
87
89
  'bufferSize',
88
- bufferSize || DEFAULT_BUFFER_SIZE,
90
+ computedBufferSize,
89
91
  'non-negative',
90
92
  DEFAULT_BUFFER_SIZE
91
93
  );
@@ -213,10 +215,17 @@ export class RenderManager {
213
215
  const normalizedRowCount = rowCount
214
216
  ? Math.min(rowCount, totalRows)
215
217
  : totalRows;
216
- state.renderedRowCount = normalizedRowCount;
217
-
218
- // Update our internal cache
219
- this.previousCache.renderedRowCount = normalizedRowCount;
218
+ if (isViewportRenderingEnabled(state)) {
219
+ if (state.renderedRowCount < normalizedRowCount) {
220
+ state.renderedRowCount = normalizedRowCount;
221
+ // Update our internal cache
222
+ this.previousCache.renderedRowCount = normalizedRowCount;
223
+ }
224
+ } else {
225
+ state.renderedRowCount = normalizedRowCount;
226
+ // Update our internal cache
227
+ this.previousCache.renderedRowCount = normalizedRowCount;
228
+ }
220
229
  this.previousCache.totalRowCount = totalRows;
221
230
 
222
231
  if (rows.length > 0) {
@@ -51,7 +51,7 @@ export function handleSelectAllRows(event) {
51
51
  event.stopPropagation();
52
52
  markAllRowsSelected(this.state);
53
53
  this.fireSelectedRowsChange(this.getSelectedRows(), {
54
- selection: ROWS_ACTION.SELECT_ALL_ROWS,
54
+ action: ROWS_ACTION.SELECT_ALL_ROWS,
55
55
  });
56
56
  }
57
57
 
@@ -64,7 +64,7 @@ export function handleDeselectAllRows(event) {
64
64
  event.stopPropagation();
65
65
  markAllRowsDeselected(this.state);
66
66
  this.fireSelectedRowsChange(this.getSelectedRows(), {
67
- selection: ROWS_ACTION.DESELECT_ALL_ROWS,
67
+ action: ROWS_ACTION.DESELECT_ALL_ROWS,
68
68
  });
69
69
  }
70
70
 
@@ -89,7 +89,7 @@ export function handleSelectRow(event) {
89
89
  markSelectedRowsInterval(this.state, fromRowKey, rowKeyValue);
90
90
  setLastRowSelection(this.state, rowKeyValue);
91
91
  this.fireSelectedRowsChange(this.getSelectedRows(), {
92
- selection: ROWS_ACTION.ROW_SELECT,
92
+ action: ROWS_ACTION.ROW_SELECT,
93
93
  value: rowKeyValue,
94
94
  });
95
95
  }
@@ -115,7 +115,7 @@ export function handleDeselectRow(event) {
115
115
  markDeselectedRowsInterval(this.state, fromRowKey, rowKeyValue);
116
116
  setLastRowSelection(this.state, rowKeyValue);
117
117
  this.fireSelectedRowsChange(this.getSelectedRows(), {
118
- selection: ROWS_ACTION.ROW_DESELECT,
118
+ action: ROWS_ACTION.ROW_DESELECT,
119
119
  value: rowKeyValue,
120
120
  });
121
121
  }
@@ -173,6 +173,7 @@ export function updateRowsAndCellIndexes() {
173
173
  : undefined,
174
174
  dataLabel: colData.label,
175
175
  value: computedCellValue, // value based on the fieldName
176
+ displayValue: rowData.displayValue ? rowData.displayValue : '',
176
177
  rowKeyValue: row.key, // unique row key value
177
178
  colKeyValue, // unique column key value
178
179
  tabIndex: -1, // tabindex
@@ -84,7 +84,8 @@
84
84
  sorted-direction={def.sortedDirection}
85
85
  column-width={def.columnWidth}
86
86
  show-checkbox={showSelectAllCheckbox}
87
- hide-header={hideTableHeader}>
87
+ hide-header={hideTableHeader}
88
+ onprivatecolumnheaderid={handleCheckboxHeaderId}>
88
89
  </lightning-primitive-header-factory>
89
90
  </template>
90
91
  <template if:false={def.fixedWidth}>
@@ -105,7 +106,8 @@
105
106
  column-width={def.columnWidth}
106
107
  resizable={hasResizebleColumns}
107
108
  resizestep={widthsData.resizeStep}
108
- hide-header={hideTableHeader}>
109
+ hide-header={hideTableHeader}
110
+ onprivatecolumnheaderid={handleCheckboxHeaderId}>
109
111
  </lightning-primitive-header-factory>
110
112
  </template>
111
113
  </div>
@@ -73,7 +73,8 @@
73
73
  sorted-direction={def.sortedDirection}
74
74
  column-width={def.columnWidth}
75
75
  show-checkbox={showSelectAllCheckbox}
76
- hide-header={hideTableHeader}>
76
+ hide-header={hideTableHeader}
77
+ onprivatecolumnheaderid={handleCheckboxHeaderId}>
77
78
  </lightning-primitive-header-factory>
78
79
  </template>
79
80
  <template if:false={def.fixedWidth}>
@@ -94,7 +95,8 @@
94
95
  column-width={def.columnWidth}
95
96
  resizable={hasResizebleColumns}
96
97
  resizestep={widthsData.resizeStep}
97
- hide-header={hideTableHeader}>
98
+ hide-header={hideTableHeader}
99
+ onprivatecolumnheaderid={handleCheckboxHeaderId}>
98
100
  </lightning-primitive-header-factory>
99
101
  </template>
100
102
  </th>
@@ -167,6 +169,7 @@
167
169
  row-key-value={row.key}
168
170
  col-key-value={cell.colKeyValue}
169
171
  value={cell.value}
172
+ display-value={cell.displayValue}
170
173
  icon-name={cell.iconName}
171
174
  icon-label={cell.iconLabel}
172
175
  icon-position={cell.iconPosition}
@@ -216,6 +219,7 @@
216
219
  row-key-value={row.key}
217
220
  col-key-value={cell.colKeyValue}
218
221
  value={cell.value}
222
+ display-value={cell.displayValue}
219
223
  icon-name={cell.iconName}
220
224
  icon-label={cell.iconLabel}
221
225
  icon-position={cell.iconPosition}
@@ -1,4 +1,4 @@
1
- # Dialog
1
+ # Dialog (Deprecated)
2
2
 
3
3
  ## Important:
4
4
  * **For any new modal work, starting in release 236, please use `lightning-modal`**
@@ -81,6 +81,48 @@ export function getElementWithFocus() {
81
81
  return undefined;
82
82
  }
83
83
 
84
+ /**
85
+ * Return the focus to an element if it is still attached to the DOM.
86
+ * @param {Element} element - element which will receive the focus.
87
+ * @returns {boolean} - true if the element is focused.
88
+ */
89
+ export function returnFocusToElement(element) {
90
+ const isSavedElemInDOM = document.body.contains(element);
91
+ if (element) {
92
+ if (isSavedElemInDOM) {
93
+ element.focus();
94
+ return true;
95
+ }
96
+ const isElementInDOM = isElementInDocument(element);
97
+ if (isElementInDOM) {
98
+ element.focus();
99
+ return true;
100
+ }
101
+ }
102
+ return false;
103
+ }
104
+
105
+ /**
106
+ * Return true if the given element is in document (rather it is in shadow or not)
107
+ * @param {Element} element - element to be inspected
108
+ * @returns {boolean} - true if the element is in document, otherwise false
109
+ */
110
+ function isElementInDocument(element) {
111
+ let currentElement = element;
112
+ // traverse all the way up to the document, to make sure
113
+ // the element is inside of the document.
114
+ while (currentElement && currentElement.parentNode) {
115
+ if (currentElement.parentNode === document) {
116
+ return true;
117
+ } else if (currentElement.parentNode instanceof DocumentFragment) {
118
+ currentElement = currentElement.parentNode.host;
119
+ } else {
120
+ currentElement = currentElement.parentNode;
121
+ }
122
+ }
123
+ return false;
124
+ }
125
+
84
126
  /**
85
127
  * Recursively traverse an active tree and run callback on each non-inert node element.
86
128
  *
@@ -3,4 +3,5 @@ export {
3
3
  findAllFocusableNodes,
4
4
  getElementWithFocus,
5
5
  filterTooltips,
6
+ returnFocusToElement,
6
7
  } from './focus';
@@ -220,7 +220,7 @@ export default class LightningFormattedAddress extends LightningElement {
220
220
  }
221
221
 
222
222
  get mapUrl() {
223
- return encodeURI(MAP_HOST + this.mapQuery);
223
+ return encodeURI(MAP_HOST) + encodeURIComponent(this.mapQuery);
224
224
  }
225
225
 
226
226
  get addressLink() {
@@ -336,7 +336,7 @@ When `multiple` is used, the email field expects a single email address or a com
336
336
 
337
337
  #### File
338
338
 
339
- An input field for selecting files to upload using an `Upload Files` button or a drag-and-drop zone.
339
+ An input field for selecting files to upload using an `Upload Files` button or a drag-and-drop zone. This field accepts files up to 3.5 MB.
340
340
 
341
341
  To retrieve the list of selected files, use
342
342
  `event.target.files` in the `onchange` event handler. Your selected files are returned in a `FileList` object, each specified as a `File` object with the `size` and `type` attributes.
@@ -75,6 +75,7 @@
75
75
  onblur={handleBlur}
76
76
  onfocus={handleFocus}
77
77
  onchange={handleChange}
78
+ onclick={handleCheckboxClick}
78
79
  name={name}
79
80
  required={required}
80
81
  readonly={readOnly}
@@ -105,7 +106,7 @@
105
106
  <abbr class="slds-required" title={i18n.required}>*</abbr>
106
107
  </template>
107
108
  </template>
108
- <input type="checkbox"
109
+ <input type="checkbox"
109
110
  part="checkbox"
110
111
  id="checkbox"
111
112
  aria-label={computedAriaLabel}
@@ -114,6 +115,7 @@
114
115
  onblur={handleBlur}
115
116
  onfocus={handleFocus}
116
117
  onchange={handleChange}
118
+ onclick={handleCheckboxClick}
117
119
  name={name}
118
120
  required={required}
119
121
  readonly={readOnly}
@@ -142,6 +144,7 @@
142
144
  onblur={handleBlur}
143
145
  onfocus={handleFocus}
144
146
  onchange={handleChange}
147
+ onclick={handleCheckboxClick}
145
148
  name={name}
146
149
  required={required}
147
150
  readonly={readOnly}
@@ -341,6 +344,6 @@
341
344
  </template>
342
345
 
343
346
  <template if:true={_helpMessage}>
344
- <div id="help-message" class="slds-form-element__help" data-help-message role="alert" part="help-text">{_helpMessage}</div>
347
+ <div id="help-message" class={computedHelpMessageClass} data-help-message role="alert" part="help-text">{_helpMessage}</div>
345
348
  </template>
346
349
  </template>
@@ -533,7 +533,7 @@ export default class LightningInput extends LightningElement {
533
533
  @api
534
534
  get ariaLabelledBy() {
535
535
  // native version returns the auto linked value
536
- if (this.isNative) {
536
+ if (this.isNative && this._rendered) {
537
537
  const ariaValues = this._inputElement.getAttribute(ARIA_LABELLEDBY);
538
538
  return filterNonAutoLink(ariaValues);
539
539
  }
@@ -574,7 +574,7 @@ export default class LightningInput extends LightningElement {
574
574
  }
575
575
 
576
576
  /**
577
- * A Boolean value for aria-invalid.
577
+ * A boolean value that controls whether accessibility tools read empty required textboxes as invalid. Default value is false.
578
578
  * @type {boolean}
579
579
  */
580
580
  @api
@@ -1306,6 +1306,12 @@ export default class LightningInput extends LightningElement {
1306
1306
  .toString();
1307
1307
  }
1308
1308
 
1309
+ get computedHelpMessageClass() {
1310
+ return classSet('slds-form-element__help')
1311
+ .add({ 'slds-m-left_none': this.variant !== VARIANT.LABEL_INLINE })
1312
+ .toString();
1313
+ }
1314
+
1309
1315
  get normalizedMax() {
1310
1316
  return this._normalizeDateTimeString(this.max);
1311
1317
  }
@@ -1750,6 +1756,12 @@ export default class LightningInput extends LightningElement {
1750
1756
  }
1751
1757
  }
1752
1758
 
1759
+ handleCheckboxClick() {
1760
+ if (this.template.activeElement === null) {
1761
+ this.template.querySelector("[type='checkbox']").focus();
1762
+ }
1763
+ }
1764
+
1753
1765
  handleChange(event) {
1754
1766
  event.stopPropagation();
1755
1767