@bagelink/vue 0.0.164 → 0.0.170
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/DataPreview.vue.d.ts +3 -19
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/FormSchema.vue.d.ts +3 -19
- package/dist/components/FormSchema.vue.d.ts.map +1 -1
- package/dist/components/PersonPreview.vue.d.ts +1 -1
- package/dist/components/PersonPreview.vue.d.ts.map +1 -1
- package/dist/components/TabbedLayout.vue.d.ts +1 -1
- package/dist/components/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/formkit/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +10 -8
- package/dist/components/formkit/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +206 -349
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +206 -349
- package/dist/plugins/bagel.d.ts +3 -0
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/style.css +227 -323
- package/package.json +1 -1
- package/src/components/DataPreview.vue +5 -6
- package/src/components/FormSchema.vue +7 -10
- package/src/components/PersonPreview.vue +147 -123
- package/src/components/TabbedLayout.vue +50 -59
- package/src/components/form/inputs/Checkbox.vue +1 -1
- package/src/components/formkit/FileUploader.vue +264 -254
- package/src/components/formkit/index.ts +10 -8
- package/src/components/index.ts +0 -1
- package/src/index.ts +1 -1
- package/src/plugins/bagel.ts +17 -1
- package/src/styles/dark.css +79 -21
- package/src/styles/inputs.css +4 -9
- package/src/styles/theme.css +6 -0
- package/src/components/FileUploader.vue +0 -345
package/package.json
CHANGED
|
@@ -45,19 +45,18 @@
|
|
|
45
45
|
</template>
|
|
46
46
|
|
|
47
47
|
<script lang="ts" setup>
|
|
48
|
-
import { keyToLabel } from '@bagelink/vue';
|
|
48
|
+
import { keyToLabel, useI18nT } from '@bagelink/vue';
|
|
49
|
+
|
|
50
|
+
const i18nT = useI18nT();
|
|
49
51
|
|
|
50
52
|
const keysToIgnore = ['id', 'person_id', 'person', 'created_at', 'updated_at'];
|
|
51
53
|
|
|
52
54
|
// const props =
|
|
53
|
-
|
|
55
|
+
defineProps<{
|
|
54
56
|
data: Record<string, any>,
|
|
55
57
|
schema?: Record<string, any>[],
|
|
56
58
|
title?: string,
|
|
57
|
-
|
|
58
|
-
}>(), {
|
|
59
|
-
i18nT: (str: string) => str,
|
|
60
|
-
});
|
|
59
|
+
}>();
|
|
61
60
|
</script>
|
|
62
61
|
|
|
63
62
|
<style scoped>
|
|
@@ -30,34 +30,31 @@ import { reactive } from 'vue';
|
|
|
30
30
|
import { type FormKitSchemaDefinition } from '@formkit/core';
|
|
31
31
|
|
|
32
32
|
import { Btn } from '@bagelink/vue';
|
|
33
|
-
import { useModal } from '..';
|
|
33
|
+
import { useModal, useI18nT } from '..';
|
|
34
34
|
|
|
35
35
|
const { showModal } = useModal();
|
|
36
|
+
const i18nT = useI18nT();
|
|
36
37
|
const emits = defineEmits(['update:modelValue', 'submit']);
|
|
37
38
|
const handleEmit = (val: any) => emits('update:modelValue', val);
|
|
38
39
|
const runSubmit = (val: any) => emits('submit', val);
|
|
39
40
|
|
|
40
|
-
const props =
|
|
41
|
+
const props = defineProps<{
|
|
41
42
|
modelValue?: any;
|
|
42
43
|
schema: FormKitSchemaDefinition;
|
|
43
44
|
// eslint-disable-next-line no-unused-vars
|
|
44
45
|
onDelete?: ((id: string) => void);
|
|
45
|
-
|
|
46
|
-
i18nT?: (key: string) => string;
|
|
47
|
-
}>(), {
|
|
48
|
-
i18nT: (key: string) => key,
|
|
49
|
-
});
|
|
46
|
+
}>();
|
|
50
47
|
|
|
51
48
|
const data = reactive({
|
|
52
49
|
...props.modelValue,
|
|
53
|
-
t: (val: string) =>
|
|
50
|
+
t: (val: string) => i18nT?.(val) || val,
|
|
54
51
|
});
|
|
55
52
|
|
|
56
53
|
const runDelete = () => {
|
|
57
54
|
showModal(
|
|
58
55
|
{
|
|
59
56
|
class: 'small-modal',
|
|
60
|
-
title:
|
|
57
|
+
title: i18nT('Are you sure?'),
|
|
61
58
|
actions: [
|
|
62
59
|
{
|
|
63
60
|
value: 'Confirm',
|
|
@@ -67,7 +64,7 @@ const runDelete = () => {
|
|
|
67
64
|
{ value: 'Cancel', color: 'gray' },
|
|
68
65
|
],
|
|
69
66
|
},
|
|
70
|
-
{ default:
|
|
67
|
+
{ default: i18nT('form.deleteMessage') },
|
|
71
68
|
);
|
|
72
69
|
};
|
|
73
70
|
</script>
|
|
@@ -1,175 +1,199 @@
|
|
|
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
|
-
|
|
2
|
+
<div
|
|
3
|
+
@click="onClick"
|
|
4
|
+
class="person-card"
|
|
5
|
+
v-if="person"
|
|
6
|
+
>
|
|
7
|
+
<div
|
|
8
|
+
class="person-card-edit flex gap-2"
|
|
9
|
+
v-if="!onClick"
|
|
10
|
+
>
|
|
11
|
+
<Btn
|
|
12
|
+
round
|
|
13
|
+
thin
|
|
14
|
+
icon.end="arrow_outward"
|
|
15
|
+
value="Profile"
|
|
16
|
+
v-if="!$route.path.match('/search')"
|
|
17
|
+
is="router-link"
|
|
18
|
+
:to="`/search/${person.id}`"
|
|
19
|
+
/>
|
|
20
|
+
<Btn
|
|
21
|
+
thin
|
|
22
|
+
flat
|
|
23
|
+
@click="showEditForm"
|
|
24
|
+
icon="edit"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="person-card-icon-wrap">
|
|
28
|
+
<p class="person-card-icon">
|
|
29
|
+
{{ initials(person.first_name, person.last_name) }}
|
|
30
|
+
</p>
|
|
31
|
+
<p class="person-card-name txt20">
|
|
32
|
+
{{ person.first_name }} {{ person.last_name }}
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="person-card-details-wrap">
|
|
37
|
+
<div
|
|
38
|
+
class="person-card-details"
|
|
39
|
+
v-if="person.phone?.length"
|
|
40
|
+
>
|
|
41
|
+
<MaterialIcon icon="phone" />
|
|
42
|
+
<p
|
|
43
|
+
v-for="phone in person.phone"
|
|
44
|
+
:key="phone.id"
|
|
45
|
+
>
|
|
46
|
+
{{ phone.phone }}
|
|
47
|
+
</p>
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
class="person-card-details"
|
|
51
|
+
v-if="person.email?.length"
|
|
52
|
+
>
|
|
53
|
+
<MaterialIcon icon="email" />
|
|
54
|
+
<p
|
|
55
|
+
v-for="email in person.email"
|
|
56
|
+
:key="email.id"
|
|
57
|
+
>
|
|
58
|
+
{{ email.email }}
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
<div
|
|
62
|
+
class="person-card-details badge"
|
|
63
|
+
v-if="person.date_of_birth || person.gender"
|
|
64
|
+
>
|
|
65
|
+
<MaterialIcon icon="badge" />
|
|
66
|
+
<p v-if="person.date_of_birth">
|
|
67
|
+
{{ person.date_of_birth }}
|
|
68
|
+
</p>
|
|
69
|
+
<p v-if="person.gender">
|
|
70
|
+
{{ person.gender }}
|
|
71
|
+
</p>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
51
75
|
</template>
|
|
52
76
|
|
|
53
77
|
<script lang="ts" setup>
|
|
54
|
-
import type { FormKitSchemaDefinition } from
|
|
55
|
-
import type { Person } from
|
|
56
|
-
import { initials, Btn, MaterialIcon } from
|
|
57
|
-
import { useBagel, useModal } from
|
|
78
|
+
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
79
|
+
import type { Person } from '@bagelink/vue';
|
|
80
|
+
import { initials, Btn, MaterialIcon } from '@bagelink/vue';
|
|
81
|
+
import { useBagel, useModal } from '..';
|
|
58
82
|
|
|
59
83
|
// const toast = useToast(); // TODO: use toast
|
|
60
84
|
const bagel = useBagel();
|
|
61
85
|
const { modalForm } = useModal();
|
|
62
86
|
|
|
63
87
|
const props = defineProps<{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
person: Person;
|
|
89
|
+
// eslint-disable-next-line no-unused-vars
|
|
90
|
+
onClick?: (event: MouseEvent) => void;
|
|
91
|
+
personSchema: () => FormKitSchemaDefinition;
|
|
68
92
|
}>();
|
|
69
93
|
|
|
70
94
|
const showEditForm = async () => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
95
|
+
const { first_name, last_name } = props.person;
|
|
96
|
+
modalForm({
|
|
97
|
+
side: true,
|
|
98
|
+
title: `${first_name} ${last_name}`,
|
|
99
|
+
schema: props.personSchema(),
|
|
100
|
+
modelValue: props.person,
|
|
101
|
+
onSubmit: (newPerson) => bagel.put('/person', newPerson),
|
|
102
|
+
// .then(() => toast.success(i18nT('updatedSuccessfully'))),
|
|
103
|
+
});
|
|
80
104
|
};
|
|
81
105
|
</script>
|
|
82
106
|
<style>
|
|
83
107
|
.person-card {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
108
|
+
border: 1.1px solid var(--border-color);
|
|
109
|
+
/* background: var(--input-bg); */
|
|
110
|
+
border-radius: var(--card-border-radius);
|
|
111
|
+
padding: 1rem;
|
|
112
|
+
margin-bottom: 0.5rem;
|
|
113
|
+
font-size: 1rem;
|
|
114
|
+
position: relative;
|
|
91
115
|
}
|
|
92
116
|
|
|
93
117
|
.person-card p {
|
|
94
|
-
|
|
118
|
+
margin: 0;
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
.person-card-details {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
margin-bottom: 2px;
|
|
124
|
+
line-height: 1.3;
|
|
125
|
+
display: flex;
|
|
102
126
|
}
|
|
103
127
|
|
|
104
128
|
.person-card-details p {
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
color: var(--input-color);
|
|
130
|
+
opacity: 0.6;
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
.person-card-details.badge p {
|
|
110
|
-
|
|
134
|
+
opacity: 1;
|
|
111
135
|
}
|
|
112
136
|
|
|
113
137
|
.person-card-details p:nth-child(2) {
|
|
114
|
-
|
|
115
|
-
|
|
138
|
+
opacity: 1;
|
|
139
|
+
padding-inline-end: 0.5rem;
|
|
116
140
|
}
|
|
117
141
|
|
|
118
142
|
.person-card-details .icon-font {
|
|
119
|
-
|
|
120
|
-
|
|
143
|
+
color: var(--bgl-primary);
|
|
144
|
+
padding-inline-end: 0.25rem;
|
|
121
145
|
}
|
|
122
146
|
|
|
123
147
|
.person-card-edit {
|
|
124
|
-
|
|
125
|
-
|
|
148
|
+
position: absolute;
|
|
149
|
+
inset-inline-end: 1rem;
|
|
126
150
|
}
|
|
127
151
|
|
|
128
152
|
.person-card-details-wrap {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
153
|
+
display: flex;
|
|
154
|
+
gap: 0.5rem;
|
|
155
|
+
flex-wrap: wrap;
|
|
132
156
|
}
|
|
133
157
|
|
|
134
158
|
.person-card-icon {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
background: var(--bgl-gray);
|
|
160
|
+
height: 30px;
|
|
161
|
+
width: 30px;
|
|
162
|
+
border-radius: 100%;
|
|
163
|
+
text-transform: uppercase;
|
|
164
|
+
display: flex;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
align-items: center;
|
|
167
|
+
color: white;
|
|
168
|
+
font-size: 12px;
|
|
145
169
|
}
|
|
146
170
|
|
|
147
171
|
.person-card-icon-wrap {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
172
|
+
display: flex;
|
|
173
|
+
gap: 0.5rem;
|
|
174
|
+
align-items: center;
|
|
175
|
+
padding-bottom: 0.75rem;
|
|
152
176
|
}
|
|
153
177
|
|
|
154
178
|
@media screen and (max-width: 910px) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
.person-card-icon-wrap {
|
|
180
|
+
padding-bottom: 0.5rem;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.person-card {
|
|
184
|
+
padding: 0.75rem;
|
|
185
|
+
position: relative;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.person-card-edit {
|
|
189
|
+
/* position: relative; */
|
|
190
|
+
inset-inline-end: 0.5rem;
|
|
191
|
+
margin-bottom: 1rem;
|
|
192
|
+
justify-content: flex-end;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.person-card-name {
|
|
196
|
+
max-width: calc(100% - 170px);
|
|
197
|
+
}
|
|
174
198
|
}
|
|
175
199
|
</style>
|
|
@@ -1,83 +1,74 @@
|
|
|
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
|
-
</div>
|
|
32
|
-
</div>
|
|
2
|
+
<div class="h-100 grid list-view gap-3">
|
|
3
|
+
<div class="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
|
+
<!-- <TransitionRouterView v-if="baseRoute" /> -->
|
|
22
|
+
<div
|
|
23
|
+
class="list-content"
|
|
24
|
+
v-for="tab in tabs.filter((item) => item === activeTab)"
|
|
25
|
+
:key="tab"
|
|
26
|
+
>
|
|
27
|
+
<slot :name="tab" :key="tab" />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
33
30
|
</template>
|
|
34
31
|
|
|
35
32
|
<script setup lang="ts">
|
|
36
|
-
import { onMounted } from
|
|
37
|
-
import type { Router } from
|
|
33
|
+
import { onMounted } from "vue";
|
|
34
|
+
import type { Router } from "vue-router";
|
|
38
35
|
|
|
39
|
-
const emit = defineEmits([
|
|
36
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
40
37
|
|
|
41
38
|
let activeTab = $ref<string>();
|
|
42
39
|
const props = defineProps<{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
title?: string;
|
|
41
|
+
tabs: string[];
|
|
42
|
+
modelValue?: string;
|
|
43
|
+
router: Router;
|
|
47
44
|
}>();
|
|
48
45
|
|
|
49
46
|
function changeTab(tab: string) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
const { router } = props;
|
|
48
|
+
activeTab = tab;
|
|
49
|
+
void router.push({
|
|
50
|
+
path: router.currentRoute.value.path,
|
|
51
|
+
query: { ...router.currentRoute.value.query, t: tab },
|
|
52
|
+
hash: router.currentRoute.value.hash,
|
|
53
|
+
});
|
|
54
|
+
emit("update:modelValue", activeTab);
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
onMounted(() => {
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
const firstTab =
|
|
59
|
+
props.modelValue ||
|
|
60
|
+
props.router.currentRoute.value.query.t ||
|
|
61
|
+
props.tabs[0];
|
|
62
|
+
activeTab = firstTab as string;
|
|
63
63
|
});
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style scoped>
|
|
67
67
|
.tab {
|
|
68
|
-
|
|
68
|
+
text-transform: capitalize;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/* .top-section {
|
|
72
|
-
grid-area: top-section;
|
|
73
|
-
font-size: 10px;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.detail-section {
|
|
77
|
-
grid-area: detail-section;
|
|
78
|
-
} */
|
|
79
71
|
.card.tabs-top {
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
/* width: 99%; */
|
|
82
73
|
}
|
|
83
74
|
</style>
|