lightning-base-components 1.21.9-alpha → 1.22.2-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/metadata/raptor.json +9 -0
- package/package.json +3 -5
- package/scopedImports/@salesforce-internal-core.appVersion.js +1 -1
- package/src/lightning/accordionSection/button.slds.css +18 -10
- package/src/lightning/baseCombobox/dropdown.slds.css +7 -7
- package/src/lightning/baseCombobox/input-text.slds.css +7 -6
- package/src/lightning/baseComboboxFormattedText/baseComboboxFormattedText.js-meta.xml +1 -1
- package/src/lightning/button/button.slds.css +18 -10
- package/src/lightning/buttonIcon/button-icon.slds.css +23 -15
- package/src/lightning/buttonIcon/buttonIcon.js +29 -26
- package/src/lightning/buttonIconStateful/button-icon.slds.css +23 -15
- package/src/lightning/buttonIconStateful/button.slds.css +18 -10
- package/src/lightning/buttonMenu/button-icon.slds.css +23 -15
- package/src/lightning/buttonMenu/button.slds.css +18 -10
- package/src/lightning/buttonMenu/dropdown.slds.css +7 -7
- package/src/lightning/buttonStateful/button-stateful.slds.css +23 -0
- package/src/lightning/buttonStateful/button.slds.css +18 -10
- package/src/lightning/buttonStateful/buttonStateful.js-meta.xml +3 -0
- package/src/lightning/calendar/calendar.lbc.native.css +1 -0
- package/src/lightning/calendar/calendar.slds.css +13 -10
- package/src/lightning/calendar/dropdown.slds.css +7 -7
- package/src/lightning/calendar/keyboard.js +11 -3
- package/src/lightning/colorPickerCustom/input-text.slds.css +7 -6
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +1 -11
- package/src/lightning/combobox/combobox.html +1 -1
- package/src/lightning/combobox/combobox.js +5 -13
- package/src/lightning/combobox/form-element.slds.css +1 -1
- package/src/lightning/datatable/__examples__/withVirtualization/withVirtualization.js +0 -1
- package/src/lightning/datatable/autoWidthStrategy.js +32 -44
- package/src/lightning/datatable/columns.js +4 -1
- package/src/lightning/datatable/datatable.js +15 -34
- package/src/lightning/datatable/keyboard.js +13 -12
- package/src/lightning/datatable/renderManager.js +1 -3
- package/src/lightning/datatable/rows.js +17 -9
- package/src/lightning/datatable/state.js +0 -1
- package/src/lightning/datatable/virtualization.js +11 -14
- package/src/lightning/datepicker/form-element.slds.css +1 -1
- package/src/lightning/datepicker/input-text.slds.css +7 -6
- package/src/lightning/datetimepicker/form-element.slds.css +1 -1
- package/src/lightning/datetimepicker/input-text.slds.css +7 -6
- package/src/lightning/dualListbox/form-element.slds.css +1 -1
- package/src/lightning/formattedAddress/formattedAddress.js +3 -2
- package/src/lightning/formattedDateTime/formattedDateTime.js +3 -2
- package/src/lightning/formattedDateTime/formattedDateTime.js-meta.xml +1 -1
- package/src/lightning/formattedLocation/formattedLocation.js +3 -2
- package/src/lightning/formattedPhone/formattedPhone.js +3 -2
- package/src/lightning/formattedTime/formattedTime.js +3 -2
- package/src/lightning/formattedUrl/formattedUrl.js +3 -2
- package/src/lightning/groupedCombobox/form-element.slds.css +1 -1
- package/src/lightning/groupedCombobox/groupedCombobox.js +21 -28
- package/src/lightning/groupedCombobox/input-text.slds.css +7 -6
- package/src/lightning/helptext/button-icon.slds.css +23 -15
- package/src/lightning/helptext/form-element.slds.css +1 -1
- package/src/lightning/helptext/helptext.html +2 -1
- package/src/lightning/helptext/helptext.js +0 -12
- package/src/lightning/helptext/helptext.js-meta.xml +3 -0
- package/src/lightning/input/form-element.slds.css +1 -1
- package/src/lightning/inputAddress/__docs__/inputAddress.md +44 -3
- package/src/lightning/inputAddress/form-element.slds.css +1 -1
- package/src/lightning/inputAddress/input-text.slds.css +7 -6
- package/src/lightning/inputAddress/inputAddress.js +8 -6
- package/src/lightning/inputLocation/form-element.slds.css +1 -1
- package/src/lightning/inputLocation/input-text.slds.css +7 -6
- package/src/lightning/inputName/form-element.slds.css +1 -1
- package/src/lightning/inputName/input-text.slds.css +7 -6
- package/src/lightning/inputName/inputName.js-meta.xml +3 -0
- package/src/lightning/interactiveDialogBase/button.slds.css +515 -0
- package/src/lightning/interactiveDialogBase/interactive-dialog-base.slds.css +45 -17
- package/src/lightning/interactiveDialogBase/interactiveDialogBase.lbc.native.css +6 -1
- package/src/lightning/interactiveDialogBase/modal-base.slds.css +242 -0
- package/src/lightning/interactiveDialogBase/modal-body.slds.css +60 -0
- package/src/lightning/interactiveDialogBase/modal-footer.slds.css +79 -0
- package/src/lightning/interactiveDialogBase/modal-header.slds.css +76 -0
- package/src/lightning/lookupAddress/form-element.slds.css +1 -1
- package/src/lightning/lookupAddress/lookupAddress.js-meta.xml +3 -0
- package/src/lightning/menuDivider/menuDivider.js-meta.xml +3 -0
- package/src/lightning/menuSubheader/menuSubheader.js-meta.xml +3 -0
- package/src/lightning/modal/modal.js-meta.xml +3 -0
- package/src/lightning/modalBase/modalBase.js +7 -5
- package/src/lightning/modalBody/modalBody.js-meta.xml +3 -0
- package/src/lightning/modalFooter/modalFooter.js-meta.xml +3 -0
- package/src/lightning/modalHeader/modalHeader.js-meta.xml +3 -0
- package/src/lightning/picklist/picklist.js +3 -2
- package/src/lightning/pill/pill.js +1 -1
- package/src/lightning/pillContainer/button.slds.css +18 -10
- package/src/lightning/primitiveBubble/primitiveBubble.js +9 -4
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +1 -1
- package/src/lightning/primitiveDatatableTooltipBubble/primitiveDatatableTooltipBubble.html +1 -1
- package/src/lightning/primitiveFileDroppableZone/primitiveFileDroppableZone.js +3 -2
- package/src/lightning/primitiveHeaderActions/primitiveHeaderActions.html +1 -0
- package/src/lightning/primitiveInputCheckbox/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputCheckboxButton/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputColor/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputColor/input-text.slds.css +7 -6
- package/src/lightning/primitiveInputFile/button.slds.css +18 -10
- package/src/lightning/primitiveInputFile/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputFile/input-file.slds.css +3 -2
- package/src/lightning/primitiveInputSimple/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputSimple/input-text.slds.css +7 -6
- package/src/lightning/primitiveInputToggle/form-element.slds.css +1 -1
- package/src/lightning/primitiveInputToggle/input-toggle.slds.css +13 -7
- package/src/lightning/progressBar/progressBar.js-meta.xml +3 -0
- package/src/lightning/progressRing/progressRing.js-meta.xml +3 -0
- package/src/lightning/prompt/form-element.slds.css +319 -0
- package/src/lightning/prompt/input-text.slds.css +507 -0
- package/src/lightning/prompt/prompt.lbc.native.css +2 -0
- package/src/lightning/purifyLib/purify.js +838 -586
- package/src/lightning/radioGroup/form-element.slds.css +1 -1
- package/src/lightning/radioGroup/radioGroup.js-meta.xml +3 -0
- package/src/lightning/select/form-element.slds.css +1 -1
- package/src/lightning/select/select.slds.css +1 -1
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +6 -4
- package/src/lightning/tabBar/tab-bar.slds.css +17 -3
- package/src/lightning/textarea/form-element.slds.css +1 -1
- package/src/lightning/textarea/textarea.js-meta.xml +3 -0
- package/src/lightning/timepicker/form-element.slds.css +1 -1
- package/src/lightning/toast/button-icon.slds.css +23 -15
- package/src/lightning/toast/toast.js-meta.xml +3 -0
- package/src/lightning/toastContainer/toastContainer.js-meta.xml +3 -0
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +15 -4
- package/src/lightning/utilsPrivate/utilsPrivate.js +4 -4
- package/src/lightning/verticalNavigationOverflow/button.slds.css +18 -10
|
@@ -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>
|
|
@@ -388,7 +388,8 @@ export default class LightningCombobox extends LightningShadowBaseClass {
|
|
|
388
388
|
'lightning-base-combobox'
|
|
389
389
|
);
|
|
390
390
|
baseCombobox.inputLabelledByElement = this.ariaLabelledBy;
|
|
391
|
-
baseCombobox.inputDescribedByElements = this.
|
|
391
|
+
baseCombobox.inputDescribedByElements = this.ariaDescribedBy;
|
|
392
|
+
baseCombobox.ariaErrorMessageElements = this.ariaErrorMessageElements;
|
|
392
393
|
}
|
|
393
394
|
|
|
394
395
|
get templateRootNode() {
|
|
@@ -409,19 +410,10 @@ export default class LightningCombobox extends LightningShadowBaseClass {
|
|
|
409
410
|
.toString();
|
|
410
411
|
}
|
|
411
412
|
|
|
412
|
-
get
|
|
413
|
-
|
|
413
|
+
get ariaErrorMessageElements() {
|
|
414
|
+
if (!this._helpMessage) return null;
|
|
414
415
|
|
|
415
|
-
|
|
416
|
-
const helpText = this.template.querySelector('[data-help-text]');
|
|
417
|
-
describedByElements.push(helpText);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
if (typeof this.ariaDescribedBy === 'string') {
|
|
421
|
-
describedByElements.push(this.ariaDescribedBy);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
return describedByElements;
|
|
416
|
+
return this.template.querySelector('[data-help-text]');
|
|
425
417
|
}
|
|
426
418
|
|
|
427
419
|
handleSelect(event) {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
hyphens: auto;
|
|
47
47
|
display: inline-block;
|
|
48
48
|
color: var(--slds-g-color-on-surface-2);
|
|
49
|
-
font-size: var(--slds-g-font-scale-neg-
|
|
49
|
+
font-size: var(--slds-s-label-font-size, var(--slds-g-font-scale-neg-2));
|
|
50
50
|
padding-inline-end: var(--slds-g-spacing-2);
|
|
51
51
|
padding-block-start: var(--slds-g-spacing-1);
|
|
52
52
|
margin-block-end: calc(var(--slds-g-spacing-1) / 2);
|
|
@@ -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
|
}
|
|
@@ -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 : [],
|
|
@@ -131,7 +131,6 @@ import {
|
|
|
131
131
|
} from './sort';
|
|
132
132
|
import {
|
|
133
133
|
getGridContainerFromScrollerY,
|
|
134
|
-
getRowDataSelector,
|
|
135
134
|
getScrollerX,
|
|
136
135
|
getScrollerY,
|
|
137
136
|
isLoadMore,
|
|
@@ -607,7 +606,7 @@ export default class LightningDatatable extends LightningElement {
|
|
|
607
606
|
|
|
608
607
|
/**
|
|
609
608
|
* Enables and configures advanced rendering modes.
|
|
610
|
-
* It supports properties 'bufferSize'
|
|
609
|
+
* It supports properties 'bufferSize' and 'rowHeight'.
|
|
611
610
|
*
|
|
612
611
|
* @type {RenderManagerConfig} value - config object for datatable rendering
|
|
613
612
|
*/
|
|
@@ -623,14 +622,11 @@ export default class LightningDatatable extends LightningElement {
|
|
|
623
622
|
this.getWrapperHeight,
|
|
624
623
|
value
|
|
625
624
|
);
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
this.
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
true
|
|
632
|
-
);
|
|
633
|
-
}
|
|
625
|
+
this._renderManager.updateViewportRendering(
|
|
626
|
+
this.state,
|
|
627
|
+
this.gridContainer,
|
|
628
|
+
true
|
|
629
|
+
);
|
|
634
630
|
this._renderConfig = value;
|
|
635
631
|
}
|
|
636
632
|
}
|
|
@@ -1102,6 +1098,8 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1102
1098
|
|
|
1103
1099
|
this._columnWidthManager = new ColumnWidthManager(this.widthsData);
|
|
1104
1100
|
this._privateTypes = new DatatableTypes(this.constructor.customTypes);
|
|
1101
|
+
this._hasSetInitialCustomTypes =
|
|
1102
|
+
!!this._privateTypes.privateCustomTypes.size;
|
|
1105
1103
|
|
|
1106
1104
|
this._renderManager = new RenderManager();
|
|
1107
1105
|
this.getWrapperHeight = () => getScrollerX(this.template).offsetHeight;
|
|
@@ -1242,9 +1240,12 @@ export default class LightningDatatable extends LightningElement {
|
|
|
1242
1240
|
if (!this._hasSetInitialCustomTypes) {
|
|
1243
1241
|
this.setCustomTypes();
|
|
1244
1242
|
this._hasSetInitialCustomTypes = true;
|
|
1245
|
-
// Return here since a re-render will occur
|
|
1246
|
-
// for column updates if custom types added
|
|
1247
|
-
if (
|
|
1243
|
+
// Return here since a re-render will occur on auto width
|
|
1244
|
+
// tables for column updates if custom types added
|
|
1245
|
+
if (
|
|
1246
|
+
this._privateTypes.privateCustomTypes.size &&
|
|
1247
|
+
widthsData.columnWidthsMode === 'auto'
|
|
1248
|
+
) {
|
|
1248
1249
|
return;
|
|
1249
1250
|
}
|
|
1250
1251
|
}
|
|
@@ -2071,28 +2072,8 @@ export default class LightningDatatable extends LightningElement {
|
|
|
2071
2072
|
if (this.state.shouldResetHeights) {
|
|
2072
2073
|
resetRowHeights(state);
|
|
2073
2074
|
this.state.shouldResetHeights = false;
|
|
2074
|
-
} else if (virtualizedRows
|
|
2075
|
-
// if row heights aren't fixed, we need to update items
|
|
2076
|
-
// in state to know where rows should be positioned
|
|
2075
|
+
} else if (virtualizedRows) {
|
|
2077
2076
|
handleVariableRowHeights(this.template, state, this.renderedRows);
|
|
2078
|
-
} else if (virtualizedRows && state.fixedHeight) {
|
|
2079
|
-
// if heights are fixed, we only need to check height of first row
|
|
2080
|
-
const rowElement = this.template.querySelector(
|
|
2081
|
-
getRowDataSelector(this.renderedRows[0].key)
|
|
2082
|
-
);
|
|
2083
|
-
// increase height by 1 since first rendered row is missing an extra 1px border
|
|
2084
|
-
if (rowElement) {
|
|
2085
|
-
const height = rowElement.getBoundingClientRect().height + 1;
|
|
2086
|
-
if (state.rowHeight !== height) {
|
|
2087
|
-
state.rowHeight = height;
|
|
2088
|
-
state.tableHeight = state.rowHeight * state.rows.length;
|
|
2089
|
-
state.rows.forEach((row) => {
|
|
2090
|
-
row.style = `position:absolute;top:${
|
|
2091
|
-
row.rowIndex * height
|
|
2092
|
-
}px;`;
|
|
2093
|
-
});
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
2077
|
}
|
|
2097
2078
|
}
|
|
2098
2079
|
|
|
@@ -481,10 +481,10 @@ export function reactToKeyboardOnRow(dt, event) {
|
|
|
481
481
|
reactToArrowRightOnRow(dt, state, template, event);
|
|
482
482
|
break;
|
|
483
483
|
case ARROW_UP:
|
|
484
|
-
reactToArrowUpOnRow(
|
|
484
|
+
reactToArrowUpOnRow(state, template, event);
|
|
485
485
|
break;
|
|
486
486
|
case ARROW_DOWN:
|
|
487
|
-
reactToArrowDownOnRow(
|
|
487
|
+
reactToArrowDownOnRow(state, template, event);
|
|
488
488
|
break;
|
|
489
489
|
default:
|
|
490
490
|
break;
|
|
@@ -920,7 +920,7 @@ export function handlePrimitiveDatatableCellFocus(event) {
|
|
|
920
920
|
cellElement.parentElement.dataset.rowKeyValue,
|
|
921
921
|
cellElement.dataset.colKeyValue
|
|
922
922
|
);
|
|
923
|
-
if (cell.
|
|
923
|
+
if (cell.keyboardMode === KEYBOARD_ACTION_MODE) {
|
|
924
924
|
// Tracked state change.
|
|
925
925
|
setFocusToActionableElement(
|
|
926
926
|
cell,
|
|
@@ -933,12 +933,13 @@ export function handlePrimitiveDatatableCellFocus(event) {
|
|
|
933
933
|
|
|
934
934
|
export function handlePrimitiveDatatableCellKeydown(event) {
|
|
935
935
|
const { state } = this;
|
|
936
|
-
|
|
936
|
+
const { target } = event;
|
|
937
|
+
// Don't continue if clicking on a cell factory
|
|
937
938
|
// Or the outer td/th element and div equivalent
|
|
938
939
|
const cellElement =
|
|
939
940
|
state.renderModeInline &&
|
|
940
|
-
|
|
941
|
-
!
|
|
941
|
+
target.tagName !== 'LIGHTNING-PRIMITIVE-CELL-FACTORY' &&
|
|
942
|
+
!target.getAttribute('role')
|
|
942
943
|
? getCellElementFromEventTarget(event.target)
|
|
943
944
|
: undefined;
|
|
944
945
|
|
|
@@ -948,18 +949,18 @@ export function handlePrimitiveDatatableCellKeydown(event) {
|
|
|
948
949
|
|
|
949
950
|
const cellElementChild = getCellElementChild(cellElement);
|
|
950
951
|
const cell = getCellByKeys(
|
|
951
|
-
|
|
952
|
+
state,
|
|
952
953
|
cellElement.parentElement.dataset.rowKeyValue,
|
|
953
954
|
cellElement.dataset.colKeyValue
|
|
954
955
|
);
|
|
955
|
-
const {
|
|
956
|
+
const { keyboardMode } = cell;
|
|
956
957
|
const { keyCode, shiftKey } = event;
|
|
957
958
|
|
|
958
959
|
// if it is in Action mode, then traverse to the next or previous
|
|
959
960
|
// focusable element.
|
|
960
961
|
// if there is no focusable element, or reach outside of the range, then move to
|
|
961
962
|
// previous or next cell.
|
|
962
|
-
if (
|
|
963
|
+
if (keyboardMode === KEYBOARD_ACTION_MODE) {
|
|
963
964
|
let passThroughEvent = keyCode !== keyCodes.shift;
|
|
964
965
|
if (keyCode === keyCodes.left) {
|
|
965
966
|
if (canMoveLeft(cell)) {
|
|
@@ -1013,7 +1014,7 @@ export function handlePrimitiveDatatableCellKeydown(event) {
|
|
|
1013
1014
|
if (passThroughEvent) {
|
|
1014
1015
|
fireCellKeydown(cell, cellElementChild, event);
|
|
1015
1016
|
}
|
|
1016
|
-
} else if (
|
|
1017
|
+
} else if (keyboardMode === KEYBOARD_NAVIGATION_MODE) {
|
|
1017
1018
|
// click the header, press enter, it does not go to action mode without this code.
|
|
1018
1019
|
if (
|
|
1019
1020
|
keyCode === keyCodes.left ||
|
|
@@ -1090,7 +1091,7 @@ function resetCurrentInputIndex(
|
|
|
1090
1091
|
// it moves focus out of table
|
|
1091
1092
|
if (
|
|
1092
1093
|
incomingMode === KEYBOARD_ACTION_MODE &&
|
|
1093
|
-
cell.
|
|
1094
|
+
cell.keyboardMode === KEYBOARD_ACTION_MODE
|
|
1094
1095
|
) {
|
|
1095
1096
|
// Tracked state change.
|
|
1096
1097
|
setFocusToActionableElement(
|
|
@@ -1127,7 +1128,7 @@ function setFocusToActionableElement(cell, cellElementChild, activeInputIndex) {
|
|
|
1127
1128
|
function setMode(cell, cellElementChild, keyboardMode, info) {
|
|
1128
1129
|
const normalizedInfo = info || { action: 'none' };
|
|
1129
1130
|
// Tracked state changes.
|
|
1130
|
-
cell.
|
|
1131
|
+
cell.keyboardMode = keyboardMode;
|
|
1131
1132
|
if (keyboardMode === KEYBOARD_ACTION_MODE) {
|
|
1132
1133
|
cell.internalTabIndex = 0;
|
|
1133
1134
|
// focus without changing tabIndex doesn't work W-6185168
|
|
@@ -79,7 +79,6 @@ export class RenderManager {
|
|
|
79
79
|
'non-negative',
|
|
80
80
|
DEFAULT_BUFFER_SIZE
|
|
81
81
|
);
|
|
82
|
-
state.fixedHeight = normalizeBoolean(config.fixedHeight);
|
|
83
82
|
if (typeof rowHeight === 'number') {
|
|
84
83
|
state.rowHeight = rowHeight;
|
|
85
84
|
this.threshold = ROW_THRESHOLD * rowHeight;
|
|
@@ -149,7 +148,6 @@ export class RenderManager {
|
|
|
149
148
|
bufferSize,
|
|
150
149
|
renderedRowCount,
|
|
151
150
|
rows,
|
|
152
|
-
fixedHeight,
|
|
153
151
|
rowHeight,
|
|
154
152
|
heightCache,
|
|
155
153
|
} = state;
|
|
@@ -161,7 +159,7 @@ export class RenderManager {
|
|
|
161
159
|
|
|
162
160
|
// if using variable heights, see if we can get more
|
|
163
161
|
// accurate estimate based on known row heights
|
|
164
|
-
if (
|
|
162
|
+
if (heightCache[firstVisibleKey]) {
|
|
165
163
|
let i = firstVisibleIndex;
|
|
166
164
|
let currentHeight = 0;
|
|
167
165
|
let knownRowHeight = rows[i] && heightCache[rows[i].key];
|
|
@@ -404,13 +404,14 @@ export function updateCell(state, rowIndex, colIndex) {
|
|
|
404
404
|
cell.typeAttribute0 = getRowNumberError(rowErrors, cell.scopeColValue);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
|
|
407
|
+
const cellAttributes = getCellAttributesValues(col);
|
|
408
|
+
let cellClass = resolveAttributeValue(cellAttributes.class, rowData) || '';
|
|
409
|
+
if (cell.hasTreeData && !cellClass) {
|
|
410
|
+
cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
|
|
411
|
+
}
|
|
408
412
|
if (cell.displayReadOnlyIcon || cell.editable) {
|
|
409
413
|
cellClass += (cellClass.length ? ' ' : '') + CELL_EDIT_CLASS;
|
|
410
414
|
}
|
|
411
|
-
if (cell.hasTreeData) {
|
|
412
|
-
cellClass += (cellClass.length ? ' ' : '') + TREE__ITEM_CLASS;
|
|
413
|
-
}
|
|
414
415
|
if (hasError) {
|
|
415
416
|
cellClass += (cellClass.length ? ' ' : '') + HAS_ERROR_CLASS;
|
|
416
417
|
}
|
|
@@ -423,7 +424,7 @@ export function updateCell(state, rowIndex, colIndex) {
|
|
|
423
424
|
}
|
|
424
425
|
|
|
425
426
|
cell.class = cellClass;
|
|
426
|
-
cell.style = computeCellStyles(cell, col, renderModeRoleBased);
|
|
427
|
+
cell.style = computeCellStyles(cell, col, renderModeRoleBased, cell.style);
|
|
427
428
|
|
|
428
429
|
if (cell.isInlined) {
|
|
429
430
|
updateInlineCell(cell);
|
|
@@ -442,14 +443,19 @@ export function updateCell(state, rowIndex, colIndex) {
|
|
|
442
443
|
* @param {Object} types - instance of DatatableTypes from `./types.js`
|
|
443
444
|
* @param {Object} col - column definition
|
|
444
445
|
* @param {Boolean} renderModeRoleBased - render mode of datatable (div || table)
|
|
446
|
+
* @param {String} initValue - default value for cell styles
|
|
445
447
|
* @returns {String} - styles to be set on the cell
|
|
446
448
|
*/
|
|
447
|
-
function computeCellStyles(cell, col, renderModeRoleBased) {
|
|
448
|
-
let cellStyle =
|
|
449
|
+
function computeCellStyles(cell, col, renderModeRoleBased, initValue = '') {
|
|
450
|
+
let cellStyle = initValue;
|
|
451
|
+
if (cellStyle && !cellStyle.endsWith(';')) {
|
|
452
|
+
cellStyle += ';';
|
|
453
|
+
}
|
|
454
|
+
|
|
449
455
|
if (cell.isCustomBareLayout) {
|
|
450
456
|
// When a custom type is not using the standard layout,
|
|
451
457
|
// remove the padding that comes with the standard layout
|
|
452
|
-
cellStyle
|
|
458
|
+
cellStyle += 'padding: 0;';
|
|
453
459
|
}
|
|
454
460
|
|
|
455
461
|
// Width needs to be managed when rendering as divs
|
|
@@ -475,7 +481,9 @@ export function recomputeCellStyles(state) {
|
|
|
475
481
|
state.rows.forEach((row) => {
|
|
476
482
|
row.cells.forEach((cell, colIndex) => {
|
|
477
483
|
const colData = columns[colIndex];
|
|
478
|
-
|
|
484
|
+
const cellAttrs = getCellAttributesValues(colData);
|
|
485
|
+
const style = resolveAttributeValue(cellAttrs.style, row) || '';
|
|
486
|
+
cell.style = computeCellStyles(cell, colData, true, style);
|
|
479
487
|
});
|
|
480
488
|
});
|
|
481
489
|
}
|
|
@@ -74,7 +74,6 @@ export function getDefaultState() {
|
|
|
74
74
|
rowHeight: 30.5,
|
|
75
75
|
renderedRowCount: 0,
|
|
76
76
|
firstVisibleIndex: 0, // first row that should be visible in viewport
|
|
77
|
-
fixedHeight: false, // by default, assume that not all rows are same height
|
|
78
77
|
heightCache: {}, // cache of row heights
|
|
79
78
|
offsets: [0],
|
|
80
79
|
offsetRanges: [],
|
|
@@ -12,7 +12,7 @@ export function addTableHeight(state, prevData, newData) {
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* resets state properties relevant to virtualization
|
|
15
|
-
* rowHeights
|
|
15
|
+
* rowHeights
|
|
16
16
|
*
|
|
17
17
|
* @param {Object} state - datatable state
|
|
18
18
|
*/
|
|
@@ -43,7 +43,7 @@ export function resetRowHeights(state) {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* updates state properties relevant to virtualization
|
|
46
|
-
* rowHeights
|
|
46
|
+
* rowHeights
|
|
47
47
|
*
|
|
48
48
|
* @param {Node} template - the custom element root `this.template` from datatable.js
|
|
49
49
|
* @param {Object} state - datatable state
|
|
@@ -71,7 +71,7 @@ export function handleVariableRowHeights(template, state, renderedRows) {
|
|
|
71
71
|
if (rowElement) {
|
|
72
72
|
// first rendered row needs height increased by 1 to account for missing border
|
|
73
73
|
let height = rowElement.getBoundingClientRect().height;
|
|
74
|
-
if (row.rowIndex === currentRange.start) {
|
|
74
|
+
if (row.rowIndex && row.rowIndex === currentRange.start) {
|
|
75
75
|
height++;
|
|
76
76
|
}
|
|
77
77
|
state.heightCache[row.key] = height;
|
|
@@ -102,10 +102,7 @@ export function handleVariableRowHeights(template, state, renderedRows) {
|
|
|
102
102
|
* for a given scrollTop value
|
|
103
103
|
*/
|
|
104
104
|
export function findFirstVisibleIndex(state, scrollTop) {
|
|
105
|
-
const { offsetRanges, offsets, rowHeight
|
|
106
|
-
if (virtualize && fixedHeight) {
|
|
107
|
-
return Math.floor(scrollTop / rowHeight);
|
|
108
|
-
}
|
|
105
|
+
const { offsetRanges, offsets, rowHeight } = state;
|
|
109
106
|
let start = 0;
|
|
110
107
|
let end = offsetRanges.length - 1;
|
|
111
108
|
|
|
@@ -133,7 +130,7 @@ export function findFirstVisibleIndex(state, scrollTop) {
|
|
|
133
130
|
// use scrollTop and rowHeight to calculate firstVisibleIndex
|
|
134
131
|
const diff = scrollTop - endOffset;
|
|
135
132
|
const extraRows = Math.floor(diff / rowHeight);
|
|
136
|
-
state.
|
|
133
|
+
state.firstRowOffset = diff % rowHeight;
|
|
137
134
|
return prevRange.end + extraRows;
|
|
138
135
|
}
|
|
139
136
|
// update start or end for next round of binary search
|
|
@@ -319,7 +316,7 @@ function checkOverlap(range1, range2) {
|
|
|
319
316
|
|
|
320
317
|
/**
|
|
321
318
|
* updates scrollTop and top values for rows when
|
|
322
|
-
* using virtualization
|
|
319
|
+
* using virtualization
|
|
323
320
|
*/
|
|
324
321
|
function updateVirtualizeStyles(template, state, renderedRows) {
|
|
325
322
|
// update scrollTop so firstVisibleIndex is correctly placed in viewport
|
|
@@ -328,12 +325,12 @@ function updateVirtualizeStyles(template, state, renderedRows) {
|
|
|
328
325
|
state.offsets[state.firstVisibleIndex] + state.firstRowOffset;
|
|
329
326
|
|
|
330
327
|
// update top of rendered rows based on offsets
|
|
331
|
-
//
|
|
332
|
-
// 1
|
|
333
|
-
|
|
328
|
+
// if first rendered row isn't first row we need to
|
|
329
|
+
// add 1 to its offset to account for missing top border
|
|
330
|
+
const addOffset = !!renderedRows[0].rowIndex;
|
|
334
331
|
renderedRows.forEach((row, index) => {
|
|
335
|
-
let top = state.offsets[row.rowIndex]
|
|
336
|
-
if (!index) {
|
|
332
|
+
let top = state.offsets[row.rowIndex];
|
|
333
|
+
if (addOffset && !index) {
|
|
337
334
|
top = top + 1; // reset first rendered row to offset in state
|
|
338
335
|
}
|
|
339
336
|
row.style = `position:absolute;top:${top}px;`;
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
hyphens: auto;
|
|
47
47
|
display: inline-block;
|
|
48
48
|
color: var(--slds-g-color-on-surface-2);
|
|
49
|
-
font-size: var(--slds-g-font-scale-neg-
|
|
49
|
+
font-size: var(--slds-s-label-font-size, var(--slds-g-font-scale-neg-2));
|
|
50
50
|
padding-inline-end: var(--slds-g-spacing-2);
|
|
51
51
|
padding-block-start: var(--slds-g-spacing-1);
|
|
52
52
|
margin-block-end: calc(var(--slds-g-spacing-1) / 2);
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
--sds-c-inputtext-text-color: var(--slds-c-inputtext-text-color);
|
|
247
247
|
--sds-c-inputtext-font-size: var(
|
|
248
248
|
--slds-c-inputtext-font-size,
|
|
249
|
-
var(--slds-g-font-
|
|
249
|
+
var(--slds-g-font-size-base)
|
|
250
250
|
);
|
|
251
251
|
--sds-c-inputtext-text-color-placeholder: var(
|
|
252
252
|
--slds-c-inputtext-text-color-placeholder,
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
|
|
265
265
|
display: flex;
|
|
266
266
|
flex-wrap: wrap;
|
|
267
|
-
|
|
267
|
+
flex-direction: column;
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
270
|
* Input Container
|
|
@@ -371,6 +371,10 @@
|
|
|
371
371
|
--sds-c-inputtext-color-border: var(--slds-g-color-border-disabled-1);
|
|
372
372
|
--sds-c-inputtext-text-color: var(--slds-g-color-on-disabled-2);
|
|
373
373
|
}
|
|
374
|
+
:host([data-render-mode="shadow"][disabled]) [part='input-text'] {
|
|
375
|
+
--sds-c-inputtext-text-color-placeholder:
|
|
376
|
+
var(--slds-g-color-on-disabled-2);
|
|
377
|
+
}
|
|
374
378
|
/**
|
|
375
379
|
* Label
|
|
376
380
|
*
|
|
@@ -384,10 +388,7 @@
|
|
|
384
388
|
--slds-c-inputtext-label-color,
|
|
385
389
|
var(--slds-g-color-on-surface-2)
|
|
386
390
|
);
|
|
387
|
-
font-size: var(
|
|
388
|
-
--slds-c-inputtext-label-font-size,
|
|
389
|
-
var(--slds-g-font-scale-neg-3)
|
|
390
|
-
);
|
|
391
|
+
font-size: var(--slds-s-label-font-size, var(--slds-g-font-scale-neg-2));
|
|
391
392
|
margin-block-end: var(--slds-g-sizing-1);
|
|
392
393
|
|
|
393
394
|
/* We inline flex to control the spacing between elements and not have to rely on whitespace characters */
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
hyphens: auto;
|
|
47
47
|
display: inline-block;
|
|
48
48
|
color: var(--slds-g-color-on-surface-2);
|
|
49
|
-
font-size: var(--slds-g-font-scale-neg-
|
|
49
|
+
font-size: var(--slds-s-label-font-size, var(--slds-g-font-scale-neg-2));
|
|
50
50
|
padding-inline-end: var(--slds-g-spacing-2);
|
|
51
51
|
padding-block-start: var(--slds-g-spacing-1);
|
|
52
52
|
margin-block-end: calc(var(--slds-g-spacing-1) / 2);
|
|
@@ -246,7 +246,7 @@
|
|
|
246
246
|
--sds-c-inputtext-text-color: var(--slds-c-inputtext-text-color);
|
|
247
247
|
--sds-c-inputtext-font-size: var(
|
|
248
248
|
--slds-c-inputtext-font-size,
|
|
249
|
-
var(--slds-g-font-
|
|
249
|
+
var(--slds-g-font-size-base)
|
|
250
250
|
);
|
|
251
251
|
--sds-c-inputtext-text-color-placeholder: var(
|
|
252
252
|
--slds-c-inputtext-text-color-placeholder,
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
|
|
265
265
|
display: flex;
|
|
266
266
|
flex-wrap: wrap;
|
|
267
|
-
|
|
267
|
+
flex-direction: column;
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
270
|
* Input Container
|
|
@@ -371,6 +371,10 @@
|
|
|
371
371
|
--sds-c-inputtext-color-border: var(--slds-g-color-border-disabled-1);
|
|
372
372
|
--sds-c-inputtext-text-color: var(--slds-g-color-on-disabled-2);
|
|
373
373
|
}
|
|
374
|
+
:host([data-render-mode="shadow"][disabled]) [part='input-text'] {
|
|
375
|
+
--sds-c-inputtext-text-color-placeholder:
|
|
376
|
+
var(--slds-g-color-on-disabled-2);
|
|
377
|
+
}
|
|
374
378
|
/**
|
|
375
379
|
* Label
|
|
376
380
|
*
|
|
@@ -384,10 +388,7 @@
|
|
|
384
388
|
--slds-c-inputtext-label-color,
|
|
385
389
|
var(--slds-g-color-on-surface-2)
|
|
386
390
|
);
|
|
387
|
-
font-size: var(
|
|
388
|
-
--slds-c-inputtext-label-font-size,
|
|
389
|
-
var(--slds-g-font-scale-neg-3)
|
|
390
|
-
);
|
|
391
|
+
font-size: var(--slds-s-label-font-size, var(--slds-g-font-scale-neg-2));
|
|
391
392
|
margin-block-end: var(--slds-g-sizing-1);
|
|
392
393
|
|
|
393
394
|
/* We inline flex to control the spacing between elements and not have to rely on whitespace characters */
|