@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
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
>
|
|
15
|
-
{{ option }}
|
|
16
|
-
</p>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
2
|
+
<label>{{ label }}</label>
|
|
3
|
+
<div class="dropdown" @click="toggleDropdown" :class="{ opendrop: isOpen }">
|
|
4
|
+
<div class="dropdown-title" :class="{ hasSelection: selectedOption }">
|
|
5
|
+
{{ selectedOption || placeholder }}
|
|
6
|
+
<MaterialIcon icon="keyboard_arrow_down" />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="dropdown-body">
|
|
9
|
+
<p v-for="(option, index) in options" :key="index" @click.stop="selectOption(option)">
|
|
10
|
+
{{ optionToLabel(option) }}
|
|
11
|
+
</p>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
19
14
|
</template>
|
|
20
15
|
|
|
21
16
|
<script setup lang="ts">
|
|
22
17
|
import { MaterialIcon } from '@bagelink/vue';
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
type Option = {
|
|
20
|
+
label: string;
|
|
21
|
+
value: string;
|
|
22
|
+
} | string | number;
|
|
23
|
+
|
|
29
24
|
const emit = defineEmits(['update:modelValue']);
|
|
30
25
|
|
|
26
|
+
function optionToLabel(option?: Option) {
|
|
27
|
+
if (!option) return '';
|
|
28
|
+
if (typeof option === 'string' || typeof option === 'number') return option;
|
|
29
|
+
return option.label;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function optionToValue(option?: Option) {
|
|
33
|
+
if (!option) return '';
|
|
34
|
+
if (typeof option === 'string' || typeof option === 'number') return option;
|
|
35
|
+
return option.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const props = defineProps<{
|
|
39
|
+
modelValue: string | number,
|
|
40
|
+
options: Option[],
|
|
41
|
+
placeholder?: string,
|
|
42
|
+
label?: string,
|
|
43
|
+
id: string,
|
|
44
|
+
required: boolean
|
|
45
|
+
}>();
|
|
46
|
+
|
|
31
47
|
let isOpen = $ref(false);
|
|
32
|
-
|
|
48
|
+
|
|
49
|
+
let selectedVal = $ref(props.modelValue);
|
|
50
|
+
|
|
51
|
+
const selectedOption = $computed(() => {
|
|
52
|
+
const option = props.options.find((optn) => optionToValue(optn) === selectedVal);
|
|
53
|
+
return optionToLabel(option);
|
|
54
|
+
});
|
|
33
55
|
|
|
34
56
|
function toggleDropdown() {
|
|
35
|
-
|
|
57
|
+
isOpen = !isOpen;
|
|
36
58
|
}
|
|
37
59
|
|
|
38
|
-
function selectOption(option:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
function selectOption(option: Option) {
|
|
61
|
+
selectedVal = optionToValue(option);
|
|
62
|
+
emit('update:modelValue', selectedVal);
|
|
63
|
+
isOpen = false;
|
|
42
64
|
}
|
|
43
65
|
</script>
|
|
44
66
|
|
|
@@ -53,7 +75,7 @@ function selectOption(option: string, index: number) {
|
|
|
53
75
|
|
|
54
76
|
.dropdown-title {
|
|
55
77
|
white-space: nowrap;
|
|
56
|
-
color: var(--bgl-
|
|
78
|
+
color: var(--bgl-gray);
|
|
57
79
|
border-radius: var(--input-border-radius);
|
|
58
80
|
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%);
|
|
59
81
|
padding-left: calc(var(--btn-padding) / 2);
|
|
@@ -69,6 +91,10 @@ function selectOption(option: string, index: number) {
|
|
|
69
91
|
position: relative;
|
|
70
92
|
}
|
|
71
93
|
|
|
94
|
+
.dropdown-title.hasSelection {
|
|
95
|
+
color: var(--bgl-primary);
|
|
96
|
+
}
|
|
97
|
+
|
|
72
98
|
.open .dropdown {
|
|
73
99
|
min-width: 120px;
|
|
74
100
|
}
|
|
@@ -1,112 +1,112 @@
|
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
2
|
+
<div class="table-list-wrap h-100">
|
|
3
|
+
<!-- <Transition name="fade"> -->
|
|
4
|
+
<div class="table-list">
|
|
5
|
+
<table class="infinite-wrapper">
|
|
6
|
+
<thead class="row first-row">
|
|
7
|
+
<th
|
|
8
|
+
class="col"
|
|
9
|
+
v-for="field in columns"
|
|
10
|
+
:key="field.id"
|
|
11
|
+
@click="sort(field.id)"
|
|
12
|
+
>
|
|
13
|
+
<div class="flex">
|
|
14
|
+
{{ field?.label || field.id }}
|
|
15
|
+
<div
|
|
16
|
+
class="list-arrows"
|
|
17
|
+
:class="{ sorted: sortField === field.id }"
|
|
18
|
+
>
|
|
19
|
+
<MaterialIcon
|
|
20
|
+
:class="{ desc: sortDirection === 'DESC' }"
|
|
21
|
+
icon="keyboard_arrow_up"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</th>
|
|
26
|
+
</thead>
|
|
27
|
+
<tbody ref="infinite" class="rows infinite" :class="{ loading }">
|
|
28
|
+
<tr
|
|
29
|
+
@click="selectElement(row)"
|
|
30
|
+
class="row row-item position-relative"
|
|
31
|
+
v-for="row in data"
|
|
32
|
+
:key="row.id"
|
|
33
|
+
>
|
|
34
|
+
<td
|
|
35
|
+
class="col"
|
|
36
|
+
v-for="field in columns"
|
|
37
|
+
:key="`${field.id}-${row.id}`"
|
|
38
|
+
>
|
|
39
|
+
<slot
|
|
40
|
+
v-if="slots[field.id]"
|
|
41
|
+
:name="field.id"
|
|
42
|
+
:row="row"
|
|
43
|
+
:field="field"
|
|
44
|
+
/>
|
|
45
|
+
<div v-else>
|
|
46
|
+
<div v-if="field.inputType === 'DateInput'">
|
|
47
|
+
{{ new Date(row[field.id]).toLocaleDateString() }}
|
|
48
|
+
</div>
|
|
49
|
+
<div v-else-if="field.inputType === 'CheckInput'">
|
|
50
|
+
<MaterialIcon
|
|
51
|
+
icon="check"
|
|
52
|
+
class="pill green"
|
|
53
|
+
v-if="row[field.id]"
|
|
54
|
+
/>
|
|
55
|
+
<MaterialIcon icon="close" class="pill" v-else />
|
|
56
|
+
</div>
|
|
57
|
+
<div v-else-if="field.inputType === 'ItemRef' && row[field.id]">
|
|
58
|
+
<Btn
|
|
59
|
+
v-if="field.refCollection"
|
|
60
|
+
color="gray"
|
|
61
|
+
class="thin"
|
|
62
|
+
@click="
|
|
63
|
+
$router.push(
|
|
64
|
+
`/${field.refCollection}/${row[field.id].id}`
|
|
65
|
+
)
|
|
66
|
+
"
|
|
67
|
+
>
|
|
68
|
+
{{
|
|
69
|
+
field.refFields?.map((k) => row[field.id][k]).join(" ") ||
|
|
70
|
+
row[field.id].id
|
|
71
|
+
}}
|
|
72
|
+
<MaterialIcon icon="arrow_forward" />
|
|
73
|
+
</Btn>
|
|
74
|
+
<Btn
|
|
75
|
+
icon="receipt"
|
|
76
|
+
is="a"
|
|
77
|
+
thin
|
|
78
|
+
v-else-if="field.link"
|
|
79
|
+
:href="row[field.id][field.link]"
|
|
80
|
+
target="_blank"
|
|
81
|
+
>
|
|
82
|
+
{{
|
|
83
|
+
field.refFields?.map((k) => row[field.id][k]).join(" ") ||
|
|
84
|
+
row[field.id].id
|
|
85
|
+
}}
|
|
86
|
+
</Btn>
|
|
87
|
+
<div class="pill" v-else :class="getPillClass(row, field)">
|
|
88
|
+
{{
|
|
89
|
+
field.refFields?.map((k) => row[field.id][k]).join(" ") ||
|
|
90
|
+
row[field.id].id
|
|
91
|
+
}}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="max-col-width" v-else>
|
|
95
|
+
{{ row[field.id] }}
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</td>
|
|
99
|
+
</tr>
|
|
100
|
+
</tbody>
|
|
101
|
+
</table>
|
|
102
|
+
</div>
|
|
103
|
+
<!-- </Transition> -->
|
|
104
|
+
</div>
|
|
105
105
|
</template>
|
|
106
106
|
|
|
107
107
|
<script setup lang="ts">
|
|
108
|
-
import { computed, ref, useSlots } from
|
|
109
|
-
import { BagelField, Btn, MaterialIcon } from
|
|
108
|
+
import { computed, ref, useSlots } from 'vue';
|
|
109
|
+
import { BagelField, Btn, MaterialIcon } from '@bagelink/vue';
|
|
110
110
|
|
|
111
111
|
const slots = useSlots();
|
|
112
112
|
const loading = ref(true);
|
|
@@ -116,39 +116,35 @@ const props = defineProps<{
|
|
|
116
116
|
schema?: BagelField[];
|
|
117
117
|
}>();
|
|
118
118
|
|
|
119
|
-
const emit = defineEmits([
|
|
119
|
+
const emit = defineEmits(['selectElement']);
|
|
120
120
|
|
|
121
121
|
const selectElement = (data: Record<string, any>) => {
|
|
122
|
-
|
|
122
|
+
emit('selectElement', data);
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
// const sortList = () => {};
|
|
126
|
-
const sortDirection = ref(
|
|
127
|
-
const sortField = ref(
|
|
126
|
+
const sortDirection = ref('');
|
|
127
|
+
const sortField = ref('');
|
|
128
128
|
|
|
129
129
|
const sort = (fieldname: string) => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
if (sortField.value === fieldname) {
|
|
131
|
+
if (sortDirection.value === 'ASC') sortDirection.value = 'DESC';
|
|
132
|
+
else sortField.value = '';
|
|
133
|
+
} else {
|
|
134
|
+
sortField.value = fieldname;
|
|
135
|
+
sortDirection.value = 'ASC';
|
|
136
|
+
}
|
|
137
137
|
};
|
|
138
138
|
|
|
139
139
|
const columns = computed<BagelField[]>(
|
|
140
|
-
|
|
141
|
-
props.
|
|
142
|
-
Object.keys(props.data[0]).map((k: string) => ({
|
|
143
|
-
id: k,
|
|
144
|
-
inputType: "PlainText",
|
|
145
|
-
}))
|
|
140
|
+
(): BagelField[] => props.schema ||
|
|
141
|
+
Object.keys(props.data[0]).map((k: string) => ({ id: k, inputType: 'PlainText' })),
|
|
146
142
|
);
|
|
147
143
|
|
|
148
144
|
function getPillClass(row: Record<string, any>, field: BagelField) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
return (
|
|
146
|
+
field.refFields?.map((k) => row[field.id][k]).join(' ') || row[field.id].id
|
|
147
|
+
);
|
|
152
148
|
}
|
|
153
149
|
</script>
|
|
154
150
|
|
package/src/components/Modal.vue
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@keydown.esc="closeModal"
|
|
7
|
-
>
|
|
8
|
-
<div
|
|
9
|
-
class="card modal"
|
|
10
|
-
@click.stop
|
|
11
|
-
>
|
|
2
|
+
<div class="bg-dark" :class="{ 'is-side': side, 'is-active': isActive }"
|
|
3
|
+
@click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal">
|
|
4
|
+
|
|
5
|
+
<div class="card modal" @click.stop>
|
|
12
6
|
<header class="tool-bar">
|
|
13
7
|
<slot name="toolbar" />
|
|
14
|
-
<Btn
|
|
15
|
-
:style="{ float: side ? 'left' : 'right' }"
|
|
16
|
-
flat
|
|
17
|
-
icon="close"
|
|
18
|
-
@click="closeModal"
|
|
19
|
-
/>
|
|
8
|
+
<Btn :style="{ float: side ? 'left' : 'right' }" flat icon="close" @click="closeModal" />
|
|
20
9
|
<h3 class="modal-title">
|
|
21
10
|
{{ title }}
|
|
22
11
|
</h3>
|
|
23
12
|
</header>
|
|
24
13
|
<slot />
|
|
25
14
|
<footer class="modal-footer mt-3">
|
|
26
|
-
<Btn
|
|
27
|
-
v-for="(action, i) in actions"
|
|
28
|
-
:key="i"
|
|
29
|
-
@click="closeModal"
|
|
30
|
-
color="gray"
|
|
31
|
-
v-bind="action"
|
|
32
|
-
/>
|
|
15
|
+
<Btn v-for="(action, i) in actions" :key="i" @click="closeModal" color="gray" v-bind="action" />
|
|
33
16
|
<slot name="footer" />
|
|
34
17
|
</footer>
|
|
35
18
|
</div>
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
</header>
|
|
24
24
|
<BagelForm
|
|
25
25
|
:onDelete="onDelete ? runDelete : undefined"
|
|
26
|
-
|
|
27
|
-
@update:modelValue="handleEmit"
|
|
26
|
+
v-model="formData"
|
|
28
27
|
@submit="runSubmit"
|
|
29
28
|
:schema="computedFormSchema"
|
|
30
29
|
/>
|
|
@@ -45,7 +44,6 @@ const props = defineProps<{
|
|
|
45
44
|
dismissable?: boolean;
|
|
46
45
|
actions?: BtnOptions[];
|
|
47
46
|
schema: BglFormSchemaT | (() => BglFormSchemaT);
|
|
48
|
-
modelValue?: Record<string, any>;
|
|
49
47
|
// eslint-disable-next-line no-unused-vars
|
|
50
48
|
onSubmit?: ((formData: any) => Promise<void>);
|
|
51
49
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -61,10 +59,9 @@ const computedFormSchema = $computed(() => {
|
|
|
61
59
|
|
|
62
60
|
let isActive = $ref<boolean>(false);
|
|
63
61
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
62
|
+
const formData = defineModel<Record<string, any>>('modelValue', { default: {} });
|
|
63
|
+
|
|
64
|
+
const emit = defineEmits(['update:isModalVisible']);
|
|
68
65
|
|
|
69
66
|
const closeModal = () => {
|
|
70
67
|
isActive = false;
|
|
@@ -73,9 +70,9 @@ const closeModal = () => {
|
|
|
73
70
|
}, 200);
|
|
74
71
|
};
|
|
75
72
|
|
|
76
|
-
const runSubmit = async (
|
|
73
|
+
const runSubmit = async () => {
|
|
77
74
|
try {
|
|
78
|
-
await props.onSubmit?.(formData);
|
|
75
|
+
await props.onSubmit?.(formData.value);
|
|
79
76
|
closeModal();
|
|
80
77
|
} catch (err) {
|
|
81
78
|
console.error(err);
|
|
@@ -83,28 +80,17 @@ const runSubmit = async (formData: any) => {
|
|
|
83
80
|
};
|
|
84
81
|
|
|
85
82
|
const runDelete = () => {
|
|
86
|
-
props.onDelete?.(
|
|
83
|
+
props.onDelete?.(formData.value?.id);
|
|
87
84
|
closeModal();
|
|
88
85
|
};
|
|
89
86
|
|
|
90
87
|
const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
|
|
91
88
|
|
|
92
89
|
onMounted(() => {
|
|
93
|
-
setTimeout(() =>
|
|
94
|
-
|
|
95
|
-
}, 1);
|
|
96
|
-
|
|
97
|
-
document.addEventListener(
|
|
98
|
-
'keydown',
|
|
99
|
-
escapeKeyClose,
|
|
100
|
-
);
|
|
101
|
-
});
|
|
102
|
-
onUnmounted(() => {
|
|
103
|
-
document.removeEventListener(
|
|
104
|
-
'keydown',
|
|
105
|
-
escapeKeyClose,
|
|
106
|
-
);
|
|
90
|
+
setTimeout(() => isActive = true, 1);
|
|
91
|
+
document.addEventListener('keydown', escapeKeyClose);
|
|
107
92
|
});
|
|
93
|
+
onUnmounted(() => document.removeEventListener('keydown', escapeKeyClose));
|
|
108
94
|
</script>
|
|
109
95
|
|
|
110
96
|
<style scoped>
|
|
@@ -9,31 +9,42 @@
|
|
|
9
9
|
aria-label="Toggle Navigation"
|
|
10
10
|
tabindex="0"
|
|
11
11
|
>
|
|
12
|
-
<
|
|
13
|
-
chevron_right
|
|
14
|
-
</div>
|
|
12
|
+
<MaterialIcon icon="chevron_right" class="top-arrow" />
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
15
|
<div class="full-nav">
|
|
18
16
|
<div class="nav-scroll">
|
|
19
17
|
<div class="nav-links-wrapper">
|
|
20
|
-
<
|
|
21
|
-
|
|
18
|
+
<component
|
|
19
|
+
:is="link.to?'router-link':'div'"
|
|
20
|
+
v-for="link in links"
|
|
22
21
|
class="nav-button"
|
|
23
22
|
:to="link.to"
|
|
24
23
|
:key="link.label"
|
|
24
|
+
@click="link.onClick?.()"
|
|
25
25
|
>
|
|
26
|
-
<
|
|
27
|
-
{{ link.materialIcon }}
|
|
28
|
-
</div>
|
|
26
|
+
<MaterialIcon :icon="link.materialIcon" />
|
|
29
27
|
<div class="tooltip">
|
|
30
|
-
{{ link.
|
|
28
|
+
{{ link.label }}
|
|
31
29
|
</div>
|
|
32
|
-
</
|
|
30
|
+
</component>
|
|
33
31
|
</div>
|
|
34
32
|
</div>
|
|
35
33
|
|
|
36
34
|
<div class="bot-buttons-wrapper">
|
|
35
|
+
<component
|
|
36
|
+
:is="link.to?'router-link':'div'"
|
|
37
|
+
v-for="link in footerLinks"
|
|
38
|
+
class="nav-button"
|
|
39
|
+
:to="link.to"
|
|
40
|
+
@click="link.onClick?.()"
|
|
41
|
+
:key="link.label"
|
|
42
|
+
>
|
|
43
|
+
<MaterialIcon :icon="link.materialIcon" />
|
|
44
|
+
<div class="tooltip">
|
|
45
|
+
{{ link.label }}
|
|
46
|
+
</div>
|
|
47
|
+
</component>
|
|
37
48
|
<slot name="floor" />
|
|
38
49
|
</div>
|
|
39
50
|
</div>
|
|
@@ -41,19 +52,22 @@
|
|
|
41
52
|
</template>
|
|
42
53
|
|
|
43
54
|
<script lang="ts" setup>
|
|
44
|
-
// import LangText from "../translation/LangText.vue"s
|
|
45
55
|
import type { MaterialIcons } from '@bagelink/vue';
|
|
56
|
+
import { MaterialIcon } from '@bagelink/vue';
|
|
46
57
|
|
|
47
58
|
const isOpen = $ref(true);
|
|
59
|
+
export type NavLink = {
|
|
60
|
+
label: string;
|
|
61
|
+
to?: string;
|
|
62
|
+
materialIcon: MaterialIcons;
|
|
63
|
+
localized?: string;
|
|
64
|
+
onClick?: () => void;
|
|
65
|
+
}
|
|
48
66
|
|
|
49
67
|
withDefaults(
|
|
50
68
|
defineProps<{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
to: string;
|
|
54
|
-
materialIcon: MaterialIcons;
|
|
55
|
-
localized?: string;
|
|
56
|
-
}[];
|
|
69
|
+
footerLinks?: NavLink[];
|
|
70
|
+
links?:NavLink[];
|
|
57
71
|
homeIcon?: MaterialIcons;
|
|
58
72
|
homeLabel?: string;
|
|
59
73
|
homeTo?: string;
|
|
@@ -62,6 +76,8 @@ withDefaults(
|
|
|
62
76
|
homeIcon: 'home',
|
|
63
77
|
homeLabel: 'Home',
|
|
64
78
|
homeTo: '/',
|
|
79
|
+
links: () => [],
|
|
80
|
+
footerLinks: () => [],
|
|
65
81
|
},
|
|
66
82
|
);
|
|
67
83
|
</script>
|