bitboss-ui 0.1.80 → 0.1.82
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/dist/components/BaseButton/BaseButton.vue.d.ts +5 -2
- package/dist/components/BaseCheckbox/BaseCheckbox.vue.d.ts +3 -0
- package/dist/components/BaseCheckboxGroup/BaseCheckboxGroup.vue.d.ts +10 -2
- package/dist/components/BaseDatePicker/BaseDatePicker.vue.d.ts +3 -0
- package/dist/components/BaseDatePickerInput/BaseDatePickerInput.vue.d.ts +3 -0
- package/dist/components/BaseDialog/BaseDialog.vue.d.ts +3 -0
- package/dist/components/BaseInputContainer/BaseInputContainer.vue.d.ts +3 -0
- package/dist/components/BaseNumberInput/BaseNumberInput.vue.d.ts +4 -1
- package/dist/components/BaseRadioGroup/BaseRadioGroup.vue.d.ts +4 -1
- package/dist/components/BaseRating/BaseRating.vue.d.ts +4 -1
- package/dist/components/BaseSelect/BaseSelect.vue.d.ts +16 -2
- package/dist/components/BaseSlider/BaseSlider.vue.d.ts +3 -0
- package/dist/components/BaseSwitch/BaseSwitch.vue.d.ts +3 -0
- package/dist/components/BaseSwitchGroup/BaseSwitchGroup.vue.d.ts +3 -0
- package/dist/components/BaseTag/BaseTag.vue.d.ts +4 -1
- package/dist/components/BaseTextInput/BaseTextInput.vue.d.ts +4 -1
- package/dist/components/BaseTextarea/BaseTextarea.vue.d.ts +2 -2
- package/dist/components/BbAccordion/BbAccordion.vue.d.ts +5 -2
- package/dist/components/BbAlert/BbAlert.vue.d.ts +3 -0
- package/dist/components/BbAvatar/BbAvatar.vue.d.ts +7 -58
- package/dist/components/BbBadge/BbBadge.vue.d.ts +4 -1
- package/dist/components/BbBreadcrumbs/BbBreadcrumbs.vue.d.ts +3 -0
- package/dist/components/BbCheckbox/BbCheckbox.vue.d.ts +3 -0
- package/dist/components/BbCheckboxGroup/BbCheckboxGroup.vue.d.ts +3 -0
- package/dist/components/BbChip/BbChip.vue.d.ts +7 -1
- package/dist/components/BbCollapsible/BbCollapsible.vue.d.ts +4 -1
- package/dist/components/BbDatePickerInput/BbDatePickerInput.vue.d.ts +3 -0
- package/dist/components/BbDialog/BbDialog.vue.d.ts +3 -0
- package/dist/components/BbDropdown/BbDropdown.vue.d.ts +15 -3
- package/dist/components/BbDropdownButton/BbDropdownButton.vue.d.ts +4 -1
- package/dist/components/BbDropzone/BbDropzone.vue.d.ts +6 -7
- package/dist/components/BbIcon/BbIcon.vue.d.ts +3 -0
- package/dist/components/BbIntersection/BbIntersection.vue.d.ts +4 -1
- package/dist/components/BbNumberInput/BbNumberInput.vue.d.ts +3 -0
- package/dist/components/BbOffCanvas/BbOffCanvas.vue.d.ts +3 -0
- package/dist/components/BbPagination/BbPagination.vue.d.ts +4 -1
- package/dist/components/BbPopover/BbPopover.vue.d.ts +14 -7
- package/dist/components/BbProgress/BbProgress.vue.d.ts +3 -0
- package/dist/components/BbRadio/BbRadio.vue.d.ts +3 -0
- package/dist/components/BbRadioGroup/BbRadioGroup.vue.d.ts +1 -6
- package/dist/components/BbRating/BbRating.vue.d.ts +3 -0
- package/dist/components/BbRatio/BbRatio.vue.d.ts +4 -1
- package/dist/components/BbSelect/BbSelect.vue.d.ts +14 -3
- package/dist/components/BbSmoothHeight/BbSmoothHeight.vue.d.ts +5 -2
- package/dist/components/BbSpinner/BbSpinner.vue.d.ts +3 -0
- package/dist/components/BbSwitch/BbSwitch.vue.d.ts +3 -0
- package/dist/components/BbTab/BbTab.vue.d.ts +4 -1
- package/dist/components/BbTable/BbTable.vue.d.ts +258 -295
- package/dist/components/BbTable/types.d.ts +214 -0
- package/dist/components/BbTag/BbTag.vue.d.ts +3 -0
- package/dist/components/BbToast/BbToast.vue.d.ts +3 -0
- package/dist/components/BbToast/BbToastMessage.vue.d.ts +3 -0
- package/dist/components/BbTooltip/BbTooltip.vue.d.ts +8 -7
- package/dist/components/BbTree/BbTree.vue.d.ts +9 -1
- package/dist/composables/useItemText.d.ts +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index10.js +2 -2
- package/dist/index10.js.map +1 -1
- package/dist/index100.js +2 -2
- package/dist/index102.js +4 -3
- package/dist/index102.js.map +1 -1
- package/dist/index106.js +1 -1
- package/dist/index108.js +85 -57
- package/dist/index108.js.map +1 -1
- package/dist/index110.js +77 -55
- package/dist/index110.js.map +1 -1
- package/dist/index112.js +5 -5
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +1 -1
- package/dist/index113.js.map +1 -1
- package/dist/index114.js +1 -1
- package/dist/index115.js +1 -1
- package/dist/index115.js.map +1 -1
- package/dist/index116.js +1 -1
- package/dist/index118.js +1 -1
- package/dist/index12.js +8 -8
- package/dist/index120.js +1 -1
- package/dist/index121.js +11 -11
- package/dist/index121.js.map +1 -1
- package/dist/index14.js +9 -9
- package/dist/index16.js +3 -3
- package/dist/index18.js +2 -2
- package/dist/index189.js +2 -2
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +2 -4
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +2 -2
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +3 -2
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +3 -2
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +4 -3
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +3 -35
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +35 -6
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +6 -350
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +5 -134
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +16 -5
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +1 -1
- package/dist/index20.js.map +1 -1
- package/dist/index200.js +15 -18
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +19 -2
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +18 -184
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +29 -23
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +8 -331
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +2 -2
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +351 -2
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +131 -13
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +2 -16
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +184 -18
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +23 -29
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +369 -8
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +2 -3
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +2 -3
- package/dist/index213.js.map +1 -1
- package/dist/index216.js +73 -53
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +3 -3
- package/dist/index22.js +2 -2
- package/dist/index221.js +223 -10
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +252 -429
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +10 -8
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +428 -82
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +9 -8
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +88 -5
- package/dist/index226.js.map +1 -1
- package/dist/index235.js +2 -69
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +2 -162
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +2 -2
- package/dist/index238.js +2 -2
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +9 -2
- package/dist/index239.js.map +1 -1
- package/dist/index24.js +1 -1
- package/dist/index24.js.map +1 -1
- package/dist/index240.js +6 -2
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +162 -2
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +2 -2
- package/dist/index243.js +2 -224
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +68 -257
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +2 -38
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +38 -2
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +2 -2
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +2 -2
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +2 -2
- package/dist/index250.js +2 -2
- package/dist/index251.js +2 -2
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +5 -0
- package/dist/index252.js.map +1 -0
- package/dist/index26.js +3 -3
- package/dist/index26.js.map +1 -1
- package/dist/index28.js +172 -155
- package/dist/index28.js.map +1 -1
- package/dist/index30.js +2 -2
- package/dist/index32.js +2 -2
- package/dist/index34.js +2 -2
- package/dist/index34.js.map +1 -1
- package/dist/index36.js +21 -19
- package/dist/index36.js.map +1 -1
- package/dist/index38.js.map +1 -1
- package/dist/index44.js +1 -1
- package/dist/index44.js.map +1 -1
- package/dist/index46.js +1 -1
- package/dist/index46.js.map +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index62.js +168 -137
- package/dist/index62.js.map +1 -1
- package/dist/index64.js +38 -30
- package/dist/index64.js.map +1 -1
- package/dist/index66.js.map +1 -1
- package/dist/index69.js +1 -1
- package/dist/index72.js +1 -1
- package/dist/index74.js.map +1 -1
- package/dist/index76.js +96 -66
- package/dist/index76.js.map +1 -1
- package/dist/index78.js +1 -1
- package/dist/index8.js +2 -2
- package/dist/index82.js +2 -2
- package/dist/index82.js.map +1 -1
- package/dist/index84.js.map +1 -1
- package/dist/index88.js +7 -4
- package/dist/index88.js.map +1 -1
- package/dist/index96.js +2 -2
- package/dist/index96.js.map +1 -1
- package/dist/index98.js +35 -30
- package/dist/index98.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/CommonProps.d.ts +15 -8
- package/package.json +1 -1
package/dist/index28.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index28.js","sources":["../src/components/BaseSelect/BaseSelect.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createCommentVNode as _createCommentVNode, withModifiers as _withModifiers, createBlock as _createBlock, vModelDynamic as _vModelDynamic, createElementVNode as _createElementVNode, withDirectives as _withDirectives, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, Teleport as _Teleport, createVNode as _createVNode, mergeProps as _mergeProps } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-select__input-container\" }\nconst _hoisted_2 = [\"autofocus\", \"disabled\", \"id\", \"placeholder\", \"readonly\", \"onBlur\", \"onFocus\", \"onChange\", \"onInput\", \"onKeydown\"]\nconst _hoisted_3 = {\n key: 0,\n class: \"bb-base-select__loading-container\"\n}\nconst _hoisted_4 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\nconst _hoisted_5 = [\"aria-selected\", \"id\", \"onClick\"]\nconst _hoisted_6 = { class: \"bb-base-select-option__content\" }\nconst _hoisted_7 = { class: \"bb-base-select-option__text\" }\nconst _hoisted_8 = { class: \"bb-base-select__chevron\" }\nconst _hoisted_9 = /*#__PURE__*/_createElementVNode(\"svg\", {\n viewBox: \"0 0 16 8\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", {\n \"fill-rule\": \"evenodd\",\n \"clip-rule\": \"evenodd\",\n d: \"M0.851779 0.225802C0.90403 0.173418 0.966103 0.131858 1.03444 0.1035C1.10278 0.0751431 1.17604 0.0605469 1.25003 0.0605469C1.32402 0.0605469 1.39728 0.0751431 1.46562 0.1035C1.53396 0.131858 1.59603 0.173418 1.64828 0.225802L8.00003 6.57868L14.3518 0.225802C14.4041 0.173503 14.4662 0.132017 14.5345 0.103713C14.6028 0.0754093 14.6761 0.0608414 14.75 0.0608414C14.824 0.0608414 14.8972 0.0754093 14.9656 0.103713C15.0339 0.132017 15.096 0.173503 15.1483 0.225802C15.2006 0.278101 15.2421 0.340189 15.2704 0.408521C15.2987 0.476852 15.3132 0.55009 15.3132 0.624052C15.3132 0.698014 15.2987 0.771252 15.2704 0.839584C15.2421 0.907916 15.2006 0.970003 15.1483 1.0223L8.39828 7.7723C8.34603 7.82469 8.28395 7.86625 8.21562 7.8946C8.14728 7.92296 8.07402 7.93756 8.00003 7.93756C7.92604 7.93756 7.85278 7.92296 7.78444 7.8946C7.7161 7.86625 7.65403 7.82469 7.60178 7.7723L0.851779 1.0223C0.799395 0.970051 0.757835 0.907978 0.729477 0.83964C0.70112 0.771302 0.686523 0.69804 0.686523 0.624052C0.686523 0.550064 0.70112 0.476803 0.729477 0.408464C0.757835 0.340126 0.799395 0.278053 0.851779 0.225802Z\",\n fill: \"currentColor\"\n })\n], -1)\n\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from \"@floating-ui/dom\";\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n} from \"vue\";\nimport { deepEqual } from \"fast-equals\";\nimport { head } from \"@/utilities/functions/head\";\nimport { isNotNil } from \"@/utilities/functions/isNotNil\";\nimport { last } from \"@/utilities/functions/last\";\nimport { useItemText } from \"@/composables/useItemText\";\nimport { useItemValue } from \"@/composables/useItemValue\";\nimport { wait } from \"@/utilities/functions/wait\";\nimport { waitFor } from \"@/utilities/functions/waitFor\";\nimport { when } from \"@/utilities/functions/when\";\nimport BbChip from \"../BbChip/BbChip.vue\";\nimport BbSpinner from \"../BbSpinner/BbSpinner.vue\";\nimport type {\n CommonProps,\n OptionItemsWithQuery,\n GenericModelValue,\n} from \"@/types/CommonProps\";\nimport type { ComputedRef } from \"vue\";\n\nexport type BaseSelectProps = Pick<\n CommonProps,\n | \"allowWriting\"\n | \"autofocus\"\n | \"dependencies\"\n | \"depsDebounceTime\"\n | \"disabled\"\n | \"enforceCoherence\"\n | \"hasErrors\"\n | \"id\"\n | \"itemText\"\n | \"itemValue\"\n | \"loadingText\"\n | \"id\"\n | \"itemText\"\n | \"itemValue\"\n | \"loadingText\"\n | \"modelValueDebounceTime\"\n | \"multiple\"\n | \"name\"\n | \"noDataText\"\n | \"placeholder\"\n | \"readonly\"\n | \"transitionDuration\"\n> &\n OptionItemsWithQuery &\n GenericModelValue & {\n /**\n * Allows the user to add options to the list by\n * inserting text in the input and pressing ENTER.\n * The value and text of the option generated is a\n * string equal to what has been inserted.\n */\n addOptions?: boolean;\n /**\n * Sets the display model for selected values to a list\n * of comma separated string. In this mode the user\n * cannot deselect an option by pressing the close button.\n */\n comma?: boolean;\n /**\n * Defines how the filtering should work.\n * In any case options are always filtered by the text displayed but\n * they can also take into account other properties of the\n * passed elements when this property is a string or an array of string.\n * E.g. items could be a list of users and you can filter users by email or phone by passing `['email', 'phone']`\n * You can also pass false to not filter anything or a function for more granular control.\n *\n */\n filterBy?:\n | string\n | string[]\n | false\n | ((value: any, item: any) => boolean)\n | null;\n /**\n * Defines the prefill strategy for the input. By default the input will prefill\n * on focus. It can also always prefill with `true` and only prefill on search with `false`.\n */\n prefill?: boolean | \"focus\";\n /**\n * Time to wait when the users stops writing in the input before querying data.\n * Especially useful when searching live data on big datasets.\n */\n queryDebounceTime?: number;\n /**\n * If `true` when in multiple selection, reset the query immediately\n * upon selecting an option. By default the query is\n * not reset until focus is lost so the user can search\n * for \"Cath\" and select \"Cathy\" and then write more to\n * search for \"Catherine\"\n */\n resetQueryOnOptionSelected?: boolean;\n /**\n * Adds a stash to accumulate selected values. Especially\n * useful when searching in a big database of items.\n * E.g. if you search for \"John\" and then search for \"Richard\"\n * you either always return the previous items or you stash them passing `true` to this option.\n */\n stash?: boolean;\n /**\n * Pass `true` if the dropdown is not updating following movement in the UI, like in modals. Very expensive so use with care.\n */\n updateOnAnimationFrame?: boolean;\n } & Pick<CommonProps, \"matchStrategy\">;\n\ntype BaseOption = {\n id: string;\n jsonValue: string;\n manual: boolean;\n original: any;\n text: string;\n value: any;\n disabled: boolean;\n};\n\ntype Option = BaseOption & {\n index: number;\n selected: boolean;\n};\n\ntype FilteredOption = Option & {\n focused: boolean;\n};\n\nexport type BaseSelectEvents = {\n (e: \"blur\", event: FocusEvent): void;\n (e: \"change\", event: Event): void;\n (e: \"click\", event: MouseEvent): void;\n (e: \"focus\", event: FocusEvent): void;\n (e: \"inactive\"): void;\n (e: \"input\", event: Event): void;\n (e: \"update:modelValue\", value: any): void;\n};\n\nexport type BaseSelectSlots = {\n \"prepend-outer\"?: (props: {}) => any;\n prepend?: (props: {}) => any;\n \"options:prepend\"?: (props: {}) => any;\n loading?: (props: { query: string }) => any;\n \"no-data\"?: (props: { query: string }) => any;\n \"option:prepend\"?: (props: { item: any }) => any;\n option?: (props: {\n disabled: FilteredOption[\"disabled\"];\n focused: FilteredOption[\"focused\"];\n hasErrors?: boolean;\n index: FilteredOption[\"index\"];\n item: FilteredOption[\"original\"];\n loading: boolean;\n manual: FilteredOption[\"manual\"];\n selected: FilteredOption[\"selected\"];\n text: FilteredOption[\"text\"];\n value: FilteredOption[\"value\"];\n }) => any;\n \"option:append\"?: (props: { item: any }) => any;\n \"options:append\"?: (props: {}) => any;\n chevron?: (props: { loading: boolean; shown: boolean }) => any;\n append?: (props: {}) => any;\n spinner?: (props: { loading: boolean }) => any;\n \"append-outer\"?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSelect',\n props: {\n allowWriting: { type: Boolean, default: true },\n autofocus: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n disabled: { type: Boolean },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n itemText: {},\n itemValue: {},\n loadingText: { default: \"Caricamento...\" },\n modelValueDebounceTime: { default: 0 },\n multiple: { type: Boolean },\n name: {},\n noDataText: { default: \"Nessun elemento da visualizzare\" },\n placeholder: {},\n readonly: {},\n transitionDuration: { default: 200 },\n items: {},\n modelValue: {},\n addOptions: { type: Boolean },\n comma: { type: Boolean },\n filterBy: { type: [String, Array, Boolean, Function, null], default: () => [] },\n prefill: { type: [Boolean, String], default: \"focus\" },\n queryDebounceTime: { default: 500 },\n resetQueryOnOptionSelected: { type: Boolean },\n stash: { type: Boolean },\n updateOnAnimationFrame: { type: Boolean, default: false },\n matchStrategy: { default: \"string\" }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nif (props.multiple && !Array.isArray(props.modelValue)) {\n throw new Error('Multiple is set to \"true\" but modelValue is not an array.');\n}\n\nconst outerContainer = ref<HTMLElement | null>(null);\nconst innerContainer = ref<HTMLElement | null>(null);\nconst optionsContainer = ref<HTMLElement | null>(null);\nconst input = ref<HTMLElement | null>(null);\nconst query = ref<string>(\"\");\nconst computedPlaceholder = computed(() => {\n if (selectedOptions.value.length) return \"\";\n else return props.placeholder;\n});\n/**\n * Use a number accumulator because if the fn takes 5 seconds\n * and after 2 seconds another search is run\n * When the first returns the second is still out for 2 seconds\n * and we want to track them both.\n * Debounce will not be enough.\n */\nconst loading = ref(0);\nconst transitionDuration = props.transitionDuration / 1000 + \"s\";\nlet cleanUpPositioning: () => void;\n\nonMounted(async () => {\n if (innerContainer.value && optionsContainer.value) {\n cleanUpPositioning = autoUpdate(\n innerContainer.value,\n optionsContainer.value,\n displayOptions,\n {\n ancestorResize: true,\n ancestorScroll: true,\n animationFrame: props.updateOnAnimationFrame,\n elementResize: true,\n }\n );\n }\n});\nonBeforeUnmount(() => {\n cleanUpPositioning();\n});\n\nconst internalItems = ref<BaseOption[]>([]);\nconst stash = ref<BaseOption[]>([]);\nconst manualItems = ref<BaseOption[]>([]);\nconst { getItemText } = useItemText();\nconst { getItemValue } = useItemValue();\n\nconst internalOptions = computed<BaseOption[]>(() => {\n return internalItems.value.map((item: any, _) => {\n const text = getItemText(item, props.itemText);\n const value = getItemValue(item, props.itemValue);\n\n // Undefined is not JSONable\n if (value === undefined)\n throw new Error(\n 'The result of extracting \"value\" from option was undefined. Affected item is ' +\n JSON.stringify(item) +\n \" please check itemValue property is correct.\"\n );\n\n const jsonValue = JSON.stringify(value);\n return {\n disabled: !!item.disabled,\n id: \"option_\" + jsonValue.replace(/\\W/g, \"_\"),\n jsonValue,\n manual: false,\n original: item,\n text,\n value,\n };\n });\n});\n\nconst options = computed<Option[]>(() => {\n let fromOptions = internalOptions.value.reduce(\n (acc: { [key: string]: BaseOption }, curr: BaseOption) => {\n acc[curr.id] = curr;\n return acc;\n },\n {}\n );\n const withManual: { [key: string]: BaseOption } = manualItems.value.reduce(\n (acc, curr) => {\n if (!acc[curr.id]) acc[curr.id] = curr;\n return acc;\n },\n fromOptions\n );\n const withStash: { [key: string]: BaseOption } = stash.value.reduce(\n (acc, curr) => {\n if (!acc[curr.id]) acc[curr.id] = curr;\n return acc;\n },\n withManual\n );\n return Object.values(withStash).map<Option>((option: BaseOption, index) => {\n return {\n ...option,\n selected: isNotNil(modelValueIndexed.value.get(option.value)),\n index,\n };\n });\n});\n\n/**\n * Filter options to be displayed based on the current query.\n * If no query is used or when query is set from the inside (after a selection) display all possible options\n */\nconst filteredOptions = computed<FilteredOption[]>(() => {\n let base = [];\n /** Only filter when a value is being searched not when the query is fully set on a selected option text */\n if (\n query.value &&\n !selectedOptions.value.some((option: Option) => option.text === query.value)\n ) {\n base = options.value.filter((item: Option) => {\n let matchedAnything = false;\n if (!props.filterBy) return true;\n else if (typeof props.filterBy === \"function\")\n matchedAnything = props.filterBy(item.value, item.original);\n else if (props.filterBy.length) {\n const keys = ([] as string[]).concat(props.filterBy);\n for (let index = 0; index < keys.length; index++) {\n const propName = keys[index];\n matchedAnything =\n matchedAnything ||\n (item.original[propName] &&\n item.original[propName]\n .toLowerCase()\n .includes(query.value.toLowerCase()));\n }\n }\n return (\n matchedAnything ||\n item.text.toLowerCase().includes(query.value.toLowerCase())\n );\n });\n /** Otherwise defaul;t to the whole set of options */\n } else base = options.value;\n /** This is done here so that only visible options are highlighted */\n return base.map((option: Option, index) => ({\n ...option,\n focused: normalizedFocusedIndex.value === index,\n }));\n});\n\n/**\n * Indexes options by id for retrieval\n */\n\nconst optionsIndexedById = computed<{\n [key: string]: Option;\n}>(() =>\n options.value.reduce(\n (acc, curr) => ({\n ...acc,\n [curr.id]: curr,\n }),\n {}\n )\n);\n\n/**\n * Indexes options by their value\n * (using JSON to circumvent identical objects not being equal in JS)\n */\nconst optionsIndexedByValue = computed(() => {\n if (props.matchStrategy === \"string\") {\n let indexed = options.value.reduce(\n (acc: { [key: string]: Option }, curr: Option) => {\n acc[curr.jsonValue] = curr;\n return acc;\n },\n {}\n );\n return {\n get: (key: any) => {\n return indexed[JSON.stringify(key)];\n },\n };\n } else if (props.matchStrategy === \"equality\") {\n let indexed: [any, Option][] = options.value.map((option) => [\n option.value,\n option,\n ]);\n\n return {\n get: (key: any) => {\n return indexed.find((pairs) => deepEqual(pairs[0], key))?.[1];\n },\n };\n } else {\n throw new Error(\"No match strategy has been defined\");\n }\n});\n\n/**\n * Indexes modelValue to a map so when can easily know which values are selected\n * (using JSON to circumvent identical object not being equal in JS)\n */\nconst modelValueIndexed = computed(() => {\n if (props.matchStrategy === \"string\") {\n let map: { [key: string]: number } = {};\n []\n .concat(props.modelValue)\n .filter(isNotNil)\n .forEach((value: any, index: number) => {\n map[JSON.stringify(value)] = index;\n });\n return {\n get: (value: any) => map[JSON.stringify(value)],\n };\n } else if (props.matchStrategy === \"equality\") {\n const map = []\n .concat(props.modelValue)\n .filter(isNotNil)\n .map((value, index) => [value, index]);\n\n return {\n get: (key: any) => {\n return map.find((pairs) => deepEqual(pairs[0], key))?.[1];\n },\n };\n } else {\n throw new Error(\"No match strategy has been defined\");\n }\n});\n\n/**\n * For every item in modelValue find the linked option if it exists.\n * This is used to display chips.\n */\nconst selectedOptions = computed(() => {\n return [].concat(props.modelValue).reduce((acc: Option[], curr: any) => {\n const linkedOption = optionsIndexedByValue.value.get(curr);\n if (linkedOption) acc.push(linkedOption);\n return acc;\n }, []);\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n let valueToEmit;\n focusedIndex.value = option.index;\n /**\n * For single selection:\n * If the option was already selected - restore the value to default, clean the stash, manual items, and query.\n * If the option was not selected - use its value, save the option in the stash and display it's text as query\n * The stash is used to remove the complexity of stashing items when searching for identifying information,\n * like searching an address would not return the option that was used to selected a previous address in another country.\n * Or when searching users by username would not return the previous ones.\n * We save it so the user hasn't to.\n */\n if (!props.multiple) {\n if (option.selected) {\n if (option.manual) {\n manualItems.value = manualItems.value.filter(\n (current: BaseOption) => current.id !== option.id\n );\n }\n valueToEmit = null;\n if (props.stash) {\n stash.value = [];\n }\n query.value = \"\";\n } else {\n valueToEmit = option.value;\n if (props.stash) {\n stash.value = [option];\n }\n query.value = option.text;\n }\n /**\n * For multiple selection\n * If the option was selected remove it from modelValue, if it is a mnaual iutem also remove it from there.\n * In the stash we can search for the id of the option.\n * If the option was not selected we can just add it to modelValue and the stash.\n */\n } else {\n if (option.selected) {\n if (option.manual) {\n manualItems.value = manualItems.value.filter(\n (current: BaseOption) => current.id !== option.id\n );\n }\n valueToEmit = props.modelValue.filter(\n (value: any) => JSON.stringify(value) !== option.jsonValue\n );\n if (props.stash) {\n stash.value = stash.value.filter((stashed) => stashed.id !== option.id);\n }\n } else {\n valueToEmit = props.modelValue.concat(option.value);\n if (props.stash) {\n stash.value = stash.value.concat(option);\n }\n }\n if (props.resetQueryOnOptionSelected) {\n query.value = \"\";\n }\n }\n emit(\"update:modelValue\", valueToEmit);\n};\n\nconst getOptions = async ({ prefill = false }) => {\n let items = [];\n if (Array.isArray(props.items)) {\n items = props.items;\n } else {\n if (typeof props.items === \"function\") {\n loading.value++;\n items = await props.items(query.value, prefill, props.modelValue);\n loading.value--;\n }\n }\n internalItems.value = items;\n};\n\n/**\n * Add an option to the manual items and then reset the query\n */\nconst addOption = () => {\n const text = query.value;\n const value = query.value;\n const jsonValue = JSON.stringify(value);\n const option = {\n text,\n value,\n jsonValue,\n id: \"option_\" + jsonValue.replace(/\\W/g, \"_\"),\n original: value,\n manual: true,\n disabled: false,\n };\n manualItems.value = manualItems.value.concat(option);\n query.value = \"\";\n};\n\n/**\n * It should prefill if asked, or\n * when single if modelValue is not null\n * when multiple if modelValue is not empty\n */\nconst shouldPrefill =\n props.prefill === true ||\n (!props.multiple && isNotNil(props.modelValue)) ||\n (props.multiple && !!props.modelValue.length);\n/**\n * When modelValue changes split behavior for single and multiple selection:\n */\nlet modelValueTimeout: ReturnType<typeof setTimeout>;\nlet hasRunOnce = false;\nwatch(\n () => props.modelValue,\n (current, previous) => {\n if (modelValueTimeout) clearTimeout(modelValueTimeout);\n modelValueTimeout = setTimeout(\n async () => {\n /**\n * For single selection if the value is already in the option (most likely you are using\n * static items) just use it.\n * If the value is not in the options try searching for it (outside dependencies may fix it).\n * If at last the value cannot be found even after searching\n * reset value to the default value when coherence is enforced\n * or at least do not display the old query\n */\n if (!props.multiple) {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (\n (!found && isNotNil(props.modelValue)) ||\n previous === undefined\n ) {\n const currentQuery = query.value;\n query.value = \"\";\n await getOptions({ prefill: true });\n query.value = currentQuery;\n }\n found = optionsIndexedByValue.value.get(props.modelValue);\n if (found) {\n query.value = found.text;\n if (props.stash) {\n stash.value = [found];\n }\n } else {\n if (props.enforceCoherence && isNotNil(current)) {\n query.value = \"\";\n if (props.stash) {\n stash.value = [];\n }\n emit(\"update:modelValue\", null);\n } else {\n query.value = \"\";\n }\n }\n /**\n * For multiple selection if every value is already in the options (most likely you are using\n * static items) just use them.\n * If not all the values are in the current options or is prefilling try searching (outside depencencies may fix the situation).\n * If the values are still not in the available options and coherence is enforced\n * discard the ones that are invalid.\n *\n */\n } else {\n if (!Array.isArray(props.modelValue)) {\n throw new Error(\"props.modelValue is not an array.\");\n }\n let allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n if (!allFound || previous === undefined) {\n await getOptions({ prefill: true });\n allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n }\n if (allFound) {\n if (props.stash) {\n stash.value = props.modelValue.map(\n (value: any) => optionsIndexedByValue.value.get(value)!\n );\n }\n } else {\n let coherentStash: Option[] = [];\n const coherent = current.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n if (found) coherentStash.push(found);\n return found;\n });\n if (props.stash) {\n stash.value = coherentStash;\n }\n if (props.enforceCoherence) {\n emit(\"update:modelValue\", coherent);\n }\n }\n }\n },\n shouldPrefill ? 0 : props.modelValueDebounceTime\n );\n },\n // Prefill when asked or when items are static\n { immediate: shouldPrefill, deep: true }\n);\n\n/**\n * This is triggered to refresh static items whenever the passed array changes.\n * If the parent defines an array in the template this is triggered\n * at every render so we take counter measures\n * Even if the entire array changes all the previously selected values are still in the stash.\n */\nwatch(\n () => props.items,\n async (current, previous) => {\n if (\n typeof current === \"function\" ||\n // Circumvent arrays defined in the template by the parent\n JSON.stringify(current) !== JSON.stringify(previous)\n ) {\n await getOptions({ prefill: false });\n if (props.multiple) {\n const allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n\n if (!allFound) {\n if (props.enforceCoherence) {\n const coherent = props.modelValue.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n return found;\n });\n emit(\"update:modelValue\", coherent);\n }\n }\n } else {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (!found && props.enforceCoherence && isNotNil(props.modelValue)) {\n emit(\"update:modelValue\", null);\n }\n focusedIndex.value = null;\n }\n }\n }\n);\n\n/**\n * When dependencies change\n * If the input has not been prefilled yet just return\n * Check dependencies are the same by value and not reference\n * Otherwise we search again for options as they might be different base on dependencies.\n * If coherence is enforced we set the state accordingly\n */\nlet depsTimeout: ReturnType<typeof setTimeout>;\nwatch(\n () => props.dependencies,\n (current, previous) => {\n if (!shouldPrefill && props.prefill === \"focus\" && isFirstFocus) {\n return;\n }\n // Circumvent array defined in the template by the parent\n if (JSON.stringify(current) === JSON.stringify(previous)) {\n return;\n }\n\n if (depsTimeout) clearTimeout(depsTimeout);\n depsTimeout = setTimeout(async () => {\n if (JSON.stringify(current) !== JSON.stringify(previous)) {\n // Only reset the stash if we are going to enforce coherence\n if (props.enforceCoherence) {\n if (props.stash) {\n stash.value = [];\n }\n }\n // Momentarily reset query\n let currentQuery = query.value;\n query.value = \"\";\n await getOptions({ prefill: true });\n query.value = currentQuery;\n if (!props.multiple) {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (!found && props.enforceCoherence && isNotNil(props.modelValue)) {\n query.value = \"\";\n if (props.stash) {\n stash.value = [];\n }\n emit(\"update:modelValue\", null);\n }\n } else {\n let allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n if (!allFound && props.enforceCoherence) {\n let coherentStash: Option[] = [];\n const coherent = props.modelValue.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n if (found) coherentStash.push(found);\n return found;\n });\n if (props.stash) {\n stash.value = coherentStash;\n }\n emit(\"update:modelValue\", coherent);\n }\n }\n }\n }, props.depsDebounceTime);\n },\n { deep: true }\n);\n\n/**\n * This is used to position the option container.\n * When the linked item (outerContainer) updates its position\n * this is rerun by floating-UI\n */\nconst displayOptions = () => {\n if (innerContainer.value && optionsContainer.value) {\n computePosition(innerContainer.value, optionsContainer.value, {\n placement: \"bottom\",\n middleware: [offset(6), flip(), shift()],\n }).then((data) => {\n if (optionsContainer.value) {\n optionsContainer.value.style.left = `${data.x}px`;\n optionsContainer.value.style.top = `${data.y}px`;\n optionsContainer.value.style.width = `${innerContainer.value?.offsetWidth}px`;\n }\n });\n }\n};\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel is opening\nconst showing = ref(false);\n// option panel is closing\nconst hiding = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst open = async () => {\n hidden.value = false;\n showing.value = true;\n await wait(props.transitionDuration);\n showing.value = false;\n shown.value = true;\n};\n\nconst close = async () => {\n shown.value = false;\n hiding.value = true;\n await wait(props.transitionDuration);\n hiding.value = false;\n hidden.value = true;\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we phisically move focus to the options so\n * we track it manually.\n */\nconst active = ref(false);\n\n/**\n * When the focus goes to the input we select the current text\n * so the user can replace or delete it.\n * On top of that if the prefill strategy is to prefill on first focus and options\n * weren't already retrieved by the watcher on mount, we do that\n */\nlet isFirstFocus = true;\nconst onInputFocus = async (event: FocusEvent) => {\n emit(\"focus\", event);\n active.value = true;\n document.addEventListener(\"click\", onClickOutside);\n document.addEventListener(\"focusin\", onFocusOutside)\n if (input.value instanceof HTMLInputElement) input.value.select();\n if (props.prefill === \"focus\" && isFirstFocus && !shouldPrefill) {\n await getOptions({ prefill: true });\n isFirstFocus = false;\n }\n};\n\nconst onFocusOutside = (event: FocusEvent) => {\n if (event.target instanceof Node) {\n if (outerContainer.value && optionsContainer.value) {\n if (!outerContainer.value.contains(event.target) && !optionsContainer.value.contains(event.target)) {\n close();\n emit(\"inactive\");\n document.removeEventListener(\"focusin\", onFocusOutside);\n active.value = false;\n if (props.multiple)\n wait(500).then(() => {\n query.value = \"\";\n });\n return;\n }\n }\n }\n};\n\n/**\n * On single selection restore the query that might be partially altered by the user.\n * Input can blur either by clicking outside or clicking on an option.\n * We do nothing if the user has selected an option. And we restore the\n * query to its text if the user has moved focus\n */\nconst onInputBlur = async (event: FocusEvent) => {\n emit(\"blur\", event);\n if (!props.multiple) {\n let noop = false;\n const currentModelValue = props.modelValue;\n await Promise.race([\n wait(250),\n waitFor(() => {\n return currentModelValue !== props.modelValue;\n }).then(() => {\n noop = true;\n }),\n ]);\n if (!noop) {\n const found = optionsIndexedByValue.value.get(props.modelValue);\n if (found) {\n query.value = found.text;\n }\n }\n }\n};\n\nconst onInputChange = (event: Event) => emit(\"change\", event);\n\n/**\n * Search at every input by the user.\n * When the user deletes the query unselect the current option\n */\nconst onInputInput = (event: Event) => {\n emit(\"input\", event);\n if (query.value === \"\") {\n if (!props.multiple) {\n emit(\"update:modelValue\", null);\n }\n }\n if (typeof props.items === \"function\") {\n searchByQuery();\n }\n};\n\n// This is the vertical index used to highlight options in the container\nconst focusedIndex = ref<number | null>(null);\n/**\n * Normalize the index using the displayed options so we can start over when reaching the end.\n * Please watch out for the side effect it is used to avoid the\n * complexity of using modulo over negative numbers\n */\nconst normalizedFocusedIndex: ComputedRef<number | null> = computed(() => {\n if (Number.isInteger(focusedIndex.value) && focusedIndex.value) {\n if (focusedIndex.value === -1) {\n focusedIndex.value = filteredOptions.value.length - 1;\n }\n return focusedIndex.value % filteredOptions.value.length;\n }\n return focusedIndex.value;\n});\n\n// This is the horizontal index used to highlight selected options\nconst selectedOptionsFocusedIndex = ref<number | null>(null);\n\n/**\n * Increment the focusIndex and wait for it to be normalized.\n * If the index corresponds to an option scroll it into view\n */\nconst focusOnNextOption = () => {\n if (focusedIndex.value !== null) focusedIndex.value++;\n else {\n focusedIndex.value = 0;\n }\n nextTick().then(() => {\n if (normalizedFocusedIndex.value !== null) {\n const foundOption = optionsContainer.value?.querySelector(\n `#${options.value[normalizedFocusedIndex.value].id}`\n );\n if (foundOption instanceof HTMLElement)\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n }\n });\n};\n\n/**\n * Decrement the focusIndex and wait for it to be normalized.\n * If the index corresponds to an option scroll it into view\n */\nconst focusOnPreviousOption = () => {\n if (focusedIndex.value !== null) focusedIndex.value--;\n else focusedIndex.value = options.value.length - 1;\n\n nextTick().then(() => {\n if (normalizedFocusedIndex.value !== null) {\n const foundOption = optionsContainer.value?.querySelector(\n `#${options.value[normalizedFocusedIndex.value].id}`\n );\n if (foundOption instanceof HTMLElement)\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n }\n });\n};\n\n/**\n * This is handled separately from input because it has a lot to do with user\n * interaction and control characters than it has with the query.\n */\nconst onInputKeyDown = async (event: KeyboardEvent) => {\n if (props.readonly || props.disabled) {\n event.preventDefault();\n return;\n }\n switch (event.key) {\n /**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\n case \"ArrowUp\":\n {\n event.preventDefault();\n if (loading.value) return;\n selectedOptionsFocusedIndex.value = null;\n if (shown.value) {\n focusOnPreviousOption();\n } else {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n await open();\n }\n }\n break;\n /**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\n case \"ArrowDown\":\n {\n event.preventDefault();\n if (loading.value) return;\n selectedOptionsFocusedIndex.value = null;\n if (shown.value) {\n focusOnNextOption();\n } else {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n await open();\n }\n }\n break;\n /**\n * When moving horizontally\n * Cycle from rightmost, next, or input focus.\n * If the focus lands on an option align the vertical focus as well\n */\n case \"ArrowLeft\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value =\n selectedOptions.value.length - 1;\n } else if (selectedOptionsFocusedIndex.value > 0) {\n selectedOptionsFocusedIndex.value--;\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n\n if (selectedOptionsFocusedIndex.value !== null) {\n let linkedOption =\n selectedOptions.value[selectedOptionsFocusedIndex.value];\n let foundOption = optionsContainer.value?.querySelector(\n `#${linkedOption.id}`\n );\n if (foundOption) {\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n\n focusedIndex.value =\n optionsIndexedById.value[\n selectedOptions.value[selectedOptionsFocusedIndex.value].id\n ].index;\n }\n }\n }\n }\n }\n break;\n /**\n * When moving horizontally\n * Cycle from leftmost, next, or input focus.\n * If the focus lands on an option align the vertical focus as well\n */\n case \"ArrowRight\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value = 0;\n } else if (\n selectedOptionsFocusedIndex.value <\n selectedOptions.value.length - 1\n ) {\n selectedOptionsFocusedIndex.value++;\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n\n if (selectedOptionsFocusedIndex.value !== null) {\n let linkedOption =\n selectedOptions.value[selectedOptionsFocusedIndex.value];\n let foundOption = optionsContainer.value?.querySelector(\n `#${linkedOption.id}`\n );\n if (foundOption) {\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n\n focusedIndex.value =\n optionsIndexedById.value[\n selectedOptions.value[selectedOptionsFocusedIndex.value].id\n ].index;\n }\n }\n }\n }\n }\n break;\n /**\n * If the panel is closed focus on the first selected option.\n * If the panel was already open select/deselect the currently focused option\n * and close the panel of single selection is enabled\n */\n case \"Enter\":\n {\n event.preventDefault();\n if (loading.value) return;\n if (!shown.value) {\n if (filteredOptions.value.length) {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n }\n await open();\n } else {\n if (normalizedFocusedIndex.value !== null) {\n if (filteredOptions.value[normalizedFocusedIndex.value].disabled)\n return;\n if (!props.multiple) {\n await close();\n }\n onOptionSelected(\n filteredOptions.value[normalizedFocusedIndex.value]\n );\n } else {\n if (props.addOptions) {\n if (props.itemText || props.itemValue) {\n console.error(\n `Adding an option for mapped items is not supported. You can't create an option while passing \"item-text\" or \"item-value\".`\n );\n return;\n }\n addOption();\n const added = last(manualItems.value);\n onOptionSelected(optionsIndexedById.value[added.id]);\n }\n }\n }\n }\n break;\n /**\n * When moving away from the component reset focus both vertically and horizontally\n */\n case \"Tab\":\n case \"Escape\":\n {\n if (shown.value) {\n await close();\n }\n emit(\"inactive\");\n selectedOptionsFocusedIndex.value = null;\n focusedIndex.value = null;\n }\n break;\n // Prevent shift from opening the panel\n case \"Shift\":\n {\n if (loading.value) return;\n }\n break;\n /**\n * Delete behavior is different when query is empty\n * If query is empty\n * If no chip is selected - select rightmost chip\n * If a chip is selected - deselect that option\n * If any option remains move focus to that or reset\n */\n case \"Backspace\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value =\n selectedOptions.value.length - 1;\n } else {\n onOptionSelected(\n selectedOptions.value[selectedOptionsFocusedIndex.value]\n );\n if (selectedOptions.value.length) {\n selectedOptionsFocusedIndex.value = Math.max(\n Math.min(\n selectedOptionsFocusedIndex.value,\n selectedOptions.value.length - 2\n ),\n 0\n );\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n }\n }\n }\n await open();\n }\n break;\n /**\n * Open the panel on writing and reset horizontal focus\n */\n default:\n {\n selectedOptionsFocusedIndex.value = null;\n focusedIndex.value = null;\n await open();\n }\n break;\n }\n};\n\n/**\n * Triggered on input when items is a function.\n */\n\nlet timeout: ReturnType<typeof setTimeout>;\nconst searchByQuery = () => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(async () => {\n try {\n await getOptions({ prefill: false });\n } catch (error) {\n console.error(error);\n }\n }, props.queryDebounceTime);\n};\n\n/**\n * When clicking on the outside container seamlessly move focus to the input and open the panel\n */\nconst onOuterContainerClick = (event: MouseEvent) => {\n emit(\"click\", event);\n if (props.disabled || props.readonly) return;\n if (input.value instanceof HTMLElement) {\n input.value.focus();\n }\n open();\n};\n\n/**\n * When an option is clicked wait for it to bubble to the option container to avoid slot event problems.\n * Select / deselect the option and then move focus to the input.\n * If it is single selection mode close the panel\n */\nconst onOptionClicked = (event: Event) => {\n if (event.currentTarget instanceof HTMLElement) {\n if (event.currentTarget.classList.contains(\"bb-base-select-option\")) {\n const option = optionsIndexedById.value[event.currentTarget.id];\n if (option.disabled) return;\n onOptionSelected(option);\n if (input.value instanceof HTMLInputElement) {\n input.value.focus();\n }\n if (!props.multiple) close();\n }\n }\n};\n\n/**\n * On click outside of the container close the panel, remove active state.\n * In multiple selection clear query after a timeout\n */\nconst onClickOutside = (event: Event) => {\n if (event.target instanceof Node) {\n if (outerContainer.value) {\n if (!outerContainer.value.contains(event.target)) {\n close();\n emit(\"inactive\");\n document.removeEventListener(\"click\", onClickOutside);\n active.value = false;\n if (props.multiple)\n wait(500).then(() => {\n query.value = \"\";\n });\n return;\n }\n }\n }\n};\n\n/**\n * When using this component for submission we add a bunch of hidden\n * inputs so the submitted inputs are on par with v-model\n */\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n (item: unknown) => typeof item !== \"string\",\n JSON.stringify\n);\n\nconst hiddenInputs = computed(() => {\n return [].concat(props.modelValue).map((current) => {\n const value = makeInputValue(current);\n return {\n disabled: props.disabled,\n name: props.name,\n type: \"hidden\",\n value: value,\n };\n });\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass({\n 'bb-base-select': true,\n 'bb-base-select--active': active.value,\n 'bb-base-select--loading': loading.value,\n 'bb-base-select--disabled': _ctx.disabled,\n 'bb-base-select--errors': _ctx.hasErrors,\n 'bb-base-select--readonly': _ctx.readonly,\n }),\n onClick: onOuterContainerClick,\n ref_key: \"outerContainer\",\n ref: outerContainer\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", {\n class: \"bb-base-select__inner-container\",\n ref_key: \"innerContainer\",\n ref: innerContainer\n }, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"span\", _hoisted_1, [\n (_ctx.multiple)\n ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [\n (_ctx.comma)\n ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(selectedOptions.value, (option, index) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass({\n 'bb-base-select__selected': true,\n 'bb-base-select__selected--comma': true,\n 'bb-base-select__selected--focused':\n index === selectedOptionsFocusedIndex.value,\n }),\n key: option.id\n }, _toDisplayString(option.text) + _toDisplayString(index < selectedOptions.value.length - 1 ? \",\" : \"\"), 3))\n }), 128))\n : (_openBlock(true), _createElementBlock(_Fragment, { key: 1 }, _renderList(selectedOptions.value, (option, index) => {\n return (_openBlock(), _createBlock(BbChip, {\n class: _normalizeClass({\n 'bb-base-select__selected': true,\n 'bb-base-select__selected--chip': true,\n 'bb-base-select__selected--focused':\n index === selectedOptionsFocusedIndex.value,\n }),\n clearable: true,\n key: option.id,\n text: option.text,\n \"onClick:clear\": _withModifiers(($event: any) => (onOptionSelected(option)), [\"stop\"])\n }, null, 8, [\"class\", \"text\", \"onClick:clear\"]))\n }), 128))\n ], 64))\n : _createCommentVNode(\"\", true),\n _withDirectives(_createElementVNode(\"input\", {\n autofocus: _ctx.autofocus,\n class: _normalizeClass('bb-base-select__text-input'),\n disabled: _ctx.disabled,\n id: _ctx.id,\n placeholder: computedPlaceholder.value,\n readonly: _ctx.readonly || !_ctx.allowWriting,\n type: 'text',\n onBlur: _withModifiers(onInputBlur, [\"stop\"]),\n onFocus: _withModifiers(onInputFocus, [\"stop\"]),\n onChange: _withModifiers(onInputChange, [\"stop\"]),\n onInput: _withModifiers(onInputInput, [\"stop\"]),\n onKeydown: _withModifiers(onInputKeyDown, [\"stop\"]),\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((query).value = $event)),\n ref_key: \"input\",\n ref: input\n }, null, 40, _hoisted_2), [\n [_vModelDynamic, query.value]\n ]),\n (_openBlock(), _createBlock(_Teleport, { to: \"body\" }, [\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n 'bb-base-select__options-container': true,\n 'bb-base-select__options-container--shown': shown.value,\n 'bb-base-select__options-container--showing': showing.value,\n 'bb-base-select__options-container--hiding': hiding.value,\n 'bb-base-select__options-container--hidden': hidden.value,\n }),\n role: 'listbox',\n style: _normalizeStyle({ transitionDuration: transitionDuration }),\n tabindex: -1,\n ref_key: \"optionsContainer\",\n ref: optionsContainer\n }, [\n _renderSlot(_ctx.$slots, \"options:prepend\"),\n (!filteredOptions.value.length && loading.value)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'loading', { query: query.value }, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!filteredOptions.value.length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_4, [\n _renderSlot(_ctx.$slots, 'no-data', { query: query.value }, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(filteredOptions.value, (option) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option.id\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"span\", {\n \"aria-selected\": option.selected,\n class: _normalizeClass({\n 'bb-base-select-option': true,\n 'bb-base-select-option--selected': option.selected,\n 'bb-base-select-option--focused': option.focused,\n 'bb-base-select-option--disabled': option.disabled,\n }),\n id: option.id,\n role: 'option',\n onClick: _withModifiers(onOptionClicked, [\"stop\"])\n }, [\n _renderSlot(_ctx.$slots, \"option\", {\n disabled: option.disabled,\n focused: option.focused,\n hasErrors: _ctx.hasErrors,\n index: option.index,\n item: option.original,\n loading: !!loading.value,\n manual: option.manual,\n selected: option.selected,\n text: option.text,\n value: option.value\n }, () => [\n _createElementVNode(\"span\", _hoisted_6, [\n _createElementVNode(\"span\", _hoisted_7, _toDisplayString(option.text), 1)\n ])\n ])\n ], 10, _hoisted_5),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"options:append\")\n ], 6)\n ]))\n ]),\n _createElementVNode(\"span\", _hoisted_8, [\n _renderSlot(_ctx.$slots, \"chevron\", {\n loading: !!loading.value,\n shown: shown.value\n }, () => [\n _hoisted_9\n ])\n ]),\n (!loading.value)\n ? _renderSlot(_ctx.$slots, \"append\", { key: 0 })\n : (_openBlock(), _createElementBlock(\"span\", {\n key: 1,\n class: _normalizeClass({\n 'bb-base-select__spinner': true,\n 'bb-base-select__spinner--loading': loading.value,\n })\n }, [\n _renderSlot(_ctx.$slots, 'spinner', {\n loading: !!loading.value\n }, () => [\n _createVNode(BbSpinner, { size: 'sm' })\n ])\n ], 2))\n ], 512),\n _renderSlot(_ctx.$slots, \"append-outer\"),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hiddenInputs.value, (input) => {\n return (_openBlock(), _createElementBlock(\"input\", _mergeProps({\n key: input.value\n }, input), null, 16))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_sfc_main","_defineComponent","__props","__emit","props","emit","outerContainer","ref","innerContainer","optionsContainer","input","query","computedPlaceholder","computed","selectedOptions","loading","transitionDuration","cleanUpPositioning","onMounted","autoUpdate","displayOptions","onBeforeUnmount","internalItems","stash","manualItems","getItemText","useItemText","getItemValue","useItemValue","internalOptions","item","_","text","value","jsonValue","options","fromOptions","acc","curr","withManual","withStash","option","index","isNotNil","modelValueIndexed","filteredOptions","base","matchedAnything","keys","propName","normalizedFocusedIndex","optionsIndexedById","optionsIndexedByValue","indexed","key","_a","pairs","deepEqual","map","linkedOption","onOptionSelected","valueToEmit","focusedIndex","current","stashed","getOptions","prefill","items","addOption","shouldPrefill","modelValueTimeout","watch","previous","allFound","coherentStash","coherent","found","currentQuery","depsTimeout","isFirstFocus","computePosition","offset","flip","shift","data","shown","showing","hiding","hidden","open","wait","close","active","onInputFocus","event","onClickOutside","onFocusOutside","onInputBlur","noop","currentModelValue","waitFor","onInputChange","onInputInput","searchByQuery","selectedOptionsFocusedIndex","focusOnNextOption","nextTick","foundOption","focusOnPreviousOption","onInputKeyDown","head","_b","added","last","timeout","error","onOuterContainerClick","onOptionClicked","makeInputValue","when","hiddenInputs","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_Fragment","_renderList","_toDisplayString","_createBlock","BbChip","_withModifiers","$event","_createCommentVNode","_withDirectives","_vModelDynamic","_Teleport","_normalizeStyle","_createTextVNode","_createVNode","BbSpinner","_mergeProps"],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAMA,KAAa,EAAE,OAAO,qCACtBC,KAAa,CAAC,aAAa,YAAY,MAAM,eAAe,YAAY,UAAU,WAAW,YAAY,WAAW,WAAW,GAC/HC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,KAAa,CAAC,iBAAiB,MAAM,SAAS,GAC9CC,KAAa,EAAE,OAAO,oCACtBC,KAAa,EAAE,OAAO,iCACtBC,KAAa,EAAE,OAAO,6BACtBC,uBAA8C,OAAO;AAAA,EACzD,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACT,GAAG;AAAA,oBACgC,QAAQ;AAAA,IACvC,aAAa;AAAA,IACb,aAAa;AAAA,IACb,GAAG;AAAA,IACH,MAAM;AAAA,EAAA,CACP;AACH,GAAG,EAAE,GAkLuBC,KAAiBC,gBAAAA,GAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,cAAc,EAAE,MAAM,SAAS,SAAS,GAAK;AAAA,IAC7C,WAAW,CAAC;AAAA,IACZ,cAAc,CAAC;AAAA,IACf,kBAAkB,EAAE,SAAS,EAAE;AAAA,IAC/B,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,kBAAkB,EAAE,MAAM,QAAQ;AAAA,IAClC,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC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GAAG;AAAA,OACN,CAAC;AAAA,EAEN;AAEA,CAAC;"}
|
1
|
+
{"version":3,"file":"index28.js","sources":["../src/components/BaseSelect/BaseSelect.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createCommentVNode as _createCommentVNode, createTextVNode as _createTextVNode, withModifiers as _withModifiers, withCtx as _withCtx, createBlock as _createBlock, vModelDynamic as _vModelDynamic, createElementVNode as _createElementVNode, withDirectives as _withDirectives, normalizeStyle as _normalizeStyle, Teleport as _Teleport, createVNode as _createVNode, mergeProps as _mergeProps } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-select__input-container\" }\nconst _hoisted_2 = [\"autofocus\", \"disabled\", \"id\", \"placeholder\", \"readonly\", \"onBlur\", \"onFocus\", \"onChange\", \"onInput\", \"onKeydown\"]\nconst _hoisted_3 = {\n key: 0,\n class: \"bb-base-select__loading-container\"\n}\nconst _hoisted_4 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\nconst _hoisted_5 = [\"aria-selected\", \"id\", \"onClick\"]\nconst _hoisted_6 = { class: \"bb-base-select-option__content\" }\nconst _hoisted_7 = { class: \"bb-base-select-option__text\" }\nconst _hoisted_8 = { class: \"bb-base-select__chevron\" }\nconst _hoisted_9 = /*#__PURE__*/_createElementVNode(\"svg\", {\n viewBox: \"0 0 16 8\",\n fill: \"none\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", {\n \"fill-rule\": \"evenodd\",\n \"clip-rule\": \"evenodd\",\n d: \"M0.851779 0.225802C0.90403 0.173418 0.966103 0.131858 1.03444 0.1035C1.10278 0.0751431 1.17604 0.0605469 1.25003 0.0605469C1.32402 0.0605469 1.39728 0.0751431 1.46562 0.1035C1.53396 0.131858 1.59603 0.173418 1.64828 0.225802L8.00003 6.57868L14.3518 0.225802C14.4041 0.173503 14.4662 0.132017 14.5345 0.103713C14.6028 0.0754093 14.6761 0.0608414 14.75 0.0608414C14.824 0.0608414 14.8972 0.0754093 14.9656 0.103713C15.0339 0.132017 15.096 0.173503 15.1483 0.225802C15.2006 0.278101 15.2421 0.340189 15.2704 0.408521C15.2987 0.476852 15.3132 0.55009 15.3132 0.624052C15.3132 0.698014 15.2987 0.771252 15.2704 0.839584C15.2421 0.907916 15.2006 0.970003 15.1483 1.0223L8.39828 7.7723C8.34603 7.82469 8.28395 7.86625 8.21562 7.8946C8.14728 7.92296 8.07402 7.93756 8.00003 7.93756C7.92604 7.93756 7.85278 7.92296 7.78444 7.8946C7.7161 7.86625 7.65403 7.82469 7.60178 7.7723L0.851779 1.0223C0.799395 0.970051 0.757835 0.907978 0.729477 0.83964C0.70112 0.771302 0.686523 0.69804 0.686523 0.624052C0.686523 0.550064 0.70112 0.476803 0.729477 0.408464C0.757835 0.340126 0.799395 0.278053 0.851779 0.225802Z\",\n fill: \"currentColor\"\n })\n], -1)\n\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n} from \"@floating-ui/dom\";\nimport {\n computed,\n nextTick,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n} from \"vue\";\nimport { deepEqual } from \"fast-equals\";\nimport { head } from \"@/utilities/functions/head\";\nimport { isNotNil } from \"@/utilities/functions/isNotNil\";\nimport { last } from \"@/utilities/functions/last\";\nimport { useItemText } from \"@/composables/useItemText\";\nimport { useItemValue } from \"@/composables/useItemValue\";\nimport { wait } from \"@/utilities/functions/wait\";\nimport { waitFor } from \"@/utilities/functions/waitFor\";\nimport { when } from \"@/utilities/functions/when\";\nimport BbChip from \"../BbChip/BbChip.vue\";\nimport BbSpinner from \"../BbSpinner/BbSpinner.vue\";\nimport type {\n CommonProps,\n OptionItemsWithQuery,\n GenericModelValue,\n} from \"@/types/CommonProps\";\nimport type { ComputedRef } from \"vue\";\n\nexport type BaseSelectProps = Pick<\n CommonProps,\n | \"allowWriting\"\n | \"autofocus\"\n | \"dependencies\"\n | \"depsDebounceTime\"\n | \"disabled\"\n | \"enforceCoherence\"\n | \"hasErrors\"\n | \"id\"\n | \"itemText\"\n | \"itemValue\"\n | \"loadingText\"\n | \"matchStrategy\"\n | \"modelValueDebounceTime\"\n | \"multiple\"\n | \"name\"\n | \"noDataText\"\n | \"placeholder\"\n | \"readonly\"\n | \"transitionDuration\"\n> &\n OptionItemsWithQuery &\n Required<GenericModelValue> & {\n /**\n * Allows the user to add options to the list by\n * inserting text in the input and pressing ENTER.\n * The value and text of the option generated is a\n * string equal to what has been inserted.\n */\n addOptions?: boolean;\n /**\n * Sets the display model for selected values to a list\n * of comma separated string. In this mode the user\n * cannot deselect an option by pressing the close button.\n */\n comma?: boolean;\n /**\n * Defines how the filtering should work.\n * In any case options are always filtered by the text displayed but\n * they can also take into account other properties of the\n * passed elements when this property is a string or an array of string.\n * E.g. items could be a list of users and you can filter users by email or phone by passing `['email', 'phone']`\n * You can also pass false to not filter anything or a function for more granular control.\n *\n */\n filterBy?:\n | string\n | string[]\n | false\n | ((value: any, item: any) => boolean)\n | null;\n /**\n * Defines the prefill strategy for the input. By default the input will prefill\n * on focus. It can also always prefill with `true` and only prefill on search with `false`.\n */\n prefill?: boolean | \"focus\";\n /**\n * Time to wait when the users stops writing in the input before querying data.\n * Especially useful when searching live data on big datasets.\n */\n queryDebounceTime?: number;\n /**\n * If `true` when in multiple selection, reset the query immediately\n * upon selecting an option. By default the query is\n * not reset until focus is lost so the user can search\n * for \"Cath\" and select \"Cathy\" and then write more to\n * search for \"Catherine\"\n */\n resetQueryOnOptionSelected?: boolean;\n /**\n * Adds a stash to accumulate selected values. Especially\n * useful when searching in a big database of items.\n * E.g. if you search for \"John\" and then search for \"Richard\"\n * you either always return the previous items or you stash them passing `true` to this option.\n */\n stash?: boolean;\n /**\n * Pass `true` if the dropdown is not updating following movement in the UI, like in modals. Very expensive so use with care.\n */\n updateOnAnimationFrame?: boolean;\n };\n\ntype BaseOption = {\n id: string;\n jsonValue: string;\n manual: boolean;\n original: any;\n text: string;\n value: any;\n disabled: boolean;\n};\n\ntype Option = BaseOption & {\n index: number;\n selected: boolean;\n};\n\ntype FilteredOption = Option & {\n focused: boolean;\n};\n\nexport type BaseSelectEvents = {\n (e: \"blur\", event: FocusEvent): void;\n (e: \"change\", event: Event): void;\n (e: \"click\", event: MouseEvent): void;\n (e: \"focus\", event: FocusEvent): void;\n (e: \"inactive\"): void;\n (e: \"input\", event: Event): void;\n (e: \"update:modelValue\", value: any): void;\n};\n\nexport type BaseSelectSlots = {\n \"prepend-outer\"?: (props: {}) => any;\n prepend?: (props: {}) => any;\n \"options:prepend\"?: (props: {}) => any;\n loading?: (props: { query: string }) => any;\n \"no-data\"?: (props: { query: string }) => any;\n \"option:prepend\"?: (props: { item: any }) => any;\n chip?: (props: {\n disabled: FilteredOption[\"disabled\"];\n hasErrors?: boolean;\n index: FilteredOption[\"index\"];\n item: FilteredOption[\"original\"];\n loading: boolean;\n manual: FilteredOption[\"manual\"];\n selected: FilteredOption[\"selected\"];\n text: FilteredOption[\"text\"];\n value: FilteredOption[\"value\"];\n }) => any;\n option?: (props: {\n disabled: FilteredOption[\"disabled\"];\n focused: FilteredOption[\"focused\"];\n hasErrors?: boolean;\n index: FilteredOption[\"index\"];\n item: FilteredOption[\"original\"];\n loading: boolean;\n manual: FilteredOption[\"manual\"];\n selected: FilteredOption[\"selected\"];\n text: FilteredOption[\"text\"];\n value: FilteredOption[\"value\"];\n }) => any;\n \"option:append\"?: (props: { item: any }) => any;\n \"options:append\"?: (props: {}) => any;\n chevron?: (props: { loading: boolean; shown: boolean }) => any;\n append?: (props: {}) => any;\n spinner?: (props: { loading: boolean }) => any;\n \"append-outer\"?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSelect',\n props: {\n allowWriting: { type: Boolean, default: true },\n autofocus: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n disabled: { type: Boolean },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n id: {},\n itemText: {},\n itemValue: {},\n loadingText: { default: \"Caricamento...\" },\n matchStrategy: { default: \"string\" },\n modelValueDebounceTime: { default: 0 },\n multiple: { type: Boolean },\n name: {},\n noDataText: { default: \"Nessun elemento da visualizzare\" },\n placeholder: {},\n readonly: {},\n transitionDuration: { default: 200 },\n items: {},\n modelValue: {},\n addOptions: { type: Boolean },\n comma: { type: Boolean },\n filterBy: { type: [String, Array, Boolean, Function, null], default: () => [] },\n prefill: { type: [Boolean, String], default: \"focus\" },\n queryDebounceTime: { default: 500 },\n resetQueryOnOptionSelected: { type: Boolean },\n stash: { type: Boolean },\n updateOnAnimationFrame: { type: Boolean, default: false }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nif (props.multiple && !Array.isArray(props.modelValue)) {\n throw new Error('Multiple is set to \"true\" but modelValue is not an array.');\n}\n\nconst outerContainer = ref<HTMLElement | null>(null);\nconst innerContainer = ref<HTMLElement | null>(null);\nconst optionsContainer = ref<HTMLElement | null>(null);\nconst input = ref<HTMLElement | null>(null);\nconst query = ref<string>(\"\");\nconst computedPlaceholder = computed(() => {\n if (selectedOptions.value.length) return \"\";\n else return props.placeholder;\n});\n/**\n * Use a number accumulator because if the fn takes 5 seconds\n * and after 2 seconds another search is run\n * When the first returns the second is still out for 2 seconds\n * and we want to track them both.\n * Debounce will not be enough.\n */\nconst loading = ref(0);\nconst transitionDuration = props.transitionDuration / 1000 + \"s\";\nlet cleanUpPositioning: () => void;\n\nonMounted(async () => {\n if (innerContainer.value && optionsContainer.value) {\n cleanUpPositioning = autoUpdate(\n innerContainer.value,\n optionsContainer.value,\n displayOptions,\n {\n ancestorResize: true,\n ancestorScroll: true,\n animationFrame: props.updateOnAnimationFrame,\n elementResize: true,\n }\n );\n }\n});\nonBeforeUnmount(() => {\n cleanUpPositioning();\n});\n\nconst internalItems = ref<BaseOption[]>([]);\nconst stash = ref<BaseOption[]>([]);\nconst manualItems = ref<BaseOption[]>([]);\nconst { getItemText } = useItemText();\nconst { getItemValue } = useItemValue();\n\nconst internalOptions = computed<BaseOption[]>(() => {\n return internalItems.value.map((item: any, _) => {\n const text = getItemText(item, props.itemText);\n const value = getItemValue(item, props.itemValue);\n\n // Undefined is not JSONable\n if (value === undefined)\n throw new Error(\n 'The result of extracting \"value\" from option was undefined. Affected item is ' +\n JSON.stringify(item) +\n \" please check itemValue property is correct.\"\n );\n\n const jsonValue = JSON.stringify(value);\n return {\n disabled: !!item.disabled,\n id: \"option_\" + jsonValue.replace(/\\W/g, \"_\"),\n jsonValue,\n manual: false,\n original: item,\n text,\n value,\n };\n });\n});\n\nconst options = computed<Option[]>(() => {\n let fromOptions = internalOptions.value.reduce(\n (acc: { [key: string]: BaseOption }, curr: BaseOption) => {\n acc[curr.id] = curr;\n return acc;\n },\n {}\n );\n const withManual: { [key: string]: BaseOption } = manualItems.value.reduce(\n (acc, curr) => {\n if (!acc[curr.id]) acc[curr.id] = curr;\n return acc;\n },\n fromOptions\n );\n const withStash: { [key: string]: BaseOption } = stash.value.reduce(\n (acc, curr) => {\n if (!acc[curr.id]) acc[curr.id] = curr;\n return acc;\n },\n withManual\n );\n return Object.values(withStash).map<Option>((option: BaseOption, index) => {\n return {\n ...option,\n selected: isNotNil(modelValueIndexed.value.get(option.value)),\n index,\n };\n });\n});\n\n/**\n * Filter options to be displayed based on the current query.\n * If no query is used or when query is set from the inside (after a selection) display all possible options\n */\nconst filteredOptions = computed<FilteredOption[]>(() => {\n let base = [];\n /** Only filter when a value is being searched not when the query is fully set on a selected option text */\n if (\n query.value &&\n !selectedOptions.value.some((option: Option) => option.text === query.value)\n ) {\n base = options.value.filter((item: Option) => {\n let matchedAnything = false;\n if (!props.filterBy) return true;\n else if (typeof props.filterBy === \"function\")\n matchedAnything = props.filterBy(item.value, item.original);\n else if (props.filterBy.length) {\n const keys = ([] as string[]).concat(props.filterBy);\n for (let index = 0; index < keys.length; index++) {\n const propName = keys[index];\n matchedAnything =\n matchedAnything ||\n (item.original[propName] &&\n item.original[propName]\n .toLowerCase()\n .includes(query.value.toLowerCase()));\n }\n }\n return (\n matchedAnything ||\n item.text.toLowerCase().includes(query.value.toLowerCase())\n );\n });\n /** Otherwise defaul;t to the whole set of options */\n } else base = options.value;\n /** This is done here so that only visible options are highlighted */\n return base.map((option: Option, index) => ({\n ...option,\n focused: normalizedFocusedIndex.value === index,\n }));\n});\n\n/**\n * Indexes options by id for retrieval\n */\n\nconst optionsIndexedById = computed<{\n [key: string]: Option;\n}>(() =>\n options.value.reduce(\n (acc, curr) => ({\n ...acc,\n [curr.id]: curr,\n }),\n {}\n )\n);\n\n/**\n * Indexes options by their value\n * (using JSON to circumvent identical objects not being equal in JS)\n */\nconst optionsIndexedByValue = computed(() => {\n if (props.matchStrategy === \"string\") {\n let indexed = options.value.reduce(\n (acc: { [key: string]: Option }, curr: Option) => {\n acc[curr.jsonValue] = curr;\n return acc;\n },\n {}\n );\n return {\n get: (key: any) => {\n return indexed[JSON.stringify(key)];\n },\n };\n } else if (props.matchStrategy === \"equality\") {\n let indexed: [any, Option][] = options.value.map((option) => [\n option.value,\n option,\n ]);\n\n return {\n get: (key: any) => {\n return indexed.find((pairs) => deepEqual(pairs[0], key))?.[1];\n },\n };\n } else {\n throw new Error(\"No match strategy has been defined\");\n }\n});\n\n/**\n * Indexes modelValue to a map so when can easily know which values are selected\n * (using JSON to circumvent identical object not being equal in JS)\n */\nconst modelValueIndexed = computed(() => {\n if (props.matchStrategy === \"string\") {\n let map: { [key: string]: number } = {};\n [].concat(props.modelValue).forEach((value: any, index: number) => {\n map[JSON.stringify(value)] = index;\n });\n return {\n get: (value: any) => map[JSON.stringify(value)],\n };\n } else if (props.matchStrategy === \"equality\") {\n const map = []\n .concat(props.modelValue)\n .filter(isNotNil)\n .map((value, index) => [value, index]);\n\n return {\n get: (key: any) => {\n return map.find((pairs) => deepEqual(pairs[0], key))?.[1];\n },\n };\n } else {\n throw new Error(\"No match strategy has been defined\");\n }\n});\n\n/**\n * For every item in modelValue find the linked option if it exists.\n * This is used to display chips.\n */\nconst selectedOptions = computed(() => {\n return [].concat(props.modelValue).reduce((acc: Option[], curr: any) => {\n const linkedOption = optionsIndexedByValue.value.get(curr);\n if (linkedOption) acc.push(linkedOption);\n return acc;\n }, []);\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n let valueToEmit;\n focusedIndex.value = option.index;\n /**\n * For single selection:\n * If the option was already selected - restore the value to default, clean the stash, manual items, and query.\n * If the option was not selected - use its value, save the option in the stash and display it's text as query\n * The stash is used to remove the complexity of stashing items when searching for identifying information,\n * like searching an address would not return the option that was used to selected a previous address in another country.\n * Or when searching users by username would not return the previous ones.\n * We save it so the user hasn't to.\n */\n if (!props.multiple) {\n if (option.selected) {\n if (option.manual) {\n manualItems.value = manualItems.value.filter(\n (current: BaseOption) => current.id !== option.id\n );\n }\n valueToEmit = null;\n if (props.stash) {\n stash.value = [];\n }\n query.value = \"\";\n } else {\n valueToEmit = option.value;\n if (props.stash) {\n stash.value = [option];\n }\n query.value = option.text;\n }\n /**\n * For multiple selection\n * If the option was selected remove it from modelValue, if it is a mnaual iutem also remove it from there.\n * In the stash we can search for the id of the option.\n * If the option was not selected we can just add it to modelValue and the stash.\n */\n } else {\n if (option.selected) {\n if (option.manual) {\n manualItems.value = manualItems.value.filter(\n (current: BaseOption) => current.id !== option.id\n );\n }\n valueToEmit = props.modelValue.filter(\n (value: any) => JSON.stringify(value) !== option.jsonValue\n );\n if (props.stash) {\n stash.value = stash.value.filter((stashed) => stashed.id !== option.id);\n }\n } else {\n valueToEmit = props.modelValue.concat(option.value);\n if (props.stash) {\n stash.value = stash.value.concat(option);\n }\n }\n if (props.resetQueryOnOptionSelected) {\n query.value = \"\";\n }\n }\n emit(\"update:modelValue\", valueToEmit);\n};\n\nconst getOptions = async ({ prefill = false }) => {\n let items = [];\n if (Array.isArray(props.items)) {\n items = props.items;\n } else {\n if (typeof props.items === \"function\") {\n loading.value++;\n items = await props.items(query.value, prefill, props.modelValue);\n loading.value--;\n }\n }\n internalItems.value = items;\n};\n\n/**\n * Add an option to the manual items and then reset the query\n */\nconst addOption = () => {\n const text = query.value;\n const value = query.value;\n const jsonValue = JSON.stringify(value);\n const option = {\n text,\n value,\n jsonValue,\n id: \"option_\" + jsonValue.replace(/\\W/g, \"_\"),\n original: value,\n manual: true,\n disabled: false,\n };\n manualItems.value = manualItems.value.concat(option);\n query.value = \"\";\n};\n\n/**\n * It should prefill if asked, or\n * when single if modelValue is not null\n * when multiple if modelValue is not empty\n */\nconst shouldPrefill =\n props.prefill === true ||\n (!props.multiple && isNotNil(props.modelValue)) ||\n (props.multiple && !!props.modelValue.length);\n/**\n * When modelValue changes split behavior for single and multiple selection:\n */\nlet modelValueTimeout: ReturnType<typeof setTimeout>;\nlet hasRunOnce = false;\nwatch(\n () => props.modelValue,\n (current, previous) => {\n if (modelValueTimeout) clearTimeout(modelValueTimeout);\n modelValueTimeout = setTimeout(\n async () => {\n /**\n * For single selection if the value is already in the option (most likely you are using\n * static items) just use it.\n * If the value is not in the options try searching for it (outside dependencies may fix it).\n * If at last the value cannot be found even after searching\n * reset value to the default value when coherence is enforced\n * or at least do not display the old query\n */\n if (!props.multiple) {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (\n (!found && isNotNil(props.modelValue)) ||\n previous === undefined\n ) {\n const currentQuery = query.value;\n query.value = \"\";\n await getOptions({ prefill: true });\n query.value = currentQuery;\n }\n found = optionsIndexedByValue.value.get(props.modelValue);\n if (found) {\n query.value = found.text;\n if (props.stash) {\n stash.value = [found];\n }\n } else {\n if (props.enforceCoherence && isNotNil(current)) {\n query.value = \"\";\n if (props.stash) {\n stash.value = [];\n }\n emit(\"update:modelValue\", null);\n } else {\n query.value = \"\";\n }\n }\n /**\n * For multiple selection if every value is already in the options (most likely you are using\n * static items) just use them.\n * If not all the values are in the current options or is prefilling try searching (outside depencencies may fix the situation).\n * If the values are still not in the available options and coherence is enforced\n * discard the ones that are invalid.\n *\n */\n } else {\n if (!Array.isArray(props.modelValue)) {\n throw new Error(\"props.modelValue is not an array.\");\n }\n let allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n if (!allFound || previous === undefined) {\n await getOptions({ prefill: true });\n allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n }\n if (allFound) {\n if (props.stash) {\n stash.value = props.modelValue.map(\n (value: any) => optionsIndexedByValue.value.get(value)!\n );\n }\n } else {\n let coherentStash: Option[] = [];\n const coherent = current.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n if (found) coherentStash.push(found);\n return found;\n });\n if (props.stash) {\n stash.value = coherentStash;\n }\n if (props.enforceCoherence) {\n emit(\"update:modelValue\", coherent);\n }\n }\n }\n },\n shouldPrefill ? 0 : props.modelValueDebounceTime\n );\n },\n // Prefill when asked or when items are static\n { immediate: shouldPrefill, deep: true }\n);\n\n/**\n * This is triggered to refresh static items whenever the passed array changes.\n * If the parent defines an array in the template this is triggered\n * at every render so we take counter measures\n * Even if the entire array changes all the previously selected values are still in the stash.\n */\nwatch(\n () => props.items,\n async (current, previous) => {\n if (\n typeof current === \"function\" ||\n // Circumvent arrays defined in the template by the parent\n JSON.stringify(current) !== JSON.stringify(previous)\n ) {\n await getOptions({ prefill: false });\n if (props.multiple) {\n const allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n\n if (!allFound) {\n if (props.enforceCoherence) {\n const coherent = props.modelValue.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n return found;\n });\n emit(\"update:modelValue\", coherent);\n }\n }\n } else {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (!found && props.enforceCoherence && isNotNil(props.modelValue)) {\n emit(\"update:modelValue\", null);\n }\n focusedIndex.value = null;\n }\n }\n }\n);\n\n/**\n * When dependencies change\n * If the input has not been prefilled yet just return\n * Check dependencies are the same by value and not reference\n * Otherwise we search again for options as they might be different base on dependencies.\n * If coherence is enforced we set the state accordingly\n */\nlet depsTimeout: ReturnType<typeof setTimeout>;\nwatch(\n () => props.dependencies,\n (current, previous) => {\n if (!shouldPrefill && props.prefill === \"focus\" && isFirstFocus) {\n return;\n }\n // Circumvent array defined in the template by the parent\n if (JSON.stringify(current) === JSON.stringify(previous)) {\n return;\n }\n\n if (depsTimeout) clearTimeout(depsTimeout);\n depsTimeout = setTimeout(async () => {\n if (JSON.stringify(current) !== JSON.stringify(previous)) {\n // Only reset the stash if we are going to enforce coherence\n if (props.enforceCoherence) {\n if (props.stash) {\n stash.value = [];\n }\n }\n // Momentarily reset query\n let currentQuery = query.value;\n query.value = \"\";\n await getOptions({ prefill: true });\n query.value = currentQuery;\n if (!props.multiple) {\n let found = optionsIndexedByValue.value.get(props.modelValue);\n if (!found && props.enforceCoherence && isNotNil(props.modelValue)) {\n query.value = \"\";\n if (props.stash) {\n stash.value = [];\n }\n emit(\"update:modelValue\", null);\n }\n } else {\n let allFound = props.modelValue.every((value: any) =>\n optionsIndexedByValue.value.get(value)\n );\n if (!allFound && props.enforceCoherence) {\n let coherentStash: Option[] = [];\n const coherent = props.modelValue.filter((value: any) => {\n let found = optionsIndexedByValue.value.get(value);\n if (found) coherentStash.push(found);\n return found;\n });\n if (props.stash) {\n stash.value = coherentStash;\n }\n emit(\"update:modelValue\", coherent);\n }\n }\n }\n }, props.depsDebounceTime);\n },\n { deep: true }\n);\n\n/**\n * This is used to position the option container.\n * When the linked item (outerContainer) updates its position\n * this is rerun by floating-UI\n */\nconst displayOptions = () => {\n if (innerContainer.value && optionsContainer.value) {\n computePosition(innerContainer.value, optionsContainer.value, {\n placement: \"bottom\",\n middleware: [offset(6), flip(), shift()],\n }).then((data) => {\n if (optionsContainer.value) {\n optionsContainer.value.style.left = `${data.x}px`;\n optionsContainer.value.style.top = `${data.y}px`;\n optionsContainer.value.style.width = `${innerContainer.value?.offsetWidth}px`;\n }\n });\n }\n};\n/**\n * We need the transitions because elements must be hidden and shown\n * to accessibility tools when they are fully closed or fully open,\n * while still being animated for sighted users.\n */\n\n// Option panel is open\nconst shown = ref(false);\n// Option panel is opening\nconst showing = ref(false);\n// option panel is closing\nconst hiding = ref(false);\n// Option panel il closed\nconst hidden = ref(true);\n\nconst open = async () => {\n hidden.value = false;\n showing.value = true;\n await wait(props.transitionDuration);\n showing.value = false;\n shown.value = true;\n};\n\nconst close = async () => {\n shown.value = false;\n hiding.value = true;\n await wait(props.transitionDuration);\n hiding.value = false;\n hidden.value = true;\n};\n\n/**\n * Applies a class when the user is inside this whole component.\n * We cannot use focus within as it doesn't work for elements that are teleported.\n * Also we cannot use the <input/> if we phisically move focus to the options so\n * we track it manually.\n */\nconst active = ref(false);\n\n/**\n * When the focus goes to the input we select the current text\n * so the user can replace or delete it.\n * On top of that if the prefill strategy is to prefill on first focus and options\n * weren't already retrieved by the watcher on mount, we do that\n */\nlet isFirstFocus = true;\nconst onInputFocus = async (event: FocusEvent) => {\n emit(\"focus\", event);\n active.value = true;\n document.addEventListener(\"click\", onClickOutside);\n document.addEventListener(\"focusin\", onFocusOutside);\n if (input.value instanceof HTMLInputElement) input.value.select();\n if (props.prefill === \"focus\" && isFirstFocus && !shouldPrefill) {\n await getOptions({ prefill: true });\n isFirstFocus = false;\n }\n};\n\nconst onFocusOutside = (event: FocusEvent) => {\n if (event.target instanceof Node) {\n if (outerContainer.value && optionsContainer.value) {\n if (\n !outerContainer.value.contains(event.target) &&\n !optionsContainer.value.contains(event.target)\n ) {\n close();\n emit(\"inactive\");\n document.removeEventListener(\"focusin\", onFocusOutside);\n active.value = false;\n if (props.multiple)\n wait(500).then(() => {\n query.value = \"\";\n });\n return;\n }\n }\n }\n};\n\n/**\n * On single selection restore the query that might be partially altered by the user.\n * Input can blur either by clicking outside or clicking on an option.\n * We do nothing if the user has selected an option. And we restore the\n * query to its text if the user has moved focus\n */\nconst onInputBlur = async (event: FocusEvent) => {\n emit(\"blur\", event);\n if (!props.multiple) {\n let noop = false;\n const currentModelValue = props.modelValue;\n await Promise.race([\n wait(250),\n waitFor(() => {\n return currentModelValue !== props.modelValue;\n }).then(() => {\n noop = true;\n }),\n ]);\n if (!noop) {\n const found = optionsIndexedByValue.value.get(props.modelValue);\n if (found) {\n query.value = found.text;\n }\n }\n }\n};\n\nconst onInputChange = (event: Event) => emit(\"change\", event);\n\n/**\n * Search at every input by the user.\n * When the user deletes the query unselect the current option\n */\nconst onInputInput = (event: Event) => {\n emit(\"input\", event);\n if (query.value === \"\") {\n if (!props.multiple) {\n emit(\"update:modelValue\", null);\n }\n }\n if (typeof props.items === \"function\") {\n searchByQuery();\n }\n};\n\n// This is the vertical index used to highlight options in the container\nconst focusedIndex = ref<number | null>(null);\n/**\n * Normalize the index using the displayed options so we can start over when reaching the end.\n * Please watch out for the side effect it is used to avoid the\n * complexity of using modulo over negative numbers\n */\nconst normalizedFocusedIndex: ComputedRef<number | null> = computed(() => {\n if (Number.isInteger(focusedIndex.value) && focusedIndex.value) {\n if (focusedIndex.value === -1) {\n focusedIndex.value = filteredOptions.value.length - 1;\n }\n return focusedIndex.value % filteredOptions.value.length;\n }\n return focusedIndex.value;\n});\n\n// This is the horizontal index used to highlight selected options\nconst selectedOptionsFocusedIndex = ref<number | null>(null);\n\n/**\n * Increment the focusIndex and wait for it to be normalized.\n * If the index corresponds to an option scroll it into view\n */\nconst focusOnNextOption = () => {\n if (focusedIndex.value !== null) focusedIndex.value++;\n else {\n focusedIndex.value = 0;\n }\n nextTick().then(() => {\n if (normalizedFocusedIndex.value !== null) {\n const foundOption = optionsContainer.value?.querySelector(\n `#${options.value[normalizedFocusedIndex.value].id}`\n );\n if (foundOption instanceof HTMLElement)\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n }\n });\n};\n\n/**\n * Decrement the focusIndex and wait for it to be normalized.\n * If the index corresponds to an option scroll it into view\n */\nconst focusOnPreviousOption = () => {\n if (focusedIndex.value !== null) focusedIndex.value--;\n else focusedIndex.value = options.value.length - 1;\n\n nextTick().then(() => {\n if (normalizedFocusedIndex.value !== null) {\n const foundOption = optionsContainer.value?.querySelector(\n `#${options.value[normalizedFocusedIndex.value].id}`\n );\n if (foundOption instanceof HTMLElement)\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n }\n });\n};\n\n/**\n * This is handled separately from input because it has a lot to do with user\n * interaction and control characters than it has with the query.\n */\nconst onInputKeyDown = async (event: KeyboardEvent) => {\n if (props.readonly || props.disabled) {\n event.preventDefault();\n return;\n }\n switch (event.key) {\n /**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\n case \"ArrowUp\":\n {\n event.preventDefault();\n if (loading.value) return;\n selectedOptionsFocusedIndex.value = null;\n if (shown.value) {\n focusOnPreviousOption();\n } else {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n await open();\n }\n }\n break;\n /**\n * On arrow prevent the page from scrolling.\n * Reset horizontal focus\n * When the panel is open\n * - Focus on the previous option\n * When the panel is closed\n * - focus on the first selected option\n */\n case \"ArrowDown\":\n {\n event.preventDefault();\n if (loading.value) return;\n selectedOptionsFocusedIndex.value = null;\n if (shown.value) {\n focusOnNextOption();\n } else {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n await open();\n }\n }\n break;\n /**\n * When moving horizontally\n * Cycle from rightmost, next, or input focus.\n * If the focus lands on an option align the vertical focus as well\n */\n case \"ArrowLeft\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value =\n selectedOptions.value.length - 1;\n } else if (selectedOptionsFocusedIndex.value > 0) {\n selectedOptionsFocusedIndex.value--;\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n\n if (selectedOptionsFocusedIndex.value !== null) {\n let linkedOption =\n selectedOptions.value[selectedOptionsFocusedIndex.value];\n let foundOption = optionsContainer.value?.querySelector(\n `#${linkedOption.id}`\n );\n if (foundOption) {\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n\n focusedIndex.value =\n optionsIndexedById.value[\n selectedOptions.value[selectedOptionsFocusedIndex.value].id\n ].index;\n }\n }\n }\n }\n }\n break;\n /**\n * When moving horizontally\n * Cycle from leftmost, next, or input focus.\n * If the focus lands on an option align the vertical focus as well\n */\n case \"ArrowRight\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value = 0;\n } else if (\n selectedOptionsFocusedIndex.value <\n selectedOptions.value.length - 1\n ) {\n selectedOptionsFocusedIndex.value++;\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n\n if (selectedOptionsFocusedIndex.value !== null) {\n let linkedOption =\n selectedOptions.value[selectedOptionsFocusedIndex.value];\n let foundOption = optionsContainer.value?.querySelector(\n `#${linkedOption.id}`\n );\n if (foundOption) {\n foundOption.scrollIntoView({\n behavior: \"smooth\",\n block: \"nearest\",\n inline: \"start\",\n });\n\n focusedIndex.value =\n optionsIndexedById.value[\n selectedOptions.value[selectedOptionsFocusedIndex.value].id\n ].index;\n }\n }\n }\n }\n }\n break;\n /**\n * If the panel is closed focus on the first selected option.\n * If the panel was already open select/deselect the currently focused option\n * and close the panel of single selection is enabled\n */\n case \"Enter\":\n {\n event.preventDefault();\n if (loading.value) return;\n if (!shown.value) {\n if (filteredOptions.value.length) {\n if (selectedOptions.value.length) {\n focusedIndex.value = head(selectedOptions.value).index;\n }\n }\n await open();\n } else {\n if (normalizedFocusedIndex.value !== null) {\n if (filteredOptions.value[normalizedFocusedIndex.value].disabled)\n return;\n if (!props.multiple) {\n await close();\n }\n onOptionSelected(\n filteredOptions.value[normalizedFocusedIndex.value]\n );\n } else {\n if (props.addOptions) {\n if (props.itemText || props.itemValue) {\n console.error(\n `Adding an option for mapped items is not supported. You can't create an option while passing \"item-text\" or \"item-value\".`\n );\n return;\n }\n addOption();\n const added = last(manualItems.value);\n onOptionSelected(optionsIndexedById.value[added.id]);\n }\n }\n }\n }\n break;\n /**\n * When moving away from the component reset focus both vertically and horizontally\n */\n case \"Tab\":\n case \"Escape\":\n {\n if (shown.value) {\n await close();\n }\n emit(\"inactive\");\n selectedOptionsFocusedIndex.value = null;\n focusedIndex.value = null;\n }\n break;\n // Prevent shift from opening the panel\n case \"Shift\":\n {\n if (loading.value) return;\n }\n break;\n /**\n * Delete behavior is different when query is empty\n * If query is empty\n * If no chip is selected - select rightmost chip\n * If a chip is selected - deselect that option\n * If any option remains move focus to that or reset\n */\n case \"Backspace\":\n {\n if (loading.value) return;\n if (!query.value) {\n if (selectedOptions.value.length) {\n if (selectedOptionsFocusedIndex.value === null) {\n selectedOptionsFocusedIndex.value =\n selectedOptions.value.length - 1;\n } else {\n onOptionSelected(\n selectedOptions.value[selectedOptionsFocusedIndex.value]\n );\n if (selectedOptions.value.length) {\n selectedOptionsFocusedIndex.value = Math.max(\n Math.min(\n selectedOptionsFocusedIndex.value,\n selectedOptions.value.length - 2\n ),\n 0\n );\n } else {\n selectedOptionsFocusedIndex.value = null;\n }\n }\n }\n }\n await open();\n }\n break;\n /**\n * Open the panel on writing and reset horizontal focus\n */\n default:\n {\n selectedOptionsFocusedIndex.value = null;\n focusedIndex.value = null;\n await open();\n }\n break;\n }\n};\n\n/**\n * Triggered on input when items is a function.\n */\n\nlet timeout: ReturnType<typeof setTimeout>;\nconst searchByQuery = () => {\n if (timeout) clearTimeout(timeout);\n timeout = setTimeout(async () => {\n try {\n await getOptions({ prefill: false });\n } catch (error) {\n console.error(error);\n }\n }, props.queryDebounceTime);\n};\n\n/**\n * When clicking on the outside container seamlessly move focus to the input and open the panel\n */\nconst onOuterContainerClick = (event: MouseEvent) => {\n emit(\"click\", event);\n if (props.disabled || props.readonly) return;\n if (input.value instanceof HTMLElement) {\n input.value.focus();\n }\n open();\n};\n\n/**\n * When an option is clicked wait for it to bubble to the option container to avoid slot event problems.\n * Select / deselect the option and then move focus to the input.\n * If it is single selection mode close the panel\n */\nconst onOptionClicked = (event: Event) => {\n if (event.currentTarget instanceof HTMLElement) {\n if (event.currentTarget.classList.contains(\"bb-base-select-option\")) {\n const option = optionsIndexedById.value[event.currentTarget.id];\n if (option.disabled) return;\n onOptionSelected(option);\n if (input.value instanceof HTMLInputElement) {\n input.value.focus();\n }\n if (!props.multiple) close();\n }\n }\n};\n\n/**\n * On click outside of the container close the panel, remove active state.\n * In multiple selection clear query after a timeout\n */\nconst onClickOutside = (event: Event) => {\n if (event.target instanceof Node) {\n if (outerContainer.value) {\n if (!outerContainer.value.contains(event.target)) {\n close();\n emit(\"inactive\");\n document.removeEventListener(\"click\", onClickOutside);\n active.value = false;\n if (props.multiple)\n wait(500).then(() => {\n query.value = \"\";\n });\n return;\n }\n }\n }\n};\n\n/**\n * When using this component for submission we add a bunch of hidden\n * inputs so the submitted inputs are on par with v-model\n */\n/**\n * This is used to keep the value compatible to common html expected values.\n * Convert to string everything that's not but do not double encode strings\n */\nconst makeInputValue = when(\n (item: unknown) => typeof item !== \"string\",\n JSON.stringify\n);\n\nconst hiddenInputs = computed(() => {\n return [].concat(props.modelValue).map((current) => {\n const value = makeInputValue(current);\n return {\n disabled: props.disabled,\n name: props.name,\n type: \"hidden\",\n value: value,\n };\n });\n});\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass({\n 'bb-base-select': true,\n 'bb-base-select--active': active.value,\n 'bb-base-select--loading': loading.value,\n 'bb-base-select--disabled': _ctx.disabled,\n 'bb-base-select--errors': _ctx.hasErrors,\n 'bb-base-select--readonly': _ctx.readonly,\n }),\n onClick: onOuterContainerClick,\n ref_key: \"outerContainer\",\n ref: outerContainer\n }, [\n _renderSlot(_ctx.$slots, \"prepend-outer\"),\n _createElementVNode(\"span\", {\n class: \"bb-base-select__inner-container\",\n ref_key: \"innerContainer\",\n ref: innerContainer\n }, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n _createElementVNode(\"span\", _hoisted_1, [\n (_ctx.multiple)\n ? (_openBlock(), _createElementBlock(_Fragment, { key: 0 }, [\n (_ctx.comma)\n ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(selectedOptions.value, (option, index) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass({\n 'bb-base-select__selected': true,\n 'bb-base-select__selected--comma': true,\n 'bb-base-select__selected--focused':\n index === selectedOptionsFocusedIndex.value,\n }),\n key: option.id\n }, _toDisplayString(option.text) + _toDisplayString(index < selectedOptions.value.length - 1 ? \",\" : \"\"), 3))\n }), 128))\n : (_openBlock(true), _createElementBlock(_Fragment, { key: 1 }, _renderList(selectedOptions.value, (option, index) => {\n return (_openBlock(), _createBlock(BbChip, {\n class: _normalizeClass({\n 'bb-base-select__selected': true,\n 'bb-base-select__selected--chip': true,\n 'bb-base-select__selected--focused':\n index === selectedOptionsFocusedIndex.value,\n }),\n clearable: true,\n key: option.id,\n text: option.text,\n \"onClick:clear\": _withModifiers(($event: any) => (onOptionSelected(option)), [\"stop\"])\n }, {\n default: _withCtx(() => [\n _renderSlot(_ctx.$slots, \"chip\", {\n disabled: option.disabled,\n hasErrors: _ctx.hasErrors,\n index: option.index,\n item: option.original,\n loading: !!loading.value,\n manual: option.manual,\n selected: option.selected,\n text: option.text,\n value: option.value\n }, () => [\n _createTextVNode(_toDisplayString(option.text), 1)\n ])\n ]),\n _: 2\n }, 1032, [\"class\", \"text\", \"onClick:clear\"]))\n }), 128))\n ], 64))\n : _createCommentVNode(\"\", true),\n _withDirectives(_createElementVNode(\"input\", {\n autofocus: _ctx.autofocus,\n class: _normalizeClass('bb-base-select__text-input'),\n disabled: _ctx.disabled,\n id: _ctx.id,\n placeholder: computedPlaceholder.value,\n readonly: _ctx.readonly || !_ctx.allowWriting,\n type: 'text',\n onBlur: _withModifiers(onInputBlur, [\"stop\"]),\n onFocus: _withModifiers(onInputFocus, [\"stop\"]),\n onChange: _withModifiers(onInputChange, [\"stop\"]),\n onInput: _withModifiers(onInputInput, [\"stop\"]),\n onKeydown: _withModifiers(onInputKeyDown, [\"stop\"]),\n \"onUpdate:modelValue\": _cache[0] || (_cache[0] = ($event: any) => ((query).value = $event)),\n ref_key: \"input\",\n ref: input\n }, null, 40, _hoisted_2), [\n [_vModelDynamic, query.value]\n ]),\n (_openBlock(), _createBlock(_Teleport, { to: \"body\" }, [\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n 'bb-base-select__options-container': true,\n 'bb-base-select__options-container--shown': shown.value,\n 'bb-base-select__options-container--showing': showing.value,\n 'bb-base-select__options-container--hiding': hiding.value,\n 'bb-base-select__options-container--hidden': hidden.value,\n }),\n role: 'listbox',\n style: _normalizeStyle({ transitionDuration: transitionDuration }),\n tabindex: -1,\n ref_key: \"optionsContainer\",\n ref: optionsContainer\n }, [\n _renderSlot(_ctx.$slots, \"options:prepend\"),\n (!filteredOptions.value.length && loading.value)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'loading', { query: query.value }, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!filteredOptions.value.length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_4, [\n _renderSlot(_ctx.$slots, 'no-data', { query: query.value }, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(filteredOptions.value, (option) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option.id\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"span\", {\n \"aria-selected\": option.selected,\n class: _normalizeClass({\n 'bb-base-select-option': true,\n 'bb-base-select-option--selected': option.selected,\n 'bb-base-select-option--focused': option.focused,\n 'bb-base-select-option--disabled': option.disabled,\n }),\n id: option.id,\n role: 'option',\n onClick: _withModifiers(onOptionClicked, [\"stop\"])\n }, [\n _renderSlot(_ctx.$slots, \"option\", {\n disabled: option.disabled,\n focused: option.focused,\n hasErrors: _ctx.hasErrors,\n index: option.index,\n item: option.original,\n loading: !!loading.value,\n manual: option.manual,\n selected: option.selected,\n text: option.text,\n value: option.value\n }, () => [\n _createElementVNode(\"span\", _hoisted_6, [\n _createElementVNode(\"span\", _hoisted_7, _toDisplayString(option.text), 1)\n ])\n ])\n ], 10, _hoisted_5),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"options:append\")\n ], 6)\n ]))\n ]),\n _createElementVNode(\"span\", _hoisted_8, [\n _renderSlot(_ctx.$slots, \"chevron\", {\n loading: !!loading.value,\n shown: shown.value\n }, () => [\n _hoisted_9\n ])\n ]),\n (!loading.value)\n ? _renderSlot(_ctx.$slots, \"append\", { key: 0 })\n : (_openBlock(), _createElementBlock(\"span\", {\n key: 1,\n class: _normalizeClass({\n 'bb-base-select__spinner': true,\n 'bb-base-select__spinner--loading': loading.value,\n })\n }, [\n _renderSlot(_ctx.$slots, 'spinner', {\n loading: !!loading.value\n }, () => [\n _createVNode(BbSpinner, { size: 'sm' })\n ])\n ], 2))\n ], 512),\n _renderSlot(_ctx.$slots, \"append-outer\"),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(hiddenInputs.value, (input) => {\n return (_openBlock(), _createElementBlock(\"input\", _mergeProps({\n key: input.value\n }, input), null, 16))\n }), 128))\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_sfc_main","_defineComponent","__props","__emit","props","emit","outerContainer","ref","innerContainer","optionsContainer","input","query","computedPlaceholder","computed","selectedOptions","loading","transitionDuration","cleanUpPositioning","onMounted","autoUpdate","displayOptions","onBeforeUnmount","internalItems","stash","manualItems","getItemText","useItemText","getItemValue","useItemValue","internalOptions","item","_","text","value","jsonValue","options","fromOptions","acc","curr","withManual","withStash","option","index","isNotNil","modelValueIndexed","filteredOptions","base","matchedAnything","keys","propName","normalizedFocusedIndex","optionsIndexedById","optionsIndexedByValue","indexed","key","_a","pairs","deepEqual","map","linkedOption","onOptionSelected","valueToEmit","focusedIndex","current","stashed","getOptions","prefill","items","addOption","shouldPrefill","modelValueTimeout","watch","previous","allFound","coherentStash","coherent","found","currentQuery","depsTimeout","isFirstFocus","computePosition","offset","flip","shift","data","shown","showing","hiding","hidden","open","wait","close","active","onInputFocus","event","onClickOutside","onFocusOutside","onInputBlur","noop","currentModelValue","waitFor","onInputChange","onInputInput","searchByQuery","selectedOptionsFocusedIndex","focusOnNextOption","nextTick","foundOption","focusOnPreviousOption","onInputKeyDown","head","_b","added","last","timeout","error","onOuterContainerClick","onOptionClicked","makeInputValue","when","hiddenInputs","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createElementVNode","_Fragment","_renderList","_toDisplayString","_createBlock","BbChip","_withModifiers","$event","_withCtx","_createTextVNode","_createCommentVNode","_withDirectives","_vModelDynamic","_Teleport","_normalizeStyle","_createVNode","BbSpinner","_mergeProps"],"mappings":";;;;;;;;;;;;;;;;AAGA,MAAMA,KAAa,EAAE,OAAO,qCACtBC,KAAa,CAAC,aAAa,YAAY,MAAM,eAAe,YAAY,UAAU,WAAW,YAAY,WAAW,WAAW,GAC/HC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,KAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,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ounted as S, watchEffect as z, computed as y, openBlock as D, createElementBlock as F, mergeProps as h, renderSlot as g, createElementVNode as t, normalizeProps as H, guardReactiveProps as T, normalizeStyle as E, unref as X } from "vue";
|
2
|
-
import { clamp as K } from "./
|
2
|
+
import { clamp as K } from "./index190.js";
|
3
3
|
import { transposeValue as w } from "./index118.js";
|
4
|
-
import { isCssColor as L } from "./
|
4
|
+
import { isCssColor as L } from "./index191.js";
|
5
5
|
import { isNil as O } from "./index117.js";
|
6
6
|
const Y = { class: "bb-base-slider__slider-container" }, j = ["disabled", "id", "name", "readonly", "value"], q = ["aria-readonly", "aria-valuemax", "aria-valuemin", "aria-valuenow", "tabindex"], W = /* @__PURE__ */ R({
|
7
7
|
__name: "BaseSlider",
|
package/dist/index32.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { defineComponent as I, ref as b, computed as n, watch as F, openBlock as m, createElementBlock as p, normalizeClass as N, normalizeProps as c, mergeProps as h, createCommentVNode as S, createElementVNode as l, renderSlot as x, guardReactiveProps as f } from "vue";
|
2
|
-
import { isCssColor as V } from "./
|
3
|
-
import { when as A } from "./
|
2
|
+
import { isCssColor as V } from "./index191.js";
|
3
|
+
import { when as A } from "./index194.js";
|
4
4
|
const J = { class: "bb-base-switch-container" }, M = /* @__PURE__ */ l("span", { class: "bb-base-switch-container__icon-thumb" }, null, -1), O = [
|
5
5
|
M
|
6
6
|
], H = /* @__PURE__ */ I({
|
package/dist/index34.js
CHANGED
@@ -28,9 +28,9 @@ const O = { class: "bb-base-switch-group__container" }, j = {
|
|
28
28
|
matchStrategy: { default: "string" },
|
29
29
|
modelValueDebounceTime: { default: 0 },
|
30
30
|
noDataText: { default: "Nessun elemento da visualizzare" },
|
31
|
-
direction: { default: "horizontal" },
|
32
31
|
modelValue: {},
|
33
|
-
items: { type: [Array, Function], default: () => [] }
|
32
|
+
items: { type: [Array, Function], default: () => [] },
|
33
|
+
direction: { default: "horizontal" }
|
34
34
|
},
|
35
35
|
emits: ["blur", "change", "click", "focus", "inactive", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
|
36
36
|
setup(T, { emit: E }) {
|
package/dist/index34.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index34.js","sources":["../src/components/BaseSwitchGroup/BaseSwitchGroup.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-group__container\" }\nconst _hoisted_2 = {\n key: 0,\n class: \"bb-base-switch-group__loading-container\"\n}\nconst _hoisted_3 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\n\nimport { default as BaseSwitch } from \"../BaseSwitch/BaseSwitch.vue\";\nimport { ref, toRef } from \"vue\";\nimport { Simplify } from \"@/types/Simplify\";\nimport { SlotAttributes } from \"../BaseCheckbox/BaseCheckbox.vue\";\nimport {\n type BaseCheckboxGroupEvents,\n type BaseCheckboxGroupProps,\n} from \"../BaseCheckboxGroup/BaseCheckboxGroup.vue\";\nimport { useOptions, type Option } from \"@/composables/useOptions\";\n\nexport type BaseSwitchGroupProps = BaseCheckboxGroupProps;\n\nexport type BaseSwitchGroupEvents = BaseCheckboxGroupEvents;\nexport type BaseSwitchGroupSlots = {\n prepend?: (props: {}) => any;\n loading?: (props: {}) => any;\n \"no-data\"?: (props: {}) => any;\n \"option:prepend\"?: (props: { item: any }) => any;\n icon?: (\n props: Simplify<\n SlotAttributes & {\n item: any;\n text: string;\n }\n >\n ) => any;\n label?: (props: { item: any; text: string; checked: boolean }) => any;\n \"option:append\"?: (props: { item: any }) => any;\n append?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitchGroup',\n props: {\n autofocus: {},\n color: {},\n disabled: { type: Boolean },\n id: {},\n name: {},\n readonly: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n hideLabel: { type: Boolean },\n itemText: {},\n itemValue: {},\n loadingText: { default: \"Caricamento...\" },\n matchStrategy: { default: 'string' },\n modelValueDebounceTime: { default: 0 },\n noDataText: { default: \"Nessun elemento da visualizzare\" },\n direction: { default: \"horizontal\" },\n modelValue: {},\n items: { type: [Array, Function], default: () => [] }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { loading, options } = useOptions({\n dependencies: toRef(() => props.dependencies),\n depsDebounceTime: props.depsDebounceTime,\n disabled: toRef(() => props.disabled),\n emitter: (value) => emit(\"update:modelValue\", value),\n enforceCoherence: toRef(() => props.enforceCoherence),\n id: props.id,\n immediate: true,\n initialItems: toRef(() => props.items),\n itemText: props.itemText,\n itemValue: props.itemValue,\n matchStrategy: 'string',\n modelValue: toRef(() => props.modelValue),\n modelValueDebounceTime: props.modelValueDebounceTime,\n multiple: true,\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n let valueToEmit;\n if (option.selected) {\n valueToEmit = props.modelValue\n .slice(0, option.selectedIndex)\n .concat(props.modelValue.slice(option.selectedIndex + 1));\n } else {\n valueToEmit = props.modelValue.concat(option.value);\n }\n emit(\"update:modelValue\", valueToEmit);\n};\n\nconst onChange = (event: Event, option: Option) => {\n emit(\"change\", event);\n onOptionSelected(option);\n};\n\nconst onFocus = (event: FocusEvent) => {\n emit(\"focus\", event);\n if (!active.value) {\n document.addEventListener(\"focusin\", onDocumentFocus, { passive: true });\n document.addEventListener(\"click\", onDocumentClick, { passive: true });\n active.value = true;\n }\n};\n\nconst eventListeners = {\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus,\n onInput: (event: Event) => emit(\"input\", event),\n onKeydown: (event: KeyboardEvent) => emit(\"keydown\", event),\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([\"bb-base-switch-group\", {\n 'bb-base-switch-group--errors': _ctx.hasErrors,\n 'bb-base-switch-group--horizontal': _ctx.direction === 'horizontal',\n 'bb-base-switch-group--vertical': _ctx.direction === 'vertical',\n }]),\n ref_key: \"container\",\n ref: container\n }, [\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n (!_unref(options).length && _unref(loading))\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, 'loading', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!_unref(options).length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'no-data', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_unref(options), (option, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option?.id || option.jsonValue\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"label\", {\n class: _normalizeClass([\"bb-base-switch-group-option\", {\n 'bb-base-switch-group-option__selected': option.selected,\n }])\n }, [\n _createVNode(BaseSwitch, _mergeProps({\n autofocus: _ctx.autofocus && !index,\n checked: option.selected,\n color: _ctx.color,\n disabled: option.disabled,\n \"has-errors\": _ctx.hasErrors,\n id: option.id,\n name: _ctx.name,\n readonly: _ctx.readonly,\n onChange: (event) => onChange(event, option),\n \"true-value\": option.value\n }, eventListeners), _createSlots({ _: 2 }, [\n (_ctx.$slots.icon)\n ? {\n name: \"icon\",\n fn: _withCtx((data) => [\n _renderSlot(_ctx.$slots, \"icon\", _mergeProps({\n item: option.original,\n text: option.text\n }, data))\n ]),\n key: \"0\"\n }\n : undefined\n ]), 1040, [\"autofocus\", \"checked\", \"color\", \"disabled\", \"has-errors\", \"id\", \"name\", \"readonly\", \"onChange\", \"true-value\"]),\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n 'bb-base-switch-group-option__text': true,\n 'bb-base-switch-group-option__text--hidden': _ctx.hideLabel,\n })\n }, [\n _renderSlot(_ctx.$slots, \"label\", {\n text: option.text,\n item: option.original,\n checked: option.selected\n }, () => [\n _createTextVNode(_toDisplayString(option.text), 1)\n ])\n ], 2)\n ], 2),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"append\")\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","active","loading","options","useOptions","toRef","value","onOptionSelected","option","valueToEmit","onChange","event","eventListeners","onDocumentFocus","onDocumentClick","_a","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_unref","_createTextVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","index","_createVNode","BaseSwitch","_mergeProps","_createSlots","_withCtx","data"],"mappings":";;;;AAGA,MAAMA,IAAa,EAAE,OAAO,qCACtBC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GAkC4BC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,IACZ,OAAO,CAAC;AAAA,IACR,UAAU,EAAE,MAAM,QAAQ;AAAA,IAC1B,IAAI,CAAC;AAAA,IACL,MAAM,CAAC;AAAA,IACP,UAAU,CAAC;AAAA,IACX,cAAc,CAAC;AAAA,IACf,kBAAkB,EAAE,SAAS,EAAE;AAAA,IAC/B,kBAAkB,EAAE,MAAM,QAAQ;AAAA,IAClC,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,WAAW,EAAE,MAAM,QAAQ;AAAA,IAC3B,UAAU,CAAC;AAAA,IACX,WAAW,CAAC;AAAA,IACZ,aAAa,EAAE,SAAS,iBAAiB;AAAA,IACzC,eAAe,EAAE,SAAS,SAAS;AAAA,IACnC,wBAAwB,EAAE,SAAS,EAAE;AAAA,IACrC,YAAY,EAAE,SAAS,kCAAkC;AAAA,IACzD,WAAW,EAAE,SAAS,aAAa;AAAA,IACnC,YAAY,CAAC;AAAA,IACb,OAAO,EAAE,MAAM,CAAC,OAAO,QAAQ,GAAG,SAAS,MAAM,GAAG;AAAA,EACtD;AAAA,EACA,OAAO,CAAC,QAAQ,UAAU,SAAS,SAAS,YAAY,SAAS,WAAW,aAAa,WAAW,mBAAmB;AAAA,EACvH,MAAMC,GAAc,EAAE,MAAMC,KAAU;AAExC,UAAMC,IA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S,CAACC,MAAS;AAAA,kBACrBb,EAAYN,EAAK,QAAQ,QAAQgB,EAAY;AAAA,oBAC3C,MAAMxB,EAAO;AAAA,oBACb,MAAMA,EAAO;AAAA,kBACf,GAAG2B,CAAI,CAAC;AAAA,gBAAA,CACT;AAAA,gBACD,KAAK;AAAA,cAEP,IAAA;AAAA,YACL,CAAA,GAAG,MAAM,CAAC,aAAa,WAAW,SAAS,YAAY,cAAc,MAAM,QAAQ,YAAY,YAAY,YAAY,CAAC;AAAA,YACzHd,EAAoB,QAAQ;AAAA,cAC1B,OAAOD,EAAgB;AAAA,gBACvB,qCAAqC;AAAA,gBACrC,6CAA6CJ,EAAK;AAAA,cAAA,CACnD;AAAA,YAAA,GACE;AAAA,cACDM,EAAYN,EAAK,QAAQ,SAAS;AAAA,gBAChC,MAAMR,EAAO;AAAA,gBACb,MAAMA,EAAO;AAAA,gBACb,SAASA,EAAO;AAAA,cAAA,GACf,MAAM;AAAA,gBACPgB,EAAiBC,EAAiBjB,EAAO,IAAI,GAAG,CAAC;AAAA,cAAA,CAClD;AAAA,eACA,CAAC;AAAA,aACH,CAAC;AAAA,UACJc,EAAYN,EAAK,QAAQ,iBAAiB;AAAA,YACxC,MAAMR,EAAO;AAAA,UAAA,CACd;AAAA,WACA,EAAE,EACN,GAAG,GAAG;AAAA,QACPc,EAAYN,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,OACA,CAAC;AAAA,EAEN;AAEA,CAAC;"}
|
1
|
+
{"version":3,"file":"index34.js","sources":["../src/components/BaseSwitchGroup/BaseSwitchGroup.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { renderSlot as _renderSlot, unref as _unref, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderList as _renderList, Fragment as _Fragment, mergeProps as _mergeProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from \"vue\"\n\nconst _hoisted_1 = { class: \"bb-base-switch-group__container\" }\nconst _hoisted_2 = {\n key: 0,\n class: \"bb-base-switch-group__loading-container\"\n}\nconst _hoisted_3 = {\n key: 1,\n class: \"bb-base-select__no-data-container\"\n}\n\nimport { default as BaseSwitch } from \"../BaseSwitch/BaseSwitch.vue\";\nimport { ref, toRef } from \"vue\";\nimport { Simplify } from \"@/types/Simplify\";\nimport { SlotAttributes } from \"../BaseCheckbox/BaseCheckbox.vue\";\nimport {\n type BaseCheckboxGroupEvents,\n type BaseCheckboxGroupProps,\n} from \"../BaseCheckboxGroup/BaseCheckboxGroup.vue\";\nimport { useOptions, type Option } from \"@/composables/useOptions\";\n\nexport type BaseSwitchGroupProps = BaseCheckboxGroupProps;\n\nexport type BaseSwitchGroupEvents = BaseCheckboxGroupEvents;\nexport type BaseSwitchGroupSlots = {\n prepend?: (props: {}) => any;\n loading?: (props: {}) => any;\n \"no-data\"?: (props: {}) => any;\n \"option:prepend\"?: (props: { item: any }) => any;\n icon?: (\n props: Simplify<\n SlotAttributes & {\n item: any;\n text: string;\n }\n >\n ) => any;\n label?: (props: { item: any; text: string; checked: boolean }) => any;\n \"option:append\"?: (props: { item: any }) => any;\n append?: (props: {}) => any;\n};\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BaseSwitchGroup',\n props: {\n autofocus: {},\n color: {},\n disabled: { type: Boolean },\n id: {},\n name: {},\n readonly: {},\n dependencies: {},\n depsDebounceTime: { default: 0 },\n enforceCoherence: { type: Boolean },\n hasErrors: { type: Boolean },\n hideLabel: { type: Boolean },\n itemText: {},\n itemValue: {},\n loadingText: { default: \"Caricamento...\" },\n matchStrategy: { default: 'string' },\n modelValueDebounceTime: { default: 0 },\n noDataText: { default: \"Nessun elemento da visualizzare\" },\n modelValue: {},\n items: { type: [Array, Function], default: () => [] },\n direction: { default: \"horizontal\" }\n },\n emits: [\"blur\", \"change\", \"click\", \"focus\", \"inactive\", \"input\", \"keydown\", \"mousedown\", \"mouseup\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n\nconst emit = __emit;\n\n\n\nconst container = ref<HTMLElement>();\nconst active = ref(false);\n\nconst { loading, options } = useOptions({\n dependencies: toRef(() => props.dependencies),\n depsDebounceTime: props.depsDebounceTime,\n disabled: toRef(() => props.disabled),\n emitter: (value) => emit(\"update:modelValue\", value),\n enforceCoherence: toRef(() => props.enforceCoherence),\n id: props.id,\n immediate: true,\n initialItems: toRef(() => props.items),\n itemText: props.itemText,\n itemValue: props.itemValue,\n matchStrategy: 'string',\n modelValue: toRef(() => props.modelValue),\n modelValueDebounceTime: props.modelValueDebounceTime,\n multiple: true,\n});\n\n/**\n * When selecting an option split behavior based on single or multiple selection\n */\nconst onOptionSelected = (option: Option) => {\n let valueToEmit;\n if (option.selected) {\n valueToEmit = props.modelValue\n .slice(0, option.selectedIndex)\n .concat(props.modelValue.slice(option.selectedIndex + 1));\n } else {\n valueToEmit = props.modelValue.concat(option.value);\n }\n emit(\"update:modelValue\", valueToEmit);\n};\n\nconst onChange = (event: Event, option: Option) => {\n emit(\"change\", event);\n onOptionSelected(option);\n};\n\nconst onFocus = (event: FocusEvent) => {\n emit(\"focus\", event);\n if (!active.value) {\n document.addEventListener(\"focusin\", onDocumentFocus, { passive: true });\n document.addEventListener(\"click\", onDocumentClick, { passive: true });\n active.value = true;\n }\n};\n\nconst eventListeners = {\n onBlur: (event: FocusEvent) => emit(\"blur\", event),\n onClick: (event: MouseEvent) => emit(\"click\", event),\n onFocus,\n onInput: (event: Event) => emit(\"input\", event),\n onKeydown: (event: KeyboardEvent) => emit(\"keydown\", event),\n onMousedown: (event: MouseEvent) => emit(\"mousedown\", event),\n onMouseup: (event: MouseEvent) => emit(\"mouseup\", event),\n};\n\nconst onDocumentFocus = (event: FocusEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nconst onDocumentClick = (event: MouseEvent) => {\n if (event.target instanceof HTMLElement) {\n if (!container.value?.contains(event.target)) {\n emit(\"inactive\");\n active.value = false;\n document.removeEventListener(\"focusin\", onDocumentFocus);\n document.removeEventListener(\"click\", onDocumentClick);\n }\n }\n};\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"span\", {\n class: _normalizeClass([\"bb-base-switch-group\", {\n 'bb-base-switch-group--errors': _ctx.hasErrors,\n 'bb-base-switch-group--horizontal': _ctx.direction === 'horizontal',\n 'bb-base-switch-group--vertical': _ctx.direction === 'vertical',\n }]),\n ref_key: \"container\",\n ref: container\n }, [\n _createElementVNode(\"span\", _hoisted_1, [\n _renderSlot(_ctx.$slots, \"prepend\"),\n (!_unref(options).length && _unref(loading))\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_2, [\n _renderSlot(_ctx.$slots, 'loading', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.loadingText), 1)\n ])\n ]))\n : (!_unref(options).length)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, [\n _renderSlot(_ctx.$slots, 'no-data', {}, () => [\n _createTextVNode(_toDisplayString(_ctx.noDataText), 1)\n ])\n ]))\n : _createCommentVNode(\"\", true),\n (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_unref(options), (option, index) => {\n return (_openBlock(), _createElementBlock(_Fragment, {\n key: option?.id || option.jsonValue\n }, [\n _renderSlot(_ctx.$slots, \"option:prepend\", {\n item: option.original\n }),\n _createElementVNode(\"label\", {\n class: _normalizeClass([\"bb-base-switch-group-option\", {\n 'bb-base-switch-group-option__selected': option.selected,\n }])\n }, [\n _createVNode(BaseSwitch, _mergeProps({\n autofocus: _ctx.autofocus && !index,\n checked: option.selected,\n color: _ctx.color,\n disabled: option.disabled,\n \"has-errors\": _ctx.hasErrors,\n id: option.id,\n name: _ctx.name,\n readonly: _ctx.readonly,\n onChange: (event) => onChange(event, option),\n \"true-value\": option.value\n }, eventListeners), _createSlots({ _: 2 }, [\n (_ctx.$slots.icon)\n ? {\n name: \"icon\",\n fn: _withCtx((data) => [\n _renderSlot(_ctx.$slots, \"icon\", _mergeProps({\n item: option.original,\n text: option.text\n }, data))\n ]),\n key: \"0\"\n }\n : undefined\n ]), 1040, [\"autofocus\", \"checked\", \"color\", \"disabled\", \"has-errors\", \"id\", \"name\", \"readonly\", \"onChange\", \"true-value\"]),\n _createElementVNode(\"span\", {\n class: _normalizeClass({\n 'bb-base-switch-group-option__text': true,\n 'bb-base-switch-group-option__text--hidden': _ctx.hideLabel,\n })\n }, [\n _renderSlot(_ctx.$slots, \"label\", {\n text: option.text,\n item: option.original,\n checked: option.selected\n }, () => [\n _createTextVNode(_toDisplayString(option.text), 1)\n ])\n ], 2)\n ], 2),\n _renderSlot(_ctx.$slots, \"option:append\", {\n item: option.original\n })\n ], 64))\n }), 128)),\n _renderSlot(_ctx.$slots, \"append\")\n ])\n ], 2))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_sfc_main","_defineComponent","__props","__emit","props","emit","container","ref","active","loading","options","useOptions","toRef","value","onOptionSelected","option","valueToEmit","onChange","event","eventListeners","onDocumentFocus","onDocumentClick","_a","_ctx","_cache","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_unref","_createTextVNode","_toDisplayString","_createCommentVNode","_Fragment","_renderList","index","_createVNode","BaseSwitch","_mergeProps","_createSlots","_withCtx","data"],"mappings":";;;;AAGA,MAAMA,IAAa,EAAE,OAAO,qCACtBC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GAkC4BC,IAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,WAAW,CAAC;AAAA,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AAA,GACE;AAAA,cACDM,EAAYN,EAAK,QAAQ,SAAS;AAAA,gBAChC,MAAMR,EAAO;AAAA,gBACb,MAAMA,EAAO;AAAA,gBACb,SAASA,EAAO;AAAA,cAAA,GACf,MAAM;AAAA,gBACPgB,EAAiBC,EAAiBjB,EAAO,IAAI,GAAG,CAAC;AAAA,cAAA,CAClD;AAAA,eACA,CAAC;AAAA,aACH,CAAC;AAAA,UACJc,EAAYN,EAAK,QAAQ,iBAAiB;AAAA,YACxC,MAAMR,EAAO;AAAA,UAAA,CACd;AAAA,WACA,EAAE,EACN,GAAG,GAAG;AAAA,QACPc,EAAYN,EAAK,QAAQ,QAAQ;AAAA,MAAA,CAClC;AAAA,OACA,CAAC;AAAA,EAEN;AAEA,CAAC;"}
|
package/dist/index36.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
import { defineComponent as h, ref as y, computed as r, onMounted as g, watch as w, nextTick as
|
2
|
-
const
|
1
|
+
import { defineComponent as h, ref as y, computed as r, onMounted as g, watch as w, nextTick as k, openBlock as x, createElementBlock as V, normalizeClass as B, renderSlot as l, createElementVNode as u, mergeProps as T } from "vue";
|
2
|
+
const v = { class: "bb-base-textarea__inner-container" }, E = ["autocomplete", "autofocus", "disabled", "id", "name", "placeholder", "readonly", "value"], M = /* @__PURE__ */ h({
|
3
3
|
__name: "BaseTextarea",
|
4
4
|
props: {
|
5
|
+
autocomplete: {},
|
5
6
|
autofocus: {},
|
6
7
|
disabled: { type: Boolean },
|
7
8
|
hasErrors: { type: Boolean },
|
@@ -13,8 +14,8 @@ const _ = { class: "bb-base-textarea__inner-container" }, v = ["autofocus", "dis
|
|
13
14
|
modelValue: {}
|
14
15
|
},
|
15
16
|
emits: ["blur", "change", "click", "focus", "input", "keydown", "mousedown", "mouseup", "update:modelValue"],
|
16
|
-
setup(d, { emit:
|
17
|
-
const a = d, o =
|
17
|
+
setup(d, { emit: p }) {
|
18
|
+
const a = d, o = p, t = y(null), i = r(() => ({
|
18
19
|
"bb-base-textarea": !0,
|
19
20
|
"bb-base-textarea--auto-grow": a.autoGrow,
|
20
21
|
"bb-base-textarea--disabled": a.disabled,
|
@@ -24,20 +25,20 @@ const _ = { class: "bb-base-textarea__inner-container" }, v = ["autofocus", "dis
|
|
24
25
|
() => a.modelValue ? a.modelValue : ""
|
25
26
|
);
|
26
27
|
g(() => {
|
27
|
-
a.autoGrow &&
|
28
|
+
a.autoGrow && n();
|
28
29
|
}), w(
|
29
30
|
() => a.modelValue,
|
30
31
|
() => {
|
31
|
-
a.autoGrow &&
|
32
|
+
a.autoGrow && k(n);
|
32
33
|
}
|
33
34
|
);
|
34
|
-
function
|
35
|
+
function m(e) {
|
35
36
|
if (e.stopPropagation(), e.target instanceof HTMLTextAreaElement) {
|
36
37
|
let s = e.target.value;
|
37
38
|
o("input", e), o("update:modelValue", s);
|
38
39
|
}
|
39
40
|
}
|
40
|
-
function
|
41
|
+
function b(e) {
|
41
42
|
e.stopPropagation(), e.target instanceof HTMLTextAreaElement && o("keydown", e);
|
42
43
|
}
|
43
44
|
const f = {
|
@@ -48,16 +49,17 @@ const _ = { class: "bb-base-textarea__inner-container" }, v = ["autofocus", "dis
|
|
48
49
|
onMousedown: (e) => o("mousedown", e),
|
49
50
|
onMouseup: (e) => o("mouseup", e)
|
50
51
|
};
|
51
|
-
function
|
52
|
+
function n() {
|
52
53
|
t.value && (t.value.style.height = "0px", t.value.style.height = `${t.value.scrollHeight}px`);
|
53
54
|
}
|
54
|
-
return (e, s) => (
|
55
|
-
class: B([
|
55
|
+
return (e, s) => (x(), V("span", {
|
56
|
+
class: B([i.value, "bb-base-textarea__container"])
|
56
57
|
}, [
|
57
|
-
|
58
|
-
u("span",
|
59
|
-
|
58
|
+
l(e.$slots, "prepend-outer"),
|
59
|
+
u("span", v, [
|
60
|
+
l(e.$slots, "prepend"),
|
60
61
|
u("textarea", T({
|
62
|
+
autocomplete: e.autocomplete,
|
61
63
|
autofocus: e.autofocus,
|
62
64
|
class: "bb-base-textarea__input",
|
63
65
|
disabled: e.disabled,
|
@@ -66,15 +68,15 @@ const _ = { class: "bb-base-textarea__inner-container" }, v = ["autofocus", "dis
|
|
66
68
|
placeholder: e.placeholder,
|
67
69
|
readonly: e.readonly,
|
68
70
|
value: c.value,
|
69
|
-
onInput:
|
70
|
-
onKeydown:
|
71
|
+
onInput: m,
|
72
|
+
onKeydown: b
|
71
73
|
}, f, {
|
72
74
|
ref_key: "textarea",
|
73
75
|
ref: t
|
74
|
-
}), null, 16,
|
75
|
-
|
76
|
+
}), null, 16, E),
|
77
|
+
l(e.$slots, "append")
|
76
78
|
]),
|
77
|
-
|
79
|
+
l(e.$slots, "append-outer")
|
78
80
|
], 2));
|
79
81
|
}
|
80
82
|
});
|