lightning-base-components 1.18.1-alpha → 1.18.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/metadata/raptor.json +9 -0
- package/package.json +57 -1
- package/src/lightning/accordion/__docs__/accordion.md +2 -2
- package/src/lightning/accordion/accordion.css +12 -0
- package/src/lightning/accordion/accordion.html +3 -1
- package/src/lightning/accordion/accordion.js +4 -2
- package/src/lightning/accordion/accordion.slds.css +671 -0
- package/src/lightning/accordionSection/accordion-section.slds.css +647 -0
- package/src/lightning/accordionSection/accordionSection.css +14 -0
- package/src/lightning/accordionSection/accordionSection.html +23 -19
- package/src/lightning/accordionSection/accordionSection.js +29 -2
- package/src/lightning/ariaObserver/__docs__/ariaObserver.md +21 -9
- package/src/lightning/ariaObserver/ariaObserver.js +185 -154
- package/src/lightning/ariaObserver/polyfill.js +639 -0
- package/src/lightning/avatar/__docs__/avatar.md +7 -7
- package/src/lightning/avatar/avatar.css +2 -0
- package/src/lightning/avatar/avatar.html +2 -0
- package/src/lightning/avatar/avatar.js +18 -15
- package/src/lightning/avatar/avatar.slds.css +272 -0
- package/src/lightning/badge/__docs__/badge.md +2 -2
- package/src/lightning/baseCombobox/base-combobox.slds.css +1585 -0
- package/src/lightning/baseCombobox/baseCombobox.css +11 -1
- package/src/lightning/baseCombobox/baseCombobox.html +154 -146
- package/src/lightning/baseCombobox/baseCombobox.js +122 -46
- package/src/lightning/baseCombobox/spinner.slds.css +438 -0
- package/src/lightning/baseComboboxItem/baseComboboxItem.js +4 -2
- package/src/lightning/baseComboboxItem/inline.css +2 -0
- package/src/lightning/breadcrumb/breadcrumb.css +2 -2
- package/src/lightning/breadcrumb/breadcrumb.js +4 -2
- package/src/lightning/breadcrumb/breadcrumb.slds.css +2 -7
- package/src/lightning/breadcrumbs/__docs__/breadcrumbs.md +3 -3
- package/src/lightning/breadcrumbs/breadcrumbs.css +2 -2
- package/src/lightning/breadcrumbs/breadcrumbs.js +3 -2
- package/src/lightning/breadcrumbs/breadcrumbs.slds.css +7 -1
- package/src/lightning/button/__docs__/button.md +15 -15
- package/src/lightning/button/__examples__/inverse/inverse.css +8 -0
- package/src/lightning/button/__examples__/inverse/inverse.html +3 -2
- package/src/lightning/button/button.css +2 -0
- package/src/lightning/button/button.html +4 -2
- package/src/lightning/button/button.js +21 -0
- package/src/lightning/button/button.slds.css +527 -0
- package/src/lightning/buttonGroup/buttonGroup.css +2 -2
- package/src/lightning/buttonGroup/buttonGroup.js +3 -2
- package/src/lightning/buttonIcon/__docs__/buttonIcon.md +9 -9
- package/src/lightning/buttonIcon/button-icon.slds.css +215 -453
- package/src/lightning/buttonIcon/buttonIcon.css +2 -2
- package/src/lightning/buttonIcon/buttonIcon.js +4 -0
- package/src/lightning/buttonIconStateful/__docs__/buttonIconStateful.md +9 -9
- package/src/lightning/buttonIconStateful/button-icon-stateful.slds.css +215 -453
- package/src/lightning/buttonIconStateful/buttonIconStateful.css +2 -2
- package/src/lightning/buttonMenu/__docs__/buttonMenu.md +8 -8
- package/src/lightning/buttonMenu/{dropdown.slds.css → button-menu.slds.css} +853 -217
- package/src/lightning/buttonMenu/buttonMenu.css +2 -2
- package/src/lightning/buttonMenu/buttonMenu.html +2 -2
- package/src/lightning/buttonMenu/buttonMenu.js +10 -14
- package/src/lightning/buttonStateful/__docs__/buttonStateful.md +12 -12
- package/src/lightning/buttonStateful/button-stateful.slds.css +225 -457
- package/src/lightning/buttonStateful/buttonStateful.css +2 -2
- package/src/lightning/buttonStateful/buttonStateful.js +3 -2
- package/src/lightning/calendar/__examples__/basic/basic.html +7 -0
- package/src/lightning/calendar/__examples__/basic/basic.js +3 -0
- package/src/lightning/calendar/calendar.css +3 -0
- package/src/lightning/calendar/calendar.html +12 -9
- package/src/lightning/calendar/calendar.js +18 -2
- package/src/lightning/calendar/calendar.slds.css +2048 -0
- package/src/lightning/card/__docs__/card.md +3 -3
- package/src/lightning/card/card.css +2 -2
- package/src/lightning/card/card.js +3 -2
- package/src/lightning/card/card.slds.css +141 -88
- package/src/lightning/checkboxGroup/__docs__/checkboxGroup.md +2 -2
- package/src/lightning/colorPickerCustom/colorPickerCustom.css +2 -2
- package/src/lightning/colorPickerCustom/colorPickerCustom.js +3 -2
- package/src/lightning/colorPickerPanel/color-picker-panel.slds.css +11 -38
- package/src/lightning/colorPickerPanel/colorPickerPanel.css +3 -2
- package/src/lightning/colorPickerPanel/colorPickerPanel.js +4 -2
- package/src/lightning/colorPickerPanel/popover.slds.css +121 -0
- package/src/lightning/combobox/combobox.css +4 -0
- package/src/lightning/combobox/combobox.html +31 -29
- package/src/lightning/combobox/combobox.js +21 -4
- package/src/lightning/combobox/combobox.slds.css +13 -0
- package/src/lightning/combobox/form-element.slds.css +281 -0
- package/src/lightning/configProvider/defaultConfig.js +2 -1
- package/src/lightning/datatable/__docs__/datatable.md +45 -35
- package/src/lightning/datatable/autoWidthStrategy.js +3 -0
- package/src/lightning/datatable/columnWidthManager.js +1 -1
- package/src/lightning/datatable/datatable.js +8 -7
- package/src/lightning/datatable/rowSelection.js +7 -4
- package/src/lightning/datatable/templates/table/table.html +1 -0
- package/src/lightning/datepicker/datepicker.css +3 -0
- package/src/lightning/datepicker/datepicker.html +7 -4
- package/src/lightning/datepicker/datepicker.js +76 -20
- package/src/lightning/datepicker/form-element.slds.css +281 -0
- package/src/lightning/datepicker/input-text.slds.css +398 -0
- package/src/lightning/datetimepicker/datetimepicker.css +3 -0
- package/src/lightning/datetimepicker/datetimepicker.html +9 -3
- package/src/lightning/datetimepicker/datetimepicker.js +42 -36
- package/src/lightning/datetimepicker/form-element.slds.css +281 -0
- package/src/lightning/datetimepicker/input-text.slds.css +398 -0
- package/src/lightning/dualListbox/dualListbox.css +2 -2
- package/src/lightning/dualListbox/dualListbox.html +3 -3
- package/src/lightning/dualListbox/dualListbox.js +47 -13
- package/src/lightning/dualListbox/form-element.slds.css +83 -34
- package/src/lightning/dualListbox/keyboard.js +20 -1
- package/src/lightning/dynamicIcon/dynamicIcon.js +3 -2
- package/src/lightning/dynamicIcon/ellie.css +1 -1
- package/src/lightning/dynamicIcon/eq.css +1 -1
- package/src/lightning/dynamicIcon/score.css +1 -1
- package/src/lightning/dynamicIcon/strength.css +1 -1
- package/src/lightning/dynamicIcon/trend.css +1 -1
- package/src/lightning/dynamicIcon/waffle.css +1 -1
- package/src/lightning/formattedRichText/formatted-rich-text.slds.css +230 -0
- package/src/lightning/formattedRichText/formattedRichText.css +2 -0
- package/src/lightning/formattedRichText/formattedRichText.js +4 -2
- package/src/lightning/formattedRichText/linkify.js +2 -2
- package/src/lightning/formattedText/formattedText.css +1 -0
- package/src/lightning/formattedText/formattedText.js +3 -2
- package/src/lightning/helptext/__docs__/helptext.md +2 -2
- package/src/lightning/helptext/form-element.slds.css +83 -34
- package/src/lightning/helptext/help-text.slds.css +215 -453
- package/src/lightning/helptext/helptext.css +2 -2
- package/src/lightning/helptext/helptext.js +3 -2
- package/src/lightning/i18nCldrOptions/README.md +5 -0
- package/src/lightning/i18nService/README.md +5 -0
- package/src/lightning/icon/__docs__/icon.md +5 -5
- package/src/lightning/icon/icon.css +2 -2
- package/src/lightning/icon/icon.js +21 -2
- package/src/lightning/icon/icon.slds.css +29 -17
- package/src/lightning/icon/iconColors.js +1 -0
- package/src/lightning/iconUtils/iconUtils.js +0 -12
- package/src/lightning/iconUtils/polyfill.js +5 -90
- package/src/lightning/input/__docs__/input.md +7 -7
- package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.css +6 -0
- package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.html +2 -1
- package/src/lightning/input/__examples__/checkboxbutton/checkboxbutton.js +1 -1
- package/src/lightning/input/__examples__/number/number.html +0 -5
- package/src/lightning/input/__examples__/text/text.html +0 -1
- package/src/lightning/input/form-element.slds.css +281 -0
- package/src/lightning/input/input.css +2 -3
- package/src/lightning/input/input.html +154 -244
- package/src/lightning/input/input.js +306 -595
- package/src/lightning/inputAddress/__docs__/inputAddress.md +3 -3
- package/src/lightning/inputUtils/inputUtils.js +15 -20
- package/src/lightning/inputUtils/normalize.js +7 -0
- package/src/lightning/{input/numberUtil.js → inputUtils/number.js} +1 -1
- package/src/lightning/inputUtils/utils.js +18 -0
- package/src/lightning/internationalizationLibrary/README.md +24 -0
- package/src/lightning/internationalizationLibrary/utils.js +4 -1
- package/src/lightning/layout/__docs__/layout.md +1 -1
- package/src/lightning/layout/__examples__/simple/simple.css +1 -1
- package/src/lightning/layout/layout.css +5 -1
- package/src/lightning/layout/layout.js +4 -2
- package/src/lightning/layoutItem/__examples__/alignmentBump/alignmentBump.css +1 -1
- package/src/lightning/layoutItem/__examples__/sizePerDevice/sizePerDevice.css +0 -1
- package/src/lightning/layoutItem/layoutItem.css +5 -0
- package/src/lightning/layoutItem/layoutItem.js +4 -2
- package/src/lightning/menuDivider/menu-divider.slds.css +15 -0
- package/src/lightning/menuDivider/menuDivider.css +3 -0
- package/src/lightning/menuDivider/menuDivider.html +1 -1
- package/src/lightning/menuDivider/menuDivider.js +4 -2
- package/src/lightning/menuItem/menu-item.slds.css +140 -0
- package/src/lightning/menuItem/menuItem.css +3 -0
- package/src/lightning/menuItem/menuItem.html +43 -41
- package/src/lightning/menuItem/menuItem.js +4 -4
- package/src/lightning/menuSubheader/menu-subheader.slds.css +22 -0
- package/src/lightning/menuSubheader/menuSubheader.css +3 -0
- package/src/lightning/menuSubheader/menuSubheader.html +3 -1
- package/src/lightning/menuSubheader/menuSubheader.js +4 -6
- package/src/lightning/modal/__docs__/modal.md +3 -1
- package/src/lightning/modal/__modalUtils__/modalContainerTestConstants.js +267 -0
- package/src/lightning/modal/__modalUtils__/modalContainerTestMethods.js +1165 -0
- package/src/lightning/modal/__modalUtils__/modalContainerTestMockData.js +131 -0
- package/src/lightning/modal/modal.js +1 -1
- package/src/lightning/modalBody/__docs__/modalBody.md +9 -9
- package/src/lightning/modalFooter/__docs__/modalFooter.md +9 -9
- package/src/lightning/modalHeader/__docs__/modalHeader.md +9 -9
- package/src/lightning/overlayContainer/overlayContainer.js +4 -2
- package/src/lightning/pill/__docs__/pill.md +3 -3
- package/src/lightning/pill/avatar.slds.css +272 -0
- package/src/lightning/pill/link.css +3 -0
- package/src/lightning/pill/link.html +1 -1
- package/src/lightning/pill/pill.js +29 -9
- package/src/lightning/pill/pill.slds.css +168 -0
- package/src/lightning/pill/plain.css +3 -0
- package/src/lightning/pill/plain.html +1 -1
- package/src/lightning/pill/plainLink.css +3 -0
- package/src/lightning/pill/plainLink.html +1 -1
- package/src/lightning/pillContainer/__docs__/pillContainer.md +14 -14
- package/src/lightning/pillContainer/barePillContainer.css +3 -0
- package/src/lightning/pillContainer/barePillContainer.html +1 -2
- package/src/lightning/pillContainer/listbox.slds.css +267 -0
- package/src/lightning/pillContainer/pill-container.slds.css +22 -0
- package/src/lightning/pillContainer/pill.slds.css +168 -0
- package/src/lightning/pillContainer/pillContainer.js +7 -3
- package/src/lightning/pillContainer/standardPillContainer.css +4 -0
- package/src/lightning/pillContainer/standardPillContainer.html +2 -2
- package/src/lightning/popup/popover.slds.css +119 -119
- package/src/lightning/popup/popup.css +1 -2
- package/src/lightning/popup/popup.js +3 -2
- package/src/lightning/positionLibrary/elementProxy.js +7 -2
- package/src/lightning/positionLibrary/util.js +8 -0
- package/src/lightning/primitiveBubble/primitiveBubble.css +2 -2
- package/src/lightning/primitiveBubble/primitiveBubble.js +4 -2
- package/src/lightning/primitiveButton/primitiveButton.js +5 -4
- package/src/lightning/primitiveCellFactory/cellWithStandardLayout.html +29 -21
- package/src/lightning/primitiveCellFactory/primitiveCellFactory.js +4 -0
- package/src/lightning/primitiveColorpickerButton/color-picker-button.slds.css +31 -19
- package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.css +2 -2
- package/src/lightning/primitiveColorpickerButton/primitiveColorpickerButton.js +5 -3
- package/src/lightning/primitiveIcon/icon.slds.css +209 -0
- package/src/lightning/primitiveIcon/primitiveIcon.css +2 -1
- package/src/lightning/primitiveIcon/primitiveIcon.html +1 -1
- package/src/lightning/primitiveIcon/primitiveIcon.js +26 -16
- package/src/lightning/progressStep/progressStep.js +10 -13
- package/src/lightning/radioGroup/__docs__/radioGroup.md +4 -4
- package/src/lightning/radioGroup/radioGroup.css +2 -1
- package/src/lightning/radioGroup/radioGroup.js +4 -2
- package/src/lightning/select/__docs__/select.md +2 -2
- package/src/lightning/select/form-element.slds.css +83 -34
- package/src/lightning/select/select.css +2 -2
- package/src/lightning/select/select.js +4 -2
- package/src/lightning/select/select.slds.css +86 -34
- package/src/lightning/shadowBaseClassPrivate/shadowBaseClassPrivate.js +1 -1
- package/src/lightning/sldsCommon/sldsCommon.css +251 -89
- package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.css +10 -0
- package/src/lightning/sldsUtilsAlignment/sldsUtilsAlignment.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.css +18 -0
- package/src/lightning/sldsUtilsBorders/sldsUtilsBorders.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsBox/sldsUtilsBox.css +24 -0
- package/src/lightning/sldsUtilsBox/sldsUtilsBox.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.css +20 -0
- package/src/lightning/sldsUtilsFloats/sldsUtilsFloats.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.css +259 -0
- package/src/lightning/sldsUtilsGrid/sldsUtilsGrid.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.css +8 -0
- package/src/lightning/sldsUtilsHyphenation/sldsUtilsHyphenation.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.css +57 -0
- package/src/lightning/sldsUtilsLineClamp/sldsUtilsLineClamp.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.css +313 -0
- package/src/lightning/sldsUtilsMargin/sldsUtilsMargin.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.css +308 -0
- package/src/lightning/sldsUtilsPadding/sldsUtilsPadding.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.css +18 -0
- package/src/lightning/sldsUtilsPosition/sldsUtilsPosition.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.css +1408 -0
- package/src/lightning/sldsUtilsSizing/sldsUtilsSizing.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.css +295 -0
- package/src/lightning/sldsUtilsThemes/sldsUtilsThemes.js-meta.xml +4 -0
- package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.css +14 -0
- package/src/lightning/sldsUtilsTruncation/sldsUtilsTruncation.js-meta.xml +4 -0
- package/src/lightning/slider/__docs__/slider.md +2 -2
- package/src/lightning/spinner/spinner.css +2 -2
- package/src/lightning/spinner/spinner.js +4 -2
- package/src/lightning/tabBar/tab-bar.slds.css +334 -0
- package/src/lightning/tabBar/tabBar.css +2 -0
- package/src/lightning/tabBar/tabBar.html +4 -3
- package/src/lightning/tabBar/tabBar.js +30 -3
- package/src/lightning/tabset/__docs__/tabset.md +2 -2
- package/src/lightning/tabset/tabset.html +5 -4
- package/src/lightning/tabset/tabset.js +29 -11
- package/src/lightning/textarea/__docs__/textarea.md +2 -2
- package/src/lightning/timepicker/form-element.slds.css +281 -0
- package/src/lightning/timepicker/timepicker.css +3 -0
- package/src/lightning/timepicker/timepicker.html +5 -1
- package/src/lightning/timepicker/timepicker.js +22 -17
- package/src/lightning/timepicker/timepicker.slds.css +18 -0
- package/src/lightning/toast/toast.js-meta.xml +2 -0
- package/src/lightning/toastContainer/__docs__/toastContainer.md +14 -34
- package/src/lightning/toastContainer/toastContainer.js +10 -15
- package/src/lightning/tooltipLibrary/tooltipLibrary.js +32 -23
- package/src/lightning/utilsPrivate/browser.js +5 -3
- package/src/lightning/utilsPrivate/os.js +6 -4
- package/src/lightning/utilsPrivate/ssr.js +4 -0
- package/src/lightning/utilsPrivate/utilsPrivate.js +2 -0
- package/src/lightning/verticalNavigation/verticalNavigation.css +2 -1
- package/src/lightning/verticalNavigation/verticalNavigation.js +3 -2
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.css +2 -1
- package/src/lightning/verticalNavigationSection/verticalNavigationSection.js +3 -2
- package/src/lightning/accordion/__perf__DISABLED/accordion-perf-utils.js +0 -76
- package/src/lightning/accordion/__perf__DISABLED/accordion10Multiple25SectionEach.perf.js +0 -57
- package/src/lightning/accordion/__perf__DISABLED/accordion10Simple25SectionEach.perf.js +0 -37
- package/src/lightning/accordion/__perf__DISABLED/accordionMultiple50Section.perf.js +0 -45
- package/src/lightning/accordion/__perf__DISABLED/accordionSimple50Section.perf.js +0 -35
- package/src/lightning/accordion/__perf__DISABLED/container/container.html +0 -15
- package/src/lightning/accordion/__perf__DISABLED/container/container.js +0 -7
- package/src/lightning/iconUtils/isIframeInEdge.js +0 -7
- package/src/lightning/iconUtils/supportsSvg.js +0 -16
- package/src/lightning/input/input-checkbox.slds.css +0 -404
- package/src/lightning/input/input-text.slds.css +0 -287
- package/src/lightning/input/normalize.js +0 -6
- package/src/lightning/input/selection.js +0 -131
- package/src/lightning/positionLibrary/__component__/positionLibraryBounding.spec.js +0 -319
- package/src/lightning/positionLibrary/__component__/x/bounding/bounding.css +0 -16
- package/src/lightning/positionLibrary/__component__/x/bounding/bounding.html +0 -36
- package/src/lightning/positionLibrary/__component__/x/bounding/bounding.js +0 -122
- /package/src/lightning/{baseCombobox → baseComboboxItem}/listbox.slds.css +0 -0
- /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.html +0 -0
- /package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.js +0 -0
- /package/src/lightning/{input/emailUtil.js → inputUtils/email.js} +0 -0
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<div part="combobox">
|
|
3
|
+
<label class={computedLabelClass}>
|
|
4
|
+
<template if:true={required}>
|
|
5
|
+
<abbr class="slds-required" title={i18n.required}>*</abbr>
|
|
6
|
+
</template>
|
|
7
|
+
{label}
|
|
8
|
+
</label>
|
|
9
|
+
<lightning-helptext if:true={_fieldLevelHelp} content={_fieldLevelHelp} alternative-text={helptextAlternativeText}></lightning-helptext>
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
<div class="slds-form-element__control">
|
|
12
|
+
<lightning-base-combobox name={name}
|
|
13
|
+
autocomplete={autocomplete}
|
|
14
|
+
root-aria-node={templateRootNode}
|
|
15
|
+
required={required}
|
|
16
|
+
disabled={disabled}
|
|
17
|
+
placeholder={placeholder}
|
|
18
|
+
items={_items}
|
|
19
|
+
input-text={_selectedLabel}
|
|
20
|
+
input-label={label}
|
|
21
|
+
input-icon-size="xx-small"
|
|
22
|
+
input-icon-name="utility:down"
|
|
23
|
+
show-dropdown-activity-indicator={spinnerActive}
|
|
24
|
+
dropdown-alignment={dropdownAlignment}
|
|
25
|
+
ondropdownopen={handleDropdownOpen}
|
|
26
|
+
onfocus={handleFocus}
|
|
27
|
+
onblur={handleBlur}
|
|
28
|
+
onready={handleComboboxReady}
|
|
29
|
+
onselect={handleSelect}></lightning-base-combobox>
|
|
30
|
+
</div>
|
|
31
|
+
<template if:true={_helpMessage}>
|
|
32
|
+
<div id="help-text" data-help-text class="slds-form-element__help" aria-live="assertive">{_helpMessage}</div>
|
|
33
|
+
</template>
|
|
28
34
|
</div>
|
|
29
|
-
<template if:true={_helpMessage}>
|
|
30
|
-
<div id="help-text" data-help-text class="slds-form-element__help" aria-live="assertive">{_helpMessage}</div>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
35
|
</template>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import labelRequired from '@salesforce/label/LightningControl.required';
|
|
2
2
|
import labelPlaceholder from '@salesforce/label/LightningCombobox.placeholder';
|
|
3
3
|
import labelHelpTextAlternativeText from '@salesforce/label/LightningInput.helptextAlternativeText';
|
|
4
|
-
import {
|
|
4
|
+
import { api, track } from 'lwc';
|
|
5
|
+
import LightningShadowBaseClass from 'lightning/shadowBaseClassPrivate';
|
|
5
6
|
import { classSet, formatLabel } from 'lightning/utils';
|
|
6
7
|
import {
|
|
7
|
-
|
|
8
|
+
classListMutation,
|
|
8
9
|
normalizeArray,
|
|
10
|
+
normalizeBoolean,
|
|
11
|
+
reflectAttribute,
|
|
9
12
|
synchronizeAttrs,
|
|
10
|
-
classListMutation,
|
|
11
13
|
} from 'lightning/utilsPrivate';
|
|
12
14
|
import {
|
|
13
15
|
isEmptyString,
|
|
@@ -26,7 +28,7 @@ const i18n = {
|
|
|
26
28
|
* A widget that provides an input field that is readonly,
|
|
27
29
|
* accompanied by a dropdown list of selectable options.
|
|
28
30
|
*/
|
|
29
|
-
export default class LightningCombobox extends
|
|
31
|
+
export default class LightningCombobox extends LightningShadowBaseClass {
|
|
30
32
|
static delegatesFocus = true;
|
|
31
33
|
|
|
32
34
|
@track _ariaLabelledBy = '';
|
|
@@ -93,6 +95,7 @@ export default class LightningCombobox extends LightningElement {
|
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
connectedCallback() {
|
|
98
|
+
super.connectedCallback();
|
|
96
99
|
this.classList.add('slds-form-element');
|
|
97
100
|
this.updateClassList();
|
|
98
101
|
this.interactingState = new InteractingState();
|
|
@@ -181,6 +184,7 @@ export default class LightningCombobox extends LightningElement {
|
|
|
181
184
|
set variant(value) {
|
|
182
185
|
this._variant = normalizeVariant(value);
|
|
183
186
|
this.updateClassList();
|
|
187
|
+
reflectAttribute(this, 'variant', this._variant);
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
/**
|
|
@@ -325,6 +329,15 @@ export default class LightningCombobox extends LightningElement {
|
|
|
325
329
|
@api
|
|
326
330
|
reportValidity() {
|
|
327
331
|
return this._constraint.reportValidity((message) => {
|
|
332
|
+
// manage invalid attribute on the base combobox
|
|
333
|
+
// this is done to allow css to target invalid base-combobox state
|
|
334
|
+
// we may want to update the logic in base combobox to handle this
|
|
335
|
+
// more generally once more usages like grouped, lookupaddress etc. are migrated
|
|
336
|
+
reflectAttribute(
|
|
337
|
+
this.template.querySelector('lightning-base-combobox'),
|
|
338
|
+
'invalid',
|
|
339
|
+
!this.checkValidity()
|
|
340
|
+
);
|
|
328
341
|
this._helpMessage = message;
|
|
329
342
|
});
|
|
330
343
|
}
|
|
@@ -362,6 +375,10 @@ export default class LightningCombobox extends LightningElement {
|
|
|
362
375
|
baseCombobox.inputDescribedByElements = this.computedAriaDescribedBy;
|
|
363
376
|
}
|
|
364
377
|
|
|
378
|
+
get templateRootNode() {
|
|
379
|
+
return this.template.host.getRootNode();
|
|
380
|
+
}
|
|
381
|
+
|
|
365
382
|
get i18n() {
|
|
366
383
|
return i18n;
|
|
367
384
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
|
|
3
|
+
Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
4
|
+
|
|
5
|
+
@supports (--styling-hooks: '') {
|
|
6
|
+
/**
|
|
7
|
+
* Invalid State
|
|
8
|
+
*/
|
|
9
|
+
:host([data-render-mode="shadow"][invalid]) [part~='combobox'] {
|
|
10
|
+
--slds-c-inputtext-color-border: var(--sds-g-color-error-base-50, #ea001e);
|
|
11
|
+
--slds-c-inputtext-sizing-border: var(--sds-g-sizing-border-1, 1px);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
|
|
2
|
+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
|
|
3
|
+
Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
4
|
+
@supports (--styling-hooks: '') {
|
|
5
|
+
/* TODO: Swap with utility classes */
|
|
6
|
+
:host([data-render-mode="shadow"]) fieldset {
|
|
7
|
+
border: 0;
|
|
8
|
+
margin: 0;
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* FORM ELEMENT: BASE */
|
|
13
|
+
:host([data-render-mode="shadow"]) .slds-form-element {
|
|
14
|
+
position: relative;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host([data-render-mode="shadow"]) .slds-form-element__label {
|
|
19
|
+
overflow-wrap: break-word;
|
|
20
|
+
word-wrap: break-word;
|
|
21
|
+
hyphens: auto;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
color: var(--sds-g-color-neutral-base-30, #444444);
|
|
24
|
+
font-size: var(--sds-g-font-scale-neg-3, 0.75rem);
|
|
25
|
+
padding-inline-end: var(--sds-g-spacing-2, 0.5rem);
|
|
26
|
+
padding-block-start: var(--sds-g-spacing-1, 0.25rem);
|
|
27
|
+
margin-block-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host([data-render-mode="shadow"]) .slds-form-element__label:empty {
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([data-render-mode="shadow"]) .slds-form-element__control {
|
|
35
|
+
clear: left; /* NOTE: Ideally we want left to be inline-start but browser support is not ready for that value. We need to figure out better RTL support */
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([data-render-mode="shadow"]) .slds-form-element__icon {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
position: relative;
|
|
42
|
+
padding-block-start: var(--sds-g-spacing-1, 0.25rem);
|
|
43
|
+
vertical-align: top;
|
|
44
|
+
line-height: var(--sds-g-font-lineheight-1, 1);
|
|
45
|
+
z-index: 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([data-render-mode="shadow"]) .slds-form-element__icon .slds-button_icon {
|
|
49
|
+
position: relative;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:host([data-render-mode="shadow"]) .slds-form-element__help,:host([data-render-mode="shadow"])
|
|
53
|
+
.slds-form-element__helper {
|
|
54
|
+
font-size: var(--sds-g-font-scale-neg-3, 0.75rem);
|
|
55
|
+
margin-block-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([data-render-mode="shadow"]) .slds-form-element_edit .slds-form-element__static {
|
|
60
|
+
width: calc(100% - var(--sds-g-sizing-7, 1.5rem));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([data-render-mode="shadow"]) .slds-form-element_readonly {
|
|
64
|
+
flex-basis: 0%;
|
|
65
|
+
border-bottom: var(--sds-g-sizing-border-1, 1px) solid var(--sds-g-color-neutral-base-90, #e5e5e5);
|
|
66
|
+
margin-block-end: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([data-render-mode="shadow"]) .slds-form-element_readonly .slds-form-element__control {
|
|
70
|
+
padding-block-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
71
|
+
padding-block-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
:host([data-render-mode="shadow"]) .slds-form-element_readonly .slds-form-element__label {
|
|
75
|
+
margin-block-end: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host([data-render-mode="shadow"]) .slds-form-element__legend {
|
|
79
|
+
font-weight: var(--sds-g-font-weight-7, 700);
|
|
80
|
+
float: left;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([data-render-mode="shadow"]) .slds-form-element__addon {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
margin-block-start: 0;
|
|
86
|
+
margin-block-end: 0;
|
|
87
|
+
margin-inline-start: var(--sds-g-spacing-2, 0.5rem);
|
|
88
|
+
margin-inline-end: var(--sds-g-spacing-2, 0.5rem);
|
|
89
|
+
align-self: center;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
:host([data-render-mode="shadow"]) .slds-form-element__static {
|
|
93
|
+
overflow-wrap: break-word;
|
|
94
|
+
word-wrap: break-word;
|
|
95
|
+
word-break: break-word;
|
|
96
|
+
display: inline-block;
|
|
97
|
+
font-size: var(--sds-g-font-scale-neg-1, 0.875rem);
|
|
98
|
+
font-weight: var(--sds-g-font-weight-4, 400);
|
|
99
|
+
color: var(--sds-g-color-neutral-base-10, #181818);
|
|
100
|
+
width: 100%;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([data-render-mode="shadow"]) .slds-form-element__static.slds-text-longform *:last-child {
|
|
104
|
+
margin-block-end: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:host([data-render-mode="shadow"]) .slds-form-element__static:empty {
|
|
108
|
+
min-height: calc(var(--sds-g-sizing-6, 1.25rem) + 1px);
|
|
109
|
+
vertical-align: bottom;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
:host([data-render-mode="shadow"]) .slds-form-element__static--edit {
|
|
113
|
+
width: calc(100% - var(--sds-g-sizing-7, 1.5rem));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host([data-render-mode="shadow"]) .slds-required {
|
|
117
|
+
color: var(--sds-g-color-error-base-50, #ea001e);
|
|
118
|
+
margin-block-start: 0;
|
|
119
|
+
margin-block-end: 0;
|
|
120
|
+
margin-inline-start: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
121
|
+
margin-inline-end: calc(var(--sds-g-spacing-1, 0.25rem) / 2);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host([data-render-mode="shadow"]) .slds-has-error .slds-form-element__help {
|
|
125
|
+
color: var(--sds-g-color-error-base-50, #ea001e);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host([data-render-mode="shadow"][invalid]) .slds-form-element__help {
|
|
129
|
+
color: var(--sds-g-color-error-base-50, #ea001e);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* --------------------------------------- */
|
|
133
|
+
|
|
134
|
+
/* FORM ELEMENT: STACKED */
|
|
135
|
+
|
|
136
|
+
:host([data-render-mode="shadow"][variant~='label-stacked']) {
|
|
137
|
+
display: block;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* TODO: Using `:not` is currently not working, and it could break the build because of issues with the dist script */
|
|
141
|
+
|
|
142
|
+
/* :host([variant~='label-stacked']):not(.slds-form-element_readonly) {
|
|
143
|
+
margin-block-end: var(--sds-g-spacing-2);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([variant~='label-stacked']):not(.slds-is-editing) {
|
|
147
|
+
padding: 0 var(--sds-g-spacing-1);
|
|
148
|
+
} */
|
|
149
|
+
|
|
150
|
+
/* :host([variant~='label-stacked']):not([class*="slds-size"]) {
|
|
151
|
+
width: 100%;
|
|
152
|
+
flex-basis: 100%;
|
|
153
|
+
} */
|
|
154
|
+
|
|
155
|
+
:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element {
|
|
156
|
+
padding: 0;
|
|
157
|
+
margin-block-end: 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__label,:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__control {
|
|
161
|
+
border-bottom: 0; /* Remove border when using legacy version of slds-form-element */
|
|
162
|
+
padding-inline-start: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__control {
|
|
166
|
+
width: 100%;
|
|
167
|
+
flex-basis: 100%;
|
|
168
|
+
clear: left;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:host([data-render-mode="shadow"][variant~='label-stacked']) .slds-form-element__icon {
|
|
172
|
+
float: none;
|
|
173
|
+
padding-block-start: var(--sds-g-spacing-1, 0.25rem);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* --------------------------------------- */
|
|
177
|
+
|
|
178
|
+
/* FORM ELEMENT: INLINE */
|
|
179
|
+
|
|
180
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) {
|
|
181
|
+
display: block;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/*
|
|
185
|
+
we have to combine with slds class here to avoid duplication
|
|
186
|
+
of this rule in child elements who import this stylesheet
|
|
187
|
+
in lighting-input this slds class is synonymous with the variant
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
:host([data-render-mode="shadow"][variant~='label-inline'].slds-form-element_horizontal) {
|
|
191
|
+
padding: var(--sds-g-spacing-1, 0.25rem);
|
|
192
|
+
margin-block-end: var(--sds-g-spacing-2, 0.5rem);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/* TODO: Using `:not` is currently not working, and it could break the build because of issues with the dist script */
|
|
196
|
+
|
|
197
|
+
/* :host([variant~='label-inline']):not(.slds-form-element_readonly) {
|
|
198
|
+
margin-block-end: var(--sds-g-spacing-2);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
:host([variant~='label-inline']):not([class*="slds-size"]) {
|
|
202
|
+
width: 100%;
|
|
203
|
+
flex-basis: 100%;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
:host([variant~='label-inline']:not(.slds-is-editing)) {
|
|
207
|
+
padding: var(--sds-g-spacing-1);
|
|
208
|
+
} */
|
|
209
|
+
|
|
210
|
+
:host([data-render-mode="shadow"][variant~='label-inline']).slds-is-edited {
|
|
211
|
+
padding-block-start: var(--sds-g-sizing-6, 1.25rem)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@media (min-width: 48em) {
|
|
215
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__label {
|
|
216
|
+
float: left;
|
|
217
|
+
max-width: calc(33% - var(--sds-g-sizing-6, 1.25rem)); /* Removing icon width for when the help-text icon is present */
|
|
218
|
+
flex-basis: calc(33% - var(--sds-g-sizing-6, 1.25rem)); /* Some form element controls are set to display:flex */
|
|
219
|
+
flex-grow: 1; /* For IE and Safari which didn't auto expand to the available space */
|
|
220
|
+
margin-block-end: 0;
|
|
221
|
+
position: relative;
|
|
222
|
+
z-index: 1;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) lightning-helptext {
|
|
226
|
+
float: left;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__control {
|
|
230
|
+
margin-inline-start: 33%;
|
|
231
|
+
clear: none; /* Reset clear: left when switching to horizontal form layout */
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__control .slds-form-element__control {
|
|
235
|
+
padding-inline-start: 0; /* Remove left padding on nested form controls, due to issues related to lightning-form components */
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-dueling-list__column .slds-form-element__label {
|
|
239
|
+
width: auto;
|
|
240
|
+
max-width: 100%;
|
|
241
|
+
-ms-flex-preferred-size: auto;
|
|
242
|
+
flex-basis: auto;
|
|
243
|
+
float: none;
|
|
244
|
+
position: relative;
|
|
245
|
+
padding-inline-start: 0;
|
|
246
|
+
margin-block-end: 0;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-form-element__help {
|
|
250
|
+
margin-inline-start: 33%;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
:host([data-render-mode="shadow"][variant~='label-inline']) .slds-dueling-list {
|
|
254
|
+
clear: none;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* --------------------------------------- */
|
|
259
|
+
|
|
260
|
+
/* FORM ELEMENT: COMPOUND */
|
|
261
|
+
|
|
262
|
+
:host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element__row {
|
|
263
|
+
display: flex;
|
|
264
|
+
margin-bottom: var(--sds-g-spacing-1, 0.25rem);
|
|
265
|
+
margin-left: calc(var(--sds-g-spacing-1, 0.25rem) * -1);
|
|
266
|
+
margin-right: calc(var(--sds-g-spacing-1, 0.25rem) * -1);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
:host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element__row .slds-form-element__label {
|
|
270
|
+
padding-top: 0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
:host([data-render-mode="shadow"]) .slds-form-element_compound .slds-form-element {
|
|
274
|
+
padding-left: var(--sds-g-spacing-1, 0.25rem);
|
|
275
|
+
padding-right: var(--sds-g-spacing-1, 0.25rem);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
:host([data-render-mode="shadow"]) .slds-form-element_address .slds-form-element__row {
|
|
279
|
+
align-items: flex-end;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import localizationService from './defaultLocalizationConfig';
|
|
2
|
+
import { isCSR } from 'lightning/utilsPrivate';
|
|
2
3
|
|
|
3
4
|
function getConfigFromAura($A) {
|
|
4
5
|
return {
|
|
@@ -34,7 +35,7 @@ function createStandAloneConfig() {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
export function getDefaultConfig() {
|
|
37
|
-
return window.$A !== undefined && window.$A.localizationService
|
|
38
|
+
return isCSR && window.$A !== undefined && window.$A.localizationService
|
|
38
39
|
? getConfigFromAura(window.$A)
|
|
39
40
|
: createStandAloneConfig();
|
|
40
41
|
}
|
|
@@ -42,7 +42,10 @@ include:
|
|
|
42
42
|
|
|
43
43
|
Tables can be populated during initialization using the `data`, `columns`, and
|
|
44
44
|
`key-field` attributes. The `key-field` attribute is required for correct table behavior.
|
|
45
|
-
It associates each row with a unique identifier.
|
|
45
|
+
It associates each row with a unique identifier. The value you use for `key-field` is
|
|
46
|
+
case-sensitive and must match what's in your `data` array.
|
|
47
|
+
If you use `key-field="Id"`, make sure the Id you provide in the `data` array
|
|
48
|
+
uses `Id` and not `id`.
|
|
46
49
|
|
|
47
50
|
This example creates a table whose first column displays a checkbox for row selection.
|
|
48
51
|
The checkbox column is displayed by default, and you can hide it by adding `hide-checkbox-column` in your markup.
|
|
@@ -53,7 +56,7 @@ Selecting the checkbox selects the entire row of data and triggers the `onrowsel
|
|
|
53
56
|
<lightning-datatable
|
|
54
57
|
data={data}
|
|
55
58
|
columns={columns}
|
|
56
|
-
key-field="
|
|
59
|
+
key-field="Id"
|
|
57
60
|
onrowselection={getSelectedName}
|
|
58
61
|
>
|
|
59
62
|
</lightning-datatable>
|
|
@@ -71,51 +74,51 @@ or decreasing confidence trend. The icon is specified with the `cellAttributes`
|
|
|
71
74
|
property. See **Working with Column Properties** for more information about the
|
|
72
75
|
properties for columns.
|
|
73
76
|
|
|
74
|
-
The JavaScript also loads two rows of data in the table. The
|
|
77
|
+
The JavaScript also loads two rows of data in the table. The Id for each
|
|
75
78
|
table row is used as the `key-field`.
|
|
76
79
|
|
|
77
80
|
```javascript
|
|
78
81
|
import { LightningElement } from 'lwc';
|
|
79
82
|
|
|
80
83
|
const columns = [
|
|
81
|
-
{ label: 'Opportunity name', fieldName: '
|
|
84
|
+
{ label: 'Opportunity name', fieldName: 'OpportunityName', type: 'text' },
|
|
82
85
|
{
|
|
83
86
|
label: 'Confidence',
|
|
84
|
-
fieldName: '
|
|
87
|
+
fieldName: 'Confidence',
|
|
85
88
|
type: 'percent',
|
|
86
89
|
cellAttributes: {
|
|
87
|
-
iconName: { fieldName: '
|
|
90
|
+
iconName: { fieldName: 'TrendIcon' },
|
|
88
91
|
iconPosition: 'right',
|
|
89
92
|
},
|
|
90
93
|
},
|
|
91
94
|
{
|
|
92
95
|
label: 'Amount',
|
|
93
|
-
fieldName: '
|
|
96
|
+
fieldName: 'Amount',
|
|
94
97
|
type: 'currency',
|
|
95
98
|
typeAttributes: { currencyCode: 'EUR', step: '0.001' },
|
|
96
99
|
},
|
|
97
|
-
{ label: 'Contact Email', fieldName: '
|
|
98
|
-
{ label: 'Contact Phone', fieldName: '
|
|
100
|
+
{ label: 'Contact Email', fieldName: 'Contact', type: 'email' },
|
|
101
|
+
{ label: 'Contact Phone', fieldName: 'Phone', type: 'phone' },
|
|
99
102
|
];
|
|
100
103
|
|
|
101
104
|
const data = [
|
|
102
105
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
Id: 'a',
|
|
107
|
+
OpportunityName: 'Cloudhub',
|
|
108
|
+
Confidence: 0.2,
|
|
109
|
+
Amount: 25000,
|
|
110
|
+
Contact: 'jrogers@cloudhub.com',
|
|
111
|
+
Phone: '2352235235',
|
|
112
|
+
TrendIcon: 'utility:down',
|
|
110
113
|
},
|
|
111
114
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
Id: 'b',
|
|
116
|
+
OpportunityName: 'Quip',
|
|
117
|
+
Confidence: 0.78,
|
|
118
|
+
Amount: 740000,
|
|
119
|
+
Contact: 'quipy@quip.com',
|
|
120
|
+
Phone: '2352235235',
|
|
121
|
+
TrendIcon: 'utility:up',
|
|
119
122
|
},
|
|
120
123
|
];
|
|
121
124
|
|
|
@@ -127,7 +130,7 @@ export default class DatatableExample extends LightningElement {
|
|
|
127
130
|
const selectedRows = event.detail.selectedRows;
|
|
128
131
|
// Display that fieldName of the selected rows
|
|
129
132
|
for (let i = 0; i < selectedRows.length; i++) {
|
|
130
|
-
alert('You selected: ' + selectedRows[i].
|
|
133
|
+
alert('You selected: ' + selectedRows[i].OpportunityName);
|
|
131
134
|
}
|
|
132
135
|
}
|
|
133
136
|
}
|
|
@@ -154,7 +157,7 @@ public with sharing class ContactController {
|
|
|
154
157
|
}
|
|
155
158
|
```
|
|
156
159
|
|
|
157
|
-
The template wires up the datatable to the contact records using the `
|
|
160
|
+
The template wires up the datatable to the contact records using the `id` field.
|
|
158
161
|
|
|
159
162
|
```html
|
|
160
163
|
<template>
|
|
@@ -552,7 +555,7 @@ there are no more data to load.
|
|
|
552
555
|
<lightning-datatable
|
|
553
556
|
columns={columns}
|
|
554
557
|
data={data}
|
|
555
|
-
key-field="
|
|
558
|
+
key-field="Id"
|
|
556
559
|
enable-infinite-loading
|
|
557
560
|
onloadmore={loadMoreData}
|
|
558
561
|
>
|
|
@@ -657,7 +660,7 @@ Publishing State column matches either the Published or Unpublished state.
|
|
|
657
660
|
<lightning-datatable
|
|
658
661
|
columns={mycolumns}
|
|
659
662
|
data={mydata}
|
|
660
|
-
key-field="
|
|
663
|
+
key-field="Id"
|
|
661
664
|
onheaderaction={handleHeaderAction}
|
|
662
665
|
>
|
|
663
666
|
</lightning-datatable>
|
|
@@ -746,7 +749,7 @@ Supported attributes for the row actions are as follows.
|
|
|
746
749
|
<lightning-datatable
|
|
747
750
|
columns={mycolumns}
|
|
748
751
|
data={mydata}
|
|
749
|
-
key-field="
|
|
752
|
+
key-field="Id"
|
|
750
753
|
onrowaction={handleRowAction}
|
|
751
754
|
>
|
|
752
755
|
</lightning-datatable>
|
|
@@ -890,7 +893,7 @@ Columns have a default minimum width of 50px and maximum width of 1000px. To cha
|
|
|
890
893
|
|
|
891
894
|
```html
|
|
892
895
|
<lightning-datatable
|
|
893
|
-
key-field="
|
|
896
|
+
key-field="Id"
|
|
894
897
|
data={data}
|
|
895
898
|
columns={columns}
|
|
896
899
|
min-column-width="80"
|
|
@@ -904,7 +907,7 @@ Resizing a column fires the `resize` event. For more information, See the **Cust
|
|
|
904
907
|
|
|
905
908
|
```html
|
|
906
909
|
<lightning-datatable
|
|
907
|
-
key-field="
|
|
910
|
+
key-field="Id"
|
|
908
911
|
data={data}
|
|
909
912
|
columns={columns}
|
|
910
913
|
onresize={handleResize}
|
|
@@ -982,7 +985,7 @@ useful when you want to preselect rows.
|
|
|
982
985
|
<lightning-datatable
|
|
983
986
|
columns={columns}
|
|
984
987
|
data={data}
|
|
985
|
-
key-field="
|
|
988
|
+
key-field="Id"
|
|
986
989
|
selected-rows={selectedRows}
|
|
987
990
|
>
|
|
988
991
|
</lightning-datatable>
|
|
@@ -1051,7 +1054,7 @@ press the Enter or Tab key, or move away from the cell.
|
|
|
1051
1054
|
```html
|
|
1052
1055
|
<template>
|
|
1053
1056
|
<lightning-datatable
|
|
1054
|
-
key-field="
|
|
1057
|
+
key-field="Id"
|
|
1055
1058
|
data={data}
|
|
1056
1059
|
columns={columns}
|
|
1057
1060
|
onsave={handleSave}
|
|
@@ -1104,7 +1107,7 @@ Your `lightning-datatable` component should look like this.
|
|
|
1104
1107
|
```html
|
|
1105
1108
|
<template>
|
|
1106
1109
|
<lightning-datatable
|
|
1107
|
-
key-field="
|
|
1110
|
+
key-field="Id"
|
|
1108
1111
|
data={data}
|
|
1109
1112
|
columns={columns}
|
|
1110
1113
|
errors={errors}
|
|
@@ -1187,7 +1190,7 @@ This example displays three lines of text and hides the rest; the text on line 3
|
|
|
1187
1190
|
<lightning-datatable
|
|
1188
1191
|
data={data}
|
|
1189
1192
|
columns={columns}
|
|
1190
|
-
key-field="
|
|
1193
|
+
key-field="Id"
|
|
1191
1194
|
wrap-text-max-lines="3"
|
|
1192
1195
|
>
|
|
1193
1196
|
</lightning-datatable>
|
|
@@ -1247,7 +1250,7 @@ If you have descriptions on an element or on multiple elements for the table, se
|
|
|
1247
1250
|
<h3 id="table-desc2">EMEA Region</h3>
|
|
1248
1251
|
<lightning-datatable
|
|
1249
1252
|
aria-labelledby="table-desc1 table-desc2"
|
|
1250
|
-
key-field="
|
|
1253
|
+
key-field="Id"
|
|
1251
1254
|
data={data}
|
|
1252
1255
|
columns={columns}
|
|
1253
1256
|
>
|
|
@@ -1426,3 +1429,10 @@ The event properties are as follows.
|
|
|
1426
1429
|
| bubbles | false | This event does not bubble. |
|
|
1427
1430
|
| cancelable | false | This event has no default behavior that can be canceled. You cannot call `preventDefault()` on this event. |
|
|
1428
1431
|
| composed | false | This event does not propagate outside the template in which it was dispatched. |
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
#### LWC Recipes
|
|
1435
|
+
|
|
1436
|
+
The [LWC Recipes GitHub repository](https://github.com/trailheadapps/lwc-recipes) contains code examples for Lightning Web Components that you can test in an org.
|
|
1437
|
+
|
|
1438
|
+
For a recipe that uses `lightning-datatable`, see the `c-datatable-*` components in the LWC Recipes repo.
|
|
@@ -282,6 +282,9 @@ export class AutoWidthStrategy {
|
|
|
282
282
|
if (columnDefinition && columnDefinition.wrapText) {
|
|
283
283
|
return width / widthsMetadata.wrapTextMaxLines;
|
|
284
284
|
}
|
|
285
|
+
if (columnDefinition.fixedWidth) {
|
|
286
|
+
return columnDefinition.fixedWidth;
|
|
287
|
+
}
|
|
285
288
|
return width;
|
|
286
289
|
});
|
|
287
290
|
const headerCellWidths = datatableInterface.getHeaderCellWidths();
|