lightning-base-components 1.22.1-alpha → 1.22.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.
- package/README.md +2 -0
- package/metadata/raptor.json +38 -2
- package/package.json +12 -1
- package/scopedImports/@salesforce-label-LightningRecordPicker.actionIconAlternativeText.js +1 -0
- package/src/lightning/accordionSection/button.slds.css +8 -0
- package/src/lightning/ariaObserver/ariaObserver.js +1 -1
- package/src/lightning/baseCombobox/baseCombobox.html +1 -1
- package/src/lightning/baseCombobox/baseCombobox.js +1 -0
- package/src/lightning/baseCombobox/dropdown.slds.css +7 -7
- package/src/lightning/baseComboboxItem/card.lbc.native.css +1 -0
- package/src/lightning/baseComboboxItem/inline.lbc.native.css +1 -0
- package/src/lightning/button/button.slds.css +8 -0
- package/src/lightning/buttonIcon/button-icon.slds.css +8 -0
- package/src/lightning/buttonIcon/buttonIcon.js +29 -26
- package/src/lightning/buttonIconStateful/button-icon.slds.css +8 -0
- package/src/lightning/buttonIconStateful/button.slds.css +8 -0
- package/src/lightning/buttonMenu/button-icon.slds.css +8 -0
- package/src/lightning/buttonMenu/button.slds.css +8 -0
- package/src/lightning/buttonMenu/dropdown.slds.css +7 -7
- package/src/lightning/buttonStateful/button.slds.css +8 -0
- package/src/lightning/calendar/calendar.lbc.native.css +1 -0
- package/src/lightning/calendar/dropdown.slds.css +7 -7
- package/src/lightning/checkboxGroup/checkboxGroup.js +21 -10
- package/src/lightning/checkboxGroup/checkboxGroup.js-meta.xml +3 -0
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +1 -11
- package/src/lightning/combobox/combobox.html +1 -1
- package/src/lightning/datatable/__docs__/datatable.md +10 -5
- package/src/lightning/datatable/autoWidthStrategy.js +32 -44
- package/src/lightning/datatable/columnResizer.js +3 -2
- package/src/lightning/datatable/columnWidthManager.js +16 -10
- package/src/lightning/datatable/columns.js +4 -1
- package/src/lightning/datatable/datatable.js +108 -46
- package/src/lightning/datatable/infiniteLoading.js +8 -20
- package/src/lightning/datatable/inlineEdit.js +11 -6
- package/src/lightning/datatable/keyboard.js +58 -55
- package/src/lightning/datatable/resizeObserver.js +10 -5
- package/src/lightning/datatable/rows.js +3 -3
- package/src/lightning/datatable/rowsInlining.js +5 -4
- package/src/lightning/datatable/state.js +1 -2
- package/src/lightning/datatable/templates/div/div.html +150 -43
- package/src/lightning/datatable/templates/div/div.lbc.synthetic.css +8 -7
- package/src/lightning/datatable/templates/table/table.html +153 -46
- package/src/lightning/datatable/utils.js +10 -4
- package/src/lightning/datatable/virtualization.js +6 -4
- package/src/lightning/datatable/wrapText.js +16 -15
- package/src/lightning/groupedCombobox/groupedCombobox.js +21 -28
- package/src/lightning/helptext/button-icon.slds.css +8 -0
- package/src/lightning/helptext/helptext.html +2 -1
- package/src/lightning/helptext/helptext.js +0 -12
- package/src/lightning/input/input.html +0 -1
- package/src/lightning/interactiveDialogBase/button.slds.css +8 -0
- package/src/lightning/modal/__docs__/modal.md +2 -0
- package/src/lightning/modalBase/modalBase.html +2 -0
- package/src/lightning/modalBase/modalBase.js +30 -31
- package/src/lightning/modalBody/modalBody.html +1 -0
- package/src/lightning/modalBody/modalBody.js +3 -0
- package/src/lightning/modalFooter/modalFooter.html +5 -1
- package/src/lightning/modalFooter/modalFooter.js +3 -0
- package/src/lightning/modalHeader/modalHeader.html +4 -1
- package/src/lightning/modalHeader/modalHeader.js +3 -0
- package/src/lightning/overlayManager/overlayManager.js +1 -1
- package/src/lightning/pillContainer/button.slds.css +8 -0
- package/src/lightning/positionLibrary/elementProxy.js +13 -6
- package/src/lightning/positionLibrary/util.js +20 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +9 -4
- package/src/lightning/primitiveCellActions/primitiveCellActions.html +1 -0
- package/src/lightning/primitiveCellActions/primitiveCellActions.js +3 -5
- package/src/lightning/primitiveCellButton/primitiveCellButton.html +2 -0
- package/src/lightning/primitiveCellButton/primitiveCellButton.js +3 -5
- package/src/lightning/primitiveCellCheckbox/checkbox.html +3 -2
- package/src/lightning/primitiveCellCheckbox/primitiveCellCheckbox.js +6 -3
- package/src/lightning/primitiveCellCheckbox/radio.html +5 -4
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.html +1 -1
- package/src/lightning/primitiveCellEditableButton/primitiveCellEditableButton.js +1 -1
- package/src/lightning/primitiveCellFactory/bareCustomCell.html +1 -0
- package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +1 -0
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -6
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.html +1 -0
- package/src/lightning/primitiveColumnSorter/primitiveColumnSorter.js +1 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.html +3 -1
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +3 -3
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.html +1 -0
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +1 -3
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.html +1 -0
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.html +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.js +1 -1
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +2 -0
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.js +2 -4
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +43 -13
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +3 -2
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +8 -3
- package/src/lightning/primitiveHeaderFactory/sortingMenuHeader.html +1 -1
- package/src/lightning/primitiveIcon/primitiveIcon.css +0 -1
- package/src/lightning/primitiveInputFile/button.slds.css +8 -0
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.html +4 -2
- package/src/lightning/primitiveResizeHandler/primitiveResizeHandler.js +2 -2
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.html +1 -1
- package/src/lightning/primitiveTreegridCellToggle/primitiveTreegridCellToggle.js +1 -1
- package/src/lightning/progressIndicator/progressIndicator.css +1 -1
- package/src/lightning/progressIndicator/progressIndicator.js +14 -6
- package/src/lightning/progressIndicator/progressIndicator.js-meta.xml +3 -0
- package/src/lightning/progressIndicator/progressIndicator.lbc.native.css +2 -0
- package/src/lightning/progressStep/__examples__/basic/basic.html +11 -0
- package/src/lightning/progressStep/__examples__/basic/basic.js +3 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.html +11 -0
- package/src/lightning/progressStep/__examples__/shaded/shaded.js +3 -0
- package/src/lightning/progressStep/base.html +2 -1
- package/src/lightning/progressStep/progressStep.css +1 -0
- package/src/lightning/progressStep/progressStep.js +40 -29
- package/src/lightning/progressStep/progressStep.js-meta.xml +3 -0
- package/src/lightning/progressStep/progressStep.lbc.native.css +3 -0
- package/src/lightning/sldsCommon/sldsCommon.css +1 -1
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +6 -4
- package/src/lightning/tabBar/tab-bar.slds.css +17 -3
- package/src/lightning/tile/mediaTile.css +2 -0
- package/src/lightning/tile/standardTile.css +2 -1
- package/src/lightning/tile/tile.js +5 -2
- package/src/lightning/tile/tile.js-meta.xml +3 -0
- package/src/lightning/tile/tile.lbc.native.css +4 -0
- package/src/lightning/toast/button-icon.slds.css +8 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +15 -4
- package/src/lightning/utilsPrivate/utilsPrivate.js +4 -4
- package/src/lightning/verticalNavigationOverflow/button.slds.css +8 -0
- package/src/lightning/primitiveIcon/primitiveIcon.lbc.synthetic.css +0 -9
- /package/src/lightning/tile/{standardTile.lbc.synthetic.css → tile.lbc.synthetic.css} +0 -0
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
synchronizeAttrs,
|
|
6
6
|
getRealDOMId,
|
|
7
7
|
classListMutation,
|
|
8
|
+
isCSR,
|
|
8
9
|
} from 'lightning/utilsPrivate';
|
|
9
10
|
import {
|
|
10
11
|
FieldConstraintApi,
|
|
@@ -25,6 +26,8 @@ const DEBOUNCE_PERIOD = 200;
|
|
|
25
26
|
* A checkbox group that enables selection of single or multiple options.
|
|
26
27
|
*/
|
|
27
28
|
export default class LightningCheckboxGroup extends LightningElement {
|
|
29
|
+
static validationOptOut = ['class'];
|
|
30
|
+
|
|
28
31
|
static delegatesFocus = true;
|
|
29
32
|
|
|
30
33
|
/**
|
|
@@ -98,7 +101,7 @@ export default class LightningCheckboxGroup extends LightningElement {
|
|
|
98
101
|
}
|
|
99
102
|
|
|
100
103
|
get fieldsetElement() {
|
|
101
|
-
return this.template.querySelector('fieldset');
|
|
104
|
+
return isCSR ? this.template.querySelector('fieldset') : null;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
renderedCallback() {
|
|
@@ -207,7 +210,7 @@ export default class LightningCheckboxGroup extends LightningElement {
|
|
|
207
210
|
*/
|
|
208
211
|
@api
|
|
209
212
|
checkValidity() {
|
|
210
|
-
return this._constraint.checkValidity();
|
|
213
|
+
return isCSR ? this._constraint.checkValidity() : null;
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
/**
|
|
@@ -218,9 +221,12 @@ export default class LightningCheckboxGroup extends LightningElement {
|
|
|
218
221
|
@api
|
|
219
222
|
reportValidity() {
|
|
220
223
|
// required to make sure the sync happens after the render
|
|
221
|
-
|
|
222
|
-
this.
|
|
223
|
-
|
|
224
|
+
if (isCSR) {
|
|
225
|
+
return this._constraint.reportValidity((message) => {
|
|
226
|
+
this._helpMessage = message;
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
return null;
|
|
224
230
|
}
|
|
225
231
|
|
|
226
232
|
/**
|
|
@@ -242,8 +248,11 @@ export default class LightningCheckboxGroup extends LightningElement {
|
|
|
242
248
|
}
|
|
243
249
|
|
|
244
250
|
get computedUniqueHelpElementId() {
|
|
245
|
-
|
|
246
|
-
|
|
251
|
+
if (isCSR) {
|
|
252
|
+
const helpElement = this.template.querySelector('[data-helptext]');
|
|
253
|
+
return getRealDOMId(helpElement);
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
247
256
|
}
|
|
248
257
|
|
|
249
258
|
/**
|
|
@@ -251,9 +260,11 @@ export default class LightningCheckboxGroup extends LightningElement {
|
|
|
251
260
|
*/
|
|
252
261
|
@api
|
|
253
262
|
focus() {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
firstCheckbox
|
|
263
|
+
if (isCSR) {
|
|
264
|
+
const firstCheckbox = this.template.querySelector('input');
|
|
265
|
+
if (firstCheckbox) {
|
|
266
|
+
firstCheckbox.focus();
|
|
267
|
+
}
|
|
257
268
|
}
|
|
258
269
|
}
|
|
259
270
|
|
|
@@ -5,7 +5,7 @@ import labelDoneButton from '@salesforce/label/LightningColorPicker.doneButton';
|
|
|
5
5
|
import { api, track } from 'lwc';
|
|
6
6
|
import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
|
|
7
7
|
import { classSet } from 'lightning/utils';
|
|
8
|
-
import { keyCodes
|
|
8
|
+
import { keyCodes } from 'lightning/utilsPrivate';
|
|
9
9
|
|
|
10
10
|
const i18n = {
|
|
11
11
|
cancelButton: labelCancelButton,
|
|
@@ -26,16 +26,6 @@ export default class LightningColorPickerPanel extends LightningShadowBaseClass
|
|
|
26
26
|
this._selectedColor = this.currentColor || DEFAULT_COLOR;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
renderedCallback() {
|
|
30
|
-
// W-14600421 bug fix: prevent panel from falling outside user focus,
|
|
31
|
-
// like when viewports are too small
|
|
32
|
-
if (isCSR && typeof document.body.scrollIntoView === 'function') {
|
|
33
|
-
this.template
|
|
34
|
-
.querySelector('lightning-color-picker-custom')
|
|
35
|
-
.scrollIntoView();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
29
|
get i18n() {
|
|
40
30
|
return i18n;
|
|
41
31
|
}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
variant={variant}></lightning-base-combobox>
|
|
35
35
|
</div>
|
|
36
36
|
<template if:true={_helpMessage}>
|
|
37
|
-
<div id="help-text" data-help-text class="slds-form-element__help" aria-live="
|
|
37
|
+
<div id="help-text" data-help-text class="slds-form-element__help" aria-live="polite">{_helpMessage}</div>
|
|
38
38
|
</template>
|
|
39
39
|
</div>
|
|
40
40
|
</template>
|
|
@@ -1260,12 +1260,17 @@ To return the name of the action, use the `event.target.action.name` property.
|
|
|
1260
1260
|
|
|
1261
1261
|
Each row header renders with an `aria-label` attribute with the labels you provide for the column definition. By default, the row number column renders with `aria-label="Row Number"` and cannot be changed. When row selection is enabled, each row renders with `aria-selected` set to true or false depending on whether the row is selected. Each cell renders with a `gridcell` role.
|
|
1262
1262
|
|
|
1263
|
-
Use the following `aria` attributes on `lightning-datatable` to provide a caption or description on your table for assistive technologies. These attributes are rendered on the `<table>` element.
|
|
1263
|
+
Use the following `aria` attributes on `lightning-datatable` to provide a caption or description on your table for assistive technologies. These attributes are rendered on the `<table>` element.
|
|
1264
1264
|
|
|
1265
|
-
| Attribute
|
|
1266
|
-
|
|
|
1267
|
-
| aria-label
|
|
1268
|
-
| aria-
|
|
1265
|
+
| Attribute | Type | Description |
|
|
1266
|
+
| ---------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1267
|
+
| aria-label | string | Provides an assistive label to identify a table from other tables on a page. |
|
|
1268
|
+
| aria-describedby | ID reference list | Specifies the ID or space-separated list of IDs that describes the current element. |
|
|
1269
|
+
| aria-labelledby | ID reference list | Specifies the ID or space-separated list of IDs of the element or elements that contain visible descriptive text to caption or describe the table. |
|
|
1270
|
+
|
|
1271
|
+
When using `aria-label`, consider using `aria-describedby` to provide supplemental information. We don't recommend using `aria-label` together with `aria-labelledby`. When there's visible text that labels an element, consider using `aria-labelledby` instead of `aria-label`.
|
|
1272
|
+
|
|
1273
|
+
If you use `aria-describedby`, the element that provides the description doesn't need to be visible. For more information, see [MDN web docs: aria-describedby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-describedby).
|
|
1269
1274
|
|
|
1270
1275
|
##### Provide an Accessible Label for the Table
|
|
1271
1276
|
|
|
@@ -19,27 +19,27 @@ function getTotalColumnWidth(columnWidths) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Determines
|
|
22
|
+
* Determines the new width of a column of after removing a set amount
|
|
23
23
|
*
|
|
24
24
|
* @param {Number} currentWidth The current width of the column in pixels
|
|
25
25
|
* @param {Number} widthToRemove The proposed amount of width to remove in pixels
|
|
26
26
|
* @param {Number} minColumnWidth The minimum width the column can be in pixels
|
|
27
|
-
* @returns {
|
|
27
|
+
* @returns {Number} The new width of the column in pixels
|
|
28
28
|
*/
|
|
29
|
-
function
|
|
30
|
-
return currentWidth - widthToRemove
|
|
29
|
+
function getReducedWidth(currentWidth, widthToRemove, minColumnWidth) {
|
|
30
|
+
return Math.max(currentWidth - widthToRemove, minColumnWidth);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Determines
|
|
34
|
+
* Determines the new width of a column of after adding a set amount
|
|
35
35
|
*
|
|
36
36
|
* @param {Number} currentWidth The current width of the column in pixels
|
|
37
|
-
* @param {Number}
|
|
37
|
+
* @param {Number} widthToRemove The proposed amount of width to add in pixels
|
|
38
38
|
* @param {Number} maxColumnWidth The maximum width the column can be in pixels
|
|
39
|
-
* @returns {
|
|
39
|
+
* @returns {Number} The new width of the column in pixels
|
|
40
40
|
*/
|
|
41
|
-
function
|
|
42
|
-
return currentWidth + widthToAdd
|
|
41
|
+
function getEnlargedWidth(currentWidth, widthToAdd, maxColumnWidth) {
|
|
42
|
+
return Math.min(currentWidth + widthToAdd, maxColumnWidth);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -397,17 +397,13 @@ export class AutoWidthStrategy {
|
|
|
397
397
|
for (let i = 0; i < colsWithMinWidthLength; i += 1) {
|
|
398
398
|
const colIndex = colsWithMinWidth[i];
|
|
399
399
|
const currentWidth = columnWidths[colIndex];
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const newWidth = currentWidth + extraWidthPerColumn;
|
|
408
|
-
columnWidthsSum += extraWidthPerColumn;
|
|
409
|
-
columnWidths[colIndex] = newWidth;
|
|
410
|
-
}
|
|
400
|
+
const newWidth = getEnlargedWidth(
|
|
401
|
+
currentWidth,
|
|
402
|
+
extraWidthPerColumn,
|
|
403
|
+
maxColumnWidth
|
|
404
|
+
);
|
|
405
|
+
columnWidthsSum += newWidth - currentWidth;
|
|
406
|
+
columnWidths[colIndex] = newWidth;
|
|
411
407
|
}
|
|
412
408
|
}
|
|
413
409
|
|
|
@@ -428,16 +424,13 @@ export class AutoWidthStrategy {
|
|
|
428
424
|
for (let colIndex = 0; colIndex < colCount; colIndex += 1) {
|
|
429
425
|
const col = columns[colIndex];
|
|
430
426
|
const currentWidth = columnWidths[colIndex];
|
|
431
|
-
if (
|
|
432
|
-
|
|
433
|
-
canAddWidth(
|
|
427
|
+
if (!getColumnWidth(col)) {
|
|
428
|
+
const newWidth = getEnlargedWidth(
|
|
434
429
|
currentWidth,
|
|
435
430
|
extraWidthPerColumn,
|
|
436
431
|
maxColumnWidth
|
|
437
|
-
)
|
|
438
|
-
|
|
439
|
-
const newWidth = currentWidth + extraWidthPerColumn;
|
|
440
|
-
columnWidthsSum += extraWidthPerColumn;
|
|
432
|
+
);
|
|
433
|
+
columnWidthsSum += newWidth - currentWidth;
|
|
441
434
|
columnWidths[colIndex] = newWidth;
|
|
442
435
|
}
|
|
443
436
|
}
|
|
@@ -474,17 +467,13 @@ export class AutoWidthStrategy {
|
|
|
474
467
|
for (let i = 0, { length } = colsWithMaxWidth; i < length; i += 1) {
|
|
475
468
|
const colIndex = colsWithMaxWidth[i];
|
|
476
469
|
const currentWidth = columnWidths[colIndex];
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
const newWidth = currentWidth - extraWidthPerColumn;
|
|
485
|
-
columnWidthsSum -= extraWidthPerColumn;
|
|
486
|
-
columnWidths[colIndex] = newWidth;
|
|
487
|
-
}
|
|
470
|
+
const newWidth = getReducedWidth(
|
|
471
|
+
currentWidth,
|
|
472
|
+
extraWidthPerColumn,
|
|
473
|
+
minColumnWidth
|
|
474
|
+
);
|
|
475
|
+
columnWidthsSum -= currentWidth - newWidth;
|
|
476
|
+
columnWidths[colIndex] = newWidth;
|
|
488
477
|
}
|
|
489
478
|
}
|
|
490
479
|
|
|
@@ -508,15 +497,14 @@ export class AutoWidthStrategy {
|
|
|
508
497
|
const currentWidth = columnWidths[colIndex];
|
|
509
498
|
if (
|
|
510
499
|
!colsWithMinWidth.includes(colIndex) &&
|
|
511
|
-
!getColumnWidth(col)
|
|
512
|
-
|
|
500
|
+
!getColumnWidth(col)
|
|
501
|
+
) {
|
|
502
|
+
const newWidth = getReducedWidth(
|
|
513
503
|
currentWidth,
|
|
514
504
|
extraWidthPerColumn,
|
|
515
505
|
minColumnWidth
|
|
516
|
-
)
|
|
517
|
-
|
|
518
|
-
const newWidth = currentWidth - extraWidthPerColumn;
|
|
519
|
-
columnWidthsSum -= extraWidthPerColumn;
|
|
506
|
+
);
|
|
507
|
+
columnWidthsSum -= currentWidth - newWidth;
|
|
520
508
|
columnWidths[colIndex] = newWidth;
|
|
521
509
|
}
|
|
522
510
|
}
|
|
@@ -150,10 +150,11 @@ export function getCustomerColumnWidths(columns, widthsData) {
|
|
|
150
150
|
* It returns if table is rendered and not hidden.
|
|
151
151
|
*
|
|
152
152
|
* @param {Node} template - The datatable template
|
|
153
|
+
* @param {Object} refs - The datatable refs
|
|
153
154
|
* @returns {boolean} - Whether the datatable is rendered and not hidden on the page
|
|
154
155
|
*/
|
|
155
|
-
export function isTableRenderedVisible(template) {
|
|
156
|
-
const scrollerY = getScrollerY(template);
|
|
156
|
+
export function isTableRenderedVisible(template, refs) {
|
|
157
|
+
const scrollerY = getScrollerY(template, refs);
|
|
157
158
|
return (
|
|
158
159
|
scrollerY &&
|
|
159
160
|
!!(
|
|
@@ -156,10 +156,11 @@ export class ColumnWidthManager {
|
|
|
156
156
|
* Adjusts all the column sizes based on the supplied widths data.
|
|
157
157
|
*
|
|
158
158
|
* @param {Node} template The datatable template
|
|
159
|
+
* @param {Object} refs The datatable refs
|
|
159
160
|
* @param {Array} columns The column definitions
|
|
160
161
|
* @param {Object} widthsData The widths data object
|
|
161
162
|
*/
|
|
162
|
-
adjustColumnsSize(template, columns, widthsData) {
|
|
163
|
+
adjustColumnsSize(template, refs, columns, widthsData) {
|
|
163
164
|
const {
|
|
164
165
|
columnWidthStrategy,
|
|
165
166
|
isAutoResizingUpdateQueued,
|
|
@@ -170,9 +171,9 @@ export class ColumnWidthManager {
|
|
|
170
171
|
// If table is hidden when updating and `ResizeObserver` is not available,
|
|
171
172
|
// then updating sizes causes min widths to be set.
|
|
172
173
|
// Hence, the check if ok update from DOM.
|
|
173
|
-
if (this.shouldResizeWithUpdate(template, widthsData)) {
|
|
174
|
+
if (this.shouldResizeWithUpdate(template, refs, widthsData)) {
|
|
174
175
|
adjustedWidths = columnWidthStrategy.getAdjustedColumnWidths(
|
|
175
|
-
this.getDatatableInterface(template),
|
|
176
|
+
this.getDatatableInterface(template, refs),
|
|
176
177
|
columns,
|
|
177
178
|
isAutoResizingUpdateQueued
|
|
178
179
|
);
|
|
@@ -193,12 +194,13 @@ export class ColumnWidthManager {
|
|
|
193
194
|
* Adjusts all the column widths after a resize happens.
|
|
194
195
|
*
|
|
195
196
|
* @param {Node} template The datatable template
|
|
197
|
+
* @param {Object} refs The datatable refs
|
|
196
198
|
* @param {Array} columns The column definitions
|
|
197
199
|
* @param {Object} widthsData The widths data object
|
|
198
200
|
*/
|
|
199
|
-
adjustColumnsSizeAfterResize(
|
|
201
|
+
adjustColumnsSizeAfterResize(dt, columns, widthsData) {
|
|
200
202
|
const adjustedWidths = this.columnWidthStrategy.getAdjustedColumnWidths(
|
|
201
|
-
this.getDatatableInterface(template),
|
|
203
|
+
this.getDatatableInterface(dt.template, dt.refs),
|
|
202
204
|
columns
|
|
203
205
|
);
|
|
204
206
|
updateColumnWidths(columns, widthsData, adjustedWidths);
|
|
@@ -346,14 +348,15 @@ export class ColumnWidthManager {
|
|
|
346
348
|
* Determines if a column should resize with an update.
|
|
347
349
|
*
|
|
348
350
|
* @param {Node} template The datatable template
|
|
351
|
+
* @param {Object} refs The datatable refs
|
|
349
352
|
* @param {Object} widthsData The source widths data
|
|
350
353
|
* @returns {Boolean} Whether the column should resize with an update
|
|
351
354
|
*/
|
|
352
|
-
shouldResizeWithUpdate(template, widthsData) {
|
|
355
|
+
shouldResizeWithUpdate(template, refs, widthsData) {
|
|
353
356
|
if (widthsData.columnWidths.length > 0) {
|
|
354
357
|
// Can resize from DOM when table is visible.
|
|
355
358
|
// Otherwise, only when `ResizeObserver` is available in browser.
|
|
356
|
-
return isTableRenderedVisible(template);
|
|
359
|
+
return isTableRenderedVisible(template, refs);
|
|
357
360
|
}
|
|
358
361
|
return true;
|
|
359
362
|
}
|
|
@@ -362,12 +365,13 @@ export class ColumnWidthManager {
|
|
|
362
365
|
* Retrieves the datatable interface from the DOM
|
|
363
366
|
*
|
|
364
367
|
* @param {Node} template The datatable template
|
|
368
|
+
* @param {Object} refs The datatable refs
|
|
365
369
|
* @returns {Object} The datatable interface
|
|
366
370
|
*/
|
|
367
|
-
getDatatableInterface(template) {
|
|
371
|
+
getDatatableInterface(template, refs) {
|
|
368
372
|
return {
|
|
369
373
|
getAvailableWidthFromDom() {
|
|
370
|
-
const scrollerX = getScrollerX(template);
|
|
374
|
+
const scrollerX = getScrollerX(template, refs);
|
|
371
375
|
return scrollerX.offsetWidth;
|
|
372
376
|
},
|
|
373
377
|
getDataCellWidths() {
|
|
@@ -395,7 +399,9 @@ export class ColumnWidthManager {
|
|
|
395
399
|
return result;
|
|
396
400
|
},
|
|
397
401
|
getTableElementWidth() {
|
|
398
|
-
|
|
402
|
+
const elem =
|
|
403
|
+
refs?.tableElement || template.querySelector('.slds-table');
|
|
404
|
+
return elem.offsetWidth;
|
|
399
405
|
},
|
|
400
406
|
};
|
|
401
407
|
}
|
|
@@ -273,11 +273,14 @@ export function setColumns(state, rawColumns, types) {
|
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
// partially inline updateHeaderInternalActions from datatable/headerActions
|
|
276
|
+
// change alignment for last col and second-to-last col when last col is
|
|
277
|
+
// has a fixedWith under 100 (this includes action columns)
|
|
276
278
|
const { actions } = normCol;
|
|
277
279
|
normCol.actions = {
|
|
278
280
|
menuAlignment:
|
|
279
281
|
normCol.isLastCol ||
|
|
280
|
-
normalizedColumns[colIndex + 1].type === 'action'
|
|
282
|
+
normalizedColumns[colIndex + 1].type === 'action' ||
|
|
283
|
+
normalizedColumns[colIndex + 1].fixedWidth < 100
|
|
281
284
|
? 'auto-right'
|
|
282
285
|
: 'auto-left',
|
|
283
286
|
customerActions: Array.isArray(actions) ? actions : [],
|