@milaboratories/uikit 2.6.1 → 2.6.3
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/.turbo/turbo-build.log +143 -143
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/base/BtnBase.vue.js +18 -18
- package/dist/base/BtnBase.vue.js.map +1 -1
- package/dist/components/ContextProvider.vue.js.map +1 -1
- package/dist/components/DataTable/BaseCellComponent.vue.js +20 -20
- package/dist/components/DataTable/BaseCellComponent.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnCaret.vue.js +6 -6
- package/dist/components/DataTable/ColumnCaret.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/RowsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/TScroll.vue.js +12 -12
- package/dist/components/DataTable/TScroll.vue.js.map +1 -1
- package/dist/components/DataTable/TableComponent.vue.js +5 -3
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/DataTable/TdCell.vue.js +36 -36
- package/dist/components/DataTable/TdCell.vue.js.map +1 -1
- package/dist/components/DataTable/ThCell.vue.js +27 -27
- package/dist/components/DataTable/ThCell.vue.js.map +1 -1
- package/dist/components/DataTable/TrBody.vue.js +12 -12
- package/dist/components/DataTable/TrBody.vue.js.map +1 -1
- package/dist/components/DataTable/TrHead.vue.js.map +1 -1
- package/dist/components/DataTable/assets/TableIcon.vue.js +2 -2
- package/dist/components/DataTable/assets/TableIcon.vue.js.map +1 -1
- package/dist/components/DropdownListItem.vue.js +18 -18
- package/dist/components/DropdownListItem.vue.js.map +1 -1
- package/dist/components/HScroll.vue.js.map +1 -1
- package/dist/components/InputRange.vue.js.map +1 -1
- package/dist/components/LongText.vue.js +1 -1
- package/dist/components/LongText.vue.js.map +1 -1
- package/dist/components/LongText.vue3.js +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordion.vue.js.map +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +21 -21
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js.map +1 -1
- package/dist/components/PlAlert/PlAlert.vue.js +23 -23
- package/dist/components/PlAlert/PlAlert.vue.js.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.d.ts +4 -0
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +112 -106
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.d.ts +4 -0
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +100 -94
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlBtnAccent/PlBtnAccent.vue.js.map +1 -1
- package/dist/components/PlBtnDanger/PlBtnDanger.vue.js.map +1 -1
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js +21 -21
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js.map +1 -1
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js +34 -34
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js.map +1 -1
- package/dist/components/PlBtnLink/PlBtnLink.vue.js +12 -12
- package/dist/components/PlBtnLink/PlBtnLink.vue.js.map +1 -1
- package/dist/components/PlBtnPrimary/PlBtnPrimary.vue.js.map +1 -1
- package/dist/components/PlBtnSecondary/PlBtnSecondary.vue.js.map +1 -1
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js +31 -31
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js.map +1 -1
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js +18 -18
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/Legends.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js +15 -15
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBarCompact.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRow.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRowCompact.vue2.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckbox.vue.js +13 -13
- package/dist/components/PlCheckbox/PlCheckbox.vue.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js +6 -6
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js.map +1 -1
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js +28 -28
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js.map +1 -1
- package/dist/components/PlChip/PlChip.vue.js +20 -20
- package/dist/components/PlChip/PlChip.vue.js.map +1 -1
- package/dist/components/PlClipboard/PlClipboard.vue2.js.map +1 -1
- package/dist/components/PlConfirmDialog.vue.js +14 -14
- package/dist/components/PlConfirmDialog.vue.js.map +1 -1
- package/dist/components/PlDialogModal/PlDialogModal.vue.js +30 -30
- package/dist/components/PlDialogModal/PlDialogModal.vue.js.map +1 -1
- package/dist/components/PlDropdown/OptionList.vue.js +40 -40
- package/dist/components/PlDropdown/OptionList.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.d.ts +8 -0
- package/dist/components/PlDropdown/PlDropdown.vue.js +102 -95
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +95 -93
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js +4 -4
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/ResizableInput.vue.js +12 -12
- package/dist/components/PlDropdownLine/ResizableInput.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.d.ts +4 -0
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +88 -82
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.js.map +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js +11 -11
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js +36 -36
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementList.vue2.js +180 -135
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue.d.ts +20 -0
- package/dist/components/PlElementList/PlElementListItem.vue2.js +101 -76
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlErrorAlert/PlErrorAlert.vue2.js.map +1 -1
- package/dist/components/PlErrorBoundary/PlErrorBoundary.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Local.vue.js +24 -24
- package/dist/components/PlFileDialog/Local.vue.js.map +1 -1
- package/dist/components/PlFileDialog/PlFileDialog.vue.js +38 -38
- package/dist/components/PlFileDialog/PlFileDialog.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.js +2 -2
- package/dist/components/PlFileDialog/Remote.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue2.js +4 -4
- package/dist/components/PlFileDialog/Shortcuts.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.d.ts +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +78 -76
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlIcon16/PlIcon16.vue2.js.map +1 -1
- package/dist/components/PlIcon24/PlIcon24.vue2.js.map +1 -1
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js +11 -11
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +62 -60
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js +22 -22
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.d.ts +6 -1
- package/dist/components/PlNumberField/PlNumberField.vue.js +66 -60
- package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
- package/dist/components/PlProgressBar/PlProgressBar.vue.js +12 -12
- package/dist/components/PlProgressBar/PlProgressBar.vue.js.map +1 -1
- package/dist/components/PlProgressCell/PlProgressCell.vue.js +20 -20
- package/dist/components/PlProgressCell/PlProgressCell.vue.js.map +1 -1
- package/dist/components/PlRadio/PlRadio.vue2.js.map +1 -1
- package/dist/components/PlRadio/PlRadioGroup.vue2.js +8 -8
- package/dist/components/PlRadio/PlRadioGroup.vue2.js.map +1 -1
- package/dist/components/PlSearchField/PlSearchField.vue2.js +19 -19
- package/dist/components/PlSearchField/PlSearchField.vue2.js.map +1 -1
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js +8 -8
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +5 -3
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js.map +1 -1
- package/dist/components/PlSplash/PlSplash.vue.js +16 -16
- package/dist/components/PlSplash/PlSplash.vue.js.map +1 -1
- package/dist/components/PlStatusTag/PlStatusTag.vue.js +7 -7
- package/dist/components/PlStatusTag/PlStatusTag.vue.js.map +1 -1
- package/dist/components/PlSvg/PlSvg.vue2.js.map +1 -1
- package/dist/components/PlTabs/PlTabs.vue.js +18 -18
- package/dist/components/PlTabs/PlTabs.vue.js.map +1 -1
- package/dist/components/PlTabs/Tab.vue.js +9 -9
- package/dist/components/PlTabs/Tab.vue.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +55 -53
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.d.ts +4 -0
- package/dist/components/PlTextField/PlTextField.vue.js +66 -60
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js +14 -14
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js.map +1 -1
- package/dist/components/PlTooltip/Beak.vue.js +2 -2
- package/dist/components/PlTooltip/Beak.vue.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue.js +50 -50
- package/dist/components/PlTooltip/PlTooltip.vue.js.map +1 -1
- package/dist/components/Scrollable.vue.js.map +1 -1
- package/dist/components/Slider.vue.js +35 -35
- package/dist/components/Slider.vue.js.map +1 -1
- package/dist/components/SliderRange.vue.js +47 -47
- package/dist/components/SliderRange.vue.js.map +1 -1
- package/dist/components/SliderRangeTriple.vue.js +47 -47
- package/dist/components/SliderRangeTriple.vue.js.map +1 -1
- package/dist/components/TabItem.vue.js.map +1 -1
- package/dist/components/ThemeSwitcher.vue.js +2 -2
- package/dist/components/ThemeSwitcher.vue.js.map +1 -1
- package/dist/components/TransitionSlidePanel.vue.js.map +1 -1
- package/dist/components/VScroll.vue.js.map +1 -1
- package/dist/components/contextMenu/Menu.vue2.js +12 -12
- package/dist/components/contextMenu/Menu.vue2.js.map +1 -1
- package/dist/composition/filters/metadata.d.ts +205 -0
- package/dist/composition/filters/metadata.js +129 -19
- package/dist/composition/filters/metadata.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js +27 -27
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js.map +1 -1
- package/dist/layout/PlContainer/PlContainer.vue.js +10 -10
- package/dist/layout/PlContainer/PlContainer.vue.js.map +1 -1
- package/dist/layout/PlGrid/PlGrid.vue.js.map +1 -1
- package/dist/layout/PlRow/PlRow.vue.js +8 -8
- package/dist/layout/PlRow/PlRow.vue.js.map +1 -1
- package/dist/layout/PlSpacer/PlSpacer.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue.d.ts +7 -1
- package/dist/utils/DoubleContour.vue.js +20 -13
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue3.js +7 -0
- package/dist/utils/DoubleContour.vue3.js.map +1 -0
- package/dist/utils/DropdownOverlay/DropdownOverlay.vue.js.map +1 -1
- package/dist/utils/PlCloseModalBtn.vue.js +2 -2
- package/dist/utils/PlCloseModalBtn.vue.js.map +1 -1
- package/dist/utils/TextLabel.vue.js.map +1 -1
- package/package.json +5 -5
- package/src/components/PlAutocomplete/PlAutocomplete.vue +6 -1
- package/src/components/PlAutocompleteMulti/PlAutocompleteMulti.vue +6 -1
- package/src/components/PlDropdown/PlDropdown.vue +12 -2
- package/src/components/PlDropdownMulti/PlDropdownMulti.vue +6 -1
- package/src/components/PlElementList/PlElementList.vue +40 -6
- package/src/components/PlElementList/PlElementListItem.vue +64 -47
- package/src/components/PlNumberField/PlNumberField.vue +4 -1
- package/src/components/PlTextField/PlTextField.vue +5 -1
- package/src/composition/filters/metadata.ts +105 -0
- package/src/utils/DoubleContour.vue +68 -2
- package/dist/utils/DoubleContour.vue2.js +0 -7
- package/dist/utils/DoubleContour.vue2.js.map +0 -1
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode(`.pl-dropdown-legacy{--contour-color: var(--txt-01);--contour-border-width: 1px;--options-bg: #fff;--option-hover-bg: var(--btn-sec-hover-grey);--label-offset-left-x: 8px;--label-offset-right-x: 8px;--label-color: var(--txt-01);position:relative;outline:none;min-height:var(--control-height);border-radius:6px;font-family:var(--font-family-base);font-size:var(--font-size-base);font-weight:var(--font-weigh-base)}[data-theme=dark] .pl-dropdown-legacy{--options-bg: #1b1b1f}.pl-dropdown-legacy__envelope{font-family:var(--control-font-family);min-width:160px}.pl-dropdown-legacy label{display:flex;align-items:center;gap:4px;position:absolute;top:0;transform:translateY(-60%);left:var(--label-offset-left-x);padding:0 4px;max-width:calc(100% - 16px);overflow:hidden;white-space:pre;text-overflow:ellipsis;cursor:inherit;color:var(--label-color);font-size:12px;font-weight:500;border-bottom-right-radius:4px;border-bottom-left-radius:4px;background:var(--bg-elevated-01)}.pl-dropdown-legacy label>span{overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-dropdown-legacy__container{position:absolute;top:0;left:0;right:0;border-radius:6px;min-height:var(--control-height);color:var(--txt-01)}.pl-dropdown-legacy__contour{border-radius:var(--border-radius-control);border:var(--contour-border-width) solid var(--contour-color);box-shadow:var(--contour-box-shadow);z-index:0;pointer-events:none}.pl-dropdown-legacy__options{position:relative;background-color:var(--options-bg);border-radius:0 0 6px 6px;max-height:244px;border-top:1px solid var(--color-div-black);--thumb-color: var(--ic-02);overflow-y:auto}.pl-dropdown-legacy__options::-webkit-scrollbar{width:var(--scrollbar-width, 6px);height:5px;background-color:transparent;display:block}.pl-dropdown-legacy__options::-webkit-scrollbar-thumb{background:var(--thumb-color);border-radius:5px}.pl-dropdown-legacy__options::-webkit-scrollbar-thumb:hover{--thumb-color: var(--border-color-focus)}.pl-dropdown-legacy__options .nothing-found{padding:0 10px;height:var(--control-height);line-height:var(--control-height);background-color:#fff;opacity:.5;font-style:italic}.pl-dropdown-legacy__options .option{position:relative;padding:0 30px 0 10px;height:var(--control-height);line-height:var(--control-height);cursor:pointer;-webkit-user-select:none;user-select:none}.pl-dropdown-legacy__options .option .checkmark{position:absolute;display:none;right:10px;top:50%;transform:translateY(-50%)}.pl-dropdown-legacy__options .option>span{display:block;overflow:hidden;white-space:nowrap;max-width:100%;text-overflow:ellipsis}.pl-dropdown-legacy__options .option.selected{background-color:var(--color-active-select)}.pl-dropdown-legacy__options .option.selected .checkmark{display:block}.pl-dropdown-legacy__options .option.active:not(.selected){background-color:var(--option-hover-bg)}.pl-dropdown-legacy__options .option:hover{background-color:var(--option-hover-bg)}.pl-dropdown-legacy__field{position:relative;border-radius:6px;overflow:hidden;background:transparent;padding:0 11px;min-height:var(--control-height);line-height:var(--control-height);display:flex;flex-direction:row;align-items:center}.pl-dropdown-legacy__field .input-value{outline:1px solid red;position:absolute;top:0;left:0;bottom:0;right:0;padding:0 60px 0 11px;pointer-events:none;line-height:var(--control-height);color:var(--contour-color);overflow:hidden;white-space:pre;text-overflow:ellipsis}.pl-dropdown-legacy__field input{min-height:calc(var(--control-height) - 2px);line-height:calc(var(--control-height) - 2px);font-family:inherit;font-size:inherit;background-color:transparent;border:none;padding:0;width:calc(100% - 40px);color:var(--txt-01);caret-color:var(--border-color-focus)}.pl-dropdown-legacy__field input:focus{outline:none}.pl-dropdown-legacy__field input:placeholder-shown{text-overflow:ellipsis}.pl-dropdown-legacy__field input::placeholder{color:var(--color-placeholder)}.pl-dropdown-legacy__helper{font-size:12px;color:var(--txt-03);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-dropdown-legacy__error{font-size:12px;color:var(--txt-error);padding:2px 0 0;white-space:pre-wrap;text-overflow:ellipsis;font-weight:500;line-height:16px;margin-top:6px}.pl-dropdown-legacy__controls{display:flex;flex-direction:row;align-items:center;gap:6px;margin-left:auto}.pl-dropdown-legacy__controls .mask-16,.pl-dropdown-legacy__controls .mask-24{--icon-color: var(--control-mask-fill);cursor:pointer}.pl-dropdown-legacy__controls .clear{--icon-color: var(--ic-02)}.pl-dropdown-legacy__controls .mask-loading{--icon-color: var(#07AD3E);animation:spin 2.5s linear infinite}.pl-dropdown-legacy .arrow-icon{cursor:pointer}.pl-dropdown-legacy .arrow-icon.arrow-icon-default{background-color:var(--control-mask-fill);mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.46967%206.53033L3.53033%205.46967L8%209.93934L12.4697%205.46967L13.5303%206.53033L8%2012.0607L2.46967%206.53033Z'%20fill='%23110529'/%3e%3c/svg%3e");-webkit-mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.46967%206.53033L3.53033%205.46967L8%209.93934L12.4697%205.46967L13.5303%206.53033L8%2012.0607L2.46967%206.53033Z'%20fill='%23110529'/%3e%3c/svg%3e");mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;mask-size:16px;-webkit-mask-size:16px;width:16px;height:16px}.pl-dropdown-legacy.open,.pl-dropdown-legacy:focus-within{z-index:1;--label-color: var(--txt-focus)}.pl-dropdown-legacy.open .pl-dropdown-legacy__container{z-index:1000}.pl-dropdown-legacy.open .pl-dropdown-legacy__field{border-radius:6px 6px 0 0}.pl-dropdown-legacy.open .arrow-icon{background-color:var(--control-mask-fill);mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8%204.93933L13.5303%2010.4697L12.4697%2011.5303L8%207.06065L3.53033%2011.5303L2.46967%2010.4697L8%204.93933Z'%20fill='%23110529'/%3e%3c/svg%3e");-webkit-mask-image:url("data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M8%204.93933L13.5303%2010.4697L12.4697%2011.5303L8%207.06065L3.53033%2011.5303L2.46967%2010.4697L8%204.93933Z'%20fill='%23110529'/%3e%3c/svg%3e");mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;mask-position:center;-webkit-mask-position:center;mask-size:16px;-webkit-mask-size:16px;width:16px;height:16px}.pl-dropdown-legacy:hover{--contour-color: var(--control-hover-color)}.pl-dropdown-legacy:focus-within:not(.error){--label-color: var(--txt-focus);--contour-color: var(--border-color-focus);--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--border-color-focus-shadow)}.pl-dropdown-legacy:focus-within.error{--contour-border-width: 2px;--contour-box-shadow: 0 0 0 4px var(--color-error-shadow)}.pl-dropdown-legacy.error{--contour-color: var(--txt-error);--label-color: var(--txt-error)}.pl-dropdown-legacy.disabled{--contour-color: var(--color-dis-01);--control-mask-fill: var(--color-dis-01);--label-color: var(--color-dis-01);cursor:not-allowed;pointer-events:none;-webkit-user-select:none;user-select:none}
|
|
2
|
-
.
|
|
3
|
-
|
|
2
|
+
.double-contour.top>div{border-bottom-right-radius:0;border-bottom-left-radius:0}.double-contour.bottom>div{border-top-right-radius:0;border-top-left-radius:0}.double-contour.left>div{border-top-right-radius:0;border-bottom-right-radius:0}.double-contour.right>div{border-top-left-radius:0;border-bottom-left-radius:0}.double-contour.top-left>div{border-top-right-radius:0;border-bottom-left-radius:0;border-bottom-right-radius:0}.double-contour.top-right>div{border-bottom-right-radius:0;border-top-left-radius:0;border-top-right-radius:0}.double-contour.bottom-left>div{border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0}.double-contour.bottom-right>div{border-top-right-radius:0;border-bottom-left-radius:0;border-top-left-radius:0}.double-contour.middle>div{border-radius:0}
|
|
3
|
+
.ui-lt-container{min-width:0;white-space:nowrap;overflow:hidden;position:relative;border-radius:5px}.ui-lt-container span{display:inline-block;overflow:hidden;text-overflow:ellipsis;width:100%;vertical-align:bottom;pointer-events:all!important}.ui-lt-container .ui-lt-animate{position:relative;animation:left-to-right var(--v5deba9de) infinite alternate linear;overflow:unset!important;text-overflow:unset!important;width:fit-content!important}@keyframes left-to-right{0%{transform:translate(0);left:0%}to{transform:translate(-101%);left:101%}}`)),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
|
|
4
|
+
import { defineComponent as te, useSlots as ne, ref as V, reactive as le, computed as s, unref as u, watch as F, watchPostEffect as re, createElementBlock as a, openBlock as l, createElementVNode as p, createCommentVNode as c, normalizeClass as b, createVNode as M, withDirectives as ie, vModelText as ae, withCtx as N, createTextVNode as se, toDisplayString as m, createBlock as h, renderSlot as P, withModifiers as w, Fragment as de, renderList as ce } from "vue";
|
|
4
5
|
|
|
5
|
-
import { tap as
|
|
6
|
+
import { tap as ue, tapIf as pe } from "../../helpers/functions.js";
|
|
6
7
|
import fe from "../PlTooltip/PlTooltip.vue.js";
|
|
7
8
|
import ve from "../../utils/DoubleContour.vue.js";
|
|
9
|
+
|
|
8
10
|
import { useLabelNotch as me } from "../../utils/useLabelNotch.js";
|
|
9
11
|
import { scrollIntoView as he } from "../../helpers/dom.js";
|
|
10
12
|
import { deepEqual as C } from "../../helpers/objects.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
+
import we from "../DropdownListItem.vue.js";
|
|
14
|
+
import ke from "../LongText.vue.js";
|
|
13
15
|
|
|
14
|
-
import
|
|
16
|
+
import _e from "../PlIcon16/PlIcon16.vue.js";
|
|
15
17
|
import ye from "../PlIcon24/PlIcon24.vue.js";
|
|
16
18
|
import { normalizeListOptions as Ie } from "../../helpers/utils.js";
|
|
17
19
|
import { getErrorMessage as ge } from "../../helpers/error.js";
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
const
|
|
20
|
+
import xe from "../PlSvg/PlSvg.vue.js";
|
|
21
|
+
import Ve from "../../assets/images/required.svg.js";
|
|
22
|
+
const be = { class: "ui-dropdown__envelope" }, Ce = ["tabindex"], Ee = { class: "ui-dropdown__container" }, Le = { class: "ui-dropdown__field" }, Se = ["disabled", "placeholder"], $e = { class: "ui-dropdown__controls" }, Ae = { key: 0 }, Oe = {
|
|
21
23
|
key: 0,
|
|
22
24
|
class: "nothing-found"
|
|
23
25
|
}, De = {
|
|
@@ -31,7 +33,7 @@ const Ce = { class: "ui-dropdown__envelope" }, Ee = ["tabindex"], Le = { class:
|
|
|
31
33
|
class: "ui-dropdown__helper"
|
|
32
34
|
}, Fe = {
|
|
33
35
|
name: "PlDropdown"
|
|
34
|
-
},
|
|
36
|
+
}, oo = /* @__PURE__ */ te({
|
|
35
37
|
...Fe,
|
|
36
38
|
props: {
|
|
37
39
|
modelValue: {},
|
|
@@ -49,182 +51,182 @@ const Ce = { class: "ui-dropdown__envelope" }, Ee = ["tabindex"], Le = { class:
|
|
|
49
51
|
optionSize: { default: "small" }
|
|
50
52
|
},
|
|
51
53
|
emits: ["update:modelValue"],
|
|
52
|
-
setup(
|
|
53
|
-
const E = q, n =
|
|
54
|
+
setup(r, { emit: q }) {
|
|
55
|
+
const E = q, n = r, T = ne(), d = V(), L = V(), y = V(), t = le({
|
|
54
56
|
search: "",
|
|
55
57
|
activeIndex: -1,
|
|
56
58
|
open: !1
|
|
57
|
-
}), H = () =>
|
|
58
|
-
|
|
59
|
+
}), H = () => ue(
|
|
60
|
+
f.value.findIndex((e) => C(e.value, n.modelValue)),
|
|
59
61
|
(e) => e < 0 ? 0 : e
|
|
60
|
-
), R = () => t.activeIndex = H(),
|
|
61
|
-
if (!
|
|
62
|
+
), R = () => t.activeIndex = H(), k = s(() => n.options === void 0), I = s(() => k.value ? !0 : n.disabled), S = s(() => (n.options ?? []).findIndex((e) => C(e.value, n.modelValue))), $ = s(() => {
|
|
63
|
+
if (!k.value) {
|
|
62
64
|
if (n.error)
|
|
63
65
|
return ge(n.error);
|
|
64
66
|
if (n.modelValue !== void 0 && S.value === -1)
|
|
65
67
|
return "The selected value is not one of the options";
|
|
66
68
|
}
|
|
67
|
-
}), A =
|
|
69
|
+
}), A = s(
|
|
68
70
|
() => Ie(n.options ?? []).map((e, o) => ({
|
|
69
71
|
...e,
|
|
70
72
|
index: o,
|
|
71
73
|
isSelected: o === S.value,
|
|
72
74
|
isActive: o === t.activeIndex
|
|
73
75
|
}))
|
|
74
|
-
), O =
|
|
75
|
-
const o = u(A).find((
|
|
76
|
+
), O = s(() => {
|
|
77
|
+
const o = u(A).find((i) => C(i.value, n.modelValue));
|
|
76
78
|
return (o == null ? void 0 : o.label) || n.modelValue;
|
|
77
|
-
}), U =
|
|
79
|
+
}), U = s(() => !t.open && n.modelValue ? "" : n.modelValue ? String(O.value) : n.placeholder), K = s(() => n.modelValue !== void 0 && n.modelValue !== null), f = s(() => {
|
|
78
80
|
const e = A.value;
|
|
79
81
|
return t.search ? e.filter((o) => {
|
|
80
|
-
const
|
|
81
|
-
return o.label.toLowerCase().includes(
|
|
82
|
+
const i = t.search.toLowerCase();
|
|
83
|
+
return o.label.toLowerCase().includes(i) || o.description && o.description.toLowerCase().includes(i) ? !0 : typeof o.value == "string" ? o.value.toLowerCase().includes(i) : o.value === t.search;
|
|
82
84
|
}) : e;
|
|
83
|
-
}), j =
|
|
85
|
+
}), j = s(() => I.value ? void 0 : "0"), D = (e) => {
|
|
84
86
|
var o;
|
|
85
|
-
E("update:modelValue", e), t.search = "", t.open = !1, (o =
|
|
87
|
+
E("update:modelValue", e), t.search = "", t.open = !1, (o = d == null ? void 0 : d.value) == null || o.focus();
|
|
86
88
|
}, G = () => E("update:modelValue", void 0), J = () => {
|
|
87
89
|
var e;
|
|
88
|
-
return (e =
|
|
89
|
-
},
|
|
90
|
+
return (e = y.value) == null ? void 0 : e.focus();
|
|
91
|
+
}, g = () => t.open = !t.open, Q = () => t.open = !0, W = (e) => {
|
|
90
92
|
var o;
|
|
91
|
-
(o =
|
|
93
|
+
(o = d == null ? void 0 : d.value) != null && o.contains(e.relatedTarget) || (t.search = "", t.open = !1);
|
|
92
94
|
}, X = () => {
|
|
93
95
|
const e = L.value;
|
|
94
96
|
e && pe(e.querySelector(".hovered-item"), (o) => {
|
|
95
97
|
he(e, o);
|
|
96
98
|
});
|
|
97
99
|
}, Y = (e) => {
|
|
98
|
-
var
|
|
100
|
+
var z, B;
|
|
99
101
|
if (["ArrowDown", "ArrowUp", "Enter", "Escape"].includes(e.code))
|
|
100
102
|
e.preventDefault();
|
|
101
103
|
else
|
|
102
104
|
return;
|
|
103
|
-
const { open: o, activeIndex:
|
|
105
|
+
const { open: o, activeIndex: i } = t;
|
|
104
106
|
if (!o) {
|
|
105
107
|
e.code === "Enter" && (t.open = !0);
|
|
106
108
|
return;
|
|
107
109
|
}
|
|
108
|
-
e.code === "Escape" && (t.open = !1, (
|
|
109
|
-
const
|
|
110
|
-
if (!
|
|
110
|
+
e.code === "Escape" && (t.open = !1, (z = d.value) == null || z.focus());
|
|
111
|
+
const v = u(f), { length: _ } = v;
|
|
112
|
+
if (!_)
|
|
111
113
|
return;
|
|
112
|
-
e.code === "Enter" &&
|
|
113
|
-
const Z =
|
|
114
|
-
t.activeIndex =
|
|
114
|
+
e.code === "Enter" && D((B = v.find((x) => x.index === i)) == null ? void 0 : B.value);
|
|
115
|
+
const Z = v.findIndex((x) => x.index === i) ?? -1, ee = e.code === "ArrowDown" ? 1 : e.code === "ArrowUp" ? -1 : 0, oe = Math.abs(Z + ee + _) % _;
|
|
116
|
+
t.activeIndex = f.value[oe].index ?? -1;
|
|
115
117
|
};
|
|
116
|
-
return me(
|
|
118
|
+
return me(d), F(() => n.modelValue, R, { immediate: !0 }), F(
|
|
117
119
|
() => t.open,
|
|
118
120
|
(e) => {
|
|
119
121
|
var o;
|
|
120
|
-
return e ? (o =
|
|
122
|
+
return e ? (o = y.value) == null ? void 0 : o.focus() : "";
|
|
121
123
|
}
|
|
122
|
-
),
|
|
124
|
+
), re(() => {
|
|
123
125
|
t.search, t.activeIndex >= 0 && t.open && X();
|
|
124
|
-
}), (e, o) => (
|
|
125
|
-
|
|
126
|
+
}), (e, o) => (l(), a("div", be, [
|
|
127
|
+
p("div", {
|
|
126
128
|
ref_key: "root",
|
|
127
|
-
ref:
|
|
129
|
+
ref: d,
|
|
128
130
|
tabindex: j.value,
|
|
129
|
-
class: b(["ui-dropdown", { open: t.open, error:
|
|
131
|
+
class: b(["ui-dropdown", { open: t.open, error: r.error, disabled: I.value }]),
|
|
130
132
|
onKeydown: Y,
|
|
131
133
|
onFocusout: W
|
|
132
134
|
}, [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
p("div", Ee, [
|
|
136
|
+
p("div", Le, [
|
|
137
|
+
ie(p("input", {
|
|
136
138
|
ref_key: "input",
|
|
137
|
-
ref:
|
|
138
|
-
"onUpdate:modelValue": o[0] || (o[0] = (
|
|
139
|
+
ref: y,
|
|
140
|
+
"onUpdate:modelValue": o[0] || (o[0] = (i) => t.search = i),
|
|
139
141
|
type: "text",
|
|
140
142
|
tabindex: "-1",
|
|
141
|
-
disabled:
|
|
143
|
+
disabled: I.value,
|
|
142
144
|
placeholder: U.value,
|
|
143
145
|
spellcheck: "false",
|
|
144
146
|
autocomplete: "chrome-off",
|
|
145
147
|
onFocus: Q
|
|
146
|
-
}, null, 40,
|
|
147
|
-
[
|
|
148
|
+
}, null, 40, Se), [
|
|
149
|
+
[ae, t.search]
|
|
148
150
|
]),
|
|
149
|
-
t.open ?
|
|
151
|
+
t.open ? c("", !0) : (l(), a("div", {
|
|
150
152
|
key: 0,
|
|
151
153
|
onClick: J
|
|
152
154
|
}, [
|
|
153
|
-
|
|
154
|
-
default:
|
|
155
|
-
|
|
155
|
+
M(ke, { class: "input-value" }, {
|
|
156
|
+
default: N(() => [
|
|
157
|
+
se(m(O.value), 1)
|
|
156
158
|
]),
|
|
157
159
|
_: 1
|
|
158
160
|
})
|
|
159
161
|
])),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
p("div", $e, [
|
|
163
|
+
k.value ? (l(), h(u(ye), {
|
|
162
164
|
key: 0,
|
|
163
165
|
name: "loading"
|
|
164
|
-
})) :
|
|
165
|
-
|
|
166
|
+
})) : c("", !0),
|
|
167
|
+
r.clearable && K.value ? (l(), h(u(_e), {
|
|
166
168
|
key: 1,
|
|
167
169
|
class: "clear",
|
|
168
170
|
name: "delete-clear",
|
|
169
|
-
onClick:
|
|
170
|
-
})) :
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
onClick: w(G, ["stop"])
|
|
172
|
+
})) : c("", !0),
|
|
173
|
+
P(e.$slots, "append"),
|
|
174
|
+
r.arrowIconLarge ? (l(), a("div", {
|
|
173
175
|
key: 2,
|
|
174
|
-
class: b(["arrow-icon", [`icon-24 ${
|
|
175
|
-
onClick:
|
|
176
|
-
}, null, 2)) :
|
|
176
|
+
class: b(["arrow-icon", [`icon-24 ${r.arrowIconLarge}`]]),
|
|
177
|
+
onClick: w(g, ["stop"])
|
|
178
|
+
}, null, 2)) : r.arrowIcon ? (l(), a("div", {
|
|
177
179
|
key: 3,
|
|
178
|
-
class: b(["arrow-icon", [`icon-16 ${
|
|
179
|
-
onClick:
|
|
180
|
-
}, null, 2)) : (
|
|
180
|
+
class: b(["arrow-icon", [`icon-16 ${r.arrowIcon}`]]),
|
|
181
|
+
onClick: w(g, ["stop"])
|
|
182
|
+
}, null, 2)) : (l(), a("div", {
|
|
181
183
|
key: 4,
|
|
182
184
|
class: "arrow-icon arrow-icon-default",
|
|
183
|
-
onClick:
|
|
185
|
+
onClick: w(g, ["stop"])
|
|
184
186
|
}))
|
|
185
187
|
])
|
|
186
188
|
]),
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
r.label ? (l(), a("label", Ae, [
|
|
190
|
+
r.required ? (l(), h(u(xe), {
|
|
189
191
|
key: 0,
|
|
190
|
-
uri: u(
|
|
191
|
-
}, null, 8, ["uri"])) :
|
|
192
|
-
|
|
193
|
-
u(T).tooltip ? (
|
|
192
|
+
uri: u(Ve)
|
|
193
|
+
}, null, 8, ["uri"])) : c("", !0),
|
|
194
|
+
p("span", null, m(r.label), 1),
|
|
195
|
+
u(T).tooltip ? (l(), h(u(fe), {
|
|
194
196
|
key: 1,
|
|
195
197
|
class: "info",
|
|
196
198
|
position: "top"
|
|
197
199
|
}, {
|
|
198
|
-
tooltip:
|
|
199
|
-
|
|
200
|
+
tooltip: N(() => [
|
|
201
|
+
P(e.$slots, "tooltip")
|
|
200
202
|
]),
|
|
201
203
|
_: 3
|
|
202
|
-
})) :
|
|
203
|
-
])) :
|
|
204
|
-
t.open ? (
|
|
204
|
+
})) : c("", !0)
|
|
205
|
+
])) : c("", !0),
|
|
206
|
+
t.open ? (l(), a("div", {
|
|
205
207
|
key: 1,
|
|
206
208
|
ref_key: "list",
|
|
207
209
|
ref: L,
|
|
208
210
|
class: "ui-dropdown__options"
|
|
209
211
|
}, [
|
|
210
|
-
(
|
|
211
|
-
key:
|
|
212
|
-
option:
|
|
213
|
-
"is-selected":
|
|
214
|
-
"is-hovered":
|
|
215
|
-
size:
|
|
216
|
-
onClick:
|
|
212
|
+
(l(!0), a(de, null, ce(f.value, (i, v) => (l(), h(we, {
|
|
213
|
+
key: v,
|
|
214
|
+
option: i,
|
|
215
|
+
"is-selected": i.isSelected,
|
|
216
|
+
"is-hovered": i.isActive,
|
|
217
|
+
size: r.optionSize,
|
|
218
|
+
onClick: w((_) => D(i.value), ["stop"])
|
|
217
219
|
}, null, 8, ["option", "is-selected", "is-hovered", "size", "onClick"]))), 128)),
|
|
218
|
-
|
|
219
|
-
], 512)) :
|
|
220
|
-
|
|
220
|
+
f.value.length ? c("", !0) : (l(), a("div", Oe, "Nothing found"))
|
|
221
|
+
], 512)) : c("", !0),
|
|
222
|
+
M(ve, { class: "ui-dropdown__contour" })
|
|
221
223
|
])
|
|
222
|
-
], 42,
|
|
223
|
-
|
|
224
|
+
], 42, Ce),
|
|
225
|
+
$.value ? (l(), a("div", De, m($.value), 1)) : k.value && r.loadingOptionsHelper ? (l(), a("div", ze, m(r.loadingOptionsHelper), 1)) : r.helper ? (l(), a("div", Be, m(r.helper), 1)) : c("", !0)
|
|
224
226
|
]));
|
|
225
227
|
}
|
|
226
228
|
});
|
|
227
229
|
export {
|
|
228
|
-
|
|
230
|
+
oo as default
|
|
229
231
|
};
|
|
230
232
|
//# sourceMappingURL=PlDropdownLegacy.vue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlDropdownLegacy.vue.js","sources":["../../../src/components/PlDropdownLegacy/PlDropdownLegacy.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: 'PlDropdown',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-dropdown-legacy.scss';\nimport { computed, reactive, ref, unref, useSlots, watch, watchPostEffect } from 'vue';\nimport { tap, tapIf } from '../../helpers/functions';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport type { ListOption, ListOptionNormalized } from '../../types';\nimport { scrollIntoView } from '../../helpers/dom';\nimport { deepEqual } from '../../helpers/objects';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport LongText from '../LongText.vue';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: M | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current selected value of the dropdown.\n */\n modelValue: M;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * List of available options for the dropdown\n */\n options?: Readonly<ListOption<M>[]>;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: 'small' | 'medium';\n }>(),\n {\n label: '',\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: '...',\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: 'small',\n options: undefined,\n },\n);\n\nconst slots = useSlots();\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst data = reactive({\n search: '',\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n filteredRef.value.findIndex((o) => deepEqual(o.value, props.modelValue)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst isLoadingOptions = computed(() => {\n return props.options === undefined;\n});\n\nconst isDisabled = computed(() => {\n if (isLoadingOptions.value) {\n return true;\n }\n\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, props.modelValue));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (props.modelValue !== undefined && selectedIndex.value === -1) {\n return 'The selected value is not one of the options';\n }\n\n return undefined;\n});\n\nconst optionsRef = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst textValue = computed(() => {\n const options = unref(optionsRef);\n\n const item: ListOption | undefined = options.find((o) => deepEqual(o.value, props.modelValue));\n\n return item?.label || props.modelValue; // @todo show inner value?\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && props.modelValue) {\n return '';\n }\n\n return props.modelValue ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return props.modelValue !== undefined && props.modelValue !== null;\n});\n\nconst filteredRef = computed(() => {\n const options = optionsRef.value;\n\n if (data.search) {\n return options.filter((o: ListOptionNormalized) => {\n const search = data.search.toLowerCase();\n\n if (o.label.toLowerCase().includes(search)) {\n return true;\n }\n\n if (o.description && o.description.toLowerCase().includes(search)) {\n return true;\n }\n\n if (typeof o.value === 'string') {\n return o.value.toLowerCase().includes(search);\n }\n\n return o.value === data.search;\n });\n }\n\n return options;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : '0'));\n\nconst selectOption = (v: M | undefined) => {\n emit('update:modelValue', v);\n data.search = '';\n data.open = false;\n root?.value?.focus();\n};\n\nconst clear = () => emit('update:modelValue', undefined);\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => (data.open = !data.open);\n\nconst onInputFocus = () => (data.open = true);\n\nconst onFocusOut = (event: FocusEvent) => {\n if (!root?.value?.contains(event.relatedTarget as Node | null)) {\n data.search = '';\n data.open = false;\n }\n};\n\nconst scrollIntoActive = () => {\n const $list = list.value;\n\n if (!$list) {\n return;\n }\n\n tapIf($list.querySelector('.hovered-item') as HTMLElement, (opt) => {\n scrollIntoView($list, opt);\n });\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === 'Enter') {\n data.open = true;\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(filteredRef);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = filteredRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(root);\n\nwatch(() => props.modelValue, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : ''),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n data.search; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n scrollIntoActive();\n }\n});\n</script>\n\n<template>\n <div class=\"ui-dropdown__envelope\">\n <div\n ref=\"root\"\n :tabindex=\"tabindex\"\n class=\"ui-dropdown\"\n :class=\"{ open: data.open, error, disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"ui-dropdown__container\">\n <div class=\"ui-dropdown__field\">\n <input\n ref=\"input\"\n v-model=\"data.search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" @click=\"setFocusOnInput\">\n <LongText class=\"input-value\"> {{ textValue }} </LongText>\n </div>\n\n <div class=\"ui-dropdown__controls\">\n <PlMaskIcon24 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-if=\"clearable && hasValue\" class=\"clear\" name=\"delete-clear\" @click.stop=\"clear\" />\n <slot name=\"append\" />\n <div v-if=\"arrowIconLarge\" class=\"arrow-icon\" :class=\"[`icon-24 ${arrowIconLarge}`]\" @click.stop=\"toggleOpen\" />\n <div v-else-if=\"arrowIcon\" class=\"arrow-icon\" :class=\"[`icon-16 ${arrowIcon}`]\" @click.stop=\"toggleOpen\" />\n <div v-else class=\"arrow-icon arrow-icon-default\" @click.stop=\"toggleOpen\" />\n </div>\n </div>\n <label v-if=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"data.open\" ref=\"list\" class=\"ui-dropdown__options\">\n <DropdownListItem\n v-for=\"(item, index) in filteredRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n @click.stop=\"selectOption(item.value)\"\n />\n <div v-if=\"!filteredRef.length\" class=\"nothing-found\">Nothing found</div>\n </div>\n <DoubleContour class=\"ui-dropdown__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"ui-dropdown__error\">{{ computedError }}</div>\n <div v-else-if=\"isLoadingOptions && loadingOptionsHelper\" class=\"ui-dropdown__helper\">{{ loadingOptionsHelper }}</div>\n <div v-else-if=\"helper\" class=\"ui-dropdown__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","emit","__emit","props","__props","slots","useSlots","root","ref","list","input","data","reactive","findActiveIndex","tap","filteredRef","o","deepEqual","v","updateActive","isLoadingOptions","computed","isDisabled","selectedIndex","computedError","getErrorMessage","optionsRef","normalizeListOptions","opt","index","textValue","item","unref","computedPlaceholder","hasValue","options","search","tabindex","selectOption","_a","clear","setFocusOnInput","toggleOpen","onInputFocus","onFocusOut","event","scrollIntoActive","$list","tapIf","scrollIntoView","handleKeydown","open","activeIndex","filtered","length","_b","it","localIndex","delta","newIndex","useLabelNotch","watch","watchPostEffect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;AAsBA,UAAMC,IAAOC,GAOPC,IAAQC,GAuERC,IAAQC,GAAA,GAERC,IAAOC,EAAA,GACPC,IAAOD,EAAA,GACPE,IAAQF,EAAA,GAERG,IAAOC,GAAS;AAAA,MACpB,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,IAAA,CACP,GAEKC,IAAkB,MACtBC;AAAA,MACEC,EAAY,MAAM,UAAU,CAACC,MAAMC,EAAUD,EAAE,OAAOb,EAAM,UAAU,CAAC;AAAA,MACvE,CAACe,MAAOA,IAAI,IAAI,IAAIA;AAAA,IAAA,GAGlBC,IAAe,MAAOR,EAAK,cAAcE,EAAA,GAEzCO,IAAmBC,EAAS,MACzBlB,EAAM,YAAY,MAC1B,GAEKmB,IAAaD,EAAS,MACtBD,EAAiB,QACZ,KAGFjB,EAAM,QACd,GAEKoB,IAAgBF,EAAS,OACrBlB,EAAM,WAAW,CAAA,GAAI,UAAU,CAACa,MAAMC,EAAUD,EAAE,OAAOb,EAAM,UAAU,CAAC,CACnF,GAEKqB,IAAgBH,EAAS,MAAM;AACnC,UAAI,CAAAD,EAAiB,OAIrB;AAAA,YAAIjB,EAAM;AACR,iBAAOsB,GAAgBtB,EAAM,KAAK;AAGpC,YAAIA,EAAM,eAAe,UAAaoB,EAAc,UAAU;AAC5D,iBAAO;AAAA;AAAA,IAIX,CAAC,GAEKG,IAAaL;AAAA,MAAS,MAC1BM,GAAqBxB,EAAM,WAAW,CAAA,CAAE,EAAE,IAAI,CAACy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D,MAAA3C,EAAK,cAAcI,EAAY,MAAM4C,EAAQ,EAAE,SAAS;AAAA,IAC1D;AAEA,WAAAC,GAAcrD,CAAI,GAElBsD,EAAM,MAAM1D,EAAM,YAAYgB,GAAc,EAAE,WAAW,IAAM,GAE/D0C;AAAA,MACE,MAAMlD,EAAK;AAAA,MACX,CAACwC,MAAA;;AAAU,eAAAA,KAAOZ,IAAA7B,EAAM,UAAN,gBAAA6B,EAAa,UAAU;AAAA;AAAA,IAAA,GAG3CuB,GAAgB,MAAM;AAEpB,MAAAnD,EAAK,QAEDA,EAAK,eAAe,KAAKA,EAAK,QAChCmC,EAAA;AAAA,IAEJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlDropdownLegacy.vue.js","sources":["../../../src/components/PlDropdownLegacy/PlDropdownLegacy.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: 'PlDropdown',\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport './pl-dropdown-legacy.scss';\nimport { computed, reactive, ref, unref, useSlots, watch, watchPostEffect } from 'vue';\nimport { tap, tapIf } from '../../helpers/functions';\nimport { PlTooltip } from '../PlTooltip';\nimport DoubleContour from '../../utils/DoubleContour.vue';\nimport { useLabelNotch } from '../../utils/useLabelNotch';\nimport type { ListOption, ListOptionNormalized } from '../../types';\nimport { scrollIntoView } from '../../helpers/dom';\nimport { deepEqual } from '../../helpers/objects';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport LongText from '../LongText.vue';\nimport { PlIcon16 } from '../PlIcon16';\nimport { PlMaskIcon24 } from '../PlMaskIcon24';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { getErrorMessage } from '../../helpers/error.ts';\nimport { PlSvg } from '../PlSvg';\nimport SvgRequired from '../../assets/images/required.svg?raw';\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: 'update:modelValue', value: M | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current selected value of the dropdown.\n */\n modelValue: M;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * List of available options for the dropdown\n */\n options?: Readonly<ListOption<M>[]>;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: 'small' | 'medium';\n }>(),\n {\n label: '',\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: '...',\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: 'small',\n options: undefined,\n },\n);\n\nconst slots = useSlots();\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst data = reactive({\n search: '',\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n filteredRef.value.findIndex((o) => deepEqual(o.value, props.modelValue)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst isLoadingOptions = computed(() => {\n return props.options === undefined;\n});\n\nconst isDisabled = computed(() => {\n if (isLoadingOptions.value) {\n return true;\n }\n\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, props.modelValue));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (props.modelValue !== undefined && selectedIndex.value === -1) {\n return 'The selected value is not one of the options';\n }\n\n return undefined;\n});\n\nconst optionsRef = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst textValue = computed(() => {\n const options = unref(optionsRef);\n\n const item: ListOption | undefined = options.find((o) => deepEqual(o.value, props.modelValue));\n\n return item?.label || props.modelValue; // @todo show inner value?\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && props.modelValue) {\n return '';\n }\n\n return props.modelValue ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return props.modelValue !== undefined && props.modelValue !== null;\n});\n\nconst filteredRef = computed(() => {\n const options = optionsRef.value;\n\n if (data.search) {\n return options.filter((o: ListOptionNormalized) => {\n const search = data.search.toLowerCase();\n\n if (o.label.toLowerCase().includes(search)) {\n return true;\n }\n\n if (o.description && o.description.toLowerCase().includes(search)) {\n return true;\n }\n\n if (typeof o.value === 'string') {\n return o.value.toLowerCase().includes(search);\n }\n\n return o.value === data.search;\n });\n }\n\n return options;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : '0'));\n\nconst selectOption = (v: M | undefined) => {\n emit('update:modelValue', v);\n data.search = '';\n data.open = false;\n root?.value?.focus();\n};\n\nconst clear = () => emit('update:modelValue', undefined);\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => (data.open = !data.open);\n\nconst onInputFocus = () => (data.open = true);\n\nconst onFocusOut = (event: FocusEvent) => {\n if (!root?.value?.contains(event.relatedTarget as Node | null)) {\n data.search = '';\n data.open = false;\n }\n};\n\nconst scrollIntoActive = () => {\n const $list = list.value;\n\n if (!$list) {\n return;\n }\n\n tapIf($list.querySelector('.hovered-item') as HTMLElement, (opt) => {\n scrollIntoView($list, opt);\n });\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (!['ArrowDown', 'ArrowUp', 'Enter', 'Escape'].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === 'Enter') {\n data.open = true;\n }\n return;\n }\n\n if (e.code === 'Escape') {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(filteredRef);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === 'Enter') {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = filteredRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(root);\n\nwatch(() => props.modelValue, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : ''),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n data.search; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n scrollIntoActive();\n }\n});\n</script>\n\n<template>\n <div class=\"ui-dropdown__envelope\">\n <div\n ref=\"root\"\n :tabindex=\"tabindex\"\n class=\"ui-dropdown\"\n :class=\"{ open: data.open, error, disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"ui-dropdown__container\">\n <div class=\"ui-dropdown__field\">\n <input\n ref=\"input\"\n v-model=\"data.search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" @click=\"setFocusOnInput\">\n <LongText class=\"input-value\"> {{ textValue }} </LongText>\n </div>\n\n <div class=\"ui-dropdown__controls\">\n <PlMaskIcon24 v-if=\"isLoadingOptions\" name=\"loading\" />\n <PlIcon16 v-if=\"clearable && hasValue\" class=\"clear\" name=\"delete-clear\" @click.stop=\"clear\" />\n <slot name=\"append\" />\n <div v-if=\"arrowIconLarge\" class=\"arrow-icon\" :class=\"[`icon-24 ${arrowIconLarge}`]\" @click.stop=\"toggleOpen\" />\n <div v-else-if=\"arrowIcon\" class=\"arrow-icon\" :class=\"[`icon-16 ${arrowIcon}`]\" @click.stop=\"toggleOpen\" />\n <div v-else class=\"arrow-icon arrow-icon-default\" @click.stop=\"toggleOpen\" />\n </div>\n </div>\n <label v-if=\"label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" />\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"data.open\" ref=\"list\" class=\"ui-dropdown__options\">\n <DropdownListItem\n v-for=\"(item, index) in filteredRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n @click.stop=\"selectOption(item.value)\"\n />\n <div v-if=\"!filteredRef.length\" class=\"nothing-found\">Nothing found</div>\n </div>\n <DoubleContour class=\"ui-dropdown__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"ui-dropdown__error\">{{ computedError }}</div>\n <div v-else-if=\"isLoadingOptions && loadingOptionsHelper\" class=\"ui-dropdown__helper\">{{ loadingOptionsHelper }}</div>\n <div v-else-if=\"helper\" class=\"ui-dropdown__helper\">{{ helper }}</div>\n </div>\n</template>\n"],"names":["__default__","emit","__emit","props","__props","slots","useSlots","root","ref","list","input","data","reactive","findActiveIndex","tap","filteredRef","o","deepEqual","v","updateActive","isLoadingOptions","computed","isDisabled","selectedIndex","computedError","getErrorMessage","optionsRef","normalizeListOptions","opt","index","textValue","item","unref","computedPlaceholder","hasValue","options","search","tabindex","selectOption","_a","clear","setFocusOnInput","toggleOpen","onInputFocus","onFocusOut","event","scrollIntoActive","$list","tapIf","scrollIntoView","handleKeydown","open","activeIndex","filtered","length","_b","it","localIndex","delta","newIndex","useLabelNotch","watch","watchPostEffect","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_normalizeClass","_hoisted_3","_hoisted_4","_cache","$event","_vModelText","_createVNode","LongText","_hoisted_6","_createBlock","_unref","PlMaskIcon24","PlIcon16","_renderSlot","_ctx","_hoisted_7","PlSvg","SvgRequired","PlTooltip","_Fragment","_renderList","DropdownListItem","_withModifiers","_hoisted_8","DoubleContour","_hoisted_9","_toDisplayString","_hoisted_10","_hoisted_11"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIAA,KAAe;AAAA,EACb,MAAM;AACR;;;;;;;;;;;;;;;;;;;AAsBA,UAAMC,IAAOC,GAOPC,IAAQC,GAuERC,IAAQC,GAAA,GAERC,IAAOC,EAAA,GACPC,IAAOD,EAAA,GACPE,IAAQF,EAAA,GAERG,IAAOC,GAAS;AAAA,MACpB,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,MAAM;AAAA,IAAA,CACP,GAEKC,IAAkB,MACtBC;AAAA,MACEC,EAAY,MAAM,UAAU,CAACC,MAAMC,EAAUD,EAAE,OAAOb,EAAM,UAAU,CAAC;AAAA,MACvE,CAACe,MAAOA,IAAI,IAAI,IAAIA;AAAA,IAAA,GAGlBC,IAAe,MAAOR,EAAK,cAAcE,EAAA,GAEzCO,IAAmBC,EAAS,MACzBlB,EAAM,YAAY,MAC1B,GAEKmB,IAAaD,EAAS,MACtBD,EAAiB,QACZ,KAGFjB,EAAM,QACd,GAEKoB,IA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AA,MAAM,GAAA,CAAA;;;;"}
|
|
@@ -39,8 +39,8 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
39
39
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
40
40
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
41
41
|
}>, {
|
|
42
|
-
mode: "list" | "tabs";
|
|
43
42
|
placeholder: string;
|
|
43
|
+
mode: "list" | "tabs";
|
|
44
44
|
clearable: boolean;
|
|
45
45
|
prefix: string;
|
|
46
46
|
tabsContainerStyles: string | false | import('vue').CSSProperties | StyleValue[] | null;
|
|
@@ -193,9 +193,9 @@ const ce = { class: "pl-line-dropdown__prefix" }, fe = { class: "pl-line-dropdow
|
|
|
193
193
|
onClick: f((V) => v(o), ["stop"])
|
|
194
194
|
}, null, 8, ["option", "is-selected", "is-hovered", "onClick"])
|
|
195
195
|
])), 128)),
|
|
196
|
-
b(a).length === 0 ? (r(), d("div", ve, t[3] || (t[3] = [
|
|
196
|
+
b(a).length === 0 ? (r(), d("div", ve, [...t[3] || (t[3] = [
|
|
197
197
|
c("div", { class: "pl-line-dropdown__no-item-title text-s" }, "Didn't find anything that matched", -1)
|
|
198
|
-
]))) : k("", !0)
|
|
198
|
+
])])) : k("", !0)
|
|
199
199
|
], 36)) : i.mode === "tabs" ? (r(), d("div", {
|
|
200
200
|
key: 1,
|
|
201
201
|
ref_key: "list",
|
|
@@ -221,9 +221,9 @@ const ce = { class: "pl-line-dropdown__prefix" }, fe = { class: "pl-line-dropdow
|
|
|
221
221
|
onClick: f((V) => v(o), ["stop"])
|
|
222
222
|
}, null, 8, ["option", "is-selected", "is-hovered", "onClick"])
|
|
223
223
|
])), 128)),
|
|
224
|
-
b(a).length === 0 ? (r(), d("div", he, t[4] || (t[4] = [
|
|
224
|
+
b(a).length === 0 ? (r(), d("div", he, [...t[4] || (t[4] = [
|
|
225
225
|
c("div", { class: "pl-line-dropdown__no-item-title text-s" }, "Didn't find anything that matched", -1)
|
|
226
|
-
]))) : k("", !0)
|
|
226
|
+
])])) : k("", !0)
|
|
227
227
|
], 36)) : k("", !0)
|
|
228
228
|
])) : k("", !0)
|
|
229
229
|
], 34));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlDropdownLine.vue.js","sources":["../../../src/components/PlDropdownLine/PlDropdownLine.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport './pl-dropdown-line.scss';\nimport type { StyleValue } from 'vue';\nimport { computed, nextTick, reactive, ref, toRef, watch } from 'vue';\nimport { deepEqual } from '../../helpers/objects';\nimport { useClickOutside } from '../../composition/useClickOutside';\nimport { useFilteredList } from '../../composition/useFilteredList';\nimport ResizableInput from './ResizableInput.vue';\nimport { tapIf, tap } from '../../helpers/functions';\nimport { scrollIntoView } from '../../helpers/dom';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport TabItem from '../TabItem.vue';\nimport type { ListOption } from '../../types';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { useElementPosition } from '../../composition/usePosition';\n\nconst emit = defineEmits(['update:modelValue']); // at the top always\n\nconst props = withDefaults(\n defineProps<{\n modelValue: unknown;\n disabled?: boolean;\n prefix?: string;\n options: ListOption[]; // @todo extend with size field\n placeholder?: string;\n mode?: 'list' | 'tabs';\n tabsContainerStyles?: StyleValue;\n clearable?: boolean;\n }>(),\n {\n mode: 'list',\n placeholder: 'Select..',\n prefix: '',\n tabsContainerStyles: undefined,\n clearable: false,\n },\n);\n\nconst data = reactive({\n isOpen: false,\n activeOption: -1,\n optionsHeight: 0,\n});\n\nconst container = ref<HTMLElement>();\n\nconst list = ref<HTMLElement>();\n\nconst classes = computed(() => {\n const classesResult = [];\n if (data.isOpen) {\n classesResult.push('open');\n }\n if (props.disabled) {\n classesResult.push('disabled');\n }\n return classesResult.join(' ');\n});\n\nconst searchPhrase = ref<string>('');\n\nconst options = useFilteredList(toRef(props, 'options'), searchPhrase);\n\nconst canShowClearBtn = computed<boolean>(() => !!(props.clearable && data.isOpen && props.modelValue && modelText.value));\n\nconst modelText = computed<string>(() => {\n if (props.modelValue !== undefined) {\n const index = getIndexForModelInItems();\n if (index !== -1) {\n const item = normalizeListOptions(props.options)[index];\n return item.label;\n }\n }\n return '';\n});\n\nconst inputModel = ref(modelText.value);\n\nwatch(modelText, (v) => {\n inputModel.value = v;\n});\n\nconst placeholderVal = computed(() => {\n if (data.isOpen) {\n if (searchPhrase.value && searchPhrase.value.length >= modelText.value.length - 1) {\n return searchPhrase.value;\n }\n }\n\n return modelText.value || '...';\n});\n\nuseClickOutside(container, () => {\n if (props.mode === 'list') {\n data.isOpen = false;\n }\n});\n\nwatch(\n () => inputModel.value,\n (val) => {\n if (modelText.value !== val) {\n searchPhrase.value = val;\n } else {\n searchPhrase.value = '';\n }\n },\n);\n\nwatch(\n () => data.isOpen,\n (value: boolean) => {\n if (value && container.value) {\n container.value.querySelector('input')?.focus();\n nextTick(() => scrollIntoActive());\n }\n },\n);\n\nwatch(\n () => props.modelValue,\n () => updateSelected(),\n { immediate: true },\n);\n\nfunction getIndexForModelInItems(): number | -1 {\n return props.options.findIndex((o: ListOption) => {\n return deepEqual(o.value, props.modelValue);\n });\n}\n\nfunction updateSelected() {\n data.activeOption = tap(\n options.value.findIndex((o: ListOption) => {\n return deepEqual(o.value, props.modelValue);\n }),\n (v) => (v < 0 ? 0 : v),\n );\n}\n\nfunction resetSearchPhrase() {\n searchPhrase.value = '';\n}\n\nfunction toggleList(): void {\n if (props.disabled) {\n data.isOpen = false;\n } else {\n nextTick(() => {\n data.isOpen = !data.isOpen;\n });\n }\n}\n\nfunction closePopupIfNeeded() {\n if (props.mode === 'list') {\n data.isOpen = false;\n }\n}\n\nfunction selectItem(item?: ListOption): void {\n if (item) {\n emit('update:modelValue', item.value);\n closePopupIfNeeded();\n resetSearchPhrase();\n }\n}\n\nfunction isItemSelected(item: ListOption): boolean {\n return deepEqual(item.value, props.modelValue);\n}\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!container.value?.contains(relatedTarget) && !list.value?.contains(relatedTarget)) {\n searchPhrase.value = '';\n data.isOpen = false;\n }\n};\n\nfunction handleKeydown(e: { code: string; preventDefault(): void }) {\n const { activeOption } = data;\n\n if (!data.isOpen && e.code === 'Enter') {\n data.isOpen = true;\n return;\n }\n\n const { length } = options.value;\n\n if (!length) {\n return;\n }\n\n if (['ArrowDown', 'ArrowUp', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n if (e.code === 'Enter') {\n selectItem(options.value[activeOption]);\n }\n\n const d = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n data.activeOption = Math.abs(activeOption + d + length) % length;\n\n requestAnimationFrame(scrollIntoActive);\n}\n\nfunction scrollIntoActive() {\n const $list = list.value;\n if (!$list) {\n return;\n }\n tapIf($list.querySelector('.hovered-item'), (el: Element) => {\n if (props.mode === 'list') {\n scrollIntoView($list, el as HTMLElement);\n } else {\n el.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });\n }\n });\n}\n\nfunction clearModel() {\n emit('update:modelValue', undefined);\n}\n\nconst optionsStyle = reactive({\n top: '0px',\n left: '0px',\n});\n\nwatch(list, (el) => {\n if (el) {\n const rect = el.getBoundingClientRect();\n data.optionsHeight = rect.height;\n window.dispatchEvent(new CustomEvent('adjust'));\n }\n});\n\nuseElementPosition(container, (pos) => {\n const gap = 2;\n\n const downTopOffset = pos.top + pos.height + gap;\n\n if (downTopOffset + data.optionsHeight > pos.clientHeight) {\n optionsStyle.top = pos.top - data.optionsHeight - gap + 'px';\n } else {\n optionsStyle.top = downTopOffset + 'px';\n }\n\n optionsStyle.left = pos.left + 'px';\n});\n</script>\n\n<template>\n <div\n ref=\"container\"\n tabindex=\"0\"\n :class=\"classes\"\n class=\"pl-line-dropdown uc-pointer\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n @click=\"toggleList\"\n >\n <div class=\"pl-line-dropdown__prefix\">{{ props?.prefix }}</div>\n\n <ResizableInput v-model=\"inputModel\" :placeholder=\"placeholderVal\" :disabled=\"props.disabled\" class=\"pl-line-dropdown__input\" />\n\n <div class=\"pl-line-dropdown__icon-wrapper\">\n <div v-show=\"!canShowClearBtn\" class=\"pl-line-dropdown__icon\" />\n <div v-show=\"canShowClearBtn\" class=\"pl-line-dropdown__icon-clear\" @click=\"clearModel\" />\n </div>\n <Teleport v-if=\"data.isOpen\" to=\"body\">\n <div\n v-if=\"props.mode === 'list'\"\n ref=\"list\"\n :style=\"optionsStyle\"\n tabindex=\"-1\"\n class=\"pl-line-dropdown__items\"\n @focusout=\"onFocusOut\"\n @click.stop\n >\n <template v-for=\"(item, index) in options\" :key=\"index\">\n <slot\n name=\"item\"\n :item=\"item\"\n :text-item=\"'text'\"\n :is-selected=\"isItemSelected(item)\"\n :is-hovered=\"data.activeOption == index\"\n @click.stop=\"selectItem(item)\"\n >\n <DropdownListItem\n :option=\"item\"\n :text-item=\"'text'\"\n :is-selected=\"isItemSelected(item)\"\n :is-hovered=\"data.activeOption == index\"\n size=\"medium\"\n @click.stop=\"selectItem(item)\"\n />\n </slot>\n </template>\n\n <div v-if=\"options.length === 0\" class=\"pl-line-dropdown__no-item\">\n <div class=\"pl-line-dropdown__no-item-title text-s\">Didn't find anything that matched</div>\n </div>\n </div>\n <div\n v-else-if=\"props.mode === 'tabs'\"\n ref=\"list\"\n :style=\"optionsStyle\"\n tabindex=\"-1\"\n class=\"pl-line-dropdown__items-tabs\"\n @focusout=\"onFocusOut\"\n @click.stop\n >\n <template v-for=\"(item, index) in options\" :key=\"index\">\n <slot name=\"item\" :item=\"item\" :is-selected=\"isItemSelected(item)\" :is-hovered=\"data.activeOption == index\" @click.stop=\"selectItem(item)\">\n <TabItem :option=\"item\" :is-selected=\"isItemSelected(item)\" :is-hovered=\"data.activeOption == index\" @click.stop=\"selectItem(item)\" />\n </slot>\n </template>\n <div v-if=\"options.length === 0\" class=\"pl-line-dropdown__no-item\">\n <div class=\"pl-line-dropdown__no-item-title text-s\">Didn't find anything that matched</div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["emit","__emit","props","__props","data","reactive","container","ref","list","classes","computed","classesResult","searchPhrase","options","useFilteredList","toRef","canShowClearBtn","modelText","index","getIndexForModelInItems","normalizeListOptions","inputModel","watch","v","placeholderVal","useClickOutside","val","value","_a","nextTick","scrollIntoActive","updateSelected","o","deepEqual","tap","resetSearchPhrase","toggleList","closePopupIfNeeded","selectItem","item","isItemSelected","onFocusOut","event","relatedTarget","_b","handleKeydown","activeOption","length","d","$list","tapIf","el","scrollIntoView","clearModel","optionsStyle","rect","useElementPosition","pos","downTopOffset"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,UAAMA,IAAOC,GAEPC,IAAQC,GAoBRC,IAAOC,EAAS;AAAA,MACpB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,eAAe;AAAA,IAAA,CAChB,GAEKC,IAAYC,EAAA,GAEZC,IAAOD,EAAA,GAEPE,IAAUC,EAAS,MAAM;AAC7B,YAAMC,IAAgB,CAAA;AACtB,aAAIP,EAAK,UACPO,EAAc,KAAK,MAAM,GAEvBT,EAAM,YACRS,EAAc,KAAK,UAAU,GAExBA,EAAc,KAAK,GAAG;AAAA,IAC/B,CAAC,GAEKC,IAAeL,EAAY,EAAE,GAE7BM,IAAUC,GAAgBC,EAAMb,GAAO,SAAS,GAAGU,CAAY,GAE/DI,IAAkBN,EAAkB,MAAM,CAAC,EAAER,EAAM,aAAaE,EAAK,UAAUF,EAAM,cAAce,EAAU,MAAM,GAEnHA,IAAYP,EAAiB,MAAM;AACvC,UAAIR,EAAM,eAAe,QAAW;AAClC,cAAMgB,IAAQC,EAAA;AACd,YAAID,MAAU;AAEZ,iBADaE,GAAqBlB,EAAM,OAAO,EAAEgB,CAAK,EAC1C;AAAA,MAEhB;AACA,aAAO;AAAA,IACT,CAAC,GAEKG,IA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eAAe,GAAG,CAACE,MAAgB;AAC3D,QAAIjD,EAAM,SAAS,SACjBkD,GAAeH,GAAOE,CAAiB,IAEvCA,EAAG,eAAe,EAAE,UAAU,UAAU,OAAO,WAAW,QAAQ,UAAU;AAAA,MAEhF,CAAC;AAAA,IACH;AAEA,aAASE,IAAa;AACpB,MAAArD,EAAK,qBAAqB,MAAS;AAAA,IACrC;AAEA,UAAMsD,IAAejD,EAAS;AAAA,MAC5B,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP;AAED,WAAAiB,EAAMd,GAAM,CAAC2C,MAAO;AAClB,UAAIA,GAAI;AACN,cAAMI,IAAOJ,EAAG,sBAAA;AAChB,QAAA/C,EAAK,gBAAgBmD,EAAK,QAC1B,OAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,MAChD;AAAA,IACF,CAAC,GAEDC,GAAmBlD,GAAW,CAACmD,MAAQ;AAGrC,YAAMC,IAAgBD,EAAI,MAAMA,EAAI,SAAS;AAE7C,MAAIC,IAAgBtD,EAAK,gBAAgBqD,EAAI,eAC3CH,EAAa,MAAMG,EAAI,MAAMrD,EAAK,gBAAgB,IAAM,OAExDkD,EAAa,MAAMI,IAAgB,MAGrCJ,EAAa,OAAOG,EAAI,OAAO;AAAA,IACjC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"PlDropdownLine.vue.js","sources":["../../../src/components/PlDropdownLine/PlDropdownLine.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport './pl-dropdown-line.scss';\nimport type { StyleValue } from 'vue';\nimport { computed, nextTick, reactive, ref, toRef, watch } from 'vue';\nimport { deepEqual } from '../../helpers/objects';\nimport { useClickOutside } from '../../composition/useClickOutside';\nimport { useFilteredList } from '../../composition/useFilteredList';\nimport ResizableInput from './ResizableInput.vue';\nimport { tapIf, tap } from '../../helpers/functions';\nimport { scrollIntoView } from '../../helpers/dom';\nimport DropdownListItem from '../DropdownListItem.vue';\nimport TabItem from '../TabItem.vue';\nimport type { ListOption } from '../../types';\nimport { normalizeListOptions } from '../../helpers/utils';\nimport { useElementPosition } from '../../composition/usePosition';\n\nconst emit = defineEmits(['update:modelValue']); // at the top always\n\nconst props = withDefaults(\n defineProps<{\n modelValue: unknown;\n disabled?: boolean;\n prefix?: string;\n options: ListOption[]; // @todo extend with size field\n placeholder?: string;\n mode?: 'list' | 'tabs';\n tabsContainerStyles?: StyleValue;\n clearable?: boolean;\n }>(),\n {\n mode: 'list',\n placeholder: 'Select..',\n prefix: '',\n tabsContainerStyles: undefined,\n clearable: false,\n },\n);\n\nconst data = reactive({\n isOpen: false,\n activeOption: -1,\n optionsHeight: 0,\n});\n\nconst container = ref<HTMLElement>();\n\nconst list = ref<HTMLElement>();\n\nconst classes = computed(() => {\n const classesResult = [];\n if (data.isOpen) {\n classesResult.push('open');\n }\n if (props.disabled) {\n classesResult.push('disabled');\n }\n return classesResult.join(' ');\n});\n\nconst searchPhrase = ref<string>('');\n\nconst options = useFilteredList(toRef(props, 'options'), searchPhrase);\n\nconst canShowClearBtn = computed<boolean>(() => !!(props.clearable && data.isOpen && props.modelValue && modelText.value));\n\nconst modelText = computed<string>(() => {\n if (props.modelValue !== undefined) {\n const index = getIndexForModelInItems();\n if (index !== -1) {\n const item = normalizeListOptions(props.options)[index];\n return item.label;\n }\n }\n return '';\n});\n\nconst inputModel = ref(modelText.value);\n\nwatch(modelText, (v) => {\n inputModel.value = v;\n});\n\nconst placeholderVal = computed(() => {\n if (data.isOpen) {\n if (searchPhrase.value && searchPhrase.value.length >= modelText.value.length - 1) {\n return searchPhrase.value;\n }\n }\n\n return modelText.value || '...';\n});\n\nuseClickOutside(container, () => {\n if (props.mode === 'list') {\n data.isOpen = false;\n }\n});\n\nwatch(\n () => inputModel.value,\n (val) => {\n if (modelText.value !== val) {\n searchPhrase.value = val;\n } else {\n searchPhrase.value = '';\n }\n },\n);\n\nwatch(\n () => data.isOpen,\n (value: boolean) => {\n if (value && container.value) {\n container.value.querySelector('input')?.focus();\n nextTick(() => scrollIntoActive());\n }\n },\n);\n\nwatch(\n () => props.modelValue,\n () => updateSelected(),\n { immediate: true },\n);\n\nfunction getIndexForModelInItems(): number | -1 {\n return props.options.findIndex((o: ListOption) => {\n return deepEqual(o.value, props.modelValue);\n });\n}\n\nfunction updateSelected() {\n data.activeOption = tap(\n options.value.findIndex((o: ListOption) => {\n return deepEqual(o.value, props.modelValue);\n }),\n (v) => (v < 0 ? 0 : v),\n );\n}\n\nfunction resetSearchPhrase() {\n searchPhrase.value = '';\n}\n\nfunction toggleList(): void {\n if (props.disabled) {\n data.isOpen = false;\n } else {\n nextTick(() => {\n data.isOpen = !data.isOpen;\n });\n }\n}\n\nfunction closePopupIfNeeded() {\n if (props.mode === 'list') {\n data.isOpen = false;\n }\n}\n\nfunction selectItem(item?: ListOption): void {\n if (item) {\n emit('update:modelValue', item.value);\n closePopupIfNeeded();\n resetSearchPhrase();\n }\n}\n\nfunction isItemSelected(item: ListOption): boolean {\n return deepEqual(item.value, props.modelValue);\n}\n\nconst onFocusOut = (event: FocusEvent) => {\n const relatedTarget = event.relatedTarget as Node | null;\n\n if (!container.value?.contains(relatedTarget) && !list.value?.contains(relatedTarget)) {\n searchPhrase.value = '';\n data.isOpen = false;\n }\n};\n\nfunction handleKeydown(e: { code: string; preventDefault(): void }) {\n const { activeOption } = data;\n\n if (!data.isOpen && e.code === 'Enter') {\n data.isOpen = true;\n return;\n }\n\n const { length } = options.value;\n\n if (!length) {\n return;\n }\n\n if (['ArrowDown', 'ArrowUp', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n if (e.code === 'Enter') {\n selectItem(options.value[activeOption]);\n }\n\n const d = e.code === 'ArrowDown' ? 1 : e.code === 'ArrowUp' ? -1 : 0;\n\n data.activeOption = Math.abs(activeOption + d + length) % length;\n\n requestAnimationFrame(scrollIntoActive);\n}\n\nfunction scrollIntoActive() {\n const $list = list.value;\n if (!$list) {\n return;\n }\n tapIf($list.querySelector('.hovered-item'), (el: Element) => {\n if (props.mode === 'list') {\n scrollIntoView($list, el as HTMLElement);\n } else {\n el.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });\n }\n });\n}\n\nfunction clearModel() {\n emit('update:modelValue', undefined);\n}\n\nconst optionsStyle = reactive({\n top: '0px',\n left: '0px',\n});\n\nwatch(list, (el) => {\n if (el) {\n const rect = el.getBoundingClientRect();\n data.optionsHeight = rect.height;\n window.dispatchEvent(new CustomEvent('adjust'));\n }\n});\n\nuseElementPosition(container, (pos) => {\n const gap = 2;\n\n const downTopOffset = pos.top + pos.height + gap;\n\n if (downTopOffset + data.optionsHeight > pos.clientHeight) {\n optionsStyle.top = pos.top - data.optionsHeight - gap + 'px';\n } else {\n optionsStyle.top = downTopOffset + 'px';\n }\n\n optionsStyle.left = pos.left + 'px';\n});\n</script>\n\n<template>\n <div\n ref=\"container\"\n tabindex=\"0\"\n :class=\"classes\"\n class=\"pl-line-dropdown uc-pointer\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n @click=\"toggleList\"\n >\n <div class=\"pl-line-dropdown__prefix\">{{ props?.prefix }}</div>\n\n <ResizableInput v-model=\"inputModel\" :placeholder=\"placeholderVal\" :disabled=\"props.disabled\" class=\"pl-line-dropdown__input\" />\n\n <div class=\"pl-line-dropdown__icon-wrapper\">\n <div v-show=\"!canShowClearBtn\" class=\"pl-line-dropdown__icon\" />\n <div v-show=\"canShowClearBtn\" class=\"pl-line-dropdown__icon-clear\" @click=\"clearModel\" />\n </div>\n <Teleport v-if=\"data.isOpen\" to=\"body\">\n <div\n v-if=\"props.mode === 'list'\"\n ref=\"list\"\n :style=\"optionsStyle\"\n tabindex=\"-1\"\n class=\"pl-line-dropdown__items\"\n @focusout=\"onFocusOut\"\n @click.stop\n >\n <template v-for=\"(item, index) in options\" :key=\"index\">\n <slot\n name=\"item\"\n :item=\"item\"\n :text-item=\"'text'\"\n :is-selected=\"isItemSelected(item)\"\n :is-hovered=\"data.activeOption == index\"\n @click.stop=\"selectItem(item)\"\n >\n <DropdownListItem\n :option=\"item\"\n :text-item=\"'text'\"\n :is-selected=\"isItemSelected(item)\"\n :is-hovered=\"data.activeOption == index\"\n size=\"medium\"\n @click.stop=\"selectItem(item)\"\n />\n </slot>\n </template>\n\n <div v-if=\"options.length === 0\" class=\"pl-line-dropdown__no-item\">\n <div class=\"pl-line-dropdown__no-item-title text-s\">Didn't find anything that matched</div>\n </div>\n </div>\n <div\n v-else-if=\"props.mode === 'tabs'\"\n ref=\"list\"\n :style=\"optionsStyle\"\n tabindex=\"-1\"\n class=\"pl-line-dropdown__items-tabs\"\n @focusout=\"onFocusOut\"\n @click.stop\n >\n <template v-for=\"(item, index) in options\" :key=\"index\">\n <slot name=\"item\" :item=\"item\" :is-selected=\"isItemSelected(item)\" :is-hovered=\"data.activeOption == index\" @click.stop=\"selectItem(item)\">\n <TabItem :option=\"item\" :is-selected=\"isItemSelected(item)\" :is-hovered=\"data.activeOption == index\" @click.stop=\"selectItem(item)\" />\n </slot>\n </template>\n <div v-if=\"options.length === 0\" class=\"pl-line-dropdown__no-item\">\n <div class=\"pl-line-dropdown__no-item-title text-s\">Didn't find anything that matched</div>\n </div>\n </div>\n </Teleport>\n </div>\n</template>\n"],"names":["emit","__emit","props","__props","data","reactive","container","ref","list","classes","computed","classesResult","searchPhrase","options","useFilteredList","toRef","canShowClearBtn","modelText","index","getIndexForModelInItems","normalizeListOptions","inputModel","watch","v","placeholderVal","useClickOutside","val","value","_a","nextTick","scrollIntoActive","updateSelected","o","deepEqual","tap","resetSearchPhrase","toggleList","closePopupIfNeeded","selectItem","item","isItemSelected","onFocusOut","event","relatedTarget","_b","handleKeydown","activeOption","length","d","$list","tapIf","el","scrollIntoView","clearModel","optionsStyle","rect","useElementPosition","pos","downTopOffset","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_1","_toDisplayString","_createVNode","ResizableInput","$event","_hoisted_2","_withDirectives","_hoisted_3","_createBlock","_Teleport","_openBlock","_Fragment","_renderList","_unref","_renderSlot","_ctx","_withModifiers","DropdownListItem","_hoisted_4","_cache","TabItem","_hoisted_5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,UAAMA,IAAOC,GAEPC,IAAQC,GAoBRC,IAAOC,EAAS;AAAA,MACpB,QAAQ;AAAA,MACR,cAAc;AAAA,MACd,eAAe;AAAA,IAAA,CAChB,GAEKC,IAAYC,EAAA,GAEZC,IAAOD,EAAA,GAEPE,IAAUC,EAAS,MAAM;AAC7B,YAAMC,IAAgB,CAAA;AACtB,aAAIP,EAAK,UACPO,EAAc,KAAK,MAAM,GAEvBT,EAAM,YACRS,EAAc,KAAK,UAAU,GAExBA,EAAc,KAAK,GAAG;AAAA,IAC/B,CAAC,GAEKC,IAAeL,EAAY,EAAE,GAE7BM,IAAUC,GAAgBC,EAAMb,GAAO,SAAS,GAAGU,CAAY,GAE/DI,IAAkBN,EAAkB,MAAM,CAAC,EAAER,EAAM,aAAaE,EAAK,UAAUF,EAAM,cAAce,EAAU,MAAM,GAEnHA,IAAYP,EAAiB,MAAM;AACvC,UAAIR,EAAM,eAAe,QAAW;AAClC,cAAMgB,IAAQC,EAAA;AACd,YAAID,MAAU;AAEZ,iBADaE,GAAqBlB,EAAM,OAAO,EAAEgB,CAAK,EAC1C;AAAA,MAEhB;AACA,aAAO;AAAA,IACT,CAAC,GAEKG,IAAad,EAAIU,EAAU,KAAK;AAEtC,IAAAK,EAAML,GAAW,CAACM,MAAM;AACtB,MAAAF,EAAW,QAAQE;AAAA,IACrB,CAAC;AAED,UAAMC,IAAiBd,EAAS,MAC1BN,EAAK,UACHQ,EAAa,SAASA,EAAa,MAAM,UAAUK,EAAU,MAAM,SAAS,IACvEL,EAAa,QAIjBK,EAAU,SAAS,KAC3B;AAED,IAAAQ,GAAgBnB,GAAW,MAAM;AAC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AA,UACV,2BAAD,MAAA;AAAA,UAAA,GAAW,CAAA,MAAA,CAAA;AAAA,QAAA;WAEX+B,EAAA,EAAA,GAAAb,EAIWc,GAAA,MAAAC,EAJuBC,EAAA9D,CAAA,GAAO,CAAvB0B,GAAMrB,MACtB0D,EAEOC,EAAA,QAAA,QAAA;AAAA,iBAHwC3D;AAAA,YAC5B,MAAAqB;AAAA,YAAa,YAAaC,EAAeD,CAAI;AAAA,YAAI,WAAYnC,EAAK,gBAAgBc;AAAA,YAAQ,SAAK4D,EAAA,CAAAZ,MAAO5B,EAAWC,CAAI,GAAA,CAAA,MAAA,CAAA;AAAA,UAAA,GAAxI,MAEO;AAAA,YADLyB,EAAsIkB,IAAA;AAAA,cAA5H,QAAQ3C;AAAA,cAAO,eAAaC,EAAeD,CAAI;AAAA,cAAI,cAAYnC,EAAK,gBAAgBc;AAAA,cAAQ,SAAK4D,EAAA,CAAAZ,MAAO5B,EAAWC,CAAI,GAAA,CAAA,MAAA,CAAA;AAAA,YAAA;;UAG1HoC,EAAA9D,CAAA,EAAQ,WAAM,KAAzB2D,KAAAb,EAEM,OAFNwB,IAEM,CAAA,GAAAF,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA;AAAA,YADJpB,EAA2F,OAAA,EAAtF,OAAM,yCAAA,GAAyC,qCAAiC,EAAA;AAAA,UAAA;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".resizable-input{position:relative;box-sizing:border-box;padding:0 8px;display:inline-block;max-width:100%;text-overflow:ellipsis;overflow:hidden}.resizable-input__size-span{font-family:inherit;white-space:pre;display:inline-block;font-size:inherit;line-height:inherit;box-sizing:border-box;position:relative;left:0;opacity:0;min-width:2px;-webkit-user-select:none;user-select:none;vertical-align:top}.resizable-input input{border:none;outline:none;height:100%;text-overflow:ellipsis;font-family:inherit;background:none;color:inherit;top:0;left:0;right:0;font-size:inherit;line-height:inherit;position:absolute;box-sizing:border-box}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
|
|
2
|
-
import { defineComponent as p, computed as
|
|
2
|
+
import { defineComponent as p, computed as o, createElementBlock as u, openBlock as c, createElementVNode as d, normalizeStyle as m, toDisplayString as h, mergeProps as _ } from "vue";
|
|
3
3
|
|
|
4
|
-
const f = { class: "resizable-input" }, b = ["placeholder", "value", "disabled"],
|
|
4
|
+
const f = { class: "resizable-input" }, b = ["placeholder", "value", "disabled"], V = /* @__PURE__ */ p({
|
|
5
5
|
__name: "ResizableInput",
|
|
6
6
|
props: {
|
|
7
7
|
modelValue: {},
|
|
@@ -11,33 +11,33 @@ const f = { class: "resizable-input" }, b = ["placeholder", "value", "disabled"]
|
|
|
11
11
|
width: {}
|
|
12
12
|
},
|
|
13
13
|
emits: ["update:modelValue"],
|
|
14
|
-
setup(
|
|
15
|
-
const t =
|
|
14
|
+
setup(l, { emit: n }) {
|
|
15
|
+
const t = l, s = n, i = o(() => {
|
|
16
16
|
var e;
|
|
17
17
|
return t.placeholder ? t.placeholder : (e = t.modelValue) == null ? void 0 : e.replace('"', "");
|
|
18
|
-
}),
|
|
18
|
+
}), a = o(() => {
|
|
19
19
|
const e = {};
|
|
20
20
|
return t.width && (e.width = t.width), t.maxWidth && (e.maxWidth = t.maxWidth), e;
|
|
21
21
|
});
|
|
22
22
|
function r(e) {
|
|
23
|
-
|
|
23
|
+
s("update:modelValue", e.target.value);
|
|
24
24
|
}
|
|
25
25
|
return (e, v) => (c(), u("div", f, [
|
|
26
|
-
|
|
27
|
-
style: m(
|
|
26
|
+
d("span", {
|
|
27
|
+
style: m(a.value),
|
|
28
28
|
class: "resizable-input__size-span"
|
|
29
29
|
}, h(i.value), 5),
|
|
30
|
-
|
|
31
|
-
placeholder:
|
|
30
|
+
d("input", _(e.$attrs, {
|
|
31
|
+
placeholder: l.placeholder,
|
|
32
32
|
value: t.modelValue,
|
|
33
33
|
disabled: t.disabled,
|
|
34
|
-
style:
|
|
34
|
+
style: a.value,
|
|
35
35
|
onInput: r
|
|
36
36
|
}), null, 16, b)
|
|
37
37
|
]));
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
V as default
|
|
42
42
|
};
|
|
43
43
|
//# sourceMappingURL=ResizableInput.vue.js.map
|