@bagelink/vue 0.0.218 → 0.0.226-beta.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/dist/components/AccordionItem.vue.d.ts +23 -0
- package/dist/components/AccordionItem.vue.d.ts.map +1 -0
- package/dist/components/Avatar.vue.d.ts +20 -0
- package/dist/components/Avatar.vue.d.ts.map +1 -0
- package/dist/components/Card.vue.d.ts +27 -0
- package/dist/components/Card.vue.d.ts.map +1 -0
- package/dist/components/DataPreview.vue.d.ts +18 -18
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/Drop.vue.d.ts +34 -0
- package/dist/components/Drop.vue.d.ts.map +1 -0
- package/dist/components/FileUploader.vue.d.ts +60 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -0
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalBglForm.vue.d.ts +50 -31
- package/dist/components/ModalBglForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts +17 -12
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts +5 -4
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts +31 -0
- package/dist/components/Title.vue.d.ts.map +1 -0
- package/dist/components/form/BglField.vue.d.ts +19 -5
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +38 -27
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/ItemRef.vue.d.ts +1 -0
- package/dist/components/form/ItemRef.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts +0 -3
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +36 -38
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts +25 -15
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectField.vue.d.ts +1 -4
- package/dist/components/form/inputs/SelectField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +37 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts +46 -0
- package/dist/components/form/inputs/ToggleInput.vue.d.ts.map +1 -0
- package/dist/components/form/inputs/index.d.ts +2 -3
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +1 -2
- package/dist/components/formkit/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +5 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +14523 -13691
- package/dist/index.mjs +14524 -13692
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +1 -3
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +744 -404
- package/dist/types/BagelForm.d.ts +8 -0
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +12 -10
- package/src/components/AccordionItem.vue +100 -0
- package/src/components/Avatar.vue +47 -0
- package/src/components/Card.vue +13 -0
- package/src/components/Comments.vue +75 -75
- package/src/components/ContactArray.vue +10 -39
- package/src/components/DataPreview.vue +22 -49
- package/src/components/{DropDown.vue → Drop.vue} +55 -29
- package/src/components/FormKitTable.vue +121 -125
- package/src/components/Modal.vue +6 -23
- package/src/components/ModalBglForm.vue +10 -24
- package/src/components/NavBar.vue +33 -17
- package/src/components/RTXEditor.vue +69 -69
- package/src/components/TableSchema.vue +26 -72
- package/src/components/Title.vue +19 -0
- package/src/components/form/BglField.vue +29 -26
- package/src/components/form/BglForm.vue +19 -14
- package/src/components/form/index.ts +0 -3
- package/src/components/form/inputs/CheckInput.vue +20 -18
- package/src/components/form/inputs/DateInput.vue +16 -34
- package/src/components/form/inputs/FileUpload.vue +139 -19
- package/src/components/form/inputs/SelectField.vue +80 -138
- package/src/components/form/inputs/SelectInput.vue +517 -0
- package/src/components/form/inputs/TableField.vue +1 -5
- package/src/components/form/inputs/index.ts +2 -3
- package/src/components/formkit/index.ts +0 -3
- package/src/components/index.ts +5 -4
- package/src/plugins/bagel.ts +2 -2
- package/src/plugins/modal.ts +7 -13
- package/src/styles/inputs.css +2 -2
- package/src/styles/layout.css +1 -1
- package/src/styles/modal.css +3 -2
- package/src/styles/theme.css +7 -6
- package/src/types/BagelForm.ts +5 -0
- package/src/types/index.ts +1 -1
- package/src/utils/index.ts +26 -6
- package/src/components/ContactSubmissions.vue +0 -45
- package/src/components/PersonPreview.vue +0 -199
- package/src/components/PersonPreviewFormkit.vue +0 -178
- package/src/components/form/ItemRef.vue +0 -44
- package/src/components/form/MaterialIcon.vue +0 -19
- package/src/components/form/PlainInputField.vue +0 -79
- package/src/components/form/inputs/DynamicLinkField.vue +0 -137
- package/src/components/form/inputs/EmailInput.vue +0 -58
- package/src/types/Person.ts +0 -51
|
@@ -3,29 +3,89 @@
|
|
|
3
3
|
<label>
|
|
4
4
|
{{ label }}
|
|
5
5
|
</label>
|
|
6
|
-
<div
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
<div
|
|
7
|
+
@click="browse" @dragover="dragover" @drop="drop" @dragleave="dragleave" class="fileUploadWrap"
|
|
8
|
+
:class="{ fileDropZone: !storageFiles.length && !fileQueue.length, dragover: isDragOver }"
|
|
9
|
+
>
|
|
10
|
+
<template v-for="file in storageFiles" :key="file.id">
|
|
11
|
+
<div class="imagePreviewWrap" v-if="!multiple">
|
|
12
|
+
<img class="preview" :src="file.url" alt="">
|
|
11
13
|
</div>
|
|
12
14
|
<div class="previewName">
|
|
15
|
+
<img height="60" v-if="multiple" class="preview" :src="file.url" alt="">
|
|
13
16
|
<p class="no-margin">
|
|
14
|
-
{{
|
|
17
|
+
{{ file.name }}
|
|
15
18
|
</p>
|
|
16
|
-
<Btn thin @click.stop="removeFile(
|
|
19
|
+
<Btn thin @click.stop="removeFile(file)" flat icon="delete" color="red" />
|
|
17
20
|
</div>
|
|
18
|
-
</
|
|
21
|
+
</template>
|
|
22
|
+
<template v-for="fileQ in fileQueue" :key="fileQ.file">
|
|
23
|
+
<div class="imagePreviewWrap" v-if="!multiple">
|
|
24
|
+
<img class="preview" :src="fileToUrl(fileQ.file)" alt="">
|
|
25
|
+
</div>
|
|
26
|
+
<div class="previewName">
|
|
27
|
+
<img height="60" v-if="multiple" class="preview" :src="fileToUrl(fileQ.file)" alt="">
|
|
28
|
+
<p class="no-margin">
|
|
29
|
+
{{ fileQ.name }}
|
|
30
|
+
</p>
|
|
31
|
+
<div
|
|
32
|
+
class="pie"
|
|
33
|
+
:style="`--p:${fileQ.progress}`"
|
|
34
|
+
style="--b: 2px"
|
|
35
|
+
:class="{ complete: fileQ.progress === 100 }"
|
|
36
|
+
>
|
|
37
|
+
<span
|
|
38
|
+
class="progress"
|
|
39
|
+
v-if="fileQ.progress < 100"
|
|
40
|
+
>
|
|
41
|
+
{{`${fileQ.progress.toFixed(0)}`}}
|
|
42
|
+
</span>
|
|
43
|
+
<MaterialIcon
|
|
44
|
+
class="success"
|
|
45
|
+
icon="check"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
19
50
|
</div>
|
|
20
51
|
</div>
|
|
21
52
|
</template>
|
|
22
53
|
|
|
23
54
|
<script setup lang="ts">
|
|
24
|
-
import {
|
|
55
|
+
import { watch } from 'vue';
|
|
56
|
+
import {
|
|
57
|
+
Btn, type StorageFile, useBagel, MaterialIcon,
|
|
58
|
+
} from '@bagelink/vue';
|
|
59
|
+
|
|
60
|
+
const bagel = useBagel();
|
|
61
|
+
|
|
62
|
+
type QueueFile = {
|
|
63
|
+
file: File;
|
|
64
|
+
progress: number;
|
|
65
|
+
uploading?: boolean;
|
|
66
|
+
name?: string;
|
|
67
|
+
uploaded?: boolean;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const props = defineProps<{ label: string, multiple?: boolean, files?: StorageFile | StorageFile[], }>();
|
|
25
71
|
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
72
|
+
const file_ids = defineModel<string[] | string>('modelValue');
|
|
73
|
+
const storageFiles = $ref<StorageFile[]>([]);
|
|
74
|
+
|
|
75
|
+
const compareIds = (v1?: string[] | string, v2?: string[] | string) => [v1].flat().join(',') === [v2].flat().join(',');
|
|
76
|
+
|
|
77
|
+
watch(() => props.files, (newFiles) => {
|
|
78
|
+
if (newFiles) storageFiles.push(...[newFiles].flat());
|
|
79
|
+
}, { immediate: true });
|
|
80
|
+
|
|
81
|
+
watch(() => storageFiles, (newFiles) => {
|
|
82
|
+
let idValue:string[] | string = '';
|
|
83
|
+
if (props.multiple) idValue = newFiles.map((f) => f.id || '');
|
|
84
|
+
else idValue = newFiles[0]?.id || '';
|
|
85
|
+
if (!compareIds(file_ids?.value, idValue)) file_ids.value = idValue;
|
|
86
|
+
}, { deep: true });
|
|
87
|
+
|
|
88
|
+
const fileQueue = $ref<QueueFile[]>([]);
|
|
29
89
|
let isDragOver = $ref(false);
|
|
30
90
|
|
|
31
91
|
const preventDefault = (e: Event) => {
|
|
@@ -34,13 +94,17 @@ const preventDefault = (e: Event) => {
|
|
|
34
94
|
};
|
|
35
95
|
|
|
36
96
|
const fileToUrl = (file: File) => URL.createObjectURL(file);
|
|
37
|
-
const removeFile = (file:
|
|
38
|
-
const index =
|
|
39
|
-
|
|
97
|
+
const removeFile = (file: StorageFile) => {
|
|
98
|
+
const index = storageFiles.indexOf(file);
|
|
99
|
+
storageFiles.splice(index, 1);
|
|
40
100
|
};
|
|
41
101
|
const flushQueue = () => {
|
|
42
|
-
fileQueue.forEach((file
|
|
43
|
-
if (props.multiple)
|
|
102
|
+
fileQueue.forEach(async (file, i) => {
|
|
103
|
+
if (!props.multiple) storageFiles.splice(0, 1);
|
|
104
|
+
const serverFile = await bagel.uploadFile(file.file, {
|
|
105
|
+
onUploadProgress: (e: any) => (file.progress = e.progress * 100 - 1),
|
|
106
|
+
});
|
|
107
|
+
storageFiles.push(serverFile);
|
|
44
108
|
fileQueue.splice(i, 1);
|
|
45
109
|
});
|
|
46
110
|
};
|
|
@@ -51,7 +115,9 @@ const browse = () => {
|
|
|
51
115
|
input.multiple = props.multiple;
|
|
52
116
|
input.onchange = (e: Event) => {
|
|
53
117
|
const target = e?.target as HTMLInputElement;
|
|
54
|
-
if (target?.files)
|
|
118
|
+
if (target?.files) {
|
|
119
|
+
Array.from(target.files).forEach((file:File) => fileQueue.push({ name: file.name, file, progress: 0 }));
|
|
120
|
+
}
|
|
55
121
|
flushQueue();
|
|
56
122
|
};
|
|
57
123
|
input.click();
|
|
@@ -71,7 +137,9 @@ const dragover = (e: DragEvent) => {
|
|
|
71
137
|
|
|
72
138
|
const drop = (e: DragEvent) => {
|
|
73
139
|
preventDefault(e);
|
|
74
|
-
if (e.dataTransfer)
|
|
140
|
+
if (e.dataTransfer) {
|
|
141
|
+
Array.from(e.dataTransfer.files).forEach((file:File) => fileQueue.push({ name: file.name, file, progress: 0 }));
|
|
142
|
+
}
|
|
75
143
|
isDragOver = false;
|
|
76
144
|
flushQueue();
|
|
77
145
|
};
|
|
@@ -134,4 +202,56 @@ img.preview {
|
|
|
134
202
|
.bagel-input .fileUploadWrap.fileDropZone:after {
|
|
135
203
|
content: "Drop files here or click to upload";
|
|
136
204
|
}
|
|
205
|
+
|
|
206
|
+
.pie {
|
|
207
|
+
width: 30px;
|
|
208
|
+
height: 30px;
|
|
209
|
+
position: relative;
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
justify-content: center;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.pie:before {
|
|
216
|
+
content: "";
|
|
217
|
+
position: absolute;
|
|
218
|
+
border-radius: 50%;
|
|
219
|
+
inset: 0;
|
|
220
|
+
transition: all 0.2s ease-in-out;
|
|
221
|
+
background: conic-gradient(var(--bgl-primary) calc(var(--p) * 1%), #0000 0);
|
|
222
|
+
-webkit-mask: radial-gradient(farthest-side,
|
|
223
|
+
#0000 calc(99% - var(--b)),
|
|
224
|
+
#000 calc(100% - var(--b)));
|
|
225
|
+
mask: radial-gradient(farthest-side,
|
|
226
|
+
#0000 calc(99% - var(--b)),
|
|
227
|
+
#000 calc(100% - var(--b)));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.pie .success {
|
|
231
|
+
transform: scale(0);
|
|
232
|
+
opacity: 0;
|
|
233
|
+
transition: all 0.3s ease-in-out;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.pie .progress {
|
|
237
|
+
position: absolute;
|
|
238
|
+
font-size: 10px;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.pie.complete .progress {
|
|
242
|
+
display: none;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.pie.complete .success {
|
|
246
|
+
transform: scale(1.3);
|
|
247
|
+
opacity: 1;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.pie.complete:before {
|
|
251
|
+
background: conic-gradient(var(--bgl-green) calc(var(--p) * 1%), #0000 0);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.pie.complete {
|
|
255
|
+
color: var(--bgl-green);
|
|
256
|
+
}
|
|
137
257
|
</style>
|
|
@@ -1,42 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="
|
|
4
|
-
:class="{ '
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<label
|
|
8
|
-
v-if="label"
|
|
9
|
-
for="label"
|
|
10
|
-
:class="{ active: showList }"
|
|
11
|
-
>
|
|
12
|
-
<LangText :input="label" />
|
|
13
|
-
</label>
|
|
14
|
-
|
|
15
|
-
<div
|
|
16
|
-
class="custom-select"
|
|
17
|
-
ref="selectEl"
|
|
18
|
-
:class="{ 'open-select': showList && editMode }"
|
|
19
|
-
>
|
|
20
|
-
<div
|
|
21
|
-
@click.stop="toggleShowList"
|
|
22
|
-
class="input"
|
|
23
|
-
name="select-input"
|
|
24
|
-
:class="{ active: showList }"
|
|
25
|
-
>
|
|
26
|
-
<LangText :input="displayValue" />
|
|
27
|
-
</div>
|
|
2
|
+
<div ref="selectInput" class="bagel-input" :title="label">
|
|
3
|
+
<label v-if="label" for="label" :class="{ active: showList }">{{ label }}</label>
|
|
4
|
+
<div class="custom-select" ref="selectEl" :class="{ 'open-select': showList }">
|
|
5
|
+
<TextInput @keydown.capture="handleKeydown" @click.stop="toggleShowList" :modelValue="displayValue"
|
|
6
|
+
:required="required" />
|
|
28
7
|
<Teleport to="#app">
|
|
29
|
-
<div
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:class="{ 'open-select': showList && editMode }"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
v-for="option in optionsRef"
|
|
36
|
-
:key="option.value"
|
|
37
|
-
@click="handleSelect(option)"
|
|
38
|
-
>
|
|
39
|
-
<LangText :input="option.label" />
|
|
8
|
+
<div ref="dropdown" class="custom-select-drop" :class="{ 'open-select': showList }">
|
|
9
|
+
<div v-for="option in optionList" :key="option.value" @click="handleSelect(option)">
|
|
10
|
+
{{ option.label }}
|
|
40
11
|
</div>
|
|
41
12
|
</div>
|
|
42
13
|
</Teleport>
|
|
@@ -46,127 +17,102 @@
|
|
|
46
17
|
|
|
47
18
|
<script lang="ts" setup>
|
|
48
19
|
import {
|
|
49
|
-
onMounted, onUnmounted,
|
|
50
|
-
watch,
|
|
20
|
+
onMounted, onUnmounted,
|
|
51
21
|
} from 'vue';
|
|
52
|
-
import {
|
|
53
|
-
|
|
22
|
+
import { TextInput } from '.';
|
|
23
|
+
|
|
24
|
+
type Option = {
|
|
25
|
+
label: string;
|
|
26
|
+
value: string | number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type RawOption = Option | string | number;
|
|
30
|
+
|
|
31
|
+
const selectEl = $ref<HTMLElement>();
|
|
32
|
+
const dropdown = $ref<HTMLElement>();
|
|
33
|
+
const selectInput = $ref<HTMLElement>();
|
|
34
|
+
let focusedIndex = $ref(-1);
|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
const showList = ref(false);
|
|
36
|
+
let showList = $ref(false);
|
|
37
|
+
const selectedValue = defineModel<string | number>();
|
|
58
38
|
const props = withDefaults(
|
|
59
|
-
defineProps<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
description?: string;
|
|
67
|
-
}
|
|
39
|
+
defineProps<{
|
|
40
|
+
options: RawOption[] | string;
|
|
41
|
+
label?: string;
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
required?: boolean;
|
|
44
|
+
helptext?: string;
|
|
45
|
+
}
|
|
68
46
|
>(),
|
|
69
47
|
{
|
|
70
|
-
|
|
71
|
-
editMode: true,
|
|
48
|
+
helptext: '',
|
|
72
49
|
label: '',
|
|
73
50
|
placeholder: '',
|
|
74
51
|
},
|
|
75
52
|
);
|
|
76
|
-
const left = ref('0');
|
|
77
|
-
const top = ref(0);
|
|
78
|
-
const width = ref('0');
|
|
79
|
-
const selectedValue = ref('');
|
|
80
|
-
const optionsRef = ref<{ label: string; value: string | number }[]>([]);
|
|
81
|
-
const displayValue = computed(() => {
|
|
82
|
-
const option = optionsRef.value.find((o) => o.value === selectedValue.value);
|
|
83
|
-
return option?.label || '';
|
|
84
|
-
});
|
|
85
|
-
const emits = defineEmits(['update:modelValue', 'selected']);
|
|
86
53
|
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
function handleKeydown(event: KeyboardEvent) {
|
|
55
|
+
if (event.key === 'Escape') {
|
|
56
|
+
showList = false;
|
|
57
|
+
}
|
|
58
|
+
// arrow down
|
|
59
|
+
if (event.key === 'ArrowDown') {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
focusedIndex++;
|
|
62
|
+
}
|
|
91
63
|
}
|
|
92
64
|
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
showList.value = false;
|
|
97
|
-
emits('update:modelValue', selectedValue);
|
|
65
|
+
function optnToValueLabel(option: RawOption): Option {
|
|
66
|
+
if (typeof option === 'string' || typeof option === 'number') {
|
|
67
|
+
return { label: `${option}`, value: option };
|
|
98
68
|
}
|
|
99
|
-
|
|
69
|
+
return option;
|
|
100
70
|
}
|
|
101
71
|
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
bottom: 0,
|
|
108
|
-
};
|
|
109
|
-
if (e?.deltaY) {
|
|
110
|
-
// top.value = top.value + e.deltaY * -1
|
|
111
|
-
} else {
|
|
112
|
-
//
|
|
113
|
-
}
|
|
114
|
-
top.value = elInfo.bottom;
|
|
72
|
+
const optionList = $computed<Option[]>(() => {
|
|
73
|
+
const optns = typeof props.options === 'string' ? props.options.split('\n|,') : props.options;
|
|
74
|
+
return optns.map(optnToValueLabel);
|
|
75
|
+
});
|
|
76
|
+
const displayValue = $computed(() => optionList.find((optn) => optn.value === selectedValue.value)?.label || '');
|
|
115
77
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
};
|
|
78
|
+
function handleSelect(option: Option) {
|
|
79
|
+
selectedValue.value = option.value;
|
|
80
|
+
showList = false;
|
|
81
|
+
}
|
|
121
82
|
|
|
122
|
-
|
|
123
|
-
|
|
83
|
+
function closestScrollableParent(element?: HTMLElement | null) {
|
|
84
|
+
if (!element) return null;
|
|
85
|
+
while (element) {
|
|
86
|
+
const style = window.getComputedStyle(element);
|
|
87
|
+
if ((style.overflowY !== 'visible' && element.scrollHeight > element.clientHeight) ||
|
|
88
|
+
(style.overflowX !== 'visible' && element.scrollWidth > element.clientWidth)) {
|
|
89
|
+
return element;
|
|
90
|
+
}
|
|
91
|
+
element = element.parentElement;
|
|
124
92
|
}
|
|
93
|
+
return null;
|
|
125
94
|
}
|
|
126
95
|
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
showList.value = false;
|
|
134
|
-
}
|
|
96
|
+
function positionDropdown() {
|
|
97
|
+
if (!selectEl || !dropdown) return;
|
|
98
|
+
const { top, left, width } = selectEl.getBoundingClientRect();
|
|
99
|
+
dropdown.style.top = `${top + 40}px`;
|
|
100
|
+
dropdown.style.left = `${left}px`;
|
|
101
|
+
dropdown.style.width = `${width}px`;
|
|
135
102
|
}
|
|
136
103
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
()
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
{ immediate: true },
|
|
143
|
-
);
|
|
104
|
+
function toggleShowList() {
|
|
105
|
+
showList = !showList;
|
|
106
|
+
positionDropdown();
|
|
107
|
+
}
|
|
144
108
|
|
|
145
109
|
onMounted(() => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
selectedValue.value = props.modelValue;
|
|
150
|
-
if (typeof props.field.options === 'string') {
|
|
151
|
-
props.field.options.split('\n').forEach((option) => {
|
|
152
|
-
optionsRef.value?.push({ label: option, value: option });
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
props.field.options.forEach((option) => {
|
|
156
|
-
optionsRef.value?.push(option);
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
document.addEventListener('click', handleClick);
|
|
110
|
+
const scrollable = closestScrollableParent(selectInput);
|
|
111
|
+
scrollable?.addEventListener('scroll', positionDropdown);
|
|
160
112
|
});
|
|
161
113
|
|
|
162
|
-
function toggleShowList() {
|
|
163
|
-
setPosition();
|
|
164
|
-
showList.value = !showList.value;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
114
|
onUnmounted(() => {
|
|
168
|
-
|
|
169
|
-
// window.removeEventListener('wheel', hideDrop);
|
|
115
|
+
closestScrollableParent(selectInput)?.removeEventListener('scroll', positionDropdown);
|
|
170
116
|
});
|
|
171
117
|
</script>
|
|
172
118
|
|
|
@@ -209,20 +155,16 @@ onUnmounted(() => {
|
|
|
209
155
|
}
|
|
210
156
|
|
|
211
157
|
[dir='rtl'] .custom-select-drop {
|
|
212
|
-
inset-inline-end: v-bind(left);
|
|
213
158
|
inset-inline-start: unset;
|
|
214
159
|
}
|
|
215
160
|
|
|
216
161
|
.custom-select-drop {
|
|
217
|
-
position:
|
|
218
|
-
|
|
162
|
+
position: absolute;
|
|
219
163
|
cursor: pointer;
|
|
220
164
|
font-size: 12px;
|
|
221
|
-
top: v-bind('`${top}px`');
|
|
222
|
-
inset-inline-start: v-bind(left);
|
|
223
165
|
box-sizing: border-box;
|
|
224
166
|
min-width: 220px;
|
|
225
|
-
width:
|
|
167
|
+
width: 100%;
|
|
226
168
|
background: var(--bgl-white);
|
|
227
169
|
box-shadow: 0 0 10px 0 var(--bgl-shadow);
|
|
228
170
|
border-radius: 10px;
|
|
@@ -230,7 +172,7 @@ onUnmounted(() => {
|
|
|
230
172
|
overflow-y: auto;
|
|
231
173
|
opacity: 0;
|
|
232
174
|
pointer-events: none;
|
|
233
|
-
max-height: 0;
|
|
175
|
+
/* max-height: 0; */
|
|
234
176
|
/*transition: var(--bgl-transition);*/
|
|
235
177
|
}
|
|
236
178
|
|