@milaboratories/uikit 2.15.42 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +27 -22
- package/.turbo/turbo-formatter$colon$check.log +2 -2
- package/.turbo/turbo-linter$colon$check.log +2 -2
- package/.turbo/turbo-types$colon$check.log +1 -1
- package/CHANGELOG.md +22 -0
- package/dist/components/DropdownListItem.js.map +1 -1
- package/dist/components/DropdownListItem.vue.d.ts.map +1 -1
- package/dist/components/DropdownListItem.vue2.js +22 -20
- package/dist/components/DropdownListItem.vue2.js.map +1 -1
- package/dist/components/PlAlert/PlAlert.vue.d.ts +1 -1
- package/dist/components/PlAlert/PlAlert.vue.d.ts.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue2.js +27 -27
- package/dist/components/PlAutocomplete/PlAutocomplete.vue2.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue2.js +17 -17
- package/dist/components/PlBtnSplit/PlBtnSplit.vue2.js +11 -11
- package/dist/components/PlColumnLabel/PlColumnLabel.js +8 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.js.map +1 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.style.js +8 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.style.js.map +1 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.vue.css +1 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.vue.d.ts +23 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.vue.d.ts.map +1 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.vue2.js +28 -0
- package/dist/components/PlColumnLabel/PlColumnLabel.vue2.js.map +1 -0
- package/dist/components/PlColumnLabel/index.d.ts +2 -0
- package/dist/components/PlColumnLabel/index.d.ts.map +1 -0
- package/dist/components/PlColumnLabel/index.js +1 -0
- package/dist/components/PlDropdown/PlDropdown.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.d.ts.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue2.js +124 -112
- package/dist/components/PlDropdown/PlDropdown.vue2.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue2.js +32 -32
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue2.js.map +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue2.js +30 -30
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue2.js +12 -12
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue2.js +7 -7
- package/dist/components/PlFileDialog/Remote.vue2.js +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue2.js +10 -10
- package/dist/components/PlFileInput/PlFileInput.vue2.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue2.js +5 -5
- package/dist/components/PlSearchField/PlSearchField.vue2.js +7 -7
- package/dist/components/PlTextArea/PlTextArea.vue2.js +11 -11
- package/dist/components/PlTextField/PlTextField.vue2.js +16 -16
- package/dist/components/Slider.vue2.js +7 -7
- package/dist/components/SliderRange.vue2.js +11 -11
- package/dist/components/SliderRangeTriple.vue2.js +9 -9
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +2 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -101
- package/dist/index.js.map +1 -1
- package/dist/utils/useLabelNotch.js +6 -6
- package/package.json +10 -5
- package/src/components/DropdownListItem.vue +2 -1
- package/src/components/PlColumnLabel/PlColumnLabel.vue +46 -0
- package/src/components/PlColumnLabel/index.ts +1 -0
- package/src/components/PlDropdown/PlDropdown.vue +13 -10
- package/src/helpers/utils.ts +1 -0
- package/src/index.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlDropdownLegacy.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/PlDropdownLegacy/PlDropdownLegacy.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: \"PlDropdown\",\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport \"./pl-dropdown-legacy.scss\";\nimport { computed, reactive, ref, unref, useSlots, watch, watchPostEffect } from \"vue\";\nimport { tap, tapIf } from \"../../helpers/functions\";\nimport { PlTooltip } from \"../PlTooltip\";\nimport DoubleContour from \"../../utils/DoubleContour.vue\";\nimport { useLabelNotch } from \"../../utils/useLabelNotch\";\nimport type { ListOption, ListOptionNormalized } from \"../../types\";\nimport { scrollIntoView } from \"../../helpers/dom\";\nimport { deepEqual } from \"../../helpers/objects\";\nimport DropdownListItem from \"../DropdownListItem.vue\";\nimport LongText from \"../LongText.vue\";\nimport { PlIcon16 } from \"../PlIcon16\";\nimport { PlMaskIcon24 } from \"../PlMaskIcon24\";\nimport { normalizeListOptions } from \"../../helpers/utils\";\nimport { getErrorMessage } from \"../../helpers/error.ts\";\nimport { PlSvg } from \"../PlSvg\";\nimport SvgRequired from \"../../assets/images/required.svg?raw\";\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: \"update:modelValue\", value: M | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current selected value of the dropdown.\n */\n modelValue: M;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * List of available options for the dropdown\n */\n options?: Readonly<ListOption<M>[]>;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: \"small\" | \"medium\";\n }>(),\n {\n label: \"\",\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: \"...\",\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: \"small\",\n options: undefined,\n },\n);\n\nconst slots = useSlots();\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst data = reactive({\n search: \"\",\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n filteredRef.value.findIndex((o) => deepEqual(o.value, props.modelValue)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst isLoadingOptions = computed(() => {\n return props.options === undefined;\n});\n\nconst isDisabled = computed(() => {\n if (isLoadingOptions.value) {\n return true;\n }\n\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, props.modelValue));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (props.modelValue !== undefined && selectedIndex.value === -1) {\n return \"The selected value is not one of the options\";\n }\n\n return undefined;\n});\n\nconst optionsRef = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst textValue = computed(() => {\n const options = unref(optionsRef);\n\n const item: ListOption | undefined = options.find((o) => deepEqual(o.value, props.modelValue));\n\n return item?.label || props.modelValue; // @todo show inner value?\n});\n\n// Native tooltip with the full selected value; the value layer itself has\n// `pointer-events: none`, so the title goes on the field wrapper.\nconst fieldTitle = computed(() => {\n if (data.open) return undefined;\n const v = textValue.value;\n return v !== undefined && v !== null && v !== \"\" ? String(v) : undefined;\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && props.modelValue) {\n return \"\";\n }\n\n return props.modelValue ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return props.modelValue !== undefined && props.modelValue !== null;\n});\n\nconst filteredRef = computed(() => {\n const options = optionsRef.value;\n\n if (data.search) {\n return options.filter((o: ListOptionNormalized) => {\n const search = data.search.toLowerCase();\n\n if (o.label.toLowerCase().includes(search)) {\n return true;\n }\n\n if (o.description && o.description.toLowerCase().includes(search)) {\n return true;\n }\n\n if (typeof o.value === \"string\") {\n return o.value.toLowerCase().includes(search);\n }\n\n return o.value === data.search;\n });\n }\n\n return options;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : \"0\"));\n\nconst selectOption = (v: M | undefined) => {\n emit(\"update:modelValue\", v);\n data.search = \"\";\n data.open = false;\n root?.value?.focus();\n};\n\nconst clear = () => emit(\"update:modelValue\", undefined);\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => (data.open = !data.open);\n\nconst onInputFocus = () => (data.open = true);\n\nconst onFocusOut = (event: FocusEvent) => {\n if (!root?.value?.contains(event.relatedTarget as Node | null)) {\n data.search = \"\";\n data.open = false;\n }\n};\n\nconst scrollIntoActive = () => {\n const $list = list.value;\n\n if (!$list) {\n return;\n }\n\n tapIf($list.querySelector(\".hovered-item\") as HTMLElement, (opt) => {\n scrollIntoView($list, opt);\n });\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (![\"ArrowDown\", \"ArrowUp\", \"Enter\", \"Escape\"].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === \"Enter\") {\n data.open = true;\n }\n return;\n }\n\n if (e.code === \"Escape\") {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(filteredRef);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === \"Enter\") {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === \"ArrowDown\" ? 1 : e.code === \"ArrowUp\" ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = filteredRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(root);\n\nwatch(() => props.modelValue, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : \"\"),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n data.search; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n scrollIntoActive();\n }\n});\n</script>\n\n<template>\n <div class=\"ui-dropdown__envelope\" data-testid=\"pl-dropdown-legacy\">\n <div\n ref=\"root\"\n :tabindex=\"tabindex\"\n class=\"ui-dropdown\"\n data-testid=\"pl-dropdown-legacy-control\"\n :class=\"{ open: data.open, error, disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"ui-dropdown__container\">\n <div class=\"ui-dropdown__field\" :title=\"fieldTitle\">\n <input\n ref=\"input\"\n v-model=\"data.search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n data-testid=\"pl-dropdown-legacy-input\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" data-testid=\"pl-dropdown-legacy-value\" @click=\"setFocusOnInput\">\n <LongText class=\"input-value\"> {{ textValue }} </LongText>\n </div>\n\n <div class=\"ui-dropdown__controls\">\n <PlMaskIcon24\n v-if=\"isLoadingOptions\"\n name=\"loading\"\n data-testid=\"pl-dropdown-legacy-loading\"\n />\n <PlIcon16\n v-if=\"clearable && hasValue\"\n class=\"clear\"\n data-testid=\"pl-dropdown-legacy-clear\"\n name=\"delete-clear\"\n @click.stop=\"clear\"\n />\n <slot name=\"append\" />\n <div\n v-if=\"arrowIconLarge\"\n class=\"arrow-icon\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n :class=\"[`icon-24 ${arrowIconLarge}`]\"\n @click.stop=\"toggleOpen\"\n />\n <div\n v-else-if=\"arrowIcon\"\n class=\"arrow-icon\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n :class=\"[`icon-16 ${arrowIcon}`]\"\n @click.stop=\"toggleOpen\"\n />\n <div\n v-else\n class=\"arrow-icon arrow-icon-default\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n @click.stop=\"toggleOpen\"\n />\n </div>\n </div>\n <label v-if=\"label\" data-testid=\"pl-dropdown-legacy-label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" data-testid=\"pl-dropdown-legacy-required\" />\n <span>{{ label }}</span>\n <PlTooltip\n v-if=\"slots.tooltip\"\n class=\"info\"\n position=\"top\"\n data-testid=\"pl-dropdown-legacy-tooltip\"\n >\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div\n v-if=\"data.open\"\n ref=\"list\"\n class=\"ui-dropdown__options\"\n data-testid=\"pl-dropdown-legacy-options\"\n >\n <DropdownListItem\n v-for=\"(item, index) in filteredRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n data-testid=\"pl-dropdown-legacy-option\"\n @click.stop=\"selectOption(item.value)\"\n />\n <div\n v-if=\"!filteredRef.length\"\n class=\"nothing-found\"\n data-testid=\"pl-dropdown-legacy-options-empty\"\n >\n Nothing found\n </div>\n </div>\n <DoubleContour class=\"ui-dropdown__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"ui-dropdown__error\" data-testid=\"pl-dropdown-legacy-error\">\n {{ computedError }}\n </div>\n <div\n v-else-if=\"isLoadingOptions && loadingOptionsHelper\"\n class=\"ui-dropdown__helper\"\n data-testid=\"pl-dropdown-legacy-helper\"\n >\n {{ loadingOptionsHelper }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-dropdown__helper\" data-testid=\"pl-dropdown-legacy-helper\">\n {{ helper }}\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBR,IAAM,IAAO,GAOP,IAAQ,GAuER,IAAQ,IAAU,EAElB,IAAO,GAA8B,EACrC,IAAO,GAA8B,EACrC,IAAQ,GAAmC,EAE3C,IAAO,EAAS;GACpB,QAAQ;GACR,aAAa;GACb,MAAM;GACP,CAAC,EAEI,WACJ,EACE,EAAY,MAAM,WAAW,MAAM,EAAU,EAAE,OAAO,EAAM,WAAW,CAAC,GACvE,MAAO,IAAI,IAAI,IAAI,EACrB,EAEG,WAAsB,EAAK,cAAc,IAAiB,EAE1D,IAAmB,QAChB,EAAM,YAAY,KAAA,EACzB,EAEI,IAAa,QACb,EAAiB,QACZ,KAGF,EAAM,SACb,EAEI,IAAgB,SACZ,EAAM,WAAW,EAAE,EAAE,WAAW,MAAM,EAAU,EAAE,OAAO,EAAM,WAAW,CAAC,CACnF,EAEI,IAAgB,QAAe;AAC/B,UAAiB,OAIrB;QAAI,EAAM,MACR,QAAO,EAAgB,EAAM,MAAM;AAGrC,QAAI,EAAM,eAAe,KAAA,KAAa,EAAc,UAAU,GAC5D,QAAO;;IAIT,EAEI,IAAa,QACjB,EAAqB,EAAM,WAAW,EAAE,CAAC,CAAC,KAAK,GAAK,OAAW;GAC7D,GAAG;GACH;GACA,YAAY,MAAU,EAAc;GACpC,UAAU,M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,eAAY;;IACtD,EAAwB,QAAA,MAAA,EAAf,EAAA,MAAK,EAAA,EAAA;IAEN,EAAA,EAAK,CAAC,WAAA,GAAA,EADd,EASY,EAAA,EAAA,EAAA;;KAPV,OAAM;KACN,UAAS;KACT,eAAY;;KAED,SAAO,QACO,CAAvB,EAAuB,EAAA,QAAA,UAAA,CAAA,CAAA;;;;GAKrB,EAAK,QAAA,GAAA,EADb,EAuBM,OAAA;;aArBA;IAAJ,KAAI;IACJ,OAAM;IACN,eAAY;eAEZ,EASE,IAAA,MAAA,EARwB,EAAA,QAAhB,GAAM,YADhB,EASE,GAAA;IAPC,KAAK;IACL,QAAQ;IACR,eAAa,EAAK;IAClB,cAAY,EAAK;IACjB,MAAM,EAAA;IACP,eAAY;IACX,SAAK,GAAA,MAAO,EAAa,EAAK,MAAK,EAAA,CAAA,OAAA,CAAA;;;;;;;gBAG7B,EAAA,MAAY,SAKrB,EAAA,IAAA,GAAA,IALqB,GAAA,EADrB,EAMM,OANN,GAIC,kBAED,EAAA,EAAA,IAAA,IAAA,EAAA,IAAA,GAAA;GAEF,EAA8C,GAAA,EAA/B,OAAM,wBAAsB,CAAA;gBAGpC,EAAA,SAAA,GAAA,EAAX,EAEM,OAFN,GAEM,EADD,EAAA,MAAa,EAAA,EAAA,IAGL,EAAA,SAAoB,EAAA,wBAAA,GAAA,EADjC,EAMM,OANN,GAMM,EADD,EAAA,qBAAoB,EAAA,EAAA,IAET,EAAA,UAAA,GAAA,EAAhB,EAEM,OAFN,GAEM,EADD,EAAA,OAAM,EAAA,EAAA,IAAA,EAAA,IAAA,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"PlDropdownLegacy.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/PlDropdownLegacy/PlDropdownLegacy.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * A component for selecting one value from a list of options\n */\nexport default {\n name: \"PlDropdown\",\n};\n</script>\n\n<script lang=\"ts\" setup generic=\"M = unknown\">\nimport \"./pl-dropdown-legacy.scss\";\nimport { computed, reactive, ref, unref, useSlots, watch, watchPostEffect } from \"vue\";\nimport { tap, tapIf } from \"../../helpers/functions\";\nimport { PlTooltip } from \"../PlTooltip\";\nimport DoubleContour from \"../../utils/DoubleContour.vue\";\nimport { useLabelNotch } from \"../../utils/useLabelNotch\";\nimport type { ListOption, ListOptionNormalized } from \"../../types\";\nimport { scrollIntoView } from \"../../helpers/dom\";\nimport { deepEqual } from \"../../helpers/objects\";\nimport DropdownListItem from \"../DropdownListItem.vue\";\nimport LongText from \"../LongText.vue\";\nimport { PlIcon16 } from \"../PlIcon16\";\nimport { PlMaskIcon24 } from \"../PlMaskIcon24\";\nimport { normalizeListOptions } from \"../../helpers/utils\";\nimport { getErrorMessage } from \"../../helpers/error.ts\";\nimport { PlSvg } from \"../PlSvg\";\nimport SvgRequired from \"../../assets/images/required.svg?raw\";\n\nconst emit = defineEmits<{\n /**\n * Emitted when the model value is updated.\n */\n (e: \"update:modelValue\", value: M | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current selected value of the dropdown.\n */\n modelValue: M;\n /**\n * The label text for the dropdown field (optional)\n */\n label?: string;\n /**\n * List of available options for the dropdown\n */\n options?: Readonly<ListOption<M>[]>;\n /**\n * A helper text displayed below the dropdown when there are no errors (optional).\n */\n helper?: string;\n /**\n * A helper text displayed below the dropdown when there are no options yet or options is undefined (optional).\n */\n loadingOptionsHelper?: string;\n /**\n * Error message displayed below the dropdown (optional)\n */\n error?: unknown;\n /**\n * Placeholder text shown when no value is selected.\n */\n placeholder?: string;\n /**\n * Enables a button to clear the selected value (default: false)\n */\n clearable?: boolean;\n /**\n * If `true`, the dropdown component is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the dropdown component is disabled and cannot be interacted with.\n */\n disabled?: boolean;\n /**\n * Custom icon (16px) class for the dropdown arrow (optional)\n */\n arrowIcon?: string;\n /**\n * Custom icon (24px) class for the dropdown arrow (optional)\n */\n arrowIconLarge?: string;\n /**\n * Option list item size\n */\n optionSize?: \"small\" | \"medium\";\n }>(),\n {\n label: \"\",\n helper: undefined,\n loadingOptionsHelper: undefined,\n error: undefined,\n placeholder: \"...\",\n clearable: false,\n required: false,\n disabled: false,\n arrowIcon: undefined,\n arrowIconLarge: undefined,\n optionSize: \"small\",\n options: undefined,\n },\n);\n\nconst slots = useSlots();\n\nconst root = ref<HTMLElement | undefined>();\nconst list = ref<HTMLElement | undefined>();\nconst input = ref<HTMLInputElement | undefined>();\n\nconst data = reactive({\n search: \"\",\n activeIndex: -1,\n open: false,\n});\n\nconst findActiveIndex = () =>\n tap(\n filteredRef.value.findIndex((o) => deepEqual(o.value, props.modelValue)),\n (v) => (v < 0 ? 0 : v),\n );\n\nconst updateActive = () => (data.activeIndex = findActiveIndex());\n\nconst isLoadingOptions = computed(() => {\n return props.options === undefined;\n});\n\nconst isDisabled = computed(() => {\n if (isLoadingOptions.value) {\n return true;\n }\n\n return props.disabled;\n});\n\nconst selectedIndex = computed(() => {\n return (props.options ?? []).findIndex((o) => deepEqual(o.value, props.modelValue));\n});\n\nconst computedError = computed(() => {\n if (isLoadingOptions.value) {\n return undefined;\n }\n\n if (props.error) {\n return getErrorMessage(props.error);\n }\n\n if (props.modelValue !== undefined && selectedIndex.value === -1) {\n return \"The selected value is not one of the options\";\n }\n\n return undefined;\n});\n\nconst optionsRef = computed(() =>\n normalizeListOptions(props.options ?? []).map((opt, index) => ({\n ...opt,\n index,\n isSelected: index === selectedIndex.value,\n isActive: index === data.activeIndex,\n })),\n);\n\nconst textValue = computed(() => {\n const options = unref(optionsRef);\n\n const item: ListOption | undefined = options.find((o) => deepEqual(o.value, props.modelValue));\n\n return item?.label || props.modelValue; // @todo show inner value?\n});\n\n// Native tooltip with the full selected value; the value layer itself has\n// `pointer-events: none`, so the title goes on the field wrapper.\nconst fieldTitle = computed(() => {\n if (data.open) return undefined;\n const v = textValue.value;\n return v !== undefined && v !== null && v !== \"\" ? String(v) : undefined;\n});\n\nconst computedPlaceholder = computed(() => {\n if (!data.open && props.modelValue) {\n return \"\";\n }\n\n return props.modelValue ? String(textValue.value) : props.placeholder;\n});\n\nconst hasValue = computed(() => {\n return props.modelValue !== undefined && props.modelValue !== null;\n});\n\nconst filteredRef = computed(() => {\n const options = optionsRef.value;\n\n if (data.search) {\n return options.filter((o: ListOptionNormalized) => {\n const search = data.search.toLowerCase();\n\n if (o.label.toLowerCase().includes(search)) {\n return true;\n }\n\n if (o.description && o.description.toLowerCase().includes(search)) {\n return true;\n }\n\n if (typeof o.value === \"string\") {\n return o.value.toLowerCase().includes(search);\n }\n\n return o.value === data.search;\n });\n }\n\n return options;\n});\n\nconst tabindex = computed(() => (isDisabled.value ? undefined : \"0\"));\n\nconst selectOption = (v: M | undefined) => {\n emit(\"update:modelValue\", v);\n data.search = \"\";\n data.open = false;\n root?.value?.focus();\n};\n\nconst clear = () => emit(\"update:modelValue\", undefined);\n\nconst setFocusOnInput = () => input.value?.focus();\n\nconst toggleOpen = () => (data.open = !data.open);\n\nconst onInputFocus = () => (data.open = true);\n\nconst onFocusOut = (event: FocusEvent) => {\n if (!root?.value?.contains(event.relatedTarget as Node | null)) {\n data.search = \"\";\n data.open = false;\n }\n};\n\nconst scrollIntoActive = () => {\n const $list = list.value;\n\n if (!$list) {\n return;\n }\n\n tapIf($list.querySelector(\".hovered-item\") as HTMLElement, (opt) => {\n scrollIntoView($list, opt);\n });\n};\n\nconst handleKeydown = (e: { code: string; preventDefault(): void }) => {\n if (![\"ArrowDown\", \"ArrowUp\", \"Enter\", \"Escape\"].includes(e.code)) {\n return;\n } else {\n e.preventDefault();\n }\n\n const { open, activeIndex } = data;\n\n if (!open) {\n if (e.code === \"Enter\") {\n data.open = true;\n }\n return;\n }\n\n if (e.code === \"Escape\") {\n data.open = false;\n root.value?.focus();\n }\n\n const filtered = unref(filteredRef);\n\n const { length } = filtered;\n\n if (!length) {\n return;\n }\n\n if (e.code === \"Enter\") {\n selectOption(filtered.find((it) => it.index === activeIndex)?.value);\n }\n\n const localIndex = filtered.findIndex((it) => it.index === activeIndex) ?? -1;\n\n const delta = e.code === \"ArrowDown\" ? 1 : e.code === \"ArrowUp\" ? -1 : 0;\n\n const newIndex = Math.abs(localIndex + delta + length) % length;\n\n data.activeIndex = filteredRef.value[newIndex].index ?? -1;\n};\n\nuseLabelNotch(root);\n\nwatch(() => props.modelValue, updateActive, { immediate: true });\n\nwatch(\n () => data.open,\n (open) => (open ? input.value?.focus() : \"\"),\n);\n\nwatchPostEffect(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n data.search; // to watch\n\n if (data.activeIndex >= 0 && data.open) {\n scrollIntoActive();\n }\n});\n</script>\n\n<template>\n <div class=\"ui-dropdown__envelope\" data-testid=\"pl-dropdown-legacy\">\n <div\n ref=\"root\"\n :tabindex=\"tabindex\"\n class=\"ui-dropdown\"\n data-testid=\"pl-dropdown-legacy-control\"\n :class=\"{ open: data.open, error, disabled: isDisabled }\"\n @keydown=\"handleKeydown\"\n @focusout=\"onFocusOut\"\n >\n <div class=\"ui-dropdown__container\">\n <div class=\"ui-dropdown__field\" :title=\"fieldTitle\">\n <input\n ref=\"input\"\n v-model=\"data.search\"\n type=\"text\"\n tabindex=\"-1\"\n :disabled=\"isDisabled\"\n :placeholder=\"computedPlaceholder\"\n spellcheck=\"false\"\n autocomplete=\"chrome-off\"\n data-testid=\"pl-dropdown-legacy-input\"\n @focus=\"onInputFocus\"\n />\n\n <div v-if=\"!data.open\" data-testid=\"pl-dropdown-legacy-value\" @click=\"setFocusOnInput\">\n <LongText class=\"input-value\"> {{ textValue }} </LongText>\n </div>\n\n <div class=\"ui-dropdown__controls\">\n <PlMaskIcon24\n v-if=\"isLoadingOptions\"\n name=\"loading\"\n data-testid=\"pl-dropdown-legacy-loading\"\n />\n <PlIcon16\n v-if=\"clearable && hasValue\"\n class=\"clear\"\n data-testid=\"pl-dropdown-legacy-clear\"\n name=\"delete-clear\"\n @click.stop=\"clear\"\n />\n <slot name=\"append\" />\n <div\n v-if=\"arrowIconLarge\"\n class=\"arrow-icon\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n :class=\"[`icon-24 ${arrowIconLarge}`]\"\n @click.stop=\"toggleOpen\"\n />\n <div\n v-else-if=\"arrowIcon\"\n class=\"arrow-icon\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n :class=\"[`icon-16 ${arrowIcon}`]\"\n @click.stop=\"toggleOpen\"\n />\n <div\n v-else\n class=\"arrow-icon arrow-icon-default\"\n data-testid=\"pl-dropdown-legacy-arrow\"\n @click.stop=\"toggleOpen\"\n />\n </div>\n </div>\n <label v-if=\"label\" data-testid=\"pl-dropdown-legacy-label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" data-testid=\"pl-dropdown-legacy-required\" />\n <span>{{ label }}</span>\n <PlTooltip\n v-if=\"slots.tooltip\"\n class=\"info\"\n position=\"top\"\n data-testid=\"pl-dropdown-legacy-tooltip\"\n >\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div\n v-if=\"data.open\"\n ref=\"list\"\n class=\"ui-dropdown__options\"\n data-testid=\"pl-dropdown-legacy-options\"\n >\n <DropdownListItem\n v-for=\"(item, index) in filteredRef\"\n :key=\"index\"\n :option=\"item\"\n :is-selected=\"item.isSelected\"\n :is-hovered=\"item.isActive\"\n :size=\"optionSize\"\n data-testid=\"pl-dropdown-legacy-option\"\n @click.stop=\"selectOption(item.value)\"\n />\n <div\n v-if=\"!filteredRef.length\"\n class=\"nothing-found\"\n data-testid=\"pl-dropdown-legacy-options-empty\"\n >\n Nothing found\n </div>\n </div>\n <DoubleContour class=\"ui-dropdown__contour\" />\n </div>\n </div>\n <div v-if=\"computedError\" class=\"ui-dropdown__error\" data-testid=\"pl-dropdown-legacy-error\">\n {{ computedError }}\n </div>\n <div\n v-else-if=\"isLoadingOptions && loadingOptionsHelper\"\n class=\"ui-dropdown__helper\"\n data-testid=\"pl-dropdown-legacy-helper\"\n >\n {{ loadingOptionsHelper }}\n </div>\n <div v-else-if=\"helper\" class=\"ui-dropdown__helper\" data-testid=\"pl-dropdown-legacy-helper\">\n {{ helper }}\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBR,IAAM,IAAO,GAOP,IAAQ,GAuER,IAAQ,IAAU,EAElB,IAAO,GAA8B,EACrC,IAAO,GAA8B,EACrC,IAAQ,GAAmC,EAE3C,IAAO,EAAS;GACpB,QAAQ;GACR,aAAa;GACb,MAAM;GACP,CAAC,EAEI,WACJ,EACE,EAAY,MAAM,WAAW,MAAM,EAAU,EAAE,OAAO,EAAM,WAAW,CAAC,GACvE,MAAO,IAAI,IAAI,IAAI,EACrB,EAEG,WAAsB,EAAK,cAAc,IAAiB,EAE1D,IAAmB,QAChB,EAAM,YAAY,KAAA,EACzB,EAEI,IAAa,QACb,EAAiB,QACZ,KAGF,EAAM,SACb,EAEI,IAAgB,SACZ,EAAM,WAAW,EAAE,EAAE,WAAW,MAAM,EAAU,EAAE,OAAO,EAAM,WAAW,CAAC,CACnF,EAEI,IAAgB,QAAe;AAC/B,UAAiB,OAIrB;QAAI,EAAM,MACR,QAAO,EAAgB,EAAM,MAAM;AAGrC,QAAI,EAAM,eAAe,KAAA,KAAa,EAAc,UAAU,GAC5D,QAAO;;IAIT,EAEI,IAAa,QACjB,EAAqB,EAAM,WAAW,EAAE,CAAC,CAAC,KAAK,GAAK,OAAW;GAC7D,GAAG;GACH;GACA,YAAY,MAAU,EAAc;GACpC,UAAU,MAAU,EAAK;GAC1B,EAAE,CACJ,EAEK,IAAY,QACA,EAAM,EAAW,CAEY,MAAM,MAAM,EAAU,EAAE,OAAO,EAAM,WAAW,CAAC,EAEjF,SAAS,EAAM,WAC5B,EAII,KAAa,QAAe;AAChC,OAAI,EAAK,KAAM;GACf,IAAM,IAAI,EAAU;AACp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AAA,CAAA,CAAA;;;;GAKrB,EAAK,QAAA,GAAA,EADb,EAuBM,OAAA;;aArBA;IAAJ,KAAI;IACJ,OAAM;IACN,eAAY;eAEZ,EASE,IAAA,MAAA,EARwB,EAAA,QAAhB,GAAM,YADhB,EASE,GAAA;IAPC,KAAK;IACL,QAAQ;IACR,eAAa,EAAK;IAClB,cAAY,EAAK;IACjB,MAAM,EAAA;IACP,eAAY;IACX,SAAK,GAAA,MAAO,EAAa,EAAK,MAAK,EAAA,CAAA,OAAA,CAAA;;;;;;;gBAG7B,EAAA,MAAY,SAKrB,EAAA,IAAA,GAAA,IALqB,GAAA,EADrB,EAMM,OANN,GAIC,kBAED,EAAA,EAAA,IAAA,IAAA,EAAA,IAAA,GAAA;GAEF,EAA8C,GAAA,EAA/B,OAAM,wBAAsB,CAAA;gBAGpC,EAAA,SAAA,GAAA,EAAX,EAEM,OAFN,GAEM,EADD,EAAA,MAAa,EAAA,EAAA,IAGL,EAAA,SAAoB,EAAA,wBAAA,GAAA,EADjC,EAMM,OANN,GAMM,EADD,EAAA,qBAAoB,EAAA,EAAA,IAET,EAAA,UAAA,GAAA,EAAhB,EAEM,OAFN,GAEM,EADD,EAAA,OAAM,EAAA,EAAA,IAAA,EAAA,IAAA,GAAA,CAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "
|
|
1
|
+
import { normalizeListOptions as e } from "../../helpers/utils.js";
|
|
2
2
|
import { tap as t, tapIf as n } from "../../helpers/functions.js";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { useClickOutside as r } from "../../composition/useClickOutside.js";
|
|
4
|
+
import i from "../DropdownListItem.js";
|
|
5
5
|
import { scrollIntoView as a } from "../../helpers/dom.js";
|
|
6
6
|
import { deepEqual as o } from "../../helpers/objects.js";
|
|
7
7
|
import { useElementPosition as ee } from "../../composition/usePosition.js";
|
|
@@ -51,8 +51,8 @@ var N = {
|
|
|
51
51
|
return R.isOpen && e.push("open"), L.disabled && e.push("disabled"), e.join(" ");
|
|
52
52
|
}), H = C(""), U = te(D(L, "options"), H), W = d(() => !!(L.clearable && R.isOpen && L.modelValue && G.value)), G = d(() => {
|
|
53
53
|
if (L.modelValue !== void 0) {
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
54
|
+
let t = J();
|
|
55
|
+
if (t !== -1) return e(L.options)[t].label;
|
|
56
56
|
}
|
|
57
57
|
return "";
|
|
58
58
|
}), K = C(G.value);
|
|
@@ -60,7 +60,7 @@ var N = {
|
|
|
60
60
|
K.value = e;
|
|
61
61
|
});
|
|
62
62
|
let q = d(() => R.isOpen && H.value && H.value.length >= G.value.length - 1 ? H.value : G.value || "...");
|
|
63
|
-
|
|
63
|
+
r(z, () => {
|
|
64
64
|
L.mode === "list" && (R.isOpen = !1);
|
|
65
65
|
}), A(() => K.value, (e) => {
|
|
66
66
|
G.value === e ? H.value = "" : H.value = e;
|
|
@@ -132,7 +132,7 @@ var N = {
|
|
|
132
132
|
}), ee(z, (e) => {
|
|
133
133
|
let t = e.top + e.height + 2;
|
|
134
134
|
t + R.optionsHeight > e.clientHeight ? $.top = e.top - R.optionsHeight - 2 + "px" : $.top = t + "px", $.left = e.left + "px";
|
|
135
|
-
}), (
|
|
135
|
+
}), (e, t) => (x(), m("div", {
|
|
136
136
|
ref_key: "container",
|
|
137
137
|
ref: z,
|
|
138
138
|
tabindex: "0",
|
|
@@ -145,7 +145,7 @@ var N = {
|
|
|
145
145
|
h("div", N, E(L?.prefix), 1),
|
|
146
146
|
g(s, {
|
|
147
147
|
modelValue: K.value,
|
|
148
|
-
"onUpdate:modelValue":
|
|
148
|
+
"onUpdate:modelValue": t[0] ||= (e) => K.value = e,
|
|
149
149
|
placeholder: q.value,
|
|
150
150
|
disabled: L.disabled,
|
|
151
151
|
class: "pl-line-dropdown__input"
|
|
@@ -171,28 +171,28 @@ var N = {
|
|
|
171
171
|
class: "pl-line-dropdown__items",
|
|
172
172
|
"data-testid": "pl-dropdown-line-options",
|
|
173
173
|
onFocusout: Z,
|
|
174
|
-
onClick:
|
|
175
|
-
}, [(x(!0), m(l, null, w(O(U), (
|
|
176
|
-
key:
|
|
177
|
-
item:
|
|
174
|
+
onClick: t[1] ||= M(() => {}, ["stop"])
|
|
175
|
+
}, [(x(!0), m(l, null, w(O(U), (t, n) => T(e.$slots, "item", {
|
|
176
|
+
key: n,
|
|
177
|
+
item: t,
|
|
178
178
|
textItem: "text",
|
|
179
|
-
isSelected: X(
|
|
180
|
-
isHovered: R.activeOption ==
|
|
181
|
-
onClick: M((e) => Y(
|
|
182
|
-
}, () => [g(
|
|
183
|
-
option:
|
|
179
|
+
isSelected: X(t),
|
|
180
|
+
isHovered: R.activeOption == n,
|
|
181
|
+
onClick: M((e) => Y(t), ["stop"])
|
|
182
|
+
}, () => [g(i, {
|
|
183
|
+
option: t,
|
|
184
184
|
"text-item": "text",
|
|
185
|
-
"is-selected": X(
|
|
186
|
-
"is-hovered": R.activeOption ==
|
|
185
|
+
"is-selected": X(t),
|
|
186
|
+
"is-hovered": R.activeOption == n,
|
|
187
187
|
size: "medium",
|
|
188
188
|
"data-testid": "pl-dropdown-line-option",
|
|
189
|
-
onClick: M((e) => Y(
|
|
189
|
+
onClick: M((e) => Y(t), ["stop"])
|
|
190
190
|
}, null, 8, [
|
|
191
191
|
"option",
|
|
192
192
|
"is-selected",
|
|
193
193
|
"is-hovered",
|
|
194
194
|
"onClick"
|
|
195
|
-
])])), 128)), O(U).length === 0 ? (x(), m("div", ie, [...
|
|
195
|
+
])])), 128)), O(U).length === 0 ? (x(), m("div", ie, [...t[3] ||= [h("div", { class: "pl-line-dropdown__no-item-title text-s" }, " Didn't find anything that matched ", -1)]])) : p("", !0)], 36)) : L.mode === "tabs" ? (x(), m("div", {
|
|
196
196
|
key: 1,
|
|
197
197
|
ref_key: "list",
|
|
198
198
|
ref: B,
|
|
@@ -201,25 +201,25 @@ var N = {
|
|
|
201
201
|
class: "pl-line-dropdown__items-tabs",
|
|
202
202
|
"data-testid": "pl-dropdown-line-options",
|
|
203
203
|
onFocusout: Z,
|
|
204
|
-
onClick:
|
|
205
|
-
}, [(x(!0), m(l, null, w(O(U), (
|
|
204
|
+
onClick: t[2] ||= M(() => {}, ["stop"])
|
|
205
|
+
}, [(x(!0), m(l, null, w(O(U), (t, n) => T(e.$slots, "item", {
|
|
206
206
|
key: n,
|
|
207
|
-
item:
|
|
208
|
-
isSelected: X(
|
|
207
|
+
item: t,
|
|
208
|
+
isSelected: X(t),
|
|
209
209
|
isHovered: R.activeOption == n,
|
|
210
|
-
onClick: M((
|
|
210
|
+
onClick: M((e) => Y(t), ["stop"])
|
|
211
211
|
}, () => [g(c, {
|
|
212
|
-
option:
|
|
213
|
-
"is-selected": X(
|
|
212
|
+
option: t,
|
|
213
|
+
"is-selected": X(t),
|
|
214
214
|
"is-hovered": R.activeOption == n,
|
|
215
215
|
"data-testid": "pl-dropdown-line-option",
|
|
216
|
-
onClick: M((
|
|
216
|
+
onClick: M((e) => Y(t), ["stop"])
|
|
217
217
|
}, null, 8, [
|
|
218
218
|
"option",
|
|
219
219
|
"is-selected",
|
|
220
220
|
"is-hovered",
|
|
221
221
|
"onClick"
|
|
222
|
-
])])), 128)), O(U).length === 0 ? (x(), m("div", P, [...
|
|
222
|
+
])])), 128)), O(U).length === 0 ? (x(), m("div", P, [...t[4] ||= [h("div", { class: "pl-line-dropdown__no-item-title text-s" }, " Didn't find anything that matched ", -1)]])) : p("", !0)], 36)) : p("", !0)])) : p("", !0)
|
|
223
223
|
], 34));
|
|
224
224
|
}
|
|
225
225
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "../
|
|
1
|
+
import e from "../PlSvg/PlSvg.js";
|
|
2
|
+
import "../PlSvg/index.js";
|
|
2
3
|
import { normalizeListOptions as t } from "../../helpers/utils.js";
|
|
3
4
|
import n from "../PlTooltip/PlTooltip.js";
|
|
4
5
|
import "../PlTooltip/index.js";
|
|
5
|
-
import
|
|
6
|
-
import i from "
|
|
7
|
-
import "../PlSvg/index.js";
|
|
6
|
+
import r from "../DropdownListItem.js";
|
|
7
|
+
import { getErrorMessage as i } from "../../helpers/error.js";
|
|
8
8
|
import a from "../PlIcon24/PlIcon24.js";
|
|
9
9
|
import "../PlIcon24/index.js";
|
|
10
10
|
import o from "../../utils/DoubleContour.js";
|
|
@@ -176,7 +176,7 @@ var ce = ["tabindex"], le = { class: "pl-dropdown-multi__container" }, ue = { cl
|
|
|
176
176
|
])
|
|
177
177
|
]),
|
|
178
178
|
y.label ? (x(), g("label", A, [
|
|
179
|
-
y.required ? (x(), m(D(
|
|
179
|
+
y.required ? (x(), m(D(e), {
|
|
180
180
|
key: 0,
|
|
181
181
|
uri: D(ee),
|
|
182
182
|
"data-testid": "pl-dropdown-multi-required"
|
|
@@ -215,16 +215,16 @@ var ce = ["tabindex"], le = { class: "pl-dropdown-multi__container" }, ue = { cl
|
|
|
215
215
|
default: O(() => [v(E(e.label), 1)]),
|
|
216
216
|
_: 2
|
|
217
217
|
}, 1032, ["class", "onClose"]))), 128))]),
|
|
218
|
-
(x(!0), g(f, null, w(q.value, (
|
|
219
|
-
key:
|
|
220
|
-
option:
|
|
218
|
+
(x(!0), g(f, null, w(q.value, (e, t) => (x(), m(r, {
|
|
219
|
+
key: t,
|
|
220
|
+
option: e,
|
|
221
221
|
"text-item": "text",
|
|
222
|
-
"is-selected":
|
|
223
|
-
"is-hovered": U.activeOption ==
|
|
222
|
+
"is-selected": e.selected,
|
|
223
|
+
"is-hovered": U.activeOption == t,
|
|
224
224
|
size: "medium",
|
|
225
225
|
"use-checkbox": "",
|
|
226
226
|
"data-testid": "pl-dropdown-multi-option",
|
|
227
|
-
onClick: k((
|
|
227
|
+
onClick: k((t) => X(e.value), ["stop"])
|
|
228
228
|
}, null, 8, [
|
|
229
229
|
"option",
|
|
230
230
|
"is-selected",
|
|
@@ -239,7 +239,7 @@ var ce = ["tabindex"], le = { class: "pl-dropdown-multi__container" }, ue = { cl
|
|
|
239
239
|
class: "pl-dropdown-multi__contour",
|
|
240
240
|
"group-position": y.groupPosition
|
|
241
241
|
}, null, 8, ["group-position"])
|
|
242
|
-
])], 42, ce), y.error ? (x(), g("div", N, E(D(
|
|
242
|
+
])], 42, ce), y.error ? (x(), g("div", N, E(D(i)(y.error)), 1)) : y.helper ? (x(), g("div", P, E(y.helper), 1)) : h("", !0)]));
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
//#endregion
|
|
@@ -61,8 +61,8 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
61
61
|
label: string;
|
|
62
62
|
error: undefined;
|
|
63
63
|
modelValue: ModelRef[] | undefined;
|
|
64
|
-
required: boolean;
|
|
65
64
|
disabled: boolean;
|
|
65
|
+
required: boolean;
|
|
66
66
|
helper: string;
|
|
67
67
|
placeholder: string;
|
|
68
68
|
missingValueLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlDropdownMultiRef.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlDropdownMultiRef/PlDropdownMultiRef.vue"],"names":[],"mappings":"AA2FA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAevD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,UAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAChC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QA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;;;;aA9HF,QAAQ,CAAC,SAAS,EAAE,CAAC;WAJvB,MAAM;;gBAJF,QAAQ,EAAE,GAAG,SAAS;cAiCvB,OAAO;cAJP,OAAO;YAjBT,MAAM;iBAQD,MAAM;uBAKA,MAAM;6EAiH5B,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import "../PlIcon24/index.js";
|
|
3
|
-
import t from "../PlIcon16/PlIcon16.js";
|
|
1
|
+
import e from "../PlIcon16/PlIcon16.js";
|
|
4
2
|
import "../PlIcon16/index.js";
|
|
3
|
+
import t from "../PlIcon24/PlIcon24.js";
|
|
4
|
+
import "../PlIcon24/index.js";
|
|
5
5
|
import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, renderSlot as d, unref as f, useSlots as p, withModifiers as m } from "vue";
|
|
6
6
|
//#region src/components/PlElementList/PlElementListItem.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var h = ["data-draggable"], g = /* @__PURE__ */ c({
|
|
@@ -79,7 +79,7 @@ var h = ["data-draggable"], g = /* @__PURE__ */ c({
|
|
|
79
79
|
{ [n.$style.disable]: !_.isDraggable }
|
|
80
80
|
]),
|
|
81
81
|
"data-draggable": _.isDraggable
|
|
82
|
-
}, [s(f(
|
|
82
|
+
}, [s(f(e), { name: "drag-dots" })], 10, h)) : i("", !0), c.isExpandable ? (u(), r(f(e), {
|
|
83
83
|
key: 1,
|
|
84
84
|
"data-testid": "pl-element-list-item-expand",
|
|
85
85
|
class: l([n.$style.contentChevron, { [n.$style.opened]: _.isExpanded }]),
|
|
@@ -105,7 +105,7 @@ var h = ["data-draggable"], g = /* @__PURE__ */ c({
|
|
|
105
105
|
{ [n.$style.disable]: !_.isToggable }
|
|
106
106
|
]),
|
|
107
107
|
onClick: p[0] ||= m((e) => S("toggle", _.item, _.index), ["stop"])
|
|
108
|
-
}, [s(f(
|
|
108
|
+
}, [s(f(t), {
|
|
109
109
|
name: _.isToggled === !0 ? "view-hide" : "view-show",
|
|
110
110
|
size: "16"
|
|
111
111
|
}, null, 8, ["name"])], 2)) : i("", !0),
|
|
@@ -121,7 +121,7 @@ var h = ["data-draggable"], g = /* @__PURE__ */ c({
|
|
|
121
121
|
}
|
|
122
122
|
]),
|
|
123
123
|
onClick: p[1] ||= m((e) => S("pin", _.item, _.index), ["stop"])
|
|
124
|
-
}, [s(f(
|
|
124
|
+
}, [s(f(t), {
|
|
125
125
|
name: "pin",
|
|
126
126
|
size: "16"
|
|
127
127
|
})], 2)) : i("", !0),
|
|
@@ -130,7 +130,7 @@ var h = ["data-draggable"], g = /* @__PURE__ */ c({
|
|
|
130
130
|
"data-testid": "pl-element-list-item-remove",
|
|
131
131
|
class: l([n.$style.action, n.$style.clickable]),
|
|
132
132
|
onClick: p[2] ||= m((e) => S("remove", _.item, _.index), ["stop"])
|
|
133
|
-
}, [s(f(
|
|
133
|
+
}, [s(f(e), { name: "close" })], 2)) : i("", !0)
|
|
134
134
|
], 2)
|
|
135
135
|
], 2), y.value && _.isExpanded ? (u(), a("div", {
|
|
136
136
|
key: 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEventListener as e } from "../../composition/useEventListener.js";
|
|
2
2
|
import t from "../PlIcon16/PlIcon16.js";
|
|
3
|
-
import "../PlMaskIcon16/index.js";
|
|
4
3
|
import "../PlIcon16/index.js";
|
|
4
|
+
import "../PlMaskIcon16/index.js";
|
|
5
5
|
import n from "../PlDropdown/PlDropdown.js";
|
|
6
6
|
import "../PlDropdown/index.js";
|
|
7
7
|
import r from "../PlSearchField/PlSearchField.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import "../PlTooltip/index.js";
|
|
3
|
-
import { getErrorMessage as t } from "../../helpers/error.js";
|
|
4
|
-
import n from "../PlSvg/PlSvg.js";
|
|
1
|
+
import e from "../PlSvg/PlSvg.js";
|
|
5
2
|
import "../PlSvg/index.js";
|
|
3
|
+
import t from "../PlTooltip/PlTooltip.js";
|
|
4
|
+
import "../PlTooltip/index.js";
|
|
5
|
+
import { getErrorMessage as n } from "../../helpers/error.js";
|
|
6
6
|
import r from "../PlIcon24/PlIcon24.js";
|
|
7
7
|
import i from "../../utils/DoubleContour.js";
|
|
8
8
|
import { useLabelNotch as a } from "../../utils/useLabelNotch.js";
|
|
@@ -13,7 +13,7 @@ import "../PlFileDialog/index.js";
|
|
|
13
13
|
import './pl-file-input.css';/* empty css */
|
|
14
14
|
import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, normalizeClass as _, normalizeStyle as v, openBlock as y, reactive as b, ref as x, renderSlot as S, toDisplayString as C, unref as w, useSlots as T, watch as E, withCtx as D, withKeys as O, withModifiers as k } from "vue";
|
|
15
15
|
import { prettyBytes as A } from "@milaboratories/helpers";
|
|
16
|
-
import { getFileNameFromHandle as
|
|
16
|
+
import { getFileNameFromHandle as j, getFilePathFromHandle as ee } from "@platforma-sdk/model";
|
|
17
17
|
//#region src/components/PlFileInput/PlFileInput.vue?vue&type=script&setup=true&lang.ts
|
|
18
18
|
var M = {
|
|
19
19
|
key: 0,
|
|
@@ -64,7 +64,7 @@ var M = {
|
|
|
64
64
|
} catch (t) {
|
|
65
65
|
return R.error = t instanceof Error ? t.message : String(t), e;
|
|
66
66
|
}
|
|
67
|
-
}, U = l(() => H(V.modelValue,
|
|
67
|
+
}, U = l(() => H(V.modelValue, j)), W = l(() => H(V.modelValue, ee)), G = l(() => V.progress && !V.progress.done), K = l(() => V.progress && V.progress.done), q = l(() => n(R.error, V.error)), J = l(() => typeof q.value == "string"), Y = l(() => {
|
|
68
68
|
let { status: e, done: t } = V.progress ?? {};
|
|
69
69
|
return !e || !e.bytesTotal ? "" : e.bytesProcessed && !t ? A(e.bytesProcessed, {}) + " / " + A(e.bytesTotal, {}) : A(e.bytesTotal, {});
|
|
70
70
|
}), X = l(() => {
|
|
@@ -77,7 +77,7 @@ var M = {
|
|
|
77
77
|
}, te = () => B("update:modelValue", void 0);
|
|
78
78
|
E(() => V.modelValue, () => R.error = void 0, { immediate: !0 });
|
|
79
79
|
let $ = x();
|
|
80
|
-
return V.cellStyle || a($), (
|
|
80
|
+
return V.cellStyle || a($), (n, a) => (y(), f("div", {
|
|
81
81
|
class: _([{
|
|
82
82
|
"pl-file-input__cell-style": !!g.cellStyle,
|
|
83
83
|
"has-file": !!U.value
|
|
@@ -102,19 +102,19 @@ var M = {
|
|
|
102
102
|
"data-testid": "pl-file-input-progress"
|
|
103
103
|
}, null, 4),
|
|
104
104
|
!g.cellStyle && g.label ? (y(), f("label", M, [
|
|
105
|
-
g.required ? (y(), u(w(
|
|
105
|
+
g.required ? (y(), u(w(e), {
|
|
106
106
|
key: 0,
|
|
107
107
|
uri: w(o),
|
|
108
108
|
"data-testid": "pl-file-input-required"
|
|
109
109
|
}, null, 8, ["uri"])) : d("", !0),
|
|
110
110
|
p("span", null, C(g.label), 1),
|
|
111
|
-
w(z).tooltip || W.value ? (y(), u(w(
|
|
111
|
+
w(z).tooltip || W.value ? (y(), u(w(t), {
|
|
112
112
|
key: 1,
|
|
113
113
|
class: "info",
|
|
114
114
|
position: "top",
|
|
115
115
|
"data-testid": "pl-file-input-tooltip"
|
|
116
116
|
}, {
|
|
117
|
-
tooltip: D(() => [w(z).tooltip ? S(
|
|
117
|
+
tooltip: D(() => [w(z).tooltip ? S(n.$slots, "tooltip", { key: 0 }) : (y(), f(c, { key: 1 }, [m(C(W.value), 1)], 64))]),
|
|
118
118
|
_: 3
|
|
119
119
|
})) : d("", !0)
|
|
120
120
|
], 512)) : d("", !0),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlFileInput.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/PlFileInput/PlFileInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport \"./pl-file-input.scss\";\n\nimport { prettyBytes } from \"@milaboratories/helpers\";\nimport type { ImportFileHandle, ImportProgress } from \"@platforma-sdk/model\";\nimport { getFileNameFromHandle, getFilePathFromHandle } from \"@platforma-sdk/model\";\nimport { computed, reactive, ref, useSlots, watch } from \"vue\";\nimport { getErrorMessage } from \"../../helpers/error.ts\";\nimport type { ImportedFiles } from \"../../types\";\nimport DoubleContour from \"../../utils/DoubleContour.vue\";\nimport { useLabelNotch } from \"../../utils/useLabelNotch\";\nimport { PlFileDialog } from \"../PlFileDialog\";\nimport { PlMaskIcon24 } from \"../PlMaskIcon24\";\nimport { PlTooltip } from \"../PlTooltip\";\n\nimport SvgRequired from \"../../assets/images/required.svg?raw\";\nimport { PlSvg } from \"../PlSvg\";\n\nconst data = reactive({\n fileDialogOpen: false,\n error: undefined as undefined | string,\n});\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n (e: \"update:modelValue\", value: ImportFileHandle | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current import file handle.\n */\n modelValue: ImportFileHandle | undefined;\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the component border is dashed.\n */\n dashed?: boolean;\n /**\n * Allowed file extensions (should start with `.`)\n */\n extensions?: string[];\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * Import/Upload progress\n */\n progress?: ImportProgress;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * Remove rounded border and change styles\n */\n cellStyle?: boolean;\n /**\n * File dialog title\n */\n fileDialogTitle?: string;\n /**\n * If `true`, the file dialog window closes when clicking outside the modal area (default: `true`)\n */\n fileDialogCloseOnOutsideClick?: boolean;\n }>(),\n {\n label: undefined,\n extensions: undefined,\n fileDialogTitle: undefined,\n placeholder: undefined,\n progress: undefined,\n error: undefined,\n helper: undefined,\n cellStyle: false,\n fileDialogCloseOnOutsideClick: true,\n },\n);\n\nconst tryValue = <T extends ImportFileHandle>(\n v: T | undefined,\n cb: (v: T) => string | undefined,\n) => {\n if (!v) {\n return undefined;\n }\n\n try {\n return cb(v);\n } catch (err) {\n data.error = err instanceof Error ? err.message : String(err);\n return v;\n }\n};\n\nconst fileName = computed(() => tryValue(props.modelValue, getFileNameFromHandle));\n\nconst filePath = computed(() => tryValue(props.modelValue, getFilePathFromHandle));\n\nconst isUploading = computed(() => props.progress && !props.progress.done);\n\nconst isUploaded = computed(() => props.progress && props.progress.done);\n\nconst computedErrorMessage = computed(() => getErrorMessage(data.error, props.error));\n\nconst hasErrors = computed(() => typeof computedErrorMessage.value === \"string\");\n\nconst uploadStats = computed(() => {\n const { status, done } = props.progress ?? {};\n\n if (!status || !status.bytesTotal) {\n return \"\";\n }\n\n if (status.bytesProcessed && !done) {\n return prettyBytes(status.bytesProcessed, {}) + \" / \" + prettyBytes(status.bytesTotal, {});\n }\n\n return prettyBytes(status.bytesTotal, {});\n});\n\nconst progressStyle = computed(() => {\n const { progress } = props;\n\n if (!progress) {\n return {};\n }\n\n return {\n width: progress.done ? \"100%\" : Math.round((progress.status?.progress ?? 0) * 100) + \"%\",\n };\n});\n\nconst openFileDialog = () => {\n data.fileDialogOpen = true;\n};\n\nconst onImport = (v: ImportedFiles) => {\n if (v.files.length) {\n emit(\"update:modelValue\", v.files[0]);\n }\n};\n\nconst clear = () => emit(\"update:modelValue\", undefined);\n\nwatch(\n () => props.modelValue,\n () => (data.error = undefined),\n { immediate: true },\n);\n\nconst rootRef = ref();\n\nif (!props.cellStyle) {\n useLabelNotch(rootRef);\n}\n</script>\n\n<template>\n <div\n :class=\"{ 'pl-file-input__cell-style': !!cellStyle, 'has-file': !!fileName }\"\n class=\"pl-file-input__envelope\"\n data-testid=\"pl-file-input\"\n >\n <div\n ref=\"rootRef\"\n :class=\"{ dashed, error: hasErrors }\"\n class=\"pl-file-input\"\n data-testid=\"pl-file-input-control\"\n tabindex=\"0\"\n @keyup.enter=\"openFileDialog\"\n @click.stop=\"openFileDialog\"\n >\n <div\n :style=\"progressStyle\"\n class=\"pl-file-input__progress\"\n data-testid=\"pl-file-input-progress\"\n />\n <label v-if=\"!cellStyle && label\" ref=\"label\" data-testid=\"pl-file-input-label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" data-testid=\"pl-file-input-required\" />\n <span>{{ label }}</span>\n <PlTooltip\n v-if=\"slots.tooltip || filePath\"\n class=\"info\"\n position=\"top\"\n data-testid=\"pl-file-input-tooltip\"\n >\n <template #tooltip>\n <slot v-if=\"slots.tooltip\" name=\"tooltip\" />\n <template v-else>{{ filePath }}</template>\n </template>\n </PlTooltip>\n </label>\n <PlMaskIcon24 v-if=\"hasErrors\" name=\"restart\" data-testid=\"pl-file-input-status-icon\" />\n <PlMaskIcon24\n v-else-if=\"isUploading\"\n name=\"cloud-upload\"\n data-testid=\"pl-file-input-status-icon\"\n />\n <PlMaskIcon24 v-else-if=\"isUploaded\" name=\"success\" data-testid=\"pl-file-input-status-icon\" />\n <PlMaskIcon24 v-else name=\"paper-clip\" data-testid=\"pl-file-input-status-icon\" />\n <div\n :data-placeholder=\"placeholder ?? 'Choose file'\"\n class=\"pl-file-input__filename\"\n data-testid=\"pl-file-input-filename\"\n >\n {{ fileName }}\n </div>\n <div v-if=\"uploadStats\" class=\"pl-file-input__stats\" data-testid=\"pl-file-input-stats\">\n {{ uploadStats }}\n </div>\n <PlMaskIcon24\n v-if=\"modelValue\"\n class=\"pl-file-input__clear\"\n data-testid=\"pl-file-input-clear\"\n name=\"close\"\n @click.stop=\"clear\"\n />\n <DoubleContour class=\"pl-file-input__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-file-input__error\" data-testid=\"pl-file-input-error\">\n {{ computedErrorMessage }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-file-input__helper\" data-testid=\"pl-file-input-helper\">\n {{ helper }}\n </div>\n <!-- Teleported to <body> by PlDialogModal; kept inside so the component has a single root. -->\n <PlFileDialog\n v-model=\"data.fileDialogOpen\"\n :close-on-outside-click=\"fileDialogCloseOnOutsideClick\"\n :extensions=\"extensions\"\n :title=\"fileDialogTitle\"\n @import:files=\"onImport\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBA,IAAM,IAAO,EAAS;GACpB,gBAAgB;GAChB,OAAO,KAAA;GACR,CAAC,EAEI,IAAQ,GAAU,EAElB,IAAO,GAIP,IAAQ,GAgER,KACJ,GACA,MACG;AACE,SAIL,KAAI;AACF,WAAO,EAAG,EAAE;YACL,GAAK;AAEZ,WADA,EAAK,QAAQ,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,EACtD;;KAIL,IAAW,QAAe,EAAS,EAAM,YAAY,GAAsB,CAAC,EAE5E,IAAW,QAAe,EAAS,EAAM,YAAY,EAAsB,CAAC,EAE5E,IAAc,QAAe,EAAM,YAAY,CAAC,EAAM,SAAS,KAAK,EAEpE,IAAa,QAAe,EAAM,YAAY,EAAM,SAAS,KAAK,EAElE,IAAuB,QAAe,EAAgB,EAAK,OAAO,EAAM,MAAM,CAAC,EAE/E,IAAY,QAAe,OAAO,EAAqB,SAAU,SAAS,EAE1E,IAAc,QAAe;GACjC,IAAM,EAAE,WAAQ,YAAS,EAAM,YAAY,EAAE;AAU7C,UARI,CAAC,KAAU,CAAC,EAAO,aACd,KAGL,EAAO,kBAAkB,CAAC,IACrB,EAAY,EAAO,gBAAgB,EAAE,CAAC,GAAG,QAAQ,EAAY,EAAO,YA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BAAwB,EAAA;IACxB,YAAY,EAAA;IACZ,OAAO,EAAA;IACP,kBAAc"}
|
|
1
|
+
{"version":3,"file":"PlFileInput.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../src/components/PlFileInput/PlFileInput.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport \"./pl-file-input.scss\";\n\nimport { prettyBytes } from \"@milaboratories/helpers\";\nimport type { ImportFileHandle, ImportProgress } from \"@platforma-sdk/model\";\nimport { getFileNameFromHandle, getFilePathFromHandle } from \"@platforma-sdk/model\";\nimport { computed, reactive, ref, useSlots, watch } from \"vue\";\nimport { getErrorMessage } from \"../../helpers/error.ts\";\nimport type { ImportedFiles } from \"../../types\";\nimport DoubleContour from \"../../utils/DoubleContour.vue\";\nimport { useLabelNotch } from \"../../utils/useLabelNotch\";\nimport { PlFileDialog } from \"../PlFileDialog\";\nimport { PlMaskIcon24 } from \"../PlMaskIcon24\";\nimport { PlTooltip } from \"../PlTooltip\";\n\nimport SvgRequired from \"../../assets/images/required.svg?raw\";\nimport { PlSvg } from \"../PlSvg\";\n\nconst data = reactive({\n fileDialogOpen: false,\n error: undefined as undefined | string,\n});\n\nconst slots = useSlots();\n\nconst emit = defineEmits<{\n (e: \"update:modelValue\", value: ImportFileHandle | undefined): void;\n}>();\n\nconst props = withDefaults(\n defineProps<{\n /**\n * The current import file handle.\n */\n modelValue: ImportFileHandle | undefined;\n /**\n * The label to display above the input field.\n */\n label?: string;\n /**\n * If `true`, the input field is marked as required.\n */\n required?: boolean;\n /**\n * If `true`, the component border is dashed.\n */\n dashed?: boolean;\n /**\n * Allowed file extensions (should start with `.`)\n */\n extensions?: string[];\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * Import/Upload progress\n */\n progress?: ImportProgress;\n /**\n * An error message to display below the input field.\n */\n error?: unknown;\n /**\n * A helper text to display below the input field when there are no errors.\n */\n helper?: string;\n /**\n * Remove rounded border and change styles\n */\n cellStyle?: boolean;\n /**\n * File dialog title\n */\n fileDialogTitle?: string;\n /**\n * If `true`, the file dialog window closes when clicking outside the modal area (default: `true`)\n */\n fileDialogCloseOnOutsideClick?: boolean;\n }>(),\n {\n label: undefined,\n extensions: undefined,\n fileDialogTitle: undefined,\n placeholder: undefined,\n progress: undefined,\n error: undefined,\n helper: undefined,\n cellStyle: false,\n fileDialogCloseOnOutsideClick: true,\n },\n);\n\nconst tryValue = <T extends ImportFileHandle>(\n v: T | undefined,\n cb: (v: T) => string | undefined,\n) => {\n if (!v) {\n return undefined;\n }\n\n try {\n return cb(v);\n } catch (err) {\n data.error = err instanceof Error ? err.message : String(err);\n return v;\n }\n};\n\nconst fileName = computed(() => tryValue(props.modelValue, getFileNameFromHandle));\n\nconst filePath = computed(() => tryValue(props.modelValue, getFilePathFromHandle));\n\nconst isUploading = computed(() => props.progress && !props.progress.done);\n\nconst isUploaded = computed(() => props.progress && props.progress.done);\n\nconst computedErrorMessage = computed(() => getErrorMessage(data.error, props.error));\n\nconst hasErrors = computed(() => typeof computedErrorMessage.value === \"string\");\n\nconst uploadStats = computed(() => {\n const { status, done } = props.progress ?? {};\n\n if (!status || !status.bytesTotal) {\n return \"\";\n }\n\n if (status.bytesProcessed && !done) {\n return prettyBytes(status.bytesProcessed, {}) + \" / \" + prettyBytes(status.bytesTotal, {});\n }\n\n return prettyBytes(status.bytesTotal, {});\n});\n\nconst progressStyle = computed(() => {\n const { progress } = props;\n\n if (!progress) {\n return {};\n }\n\n return {\n width: progress.done ? \"100%\" : Math.round((progress.status?.progress ?? 0) * 100) + \"%\",\n };\n});\n\nconst openFileDialog = () => {\n data.fileDialogOpen = true;\n};\n\nconst onImport = (v: ImportedFiles) => {\n if (v.files.length) {\n emit(\"update:modelValue\", v.files[0]);\n }\n};\n\nconst clear = () => emit(\"update:modelValue\", undefined);\n\nwatch(\n () => props.modelValue,\n () => (data.error = undefined),\n { immediate: true },\n);\n\nconst rootRef = ref();\n\nif (!props.cellStyle) {\n useLabelNotch(rootRef);\n}\n</script>\n\n<template>\n <div\n :class=\"{ 'pl-file-input__cell-style': !!cellStyle, 'has-file': !!fileName }\"\n class=\"pl-file-input__envelope\"\n data-testid=\"pl-file-input\"\n >\n <div\n ref=\"rootRef\"\n :class=\"{ dashed, error: hasErrors }\"\n class=\"pl-file-input\"\n data-testid=\"pl-file-input-control\"\n tabindex=\"0\"\n @keyup.enter=\"openFileDialog\"\n @click.stop=\"openFileDialog\"\n >\n <div\n :style=\"progressStyle\"\n class=\"pl-file-input__progress\"\n data-testid=\"pl-file-input-progress\"\n />\n <label v-if=\"!cellStyle && label\" ref=\"label\" data-testid=\"pl-file-input-label\">\n <PlSvg v-if=\"required\" :uri=\"SvgRequired\" data-testid=\"pl-file-input-required\" />\n <span>{{ label }}</span>\n <PlTooltip\n v-if=\"slots.tooltip || filePath\"\n class=\"info\"\n position=\"top\"\n data-testid=\"pl-file-input-tooltip\"\n >\n <template #tooltip>\n <slot v-if=\"slots.tooltip\" name=\"tooltip\" />\n <template v-else>{{ filePath }}</template>\n </template>\n </PlTooltip>\n </label>\n <PlMaskIcon24 v-if=\"hasErrors\" name=\"restart\" data-testid=\"pl-file-input-status-icon\" />\n <PlMaskIcon24\n v-else-if=\"isUploading\"\n name=\"cloud-upload\"\n data-testid=\"pl-file-input-status-icon\"\n />\n <PlMaskIcon24 v-else-if=\"isUploaded\" name=\"success\" data-testid=\"pl-file-input-status-icon\" />\n <PlMaskIcon24 v-else name=\"paper-clip\" data-testid=\"pl-file-input-status-icon\" />\n <div\n :data-placeholder=\"placeholder ?? 'Choose file'\"\n class=\"pl-file-input__filename\"\n data-testid=\"pl-file-input-filename\"\n >\n {{ fileName }}\n </div>\n <div v-if=\"uploadStats\" class=\"pl-file-input__stats\" data-testid=\"pl-file-input-stats\">\n {{ uploadStats }}\n </div>\n <PlMaskIcon24\n v-if=\"modelValue\"\n class=\"pl-file-input__clear\"\n data-testid=\"pl-file-input-clear\"\n name=\"close\"\n @click.stop=\"clear\"\n />\n <DoubleContour class=\"pl-file-input__contour\" />\n </div>\n <div v-if=\"hasErrors\" class=\"pl-file-input__error\" data-testid=\"pl-file-input-error\">\n {{ computedErrorMessage }}\n </div>\n <div v-else-if=\"helper\" class=\"pl-file-input__helper\" data-testid=\"pl-file-input-helper\">\n {{ helper }}\n </div>\n <!-- Teleported to <body> by PlDialogModal; kept inside so the component has a single root. -->\n <PlFileDialog\n v-model=\"data.fileDialogOpen\"\n :close-on-outside-click=\"fileDialogCloseOnOutsideClick\"\n :extensions=\"extensions\"\n :title=\"fileDialogTitle\"\n @import:files=\"onImport\"\n />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBA,IAAM,IAAO,EAAS;GACpB,gBAAgB;GAChB,OAAO,KAAA;GACR,CAAC,EAEI,IAAQ,GAAU,EAElB,IAAO,GAIP,IAAQ,GAgER,KACJ,GACA,MACG;AACE,SAIL,KAAI;AACF,WAAO,EAAG,EAAE;YACL,GAAK;AAEZ,WADA,EAAK,QAAQ,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI,EACtD;;KAIL,IAAW,QAAe,EAAS,EAAM,YAAY,EAAsB,CAAC,EAE5E,IAAW,QAAe,EAAS,EAAM,YAAY,GAAsB,CAAC,EAE5E,IAAc,QAAe,EAAM,YAAY,CAAC,EAAM,SAAS,KAAK,EAEpE,IAAa,QAAe,EAAM,YAAY,EAAM,SAAS,KAAK,EAElE,IAAuB,QAAe,EAAgB,EAAK,OAAO,EAAM,MAAM,CAAC,EAE/E,IAAY,QAAe,OAAO,EAAqB,SAAU,SAAS,EAE1E,IAAc,QAAe;GACjC,IAAM,EAAE,WAAQ,YAAS,EAAM,YAAY,EAAE;AAU7C,UARI,CAAC,KAAU,CAAC,EAAO,aACd,KAGL,EAAO,kBAAkB,CAAC,IACrB,EAAY,EAAO,gBAAgB,EAAE,CAAC,GAAG,QAAQ,EAAY,EAAO,YAAY,EAAE,CAAC,GAGrF,EAAY,EA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IACZ,OAAO,EAAA;IACP,kBAAc"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import e from "../
|
|
1
|
+
import e from "../PlIcon16/PlIcon16.js";
|
|
2
|
+
import "../PlIcon16/index.js";
|
|
3
|
+
import t from "../PlTooltip/PlTooltip.js";
|
|
2
4
|
import "../PlTooltip/index.js";
|
|
3
|
-
import t from "../PlIcon16/PlIcon16.js";
|
|
4
5
|
import n from "../../utils/DoubleContour.js";
|
|
5
6
|
import { useLabelNotch as r } from "../../utils/useLabelNotch.js";
|
|
6
|
-
import "../PlIcon16/index.js";
|
|
7
7
|
import './pl-number-field.css';/* empty css */
|
|
8
8
|
import { numberToDecimalString as i, tryParseNumber as a, validateNumber as o } from "./parseNumber.js";
|
|
9
9
|
import { computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, normalizeClass as g, openBlock as _, ref as v, renderSlot as y, toDisplayString as b, unref as x, useModel as S, useSlots as C, watch as w, withCtx as T, withModifiers as E } from "vue";
|
|
@@ -113,7 +113,7 @@ var D = { class: "pl-number-field__main-wrapper d-flex" }, O = { class: "pl-numb
|
|
|
113
113
|
"group-position": m.groupPosition
|
|
114
114
|
}, null, 8, ["group-position"]),
|
|
115
115
|
d("div", O, [
|
|
116
|
-
m.label ? (_(), u("label", k, [f(b(m.label) + " ", 1), x(F).tooltip ? (_(), c(x(
|
|
116
|
+
m.label ? (_(), u("label", k, [f(b(m.label) + " ", 1), x(F).tooltip ? (_(), c(x(t), {
|
|
117
117
|
key: 0,
|
|
118
118
|
class: "info",
|
|
119
119
|
position: "top",
|
|
@@ -135,7 +135,7 @@ var D = { class: "pl-number-field__main-wrapper d-flex" }, O = { class: "pl-numb
|
|
|
135
135
|
onFocusout: J,
|
|
136
136
|
onFocusin: Y
|
|
137
137
|
}, null, 40, A),
|
|
138
|
-
V.value ? (_(), c(x(
|
|
138
|
+
V.value ? (_(), c(x(e), {
|
|
139
139
|
key: 1,
|
|
140
140
|
class: "pl-number-field__clearable",
|
|
141
141
|
"data-testid": "pl-number-field-clear",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import t from "../PlIcon24/PlIcon24.js";
|
|
3
|
-
import "../PlIcon24/index.js";
|
|
4
|
-
import n from "../PlIcon16/PlIcon16.js";
|
|
1
|
+
import e from "../PlIcon16/PlIcon16.js";
|
|
5
2
|
import "../PlIcon16/index.js";
|
|
3
|
+
import t from "../PlTooltip/PlTooltip.js";
|
|
4
|
+
import n from "../PlIcon24/PlIcon24.js";
|
|
5
|
+
import "../PlIcon24/index.js";
|
|
6
6
|
import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, mergeModels as d, normalizeClass as f, openBlock as p, renderSlot as m, toDisplayString as h, unref as g, useModel as _, useSlots as v, vModelText as y, withCtx as b, withDirectives as x, withModifiers as S } from "vue";
|
|
7
7
|
//#region src/components/PlSearchField/PlSearchField.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var C = ["disabled", "placeholder"], w = /* @__PURE__ */ u({
|
|
@@ -27,7 +27,7 @@ var C = ["disabled", "placeholder"], w = /* @__PURE__ */ u({
|
|
|
27
27
|
class: f(r.$style.component),
|
|
28
28
|
"data-testid": "pl-search-field"
|
|
29
29
|
}, [
|
|
30
|
-
l(g(
|
|
30
|
+
l(g(n), {
|
|
31
31
|
name: "search",
|
|
32
32
|
"data-testid": "pl-search-field-icon"
|
|
33
33
|
}),
|
|
@@ -40,14 +40,14 @@ var C = ["disabled", "placeholder"], w = /* @__PURE__ */ u({
|
|
|
40
40
|
spellcheck: "false",
|
|
41
41
|
"data-testid": "pl-search-field-input"
|
|
42
42
|
}, null, 8, C), [[y, d.value]]),
|
|
43
|
-
w.clearable && E.value ? (p(), i(g(
|
|
43
|
+
w.clearable && E.value ? (p(), i(g(e), {
|
|
44
44
|
key: 0,
|
|
45
45
|
class: f(r.$style.clear),
|
|
46
46
|
name: "delete-clear",
|
|
47
47
|
"data-testid": "pl-search-field-clear",
|
|
48
48
|
onClick: S(O, ["stop"])
|
|
49
49
|
}, null, 8, ["class"])) : a("", !0),
|
|
50
|
-
D.value ? (p(), i(
|
|
50
|
+
D.value ? (p(), i(t, {
|
|
51
51
|
key: 1,
|
|
52
52
|
class: "info",
|
|
53
53
|
position: "bottom",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from "../
|
|
2
|
-
import "../PlTooltip/index.js";
|
|
3
|
-
import { getErrorMessage as t } from "../../helpers/error.js";
|
|
4
|
-
import n from "../PlSvg/PlSvg.js";
|
|
1
|
+
import e from "../PlSvg/PlSvg.js";
|
|
5
2
|
import "../PlSvg/index.js";
|
|
3
|
+
import t from "../PlTooltip/PlTooltip.js";
|
|
4
|
+
import "../PlTooltip/index.js";
|
|
5
|
+
import { getErrorMessage as n } from "../../helpers/error.js";
|
|
6
6
|
import r from "../../utils/DoubleContour.js";
|
|
7
7
|
import { useLabelNotch as i } from "../../utils/useLabelNotch.js";
|
|
8
8
|
import a from "../../assets/images/required.js";
|
|
@@ -61,8 +61,8 @@ var T = {
|
|
|
61
61
|
}), R = s(() => !!P.modelValue), z = o(L, P.rules || []);
|
|
62
62
|
i(F);
|
|
63
63
|
let B = s(() => {
|
|
64
|
-
let e = [],
|
|
65
|
-
return
|
|
64
|
+
let e = [], t = n(P.error);
|
|
65
|
+
return t && e.push(t), e.push(...z.value.errors), e;
|
|
66
66
|
}), V = s(() => B.value.length > 0), H = () => {
|
|
67
67
|
if (!P.autogrow) return;
|
|
68
68
|
let e = I.value;
|
|
@@ -70,7 +70,7 @@ var T = {
|
|
|
70
70
|
};
|
|
71
71
|
return h(() => {
|
|
72
72
|
H();
|
|
73
|
-
}), (
|
|
73
|
+
}), (n, i) => (g(), u("div", T, [d("div", {
|
|
74
74
|
ref_key: "root",
|
|
75
75
|
ref: F,
|
|
76
76
|
class: m(["ui-text-area", {
|
|
@@ -82,19 +82,19 @@ var T = {
|
|
|
82
82
|
"data-testid": "pl-text-area-control"
|
|
83
83
|
}, [
|
|
84
84
|
p.label ? (g(), u("label", E, [
|
|
85
|
-
p.required ? (g(), c(b(
|
|
85
|
+
p.required ? (g(), c(b(e), {
|
|
86
86
|
key: 0,
|
|
87
87
|
uri: b(a),
|
|
88
88
|
"data-testid": "pl-text-area-required"
|
|
89
89
|
}, null, 8, ["uri"])) : l("", !0),
|
|
90
90
|
d("span", null, y(p.label), 1),
|
|
91
|
-
b(M).tooltip ? (g(), c(b(
|
|
91
|
+
b(M).tooltip ? (g(), c(b(t), {
|
|
92
92
|
key: 1,
|
|
93
93
|
class: "info",
|
|
94
94
|
position: "top",
|
|
95
95
|
"data-testid": "pl-text-area-tooltip"
|
|
96
96
|
}, {
|
|
97
|
-
tooltip: C(() => [v(
|
|
97
|
+
tooltip: C(() => [v(n.$slots, "tooltip")]),
|
|
98
98
|
_: 3
|
|
99
99
|
})) : l("", !0)
|
|
100
100
|
], 512)) : l("", !0),
|
|
@@ -110,7 +110,7 @@ var T = {
|
|
|
110
110
|
"data-testid": "pl-text-area-input",
|
|
111
111
|
onInput: H
|
|
112
112
|
}, null, 40, D), [[S, L.value]]),
|
|
113
|
-
d("div", O, [v(
|
|
113
|
+
d("div", O, [v(n.$slots, "append")]),
|
|
114
114
|
f(r, { class: "ui-text-area__contour" })
|
|
115
115
|
], 2), V.value ? (g(), u("div", k, y(B.value.join(" ")), 1)) : p.helper ? (g(), u("div", A, y(p.helper), 1)) : l("", !0)]));
|
|
116
116
|
}
|