lightning-base-components 1.19.7-alpha → 1.19.8-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 (43) hide show
  1. package/metadata/raptor.json +78 -0
  2. package/package.json +5 -1
  3. package/scopedImports/@salesforce-label-LightningProgressRing.progressRing.js +1 -0
  4. package/src/lightning/baseCombobox/baseCombobox.css +8 -0
  5. package/src/lightning/baseCombobox/baseCombobox.js +1 -0
  6. package/src/lightning/datatable/README.md +2 -1
  7. package/src/lightning/datatable/columnResizer.js +22 -18
  8. package/src/lightning/datatable/columnWidthManager.js +30 -22
  9. package/src/lightning/datatable/errors.js +2 -2
  10. package/src/lightning/datatable/infiniteLoading.js +13 -14
  11. package/src/lightning/datatable/sort.js +15 -16
  12. package/src/lightning/datatable/tree.js +10 -6
  13. package/src/lightning/datatable/types.js +158 -129
  14. package/src/lightning/datatable/utils.js +26 -24
  15. package/src/lightning/datatable/wrapText.js +15 -8
  16. package/src/lightning/input/input.html +23 -2
  17. package/src/lightning/input/input.js +54 -2
  18. package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +74 -69
  19. package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +8 -2
  20. package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +62 -87
  21. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.html +3 -0
  22. package/src/lightning/primitiveInputCheckbox/primitiveInputCheckbox.js +3 -0
  23. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.html +3 -0
  24. package/src/lightning/primitiveInputCheckboxButton/primitiveInputCheckboxButton.js +3 -0
  25. package/src/lightning/primitiveInputFile/primitiveInputFile.html +3 -0
  26. package/src/lightning/primitiveInputFile/primitiveInputFile.js +3 -0
  27. package/src/lightning/primitiveInputRadio/primitiveInputRadio.html +3 -0
  28. package/src/lightning/primitiveInputRadio/primitiveInputRadio.js +3 -0
  29. package/src/lightning/primitiveInputSimple/primitiveInputSimple.html +6 -0
  30. package/src/lightning/primitiveInputSimple/primitiveInputSimple.js +7 -19
  31. package/src/lightning/primitiveInputToggle/primitiveInputToggle.html +4 -1
  32. package/src/lightning/primitiveInputToggle/primitiveInputToggle.js +3 -0
  33. package/src/lightning/progressRing/progressRing.html +9 -7
  34. package/src/lightning/progressRing/progressRing.js +15 -0
  35. package/src/lightning/tabBar/tabBar.html +5 -1
  36. package/src/lightning/tabBar/tabBar.js +25 -9
  37. package/src/lightning/utils/classSet.js +19 -19
  38. package/src/lightning/utilsPrivate/aria.js +11 -8
  39. package/src/lightning/utilsPrivate/classListMutation.js +5 -3
  40. package/src/lightning/utilsPrivate/classSet.js +11 -0
  41. package/src/lightning/utilsPrivate/eventEmitter.js +4 -4
  42. package/src/lightning/utilsPrivate/inert.js +6 -4
  43. package/src/lightning/utilsPrivate/utilsPrivate.js +40 -8
@@ -629,6 +629,36 @@ export default class LightningInput extends LightningElement {
629
629
  */
630
630
  @api ariaHasPopup;
631
631
 
632
+ /**
633
+ * Specifies the value of the aria-keyshortcuts attribute
634
+ * @type {string}
635
+ */
636
+ @api ariaKeyShortcuts;
637
+
638
+ /**
639
+ * Specifies the value of the aria-disabled attribute
640
+ * @type {boolean}
641
+ */
642
+ @api ariaDisabled;
643
+
644
+ /**
645
+ * Specifies the value of the aria-roledescription attribute
646
+ * @type {string}
647
+ */
648
+ @api ariaRoleDescription;
649
+
650
+ /**
651
+ * Specifies the value of the aria-expanded attribute, only valid on type simple
652
+ * @type {string}
653
+ */
654
+ @api ariaExpanded;
655
+
656
+ /**
657
+ * Specifies the value of the aria-autocomplete, only valid on type simple
658
+ * @type {string}
659
+ */
660
+ @api ariaAutoComplete;
661
+
632
662
  /**
633
663
  * String value with the formatter to be used for number input. Valid values include
634
664
  * decimal, percent, percent-fixed, and currency.
@@ -919,7 +949,9 @@ export default class LightningInput extends LightningElement {
919
949
  if (subcomponent) {
920
950
  subcomponent.value = this._value;
921
951
  }
922
- } else if (
952
+ }
953
+
954
+ if (
923
955
  this._rendered &&
924
956
  this._inputElement.value !== this._displayedValue
925
957
  ) {
@@ -1117,6 +1149,26 @@ export default class LightningInput extends LightningElement {
1117
1149
  }
1118
1150
  }
1119
1151
 
1152
+ /**
1153
+ * The role set on lightning-primitive-input-simple to allow external developers to have a type="text"
1154
+ * and role="combobox" if lightning-combobox does not meet their requirements.
1155
+ * @type {string}
1156
+ */
1157
+ @api
1158
+ get role() {
1159
+ return this._role;
1160
+ }
1161
+
1162
+ set role(value) {
1163
+ if (value === 'combobox') {
1164
+ this._role = 'combobox';
1165
+ } else {
1166
+ console.warn(
1167
+ "<lightning-input> The role attribute value is invalid. Options are: 'combobox'"
1168
+ );
1169
+ }
1170
+ }
1171
+
1120
1172
  /**
1121
1173
  * Checks if the input is valid.
1122
1174
  * @returns {boolean} Indicates whether the element meets all constraint validations.
@@ -1724,7 +1776,7 @@ export default class LightningInput extends LightningElement {
1724
1776
  );
1725
1777
  }
1726
1778
 
1727
- handlePrimitiveInputSimpleChange(event) {
1779
+ handlePrimitiveInputChange(event) {
1728
1780
  this.interactingState.enter();
1729
1781
  this._updateValueAndValidityAttribute(event.detail.value);
1730
1782
  }
@@ -1,6 +1,6 @@
1
1
  import PrimitiveDatatableCell from 'lightning/primitiveDatatableCell';
2
2
  import { api } from 'lwc';
3
- import { classSet } from 'lightning/utils';
3
+ import { classSetToString } from 'lightning/utilsPrivate';
4
4
  import { toDate } from 'lightning/internationalizationLibrary';
5
5
  import cellWithStandardLayout from './cellWithStandardLayout.html';
6
6
  import bareCustomCell from './bareCustomCell.html';
@@ -19,18 +19,14 @@ const i18n = {
19
19
  false: labelFalse,
20
20
  };
21
21
 
22
- function isNumberedBasedType(cellType) {
22
+ function isSpreadComputedAlignment(computedAlignment) {
23
23
  return (
24
- cellType === 'currency' ||
25
- cellType === 'number' ||
26
- cellType === 'percent'
24
+ !computedAlignment ||
25
+ computedAlignment === 'left' ||
26
+ (computedAlignment !== 'center' && computedAlignment !== 'right')
27
27
  );
28
28
  }
29
29
 
30
- function isTypeCenteredByDefault(cellType) {
31
- return cellType === 'button-icon';
32
- }
33
-
34
30
  export default class PrivateCellFactory extends PrimitiveDatatableCell {
35
31
  @api types;
36
32
  @api alignment;
@@ -93,7 +89,7 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
93
89
  }
94
90
 
95
91
  getActionableElements() {
96
- const result = Array.prototype.slice.call(
92
+ const result = Array.from(
97
93
  this.template.querySelectorAll('[data-navigation="enable"]')
98
94
  );
99
95
 
@@ -161,7 +157,8 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
161
157
  get isRowNumber() {
162
158
  if (this.isType('rowNumber')) {
163
159
  const error = this.typeAttribute0;
164
- this._rowHasError = error && error.title && error.messages;
160
+ this._rowHasError =
161
+ error && error.title && error.messages ? true : false;
165
162
  return true;
166
163
  }
167
164
 
@@ -189,10 +186,11 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
189
186
  }
190
187
 
191
188
  isLtrType() {
189
+ const { columnType } = this;
192
190
  return (
193
- this.columnType === 'url' ||
194
- this.columnType === 'email' ||
195
- this.columnType === 'phone'
191
+ columnType === 'url' ||
192
+ columnType === 'email' ||
193
+ columnType === 'phone'
196
194
  );
197
195
  }
198
196
 
@@ -201,7 +199,8 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
201
199
  }
202
200
 
203
201
  get isCustomType() {
204
- return this.types && this.types.isCustomType(this.columnType);
202
+ const { types } = this;
203
+ return types ? types.isCustomType(this.columnType) : false;
205
204
  }
206
205
 
207
206
  /**
@@ -210,13 +209,19 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
210
209
  * but is also using a standard cell layout
211
210
  */
212
211
  get isEditable() {
213
- return this.editable && this.types.isEditableType(this.columnType);
212
+ const { types } = this;
213
+ if (types) {
214
+ return this.editable && types.isEditableType(this.columnType);
215
+ }
216
+ return false;
214
217
  }
215
218
 
216
219
  render() {
220
+ const { columnType, types } = this;
217
221
  if (
218
- this.isCustomType &&
219
- !this.types.isStandardCellLayoutForCustomType(this.columnType)
222
+ types &&
223
+ types.isCustomType(columnType) &&
224
+ !types.isStandardCellLayoutForCustomType(columnType)
220
225
  ) {
221
226
  return bareCustomCell;
222
227
  }
@@ -228,38 +233,42 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
228
233
  */
229
234
 
230
235
  get isSpreadAlignment() {
231
- const alignment = this.computedAlignment;
232
-
233
- return (
234
- !alignment ||
235
- alignment === 'left' ||
236
- (alignment !== 'center' && alignment !== 'right')
237
- );
236
+ return isSpreadComputedAlignment(this.computedAlignment);
238
237
  }
239
238
 
240
239
  // Note: this should be passed from above, but we dont have a defined architecture that lets customize / provide defaults
241
240
  // on cell attributes per type.
242
241
  get computedAlignment() {
243
- if (!this.alignment && isNumberedBasedType(this.columnType)) {
244
- return 'right';
242
+ const { alignment } = this;
243
+ if (alignment) {
244
+ return alignment;
245
245
  }
246
-
247
- if (!this.alignment && isTypeCenteredByDefault(this.columnType)) {
246
+ const { columnType } = this;
247
+ // is centered by default type
248
+ if (columnType === 'button-icon') {
248
249
  return 'center';
249
250
  }
250
-
251
- return this.alignment;
251
+ // is numbered based type
252
+ if (
253
+ columnType === 'currency' ||
254
+ columnType === 'number' ||
255
+ columnType === 'percent'
256
+ ) {
257
+ return 'right';
258
+ }
259
+ return alignment;
252
260
  }
253
261
 
254
262
  get hasLeftIcon() {
255
- return (
256
- this.iconName &&
257
- (!this.iconPosition || this.iconPosition === 'left')
258
- );
263
+ if (this.iconName) {
264
+ const { iconPosition } = this;
265
+ return !iconPosition || iconPosition === 'left';
266
+ }
267
+ return false;
259
268
  }
260
269
 
261
270
  get hasRightIcon() {
262
- return this.iconName && this.iconPosition === 'right';
271
+ return this.iconName ? this.iconPosition === 'right' : false;
263
272
  }
264
273
 
265
274
  get shouldDisplayReadOnlyIcon() {
@@ -267,20 +276,16 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
267
276
  }
268
277
 
269
278
  get computedCellDivClass() {
270
- return classSet()
271
- .add({
272
- 'slds-truncate':
273
- !this.isAction &&
274
- this.columnType !== 'button-icon' &&
275
- !this.wrapText,
276
- })
277
- .add({ 'slds-hyphenate': this.wrapText })
278
- .add({ 'slds-line-clamp': this.wrapText && this.wrapTextMaxLines })
279
- .add({
280
- 'ltr-content-in-rtl':
281
- document.dir === 'rtl' && this.isLtrType(),
282
- })
283
- .toString();
279
+ const { columnType, _wrapText } = this;
280
+ const isActionType =
281
+ 'action' === columnType || 'action' === this.columnSubType;
282
+ return classSetToString({
283
+ 'slds-truncate':
284
+ columnType !== 'button-icon' && !isActionType && !_wrapText,
285
+ 'slds-hyphenate': _wrapText,
286
+ 'slds-line-clamp': _wrapText && this.wrapTextMaxLines,
287
+ 'ltr-content-in-rtl': document.dir === 'rtl' && this.isLtrType(),
288
+ });
284
289
  }
285
290
 
286
291
  get computedMarginClassWhenLeftIconExists() {
@@ -288,17 +293,18 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
288
293
  }
289
294
 
290
295
  get computedWrapperClass() {
291
- const alignment = this.computedAlignment;
292
-
293
- return classSet('slds-grid')
294
- .add({
295
- 'slds-no-space': this.hasTreeData,
296
- 'slds-align_absolute-center': this.isAction,
297
- 'slds-grid_align-end': alignment === 'right',
298
- 'slds-grid_align-center': alignment === 'center',
299
- 'slds-grid_align-spread': this.isSpreadAlignment,
300
- })
301
- .toString();
296
+ const { columnType, computedAlignment } = this;
297
+ const isActionType =
298
+ 'action' === columnType || 'action' === this.columnSubType;
299
+ return classSetToString({
300
+ 'slds-grid': true,
301
+ 'slds-no-space': columnType === 'tree',
302
+ 'slds-align_absolute-center': isActionType,
303
+ 'slds-grid_align-end': computedAlignment === 'right',
304
+ 'slds-grid_align-center': computedAlignment === 'center',
305
+ 'slds-grid_align-spread':
306
+ isSpreadComputedAlignment(computedAlignment),
307
+ });
302
308
  }
303
309
 
304
310
  get computedRowNumberStyle() {
@@ -351,14 +357,14 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
351
357
  }
352
358
 
353
359
  get computedCssStyles() {
354
- if (this.wrapText && this.wrapTextMaxLines) {
360
+ if (this._wrapText && this.wrapTextMaxLines) {
355
361
  return `${'--lwc-lineClamp'}: ${this.wrapTextMaxLines}`;
356
362
  }
357
363
  return null;
358
364
  }
359
365
 
360
366
  get booleanCellAssistiveText() {
361
- return this.isChecked ? i18n.true : i18n.false;
367
+ return this.value ? i18n.true : i18n.false;
362
368
  }
363
369
 
364
370
  /**
@@ -390,16 +396,15 @@ export default class PrivateCellFactory extends PrimitiveDatatableCell {
390
396
 
391
397
  fireCellFocusByClickEvent() {
392
398
  let needsRefocusOnCellElement = false;
393
- const wrapperDiv = this.template.querySelector('div:first-child');
394
- const wrapperSpan = this.template.querySelector(
395
- 'span.slds-grid:first-child'
396
- );
397
- const activeElement = this.template.activeElement;
399
+ const { template } = this;
400
+ const { activeElement } = this.template;
398
401
  // pass a flag for IE11 to refocus on the cell element if the activeElement is not
399
402
  // something focusable in the cell or the cell td/th itself
400
403
  if (
401
404
  activeElement &&
402
- (activeElement === wrapperDiv || activeElement === wrapperSpan)
405
+ (activeElement === template.querySelector('div:first-child') ||
406
+ activeElement ===
407
+ template.querySelector('span.slds-grid:first-child'))
403
408
  ) {
404
409
  needsRefocusOnCellElement = true;
405
410
  }
@@ -31,12 +31,18 @@ export default class LightningPrimitiveDatatableStatusBar extends LightningEleme
31
31
 
32
32
  get showError() {
33
33
  const { error } = this;
34
- return error && (error.title || error.messages);
34
+ if (error && (error.title || error.messages)) {
35
+ return true;
36
+ }
37
+ return false;
35
38
  }
36
39
 
37
40
  get showErrorBubble() {
38
41
  const { error } = this;
39
- return error && error.showBubble;
42
+ if (error && error.showBubble) {
43
+ return true;
44
+ }
45
+ return false;
40
46
  }
41
47
 
42
48
  get bubbleOffset() {
@@ -7,13 +7,18 @@ import labelSortDesc from '@salesforce/label/LightningDatatable.sortDesc';
7
7
  import labelSortNone from '@salesforce/label/LightningDatatable.sortNone';
8
8
  import PrimitiveDatatableCell from 'lightning/primitiveDatatableCell';
9
9
  import { api, track } from 'lwc';
10
- import { classSet } from 'lightning/utils';
11
- import { classListMutation, isRTL, getRealDOMId } from 'lightning/utilsPrivate';
10
+ import {
11
+ classListMutation,
12
+ classSetToString,
13
+ getRealDOMId,
14
+ } from 'lightning/utilsPrivate';
12
15
 
13
16
  import selectable from './selectableHeader.html';
14
17
  import sortable from './sortableHeader.html';
15
18
  import nonsortable from './nonsortableHeader.html';
16
19
 
20
+ const SELECTABLE_HEADER_TYPE = 'SELECTABLE_CHECKBOX';
21
+
17
22
  const i18n = {
18
23
  chooseARow: labelChooseARow,
19
24
  chooseARowSelectAll: labelChooseARowSelectAll,
@@ -158,14 +163,14 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
158
163
  * @return {string} The computed inline styles
159
164
  */
160
165
  get columnStyles() {
161
- const outlineStyle = this.isSortable ? '' : 'outline:none;';
166
+ const { columnWidth } = this;
167
+ const outlineStyle = this._sortable ? '' : 'outline:none;';
162
168
 
163
169
  // In RTL, we need to explicitly position the column headers.
164
170
  // We do this by setting the offset (in pixels) from the start of the table.
165
- const offsetStyle = isRTL() ? `right: ${this.def.offset}px;` : '';
166
- const widthStyle = this.columnWidth
167
- ? `width: ${this.columnWidth}px;`
168
- : '';
171
+ const offsetStyle =
172
+ document.dir === 'rtl' ? `right: ${this._def.offset}px;` : '';
173
+ const widthStyle = columnWidth ? `width: ${columnWidth}px;` : '';
169
174
  const heightStyle = this._wrapTableHeader ? 'min-height: 3rem' : '';
170
175
 
171
176
  return `
@@ -176,27 +181,20 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
176
181
  `;
177
182
  }
178
183
 
179
- /**
180
- * Get th Action styles
181
- *
182
- * @return {string} The computed classes
183
- */
184
- get thActionStyles() {
185
- const heightStyle = this._wrapTableHeader ? 'min-height: 3rem' : '';
186
- return `
187
- ${heightStyle}
188
- `;
189
- }
190
-
191
184
  /**
192
185
  * Computes the classes for the column
193
186
  *
194
187
  * @return {string} The computed classes
195
188
  */
196
189
  get computedClass() {
197
- return classSet('slds-cell-fixed')
198
- .add({ 'slds-has-button-menu': this.hasActions })
199
- .toString();
190
+ const { actions } = this;
191
+ return classSetToString({
192
+ 'slds-cell-fixed': true,
193
+ 'slds-has-button-menu':
194
+ // inline hasActions
195
+ actions.customerActions.length > 0 ||
196
+ actions.internalActions.length > 0,
197
+ });
200
198
  }
201
199
 
202
200
  /**
@@ -205,11 +203,13 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
205
203
  * @return {string} The computed sort classes
206
204
  */
207
205
  get computedSortClass() {
208
- return classSet('slds-th__action slds-text-link_reset')
209
- .add({ 'slds-is-sorted': this.sorted })
210
- .add({ 'slds-is-sorted_asc': this.isAscSorted })
211
- .add({ 'slds-is-sorted_desc': this.isDescSorted })
212
- .toString();
206
+ const { sortedDirection } = this;
207
+ return classSetToString({
208
+ 'slds-th__action slds-text-link_reset': true,
209
+ 'slds-is-sorted': this.sorted,
210
+ 'slds-is-sorted_asc': sortedDirection === 'asc',
211
+ 'slds-is-sorted_desc': sortedDirection === 'desc',
212
+ });
213
213
  }
214
214
 
215
215
  /**
@@ -236,9 +236,10 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
236
236
  * @return {boolean} Whether the header has available actions
237
237
  */
238
238
  get hasActions() {
239
+ const { actions } = this;
239
240
  return (
240
- this.actions.customerActions.length > 0 ||
241
- this.actions.internalActions.length > 0
241
+ actions.customerActions.length > 0 ||
242
+ actions.internalActions.length > 0
242
243
  );
243
244
  }
244
245
 
@@ -259,25 +260,14 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
259
260
  * @return {string|boolean} The aria role for the header
260
261
  */
261
262
  get headerRole() {
262
- return this.isResizable || this.sortable ? 'button' : false;
263
- }
264
-
265
- /**
266
- * Determines if sort direction is set to ascending
267
- *
268
- * @return {boolean} Whether the sort direction is ascending
269
- */
270
- get isAscSorted() {
271
- return this.sortedDirection === 'asc';
272
- }
273
-
274
- /**
275
- * Determines if sort direction is set to descending
276
- *
277
- * @return {boolean} Whether the sort direction is descending
278
- */
279
- get isDescSorted() {
280
- return this.sortedDirection === 'desc';
263
+ if (
264
+ this._sortable ||
265
+ // inline isResizable
266
+ (this._resizable && this._def.resizable !== false)
267
+ ) {
268
+ return 'button';
269
+ }
270
+ return false;
281
271
  }
282
272
 
283
273
  /**
@@ -286,7 +276,7 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
286
276
  * @return {boolean} Whether the header is regular
287
277
  */
288
278
  get isRegularHeader() {
289
- return this.def.type !== 'SELECTABLE_CHECKBOX';
279
+ return this._def.type !== SELECTABLE_HEADER_TYPE;
290
280
  }
291
281
 
292
282
  /**
@@ -295,25 +285,7 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
295
285
  * @return {boolean} Whether the header is resizable
296
286
  */
297
287
  get isResizable() {
298
- return this.resizable && this.def.resizable !== false;
299
- }
300
-
301
- /**
302
- * Determines if the header is selectable
303
- *
304
- * @return {boolean} Whether the header is selectable
305
- */
306
- get isSelectableHeader() {
307
- return this.def.type === 'SELECTABLE_CHECKBOX';
308
- }
309
-
310
- /**
311
- * Determines if the header is sortable
312
- *
313
- * @return {boolean} Whether the header is sortable
314
- */
315
- get isSortable() {
316
- return this.sortable;
288
+ return this._resizable && this._def.resizable !== false;
317
289
  }
318
290
 
319
291
  /**
@@ -356,29 +328,28 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
356
328
  * By default, nonsortableHeader.html is rendered
357
329
  */
358
330
  render() {
359
- if (this.isSelectableHeader) {
331
+ if (this._def.type === SELECTABLE_HEADER_TYPE) {
360
332
  return selectable;
361
- } else if (this.sortable) {
333
+ } else if (this._sortable) {
362
334
  return sortable;
363
335
  }
364
336
  return nonsortable;
365
337
  }
366
338
 
367
339
  renderedCallback() {
368
- if (this.isSelectableHeader && this.showCheckbox) {
369
- this.updateBulkSelectionCheckbox();
370
- }
371
- if (this.isSelectableHeader) {
372
- const columnHeaderId = this.computedColumnHeaderId;
340
+ if (this._def.type === SELECTABLE_HEADER_TYPE) {
341
+ if (this.showCheckbox) {
342
+ this.updateBulkSelectionCheckbox();
343
+ }
373
344
  const columnHeaderEvent = new CustomEvent('privatecolumnheaderid', {
374
- detail: columnHeaderId,
345
+ detail: this.computedColumnHeaderId,
375
346
  });
376
347
  this.dispatchEvent(columnHeaderEvent);
377
348
  }
378
349
  }
379
350
 
380
351
  disconnectedCallback() {
381
- if (this.isSelectableHeader) {
352
+ if (this._def.type === SELECTABLE_HEADER_TYPE) {
382
353
  const columnHeaderEvent = new CustomEvent('privatecolumnheaderid', {
383
354
  detail: null,
384
355
  });
@@ -396,7 +367,7 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
396
367
  handleSortingClick(event) {
397
368
  event.preventDefault();
398
369
 
399
- if (this.isSortable) {
370
+ if (this._sortable) {
400
371
  event.stopPropagation();
401
372
  this.fireSortedColumn();
402
373
  this.fireCellFocusByClickEvent();
@@ -411,7 +382,7 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
411
382
  handleSelectAllRows() {
412
383
  const { rowKeyValue, colKeyValue } = this;
413
384
  const actionName =
414
- this.def.bulkSelection === 'none'
385
+ this._def.bulkSelection === 'none'
415
386
  ? 'selectallrows'
416
387
  : 'deselectallrows';
417
388
  // eslint-disable-next-line lightning-global/no-custom-event-identifier-arguments
@@ -432,12 +403,13 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
432
403
  * the details of the sort action
433
404
  */
434
405
  fireSortedColumn() {
406
+ const { columnKey, fieldName } = this._def;
435
407
  const event = new CustomEvent('privateupdatecolsort', {
436
408
  bubbles: true,
437
409
  composed: true,
438
410
  detail: {
439
- fieldName: this.def.fieldName,
440
- columnKey: this.def.columnKey,
411
+ columnKey,
412
+ fieldName,
441
413
  sortDirection: this.getTargetSortDirection(),
442
414
  },
443
415
  });
@@ -452,9 +424,11 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
452
424
  */
453
425
  updateElementClasses() {
454
426
  classListMutation(this.classList, {
455
- 'slds-is-sortable': this.isSortable,
456
- 'slds-is-resizable': this.isResizable,
457
- 'slds-assistive-text': this.hideHeader,
427
+ 'slds-is-sortable': this._sortable,
428
+ // inline isResizable
429
+ 'slds-is-resizable':
430
+ this._resizable && this._def.resizable !== false,
431
+ 'slds-assistive-text': this._hideHeader,
458
432
  });
459
433
  }
460
434
 
@@ -474,13 +448,14 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
474
448
  * Determines the state of the header "all" checkbox based on current selections
475
449
  */
476
450
  updateBulkSelectionCheckbox() {
451
+ const { bulkSelection } = this._def;
477
452
  const allCheckbox = this.template.querySelector(
478
453
  '.datatable-select-all'
479
454
  );
480
- allCheckbox.indeterminate = this.def.bulkSelection === 'some';
455
+ allCheckbox.indeterminate = bulkSelection === 'some';
481
456
 
482
457
  // Note: since we have to handle the indeterminate state,
483
- // this is to remove a raptor warning `Unneccessary update of property "checked"`
484
- allCheckbox.checked = !(this.def.bulkSelection === 'none');
458
+ // this is to remove a raptor warning `Unnecessary update of property "checked"`
459
+ allCheckbox.checked = !(bulkSelection === 'none');
485
460
  }
486
461
  }
@@ -20,6 +20,9 @@
20
20
  part="checkbox"
21
21
  id="checkbox"
22
22
  aria-label={ariaLabel}
23
+ aria-keyshortcuts={ariaKeyShortcuts}
24
+ aria-disabled={ariaDisabled}
25
+ aria-roledescription={ariaRoleDescription}
23
26
  aria-invalid={ariaInvalid}
24
27
  accesskey={accessKey}
25
28
  onblur={handleBlur}
@@ -18,6 +18,9 @@ export default class LightningPrimitiveInputCheckbox extends LightningElement {
18
18
  @api name;
19
19
  @api disabled;
20
20
  @api variant;
21
+ @api ariaKeyShortcuts;
22
+ @api ariaDisabled;
23
+ @api ariaRoleDescription;
21
24
 
22
25
  @api
23
26
  get checked() {
@@ -2,6 +2,9 @@
2
2
  <div class="slds-checkbox_add-button" part="input-checkbox-button">
3
3
  <input type="checkbox" id="checkbox-button"
4
4
  aria-label={ariaLabel}
5
+ aria-keyshortcuts={ariaKeyShortcuts}
6
+ aria-disabled={ariaDisabled}
7
+ aria-roledescription={ariaRoleDescription}
5
8
  aria-invalid={ariaInvalid}
6
9
  accesskey={accessKey}
7
10
  class="slds-assistive-text"