lightning-base-components 1.13.6-alpha → 1.13.10-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 (189) hide show
  1. package/metadata/raptor.json +104 -2
  2. package/package.json +37 -1
  3. package/scopedImports/@salesforce-label-LightningAlert.defaultLabel.js +1 -0
  4. package/scopedImports/@salesforce-label-LightningConfirm.defaultLabel.js +1 -0
  5. package/scopedImports/@salesforce-label-LightningDateTimePicker.selectDateFor.js +1 -0
  6. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.cancel.js +1 -0
  7. package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.ok.js +1 -0
  8. package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
  9. package/scopedImports/@salesforce-label-LightningModalBase.close.js +1 -0
  10. package/scopedImports/@salesforce-label-LightningModalBase.waitstate.js +1 -0
  11. package/scopedImports/@salesforce-label-LightningPrompt.defaultLabel.js +1 -0
  12. package/src/lightning/baseCombobox/baseCombobox.html +50 -24
  13. package/src/lightning/baseCombobox/baseCombobox.js +53 -28
  14. package/src/lightning/card/card.html +7 -1
  15. package/src/lightning/card/card.js +30 -2
  16. package/src/lightning/card/utils.js +14 -0
  17. package/src/lightning/combobox/combobox.css +12 -0
  18. package/src/lightning/combobox/combobox.html +1 -0
  19. package/src/lightning/datatable/__docs__/datatable.md +40 -13
  20. package/src/lightning/datatable/columnWidthManager.js +8 -4
  21. package/src/lightning/datatable/columns-shared.js +8 -7
  22. package/src/lightning/datatable/columns.js +38 -4
  23. package/src/lightning/datatable/datatable.js +932 -727
  24. package/src/lightning/datatable/datatableResizeObserver.js +1 -1
  25. package/src/lightning/datatable/inlineEdit.js +15 -3
  26. package/src/lightning/datatable/keyboard.js +1078 -935
  27. package/src/lightning/datatable/resizer.js +92 -109
  28. package/src/lightning/datatable/rows.js +245 -59
  29. package/src/lightning/datatable/sort.js +83 -28
  30. package/src/lightning/datatable/{normalizer.js → state.js} +16 -28
  31. package/src/lightning/datatable/templates/div/div.css +53 -0
  32. package/src/lightning/datatable/templates/div/div.html +272 -0
  33. package/src/lightning/datatable/{datatable.css → templates/table/table.css} +0 -0
  34. package/src/lightning/datatable/templates/table/table.html +260 -0
  35. package/src/lightning/datatable/widthManagerShared.js +1 -1
  36. package/src/lightning/datepicker/datepicker.html +3 -3
  37. package/src/lightning/datepicker/datepicker.js +6 -2
  38. package/src/lightning/datetimepicker/datetimepicker.html +3 -4
  39. package/src/lightning/datetimepicker/datetimepicker.js +0 -2
  40. package/src/lightning/formattedRichText/__docs__/formattedRichText.md +1 -0
  41. package/src/lightning/helptext/helptext.js +8 -0
  42. package/src/lightning/iconSvgTemplates/buildTemplates/standard/asset_audit.html +7 -0
  43. package/src/lightning/iconSvgTemplates/buildTemplates/standard/attach.html +7 -0
  44. package/src/lightning/iconSvgTemplates/buildTemplates/standard/contract_payment.html +10 -0
  45. package/src/lightning/iconSvgTemplates/buildTemplates/standard/field_sales.html +8 -0
  46. package/src/lightning/iconSvgTemplates/buildTemplates/standard/historical_adherence.html +9 -0
  47. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_recommendation.html +8 -0
  48. package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  49. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_dispense.html +11 -0
  50. package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_reconciliation.html +7 -0
  51. package/src/lightning/iconSvgTemplates/buildTemplates/standard/report_type.html +9 -0
  52. package/src/lightning/iconSvgTemplates/buildTemplates/standard/story.html +2 -4
  53. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour.html +9 -0
  54. package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour_check.html +8 -0
  55. package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
  56. package/src/lightning/iconSvgTemplates/buildTemplates/standard/unified_health_score.html +7 -0
  57. package/src/lightning/iconSvgTemplates/buildTemplates/standard/workforce_engagement.html +8 -0
  58. package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +26 -1
  59. package/src/lightning/iconSvgTemplates/buildTemplates/utility/asset_audit.html +9 -0
  60. package/src/lightning/iconSvgTemplates/buildTemplates/utility/collection_alt.html +8 -0
  61. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
  62. package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_payment.html +10 -0
  63. package/src/lightning/iconSvgTemplates/buildTemplates/utility/einstein.html +2 -1
  64. package/src/lightning/iconSvgTemplates/buildTemplates/utility/entitlement.html +7 -0
  65. package/src/lightning/iconSvgTemplates/buildTemplates/utility/field_sales.html +8 -0
  66. package/src/lightning/iconSvgTemplates/buildTemplates/utility/signature.html +9 -0
  67. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour.html +9 -0
  68. package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour_check.html +8 -0
  69. package/src/lightning/iconSvgTemplates/buildTemplates/utility/truck.html +10 -0
  70. package/src/lightning/iconSvgTemplates/buildTemplates/utility/workforce_engagement.html +8 -0
  71. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/asset_audit.html +7 -0
  72. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/attach.html +7 -0
  73. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/contract_payment.html +10 -0
  74. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/field_sales.html +8 -0
  75. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/historical_adherence.html +9 -0
  76. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  77. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  78. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_dispense.html +11 -0
  79. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  80. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/report_type.html +9 -0
  81. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/story.html +2 -4
  82. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour.html +9 -0
  83. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour_check.html +8 -0
  84. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
  85. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/unified_health_score.html +7 -0
  86. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  87. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +26 -1
  88. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/asset_audit.html +9 -0
  89. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/collection_alt.html +8 -0
  90. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
  91. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_payment.html +10 -0
  92. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/einstein.html +2 -1
  93. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/entitlement.html +7 -0
  94. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/field_sales.html +8 -0
  95. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/signature.html +9 -0
  96. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour.html +9 -0
  97. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour_check.html +8 -0
  98. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/truck.html +10 -0
  99. package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  100. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/asset_audit.html +7 -0
  101. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/attach.html +7 -0
  102. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/contract_payment.html +10 -0
  103. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/field_sales.html +8 -0
  104. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/historical_adherence.html +9 -0
  105. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_recommendation.html +8 -0
  106. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  107. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_dispense.html +11 -0
  108. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_reconciliation.html +7 -0
  109. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/report_type.html +9 -0
  110. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/story.html +2 -4
  111. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour.html +9 -0
  112. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour_check.html +8 -0
  113. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
  114. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/unified_health_score.html +7 -0
  115. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/workforce_engagement.html +8 -0
  116. package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +15 -1
  117. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/asset_audit.html +7 -0
  118. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/attach.html +7 -0
  119. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/contract_payment.html +10 -0
  120. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/field_sales.html +8 -0
  121. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/historical_adherence.html +9 -0
  122. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
  123. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
  124. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_dispense.html +11 -0
  125. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
  126. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/report_type.html +9 -0
  127. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/story.html +2 -4
  128. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour.html +9 -0
  129. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour_check.html +8 -0
  130. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
  131. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/unified_health_score.html +7 -0
  132. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/workforce_engagement.html +8 -0
  133. package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +15 -1
  134. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +12 -1
  135. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/asset_audit.html +9 -0
  136. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/collection_alt.html +8 -0
  137. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
  138. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_payment.html +10 -0
  139. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/einstein.html +2 -1
  140. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/entitlement.html +7 -0
  141. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/field_sales.html +8 -0
  142. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/signature.html +9 -0
  143. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour.html +9 -0
  144. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour_check.html +8 -0
  145. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/truck.html +10 -0
  146. package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/workforce_engagement.html +8 -0
  147. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +12 -1
  148. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/asset_audit.html +9 -0
  149. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/collection_alt.html +8 -0
  150. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
  151. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_payment.html +10 -0
  152. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/einstein.html +2 -1
  153. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/entitlement.html +7 -0
  154. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/field_sales.html +8 -0
  155. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/signature.html +9 -0
  156. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour.html +9 -0
  157. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour_check.html +8 -0
  158. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/truck.html +10 -0
  159. package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/workforce_engagement.html +8 -0
  160. package/src/lightning/input/__docs__/input.md +4 -0
  161. package/src/lightning/input/input.js +11 -6
  162. package/src/lightning/pill/link.html +1 -1
  163. package/src/lightning/pill/pill.js +18 -0
  164. package/src/lightning/pill/plainLink.html +2 -0
  165. package/src/lightning/pillContainer/barePillContainer.html +5 -5
  166. package/src/lightning/pillContainer/pillContainer.js +5 -4
  167. package/src/lightning/pillContainer/standardPillContainer.html +5 -5
  168. package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +8 -6
  169. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +1 -1
  170. package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +6 -9
  171. package/src/lightning/positionLibrary/direction.js +17 -5
  172. package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +20 -0
  173. package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +10 -0
  174. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +17 -3
  175. package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -0
  176. package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +5 -4
  177. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +255 -94
  178. package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
  179. package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
  180. package/src/lightning/progressIndicator/progressIndicator.js +30 -9
  181. package/src/lightning/progressRing/progressRing.html +6 -0
  182. package/src/lightning/progressRing/progressRing.js +98 -3
  183. package/src/lightning/progressStep/progressStep.js +6 -3
  184. package/src/lightning/timepicker/timepicker.html +1 -0
  185. package/src/lightning/utilsPrivate/aria.js +30 -0
  186. package/src/lightning/utilsPrivate/contentMutation.js +24 -2
  187. package/src/lightning/utilsPrivate/utilsPrivate.js +1 -1
  188. package/src/lightning/datatable/datatable.html +0 -237
  189. package/src/lightning/datatable/keys.js +0 -32
@@ -93,17 +93,28 @@ export default class LightningProgressIndicator extends LightningElement {
93
93
  this.updateSteps();
94
94
  }
95
95
 
96
- updateSteps(activeStep) {
96
+ // Added `shouldFocus` as fix for W-9862373
97
+ updateSteps(activeStep, shouldFocus) {
97
98
  const steps = this.getSteps();
98
99
  const { privateStepHandlers, type, hasError, currentStep } = this;
99
100
  const currentStepIndex = getCurrentStepIndex(steps, currentStep);
100
- let activeStepIndex = -1;
101
101
 
102
+ let activeStepIndex = -1;
103
+ // Set activeStepIndex to activeStep if provided.
104
+ // This happens when focus is updated by user using arrow keys or clicking a progress step.
105
+ // When component re-renders, active step is not passed from renderedCallback or handleSlotChange
106
+ // In this scenario, use the privateActiveStepIndex to maintain the activeStep.
107
+ // privateActiveStepInde will have the active step before the re-render
108
+ // In case of initial render, privateActiveStepIndex is undefined. Use privateCurrentStep as activeStepIndex for fallback.
109
+ // activeStep is needed to set active class and proper tabIndex for the progress step
102
110
  if (activeStep) {
103
111
  activeStepIndex = getStepIndex(steps, activeStep);
112
+ } else if (this.privateActiveStepIndex !== undefined) {
113
+ activeStepIndex = this.privateActiveStepIndex;
104
114
  } else {
105
115
  activeStepIndex = getStepIndex(steps, this.privateCurrentStep);
106
116
  }
117
+
107
118
  this.privateActiveStepIndex = activeStepIndex;
108
119
 
109
120
  // cast 'steps' NodeList to an Array for crossbrowser compatibility
@@ -111,24 +122,32 @@ export default class LightningProgressIndicator extends LightningElement {
111
122
 
112
123
  stepsArray.forEach((step, index) => {
113
124
  const stepName = step.value;
114
- const isActive = index === activeStepIndex;
125
+ const isActive = index === this.privateActiveStepIndex;
115
126
 
116
127
  if (index < currentStepIndex) {
117
128
  privateStepHandlers[stepName](
118
129
  STATE_COMPLETED,
119
130
  type,
120
131
  index,
121
- isActive
132
+ isActive,
133
+ shouldFocus
122
134
  );
123
135
  } else if (index === currentStepIndex) {
124
136
  const state = hasError ? STATE_ERROR : STATE_CURRENT;
125
- privateStepHandlers[stepName](state, type, index, isActive);
137
+ privateStepHandlers[stepName](
138
+ state,
139
+ type,
140
+ index,
141
+ isActive,
142
+ shouldFocus
143
+ );
126
144
  } else {
127
145
  privateStepHandlers[stepName](
128
146
  STATE_INCOMPLETE,
129
147
  type,
130
148
  index,
131
- isActive
149
+ isActive,
150
+ shouldFocus
132
151
  );
133
152
  }
134
153
  });
@@ -169,15 +188,17 @@ export default class LightningProgressIndicator extends LightningElement {
169
188
  case LEFT:
170
189
  if (this.privateActiveStepIndex - 1 >= 0) {
171
190
  this.updateSteps(
172
- steps[this.privateActiveStepIndex - 1].value
191
+ steps[this.privateActiveStepIndex - 1].value,
192
+ true // Set shouldFocus to true to focus on nthe updated progress step
173
193
  );
174
194
  }
175
195
  break;
176
196
  case DOWN:
177
197
  case RIGHT:
178
- if (this.privateActiveStepIndex + 1 <= steps.length) {
198
+ if (this.privateActiveStepIndex + 1 < steps.length) {
179
199
  this.updateSteps(
180
- steps[this.privateActiveStepIndex + 1].value
200
+ steps[this.privateActiveStepIndex + 1].value,
201
+ true // Set shouldFocus to true to focus on nthe updated progress step
181
202
  );
182
203
  }
183
204
  break;
@@ -29,5 +29,11 @@
29
29
  <span class="slds-assistive-text">{computedAltText}</span>
30
30
  </span>
31
31
  </div>
32
+ <div class="slds-progress-ring__progress-head">
33
+ <svg viewBox="-1 -1 2 2">
34
+ <circle if:true={isProgressHeadVisible} class="slds-progress-ring__path" cx={progressHeadCenter.x} cy={progressHeadCenter.y} r="0.2">
35
+ </circle>
36
+ </svg>
37
+ </div>
32
38
  </div>
33
39
  </template>
@@ -1,6 +1,11 @@
1
1
  import { LightningElement, api } from 'lwc';
2
2
  import { classSet } from 'lightning/utils';
3
3
 
4
+ /**
5
+ * Progress head SVG element viewBox attribute is set as '-1 -1 2 2', hence viewbox height is 2 units
6
+ */
7
+ export const PROGRESS_HEAD_VIEWBOX_HEIGHT = 2;
8
+
4
9
  /**
5
10
  * Displays a circular progress indicator to provide feedback about an action or process.
6
11
  * This component requires API version 48.0 and later.
@@ -42,6 +47,94 @@ export default class progressRing extends LightningElement {
42
47
  */
43
48
  @api size = 'medium';
44
49
 
50
+ arcY = 0;
51
+ arcX = 0;
52
+ radiusOfCircularMotionForProgressHead = 0;
53
+
54
+ isRendered = false;
55
+
56
+ /**
57
+ * Calculates the radius along which to rotate the SVG circle element present inside
58
+ * ".slds-progress-ring__progress-head" container element.
59
+ */
60
+ calculateRadiusOfCircularMotionForProgressHead() {
61
+ const progressHeadContainerHeight = parseFloat(
62
+ getComputedStyle(
63
+ this.template.querySelector(
64
+ '.slds-progress-ring__progress-head'
65
+ )
66
+ ).height
67
+ );
68
+ const progressArcContainerHeight = parseFloat(
69
+ getComputedStyle(
70
+ this.template.querySelector('.slds-progress-ring__progress')
71
+ ).height
72
+ );
73
+ const progressContentContainerHeight = parseFloat(
74
+ getComputedStyle(
75
+ this.template.querySelector('.slds-progress-ring__content')
76
+ ).height
77
+ );
78
+ // NOTE:- The progress-head SVG viewbox attribute is set as '-1 -1 2 2', which means the "2" units
79
+ // height and width of viewbox would correspond to the actual height/width of the SVG in pixels.
80
+ // ex:- If the SVG's actual widthxheight in pixels is 32x32, then inside the viewbox the "32px" would
81
+ // correspond to "2" units. This means the viewbox scales down lengths to it's own units between 0 and 2.
82
+ // So to work with actual lengths in pixels inside the viewbox, you have to first convert the pixel length
83
+ // to "viewbox length" units.
84
+ // ex:- Continuing from previous example, If 32px is 2 units inside viewbox, how many units is 24px?
85
+ // it will be 24 * (2 / 32).
86
+ // Therefore, you need a "length scaling factor" to find the "viewbox length" for a given pixel length. The
87
+ // (2 / 32) in the previous example is the "length scaling factor"
88
+ const lengthScalingFactorInProgressHeadViewBox =
89
+ PROGRESS_HEAD_VIEWBOX_HEIGHT / progressHeadContainerHeight;
90
+ const radiusOfProgressArcInPixels = progressArcContainerHeight / 2;
91
+ const radiusOfProgressArcInProgressHeadViewBox =
92
+ radiusOfProgressArcInPixels *
93
+ lengthScalingFactorInProgressHeadViewBox;
94
+
95
+ // Note:- The progress-content container element partially overlaps the progress-arc container
96
+ // element like a concentric circle inside another circle. So the width of the progress arc that is visible to the user
97
+ // is equal to the length of the non-overlapping part between them.
98
+ const radiusOfProgressContentInPixels =
99
+ progressContentContainerHeight / 2;
100
+ const widthOfArcInPixels =
101
+ radiusOfProgressArcInPixels - radiusOfProgressContentInPixels;
102
+ const widthOfArcInProgressHeadViewBox =
103
+ widthOfArcInPixels * lengthScalingFactorInProgressHeadViewBox;
104
+
105
+ // Note:- Here the intent is to move the progress-head circle svg element
106
+ // along the midpoint of the progress arc width.
107
+ this.radiusOfCircularMotionForProgressHead =
108
+ radiusOfProgressArcInProgressHeadViewBox -
109
+ widthOfArcInProgressHeadViewBox / 2;
110
+ }
111
+
112
+ renderedCallback() {
113
+ if (this.isRendered) {
114
+ return;
115
+ }
116
+ this.calculateRadiusOfCircularMotionForProgressHead();
117
+ this.isRendered = true;
118
+ }
119
+
120
+ get progressHeadCenter() {
121
+ // Note:- Formula is x = radius * Cosine(theta), y = radius * Sine(theta), and here
122
+ // arcX = Cosine(theta), arcY = Sine(theta) calculated already in the method "get d()"
123
+ const x = this.arcX * this.radiusOfCircularMotionForProgressHead;
124
+ const y = this.arcY * this.radiusOfCircularMotionForProgressHead;
125
+ return {
126
+ x,
127
+ y,
128
+ };
129
+ }
130
+
131
+ get isProgressHeadVisible() {
132
+ if (this.value > 0 && this.value < 100) {
133
+ return true;
134
+ }
135
+ return false;
136
+ }
137
+
45
138
  get d() {
46
139
  const fillPercent = this.value / 100;
47
140
  const filldrain = this.direction === 'drain' ? 1 : 0;
@@ -50,10 +143,12 @@ export default class progressRing extends LightningElement {
50
143
 
51
144
  const subCalc = 2 * Math.PI * fillPercent;
52
145
 
53
- const arcx = Math.cos(subCalc);
54
- const arcy = Math.sin(subCalc) * inverter;
146
+ // Note:- The formula is x = radius * Cosine(theta), y = radius * Sine(theta) with appropriate signs (+ / -), and
147
+ // here the radius is 1 unit implicitly as per the svg's viewBox attribute.
148
+ this.arcX = Math.cos(subCalc);
149
+ this.arcY = Math.sin(subCalc) * inverter;
55
150
 
56
- return `M 1 0 A 1 1 0 ${islong} ${filldrain} ${arcx} ${arcy} L 0 0`;
151
+ return `M 1 0 A 1 1 0 ${islong} ${filldrain} ${this.arcX} ${this.arcY} L 0 0`;
57
152
  }
58
153
 
59
154
  get iconSvg() {
@@ -33,12 +33,14 @@ export default class LightningProgressStep extends LightningElement {
33
33
 
34
34
  @track state = {};
35
35
 
36
- updateInternal(newStatus, newType, newIndex, newActive) {
36
+ updateInternal(newStatus, newType, newIndex, newActive, shouldFocus) {
37
37
  classListMutation(
38
38
  this.classList,
39
39
  this.computeClassSet(newType, newStatus, newActive)
40
40
  );
41
- if (newActive === true) {
41
+ // Added `shouldFocus` as fix for W-9862373
42
+ // This ensures progressStep is focused only when this argument is true.
43
+ if (newActive === true && shouldFocus) {
42
44
  this.focusPathLink();
43
45
  }
44
46
  this.state.status = newStatus;
@@ -85,7 +87,8 @@ export default class LightningProgressStep extends LightningElement {
85
87
  'slds-is-completed': !isPath && status === 'completed',
86
88
  'slds-has-error': !isPath && status === 'error',
87
89
  'slds-is-active':
88
- isActive === true || (type === 'base' && status === 'current'),
90
+ (type !== 'base' && isActive === true) ||
91
+ (type === 'base' && status === 'current'),
89
92
  'slds-path__item': isPath,
90
93
  'slds-is-complete': isPath && status === 'completed',
91
94
  'slds-is-current':
@@ -18,6 +18,7 @@
18
18
  placeholder={placeholder}
19
19
  disabled={disabled}
20
20
  readonly={readOnly}
21
+ required={required}
21
22
  items={items}
22
23
  input-text={displayValue}
23
24
  input-icon-name="utility:clock"
@@ -17,6 +17,7 @@ const ARIA_PROP_LIST = [
17
17
  'current',
18
18
  'describedAt',
19
19
  'describedBy',
20
+ 'description',
20
21
  'details',
21
22
  'disabled',
22
23
  'dropEffect',
@@ -105,3 +106,32 @@ export const ARIA = getAriaLookup(ARIA_PROP_LIST);
105
106
  * Useful for converting from normal aria properties to aria camel cased values
106
107
  */
107
108
  export const ARIA_TO_CAMEL = getAriaLookup(ARIA_PROP_LIST, 'cc');
109
+
110
+ /**
111
+ * Set either 'aria-describedby' or 'aria-description' value for accessibility
112
+ * based on the presence of 'description' api value and support of the newer ARIA
113
+ * 'aria-description'. At launch, Firefox, Safari do not support it (and IE11 never will).
114
+ * https://caniuse.com/mdn-api_element_ariadescription
115
+ * @private
116
+ * @returns {boolean} true indicates aria-description is supported; false, no support
117
+ */
118
+ // cached value, so check once and only once
119
+ let ariaDescriptionSupported = null;
120
+
121
+ export function isAriaDescriptionSupported() {
122
+ // return previously cached value, don't recheck
123
+ if (ariaDescriptionSupported !== null) {
124
+ return ariaDescriptionSupported;
125
+ }
126
+ // if not previously set, test for browser support
127
+ const testVal = 'test ability to set';
128
+ const span = document.createElement('span');
129
+ try {
130
+ span.ariaDescription = testVal;
131
+ const ariaDescVal = span.getAttribute(ARIA.DESCRIPTION);
132
+ ariaDescriptionSupported = testVal === ariaDescVal;
133
+ } catch (e) {
134
+ ariaDescriptionSupported = false;
135
+ }
136
+ return ariaDescriptionSupported;
137
+ }
@@ -15,6 +15,19 @@ class Foo extends LightningElement {
15
15
  this.ariaObserver = new ContentMutation(this);
16
16
  }
17
17
 
18
+ connectedCallback() {
19
+ if (!this.ariaObserver) {
20
+ this.ariaObserver = new ContentMutation(this);
21
+ }
22
+ }
23
+
24
+ disconnectedCallback() {
25
+ if (this.ariaObserver) {
26
+ this.ariaObserver.disconnect();
27
+ this.ariaObserver = undefined;
28
+ }
29
+ }
30
+
18
31
  @track ariaLabeledbyValue = '';
19
32
 
20
33
  @api
@@ -258,16 +271,25 @@ export class ContentMutation {
258
271
  // caching root ref
259
272
  this.root = this.template.host.getRootNode();
260
273
  // creating the observer once
261
- const mo = new MutationObserver(() => {
274
+ this.mo = new MutationObserver(() => {
262
275
  if (!this.component.isConnected) {
263
276
  return; // do nothing when the template is not connected
264
277
  }
265
278
  this.sync();
266
279
  });
267
- mo.observe(this.root, {
280
+ this.mo.observe(this.root, {
268
281
  characterData: true,
269
282
  childList: true,
270
283
  subtree: true,
271
284
  });
272
285
  }
286
+
287
+ disconnect() {
288
+ // MutationObservers must be disconnected manually when using @lwc/synthetic-shadow
289
+ // https://lwc.dev/guide/composition#:~:text=memory%20leak
290
+ if (this.mo) {
291
+ this.mo.disconnect();
292
+ this.mo = undefined;
293
+ }
294
+ }
273
295
  }
@@ -1,5 +1,5 @@
1
1
  export { assert } from './assert';
2
- export { ARIA, ARIA_TO_CAMEL } from './aria';
2
+ export { ARIA, ARIA_TO_CAMEL, isAriaDescriptionSupported } from './aria';
3
3
  export { EventEmitter } from './eventEmitter';
4
4
  export { toNorthAmericanPhoneNumber } from './phonify';
5
5
  export * from './linkUtils';
@@ -1,237 +0,0 @@
1
- <template>
2
- <span aria-live="polite">
3
- <span class={computedAriaLiveClassForNavMode}>{ariaLiveNavigationModeText}</span>
4
- <span class={computedAriaLiveClassForActionMode}>{ariaLiveActionModeText}</span>
5
- </span>
6
- <div lwc:dom="manual" class="dt-width-observer" style="width: 100%; height: 0px;"></div>
7
- <div class="dt-outer-container" style="height: 100%; position: relative;">
8
- <lightning-primitive-datatable-iedit-panel
9
- data-iedit-panel="true"
10
- visible={state.inlineEdit.isPanelVisible}
11
- row-key-value={state.inlineEdit.rowKeyValue}
12
- col-key-value={state.inlineEdit.colKeyValue}
13
- edited-value={state.inlineEdit.editedValue}
14
- column-def={state.inlineEdit.columnDef}
15
- is-mass-edit-enabled={state.inlineEdit.massEditEnabled}
16
- number-of-selected-rows={state.inlineEdit.massEditSelectedRows}
17
- resolved-type-attributes={state.inlineEdit.resolvedTypeAttributes}
18
- onieditfinished={handleInlineEditFinish}
19
- onmasscheckboxchange={handleMassCheckboxChange}
20
- ></lightning-primitive-datatable-iedit-panel>
21
- <div class={computedTableContainerClass} onscroll={handleHorizontalScroll} style={scrollerXStyles}>
22
- <div class="slds-scrollable_y" onscroll={handleVerticalScroll} style={computedScrollerStyle}>
23
- <table class={computedTableClass} role={computedTableRole} style={computedTableStyle}
24
- onkeydown={handleTableKeydown}
25
- onclick={handleCellClick}
26
- onfocusin={handleTableFocusIn}
27
- onfocusout={handleTableFocusOut}
28
- aria-label={ariaLabel}
29
- aria-labelledby={ariaLabelledBy}
30
- aria-rowcount={ariaRowCount}>
31
- <template if:false={hasValidKeyField}>
32
- <!-- empty since keyField wasn't provided -->
33
- </template>
34
- <template if:true={hasValidKeyField}>
35
- <thead class={computedTableHeaderClass}>
36
- <tr class="slds-line-height_reset"
37
- onprivateresizestart={handleResizeStart}
38
- onprivateresizeend={handleResizeEnd}>
39
- <template for:each={state.columns} for:item="def" for:index="colIndex">
40
- <th style={def.style}
41
- scope="col"
42
- tabindex={def.tabIndex}
43
- aria-label={def.ariaLabel}
44
- aria-sort={def.sortAriaLabel}
45
- key={def.colKeyValue}>
46
-
47
- <template if:true={def.fixedWidth}>
48
- <lightning-primitive-header-factory
49
- style={def.style}
50
- def={def}
51
- dt-context-id={privateDatatableId}
52
- key={def.colKeyValue}
53
- row-key-value="HEADER"
54
- col-key-value={def.colKeyValue}
55
- has-focus={def.hasFocus}
56
- column-width={def.columnWidth}
57
- col-index={colIndex}
58
- sortable={def.sortable}
59
- sorted={def.sorted}
60
- sorted-direction={def.sortedDirection}
61
- show-checkbox={showSelectAllCheckbox}
62
- actions={def.actions}>
63
- </lightning-primitive-header-factory>
64
- </template>
65
- <template if:false={def.fixedWidth}>
66
- <lightning-primitive-header-factory
67
- style={def.style}
68
- def={def}
69
- dt-context-id={privateDatatableId}
70
- key={def.colKeyValue}
71
- row-key-value="HEADER"
72
- col-key-value={def.colKeyValue}
73
- col-index={colIndex}
74
- resizable={hasResizebleColumns}
75
- sortable={def.sortable}
76
- sorted={def.sorted}
77
- sorted-direction={def.sortedDirection}
78
- has-focus={def.hasFocus}
79
- column-width={def.columnWidth}
80
- resizestep={state.resizeStep}
81
- actions={def.actions}>
82
- </lightning-primitive-header-factory>
83
- </template>
84
- </th>
85
- </template>
86
- </tr>
87
- </thead>
88
- <tbody style={computedTbodyStyle}>
89
- <template for:each={renderedRows} for:item="row" for:index="rowIndex">
90
- <tr class={row.classnames}
91
- onkeydown={handleTrRowKeyDown}
92
- key={row.key}
93
- data-row-key-value={row.key}
94
- aria-selected={row.ariaSelected}
95
- aria-level={row.level}
96
- aria-expanded={row.isExpanded}
97
- aria-setsize={row.setSize}
98
- aria-posinset={row.posInSet}
99
- tabindex={row.tabIndex}>
100
- <template for:each={row.cells} for:item="cell">
101
- <template if:true={cell.isCheckbox}>
102
- <td class={cell.class} role="gridcell" tabindex={cell.tabIndex} data-label={cell.dataLabel} key={cell.colKeyValue}>
103
- <lightning-primitive-cell-checkbox
104
- dt-context-id={privateDatatableId}
105
- has-focus={cell.hasFocus}
106
- data-label={cell.dataLabel}
107
- key={cell.key}
108
- row-key-value={row.key}
109
- col-key-value={cell.colKeyValue}
110
- row-index={rowIndex}
111
- type={row.inputType}
112
- is-selected={row.isSelected}
113
- is-disabled={row.isDisabled}
114
- column-header-id={computedCheckboxColumnHeaderId}>
115
- </lightning-primitive-cell-checkbox>
116
- </td>
117
- </template>
118
- <template if:true={cell.isDataTypeScope}>
119
- <th class={cell.class}
120
- style={cell.paddingStyle}
121
- aria-selected={cell.ariaSelected}
122
- aria-readonly={cell.ariaReadOnly}
123
- scope="row"
124
- tabindex={cell.tabIndex}
125
- data-label={cell.dataLabel}
126
- key={cell.colKeyValue}>
127
- <lightning-primitive-cell-factory
128
- types={privateTypes}
129
- aria-selected={cell.ariaSelected}
130
- data-label={cell.dataLabel}
131
- alignment={cell.alignment}
132
- has-error={cell.hasError}
133
- has-focus={cell.hasFocus}
134
- column-label={cell.dataLabel}
135
- column-type={cell.columnType}
136
- column-sub-type={cell.columnSubType}
137
- wrap-text={cell.wrapText}
138
- wrap-text-max-lines={cell.wrapTextMaxLines}
139
- key={cell.columnType}
140
- row-key-value={row.key}
141
- col-key-value={cell.colKeyValue}
142
- value={cell.value}
143
- icon-name={cell.iconName}
144
- icon-label={cell.iconLabel}
145
- icon-position={cell.iconPosition}
146
- icon-alternative-text={cell.iconAlternativeText}
147
- editable={cell.editable}
148
- display-read-only-icon={cell.displayReadOnlyIcon}
149
- type-attribute-0={cell.typeAttribute0}
150
- type-attribute-1={cell.typeAttribute1}
151
- type-attribute-2={cell.typeAttribute2}
152
- type-attribute-3={cell.typeAttribute3}
153
- type-attribute-4={cell.typeAttribute4}
154
- type-attribute-5={cell.typeAttribute5}
155
- type-attribute-6={cell.typeAttribute6}
156
- type-attribute-7={cell.typeAttribute7}
157
- type-attribute-8={cell.typeAttribute8}
158
- type-attribute-9={cell.typeAttribute9}
159
- type-attribute-10={cell.typeAttribute10}
160
- type-attribute-21={cell.typeAttribute21}
161
- type-attribute-22={cell.typeAttribute22}>
162
- </lightning-primitive-cell-factory>
163
- </th>
164
- </template>
165
- <template if:true={cell.isDataType}>
166
- <td
167
- class={cell.class}
168
- style={cell.paddingStyle}
169
- aria-selected={cell.ariaSelected}
170
- aria-readonly={cell.ariaReadOnly}
171
- role="gridcell"
172
- tabindex={cell.tabIndex}
173
- data-label={cell.dataLabel}
174
- key={cell.colKeyValue}>
175
- <lightning-primitive-cell-factory
176
- types={privateTypes}
177
- aria-selected={cell.ariaSelected}
178
- role="gridcell"
179
- data-label={cell.dataLabel}
180
- alignment={cell.alignment}
181
- has-focus={cell.hasFocus}
182
- has-error={cell.hasError}
183
- column-label={cell.dataLabel}
184
- column-type={cell.columnType}
185
- column-sub-type={cell.columnSubType}
186
- wrap-text={cell.wrapText}
187
- wrap-text-max-lines={cell.wrapTextMaxLines}
188
- key={cell.columnType}
189
- row-key-value={row.key}
190
- col-key-value={cell.colKeyValue}
191
- value={cell.value}
192
- icon-name={cell.iconName}
193
- icon-label={cell.iconLabel}
194
- icon-position={cell.iconPosition}
195
- icon-alternative-text={cell.iconAlternativeText}
196
- editable={cell.editable}
197
- display-read-only-icon={cell.displayReadOnlyIcon}
198
- type-attribute-0={cell.typeAttribute0}
199
- type-attribute-1={cell.typeAttribute1}
200
- type-attribute-2={cell.typeAttribute2}
201
- type-attribute-3={cell.typeAttribute3}
202
- type-attribute-4={cell.typeAttribute4}
203
- type-attribute-5={cell.typeAttribute5}
204
- type-attribute-6={cell.typeAttribute6}
205
- type-attribute-7={cell.typeAttribute7}
206
- type-attribute-8={cell.typeAttribute8}
207
- type-attribute-9={cell.typeAttribute9}
208
- type-attribute-10={cell.typeAttribute10}
209
- type-attribute-21={cell.typeAttribute21}
210
- type-attribute-22={cell.typeAttribute22}>
211
- </lightning-primitive-cell-factory>
212
- </td>
213
- </template>
214
- </template>
215
- </tr>
216
- </template>
217
- <template if:true={isLoading}>
218
- <tr>
219
- <td colspan={numberOfColumns} class="slds-is-relative">
220
- <lightning-primitive-datatable-loading-indicator></lightning-primitive-datatable-loading-indicator>
221
- </td>
222
- </tr>
223
- </template>
224
- </tbody>
225
- </template>
226
- </table>
227
- </div>
228
- </div>
229
- <template if:true={showStatusBar}>
230
- <lightning-primitive-datatable-status-bar
231
- error={tableError}
232
- onprivatesave={handleInlineEditSave}
233
- onprivatecancel={handleInlineEditCancel}
234
- ></lightning-primitive-datatable-status-bar>
235
- </template>
236
- </div>
237
- </template>
@@ -1,32 +0,0 @@
1
- /**
2
- * It creates a row key generator based on the keyField passed by the consumer
3
- * if the keyField does not point to a value row object passed in computeUniqueRowKey
4
- * it fallback to a generated key using indexes
5
- *
6
- * @param {String} keyField - keyField provided by the consumer
7
- * @returns {*} - Object with a computeUniqueRowKey method
8
- */
9
- export const createRowKeysGenerator = function (keyField) {
10
- let index = 0;
11
- return {
12
- computeUniqueRowKey(row) {
13
- if (row[keyField]) {
14
- return row[keyField];
15
- }
16
- return `row-${index++}`;
17
- },
18
- };
19
- };
20
-
21
- /**
22
- * It generate a unique column key value.
23
- *
24
- * @param {object} columnMetadata - the object for an specific column metadata
25
- * @param {int} index - optionally, the index of the column.
26
- * @returns {string} It generate the column key value based on the column field name and type.
27
- */
28
- export const generateColKeyValue = function (columnMetadata, index) {
29
- const prefix =
30
- columnMetadata.columnKey || columnMetadata.fieldName || index;
31
- return `${prefix}-${columnMetadata.type}-${index}`;
32
- };