@bagelink/vue 0.0.331 → 0.0.337
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/MaterialIcon.vue.d.ts +4 -2
- package/dist/components/MaterialIcon.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +24 -16
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/Layout.vue.d.ts +8 -0
- package/dist/components/layout/Layout.vue.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/layout/TabbedLayout.vue.d.ts +38 -0
- package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -0
- package/dist/components/layout/Tabs.vue.d.ts +24 -0
- package/dist/components/layout/Tabs.vue.d.ts.map +1 -0
- package/dist/components/layout/TabsBody.vue.d.ts +21 -0
- package/dist/components/layout/TabsBody.vue.d.ts.map +1 -0
- package/dist/components/layout/TabsNav.vue.d.ts +25 -0
- package/dist/components/layout/TabsNav.vue.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +4 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/tabsManager.d.ts +4 -0
- package/dist/components/layout/tabsManager.d.ts.map +1 -0
- package/dist/index.cjs +806 -2027
- package/dist/index.mjs +808 -2029
- package/dist/style.css +420 -504
- package/dist/types/index.d.ts +7 -1
- package/dist/types/index.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/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/MaterialIcon.vue +3 -2
- package/src/components/PageTitle.vue +10 -20
- package/src/components/form/BglField.vue +2 -2
- package/src/components/form/BglForm.vue +0 -1
- package/src/components/form/inputs/SelectInput.vue +161 -482
- package/src/components/index.ts +0 -2
- package/src/components/layout/Layout.vue +34 -13
- package/src/components/layout/SidebarMenu.vue +22 -22
- package/src/components/layout/TabbedLayout.vue +79 -0
- package/src/components/layout/Tabs.vue +19 -0
- package/src/components/layout/TabsBody.vue +15 -0
- package/src/components/layout/TabsNav.vue +48 -0
- package/src/components/layout/index.ts +4 -0
- package/src/components/layout/tabsManager.ts +18 -0
- package/src/styles/appearance.css +42 -0
- package/src/styles/layout.css +74 -12
- package/src/styles/mobilLayout.css +77 -17
- package/src/styles/text.css +153 -1
- package/src/types/index.ts +9 -1
- package/src/types/materialIcons.ts +1180 -1178
- package/src/utils/index.ts +0 -1
- package/src/components/ComboBox.vue +0 -171
- package/src/components/TabbedLayout.vue +0 -87
package/src/utils/index.ts
CHANGED
|
@@ -44,7 +44,6 @@ export function bindAttrs<T = Record<string, any>>(attrs?: Attributes, fieldVal?
|
|
|
44
44
|
key,
|
|
45
45
|
typeof value === 'function' ? value(fieldVal, row) : value,
|
|
46
46
|
]);
|
|
47
|
-
if (attrs.options) console.log('arr', arr);
|
|
48
47
|
const resolvedAttrs = Object.fromEntries(arr);
|
|
49
48
|
return resolvedAttrs;
|
|
50
49
|
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
<template>
|
|
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 class="combobox-options p-05" :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 hover gap-1" v-for="(option, i) in filteredOptions" :key="`${option}${i}`" @click="() => {
|
|
19
|
-
select(option); hide();
|
|
20
|
-
}" :class="{ selected: option === selectedItem }"
|
|
21
|
-
>
|
|
22
|
-
<Icon v-if="isSelected(option)" icon="check" />
|
|
23
|
-
<Icon class="opacity-3" v-if="!isSelected(option)" icon="fiber_manual_record" />
|
|
24
|
-
<span >
|
|
25
|
-
{{ getLabel(option) }}
|
|
26
|
-
</span>
|
|
27
|
-
</div>
|
|
28
|
-
<slot name="last" />
|
|
29
|
-
</Card>
|
|
30
|
-
</template>
|
|
31
|
-
</Dropdown>
|
|
32
|
-
</template>
|
|
33
|
-
|
|
34
|
-
<script lang="ts" setup>
|
|
35
|
-
import { watch } from 'vue';
|
|
36
|
-
import { Dropdown } from 'floating-vue';
|
|
37
|
-
import 'floating-vue/style.css';
|
|
38
|
-
import {
|
|
39
|
-
TextInput, Card, Icon, MaterialIcon,
|
|
40
|
-
} from '@bagelink/vue';
|
|
41
|
-
|
|
42
|
-
type Option = string | number | Record<string, any> | { label: string, value: string | number };
|
|
43
|
-
let open = $ref(false);
|
|
44
|
-
|
|
45
|
-
const searchInput = $ref<HTMLInputElement | null>(null);
|
|
46
|
-
|
|
47
|
-
const props = defineProps<{
|
|
48
|
-
options: Option[];
|
|
49
|
-
placeholder?: string;
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
modelValue?: Option;
|
|
52
|
-
searchable?: boolean;
|
|
53
|
-
required?: boolean;
|
|
54
|
-
label?: string;
|
|
55
|
-
fullWidth?: boolean;
|
|
56
|
-
}>();
|
|
57
|
-
let selectedItem = $ref<Option>();
|
|
58
|
-
let search = $ref('');
|
|
59
|
-
|
|
60
|
-
const toggle = () => {
|
|
61
|
-
open = !open;
|
|
62
|
-
if (!open) search = '';
|
|
63
|
-
if (open) setTimeout(() => (searchInput as any)?.$el?.querySelector('input')?.focus(), 100);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const valueToLabel = (value?: Option) => {
|
|
67
|
-
if (!value) return '';
|
|
68
|
-
const option = props.options.find((option) => {
|
|
69
|
-
if (typeof option === 'string' || typeof option === 'number') return option === value;
|
|
70
|
-
return option.value === value;
|
|
71
|
-
});
|
|
72
|
-
if (!option) return value;
|
|
73
|
-
return getLabel(option);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const emit = defineEmits(['update:modelValue']);
|
|
77
|
-
|
|
78
|
-
const getLabel = (option: Option) => {
|
|
79
|
-
if (typeof option === 'string') return option;
|
|
80
|
-
if (typeof option === 'number') return `${option}`;
|
|
81
|
-
return option.label;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const isSelected = (option: Option) => {
|
|
85
|
-
if (typeof option === 'string' || typeof option === 'number') return option === selectedItem;
|
|
86
|
-
return option.value === selectedItem;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const filteredOptions = $computed(() => props.options.filter((option) => {
|
|
90
|
-
const searchTerm = new RegExp(search, 'gi');
|
|
91
|
-
if (typeof option === 'string') return option.match(searchTerm);
|
|
92
|
-
if (typeof option === 'number') return `${option}`.match(searchTerm);
|
|
93
|
-
return option.label.match(searchTerm);
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
|
-
const select = (option: Option) => {
|
|
97
|
-
if (typeof option === 'string') selectedItem = option;
|
|
98
|
-
else if (typeof option === 'number') selectedItem = option;
|
|
99
|
-
else selectedItem = option.value;
|
|
100
|
-
emit('update:modelValue', selectedItem);
|
|
101
|
-
open = false;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
watch(() => props.modelValue, (value) => {
|
|
105
|
-
if (value !== selectedItem) selectedItem = value;
|
|
106
|
-
}, { immediate: true });
|
|
107
|
-
</script>
|
|
108
|
-
|
|
109
|
-
<style scoped>
|
|
110
|
-
.combobox {
|
|
111
|
-
width: 100%;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.combobox-option {
|
|
115
|
-
padding: 6px 12px;
|
|
116
|
-
cursor: pointer;
|
|
117
|
-
border-radius: 5px;
|
|
118
|
-
transition: all 0.2s;
|
|
119
|
-
display: grid;
|
|
120
|
-
grid-template-columns: 10px 1fr;
|
|
121
|
-
justify-content: space-between;
|
|
122
|
-
width: 100%;
|
|
123
|
-
font-size: var(--input-font-size);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.combobox-options {
|
|
127
|
-
max-height: 300px;
|
|
128
|
-
overflow-y: auto;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.combobox-option:hover {
|
|
132
|
-
background: var(--bgl-gray-20);
|
|
133
|
-
}
|
|
134
|
-
</style>
|
|
135
|
-
|
|
136
|
-
<style>
|
|
137
|
-
[data-popper-shown]{
|
|
138
|
-
color: var(--bgl-primary) !important;
|
|
139
|
-
}
|
|
140
|
-
.bagel-input label {
|
|
141
|
-
font-size: var(--label-font-size);
|
|
142
|
-
}
|
|
143
|
-
.combobox-btn {
|
|
144
|
-
display: flex;
|
|
145
|
-
justify-content: space-between;
|
|
146
|
-
align-items: center;
|
|
147
|
-
height: var(--input-height);
|
|
148
|
-
border-radius: var(--input-border-radius);
|
|
149
|
-
border: none;
|
|
150
|
-
background: var(--input-bg);
|
|
151
|
-
padding: 0.7rem;
|
|
152
|
-
color: var(--input-color);
|
|
153
|
-
width: 100%;
|
|
154
|
-
font-family: inherit;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.combobox-btn:focus {
|
|
158
|
-
outline: none;
|
|
159
|
-
box-shadow: inset 0 0 10px #00000012;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.v-popper__arrow-container {
|
|
163
|
-
display: none;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.v-popper--theme-dropdown .v-popper__inner {
|
|
167
|
-
border: none;
|
|
168
|
-
background: transparent;
|
|
169
|
-
border-radius: var(--card-border-radius);
|
|
170
|
-
}
|
|
171
|
-
</style>
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="h-100 grid list-view gap-1" :class="{'side-tabs': sideTabs}">
|
|
3
|
-
<div class="bgl_card tabs-top">
|
|
4
|
-
<slot name="top-section" />
|
|
5
|
-
<div class="tabs grid auto-flow-columns fit-content">
|
|
6
|
-
<div
|
|
7
|
-
v-for="tab in tabs"
|
|
8
|
-
:class="{
|
|
9
|
-
active:
|
|
10
|
-
tab === activeTab ||
|
|
11
|
-
tab === router?.currentRoute.value.path.split('/').slice(-1)[0],
|
|
12
|
-
}"
|
|
13
|
-
class="tab"
|
|
14
|
-
:key="tab"
|
|
15
|
-
@click="changeTab(tab)"
|
|
16
|
-
>
|
|
17
|
-
{{ tab }}
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div
|
|
22
|
-
class="list-content"
|
|
23
|
-
v-for="tab in tabs.filter((item) => item === activeTab)"
|
|
24
|
-
:key="tab"
|
|
25
|
-
>
|
|
26
|
-
<slot :name="tab" :key="tab" />
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</template>
|
|
30
|
-
|
|
31
|
-
<script setup lang="ts">
|
|
32
|
-
import { onMounted } from 'vue';
|
|
33
|
-
import type { Router } from 'vue-router';
|
|
34
|
-
|
|
35
|
-
const emit = defineEmits(['update:modelValue']);
|
|
36
|
-
|
|
37
|
-
let activeTab = $ref<string>();
|
|
38
|
-
const props = defineProps<{
|
|
39
|
-
title?: string;
|
|
40
|
-
tabs: string[];
|
|
41
|
-
modelValue?: string;
|
|
42
|
-
router?: Router;
|
|
43
|
-
sideTabs?: boolean;
|
|
44
|
-
}>();
|
|
45
|
-
|
|
46
|
-
function changeTab(tab: string) {
|
|
47
|
-
activeTab = tab;
|
|
48
|
-
emit('update:modelValue', activeTab);
|
|
49
|
-
if (!props.router) return;
|
|
50
|
-
void props.router?.push({
|
|
51
|
-
path: props.router.currentRoute.value.path,
|
|
52
|
-
query: { ...props.router.currentRoute.value.query, t: tab },
|
|
53
|
-
hash: props.router.currentRoute.value.hash,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
onMounted(() => {
|
|
58
|
-
const firstTab =
|
|
59
|
-
props.modelValue ||
|
|
60
|
-
props.router?.currentRoute.value.query.t ||
|
|
61
|
-
props.tabs[0];
|
|
62
|
-
activeTab = firstTab as string;
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<style scoped>
|
|
67
|
-
.tab {
|
|
68
|
-
text-transform: capitalize;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.side-tabs{
|
|
72
|
-
display: flex;
|
|
73
|
-
}
|
|
74
|
-
.side-tabs .tabs-top{
|
|
75
|
-
margin-inline-end: 1rem;
|
|
76
|
-
}
|
|
77
|
-
.side-tabs .tabs{
|
|
78
|
-
display: block;
|
|
79
|
-
padding: 0;
|
|
80
|
-
margin: 0;
|
|
81
|
-
border: none;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.side-tabs .tab{
|
|
85
|
-
border: none;
|
|
86
|
-
}
|
|
87
|
-
</style>
|