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
@@ -10,24 +10,28 @@ const i18n = {
10
10
  wrapText: labelWrapText,
11
11
  };
12
12
 
13
+ /**
14
+ * A header-level action.
15
+ */
13
16
  export default class PrimitiveHeaderActions extends LightningElement {
14
- static delegatesFocus = true;
15
- @api colKeyValue;
16
-
17
+ // Tracked objects
17
18
  @track containerRect;
18
19
  @track _internalActions = [];
19
20
  @track _customerActions = [];
21
+
22
+ // Private variables
23
+ static delegatesFocus = true;
20
24
  _actionMenuAlignment;
21
25
 
22
- @api
23
- focus() {
24
- const btnMenu = this.template.querySelector('lightning-button-menu');
26
+ /************************** PUBLIC ATTRIBUTES ***************************/
25
27
 
26
- if (btnMenu) {
27
- btnMenu.focus();
28
- }
29
- }
28
+ @api colKeyValue;
30
29
 
30
+ /**
31
+ * Defines the actions on a header cell
32
+ *
33
+ * @type {Object}
34
+ */
31
35
  @api
32
36
  get actions() {
33
37
  return this._actions;
@@ -38,49 +42,60 @@ export default class PrimitiveHeaderActions extends LightningElement {
38
42
  this.updateActions();
39
43
  }
40
44
 
41
- get i18n() {
42
- return i18n;
43
- }
44
-
45
- updateActions() {
46
- const actionTypeReducer = (type) => (actions, action) => {
47
- const overrides = { _type: type, _action: action };
48
- actions.push(Object.assign({}, action, overrides));
45
+ /************************** PUBLIC METHODS ***************************/
49
46
 
50
- return actions;
51
- };
47
+ /**
48
+ * Sets focus on a lightning-button-menu
49
+ */
50
+ @api
51
+ focus() {
52
+ const btnMenu = this.template.querySelector('lightning-button-menu');
52
53
 
53
- this._internalActions = this.getActionsByType('internalActions').reduce(
54
- actionTypeReducer('internal'),
55
- []
56
- );
54
+ if (btnMenu) {
55
+ btnMenu.focus();
56
+ }
57
+ }
57
58
 
58
- this._customerActions = this.getActionsByType('customerActions').reduce(
59
- actionTypeReducer('customer'),
60
- []
61
- );
59
+ /************************** PRIVATE GETTERS **************************/
62
60
 
63
- // ToDo: W-8389508 Refactor so menu is outside of header
64
- this._actionMenuAlignment =
65
- this._actions.menuAlignment &&
66
- this._actions.menuAlignment.replace('auto-', '');
61
+ /**
62
+ * Returns the internationalization definition object
63
+ *
64
+ * @return {Object} The i18n definition object
65
+ */
66
+ get i18n() {
67
+ return i18n;
67
68
  }
68
69
 
70
+ /**
71
+ * Determines whether or not a header has actions
72
+ *
73
+ * @return {Boolean}
74
+ */
69
75
  get hasActions() {
70
76
  return (
71
77
  this._internalActions.length > 0 || this._customerActions.length > 0
72
78
  );
73
79
  }
80
+
81
+ /**
82
+ * Determines whether or not a header has an action divider
83
+ *
84
+ * @return {Boolean}
85
+ */
74
86
  get hasActionsDivider() {
75
87
  return (
76
88
  this._internalActions.length > 0 && this._customerActions.length > 0
77
89
  );
78
90
  }
79
91
 
80
- getActionsByType(type) {
81
- return Array.isArray(this._actions[type]) ? this._actions[type] : [];
82
- }
92
+ /************************ EVENT DISPATCHERS **************************/
83
93
 
94
+ /**
95
+ * Handles opening a menu
96
+ *
97
+ * @param {Event} event
98
+ */
84
99
  handleMenuOpen(event) {
85
100
  event.preventDefault();
86
101
  event.stopPropagation();
@@ -107,6 +122,9 @@ export default class PrimitiveHeaderActions extends LightningElement {
107
122
  );
108
123
  }
109
124
 
125
+ /**
126
+ * Handles closing a menu
127
+ */
110
128
  handleMenuClose() {
111
129
  this.dispatchEvent(
112
130
  new CustomEvent('privatecellheaderactionmenuclosed', {
@@ -117,8 +135,13 @@ export default class PrimitiveHeaderActions extends LightningElement {
117
135
  );
118
136
  }
119
137
 
120
- handleActionSelect(evt) {
121
- const action = evt.detail.value;
138
+ /**
139
+ * Handles selecting an action
140
+ *
141
+ * @param {Event} event
142
+ */
143
+ handleActionSelect(event) {
144
+ const action = event.detail.value;
122
145
 
123
146
  this.dispatchEvent(
124
147
  new CustomEvent('privatecellheaderactiontriggered', {
@@ -133,4 +156,43 @@ export default class PrimitiveHeaderActions extends LightningElement {
133
156
  })
134
157
  );
135
158
  }
159
+
160
+ /************************* HELPER FUNCTIONS **************************/
161
+
162
+ /**
163
+ * Updates the actions object
164
+ */
165
+ updateActions() {
166
+ const actionTypeReducer = (type) => (actions, action) => {
167
+ const overrides = { _type: type, _action: action };
168
+ actions.push(Object.assign({}, action, overrides));
169
+
170
+ return actions;
171
+ };
172
+
173
+ this._internalActions = this.getActionsByType('internalActions').reduce(
174
+ actionTypeReducer('internal'),
175
+ []
176
+ );
177
+
178
+ this._customerActions = this.getActionsByType('customerActions').reduce(
179
+ actionTypeReducer('customer'),
180
+ []
181
+ );
182
+
183
+ // TODO: W-8389508 Refactor so menu is outside of header
184
+ this._actionMenuAlignment =
185
+ this._actions.menuAlignment &&
186
+ this._actions.menuAlignment.replace('auto-', '');
187
+ }
188
+
189
+ /**
190
+ * Returns actions by action type
191
+ *
192
+ * @param {String} type The action type to filter by
193
+ * @return {Array} An array of actions that match the provided type
194
+ */
195
+ getActionsByType(type) {
196
+ return Array.isArray(this._actions[type]) ? this._actions[type] : [];
197
+ }
136
198
  }
@@ -1,8 +1,7 @@
1
1
  <template>
2
- <div
3
- class={computedClass}
4
- style={columnStyles}
5
- >
2
+ <div class={computedClass} style={columnStyles}>
3
+
4
+ <!-- Header Content -->
6
5
  <span class="slds-th__action">
7
6
  <template if:true={def.iconName}>
8
7
  <div class="slds-grid slds-grid_vertical-align-center slds-has-flexi-truncate">
@@ -17,6 +16,7 @@
17
16
  <span class="slds-truncate" if:false={def.label} title={def.ariaLabel}></span>
18
17
  </template>
19
18
 
19
+ <!-- Header Actions -->
20
20
  <template if:true={hasActions}>
21
21
  <lightning-primitive-header-actions
22
22
  col-key-value={def.colKeyValue}
@@ -26,6 +26,7 @@
26
26
  ></lightning-primitive-header-actions>
27
27
  </template>
28
28
 
29
+ <!-- Resize Handler -->
29
30
  <template if:true={isResizable}>
30
31
  <lightning-primitive-resize-handler
31
32
  value={columnWidth}
@@ -181,44 +181,51 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
181
181
  }
182
182
 
183
183
  /**
184
- * Determines if sort direction is set to ascending
184
+ * Computes an option name
185
185
  *
186
- * @return {boolean} Whether the sort direction is ascending
186
+ * @return {string} The computed option name
187
187
  */
188
- get isAscSorted() {
189
- return this.sortedDirection === 'asc';
188
+ get computedOptionName() {
189
+ return `${this.dtContextId}-options`;
190
190
  }
191
191
 
192
192
  /**
193
- * Determines if sort direction is set to descending
193
+ * Determines if the header has actions available
194
194
  *
195
- * @return {boolean} Whether the sort direction is descending
195
+ * @return {boolean} Whether the header has available actions
196
196
  */
197
- get isDescSorted() {
198
- return this.sortedDirection === 'desc';
197
+ get hasActions() {
198
+ return (
199
+ this.actions.customerActions.length > 0 ||
200
+ this.actions.internalActions.length > 0
201
+ );
199
202
  }
200
203
 
201
204
  /**
202
- * Returns the sort order label in the appropriate language
205
+ * Returns the header's aria role
203
206
  *
204
- * @return {string} Language-specific sort order label
207
+ * @return {string|boolean} The aria role for the header
205
208
  */
206
- get sortedOrderLabel() {
207
- if (this.sorted) {
208
- return this.sortedDirection === 'desc'
209
- ? i18n.sortDesc
210
- : i18n.sortAsc;
211
- }
212
- return i18n.sortNone;
209
+ get headerRole() {
210
+ return this.isResizable || this.sortable ? 'button' : false;
213
211
  }
214
212
 
215
213
  /**
216
- * Determines if the header is selectable
214
+ * Determines if sort direction is set to ascending
217
215
  *
218
- * @return {boolean} Whether the header is selectable
216
+ * @return {boolean} Whether the sort direction is ascending
219
217
  */
220
- get isSelectableHeader() {
221
- return this.def.type === 'SELECTABLE_CHECKBOX';
218
+ get isAscSorted() {
219
+ return this.sortedDirection === 'asc';
220
+ }
221
+
222
+ /**
223
+ * Determines if sort direction is set to descending
224
+ *
225
+ * @return {boolean} Whether the sort direction is descending
226
+ */
227
+ get isDescSorted() {
228
+ return this.sortedDirection === 'desc';
222
229
  }
223
230
 
224
231
  /**
@@ -239,6 +246,15 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
239
246
  return this.resizable && this.def.resizable !== false;
240
247
  }
241
248
 
249
+ /**
250
+ * Determines if the header is selectable
251
+ *
252
+ * @return {boolean} Whether the header is selectable
253
+ */
254
+ get isSelectableHeader() {
255
+ return this.def.type === 'SELECTABLE_CHECKBOX';
256
+ }
257
+
242
258
  /**
243
259
  * Determines if the header is sortable
244
260
  *
@@ -257,15 +273,6 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
257
273
  return i18n;
258
274
  }
259
275
 
260
- /**
261
- * Returns the header's aria role
262
- *
263
- * @return {string|boolean} The aria role for the header
264
- */
265
- get headerRole() {
266
- return this.isResizable || this.sortable ? 'button' : false;
267
- }
268
-
269
276
  /**
270
277
  * Returns the header's resize step
271
278
  *
@@ -276,24 +283,17 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
276
283
  }
277
284
 
278
285
  /**
279
- * Computes an option name
280
- *
281
- * @return {string} The computed option name
282
- */
283
- get computedOptionName() {
284
- return `${this.dtContextId}-options`;
285
- }
286
-
287
- /**
288
- * Determines if the header has actions available
286
+ * Returns the sort order label in the appropriate language
289
287
  *
290
- * @return {boolean} Whether the header has available actions
288
+ * @return {string} Language-specific sort order label
291
289
  */
292
- get hasActions() {
293
- return (
294
- this.actions.customerActions.length > 0 ||
295
- this.actions.internalActions.length > 0
296
- );
290
+ get sortedOrderLabel() {
291
+ if (this.sorted) {
292
+ return this.sortedDirection === 'desc'
293
+ ? i18n.sortDesc
294
+ : i18n.sortAsc;
295
+ }
296
+ return i18n.sortNone;
297
297
  }
298
298
 
299
299
  /************************** LIFECYCLE HOOKS **************************/
@@ -1,30 +1,32 @@
1
1
  <template>
2
- <div class="slds-th__action slds-th__action_form slds-cell-fixed"
3
- style={columnStyles}>
2
+ <!-- Header Content -->
3
+ <div class="slds-th__action slds-th__action_form slds-cell-fixed" style={columnStyles}>
4
4
  <template if:true={showCheckbox}>
5
- <span class="slds-checkbox">
6
- <input
7
- type="checkbox"
8
- class="datatable-select-all"
9
- name={computedOptionName}
10
- id="lgt-dt-header-factory-id"
11
- onclick={handleSelectAllRows}
12
- tabindex={internalTabIndex}
13
- data-navigation="enable"
14
- disabled={def.isBulkSelectionDisabled}
15
- >
16
- <label class="slds-checkbox__label" for="lgt-dt-header-factory-id">
17
- <span class="slds-checkbox_faux"></span>
18
- <span class="slds-form-element__label slds-assistive-text">
19
- {i18n.selectAll}
20
- </span>
21
- </label>
22
- </span>
5
+ <span class="slds-checkbox">
6
+
7
+ <!-- Selectable Checkbox -->
8
+ <input
9
+ type="checkbox"
10
+ class="datatable-select-all"
11
+ name={computedOptionName}
12
+ id="lgt-dt-header-factory-id"
13
+ onclick={handleSelectAllRows}
14
+ tabindex={internalTabIndex}
15
+ data-navigation="enable"
16
+ disabled={def.isBulkSelectionDisabled}>
17
+
18
+ <label class="slds-checkbox__label" for="lgt-dt-header-factory-id">
19
+ <span class="slds-checkbox_faux"></span>
20
+ <span class="slds-form-element__label slds-assistive-text">
21
+ {i18n.selectAll}
22
+ </span>
23
+ </label>
24
+ </span>
23
25
  </template>
24
26
  <template if:false={showCheckbox}>
25
- <span id="column-group-header" class="slds-assistive-text" data-column-header>
26
- {i18n.chooseARow}
27
- </span>
27
+ <span id="column-group-header" class="slds-assistive-text" data-column-header>
28
+ {i18n.chooseARow}
29
+ </span>
28
30
  </template>
29
31
  </div>
30
32
  </template>
@@ -1,19 +1,19 @@
1
1
  <template>
2
- <span
3
- class={computedClass}
4
- tabindex={internalTabIndex}
5
- style={columnStyles}
6
- >
2
+ <!-- Header Content -->
3
+ <span class={computedClass} tabindex={internalTabIndex} style={columnStyles}>
4
+
7
5
  <a href="javascript:void(0);"
8
6
  class={computedSortClass}
9
7
  role={headerRole}
10
8
  tabindex={internalTabIndex}
11
9
  data-navigation="enable"
12
10
  onclick={handleSortingClick}
13
- style={columnStyles} data-action-triggers="enter">
11
+ style={columnStyles}
12
+ data-action-triggers="enter">
14
13
 
15
14
  <span class="slds-assistive-text">{i18n.sort}</span>
16
15
 
16
+ <!-- Icon to display to the left/start of the header text -->
17
17
  <template if:true={def.iconName}>
18
18
  <div class="slds-grid slds-grid_vertical-align-center slds-has-flexi-truncate">
19
19
  <lightning-icon icon-name={def.iconName} size="x-small" class="slds-icon_container slds-m-right_xx-small" alternative-text={def.label} title={def.label}></lightning-icon>
@@ -21,17 +21,18 @@
21
21
  <span class="slds-truncate">{def.label}</span>
22
22
  </template>
23
23
 
24
+ <!-- Arrow Icon - Rotates based on sorting direction -->
24
25
  <lightning-primitive-icon
25
26
  class="slds-icon_container"
26
27
  svg-class="slds-icon slds-icon-text-default slds-is-sortable__icon"
27
28
  icon-name="utility:arrowdown"
28
29
  size="x-small">
29
30
  </lightning-primitive-icon>
30
-
31
31
  </div>
32
32
  </template>
33
33
  <template if:false={def.iconName}>
34
34
  <span class="slds-truncate" title={def.label}>{def.label}</span>
35
+ <!-- Arrow Icon - Rotates based on sorting direction -->
35
36
  <lightning-primitive-icon
36
37
  class="slds-icon_container"
37
38
  svg-class="slds-icon slds-icon-text-default slds-is-sortable__icon"
@@ -41,17 +42,20 @@
41
42
  </template>
42
43
  </a>
43
44
 
45
+ <!-- Aria Live Region to announce sorting order -->
44
46
  <span class="slds-assistive-text" aria-live="polite" aria-atomic="true">{sortedOrderLabel}</span>
45
47
 
48
+ <!-- Header Actions -->
46
49
  <template if:true={hasActions}>
47
50
  <lightning-primitive-header-actions
48
51
  col-key-value={def.colKeyValue}
49
52
  actions={actions}
50
53
  tabindex={internalTabIndex}
51
- data-navigation="enable"
52
- ></lightning-primitive-header-actions>
54
+ data-navigation="enable">
55
+ </lightning-primitive-header-actions>
53
56
  </template>
54
57
 
58
+ <!-- Resize Handler -->
55
59
  <template if:true={isResizable}>
56
60
  <lightning-primitive-resize-handler
57
61
  value={columnWidth}
@@ -53,7 +53,7 @@ export default class LightningProgressIndicator extends LightningElement {
53
53
  set currentStep(value) {
54
54
  this.privateCurrentStep = value;
55
55
  if (this.privateRendered) {
56
- this.updateSteps();
56
+ this.updateSteps(value);
57
57
  }
58
58
  }
59
59
 
@@ -100,18 +100,16 @@ export default class LightningProgressIndicator extends LightningElement {
100
100
  const currentStepIndex = getCurrentStepIndex(steps, currentStep);
101
101
 
102
102
  let activeStepIndex = -1;
103
-
104
- // Set activeStep index to activeStep if provided.
103
+ // Set activeStepIndex to activeStep if provided.
105
104
  // This happens when focus is updated by user using arrow keys or clicking a progress step.
106
105
  // When component re-renders, active step is not passed from renderedCallback or handleSlotChange
107
106
  // In this scenario, use the privateActiveStepIndex to maintain the activeStep.
108
107
  // privateActiveStepInde will have the active step before the re-render
109
- // In case of initial render, privateActiveStepIndex is null. Use privateCurrentStep as activeStepIndex for fallback.
108
+ // In case of initial render, privateActiveStepIndex is undefined. Use privateCurrentStep as activeStepIndex for fallback.
110
109
  // activeStep is needed to set active class and proper tabIndex for the progress step
111
-
112
110
  if (activeStep) {
113
111
  activeStepIndex = getStepIndex(steps, activeStep);
114
- } else if (this.privateActiveStepIndex) {
112
+ } else if (this.privateActiveStepIndex !== undefined) {
115
113
  activeStepIndex = this.privateActiveStepIndex;
116
114
  } else {
117
115
  activeStepIndex = getStepIndex(steps, this.privateCurrentStep);
@@ -31,6 +31,8 @@ export default class LightningProgressStep extends LightningElement {
31
31
  */
32
32
  @api value;
33
33
 
34
+ _privateLabel;
35
+
34
36
  @track state = {};
35
37
 
36
38
  updateInternal(newStatus, newType, newIndex, newActive, shouldFocus) {
@@ -47,6 +49,7 @@ export default class LightningProgressStep extends LightningElement {
47
49
  this.state.type = newType;
48
50
  this.state.index = newIndex;
49
51
  this.state.active = newActive;
52
+ this.initializeTooltip();
50
53
  }
51
54
  /**
52
55
  * Text to display as the name or tooltip for the step.
@@ -54,30 +57,12 @@ export default class LightningProgressStep extends LightningElement {
54
57
  */
55
58
  @api
56
59
  set label(value) {
57
- if (this._tooltip) {
58
- this._tooltip.value = value;
59
- } else if (value && !this.isPath) {
60
- // Note that because the tooltip target is a child element it may not be present in the
61
- // dom during initial rendering.
62
- this._tooltip = new Tooltip(value, {
63
- root: this,
64
- target: () => this.template.querySelector('button'),
65
- type: TooltipType.Toggle,
66
- align: {
67
- horizontal: Direction.Center,
68
- vertical: Direction.Bottom,
69
- },
70
- targetAlign: {
71
- horizontal: Direction.Center,
72
- vertical: Direction.Top,
73
- },
74
- });
75
- this._tooltip.initialize();
76
- }
60
+ this._privateLabel = value;
61
+ this.initializeTooltip();
77
62
  }
78
63
 
79
64
  get label() {
80
- return this._tooltip ? this._tooltip.value : undefined;
65
+ return this._privateLabel;
81
66
  }
82
67
 
83
68
  computeClassSet(type, status, isActive) {
@@ -87,7 +72,8 @@ export default class LightningProgressStep extends LightningElement {
87
72
  'slds-is-completed': !isPath && status === 'completed',
88
73
  'slds-has-error': !isPath && status === 'error',
89
74
  'slds-is-active':
90
- isActive === true || (type === 'base' && status === 'current'),
75
+ (isPath && isActive === true) ||
76
+ (type === 'base' && status === 'current'),
91
77
  'slds-path__item': isPath,
92
78
  'slds-is-complete': isPath && status === 'completed',
93
79
  'slds-is-current':
@@ -239,4 +225,27 @@ export default class LightningProgressStep extends LightningElement {
239
225
  }
240
226
  return base;
241
227
  }
228
+
229
+ initializeTooltip() {
230
+ if (this._tooltip) {
231
+ this._tooltip.value = this._privateLabel;
232
+ } else if (this._privateLabel && this.state.type && !this.isPath) {
233
+ // Note that because the tooltip target is a child element it may not be present in the
234
+ // dom during initial rendering.
235
+ this._tooltip = new Tooltip(this._privateLabel, {
236
+ root: this,
237
+ target: () => this.template.querySelector('button'),
238
+ type: TooltipType.Toggle,
239
+ align: {
240
+ horizontal: Direction.Center,
241
+ vertical: Direction.Bottom,
242
+ },
243
+ targetAlign: {
244
+ horizontal: Direction.Center,
245
+ vertical: Direction.Top,
246
+ },
247
+ });
248
+ this._tooltip.initialize();
249
+ }
250
+ }
242
251
  }
@@ -6,6 +6,7 @@
6
6
  oniframeload={handleIframeLoad}
7
7
  width={width}
8
8
  height={height}
9
+ title={mapTitle}
9
10
  frame-style={mapStyle}>
10
11
  </lightning-primitive-iframe>
11
12
  <div class="slds-iframe-cover"></div>