@vc-shell/framework 1.1.17 → 1.1.19
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/CHANGELOG.md +13 -0
- package/dist/apl-B2DGVGxc.js +76 -0
- package/dist/asciiarmor-2LVJmxlE.js +34 -0
- package/dist/asn1-jKiBa2Ya.js +95 -0
- package/dist/asterisk-DS281yxp.js +271 -0
- package/dist/brainfuck-C_p9pTT8.js +34 -0
- package/dist/clike-DGTaUp48.js +620 -0
- package/dist/clojure-CCKyeQKf.js +800 -0
- package/dist/cmake-CuaCgAKt.js +28 -0
- package/dist/cobol-BlTKFDRj.js +72 -0
- package/dist/coffeescript-BVCvwO8I.js +179 -0
- package/dist/commonlisp-D_kxz07b.js +75 -0
- package/dist/crystal-D309uH6_.js +217 -0
- package/dist/css-BkF-NPzE.js +1553 -0
- package/dist/cypher-BMq4Fwjl.js +68 -0
- package/dist/d-BZcgY6La.js +127 -0
- package/dist/diff-Cg9d_RX2.js +18 -0
- package/dist/dockerfile-DIy8NleC.js +194 -0
- package/dist/dtd-CtLokQ-U.js +84 -0
- package/dist/dylan-QYeExnWK.js +234 -0
- package/dist/ebnf-DUPDuY4r.js +78 -0
- package/dist/ecl-CiXN-g_D.js +121 -0
- package/dist/eiffel-yQhjl4T1.js +110 -0
- package/dist/elm-CNT9vbN0.js +108 -0
- package/dist/erlang-CFOYdy9e.js +487 -0
- package/dist/factor-DDOC7X6P.js +65 -0
- package/dist/fcl-CPC2WYrI.js +103 -0
- package/dist/forth-BmxRyE9S.js +60 -0
- package/dist/fortran-9bvPyrOW.js +442 -0
- package/dist/framework.js +290 -0
- package/dist/gas-cpmYfFX2.js +183 -0
- package/dist/gherkin-CJuwpceU.js +34 -0
- package/dist/groovy-DZeT_VM-.js +146 -0
- package/dist/haskell-Bvt3Qq1t.js +375 -0
- package/dist/haxe-70NVW1pR.js +359 -0
- package/dist/http-D9LttvKF.js +44 -0
- package/dist/idl-B6TRFYjl.js +947 -0
- package/dist/index-BFhNVNTZ.js +98 -0
- package/dist/index-BJ39J43e.js +156 -0
- package/dist/index-BRQ9wWZR.js +137 -0
- package/dist/index-BoGxKFnu.js +249 -0
- package/dist/index-BvsQBH3w.js +308 -0
- package/dist/index-BwOwXBut.js +71 -0
- package/dist/index-CEEN9FWP.js +93 -0
- package/dist/index-CFKt4CD5.js +538 -0
- package/dist/index-CH1B6sJF.js +288 -0
- package/dist/index-CgZYncHs.js +134 -0
- package/dist/index-CjOyhVA4.js +147476 -0
- package/dist/index-DkYs6XSR.js +299 -0
- package/dist/index-T_R-gZqQ.js +268 -0
- package/dist/index-hV9___CR.js +58 -0
- package/dist/index-nqbjSJZb.js +341 -0
- package/dist/index-uTKF7rlc.js +611 -0
- package/dist/index-zEitvdcx.js +75 -0
- package/dist/index.css +9 -0
- package/dist/javascript-C2yteZeJ.js +691 -0
- package/dist/jinja2-DnB6dQmV.js +154 -0
- package/dist/julia-DpvXAuO6.js +241 -0
- package/dist/livescript-CanGTf8u.js +272 -0
- package/dist/lua-XplVlWi_.js +217 -0
- package/dist/mathematica-jaRHnSxC.js +35 -0
- package/dist/mbox-BctzC1hL.js +76 -0
- package/dist/mirc-CFBPAOaF.js +72 -0
- package/dist/mllike-BSnXJBGA.js +272 -0
- package/dist/modelica-vUgVs--1.js +93 -0
- package/dist/mscgen-Cpl0NYLN.js +104 -0
- package/dist/mumps-CQoS1kWX.js +25 -0
- package/dist/nginx-zDPm3Z74.js +89 -0
- package/dist/nsis-fePjrhq7.js +62 -0
- package/dist/ntriples-CsNjv2QF.js +79 -0
- package/dist/octave-C8PmmSRH.js +143 -0
- package/dist/oz-Ce8aN8oE.js +151 -0
- package/dist/pascal-De0D6mP7.js +77 -0
- package/dist/perl-B4bSCe1C.js +915 -0
- package/dist/pig-D24Z8EXi.js +54 -0
- package/dist/powershell-DkYVfTzP.js +249 -0
- package/dist/properties-Dn9wna3M.js +26 -0
- package/dist/protobuf-BPIjwpzm.js +49 -0
- package/dist/pug-CwAQJzGR.js +248 -0
- package/dist/puppet-nyd4dhjf.js +45 -0
- package/dist/python-BkR3uSy8.js +313 -0
- package/dist/q-DXjKs-tC.js +83 -0
- package/dist/r-LKEuhEGI.js +104 -0
- package/dist/rpm-IznJm2Xc.js +57 -0
- package/dist/ruby-CcYfvIk6.js +228 -0
- package/dist/sas-7E8yHoCW.js +105 -0
- package/dist/scheme-DjibxsNh.js +124 -0
- package/dist/shared/components/draggable-dashboard/composables/useDashboardDragAndDrop.d.ts +4 -4
- package/dist/shared/components/notifications/components/notification-container/index.d.ts +6 -6
- package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -2
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +2 -2
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +2 -2
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +1 -1
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +1 -1
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
- package/dist/shell-C0C2sNA_.js +182 -0
- package/dist/sieve-Bwz7vjP5.js +72 -0
- package/dist/simple-mode-B0dvCdAA.js +89 -0
- package/dist/smalltalk-Bhddl2pB.js +48 -0
- package/dist/solr-BNlsLglM.js +41 -0
- package/dist/sparql-FarWu_Gb.js +197 -0
- package/dist/spreadsheet-C-cy4P5N.js +49 -0
- package/dist/sql-CfG5lQ3l.js +282 -0
- package/dist/stex-Du4h4KAU.js +129 -0
- package/dist/stylus-CAdqWld3.js +250 -0
- package/dist/swift-DSxqR9R6.js +230 -0
- package/dist/tcl-xfoLljhY.js +81 -0
- package/dist/textile-D1AWE-pc.js +295 -0
- package/dist/tiddlywiki-5wqsXtSk.js +155 -0
- package/dist/tiki-__Kn3CeS.js +181 -0
- package/dist/toml-BHiuTcfn.js +49 -0
- package/dist/troff-D2UO-fKf.js +35 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ttcn-Bsa4sfRm.js +123 -0
- package/dist/ttcn-cfg-Bac_acMi.js +88 -0
- package/dist/turtle-xwJUxoPV.js +80 -0
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts +2 -2
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +2 -2
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +2 -2
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +2 -2
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.vue.d.ts +3 -3
- package/dist/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.backupsb.d.ts +3 -3
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +2 -2
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +3 -3
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
- package/dist/vb-c2kQGd6-.js +74 -0
- package/dist/vbscript-1f_Dhg5H.js +324 -0
- package/dist/velocity-DJd0pTTC.js +96 -0
- package/dist/verilog-CiS1jyi5.js +262 -0
- package/dist/vhdl-T9HkrbI2.js +106 -0
- package/dist/webidl-CjfDENEo.js +155 -0
- package/dist/xquery-BUQdORAS.js +422 -0
- package/dist/yacas-C0absKBh.js +73 -0
- package/dist/z80-Pki2zAjW.js +61 -0
- package/package.json +4 -4
- package/ui/components/molecules/vc-input-dropdown/vc-input-dropdown.vue +3 -3
- package/ui/components/molecules/vc-select/vc-select.vue +186 -68
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
+
ref="selectRootRef"
|
|
3
4
|
class="vc-select"
|
|
4
5
|
:class="{
|
|
5
6
|
'vc-select_opened': isOpened,
|
|
@@ -98,7 +99,7 @@
|
|
|
98
99
|
v-bind="item"
|
|
99
100
|
>
|
|
100
101
|
<div class="vc-select__multiple-item">
|
|
101
|
-
<template v-if="loading">
|
|
102
|
+
<template v-if="loading || defaultOptionLoading">
|
|
102
103
|
<span class="vc-select__loading">{{
|
|
103
104
|
t("COMPONENTS.MOLECULES.VC_SELECT.LOADING")
|
|
104
105
|
}}</span>
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
</slot>
|
|
118
119
|
</template>
|
|
119
120
|
<template v-else-if="!multiple">
|
|
120
|
-
<template v-if="loading">
|
|
121
|
+
<template v-if="loading || defaultOptionLoading">
|
|
121
122
|
<span class="vc-select__loading">{{
|
|
122
123
|
t("COMPONENTS.MOLECULES.VC_SELECT.LOADING")
|
|
123
124
|
}}</span>
|
|
@@ -128,7 +129,7 @@
|
|
|
128
129
|
v-bind="item"
|
|
129
130
|
>
|
|
130
131
|
{{
|
|
131
|
-
loading
|
|
132
|
+
loading || defaultOptionLoading
|
|
132
133
|
? t("COMPONENTS.MOLECULES.VC_SELECT.LOADING")
|
|
133
134
|
: getEmittingOptionValue(item.opt)
|
|
134
135
|
}}
|
|
@@ -167,7 +168,7 @@
|
|
|
167
168
|
</div>
|
|
168
169
|
<!-- Loading-->
|
|
169
170
|
<div
|
|
170
|
-
v-if="loading || listLoading"
|
|
171
|
+
v-if="loading || listLoading || defaultOptionLoading"
|
|
171
172
|
class="vc-select__loading-icon"
|
|
172
173
|
>
|
|
173
174
|
<VcIcon
|
|
@@ -250,6 +251,8 @@
|
|
|
250
251
|
class="vc-select__search-input"
|
|
251
252
|
tabindex="0"
|
|
252
253
|
@input="onInput"
|
|
254
|
+
@keydown.space.stop
|
|
255
|
+
@keydown.enter.stop
|
|
253
256
|
/>
|
|
254
257
|
|
|
255
258
|
<VcContainer
|
|
@@ -320,7 +323,7 @@
|
|
|
320
323
|
|
|
321
324
|
<!-- eslint-disable @typescript-eslint/no-explicit-any -->
|
|
322
325
|
<script lang="ts" setup generic="T, P extends { results?: T[]; totalCount?: number }">
|
|
323
|
-
import { ref, computed, watch, nextTick, Ref, toRefs } from "vue";
|
|
326
|
+
import { ref, computed, watch, nextTick, Ref, toRefs, onMounted, onUnmounted } from "vue";
|
|
324
327
|
import { vOnClickOutside } from "@vueuse/components";
|
|
325
328
|
import * as _ from "lodash-es";
|
|
326
329
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
@@ -577,6 +580,9 @@ const { t } = useI18n({ useScope: "global" });
|
|
|
577
580
|
|
|
578
581
|
const { modelValue, options } = toRefs(props);
|
|
579
582
|
|
|
583
|
+
const selectRootRef = ref<HTMLDivElement | null>(null);
|
|
584
|
+
const isSelectVisible = ref(false);
|
|
585
|
+
|
|
580
586
|
const isOpened = ref(false);
|
|
581
587
|
|
|
582
588
|
const searchRef = ref();
|
|
@@ -585,6 +591,7 @@ const dropdownRef = ref();
|
|
|
585
591
|
const root = ref();
|
|
586
592
|
const el = ref();
|
|
587
593
|
const listLoading = ref(false);
|
|
594
|
+
const defaultOptionLoading = ref(false);
|
|
588
595
|
const isFocused = ref(false);
|
|
589
596
|
|
|
590
597
|
const filterString = ref();
|
|
@@ -601,6 +608,33 @@ let emitValueFn;
|
|
|
601
608
|
let emitTimer: NodeJS.Timeout;
|
|
602
609
|
let innerValueCache: Option[];
|
|
603
610
|
|
|
611
|
+
let rootVisibilityObserver: IntersectionObserver | null = null;
|
|
612
|
+
|
|
613
|
+
onMounted(() => {
|
|
614
|
+
if (selectRootRef.value) {
|
|
615
|
+
rootVisibilityObserver = new IntersectionObserver(
|
|
616
|
+
([entry]) => {
|
|
617
|
+
if (entry.isIntersecting) {
|
|
618
|
+
isSelectVisible.value = true;
|
|
619
|
+
} else {
|
|
620
|
+
isSelectVisible.value = false;
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
{ threshold: 0.1 },
|
|
624
|
+
);
|
|
625
|
+
rootVisibilityObserver.observe(selectRootRef.value);
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
|
|
629
|
+
onUnmounted(() => {
|
|
630
|
+
if (rootVisibilityObserver && selectRootRef.value) {
|
|
631
|
+
rootVisibilityObserver.unobserve(selectRootRef.value);
|
|
632
|
+
}
|
|
633
|
+
if (rootVisibilityObserver) {
|
|
634
|
+
rootVisibilityObserver.disconnect();
|
|
635
|
+
}
|
|
636
|
+
});
|
|
637
|
+
|
|
604
638
|
useIntersectionObserver(
|
|
605
639
|
el,
|
|
606
640
|
([{ isIntersecting }]) => {
|
|
@@ -625,89 +659,150 @@ const popper = useFloating(dropdownToggleRef, dropdownRef, {
|
|
|
625
659
|
}) as FloatingInstanceType;
|
|
626
660
|
|
|
627
661
|
watch(
|
|
628
|
-
modelValue,
|
|
629
|
-
async (
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
});
|
|
662
|
+
[() => props.modelValue, isSelectVisible],
|
|
663
|
+
async ([currentModelVal, selectIsVisible]) => {
|
|
664
|
+
let modelAsArrayValueIds: (string | number | Record<string, any> | null)[] = [];
|
|
665
|
+
if (Array.isArray(currentModelVal)) {
|
|
666
|
+
modelAsArrayValueIds = props.emitValue
|
|
667
|
+
? currentModelVal
|
|
668
|
+
: currentModelVal.map((v) => getOptionValue.value(v as Option));
|
|
669
|
+
} else if (currentModelVal != null) {
|
|
670
|
+
modelAsArrayValueIds = [props.emitValue ? currentModelVal : getOptionValue.value(currentModelVal as Option)];
|
|
671
|
+
}
|
|
640
672
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
673
|
+
const currentDefaultValueIds = defaultValue.value.map((opt) => getOptionValue.value(opt));
|
|
674
|
+
|
|
675
|
+
const sortedCurrentDefaultIds = [...currentDefaultValueIds].sort((a, b) => String(a).localeCompare(String(b)));
|
|
676
|
+
const sortedModelValueIds = [...modelAsArrayValueIds].sort((a, b) => String(a).localeCompare(String(b)));
|
|
677
|
+
|
|
678
|
+
const isDefaultValueResolved =
|
|
679
|
+
_.isEqual(sortedCurrentDefaultIds, sortedModelValueIds) &&
|
|
680
|
+
(modelAsArrayValueIds.length > 0 || defaultValue.value.length === 0);
|
|
681
|
+
|
|
682
|
+
if (!selectIsVisible) {
|
|
683
|
+
if (modelAsArrayValueIds.length === 0 && defaultValue.value.length > 0) {
|
|
684
|
+
defaultValue.value = [];
|
|
685
|
+
}
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
if (modelAsArrayValueIds.length === 0) {
|
|
690
|
+
if (defaultValue.value.length > 0) {
|
|
691
|
+
defaultValue.value = [];
|
|
692
|
+
}
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (!isDefaultValueResolved) {
|
|
697
|
+
if (props.options && typeof props.options === "function") {
|
|
698
|
+
try {
|
|
699
|
+
defaultOptionLoading.value = true;
|
|
700
|
+
const idsToFetch = modelAsArrayValueIds.filter((id) => id != null) as string[];
|
|
701
|
+
|
|
702
|
+
if (
|
|
703
|
+
idsToFetch.length === 0 &&
|
|
704
|
+
!(
|
|
705
|
+
modelAsArrayValueIds.length === 1 &&
|
|
706
|
+
modelAsArrayValueIds[0] == null &&
|
|
707
|
+
props.mapOptions &&
|
|
708
|
+
!props.multiple
|
|
709
|
+
)
|
|
710
|
+
) {
|
|
711
|
+
defaultValue.value = [];
|
|
712
|
+
defaultOptionLoading.value = false;
|
|
713
|
+
return;
|
|
663
714
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
)
|
|
715
|
+
|
|
716
|
+
const data = await props.options(undefined, undefined, idsToFetch);
|
|
717
|
+
|
|
718
|
+
if (typeof data === "object" && !Array.isArray(data) && "results" in data && data.results) {
|
|
719
|
+
const results = data.results as Option[];
|
|
720
|
+
defaultValue.value = results.filter((rOpt) =>
|
|
721
|
+
modelAsArrayValueIds.some((mId) => _.isEqual(getOptionValue.value(rOpt), mId)),
|
|
722
|
+
);
|
|
723
|
+
} else {
|
|
724
|
+
defaultValue.value = [];
|
|
725
|
+
}
|
|
726
|
+
} catch (e) {
|
|
727
|
+
console.error("Error loading default options:", e);
|
|
728
|
+
defaultValue.value = [];
|
|
729
|
+
} finally {
|
|
730
|
+
defaultOptionLoading.value = false;
|
|
668
731
|
}
|
|
732
|
+
} else if (props.options && Array.isArray(props.options)) {
|
|
733
|
+
defaultValue.value = (props.options as Option[]).filter((opt) =>
|
|
734
|
+
modelAsArrayValueIds.some((mId) => _.isEqual(getOptionValue.value(opt), mId)),
|
|
735
|
+
);
|
|
669
736
|
}
|
|
670
737
|
}
|
|
671
738
|
},
|
|
672
|
-
{ immediate: true },
|
|
739
|
+
{ immediate: true, deep: true },
|
|
673
740
|
);
|
|
674
741
|
|
|
675
742
|
watch(
|
|
676
|
-
isOpened,
|
|
677
|
-
async (
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
743
|
+
[isOpened, isSelectVisible],
|
|
744
|
+
async ([newIsOpened, newIsSelectVisible]) => {
|
|
745
|
+
if (newIsOpened && newIsSelectVisible) {
|
|
746
|
+
const needsLoad =
|
|
747
|
+
optionsList.value.length === 0 ||
|
|
748
|
+
(props.options && typeof props.options === "function" && filterString.value && !listLoading.value);
|
|
749
|
+
|
|
750
|
+
if (needsLoad) {
|
|
751
|
+
if (props.options && typeof props.options === "function") {
|
|
752
|
+
await loadOptionsForOpenDropdown();
|
|
753
|
+
} else if (props.options && Array.isArray(props.options)) {
|
|
754
|
+
optionsList.value = [...props.options] as Option[];
|
|
755
|
+
optionsTemp.value = optionsList.value;
|
|
756
|
+
totalItems.value = optionsList.value.length;
|
|
687
757
|
}
|
|
688
758
|
}
|
|
689
759
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
760
|
+
nextTick(() => {
|
|
761
|
+
popper.update();
|
|
762
|
+
if (dropdownRef.value) {
|
|
763
|
+
keyboardNavigation.initKeyboardNavigation(dropdownRef.value);
|
|
764
|
+
if (props.searchable && searchRef.value) {
|
|
765
|
+
searchRef.value.focus();
|
|
766
|
+
} else {
|
|
767
|
+
const firstFocusable = dropdownRef.value.querySelector(
|
|
768
|
+
'.vc-select__option[tabindex="0"], .vc-select__search-input[tabindex="0"]',
|
|
769
|
+
) as HTMLElement | null;
|
|
770
|
+
|
|
771
|
+
if (firstFocusable) {
|
|
772
|
+
firstFocusable.focus();
|
|
773
|
+
} else {
|
|
774
|
+
keyboardNavigation.focusFirstElement();
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
} else if (!newIsOpened) {
|
|
780
|
+
keyboardNavigation.cleanupKeyboardNavigation();
|
|
694
781
|
}
|
|
695
782
|
},
|
|
696
|
-
{ immediate:
|
|
783
|
+
{ immediate: false },
|
|
697
784
|
);
|
|
698
785
|
|
|
699
786
|
watch(
|
|
700
|
-
options,
|
|
701
|
-
async (
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
787
|
+
() => props.options,
|
|
788
|
+
async (newOptionsSource) => {
|
|
789
|
+
optionsList.value = [];
|
|
790
|
+
optionsTemp.value = [];
|
|
791
|
+
totalItems.value = 0;
|
|
792
|
+
|
|
793
|
+
if (isSelectVisible.value) {
|
|
794
|
+
if (Array.isArray(newOptionsSource)) {
|
|
795
|
+
optionsList.value = [...newOptionsSource] as Option[];
|
|
796
|
+
optionsTemp.value = optionsList.value;
|
|
797
|
+
totalItems.value = optionsList.value.length;
|
|
705
798
|
}
|
|
706
799
|
|
|
707
|
-
|
|
800
|
+
if (isOpened.value && typeof newOptionsSource === "function") {
|
|
801
|
+
await loadOptionsForOpenDropdown();
|
|
802
|
+
}
|
|
708
803
|
}
|
|
709
804
|
},
|
|
710
|
-
{
|
|
805
|
+
{ deep: false },
|
|
711
806
|
);
|
|
712
807
|
|
|
713
808
|
watch(
|
|
@@ -719,6 +814,28 @@ watch(
|
|
|
719
814
|
},
|
|
720
815
|
);
|
|
721
816
|
|
|
817
|
+
async function loadOptionsForOpenDropdown() {
|
|
818
|
+
if (props.options && typeof props.options === "function" && !listLoading.value) {
|
|
819
|
+
try {
|
|
820
|
+
listLoading.value = true;
|
|
821
|
+
const data = await props.options(filterString.value, optionsList.value.length);
|
|
822
|
+
if (filterString.value || optionsList.value.length === 0) {
|
|
823
|
+
optionsList.value = (data.results as Option[]) || [];
|
|
824
|
+
} else {
|
|
825
|
+
optionsList.value = _.unionBy<Option>(optionsList.value, (data.results as Option[]) || [], "id");
|
|
826
|
+
}
|
|
827
|
+
totalItems.value = data.totalCount || 0;
|
|
828
|
+
optionsTemp.value = optionsList.value;
|
|
829
|
+
} catch (e) {
|
|
830
|
+
console.error("Error in loadOptionsForOpenDropdown:", e);
|
|
831
|
+
optionsList.value = [];
|
|
832
|
+
totalItems.value = 0;
|
|
833
|
+
} finally {
|
|
834
|
+
listLoading.value = false;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
722
839
|
async function onLoadMore() {
|
|
723
840
|
if (props.options && typeof props.options === "function") {
|
|
724
841
|
try {
|
|
@@ -864,6 +981,7 @@ function closeDropdown() {
|
|
|
864
981
|
onDropdownClose();
|
|
865
982
|
isOpened.value = false;
|
|
866
983
|
isFocused.value = false;
|
|
984
|
+
keyboardNavigation.cleanupKeyboardNavigation();
|
|
867
985
|
emit("close");
|
|
868
986
|
}
|
|
869
987
|
|
|
@@ -1043,7 +1161,7 @@ const keyboardNavigation = useKeyboardNavigation({
|
|
|
1043
1161
|
}
|
|
1044
1162
|
},
|
|
1045
1163
|
onEscape: () => {
|
|
1046
|
-
|
|
1164
|
+
closeDropdown();
|
|
1047
1165
|
},
|
|
1048
1166
|
});
|
|
1049
1167
|
</script>
|