@bagelink/vue 0.0.384 → 0.0.392
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 +4 -4
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RadioPillsInput.vue.d.ts +5 -8
- package/dist/components/form/inputs/RadioPillsInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/index.cjs +37 -25
- package/dist/index.mjs +37 -25
- package/dist/style.css +141 -134
- package/package.json +1 -1
- package/src/components/Badge.vue +31 -26
- package/src/components/TableSchema.vue +99 -71
- package/src/components/form/inputs/RadioPillsInput.vue +48 -43
- package/src/components/form/inputs/SelectInput.vue +10 -7
- package/src/styles/modal.css +5 -6
|
@@ -2,21 +2,44 @@
|
|
|
2
2
|
<div class="table-list-wrap h-100">
|
|
3
3
|
<table class="infinite-wrapper">
|
|
4
4
|
<thead class="row first-row">
|
|
5
|
-
<th
|
|
5
|
+
<th
|
|
6
|
+
class="col"
|
|
7
|
+
v-for="field in computedSchema"
|
|
8
|
+
:key="field.id"
|
|
9
|
+
@click="sort(field?.id || '')">
|
|
6
10
|
<div class="flex">
|
|
7
11
|
{{ field.label || keyToLabel(field.id) }}
|
|
8
|
-
<div
|
|
9
|
-
|
|
12
|
+
<div
|
|
13
|
+
class="list-arrows"
|
|
14
|
+
:class="{ sorted: sortField === field.id }">
|
|
15
|
+
<MaterialIcon
|
|
16
|
+
:class="{ desc: sortDirection === 'DESC' }"
|
|
17
|
+
icon="keyboard_arrow_up" />
|
|
10
18
|
</div>
|
|
11
19
|
</div>
|
|
12
20
|
</th>
|
|
13
21
|
</thead>
|
|
14
22
|
<tbody ref="infinite" class="rows infinite" :class="{ loading }">
|
|
15
|
-
<tr
|
|
16
|
-
|
|
17
|
-
|
|
23
|
+
<tr
|
|
24
|
+
v-for="row in data"
|
|
25
|
+
:key="row.id"
|
|
26
|
+
@click="selectElement(row)"
|
|
27
|
+
class="row row-item position-relative">
|
|
28
|
+
<td
|
|
29
|
+
class="col"
|
|
30
|
+
v-for="field in computedSchema"
|
|
31
|
+
:key="`${field.id}-${row.id}`">
|
|
32
|
+
<slot
|
|
33
|
+
v-if="field.id && slots[field.id]"
|
|
34
|
+
:name="field.id"
|
|
35
|
+
:row="row"
|
|
36
|
+
:field="field" />
|
|
18
37
|
<div v-else>
|
|
19
|
-
<BglField
|
|
38
|
+
<BglField
|
|
39
|
+
class="embedded-field"
|
|
40
|
+
:field="field"
|
|
41
|
+
:modelValue="row"
|
|
42
|
+
label="" />
|
|
20
43
|
</div>
|
|
21
44
|
</td>
|
|
22
45
|
</tr>
|
|
@@ -38,8 +61,8 @@ const slots = useSlots();
|
|
|
38
61
|
const loading = $ref(true);
|
|
39
62
|
|
|
40
63
|
const props = defineProps<{
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
data: any[];
|
|
65
|
+
schema: BglFormSchemaT | (() => BglFormSchemaT);
|
|
43
66
|
}>();
|
|
44
67
|
|
|
45
68
|
const computedSchema = $computed(() => {
|
|
@@ -70,126 +93,131 @@ const sort = (fieldname: string) => {
|
|
|
70
93
|
|
|
71
94
|
<style scoped>
|
|
72
95
|
.list-arrows {
|
|
73
|
-
|
|
96
|
+
opacity: 0;
|
|
74
97
|
}
|
|
75
98
|
|
|
76
99
|
.list-arrows .bgl_icon-font {
|
|
77
|
-
|
|
100
|
+
transition: all ease-in-out 0.2s;
|
|
78
101
|
}
|
|
79
102
|
|
|
80
103
|
.list-arrows.sorted {
|
|
81
|
-
|
|
104
|
+
opacity: 1;
|
|
82
105
|
}
|
|
83
106
|
|
|
84
107
|
.col img {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
108
|
+
height: 35px;
|
|
109
|
+
margin-top: -14px;
|
|
110
|
+
margin-bottom: -14px;
|
|
111
|
+
border-radius: 5px;
|
|
89
112
|
}
|
|
90
113
|
|
|
91
114
|
.list-arrows.sorted .desc {
|
|
92
|
-
|
|
115
|
+
transform: rotate(180deg);
|
|
93
116
|
}
|
|
94
117
|
|
|
95
118
|
table {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
border-collapse: separate;
|
|
120
|
+
border-spacing: 0 15px;
|
|
121
|
+
border-collapse: collapse;
|
|
99
122
|
}
|
|
100
123
|
|
|
101
124
|
th {
|
|
102
|
-
|
|
125
|
+
font-weight: 400;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.embedded-field {
|
|
129
|
+
margin-bottom: -0.2rem;
|
|
130
|
+
margin-top: -0.2rem;
|
|
103
131
|
}
|
|
104
132
|
|
|
105
133
|
.row {
|
|
106
|
-
|
|
107
|
-
|
|
134
|
+
border-bottom: 1px solid var(--border-color);
|
|
135
|
+
cursor: pointer;
|
|
108
136
|
}
|
|
109
137
|
|
|
110
138
|
.row.first-row {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
139
|
+
font-size: 0.8rem;
|
|
140
|
+
color: var(--bgl-black-tint);
|
|
141
|
+
position: sticky;
|
|
142
|
+
top: 0;
|
|
143
|
+
z-index: 2;
|
|
144
|
+
background: var(--bgl-white);
|
|
145
|
+
height: 50px;
|
|
146
|
+
vertical-align: bottom;
|
|
119
147
|
}
|
|
120
148
|
|
|
121
149
|
.row.first-row::after {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
150
|
+
content: '';
|
|
151
|
+
border-bottom: 1px solid var(--border-color);
|
|
152
|
+
position: absolute;
|
|
153
|
+
left: 0;
|
|
154
|
+
right: 0;
|
|
155
|
+
bottom: -1px;
|
|
128
156
|
}
|
|
129
157
|
|
|
130
158
|
.first-row .col {
|
|
131
|
-
|
|
132
|
-
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
background: var(--bgl-white);
|
|
133
161
|
}
|
|
134
162
|
|
|
135
163
|
.col {
|
|
136
|
-
|
|
137
|
-
padding: 0.75rem 0.5rem;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
164
|
+
white-space: nowrap;
|
|
165
|
+
padding: 0.75rem 0.5rem;
|
|
166
|
+
transition: var(--bgl-transition);
|
|
167
|
+
line-height: 1;
|
|
168
|
+
align-items: center;
|
|
141
169
|
}
|
|
142
170
|
|
|
143
|
-
.col>div {
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
.col > div {
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: 0.5rem;
|
|
146
174
|
}
|
|
147
175
|
|
|
148
176
|
.max-col-width {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
177
|
+
max-width: 30vw;
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
text-overflow: ellipsis;
|
|
152
180
|
}
|
|
153
181
|
|
|
154
182
|
.col.check .bgl_icon-font {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
border-radius: 100%;
|
|
184
|
+
background: var(--bgl-blue-20);
|
|
185
|
+
color: var(--bgl-primary);
|
|
186
|
+
width: 20px;
|
|
187
|
+
height: 20px;
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
margin-top: -2px;
|
|
164
192
|
}
|
|
165
193
|
|
|
166
194
|
.rows {
|
|
167
|
-
|
|
195
|
+
font-size: 0.8125em;
|
|
168
196
|
}
|
|
169
197
|
|
|
170
198
|
.table-list {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
199
|
+
height: 100%;
|
|
200
|
+
position: relative;
|
|
201
|
+
padding-left: 0 !important;
|
|
202
|
+
padding-right: 0 !important;
|
|
203
|
+
overflow: auto;
|
|
176
204
|
}
|
|
177
205
|
|
|
178
206
|
.BagelTable .table-list {
|
|
179
|
-
|
|
207
|
+
overflow: unset;
|
|
180
208
|
}
|
|
181
209
|
|
|
182
210
|
.row-item {
|
|
183
|
-
|
|
184
|
-
|
|
211
|
+
height: 50px;
|
|
212
|
+
transition: all 200ms ease;
|
|
185
213
|
}
|
|
186
214
|
|
|
187
215
|
.row-item:hover {
|
|
188
|
-
|
|
216
|
+
background: var(--bgl-gray-light);
|
|
189
217
|
}
|
|
190
218
|
|
|
191
219
|
.infinite-wrapper {
|
|
192
|
-
|
|
193
|
-
|
|
220
|
+
overflow-y: auto;
|
|
221
|
+
width: 100%;
|
|
194
222
|
}
|
|
195
223
|
</style>
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="bagel-input">
|
|
3
|
-
<label class="pb-025"
|
|
4
|
-
{{ label
|
|
3
|
+
<label class="pb-025">
|
|
4
|
+
{{ label }}
|
|
5
5
|
</label>
|
|
6
6
|
<div class="flex gap-05 flex-wrap">
|
|
7
|
-
<div class="radio-pill" v-for="(
|
|
7
|
+
<div class="radio-pill" v-for="(option, index) in options" :key="index">
|
|
8
8
|
<input
|
|
9
9
|
type="radio"
|
|
10
|
-
:id="
|
|
10
|
+
:id="getValue(option)"
|
|
11
11
|
:name="id"
|
|
12
|
-
:value="
|
|
13
|
-
:checked="selectedValue ===
|
|
14
|
-
@change="handleSelect"
|
|
15
|
-
>
|
|
16
|
-
<label :for="optioId">{{ label }}</label>
|
|
12
|
+
:value="getValue(option)"
|
|
13
|
+
:checked="selectedValue === getValue(option)"
|
|
14
|
+
@change="handleSelect" />
|
|
15
|
+
<label :for="getValue(option)">{{ getLabel(option) }}</label>
|
|
17
16
|
</div>
|
|
18
17
|
</div>
|
|
19
18
|
</div>
|
|
@@ -22,27 +21,33 @@
|
|
|
22
21
|
<script setup lang="ts">
|
|
23
22
|
import { onMounted, watch } from 'vue';
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
24
|
+
type Option =
|
|
25
|
+
| string
|
|
26
|
+
| number
|
|
27
|
+
| Record<string, any>
|
|
28
|
+
| { label: string; value: string | number };
|
|
29
|
+
|
|
30
30
|
const emits = defineEmits(['update:modelValue']);
|
|
31
31
|
|
|
32
|
+
const getLabel = (option: Option) => {
|
|
33
|
+
if (typeof option === 'string') return option;
|
|
34
|
+
if (typeof option === 'number') return `${option}`;
|
|
35
|
+
return option.label;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const getValue = (option: Option) => {
|
|
39
|
+
if (typeof option === 'string') return option;
|
|
40
|
+
if (typeof option === 'number') return option;
|
|
41
|
+
return option.value;
|
|
42
|
+
};
|
|
43
|
+
|
|
32
44
|
const props = defineProps<{
|
|
33
|
-
options?:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label?: string,
|
|
45
|
+
options?: Option[];
|
|
46
|
+
modelValue: any;
|
|
47
|
+
id?: string;
|
|
48
|
+
label?: string;
|
|
38
49
|
}>();
|
|
39
50
|
|
|
40
|
-
const cumputedOptions = $computed(() => props.options || props.stringOptions.map((v) => ({
|
|
41
|
-
optioId: v,
|
|
42
|
-
label: v,
|
|
43
|
-
value: v,
|
|
44
|
-
})));
|
|
45
|
-
|
|
46
51
|
let selectedValue = $ref('');
|
|
47
52
|
|
|
48
53
|
function handleSelect(e: Event) {
|
|
@@ -56,7 +61,7 @@ watch(
|
|
|
56
61
|
if (newVal === oldVal || oldVal === undefined) return;
|
|
57
62
|
if (selectedValue !== newVal) selectedValue = newVal;
|
|
58
63
|
},
|
|
59
|
-
{ immediate: true }
|
|
64
|
+
{ immediate: true }
|
|
60
65
|
);
|
|
61
66
|
|
|
62
67
|
onMounted(() => {
|
|
@@ -66,30 +71,30 @@ onMounted(() => {
|
|
|
66
71
|
|
|
67
72
|
<style scoped>
|
|
68
73
|
.radio-pill label {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
color: var(--bgl-primary);
|
|
75
|
+
white-space: nowrap;
|
|
76
|
+
border-radius: calc(var(--btn-border-radius) * 2);
|
|
77
|
+
outline: 1px solid var(--bgl-primary);
|
|
78
|
+
padding-left: calc(var(--btn-padding) / 2);
|
|
79
|
+
padding-right: calc(var(--btn-padding) / 2);
|
|
80
|
+
padding-top: calc(var(--btn-padding) / 6);
|
|
81
|
+
padding-bottom: calc(var(--btn-padding) / 6);
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
transition: var(--bgl-transition);
|
|
84
|
+
background: var(--bgl-white);
|
|
85
|
+
user-select: none;
|
|
81
86
|
}
|
|
82
87
|
|
|
83
88
|
.radio-pill label:hover {
|
|
84
|
-
|
|
89
|
+
filter: var(--bgl-hover-filter);
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
.radio-pill input {
|
|
88
|
-
|
|
93
|
+
display: none;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
|
-
.radio-pill input:checked~label {
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
.radio-pill input:checked ~ label {
|
|
97
|
+
background: var(--bgl-primary);
|
|
98
|
+
color: var(--bgl-white);
|
|
94
99
|
}
|
|
95
100
|
</style>
|
|
@@ -173,12 +173,16 @@ watch(
|
|
|
173
173
|
(newVal: Option | Option[]) => {
|
|
174
174
|
if (!newVal) return;
|
|
175
175
|
if (!props.multiselect) {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
const newOption =
|
|
177
|
+
props.options.find((o) => getValue(o) === newVal) || newVal;
|
|
178
|
+
if (!isSelected(newOption)) {
|
|
179
|
+
selectedItems.splice(0, selectedItems.length, newOption);
|
|
180
|
+
}
|
|
178
181
|
} else {
|
|
179
182
|
const isSame = compareArrays([newVal].flat(), selectedItems);
|
|
180
|
-
if (!isSame)
|
|
183
|
+
if (!isSame) {
|
|
181
184
|
selectedItems.splice(0, selectedItems.length, [newVal].flat());
|
|
185
|
+
}
|
|
182
186
|
}
|
|
183
187
|
},
|
|
184
188
|
{ immediate: true }
|
|
@@ -187,15 +191,14 @@ watch(
|
|
|
187
191
|
watch(
|
|
188
192
|
() => props.options,
|
|
189
193
|
() => {
|
|
190
|
-
const original = JSON.stringify(
|
|
194
|
+
const original = JSON.stringify(props.options.map(getValue));
|
|
191
195
|
[...selectedItems].forEach((option, i) => {
|
|
192
196
|
const exists = props.options.find(
|
|
193
197
|
(o) => getValue(o) === getValue(option)
|
|
194
198
|
);
|
|
195
|
-
|
|
196
|
-
else selectedItems.splice(i, 1, exists);
|
|
199
|
+
selectedItems.splice(i, 1, exists);
|
|
197
200
|
});
|
|
198
|
-
const newSelection = JSON.stringify(selectedItems);
|
|
201
|
+
const newSelection = JSON.stringify(selectedItems.map(getValue));
|
|
199
202
|
if (original !== newSelection) emitUpdate();
|
|
200
203
|
}
|
|
201
204
|
);
|
package/src/styles/modal.css
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
overflow: auto;
|
|
14
14
|
margin: 0 auto;
|
|
15
15
|
width: 100%;
|
|
16
|
-
text-align: center;
|
|
17
16
|
display: grid;
|
|
18
17
|
align-items: center;
|
|
19
18
|
}
|
|
@@ -25,9 +24,9 @@
|
|
|
25
24
|
.modal {
|
|
26
25
|
width: 96%;
|
|
27
26
|
max-width: 720px;
|
|
28
|
-
transform: scale(0.5);
|
|
29
|
-
opacity: 0;
|
|
30
|
-
transition: all ease-in-out 0.
|
|
27
|
+
/* transform: scale(0.5); */
|
|
28
|
+
/* opacity: 0; */
|
|
29
|
+
transition: all ease-in-out 0.18s;
|
|
31
30
|
margin-left: auto;
|
|
32
31
|
margin-right: auto;
|
|
33
32
|
height: fit-content;
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
.is-side .modal {
|
|
58
|
-
inset-inline-end: -
|
|
57
|
+
inset-inline-end: -1720px;
|
|
59
58
|
transform: scale(1);
|
|
60
59
|
opacity: 1;
|
|
61
60
|
/* position: fixed; */
|
|
@@ -87,7 +86,7 @@
|
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
.is-active.is-side .modal {
|
|
90
|
-
inset-inline-end:
|
|
89
|
+
inset-inline-end: 0px;
|
|
91
90
|
transform: translateX(0%);
|
|
92
91
|
}
|
|
93
92
|
|