lightning-base-components 1.13.9-alpha → 1.14.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 (83) hide show
  1. package/metadata/raptor.json +1 -0
  2. package/package.json +21 -1
  3. package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
  4. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsPlural.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningDualListbox.movedOptionsSingular.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningErrorMessage.validitySelectAtleastOne.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningMap.titleWithAddress.js +1 -0
  9. package/src/lightning/ariaObserver/__component__/ariaObserver.spec.js +103 -0
  10. package/src/lightning/ariaObserver/__docs__/ariaObserver.md +142 -0
  11. package/src/lightning/{utilsPrivate/contentMutation.js → ariaObserver/ariaObserver.js} +51 -78
  12. package/src/lightning/baseCombobox/baseCombobox.html +1 -0
  13. package/src/lightning/baseCombobox/baseCombobox.js +14 -1
  14. package/src/lightning/buttonMenu/keyboard.js +0 -10
  15. package/src/lightning/card/card.html +6 -0
  16. package/src/lightning/checkboxGroup/checkboxGroup.html +2 -2
  17. package/src/lightning/checkboxGroup/checkboxGroup.js +6 -1
  18. package/src/lightning/colorPickerCustom/colorPickerCustom.js +20 -1
  19. package/src/lightning/combobox/combobox.css +12 -0
  20. package/src/lightning/combobox/combobox.html +1 -0
  21. package/src/lightning/datatable/__docs__/datatable.md +55 -0
  22. package/src/lightning/datatable/__examples__/basic/basic.html +1 -1
  23. package/src/lightning/datatable/columnWidthManager.js +7 -3
  24. package/src/lightning/datatable/columns-shared.js +1 -1
  25. package/src/lightning/datatable/datatable.js +122 -40
  26. package/src/lightning/datatable/errors.js +20 -9
  27. package/src/lightning/datatable/headerActions.js +77 -49
  28. package/src/lightning/datatable/inlineEdit.js +520 -373
  29. package/src/lightning/datatable/inlineEditShared.js +24 -0
  30. package/src/lightning/datatable/keyboard.js +1077 -933
  31. package/src/lightning/datatable/renderManager.js +241 -129
  32. package/src/lightning/datatable/resizer.js +91 -108
  33. package/src/lightning/datatable/rowLevelActions.js +17 -13
  34. package/src/lightning/datatable/rowNumber.js +54 -20
  35. package/src/lightning/datatable/rowSelection.js +760 -0
  36. package/src/lightning/datatable/rowSelectionShared.js +79 -0
  37. package/src/lightning/datatable/rows.js +16 -5
  38. package/src/lightning/datatable/state.js +10 -10
  39. package/src/lightning/datatable/templates/div/div.css +23 -0
  40. package/src/lightning/datatable/templates/div/div.html +6 -5
  41. package/src/lightning/datatable/templates/table/table.html +4 -4
  42. package/src/lightning/datatable/utils.js +14 -0
  43. package/src/lightning/datatable/widthManagerShared.js +1 -1
  44. package/src/lightning/dualListbox/dualListbox.html +1 -1
  45. package/src/lightning/dualListbox/dualListbox.js +42 -0
  46. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +2 -1
  47. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_alt.html +1 -2
  48. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
  49. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +2 -1
  50. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_alt.html +1 -2
  51. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
  52. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +2 -1
  53. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_alt.html +1 -2
  54. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
  55. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +2 -1
  56. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_alt.html +1 -2
  57. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
  58. package/src/lightning/input/input.html +0 -1
  59. package/src/lightning/input/input.js +69 -48
  60. package/src/lightning/inputUtils/validity.js +12 -1
  61. package/src/lightning/pillContainer/__docs__/pillContainer.md +45 -1
  62. package/src/lightning/primitiveCellActions/primitiveCellActions.js +69 -12
  63. package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +13 -11
  64. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +13 -8
  65. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +17 -14
  66. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +169 -80
  67. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +97 -62
  68. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +4 -4
  69. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +4 -4
  70. package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +99 -37
  71. package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +5 -4
  72. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +46 -46
  73. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
  74. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
  75. package/src/lightning/progressIndicator/progressIndicator.js +4 -6
  76. package/src/lightning/progressStep/progressStep.js +31 -22
  77. package/src/lightning/staticMap/staticMap.html +1 -0
  78. package/src/lightning/staticMap/staticMap.js +39 -2
  79. package/src/lightning/utils/classSet.js +4 -1
  80. package/src/lightning/utilsPrivate/utilsPrivate.js +12 -1
  81. package/src/lightning/datatable/inlineEdit-shared.js +0 -14
  82. package/src/lightning/datatable/selector-shared.js +0 -38
  83. package/src/lightning/datatable/selector.js +0 -527
@@ -14,6 +14,7 @@ selections when filtering a list, such as from a multi-select picklist.
14
14
  To specify the pills, set the `items` attribute to an array of values in your component's JavaScript.
15
15
 
16
16
  By default, all pills in the container are displayed and wrap to additional lines if they can't fit on one line.
17
+ For information about changing the behavior, see **Managing Pill Layout in the Container**.
17
18
 
18
19
  This example creates three pills: a text-only pill, a pill with an avatar, and
19
20
  a pill with an icon.
@@ -70,7 +71,7 @@ To create a pill with an avatar, use the following attributes.
70
71
  To create a pill with an icon, use the following attributes.
71
72
 
72
73
  - `type`: The media type. Use `icon`.
73
- - `iconName`: Required. The Lightning Design System name of the icon. Names are written in the format '\utility:down\' where 'utility' is the category, and 'down' is the specific icon to be displayed. Only utility icons can be used in this component.
74
+ - `iconName`: Required. The Lightning Design System name of the icon. Names are written in the format 'utility:down' where 'utility' is the category, and 'down' is the specific icon to be displayed. Only utility icons can be used for the `iconName`.
74
75
  - `alternativeText`: The alternative text used to describe the icon. Describe what happens when you click the button, for example 'Upload File', not what the icon looks like, 'Paperclip'.
75
76
 
76
77
  `lightning-pill-container` provides two variants: `bare` and `standard` (default). They are visually the same. However, the `standard` variant renders pills in an unordered list element. For more information, see the **Accessibility** section.
@@ -135,9 +136,12 @@ set to false by default, which makes all pills display and wrap to multiple line
135
136
  - `single-line`: Specifies that the pill container can display one line of pills. By default, if pills can't fit on one line, they are wrapped to additional lines to fit the container. Set `single-line` to true to limit pill display to one line. This attribute overrides `is-collapsible` and `is-expanded`.
136
137
 
137
138
  If all pills aren't displayed, the component shows a text button indicating how many more pills there are.
139
+ For example, if there are five more pills that aren’t displayed, the text button shows `+5 more`. The text button fires the `focus` event when you click it.
138
140
 
139
141
  To display a long list of pills as collapsed, set `is-collapsible` to true and optionally set `is-expanded` to false. Otherwise, pills are displayed expanded.
140
142
 
143
+ ##### Expand and Collapse Pills Programmatically
144
+
141
145
  Use `is-collapsible` and `is-expanded` to programmatically expand and collapse the pills.
142
146
 
143
147
  This example sets `is-collapsible` and uses a button to change the value of `is-expanded`.
@@ -175,6 +179,46 @@ export default class PillContainerCanCollapse extends LightningElement {
175
179
  ];
176
180
  }
177
181
  ```
182
+ ##### Display All Pills With the `+n more` Button
183
+
184
+ If all pills aren't displayed, the component shows a text button labeled `+n more` to indicate more pills can be displayed. By default, `lightning-pill-container` doesn’t handle the `focus` event that’s fired when you click the button. You can handle the event to display more pills or write logic to do something else when the button is clicked.
185
+
186
+ This example sets the pills to be collapsible but not expanded and handles the focus event.
187
+
188
+ ```html
189
+ <template>
190
+ <div style="width: 600px">
191
+ <lightning-pill-container
192
+ items={items}
193
+ is-collapsible={collapsible}
194
+ is-expanded={expanded}
195
+ onfocus={handlePillExpansion}
196
+ >
197
+ </lightning-pill-container>
198
+ </div>
199
+ </template>
200
+ ```
201
+
202
+ The list of pills is initially collapsed. When there are too many pills to be displayed, the text button labeled `+n more` displays. The handler for the `focus` event enables all the pills to display.
203
+
204
+ ```javascript
205
+ import { LightningElement } from 'lwc';
206
+
207
+ export default class PillContainerMoreButtonExpands extends LightningElement {
208
+ collapsible = true;
209
+ expanded = false;
210
+
211
+ handlePillExpansion(){
212
+ this.expanded = true;
213
+ }
214
+
215
+ items = [
216
+ {
217
+ //define the pills
218
+ }
219
+ ];
220
+ }
221
+ ```
178
222
 
179
223
  #### Component Styling
180
224
 
@@ -21,28 +21,33 @@ const i18n = {
21
21
  showActions: labelShowActions,
22
22
  };
23
23
 
24
+ /**
25
+ * A cell-level action.
26
+ */
24
27
  export default class PrimitiveCellActions extends LightningElement {
25
- static delegatesFocus = true;
26
-
27
- @api rowKeyValue;
28
- @api colKeyValue;
29
- @api rowActions;
30
-
28
+ // Tracked objects
31
29
  @track containerRect;
32
30
  @track _actions = [];
33
31
 
32
+ // Private variables
33
+ static delegatesFocus = true;
34
34
  _isLoadingActions;
35
35
  _menuAlignment = DEFAULT_MENU_ALIGNMENT;
36
36
  _internalTabIndex = false;
37
37
 
38
- connectedCallback() {
39
- this._connected = true;
40
- }
38
+ /************************** PUBLIC ATTRIBUTES ***************************/
41
39
 
42
- disconnectedCallback() {
43
- this._connected = false;
44
- }
40
+ @api rowKeyValue;
41
+ @api colKeyValue;
42
+ @api rowActions;
45
43
 
44
+ /**
45
+ * Defines the current menu alignment
46
+ * See `VALID_MENU_ALIGNMENT` for valid menu alignment values
47
+ * See `DEFAULT_MENU_ALIGNMENT` for the default menu alignment
48
+ *
49
+ * @type {string}
50
+ */
46
51
  @api
47
52
  get menuAlignment() {
48
53
  return this._menuAlignment;
@@ -55,6 +60,11 @@ export default class PrimitiveCellActions extends LightningElement {
55
60
  });
56
61
  }
57
62
 
63
+ /************************** PUBLIC METHODS ***************************/
64
+
65
+ /**
66
+ * Sets focus on a lightning-button-menu
67
+ */
58
68
  @api
59
69
  focus() {
60
70
  if (this._connected) {
@@ -62,6 +72,9 @@ export default class PrimitiveCellActions extends LightningElement {
62
72
  }
63
73
  }
64
74
 
75
+ /**
76
+ * Clicks a lightning-button-menu
77
+ */
65
78
  @api
66
79
  click() {
67
80
  if (this._connected) {
@@ -73,18 +86,42 @@ export default class PrimitiveCellActions extends LightningElement {
73
86
  }
74
87
  }
75
88
 
89
+ /************************** PRIVATE GETTERS **************************/
90
+
91
+ /**
92
+ * Returns the computed menu alignment value
93
+ *
94
+ * @return {string} Current computed menu alignment
95
+ */
76
96
  get computedMenuAlignment() {
77
97
  return this.menuAlignment;
78
98
  }
79
99
 
100
+ /**
101
+ * Returns the button alternative text in the appropriate language
102
+ *
103
+ * @return {string} Language-specific button alternative text
104
+ */
80
105
  get buttonAlternateText() {
81
106
  return `${i18n.showActions}`;
82
107
  }
83
108
 
109
+ /**
110
+ * Returns the spinner alternative text in the appropriate language
111
+ *
112
+ * @return {string} Language-specific spinner alternative text
113
+ */
84
114
  get spinnerAlternateText() {
85
115
  return `${i18n.loadingActions}`;
86
116
  }
87
117
 
118
+ /************************ EVENT DISPATCHERS **************************/
119
+
120
+ /**
121
+ * Handles selecting an action
122
+ *
123
+ * @param {Event} event
124
+ */
88
125
  handleActionSelect(event) {
89
126
  this.dispatchEvent(
90
127
  new CustomEvent('privatecellactiontriggered', {
@@ -100,6 +137,9 @@ export default class PrimitiveCellActions extends LightningElement {
100
137
  );
101
138
  }
102
139
 
140
+ /**
141
+ * Handles the opening of an action menu
142
+ */
103
143
  handleMenuOpen() {
104
144
  this.elementRect = this.template
105
145
  .querySelector('lightning-button-menu')
@@ -135,6 +175,23 @@ export default class PrimitiveCellActions extends LightningElement {
135
175
  }
136
176
  }
137
177
 
178
+ /************************** LIFECYCLE HOOKS **************************/
179
+
180
+ connectedCallback() {
181
+ this._connected = true;
182
+ }
183
+
184
+ disconnectedCallback() {
185
+ this._connected = false;
186
+ }
187
+
188
+ /************************* HELPER FUNCTIONS **************************/
189
+
190
+ /**
191
+ * Resets loading state when all actions have been loaded
192
+ *
193
+ * @param {object} actions - Actions displayed in the menu
194
+ */
138
195
  finishLoadingActions(actions) {
139
196
  this._isLoadingActions = false;
140
197
  this._actions = actions;
@@ -215,18 +215,20 @@
215
215
 
216
216
  <!-- row number -->
217
217
  <template if:true={isRowNumber}>
218
- <lightning-primitive-datatable-tooltip data-navigation="enable"
219
- data-action-triggers="enter,space"
220
- class={rowNumberErrorClass}
221
- size="xx-small"
222
- header={typeAttribute0.title}
223
- content={typeAttribute0.messages}
224
- variant='error'
225
- internal-tab-index={internalTabIndex}
226
- alternative-text={typeAttribute0.alternativeText}>
218
+ <template if:true={_rowHasError}>
219
+ <lightning-primitive-datatable-tooltip data-navigation="enable"
220
+ data-action-triggers="enter,space"
221
+ class="slds-m-horizontal_xxx-small"
222
+ size="xx-small"
223
+ header={typeAttribute0.title}
224
+ content={typeAttribute0.messages}
225
+ variant='error'
226
+ internal-tab-index={internalTabIndex}
227
+ alternative-text={typeAttribute0.alternativeText}>
227
228
 
228
- </lightning-primitive-datatable-tooltip>
229
- <span class="slds-row-number slds-text-body_small slds-text-color_weak"></span>
229
+ </lightning-primitive-datatable-tooltip>
230
+ </template>
231
+ <span class="slds-row-number slds-text-body_small slds-text-color_weak" style={computedRowNumberStyle}></span>
230
232
  </template>
231
233
 
232
234
  <!-- text -->
@@ -8,6 +8,9 @@ import labelEditHasError from '@salesforce/label/LightningDatatable.editHasError
8
8
  import labelTrue from '@salesforce/label/LightningDatatable.true';
9
9
  import labelFalse from '@salesforce/label/LightningDatatable.false';
10
10
 
11
+ // Same constant (TOOLTIP_ALLOWANCE) as used in lightning/datatable/rowNumber.js
12
+ // If making change to this, make sure to modify in rowNumber.js as well
13
+ const TOOLTIP_ALLOWANCE = 20;
11
14
  const i18n = {
12
15
  edit: labelEdit,
13
16
  editHasError: labelEditHasError,
@@ -58,6 +61,7 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
58
61
  @api wrapTextMaxLines;
59
62
 
60
63
  _wrapText = false;
64
+ _rowHasError = false;
61
65
 
62
66
  @api
63
67
  get wrapText() {
@@ -153,7 +157,13 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
153
157
  }
154
158
 
155
159
  get isRowNumber() {
156
- return this.isType('rowNumber');
160
+ if (this.isType('rowNumber')) {
161
+ const error = this.typeAttribute0;
162
+ this._rowHasError = error && error.title && error.messages;
163
+ return true;
164
+ }
165
+
166
+ return false;
157
167
  }
158
168
 
159
169
  get isAction() {
@@ -285,13 +295,8 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
285
295
  .toString();
286
296
  }
287
297
 
288
- get rowNumberErrorClass() {
289
- const classes = classSet('slds-m-horizontal_xxx-small');
290
- const error = this.typeAttribute0;
291
- if (error) {
292
- classes.add({ 'slds-hidden': !error.title && !error.messages });
293
- }
294
- return classes.toString();
298
+ get computedRowNumberStyle() {
299
+ return this._rowHasError ? '' : `padding-left: ${TOOLTIP_ALLOWANCE}px;`;
295
300
  }
296
301
 
297
302
  get editIconAssistiveText() {
@@ -3,19 +3,21 @@
3
3
  if:true={visible}
4
4
  class="slds-popover slds-popover_edit"
5
5
  role="dialog"
6
+ aria-label={dialogAriaLabel}
6
7
  tabindex="-1"
7
8
  onblur={handleTypeElemBlur}
8
9
  onfocus={handleTypeElemFocus}
9
10
  onkeydown={handleCellKeydown}
10
- style={computedStyle}
11
- >
11
+ style={computedStyle}>
12
+
12
13
  <span class="inline-edit-form-start" tabindex="0" onfocus={handleFormStartFocus}></span>
13
14
  <div class="slds-popover__body">
14
15
  <form onsubmit={handleEditFormSubmit} novalidate>
16
+ <!-- Renders the required indicator -->
15
17
  <lightning-primitive-datatable-iedit-input-wrapper
16
18
  required={required}
17
- class="slds-grid slds-p-left_xx-small"
18
- >
19
+ class="slds-grid slds-p-left_xx-small">
20
+ <!-- Renders the appropriate input type in the inline edit panel -->
19
21
  <lightning-primitive-datatable-iedit-type-factory
20
22
  required={required}
21
23
  class="dt-type-edit-factory slds-col"
@@ -24,10 +26,11 @@
24
26
  edited-value={editedValue}
25
27
  onblur={handleTypeElemBlur}
26
28
  onfocus={handleTypeElemFocus}
27
- key={inputKey}
28
- ></lightning-primitive-datatable-iedit-type-factory>
29
+ key={inputKey}>
30
+ </lightning-primitive-datatable-iedit-type-factory>
29
31
  </lightning-primitive-datatable-iedit-input-wrapper>
30
32
  <template if:true={isMassEditEnabled}>
33
+ <!-- Checkbox to select in order to mass edit multiple rows -->
31
34
  <lightning-input
32
35
  data-mass-selection="true"
33
36
  type="checkbox"
@@ -35,32 +38,32 @@
35
38
  label={massEditCheckboxLabel}
36
39
  onchange={handleMassCheckboxChange}
37
40
  onblur={handleTypeElemBlur}
38
- onfocus={handleTypeElemFocus}
39
- ></lightning-input>
41
+ onfocus={handleTypeElemFocus}>
42
+ </lightning-input>
40
43
  </template>
41
44
  <template if:false={isMassEditEnabled}>
42
45
  <button type="submit" aria-hidden="true" tabindex="-1" class="slds-hide" value="save"></button>
43
46
  </template>
44
47
  </form>
45
48
  </div>
49
+ <!-- If in mass edit mode, render 'Cancel' and 'Apply' buttons -->
46
50
  <template if:true={isMassEditEnabled}>
47
51
  <div class="slds-popover__footer">
48
52
  <div class="slds-grid slds-grid_align-end">
49
53
  <lightning-button
50
- label={cancelLabel}
54
+ label={i18n.cancel}
51
55
  onblur={handleTypeElemBlur}
52
56
  onfocus={handleTypeElemFocus}
53
- onclick={cancelEdition}
54
- ></lightning-button>
57
+ onclick={cancelEditing}>
58
+ </lightning-button>
55
59
  <lightning-button
56
- label={applyLabel}
60
+ label={i18n.apply}
57
61
  style="margin-left: .25rem"
58
62
  variant="brand"
59
63
  onblur={handleTypeElemBlur}
60
64
  onfocus={handleTypeElemFocus}
61
65
  data-form-last-element="true"
62
- onclick={processSubmission}
63
- >
66
+ onclick={processSubmission}>
64
67
  </lightning-button>
65
68
  </div>
66
69
  </div>