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,131 +0,0 @@
|
|
|
1
|
-
import { isSafari, isIE11, timeout } from 'lightning/utilsPrivate';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Purges the selection cache to the DOM.
|
|
5
|
-
* @param input {HTMLInputElement}
|
|
6
|
-
* @param cache {InputSelectionCache}
|
|
7
|
-
*/
|
|
8
|
-
function restoreCacheToInput(input, cache) {
|
|
9
|
-
input.setSelectionRange(
|
|
10
|
-
cache._selectionStartCached,
|
|
11
|
-
cache._selectionEndCached
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
cache.clearCache();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This class provides a way to cache text selection in input fields.
|
|
19
|
-
*/
|
|
20
|
-
export class InputSelectionCache {
|
|
21
|
-
/**
|
|
22
|
-
* Cached value for selectionStart
|
|
23
|
-
* @type {number|null}
|
|
24
|
-
*/
|
|
25
|
-
_selectionStartCached = null;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Cached value for selectionEnd
|
|
29
|
-
* @type {number|null}
|
|
30
|
-
*/
|
|
31
|
-
_selectionEndCached = null;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Updates the cached values.
|
|
35
|
-
* @param {number} start The start of the selected range
|
|
36
|
-
* @param {number} end The end of the selected range
|
|
37
|
-
* @private
|
|
38
|
-
*/
|
|
39
|
-
_cacheSelectionRange(start, end) {
|
|
40
|
-
if (typeof start === 'number' && typeof end === 'number') {
|
|
41
|
-
this._selectionStartCached = start;
|
|
42
|
-
this._selectionEndCached = end;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Clears our cached selection.
|
|
48
|
-
*/
|
|
49
|
-
clearCache() {
|
|
50
|
-
this._selectionStartCached = null;
|
|
51
|
-
this._selectionEndCached = null;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* True, if the DOM element has selection.
|
|
56
|
-
* @param input {HTMLInputElement} The DOM element to operate on
|
|
57
|
-
*/
|
|
58
|
-
hasSelection(input) {
|
|
59
|
-
return (
|
|
60
|
-
input.selectionStart !== null &&
|
|
61
|
-
// If the start and end are the same, that's not selection, it's just the cursor position.
|
|
62
|
-
input.selectionStart !== input.selectionEnd
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* True, if selection has been cached.
|
|
68
|
-
*/
|
|
69
|
-
isCached() {
|
|
70
|
-
return (
|
|
71
|
-
this._selectionStartCached !== null &&
|
|
72
|
-
this._selectionEndCached !== null
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Cache the current text selection for this input field.
|
|
78
|
-
* We ignore selection range of (0,0) because that indicates no selection and we don't want to restore it later.
|
|
79
|
-
* @param input {HTMLInputElement} The DOM element to operate on
|
|
80
|
-
*/
|
|
81
|
-
preserve(input) {
|
|
82
|
-
if (!this.hasSelection(input) && this.isCached()) {
|
|
83
|
-
// We already have cached selection but we're asking to preserve no selection,
|
|
84
|
-
// so we must NOT overwrite our cache with no selection or we can't restore the previously selected text.
|
|
85
|
-
// This happens if the browser doesn't preserve text selection automatically in the input.
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Only update cache if there is selection.
|
|
90
|
-
if (this.hasSelection(input)) {
|
|
91
|
-
this._cacheSelectionRange(input.selectionStart, input.selectionEnd);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Restore cached selection. This may happen async, so a promise is returned.
|
|
97
|
-
* @param input {HTMLInputElement} The DOM element to operate on
|
|
98
|
-
* @returns {Promise} A promise to be resolved when the selection is restored.
|
|
99
|
-
* If the cache was empty, the promise is resolved immediately as a no-op.
|
|
100
|
-
*/
|
|
101
|
-
restore(input) {
|
|
102
|
-
// Bail early if we don't have a cached selection.
|
|
103
|
-
if (!this.isCached()) {
|
|
104
|
-
return Promise.resolve();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// @W-7962838 - Safari has a browser bug where setting the selection on inputs
|
|
108
|
-
// as you focus them keeps it from scrolling into view in certain conditions.
|
|
109
|
-
// This can be worked around by setting the text selection in a new call stack immediately after the focus.
|
|
110
|
-
// https://bugs.webkit.org/show_bug.cgi?id=217350
|
|
111
|
-
if (isSafari) {
|
|
112
|
-
return timeout(0).then(() => {
|
|
113
|
-
// running async, so revalidate our inputs
|
|
114
|
-
if (this.isCached() && input) {
|
|
115
|
-
restoreCacheToInput(input, this);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// W-6176985: IE11 input when set value, will move cursor to beginning.
|
|
121
|
-
// This fix is only for input type=number on IE11, and force the cursor to the end.
|
|
122
|
-
if (isIE11) {
|
|
123
|
-
const length = input.value.length;
|
|
124
|
-
input.setSelectionRange(length, length);
|
|
125
|
-
return Promise.resolve();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
restoreCacheToInput(input, this);
|
|
129
|
-
return Promise.resolve();
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* THIS IS ONLY A SAMPLE TEST OF DEMO HOW TO RUN SAME TEST FROM WDIO
|
|
3
|
-
* AS A KARMA TEST, SHOULD BE ALIGN TO ASYNC MODEL INSTEAD OF waitFor
|
|
4
|
-
*/
|
|
5
|
-
import { createElement } from 'lwc';
|
|
6
|
-
import Bounding from 'x/bounding';
|
|
7
|
-
|
|
8
|
-
function createHtml(props = {}) {
|
|
9
|
-
const element = createElement('x-bounding', { is: Bounding });
|
|
10
|
-
Object.assign(element, props);
|
|
11
|
-
return element;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const FLIP_MAP = {
|
|
15
|
-
bottom: 'bottom',
|
|
16
|
-
'bottom-left': 'bottom-right',
|
|
17
|
-
'bottom-right': 'bottom-left',
|
|
18
|
-
left: 'right',
|
|
19
|
-
'left-bottom': 'right-bottom',
|
|
20
|
-
'left-top': 'right-bottom',
|
|
21
|
-
right: 'left',
|
|
22
|
-
'right-bottom': 'left-bottom',
|
|
23
|
-
'right-top': 'left-top',
|
|
24
|
-
top: 'top',
|
|
25
|
-
'top-left': 'top-right',
|
|
26
|
-
'top-right': 'top-left',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Fixes @W-8235775.
|
|
31
|
-
* Clean up the DOM, removing anything that isn't Jasmine related or script/css.
|
|
32
|
-
* These tests are sensitive to the height of the DOM and fail if other stuff is too tall.
|
|
33
|
-
*
|
|
34
|
-
* TODO: Remove this cleanup when this can be done in a central location instead.
|
|
35
|
-
*/
|
|
36
|
-
function cleanDom() {
|
|
37
|
-
const bodyNodes = Array.prototype.slice.call(
|
|
38
|
-
document.querySelectorAll('body > *')
|
|
39
|
-
);
|
|
40
|
-
const nodesToRemove = bodyNodes.filter(
|
|
41
|
-
(n) =>
|
|
42
|
-
n.tagName.toLowerCase() !== 'script' &&
|
|
43
|
-
n.tagName.toLowerCase() !== 'link' &&
|
|
44
|
-
n.className.indexOf('jasmine') !== 0
|
|
45
|
-
);
|
|
46
|
-
for (let i = 0; i < nodesToRemove.length; i++) {
|
|
47
|
-
document.body.removeChild(nodesToRemove[i]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
document.querySelectorAll('style').forEach((style) => style.remove());
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function setup() {
|
|
54
|
-
cleanDom();
|
|
55
|
-
|
|
56
|
-
const element = createHtml();
|
|
57
|
-
document.body.appendChild(element);
|
|
58
|
-
return element;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function convertCasesToRtl(cases) {
|
|
62
|
-
const result = {};
|
|
63
|
-
Object.keys(cases).forEach((align) => {
|
|
64
|
-
result[align] = {};
|
|
65
|
-
Object.keys(cases[align]).forEach((pos) => {
|
|
66
|
-
const nubbinAlign = cases[align][pos];
|
|
67
|
-
result[align][pos] = FLIP_MAP[nubbinAlign];
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Waits for the bubble to be visible and have the correct positioning. If the wait condition is
|
|
75
|
-
* not satisfied within the global Jasmine timeout interval (5000ms by default) the consuming test
|
|
76
|
-
* will fail.
|
|
77
|
-
* @param {Node} element test root node
|
|
78
|
-
* @param {String} expected expected nubbin class
|
|
79
|
-
*/
|
|
80
|
-
function waitForBubbleAlignment(element, expected) {
|
|
81
|
-
return new Promise((resolve) => {
|
|
82
|
-
function waitCondition() {
|
|
83
|
-
const bubble = element.querySelector('lightning-primitive-bubble');
|
|
84
|
-
if (bubble && bubble.visible) {
|
|
85
|
-
const overlay =
|
|
86
|
-
bubble.shadowRoot.querySelector('[part="overlay"]');
|
|
87
|
-
|
|
88
|
-
const classList = overlay.getAttribute('class').split(' ');
|
|
89
|
-
const positioned = classList.indexOf(expected) > -1;
|
|
90
|
-
if (positioned) {
|
|
91
|
-
resolve(positioned);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
window.requestAnimationFrame(waitCondition);
|
|
96
|
-
}
|
|
97
|
-
waitCondition();
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The nubbin css class is used to determine the correctness of the bubble position.
|
|
103
|
-
* @param {String} align alignment of the bubble
|
|
104
|
-
* @param {String} pos name of target for the bubble
|
|
105
|
-
* @param {String} nubbinAlign expected alignment for the nubbin
|
|
106
|
-
*/
|
|
107
|
-
async function verifyBubbleAlignment(align, pos, nubbinAlign) {
|
|
108
|
-
// Set the bubble alignment for the test.
|
|
109
|
-
const element = document.querySelector('x-bounding');
|
|
110
|
-
const button = element.querySelector(`[data-align=${align}]`);
|
|
111
|
-
button.click();
|
|
112
|
-
|
|
113
|
-
// Show the bubble at the position being tested.
|
|
114
|
-
const show = element.querySelector(`[data-pos=${pos}]`);
|
|
115
|
-
show.click();
|
|
116
|
-
|
|
117
|
-
const expected = `slds-nubbin_${nubbinAlign}`;
|
|
118
|
-
const positioned = await waitForBubbleAlignment(element, expected);
|
|
119
|
-
expect(positioned).toBeTruthy();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Dynamically creates test cases for all the combinations of alignments and positions specified in
|
|
124
|
-
* the given map.
|
|
125
|
-
* @param {Object} cases alignments with positions and their expected outcomes to test
|
|
126
|
-
*/
|
|
127
|
-
function executeCases(cases) {
|
|
128
|
-
Object.keys(cases).forEach((align) => {
|
|
129
|
-
Object.keys(cases[align]).forEach((pos) => {
|
|
130
|
-
const nubbinAlign = cases[align][pos];
|
|
131
|
-
it(`should have bubble with nubbin alignment of ${nubbinAlign} relative to the ${pos} element when ${align} alignment is used`, async () => {
|
|
132
|
-
await verifyBubbleAlignment(align, pos, nubbinAlign);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/*
|
|
139
|
-
* THIS IS ONLY A SAMPLE TEST OF DEMO HOW TO RUN SAME TEST FROM WDIO
|
|
140
|
-
* AS A KARMA TEST, SHOULD BE ALIGN TO ASYNC MODEL INSTEAD OF waitFor
|
|
141
|
-
*/
|
|
142
|
-
describe('Viewport Bounding', () => {
|
|
143
|
-
// We can reuse the same page instance for the tests so we only need to run setup once.
|
|
144
|
-
beforeAll(() => {
|
|
145
|
-
setup();
|
|
146
|
-
});
|
|
147
|
-
afterAll(() => {
|
|
148
|
-
const element = document.querySelector('x-bounding');
|
|
149
|
-
document.body.removeChild(element);
|
|
150
|
-
document.querySelectorAll('style').forEach((style) => style.remove());
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// TODO: New cases will be added and some expected alignments will change when we add support
|
|
154
|
-
// for left-top, right-top, left-bottom, right-bottom alignments.
|
|
155
|
-
const cases = {
|
|
156
|
-
Bottom: {
|
|
157
|
-
leftTop: 'top-left',
|
|
158
|
-
top: 'top',
|
|
159
|
-
rightTop: 'top-right',
|
|
160
|
-
left: 'top-left',
|
|
161
|
-
center: 'top',
|
|
162
|
-
right: 'top-right',
|
|
163
|
-
leftBottom: 'bottom-left',
|
|
164
|
-
bottom: 'bottom',
|
|
165
|
-
rightBottom: 'bottom-right',
|
|
166
|
-
},
|
|
167
|
-
BottomLeft: {
|
|
168
|
-
leftTop: 'top-left',
|
|
169
|
-
top: 'top-left',
|
|
170
|
-
rightTop: 'top-right',
|
|
171
|
-
left: 'top-left',
|
|
172
|
-
center: 'top-left',
|
|
173
|
-
right: 'top-right',
|
|
174
|
-
leftBottom: 'bottom-left',
|
|
175
|
-
bottom: 'bottom-left',
|
|
176
|
-
rightBottom: 'bottom-right',
|
|
177
|
-
},
|
|
178
|
-
BottomRight: {
|
|
179
|
-
leftTop: 'top-left',
|
|
180
|
-
top: 'top-right',
|
|
181
|
-
rightTop: 'top-right',
|
|
182
|
-
left: 'top-left',
|
|
183
|
-
center: 'top-right',
|
|
184
|
-
right: 'top-right',
|
|
185
|
-
leftBottom: 'bottom-left',
|
|
186
|
-
bottom: 'bottom-right',
|
|
187
|
-
rightBottom: 'bottom-right',
|
|
188
|
-
},
|
|
189
|
-
Left: {
|
|
190
|
-
leftTop: 'top-left', // left-top
|
|
191
|
-
top: 'top-right', // right-top
|
|
192
|
-
rightTop: 'top-right', // right-top
|
|
193
|
-
left: 'left',
|
|
194
|
-
center: 'right',
|
|
195
|
-
right: 'right',
|
|
196
|
-
leftBottom: 'bottom-left', // left-bottom
|
|
197
|
-
bottom: 'bottom-right', // right-bottom
|
|
198
|
-
rightBottom: 'bottom-right', // right-bottom
|
|
199
|
-
},
|
|
200
|
-
Right: {
|
|
201
|
-
leftTop: 'top-left', // left-top
|
|
202
|
-
top: 'top-left', // left-top
|
|
203
|
-
rightTop: 'top-right', // right-top
|
|
204
|
-
left: 'left',
|
|
205
|
-
center: 'left',
|
|
206
|
-
right: 'right',
|
|
207
|
-
leftBottom: 'bottom-left', // left-bottom
|
|
208
|
-
bottom: 'bottom-left', // left-bottom
|
|
209
|
-
rightBottom: 'bottom-right', // right-bottom
|
|
210
|
-
},
|
|
211
|
-
Top: {
|
|
212
|
-
leftTop: 'top-left',
|
|
213
|
-
top: 'top',
|
|
214
|
-
rightTop: 'top-right',
|
|
215
|
-
left: 'bottom-left',
|
|
216
|
-
center: 'bottom',
|
|
217
|
-
right: 'bottom-right',
|
|
218
|
-
leftBottom: 'bottom-left',
|
|
219
|
-
bottom: 'bottom',
|
|
220
|
-
rightBottom: 'bottom-right',
|
|
221
|
-
},
|
|
222
|
-
TopLeft: {
|
|
223
|
-
leftTop: 'top-left',
|
|
224
|
-
top: 'top-left',
|
|
225
|
-
rightTop: 'top-right',
|
|
226
|
-
left: 'bottom-left',
|
|
227
|
-
center: 'bottom-left',
|
|
228
|
-
right: 'bottom-right',
|
|
229
|
-
leftBottom: 'bottom-left',
|
|
230
|
-
bottom: 'bottom-left',
|
|
231
|
-
rightBottom: 'bottom-right',
|
|
232
|
-
},
|
|
233
|
-
TopRight: {
|
|
234
|
-
leftTop: 'top-left',
|
|
235
|
-
top: 'top-right',
|
|
236
|
-
rightTop: 'top-right',
|
|
237
|
-
left: 'bottom-left',
|
|
238
|
-
center: 'bottom-right',
|
|
239
|
-
right: 'bottom-right',
|
|
240
|
-
leftBottom: 'bottom-left',
|
|
241
|
-
bottom: 'bottom-right',
|
|
242
|
-
rightBottom: 'bottom-right',
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
describe('LTR', () => {
|
|
247
|
-
executeCases(cases);
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
describe('RTL', () => {
|
|
251
|
-
beforeEach(() => {
|
|
252
|
-
document.dir = 'rtl';
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
executeCases(convertCasesToRtl(cases));
|
|
256
|
-
|
|
257
|
-
afterEach(() => {
|
|
258
|
-
document.dir = 'ltr';
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
describe('Element Bounding', () => {
|
|
264
|
-
// Same setup as viewport bounding but with element bounding enabled.
|
|
265
|
-
beforeAll(() => {
|
|
266
|
-
setup();
|
|
267
|
-
const element = document.querySelector('x-bounding');
|
|
268
|
-
element.querySelector('[name=elementBound]').click();
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
afterAll(() => {
|
|
272
|
-
const element = document.querySelector('x-bounding');
|
|
273
|
-
document.body.removeChild(element);
|
|
274
|
-
document.querySelectorAll('style').forEach((style) => style.remove());
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
describe('LTR', () => {
|
|
278
|
-
const cases = {
|
|
279
|
-
BottomLeft: {
|
|
280
|
-
left: 'top-left',
|
|
281
|
-
center: 'top-left',
|
|
282
|
-
right: 'top-right',
|
|
283
|
-
},
|
|
284
|
-
BottomRight: {
|
|
285
|
-
left: 'top-left',
|
|
286
|
-
center: 'top-left',
|
|
287
|
-
right: 'top-right',
|
|
288
|
-
},
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
executeCases(cases);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
describe('RTL', () => {
|
|
295
|
-
beforeEach(() => {
|
|
296
|
-
document.dir = 'rtl';
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
// RTL flips the positions of the left and right elements.
|
|
300
|
-
const cases = {
|
|
301
|
-
BottomLeft: {
|
|
302
|
-
left: 'top-right',
|
|
303
|
-
center: 'top-right',
|
|
304
|
-
right: 'top-left',
|
|
305
|
-
},
|
|
306
|
-
BottomRight: {
|
|
307
|
-
left: 'top-right',
|
|
308
|
-
center: 'top-right',
|
|
309
|
-
right: 'top-left',
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
executeCases(cases);
|
|
314
|
-
|
|
315
|
-
afterEach(() => {
|
|
316
|
-
document.dir = 'ltr';
|
|
317
|
-
});
|
|
318
|
-
});
|
|
319
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Makes element take up available space like slds-grid_frame but works with IE11.
|
|
3
|
-
*/
|
|
4
|
-
.frame {
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: 0;
|
|
7
|
-
bottom: 0;
|
|
8
|
-
left: 0;
|
|
9
|
-
right: 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.bubble {
|
|
13
|
-
position: absolute;
|
|
14
|
-
width: 150px;
|
|
15
|
-
height: 150px;
|
|
16
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template lwc:render-mode="light">
|
|
2
|
-
<div class="frame slds-grid slds-grid_vertical slds-p-around_large">
|
|
3
|
-
<div class="slds-col slds-grow-none">
|
|
4
|
-
<button data-align="Bottom" onclick={changeAlign}>B</button>
|
|
5
|
-
<button data-align="BottomLeft" onclick={changeAlign}>BL</button>
|
|
6
|
-
<button data-align="BottomRight" onclick={changeAlign}>BR</button>
|
|
7
|
-
<button data-align="Left" onclick={changeAlign}>L</button>
|
|
8
|
-
<button data-align="Right" onclick={changeAlign}>R</button>
|
|
9
|
-
<button data-align="Top" onclick={changeAlign}>T</button>
|
|
10
|
-
<button data-align="TopLeft" onclick={changeAlign}>TL</button>
|
|
11
|
-
<button data-align="TopRight" onclick={changeAlign}>TR</button>
|
|
12
|
-
|
|
13
|
-
<label for="elementBound" class="slds-p-left_large">Element Bound:</label>
|
|
14
|
-
<input type="checkbox" name="elementBound" class="slds-m-left_x-small" onclick={toggleElementBound}></input>
|
|
15
|
-
|
|
16
|
-
<span class="slds-p-left_large">Align: <span class="align">{align}</span></span>
|
|
17
|
-
|
|
18
|
-
<lightning-primitive-bubble class="bubble" content-id="test-bubble" content="Lightning Primitive Bubble"></lightning-primitive-bubble>
|
|
19
|
-
</div>
|
|
20
|
-
<div class="slds-col slds-grid slds-grid_align-spread slds-grid_vertical-align-start">
|
|
21
|
-
<lightning-button-icon class="slds-col" data-pos="leftTop" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
22
|
-
<lightning-button-icon class="slds-col" data-pos="top" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
23
|
-
<lightning-button-icon class="slds-col" data-pos="rightTop" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
24
|
-
</div>
|
|
25
|
-
<div class="slds-col slds-col_bump-bottom slds-grid slds-grid_align-spread slds-grid_vertical-align-center">
|
|
26
|
-
<lightning-button-icon class="slds-col" data-pos="left" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
27
|
-
<lightning-button-icon class="slds-col" data-pos="center" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
28
|
-
<lightning-button-icon class="slds-col" data-pos="right" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="slds-col slds-grid slds-grid_align-spread slds-grid_vertical-align-end">
|
|
31
|
-
<lightning-button-icon class="slds-col" data-pos="leftBottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
32
|
-
<lightning-button-icon class="slds-col" data-pos="bottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
33
|
-
<lightning-button-icon class="slds-col" data-pos="rightBottom" icon-name="utility:settings" onclick={toggle}></lightning-button-icon>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @lwc/lwc/no-api-reassignments */
|
|
2
|
-
|
|
3
|
-
import { LightningElement, api } from 'lwc';
|
|
4
|
-
import { AutoPosition, Direction } from 'lightning/positionLibrary';
|
|
5
|
-
|
|
6
|
-
// TODO: Will need LeftBottom, LeftTop, RightBottom, and RightTop cases when they're supported.
|
|
7
|
-
const BubbleAlign = {
|
|
8
|
-
Bottom: {
|
|
9
|
-
align: { horizontal: Direction.Center, vertical: Direction.Top },
|
|
10
|
-
targetAlign: {
|
|
11
|
-
horizontal: Direction.Center,
|
|
12
|
-
vertical: Direction.Bottom,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
BottomLeft: {
|
|
16
|
-
align: { horizontal: Direction.Left, vertical: Direction.Top },
|
|
17
|
-
targetAlign: { horizontal: Direction.Left, vertical: Direction.Bottom },
|
|
18
|
-
},
|
|
19
|
-
BottomRight: {
|
|
20
|
-
align: { horizontal: Direction.Right, vertical: Direction.Top },
|
|
21
|
-
targetAlign: {
|
|
22
|
-
horizontal: Direction.Right,
|
|
23
|
-
vertical: Direction.Bottom,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
Left: {
|
|
27
|
-
align: { horizontal: Direction.Right, vertical: Direction.Center },
|
|
28
|
-
targetAlign: { horizontal: Direction.Left, vertical: Direction.Center },
|
|
29
|
-
},
|
|
30
|
-
Right: {
|
|
31
|
-
align: { horizontal: Direction.Left, vertical: Direction.Center },
|
|
32
|
-
targetAlign: {
|
|
33
|
-
horizontal: Direction.Right,
|
|
34
|
-
vertical: Direction.Center,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
Top: {
|
|
38
|
-
align: { horizontal: Direction.Center, vertical: Direction.Bottom },
|
|
39
|
-
targetAlign: { horizontal: Direction.Center, vertical: Direction.Top },
|
|
40
|
-
},
|
|
41
|
-
TopLeft: {
|
|
42
|
-
align: { horizontal: Direction.Left, vertical: Direction.Bottom },
|
|
43
|
-
targetAlign: { horizontal: Direction.Left, vertical: Direction.Top },
|
|
44
|
-
},
|
|
45
|
-
TopRight: {
|
|
46
|
-
align: { horizontal: Direction.Right, vertical: Direction.Bottom },
|
|
47
|
-
targetAlign: { horizontal: Direction.Right, vertical: Direction.Top },
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default class PositionLibraryBounding extends LightningElement {
|
|
52
|
-
static renderMode = 'light';
|
|
53
|
-
|
|
54
|
-
@api align = 'Bottom';
|
|
55
|
-
@api elementBound;
|
|
56
|
-
|
|
57
|
-
_autoPosition = null;
|
|
58
|
-
_current = null;
|
|
59
|
-
_visible = false;
|
|
60
|
-
|
|
61
|
-
changeAlign(e) {
|
|
62
|
-
this.align = e.target.getAttribute('data-align');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
toggleElementBound(e) {
|
|
66
|
-
this.elementBound = e.target.checked;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
toggle(e) {
|
|
70
|
-
this.hide();
|
|
71
|
-
const pos = e.target.getAttribute('data-pos');
|
|
72
|
-
if (pos !== this._current) {
|
|
73
|
-
this.show(pos);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
show(pos) {
|
|
78
|
-
this._current = pos;
|
|
79
|
-
this._visible = true;
|
|
80
|
-
const target = () => this.querySelector(`[data-pos=${pos}`);
|
|
81
|
-
const config = BubbleAlign[this.align];
|
|
82
|
-
this.startPositioning(target, config);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
hide() {
|
|
86
|
-
this._current = null;
|
|
87
|
-
this._visible = false;
|
|
88
|
-
const bubble = this.querySelector('lightning-primitive-bubble');
|
|
89
|
-
bubble.visible = this._visible;
|
|
90
|
-
|
|
91
|
-
this.stopPositioning();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
startPositioning(target, config) {
|
|
95
|
-
if (!this._autoPosition) {
|
|
96
|
-
this._autoPosition = new AutoPosition(this);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
this._autoPosition
|
|
100
|
-
.start({
|
|
101
|
-
target,
|
|
102
|
-
element: () => this.querySelector('lightning-primitive-bubble'),
|
|
103
|
-
autoFlip: true,
|
|
104
|
-
align: config.align,
|
|
105
|
-
targetAlign: config.targetAlign,
|
|
106
|
-
padLeft: config.padLeft,
|
|
107
|
-
padTop: config.padTop,
|
|
108
|
-
leftAsBoundary: !!this.elementBound,
|
|
109
|
-
})
|
|
110
|
-
.then((autoPositionUpdater) => {
|
|
111
|
-
const bubble = this.querySelector('lightning-primitive-bubble');
|
|
112
|
-
bubble.align = autoPositionUpdater.config.align;
|
|
113
|
-
bubble.visible = this._visible;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
stopPositioning() {
|
|
118
|
-
if (this._autoPosition) {
|
|
119
|
-
this._autoPosition.stop();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
File without changes
|
/package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.html
RENAMED
|
File without changes
|
/package/src/lightning/formattedRichText/{__examples__disabled → __examples__}/basic/basic.js
RENAMED
|
File without changes
|
|
File without changes
|