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.
- package/metadata/raptor.json +104 -2
- package/package.json +37 -1
- package/scopedImports/@salesforce-label-LightningAlert.defaultLabel.js +1 -0
- package/scopedImports/@salesforce-label-LightningConfirm.defaultLabel.js +1 -0
- package/scopedImports/@salesforce-label-LightningDateTimePicker.selectDateFor.js +1 -0
- package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.cancel.js +1 -0
- package/scopedImports/@salesforce-label-LightningInteractiveDialogBase.ok.js +1 -0
- package/scopedImports/@salesforce-label-LightningLookup.recentItems.js +1 -0
- package/scopedImports/@salesforce-label-LightningModalBase.close.js +1 -0
- package/scopedImports/@salesforce-label-LightningModalBase.waitstate.js +1 -0
- package/scopedImports/@salesforce-label-LightningPrompt.defaultLabel.js +1 -0
- package/src/lightning/baseCombobox/baseCombobox.html +50 -24
- package/src/lightning/baseCombobox/baseCombobox.js +53 -28
- package/src/lightning/card/card.html +7 -1
- package/src/lightning/card/card.js +30 -2
- package/src/lightning/card/utils.js +14 -0
- package/src/lightning/combobox/combobox.css +12 -0
- package/src/lightning/combobox/combobox.html +1 -0
- package/src/lightning/datatable/__docs__/datatable.md +40 -13
- package/src/lightning/datatable/columnWidthManager.js +8 -4
- package/src/lightning/datatable/columns-shared.js +8 -7
- package/src/lightning/datatable/columns.js +38 -4
- package/src/lightning/datatable/datatable.js +932 -727
- package/src/lightning/datatable/datatableResizeObserver.js +1 -1
- package/src/lightning/datatable/inlineEdit.js +15 -3
- package/src/lightning/datatable/keyboard.js +1078 -935
- package/src/lightning/datatable/resizer.js +92 -109
- package/src/lightning/datatable/rows.js +245 -59
- package/src/lightning/datatable/sort.js +83 -28
- package/src/lightning/datatable/{normalizer.js → state.js} +16 -28
- package/src/lightning/datatable/templates/div/div.css +53 -0
- package/src/lightning/datatable/templates/div/div.html +272 -0
- package/src/lightning/datatable/{datatable.css → templates/table/table.css} +0 -0
- package/src/lightning/datatable/templates/table/table.html +260 -0
- package/src/lightning/datatable/widthManagerShared.js +1 -1
- package/src/lightning/datepicker/datepicker.html +3 -3
- package/src/lightning/datepicker/datepicker.js +6 -2
- package/src/lightning/datetimepicker/datetimepicker.html +3 -4
- package/src/lightning/datetimepicker/datetimepicker.js +0 -2
- package/src/lightning/formattedRichText/__docs__/formattedRichText.md +1 -0
- package/src/lightning/helptext/helptext.js +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/asset_audit.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/attach.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/historical_adherence.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_recommendation.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_dispense.html +11 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/medication_reconciliation.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/report_type.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/story.html +2 -4
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/unified_health_score.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/standard/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/templates.js +26 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/asset_audit.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/collection_alt.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_doc.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/einstein.html +2 -1
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/entitlement.html +7 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/signature.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour.html +9 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/truck.html +10 -0
- package/src/lightning/iconSvgTemplates/buildTemplates/utility/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/asset_audit.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/attach.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/historical_adherence.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_dispense.html +11 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/report_type.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/story.html +2 -4
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/unified_health_score.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/standard/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/templates.js +26 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/asset_audit.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/collection_alt.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_doc.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/einstein.html +2 -1
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/entitlement.html +7 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/signature.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/truck.html +10 -0
- package/src/lightning/iconSvgTemplatesRtl/buildTemplates/utility/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/asset_audit.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/attach.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/historical_adherence.html +9 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_recommendation.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_dispense.html +11 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/medication_reconciliation.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/report_type.html +9 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/story.html +2 -4
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/unified_health_score.html +7 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/standard/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesStandard/buildTemplates/templates.js +15 -1
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/asset_audit.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/attach.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/historical_adherence.html +9 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_recommendation.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/med_rec_statement_recommendation.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_dispense.html +11 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/medication_reconciliation.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/report_type.html +9 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/story.html +2 -4
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/travel_mode.html +2 -2
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/unified_health_score.html +7 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/standard/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesStandardRtl/buildTemplates/templates.js +15 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/templates.js +12 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/asset_audit.html +9 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/collection_alt.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_doc.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/einstein.html +2 -1
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/entitlement.html +7 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/signature.html +9 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/truck.html +10 -0
- package/src/lightning/iconSvgTemplatesUtility/buildTemplates/utility/workforce_engagement.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/templates.js +12 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/asset_audit.html +9 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/collection_alt.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_doc.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/contract_payment.html +10 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/einstein.html +2 -1
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/entitlement.html +7 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/field_sales.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/signature.html +9 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour.html +9 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/tour_check.html +8 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/truck.html +10 -0
- package/src/lightning/iconSvgTemplatesUtilityRtl/buildTemplates/utility/workforce_engagement.html +8 -0
- package/src/lightning/input/__docs__/input.md +4 -0
- package/src/lightning/input/input.js +11 -6
- package/src/lightning/pill/link.html +1 -1
- package/src/lightning/pill/pill.js +18 -0
- package/src/lightning/pill/plainLink.html +2 -0
- package/src/lightning/pillContainer/barePillContainer.html +5 -5
- package/src/lightning/pillContainer/pillContainer.js +5 -4
- package/src/lightning/pillContainer/standardPillContainer.html +5 -5
- package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +8 -6
- package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +1 -1
- package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +6 -9
- package/src/lightning/positionLibrary/direction.js +17 -5
- package/src/lightning/primitiveDatatableIeditPanel/primitiveDatatableIeditPanel.js +20 -0
- package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js +10 -0
- package/src/lightning/primitiveDatatableStatusBar/primitiveDatatableStatusBar.js +17 -3
- package/src/lightning/primitiveDatatableTooltip/primitiveDatatableTooltip.js +1 -0
- package/src/lightning/primitiveHeaderFactory/nonsortableHeader.html +5 -4
- package/src/lightning/primitiveHeaderFactory/primitiveHeaderFactory.js +255 -94
- package/src/lightning/primitiveHeaderFactory/selectableHeader.html +25 -23
- package/src/lightning/primitiveHeaderFactory/sortableHeader.html +13 -9
- package/src/lightning/progressIndicator/progressIndicator.js +30 -9
- package/src/lightning/progressRing/progressRing.html +6 -0
- package/src/lightning/progressRing/progressRing.js +98 -3
- package/src/lightning/progressStep/progressStep.js +6 -3
- package/src/lightning/timepicker/timepicker.html +1 -0
- package/src/lightning/utilsPrivate/aria.js +30 -0
- package/src/lightning/utilsPrivate/contentMutation.js +24 -2
- package/src/lightning/utilsPrivate/utilsPrivate.js +1 -1
- package/src/lightning/datatable/datatable.html +0 -237
- package/src/lightning/datatable/keys.js +0 -32
package/src/lightning/primitiveDatatableIeditTypeFactory/primitiveDatatableIeditTypeFactory.js
CHANGED
|
@@ -159,4 +159,14 @@ export default class LightningPrimitiveDatatableIeditTypeFactory extends Lightni
|
|
|
159
159
|
this._columnDef.editableCustomType && this._columnDef.editTemplate
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Checks if type is an custom type that is editable and
|
|
165
|
+
* has an editTemplate that contains [data-inputable="true"]
|
|
166
|
+
* Used when checking if cell can actually be edited
|
|
167
|
+
*/
|
|
168
|
+
@api
|
|
169
|
+
get isEditableCustomValid() {
|
|
170
|
+
return this.isValidCustomType && this.concreteComponent;
|
|
171
|
+
}
|
|
162
172
|
}
|
|
@@ -21,7 +21,7 @@ export default class LightningPrimitiveDatatableStatusBar extends LightningEleme
|
|
|
21
21
|
this.privateError = value;
|
|
22
22
|
|
|
23
23
|
if (this.showError && this.isSaveBtnFocused()) {
|
|
24
|
-
this.
|
|
24
|
+
this.handleShowError();
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -34,6 +34,11 @@ export default class LightningPrimitiveDatatableStatusBar extends LightningEleme
|
|
|
34
34
|
return error && (error.title || error.messages);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
get showErrorBubble() {
|
|
38
|
+
const { error } = this;
|
|
39
|
+
return error && error.showBubble;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
get bubbleOffset() {
|
|
38
43
|
// move bubble above the docked bar since docked bar has higher z-index
|
|
39
44
|
// and can block the nubbin of the bubble
|
|
@@ -77,14 +82,23 @@ export default class LightningPrimitiveDatatableStatusBar extends LightningEleme
|
|
|
77
82
|
return this.template.querySelector('button.save-btn:focus') !== null;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Handling between displaying/focusing tooltip icon and/or error bubble
|
|
87
|
+
* If showBubble property is set within error object, display/focus the error bubble.
|
|
88
|
+
* Otherwise, display/focus the tooltip icon only.
|
|
89
|
+
*/
|
|
90
|
+
handleShowError() {
|
|
81
91
|
Promise.resolve().then(() => {
|
|
82
92
|
const trigger = this.template.querySelector(
|
|
83
93
|
'lightning-primitive-datatable-tooltip'
|
|
84
94
|
);
|
|
85
95
|
|
|
86
96
|
if (trigger) {
|
|
87
|
-
|
|
97
|
+
if (this.showErrorBubble) {
|
|
98
|
+
trigger.showBubble();
|
|
99
|
+
} else {
|
|
100
|
+
trigger.focus();
|
|
101
|
+
}
|
|
88
102
|
}
|
|
89
103
|
});
|
|
90
104
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
>
|
|
2
|
+
<div class={computedClass} style={columnStyles}>
|
|
3
|
+
|
|
4
|
+
<!-- Header Content -->
|
|
6
5
|
<span class="slds-th__action">
|
|
7
6
|
<template if:true={def.iconName}>
|
|
8
7
|
<div class="slds-grid slds-grid_vertical-align-center slds-has-flexi-truncate">
|
|
@@ -17,6 +16,7 @@
|
|
|
17
16
|
<span class="slds-truncate" if:false={def.label} title={def.ariaLabel}></span>
|
|
18
17
|
</template>
|
|
19
18
|
|
|
19
|
+
<!-- Header Actions -->
|
|
20
20
|
<template if:true={hasActions}>
|
|
21
21
|
<lightning-primitive-header-actions
|
|
22
22
|
col-key-value={def.colKeyValue}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
></lightning-primitive-header-actions>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
|
+
<!-- Resize Handler -->
|
|
29
30
|
<template if:true={isResizable}>
|
|
30
31
|
<lightning-primitive-resize-handler
|
|
31
32
|
value={columnWidth}
|
|
@@ -22,35 +22,45 @@ const i18n = {
|
|
|
22
22
|
sortNone: labelSortNone,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
25
|
+
/**
|
|
26
|
+
* A table column header.
|
|
27
|
+
*/
|
|
30
28
|
export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
|
|
31
|
-
|
|
32
|
-
@
|
|
33
|
-
@api sortedDirection;
|
|
34
|
-
@api resizestep;
|
|
35
|
-
@api columnWidth;
|
|
36
|
-
@api actions;
|
|
37
|
-
@api showCheckbox = false;
|
|
38
|
-
@api dtContextId;
|
|
29
|
+
// Tracked objects
|
|
30
|
+
@track _def = {};
|
|
39
31
|
|
|
32
|
+
// Private variables
|
|
40
33
|
_resizable;
|
|
41
|
-
@track _def = {};
|
|
42
34
|
_sortable = false;
|
|
35
|
+
_hideHeader = false;
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
get resizable() {
|
|
46
|
-
return this._resizable;
|
|
47
|
-
}
|
|
37
|
+
/************************** PUBLIC ATTRIBUTES ***************************/
|
|
48
38
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
@api actions;
|
|
40
|
+
@api colIndex;
|
|
41
|
+
@api columnWidth;
|
|
42
|
+
@api dtContextId;
|
|
43
|
+
@api resizestep;
|
|
44
|
+
@api showCheckbox = false;
|
|
45
|
+
@api sorted;
|
|
46
|
+
@api sortedDirection;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves the computed header DOM `id`
|
|
50
|
+
*
|
|
51
|
+
* @return {string} The DOM `id`
|
|
52
|
+
*/
|
|
53
|
+
@api
|
|
54
|
+
get computedColumnHeaderId() {
|
|
55
|
+
const el = this.template.querySelector('[data-column-header]');
|
|
56
|
+
return getRealDOMId(el);
|
|
52
57
|
}
|
|
53
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Defines the data type for the column
|
|
61
|
+
*
|
|
62
|
+
* @type {string}
|
|
63
|
+
*/
|
|
54
64
|
@api
|
|
55
65
|
get def() {
|
|
56
66
|
return this._def;
|
|
@@ -61,18 +71,44 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
|
|
|
61
71
|
this.updateElementClasses();
|
|
62
72
|
}
|
|
63
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Defines whether the table header is hidden
|
|
76
|
+
*
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
*/
|
|
64
79
|
@api
|
|
65
|
-
get
|
|
66
|
-
return this.
|
|
80
|
+
get hideHeader() {
|
|
81
|
+
return this._hideHeader;
|
|
67
82
|
}
|
|
68
83
|
|
|
84
|
+
set hideHeader(value) {
|
|
85
|
+
this._hideHeader = value;
|
|
86
|
+
this.updateElementClasses();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Defines whether the column is resizable
|
|
91
|
+
*
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
69
94
|
@api
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
get resizable() {
|
|
96
|
+
return this._resizable;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
set resizable(value) {
|
|
100
|
+
this._resizable = value;
|
|
101
|
+
this.updateElementClasses();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Defines whether the column is sortable
|
|
106
|
+
*
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
*/
|
|
109
|
+
@api
|
|
110
|
+
get sortable() {
|
|
111
|
+
return this._sortable;
|
|
76
112
|
}
|
|
77
113
|
|
|
78
114
|
set sortable(value) {
|
|
@@ -80,111 +116,230 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
|
|
|
80
116
|
this.updateElementClasses();
|
|
81
117
|
}
|
|
82
118
|
|
|
83
|
-
|
|
84
|
-
if (this.isSelectableHeader) {
|
|
85
|
-
return selectable;
|
|
86
|
-
} else if (this.sortable) {
|
|
87
|
-
return sortable;
|
|
88
|
-
}
|
|
89
|
-
return nonsortable;
|
|
90
|
-
}
|
|
119
|
+
/************************** PUBLIC METHODS ***************************/
|
|
91
120
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Retrieves the header cell's width
|
|
123
|
+
*
|
|
124
|
+
* @return {string} The width of the cell
|
|
125
|
+
*/
|
|
126
|
+
@api
|
|
127
|
+
getDomWidth() {
|
|
128
|
+
const child = this.template.querySelector('.slds-cell-fixed');
|
|
129
|
+
if (child) {
|
|
130
|
+
return child.offsetWidth;
|
|
95
131
|
}
|
|
132
|
+
return '';
|
|
96
133
|
}
|
|
97
134
|
|
|
98
|
-
|
|
99
|
-
classListMutation(this.classList, {
|
|
100
|
-
'slds-is-sortable': this.isSortable,
|
|
101
|
-
'slds-is-resizable': this.isResizable,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
135
|
+
/************************** PRIVATE GETTERS **************************/
|
|
104
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Computes the styles for the column
|
|
139
|
+
*
|
|
140
|
+
* @return {string} The computed inline styles
|
|
141
|
+
*/
|
|
105
142
|
get columnStyles() {
|
|
106
143
|
const outlineStyle = this.isSortable ? '' : 'outline:none;';
|
|
107
144
|
|
|
108
145
|
// In RTL, we need to explicitly position the column headers.
|
|
109
146
|
// We do this by setting the offset (in pixels) from the start of the table.
|
|
110
147
|
const offsetStyle = isRTL() ? `right: ${this.def.offset}px;` : '';
|
|
148
|
+
const widthStyle = this.columnWidth
|
|
149
|
+
? `width: ${this.columnWidth}px;`
|
|
150
|
+
: '';
|
|
111
151
|
|
|
112
152
|
return `
|
|
113
|
-
|
|
153
|
+
${widthStyle}
|
|
114
154
|
${outlineStyle}
|
|
115
155
|
${offsetStyle}
|
|
116
156
|
`;
|
|
117
157
|
}
|
|
118
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Computes the classes for the column
|
|
161
|
+
*
|
|
162
|
+
* @return {string} The computed classes
|
|
163
|
+
*/
|
|
119
164
|
get computedClass() {
|
|
120
165
|
return classSet('slds-cell-fixed')
|
|
121
166
|
.add({ 'slds-has-button-menu': this.hasActions })
|
|
122
167
|
.toString();
|
|
123
168
|
}
|
|
124
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Computes the sort classes for the column
|
|
172
|
+
*
|
|
173
|
+
* @return {string} The computed sort classes
|
|
174
|
+
*/
|
|
125
175
|
get computedSortClass() {
|
|
126
176
|
return classSet('slds-th__action slds-text-link_reset')
|
|
127
177
|
.add({ 'slds-is-sorted': this.sorted })
|
|
128
|
-
.add({ 'slds-is-sorted_asc': this.
|
|
129
|
-
.add({ 'slds-is-sorted_desc': this.
|
|
178
|
+
.add({ 'slds-is-sorted_asc': this.isAscSorted })
|
|
179
|
+
.add({ 'slds-is-sorted_desc': this.isDescSorted })
|
|
130
180
|
.toString();
|
|
131
181
|
}
|
|
132
182
|
|
|
133
|
-
|
|
134
|
-
|
|
183
|
+
/**
|
|
184
|
+
* Computes an option name
|
|
185
|
+
*
|
|
186
|
+
* @return {string} The computed option name
|
|
187
|
+
*/
|
|
188
|
+
get computedOptionName() {
|
|
189
|
+
return `${this.dtContextId}-options`;
|
|
135
190
|
}
|
|
136
191
|
|
|
137
|
-
|
|
138
|
-
|
|
192
|
+
/**
|
|
193
|
+
* Determines if the header has actions available
|
|
194
|
+
*
|
|
195
|
+
* @return {boolean} Whether the header has available actions
|
|
196
|
+
*/
|
|
197
|
+
get hasActions() {
|
|
198
|
+
return (
|
|
199
|
+
this.actions.customerActions.length > 0 ||
|
|
200
|
+
this.actions.internalActions.length > 0
|
|
201
|
+
);
|
|
139
202
|
}
|
|
140
203
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return
|
|
204
|
+
/**
|
|
205
|
+
* Returns the header's aria role
|
|
206
|
+
*
|
|
207
|
+
* @return {string|boolean} The aria role for the header
|
|
208
|
+
*/
|
|
209
|
+
get headerRole() {
|
|
210
|
+
return this.isResizable || this.sortable ? 'button' : false;
|
|
148
211
|
}
|
|
149
212
|
|
|
150
|
-
|
|
151
|
-
|
|
213
|
+
/**
|
|
214
|
+
* Determines if sort direction is set to ascending
|
|
215
|
+
*
|
|
216
|
+
* @return {boolean} Whether the sort direction is ascending
|
|
217
|
+
*/
|
|
218
|
+
get isAscSorted() {
|
|
219
|
+
return this.sortedDirection === 'asc';
|
|
152
220
|
}
|
|
153
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Determines if sort direction is set to descending
|
|
224
|
+
*
|
|
225
|
+
* @return {boolean} Whether the sort direction is descending
|
|
226
|
+
*/
|
|
227
|
+
get isDescSorted() {
|
|
228
|
+
return this.sortedDirection === 'desc';
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Determines if the header is regular (unselectable)
|
|
233
|
+
*
|
|
234
|
+
* @return {boolean} Whether the header is regular
|
|
235
|
+
*/
|
|
154
236
|
get isRegularHeader() {
|
|
155
237
|
return this.def.type !== 'SELECTABLE_CHECKBOX';
|
|
156
238
|
}
|
|
157
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Determines if the header is resizable
|
|
242
|
+
*
|
|
243
|
+
* @return {boolean} Whether the header is resizable
|
|
244
|
+
*/
|
|
158
245
|
get isResizable() {
|
|
159
246
|
return this.resizable && this.def.resizable !== false;
|
|
160
247
|
}
|
|
161
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Determines if the header is selectable
|
|
251
|
+
*
|
|
252
|
+
* @return {boolean} Whether the header is selectable
|
|
253
|
+
*/
|
|
254
|
+
get isSelectableHeader() {
|
|
255
|
+
return this.def.type === 'SELECTABLE_CHECKBOX';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Determines if the header is sortable
|
|
260
|
+
*
|
|
261
|
+
* @return {boolean} Whether the header is sortable
|
|
262
|
+
*/
|
|
162
263
|
get isSortable() {
|
|
163
264
|
return this.sortable;
|
|
164
265
|
}
|
|
165
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Returns the internationalization language mapping
|
|
269
|
+
*
|
|
270
|
+
* @return {Object} The i18n mapping
|
|
271
|
+
*/
|
|
166
272
|
get i18n() {
|
|
167
273
|
return i18n;
|
|
168
274
|
}
|
|
169
275
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Returns the header's resize step
|
|
278
|
+
*
|
|
279
|
+
* @return {number} The resize step for the header
|
|
280
|
+
*/
|
|
174
281
|
get resizeStep() {
|
|
175
282
|
return this.resizestep;
|
|
176
283
|
}
|
|
177
284
|
|
|
178
|
-
|
|
179
|
-
|
|
285
|
+
/**
|
|
286
|
+
* Returns the sort order label in the appropriate language
|
|
287
|
+
*
|
|
288
|
+
* @return {string} Language-specific sort order label
|
|
289
|
+
*/
|
|
290
|
+
get sortedOrderLabel() {
|
|
291
|
+
if (this.sorted) {
|
|
292
|
+
return this.sortedDirection === 'desc'
|
|
293
|
+
? i18n.sortDesc
|
|
294
|
+
: i18n.sortAsc;
|
|
295
|
+
}
|
|
296
|
+
return i18n.sortNone;
|
|
180
297
|
}
|
|
181
298
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
299
|
+
/************************** LIFECYCLE HOOKS **************************/
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Renders the appropriate template: selectableHeader.html,
|
|
303
|
+
* sortableHeader.html, or nonsortableHeader.html.
|
|
304
|
+
* By default, nonsortableHeader.html is rendered
|
|
305
|
+
*/
|
|
306
|
+
render() {
|
|
307
|
+
if (this.isSelectableHeader) {
|
|
308
|
+
return selectable;
|
|
309
|
+
} else if (this.sortable) {
|
|
310
|
+
return sortable;
|
|
311
|
+
}
|
|
312
|
+
return nonsortable;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
renderedCallback() {
|
|
316
|
+
if (this.isSelectableHeader && this.showCheckbox) {
|
|
317
|
+
this.updateBulkSelectionCheckbox();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/************************** EVENT HANDLERS ***************************/
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Handles a sorting click on a header
|
|
325
|
+
*
|
|
326
|
+
* @param {Event} event
|
|
327
|
+
*/
|
|
328
|
+
handleSortingClick(event) {
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
|
|
331
|
+
if (this.isSortable) {
|
|
332
|
+
event.stopPropagation();
|
|
333
|
+
this.fireSortedColumn();
|
|
334
|
+
this.fireCellFocusByClickEvent();
|
|
335
|
+
}
|
|
186
336
|
}
|
|
187
337
|
|
|
338
|
+
/************************ EVENT DISPATCHERS **************************/
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Handles selecting all rows
|
|
342
|
+
*/
|
|
188
343
|
handleSelectAllRows() {
|
|
189
344
|
const { rowKeyValue, colKeyValue } = this;
|
|
190
345
|
const actionName =
|
|
@@ -204,25 +359,9 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
|
|
|
204
359
|
this.dispatchEvent(actionEvent);
|
|
205
360
|
}
|
|
206
361
|
|
|
207
|
-
handleSortingClick(event) {
|
|
208
|
-
event.preventDefault();
|
|
209
|
-
if (this.isSortable) {
|
|
210
|
-
preventDefaultAndStopPropagation(event);
|
|
211
|
-
this.fireSortedColumn();
|
|
212
|
-
this.fireCellFocusByClickEvent();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
getTargetSortDirection() {
|
|
217
|
-
if (this.sorted) {
|
|
218
|
-
return this.sortedDirection === 'desc' ? 'asc' : 'desc';
|
|
219
|
-
}
|
|
220
|
-
return this.sortedDirection;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
362
|
/**
|
|
224
363
|
* Notifies the parent datatable component by firing a private event with
|
|
225
|
-
* the details of the sort action
|
|
364
|
+
* the details of the sort action
|
|
226
365
|
*/
|
|
227
366
|
fireSortedColumn() {
|
|
228
367
|
const event = new CustomEvent('privateupdatecolsort', {
|
|
@@ -234,16 +373,38 @@ export default class PrimitiveHeaderFactory extends PrimitiveDatatableCell {
|
|
|
234
373
|
sortDirection: this.getTargetSortDirection(),
|
|
235
374
|
},
|
|
236
375
|
});
|
|
376
|
+
|
|
237
377
|
this.dispatchEvent(event);
|
|
238
378
|
}
|
|
239
379
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
380
|
+
/************************* HELPER FUNCTIONS **************************/
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Updates classes based on sort, resize and header eligibility
|
|
384
|
+
*/
|
|
385
|
+
updateElementClasses() {
|
|
386
|
+
classListMutation(this.classList, {
|
|
387
|
+
'slds-is-sortable': this.isSortable,
|
|
388
|
+
'slds-is-resizable': this.isResizable,
|
|
389
|
+
'slds-assistive-text': this.hideHeader,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Determines the opposite direction to sort on based on the current direction
|
|
395
|
+
*
|
|
396
|
+
* @return {string} The new sort direction
|
|
397
|
+
*/
|
|
398
|
+
getTargetSortDirection() {
|
|
399
|
+
if (this.sorted) {
|
|
400
|
+
return this.sortedDirection === 'desc' ? 'asc' : 'desc';
|
|
401
|
+
}
|
|
402
|
+
return this.sortedDirection;
|
|
245
403
|
}
|
|
246
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Determines the state of the header "all" checkbox based on current selections
|
|
407
|
+
*/
|
|
247
408
|
updateBulkSelectionCheckbox() {
|
|
248
409
|
const allCheckbox = this.template.querySelector(
|
|
249
410
|
'.datatable-select-all'
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
<!-- Header Content -->
|
|
3
|
+
<div class="slds-th__action slds-th__action_form slds-cell-fixed" style={columnStyles}>
|
|
4
4
|
<template if:true={showCheckbox}>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
5
|
+
<span class="slds-checkbox">
|
|
6
|
+
|
|
7
|
+
<!-- Selectable Checkbox -->
|
|
8
|
+
<input
|
|
9
|
+
type="checkbox"
|
|
10
|
+
class="datatable-select-all"
|
|
11
|
+
name={computedOptionName}
|
|
12
|
+
id="lgt-dt-header-factory-id"
|
|
13
|
+
onclick={handleSelectAllRows}
|
|
14
|
+
tabindex={internalTabIndex}
|
|
15
|
+
data-navigation="enable"
|
|
16
|
+
disabled={def.isBulkSelectionDisabled}>
|
|
17
|
+
|
|
18
|
+
<label class="slds-checkbox__label" for="lgt-dt-header-factory-id">
|
|
19
|
+
<span class="slds-checkbox_faux"></span>
|
|
20
|
+
<span class="slds-form-element__label slds-assistive-text">
|
|
21
|
+
{i18n.selectAll}
|
|
22
|
+
</span>
|
|
23
|
+
</label>
|
|
24
|
+
</span>
|
|
23
25
|
</template>
|
|
24
26
|
<template if:false={showCheckbox}>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
<span id="column-group-header" class="slds-assistive-text" data-column-header>
|
|
28
|
+
{i18n.chooseARow}
|
|
29
|
+
</span>
|
|
28
30
|
</template>
|
|
29
31
|
</div>
|
|
30
32
|
</template>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
style={columnStyles}
|
|
6
|
-
>
|
|
2
|
+
<!-- Header Content -->
|
|
3
|
+
<span class={computedClass} tabindex={internalTabIndex} style={columnStyles}>
|
|
4
|
+
|
|
7
5
|
<a href="javascript:void(0);"
|
|
8
6
|
class={computedSortClass}
|
|
9
7
|
role={headerRole}
|
|
10
8
|
tabindex={internalTabIndex}
|
|
11
9
|
data-navigation="enable"
|
|
12
10
|
onclick={handleSortingClick}
|
|
13
|
-
style={columnStyles}
|
|
11
|
+
style={columnStyles}
|
|
12
|
+
data-action-triggers="enter">
|
|
14
13
|
|
|
15
14
|
<span class="slds-assistive-text">{i18n.sort}</span>
|
|
16
15
|
|
|
16
|
+
<!-- Icon to display to the left/start of the header text -->
|
|
17
17
|
<template if:true={def.iconName}>
|
|
18
18
|
<div class="slds-grid slds-grid_vertical-align-center slds-has-flexi-truncate">
|
|
19
19
|
<lightning-icon icon-name={def.iconName} size="x-small" class="slds-icon_container slds-m-right_xx-small" alternative-text={def.label} title={def.label}></lightning-icon>
|
|
@@ -21,17 +21,18 @@
|
|
|
21
21
|
<span class="slds-truncate">{def.label}</span>
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
|
+
<!-- Arrow Icon - Rotates based on sorting direction -->
|
|
24
25
|
<lightning-primitive-icon
|
|
25
26
|
class="slds-icon_container"
|
|
26
27
|
svg-class="slds-icon slds-icon-text-default slds-is-sortable__icon"
|
|
27
28
|
icon-name="utility:arrowdown"
|
|
28
29
|
size="x-small">
|
|
29
30
|
</lightning-primitive-icon>
|
|
30
|
-
|
|
31
31
|
</div>
|
|
32
32
|
</template>
|
|
33
33
|
<template if:false={def.iconName}>
|
|
34
34
|
<span class="slds-truncate" title={def.label}>{def.label}</span>
|
|
35
|
+
<!-- Arrow Icon - Rotates based on sorting direction -->
|
|
35
36
|
<lightning-primitive-icon
|
|
36
37
|
class="slds-icon_container"
|
|
37
38
|
svg-class="slds-icon slds-icon-text-default slds-is-sortable__icon"
|
|
@@ -41,17 +42,20 @@
|
|
|
41
42
|
</template>
|
|
42
43
|
</a>
|
|
43
44
|
|
|
45
|
+
<!-- Aria Live Region to announce sorting order -->
|
|
44
46
|
<span class="slds-assistive-text" aria-live="polite" aria-atomic="true">{sortedOrderLabel}</span>
|
|
45
47
|
|
|
48
|
+
<!-- Header Actions -->
|
|
46
49
|
<template if:true={hasActions}>
|
|
47
50
|
<lightning-primitive-header-actions
|
|
48
51
|
col-key-value={def.colKeyValue}
|
|
49
52
|
actions={actions}
|
|
50
53
|
tabindex={internalTabIndex}
|
|
51
|
-
data-navigation="enable"
|
|
52
|
-
|
|
54
|
+
data-navigation="enable">
|
|
55
|
+
</lightning-primitive-header-actions>
|
|
53
56
|
</template>
|
|
54
57
|
|
|
58
|
+
<!-- Resize Handler -->
|
|
55
59
|
<template if:true={isResizable}>
|
|
56
60
|
<lightning-primitive-resize-handler
|
|
57
61
|
value={columnWidth}
|