@bagelink/vue 0.0.316 → 0.0.322
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/Badge.vue.d.ts +2 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts +2 -2
- package/dist/components/ComboBox.vue.d.ts +13 -2
- package/dist/components/ComboBox.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +1 -0
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +50 -27
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +1 -0
- package/dist/components/form/inputs/TextInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts +3 -3
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts +1 -7
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/whatsapp/index.d.ts +0 -2
- package/dist/components/whatsapp/index.d.ts.map +1 -1
- package/dist/index.cjs +417 -568
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +417 -568
- package/dist/style.css +224 -258
- package/dist/types/BagelForm.d.ts +1 -1
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/NavLink.d.ts +2 -1
- package/dist/types/NavLink.d.ts.map +1 -1
- package/dist/types/materialIcons.d.ts +1 -1
- package/dist/types/materialIcons.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +23 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Badge.vue +2 -2
- package/src/components/Carousel.vue +137 -137
- package/src/components/ComboBox.vue +72 -49
- package/src/components/ListView.vue +28 -27
- package/src/components/Modal.vue +25 -23
- package/src/components/NavBar.vue +46 -40
- package/src/components/form/BglField.vue +33 -48
- package/src/components/form/BglForm.vue +34 -15
- package/src/components/form/inputs/TextInput.vue +121 -151
- package/src/components/index.ts +1 -1
- package/src/components/layout/Layout.vue +3 -2
- package/src/components/layout/SidebarMenu.vue +5 -12
- package/src/components/whatsapp/index.ts +2 -2
- package/src/styles/layout.css +24 -1
- package/src/styles/text.css +4 -0
- package/src/types/BagelForm.ts +7 -7
- package/src/types/NavLink.ts +2 -1
- package/src/types/materialIcons.ts +1183 -3006
- package/src/utils/BagelFormUtils.ts +58 -0
- package/src/utils/index.ts +3 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<div class="BglCarousel" :style="{ height: yHeight }" :class="{ autoHeight }">
|
|
3
|
+
<div :class="{ dragging: isDragging, clicking: isPressed, [`slides-${items}`]: true, allowScroll }"
|
|
4
|
+
@scrollend="scrollEnd" @mousedown="startDragging" class="bgl-slider" ref="bglSlider">
|
|
5
|
+
<div v-if="isDragging" class="blocker" />
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="Handlers">
|
|
9
|
+
<span @click="prev">
|
|
10
|
+
<slot name="prev" />
|
|
11
|
+
</span>
|
|
12
|
+
<span @click="next">
|
|
13
|
+
<slot name="next" />
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script setup lang="ts">
|
|
@@ -29,55 +29,55 @@ let isPressed = $ref(false);
|
|
|
29
29
|
const emit = defineEmits(['update:index']);
|
|
30
30
|
|
|
31
31
|
const props = defineProps({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
autoHeight: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
allowScroll: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: true,
|
|
39
|
+
},
|
|
40
|
+
freeDrag: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true,
|
|
43
|
+
},
|
|
44
|
+
items: {
|
|
45
|
+
type: Number,
|
|
46
|
+
default: 4,
|
|
47
|
+
},
|
|
48
|
+
index: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 0,
|
|
51
|
+
},
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const disableDrag = () => {
|
|
55
|
-
|
|
55
|
+
bglSlider?.querySelectorAll('img').forEach((e) => e.setAttribute('draggable', 'false'));
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
for (const e of bglSlider?.children as any[] | undefined || []) {
|
|
58
|
+
e.setAttribute('draggable', 'false');
|
|
59
|
+
e.addEventListener('click', (e: any) => e.preventDefault());
|
|
60
|
+
}
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
let yHeight = $ref('auto');
|
|
64
64
|
const evalHeight = () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
if (!props.autoHeight || !bglSlider) return;
|
|
66
|
+
const slidChildren = bglSlider.children[activeSlideIndex].children;
|
|
67
|
+
const height = Array.from(slidChildren).map((el) => el.clientHeight).reduce((a, b) => a + b, 0);
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
yHeight = `${height}px`;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
const goToSlide = (index: number) => {
|
|
73
|
-
|
|
73
|
+
if (!bglSlider || index < 0 || index > bglSlider.children.length - 1) return;
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const slider = bglSlider;
|
|
76
|
+
const scrollX = slider.offsetWidth * index;
|
|
77
|
+
slider.scrollTo({ left: scrollX, behavior: 'smooth' });
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
activeSlideIndex = index;
|
|
80
|
+
evalHeight();
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
watch(() => props.index, goToSlide);
|
|
@@ -85,74 +85,74 @@ watch(() => props.index, goToSlide);
|
|
|
85
85
|
watch(activeSlideIndex, (index) => emit('update:index', index));
|
|
86
86
|
|
|
87
87
|
const scrollEnd = () => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
const slider = bglSlider;
|
|
89
|
+
if (!slider || props.items !== 1) return;
|
|
90
|
+
const nextSlide = Math.round(slider.scrollLeft / slider.offsetWidth);
|
|
91
|
+
goToSlide(nextSlide);
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
const stopDragging = (e: MouseEvent) => {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
isPressed = false;
|
|
96
|
+
const slider = bglSlider;
|
|
97
|
+
if (!slider) return;
|
|
98
|
+
const isDragForward = startX > (e.pageX + slider.offsetLeft);
|
|
99
|
+
if (isDragForward) activeSlideIndex = Math.ceil(slider.scrollLeft / slider.offsetWidth);
|
|
100
|
+
else activeSlideIndex = Math.floor(slider.scrollLeft / slider.offsetWidth);
|
|
101
|
+
if (props.items === 1) goToSlide(activeSlideIndex);
|
|
102
|
+
startX = 0;
|
|
103
|
+
document.removeEventListener('mousemove', move);
|
|
104
|
+
document.removeEventListener('mouseup', stopDragging);
|
|
105
|
+
document.removeEventListener('dragend', stopDragging);
|
|
106
|
+
setTimeout(() => isDragging = false, 100);
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
const move = (e: MouseEvent) => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
if (!bglSlider) return;
|
|
111
|
+
const x = e.pageX - bglSlider.offsetLeft;
|
|
112
|
+
const walk = x - startX;
|
|
113
|
+
if (walk > 20 || walk < -20) isDragging = true;
|
|
114
|
+
if (!isDragging) return;
|
|
115
|
+
const scroll = x - startX;
|
|
116
|
+
bglSlider.scrollLeft = scrollLeft - scroll;
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
// eslint-disable-next-line no-unused-vars
|
|
120
120
|
const startDragging = (e: MouseEvent) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
if (e.button !== 0 || !props.freeDrag || !bglSlider) return;
|
|
122
|
+
startX = e.pageX - bglSlider.offsetLeft;
|
|
123
|
+
scrollLeft = bglSlider.scrollLeft;
|
|
124
|
+
isPressed = true;
|
|
125
|
+
document.addEventListener('mousemove', move);
|
|
126
|
+
document.addEventListener('mouseup', stopDragging);
|
|
127
|
+
document.addEventListener('dragend', stopDragging);
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// eslint-disable-next-line no-unused-vars
|
|
131
131
|
const next = () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
132
|
+
if (!bglSlider) return;
|
|
133
|
+
const slideCount = bglSlider.children.length;
|
|
134
|
+
const isLastSlide = activeSlideIndex >= slideCount - 1;
|
|
135
|
+
if (isLastSlide) goToSlide(0);
|
|
136
|
+
else goToSlide(activeSlideIndex + 1);
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
// eslint-disable-next-line no-unused-vars
|
|
140
140
|
const prev = () => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
if (!bglSlider) return;
|
|
142
|
+
const slideCount = bglSlider.children.length;
|
|
143
|
+
if (activeSlideIndex === 0) goToSlide(slideCount - 1);
|
|
144
|
+
else goToSlide(activeSlideIndex - 1);
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
const evalWidth = () => {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
if (!bglSlider) return;
|
|
149
|
+
goToSlide(activeSlideIndex);
|
|
150
150
|
};
|
|
151
151
|
|
|
152
152
|
onMounted(() => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
window.addEventListener('resize', evalWidth);
|
|
154
|
+
evalHeight();
|
|
155
|
+
disableDrag();
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
onUnmounted(() => window.removeEventListener('resize', evalWidth));
|
|
@@ -160,99 +160,99 @@ onUnmounted(() => window.removeEventListener('resize', evalWidth));
|
|
|
160
160
|
|
|
161
161
|
<style scoped>
|
|
162
162
|
.blocker {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
163
|
+
position: fixed;
|
|
164
|
+
top: 0;
|
|
165
|
+
left: 0;
|
|
166
|
+
width: 100%;
|
|
167
|
+
height: 100%;
|
|
168
|
+
z-index: 100;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
.bgl-slider {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
display: grid;
|
|
173
|
+
position: relative;
|
|
174
|
+
scroll-behavior: smooth;
|
|
175
|
+
grid-auto-flow: column;
|
|
176
|
+
grid-auto-columns: 100%;
|
|
177
|
+
scroll-snap-type: x mandatory;
|
|
178
|
+
overflow-x: hidden;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
.autoHeight {
|
|
182
|
-
|
|
182
|
+
transition: height ease 0.7s;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
.bgl-slider.allowScroll {
|
|
186
|
-
|
|
186
|
+
overflow-x: scroll;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
.bgl-slider.slides-6 {
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
grid-auto-columns: 15.9%;
|
|
191
|
+
gap: 1%;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
.bgl-slider.slides-5 {
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
grid-auto-columns: 19.3%;
|
|
196
|
+
gap: 1%;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
.bgl-slider.slides-4 {
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
grid-auto-columns: 24.3%;
|
|
201
|
+
gap: 1%;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
.bgl-slider.slides-3 {
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
grid-auto-columns: 33%;
|
|
206
|
+
gap: 1%;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
.bgl-slider.slides-2 {
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
grid-auto-columns: 50%;
|
|
211
|
+
gap: 1%;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
.bgl-slider.slides-1 {
|
|
215
|
-
|
|
215
|
+
grid-auto-columns: 100%;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
.bgl-slider::-webkit-scrollbar {
|
|
219
|
-
|
|
219
|
+
display: none;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
.bgl-slider * {
|
|
223
|
-
|
|
223
|
+
scroll-snap-align: start;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
.dragging.bgl-slider {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
227
|
+
cursor: grabbing;
|
|
228
|
+
cursor: -webkit-grabbing;
|
|
229
|
+
scroll-snap-type: unset;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
.clicking.bgl-slider {
|
|
233
|
-
|
|
233
|
+
scroll-behavior: unset;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
.dragging.bgl-slider * {
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
scroll-snap-align: unset;
|
|
238
|
+
user-select: none;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
@media screen and (max-width: 1280px) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
.bgl-slider.slides-4 {
|
|
243
|
+
grid-auto-columns: 33%;
|
|
244
|
+
}
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
@media screen and (max-width: 991px) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
.bgl-slider.slides-4 {
|
|
249
|
+
grid-auto-columns: 50%;
|
|
250
|
+
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
@media screen and (max-width: 600px) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
.bgl-slider.slides-4 {
|
|
255
|
+
grid-auto-columns: 100%;
|
|
256
|
+
}
|
|
257
257
|
}
|
|
258
258
|
</style>
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
<Dropdown placement="bottom-start" class="bagel-input combobox">
|
|
3
|
+
<label>
|
|
4
|
+
{{ label }}
|
|
5
|
+
<button type="button" class="combobox-btn" @click="toggle">
|
|
6
|
+
{{ valueToLabel(selectedItem) || placeholder || 'Select' }}
|
|
7
|
+
<MaterialIcon v-bind="{ 'icon': open ? 'unfold_less' : 'unfold_more' }" />
|
|
8
|
+
</button>
|
|
9
|
+
<input
|
|
10
|
+
style="width: 0; height: 0; position: absolute; opacity: 0; z-index: -1;" v-if="required"
|
|
11
|
+
v-model="selectedItem" required
|
|
12
|
+
>
|
|
13
|
+
</label>
|
|
14
|
+
<template #popper="{ hide }">
|
|
15
|
+
<Card thin class="combobox-options" :style="{width: fullWidth?'100%':'auto'}">
|
|
16
|
+
<TextInput v-if="searchable" ref="searchInput" dense :placeholder="'Search'" icon="search" v-model="search" />
|
|
17
|
+
<div
|
|
18
|
+
class="combobox-option" v-for="(option, i) in filteredOptions" :key="`${option}${i}`" @click="() => {
|
|
19
|
+
select(option); hide();
|
|
20
|
+
}" :class="{ selected: option === selectedItem }"
|
|
21
|
+
>
|
|
22
|
+
<span>
|
|
23
|
+
{{ getLabel(option) }}
|
|
24
|
+
</span>
|
|
25
|
+
<Icon v-if="isSelected(option)" icon="check" />
|
|
26
|
+
</div>
|
|
27
|
+
<slot name="last" />
|
|
28
|
+
</Card>
|
|
29
|
+
</template>
|
|
30
|
+
</Dropdown>
|
|
24
31
|
</template>
|
|
25
32
|
|
|
26
33
|
<script lang="ts" setup>
|
|
@@ -28,7 +35,7 @@ import { watch } from 'vue';
|
|
|
28
35
|
import { Dropdown } from 'floating-vue';
|
|
29
36
|
import 'floating-vue/style.css';
|
|
30
37
|
import {
|
|
31
|
-
|
|
38
|
+
TextInput, Card, Icon, MaterialIcon,
|
|
32
39
|
} from '@bagelink/vue';
|
|
33
40
|
|
|
34
41
|
type Option = string | number | Record<string, any> | { label: string, value: string | number };
|
|
@@ -43,56 +50,58 @@ const props = defineProps<{
|
|
|
43
50
|
modelValue?: Option;
|
|
44
51
|
searchable?: boolean;
|
|
45
52
|
required?: boolean;
|
|
53
|
+
label?: string;
|
|
54
|
+
fullWidth?: boolean;
|
|
46
55
|
}>();
|
|
47
56
|
let selectedItem = $ref<Option>();
|
|
48
57
|
let search = $ref('');
|
|
49
58
|
|
|
50
59
|
const toggle = () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
open = !open;
|
|
61
|
+
if (!open) search = '';
|
|
62
|
+
if (open) setTimeout(() => (searchInput as any)?.$el?.querySelector('input')?.focus(), 100);
|
|
54
63
|
};
|
|
55
64
|
|
|
56
65
|
const valueToLabel = (value?: Option) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
if (!value) return '';
|
|
67
|
+
const option = props.options.find((option) => {
|
|
68
|
+
if (typeof option === 'string' || typeof option === 'number') return option === value;
|
|
69
|
+
return option.value === value;
|
|
70
|
+
});
|
|
71
|
+
if (!option) return value;
|
|
72
|
+
return getLabel(option);
|
|
64
73
|
};
|
|
65
74
|
|
|
66
75
|
const emit = defineEmits(['update:modelValue']);
|
|
67
76
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
const getLabel = (option: Option) => {
|
|
78
|
+
if (typeof option === 'string') return option;
|
|
79
|
+
if (typeof option === 'number') return `${option}`;
|
|
80
|
+
return option.label;
|
|
72
81
|
};
|
|
73
82
|
|
|
74
83
|
const isSelected = (option: Option) => {
|
|
75
|
-
|
|
76
|
-
|
|
84
|
+
if (typeof option === 'string' || typeof option === 'number') return option === selectedItem;
|
|
85
|
+
return option.value === selectedItem;
|
|
77
86
|
};
|
|
78
87
|
|
|
79
88
|
const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const searchTerm = new RegExp(search, 'gi');
|
|
90
|
+
if (typeof option === 'string') return option.match(searchTerm);
|
|
91
|
+
if (typeof option === 'number') return `${option}`.match(searchTerm);
|
|
92
|
+
return option.label.match(searchTerm);
|
|
84
93
|
}));
|
|
85
94
|
|
|
86
95
|
const select = (option: Option) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
if (typeof option === 'string') selectedItem = option;
|
|
97
|
+
else if (typeof option === 'number') selectedItem = option;
|
|
98
|
+
else selectedItem = option.value;
|
|
99
|
+
emit('update:modelValue', selectedItem);
|
|
100
|
+
open = false;
|
|
92
101
|
};
|
|
93
102
|
|
|
94
103
|
watch(() => props.modelValue, (value) => {
|
|
95
|
-
|
|
104
|
+
if (value !== selectedItem) selectedItem = value;
|
|
96
105
|
}, { immediate: true });
|
|
97
106
|
</script>
|
|
98
107
|
|
|
@@ -122,12 +131,26 @@ watch(() => props.modelValue, (value) => {
|
|
|
122
131
|
</style>
|
|
123
132
|
|
|
124
133
|
<style>
|
|
134
|
+
.bagel-input label {
|
|
135
|
+
font-size: var(--label-font-size);
|
|
136
|
+
}
|
|
125
137
|
.combobox-btn {
|
|
126
138
|
display: flex;
|
|
127
139
|
justify-content: space-between;
|
|
128
140
|
align-items: center;
|
|
129
141
|
height: var(--input-height);
|
|
130
142
|
border-radius: var(--input-border-radius);
|
|
143
|
+
border: none;
|
|
144
|
+
background: var(--input-bg);
|
|
145
|
+
padding: 0.7rem;
|
|
146
|
+
color: var(--input-color);
|
|
147
|
+
width: 100%;
|
|
148
|
+
font-family: inherit;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.combobox-btn:focus {
|
|
152
|
+
outline: none;
|
|
153
|
+
box-shadow: inset 0 0 10px #00000012;
|
|
131
154
|
}
|
|
132
155
|
|
|
133
156
|
.v-popper__arrow-container {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="list-wrap bgl_card thin grid overflow-hidden h-100 p-0">
|
|
3
3
|
<div class="p-1">
|
|
4
|
-
<slot
|
|
5
|
-
</div>
|
|
4
|
+
<slot name="header" />
|
|
5
|
+
</div>
|
|
6
|
+
<div class="list-content auto-flow-rows align-items-start overflow-y h-100">
|
|
6
7
|
<slot />
|
|
7
8
|
</div>
|
|
8
9
|
</div>
|
|
@@ -14,46 +15,46 @@ import Card from './Card.vue';
|
|
|
14
15
|
</script>
|
|
15
16
|
|
|
16
17
|
<style>
|
|
17
|
-
.list-wrap{
|
|
18
|
-
|
|
18
|
+
.list-wrap {
|
|
19
|
+
grid-template-rows: auto 1fr;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.list-item {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
position: relative;
|
|
23
|
+
padding: 0.5rem 1rem;
|
|
24
|
+
min-height: -webkit-fit-content;
|
|
25
|
+
min-height: -moz-fit-content;
|
|
26
|
+
min-height: fit-content;
|
|
27
|
+
margin: 0.25rem 0;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
transition: var(--bgl-transition);
|
|
30
|
+
color: var(--bgl-black);
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
position: relative;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.list-item::after {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
content: "";
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: -0.15rem;
|
|
41
|
+
border-bottom: 1px solid var(--border-color);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.list-item:hover,
|
|
45
45
|
.list-item.router-link-active {
|
|
46
|
-
|
|
46
|
+
background-color: var(--bgl-blue-light);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.list-item:active {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
-webkit-filter: var(--bgl-hover-filter);
|
|
51
|
+
filter: var(--bgl-hover-filter);
|
|
52
52
|
}
|
|
53
|
+
|
|
53
54
|
@media screen and (max-width: 910px) {
|
|
54
55
|
|
|
55
|
-
.list-item {
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
.list-item {
|
|
57
|
+
padding: 0.5rem;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
</style>
|