@bagelink/vue 0.0.32 → 0.0.37
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/package.json +8 -2
- package/src/components/Comments.vue +30 -11
- package/src/components/ContactArray.vue +21 -6
- package/src/components/ContactSubmissions.vue +6 -3
- package/src/components/DataPreview.vue +22 -9
- package/src/components/FileUploader.vue +17 -8
- package/src/components/FormKitTable.vue +120 -71
- package/src/components/FormSchema.vue +20 -6
- package/src/components/LangText.vue +3 -1
- package/src/components/ListItem.vue +5 -1
- package/src/components/ListView.vue +25 -10
- package/src/components/MaterialIcon.vue +4 -1
- package/src/components/Modal.vue +17 -5
- package/src/components/ModalForm.vue +23 -8
- package/src/components/NavBar.vue +15 -5
- package/src/components/PersonPreview.vue +5 -7
- package/src/components/PersonPreviewFormkit.vue +5 -5
- package/src/components/RTXEditor.vue +4 -0
- package/src/components/RouterWrapper.vue +10 -2
- package/src/components/TabbedLayout.vue +8 -5
- package/src/components/TableSchema.vue +49 -14
- package/src/components/charts/BarChart.vue +35 -9
- package/src/components/dashboard/Lineart.vue +47 -15
- package/src/components/form/ItemRef.vue +10 -3
- package/src/components/form/MaterialIcon.vue +3 -3
- package/src/components/form/PlainInputField.vue +2 -3
- package/src/components/form/inputs/CheckInput.vue +3 -3
- package/src/components/form/inputs/Checkbox.vue +10 -2
- package/src/components/form/inputs/ColorPicker.vue +13 -3
- package/src/components/form/inputs/CurrencyInput.vue +7 -3
- package/src/components/form/inputs/DateInput.vue +8 -2
- package/src/components/form/inputs/DatetimeInput.vue +8 -4
- package/src/components/form/inputs/DurationInput.vue +8 -4
- package/src/components/form/inputs/DynamicLinkField.vue +9 -7
- package/src/components/form/inputs/EmailInput.vue +7 -3
- package/src/components/form/inputs/FloatInput.vue +7 -3
- package/src/components/form/inputs/IntInput.vue +8 -4
- package/src/components/form/inputs/JSONInput.vue +7 -3
- package/src/components/form/inputs/LinkField.vue +26 -19
- package/src/components/form/inputs/Password.vue +2 -0
- package/src/components/form/inputs/PasswordInput.vue +13 -10
- package/src/components/form/inputs/PlainText.vue +14 -3
- package/src/components/form/inputs/ReadOnlyInput.vue +5 -1
- package/src/components/form/inputs/RichTextEditor.vue +9 -7
- package/src/components/form/inputs/SelectField.vue +10 -5
- package/src/components/form/inputs/TableField.vue +1 -3
- package/src/components/form/inputs/TextArea.vue +11 -2
- package/src/components/form/inputs/TextInput.vue +13 -3
- package/src/components/form/inputs/index.ts +0 -1
- package/src/components/formkit/AddressArray.vue +1 -1
- package/src/components/formkit/BankDetailsArray.vue +10 -10
- package/src/components/formkit/ContactArrayFormKit.vue +58 -17
- package/src/components/formkit/FileUploader.vue +7 -7
- package/src/components/formkit/MiscFields.vue +6 -1
- package/src/components/formkit/Toggle.vue +8 -4
- package/src/components/whatsapp/form/MsgTemplate.vue +15 -8
- package/src/components/whatsapp/form/TextVariableExamples.vue +8 -3
- package/src/utils/index.ts +9 -4
- package/src/utils/modal.ts +7 -1
- package/src/utils/strings.ts +8 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bagelink/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.37",
|
|
5
5
|
"description": "Bagel core sdk packages",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Neveh Allon",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
"./package.json": "./package.json",
|
|
23
23
|
"./src": "./src/index.ts",
|
|
24
|
+
"./src/components": "./src/components/index.ts",
|
|
25
|
+
"./src/plugins": "./src/plugins/index.ts",
|
|
26
|
+
"./src/utils": "./src/utils/index.ts",
|
|
27
|
+
"./src/types": "./src/types/index.ts",
|
|
24
28
|
".": {
|
|
25
29
|
"types": "./dist/index.d.ts",
|
|
26
30
|
"require": "./dist/index.cjs",
|
|
@@ -46,6 +50,7 @@
|
|
|
46
50
|
"devDependencies": {
|
|
47
51
|
"vue": "^3.3.8",
|
|
48
52
|
"vue-router": "^4.2.5",
|
|
53
|
+
"vue3-charts": "^1.1.33",
|
|
49
54
|
"@formkit/vue": "^1.3.0",
|
|
50
55
|
"@formkit/core": "1.3.0",
|
|
51
56
|
"vue-draggable-next": "^2.2.1",
|
|
@@ -57,13 +62,14 @@
|
|
|
57
62
|
"prosemirror-state": "^1.4.3",
|
|
58
63
|
"prosemirror-view": "^1.32.4",
|
|
59
64
|
"@vue-macros/reactivity-transform": "^0.4.0",
|
|
60
|
-
"@bagelink/sdk": "0.0.
|
|
65
|
+
"@bagelink/sdk": "0.0.37"
|
|
61
66
|
},
|
|
62
67
|
"peerDependencies": {
|
|
63
68
|
"@bagelink/sdk": "*"
|
|
64
69
|
},
|
|
65
70
|
"optionalDependencies": {
|
|
66
71
|
"vue-router": "^4.2.5",
|
|
72
|
+
"vue3-charts": "^1.1.33",
|
|
67
73
|
"@formkit/vue": "^1.3.0",
|
|
68
74
|
"@formkit/core": "1.3.0",
|
|
69
75
|
"vue-draggable-next": "^2.2.1",
|
|
@@ -30,7 +30,12 @@
|
|
|
30
30
|
icon="delete"
|
|
31
31
|
@click="deleteComment(comment.id)"
|
|
32
32
|
/>
|
|
33
|
-
<MaterialIcon
|
|
33
|
+
<MaterialIcon
|
|
34
|
+
:size="1.2"
|
|
35
|
+
class="save"
|
|
36
|
+
icon="save"
|
|
37
|
+
@click="save"
|
|
38
|
+
/>
|
|
34
39
|
</div>
|
|
35
40
|
</div>
|
|
36
41
|
<RTXEditor
|
|
@@ -38,7 +43,11 @@
|
|
|
38
43
|
@keydown.meta.enter="save"
|
|
39
44
|
v-if="editComment !== null && editComment?.id === comment.id"
|
|
40
45
|
/>
|
|
41
|
-
<div
|
|
46
|
+
<div
|
|
47
|
+
class="editor-wrapper"
|
|
48
|
+
v-html="comment.body_html"
|
|
49
|
+
v-else
|
|
50
|
+
/>
|
|
42
51
|
</div>
|
|
43
52
|
</div>
|
|
44
53
|
<div class="new-comment">
|
|
@@ -47,7 +56,10 @@
|
|
|
47
56
|
v-model="bodyHtml"
|
|
48
57
|
@keydown.meta.enter="newComment"
|
|
49
58
|
/>
|
|
50
|
-
<Btn
|
|
59
|
+
<Btn
|
|
60
|
+
icon="send"
|
|
61
|
+
@click="newComment"
|
|
62
|
+
>
|
|
51
63
|
{{ form.send }}
|
|
52
64
|
</Btn>
|
|
53
65
|
</div>
|
|
@@ -56,8 +68,8 @@
|
|
|
56
68
|
|
|
57
69
|
<script lang="ts" setup>
|
|
58
70
|
import { onMounted, watch } from 'vue';
|
|
59
|
-
import { Btn, MaterialIcon, RTXEditor } from '@/components';
|
|
60
71
|
import { useBagel } from 'src/plugins/bagel';
|
|
72
|
+
import { Btn, MaterialIcon, RTXEditor } from '@/components';
|
|
61
73
|
|
|
62
74
|
const bagel = useBagel();
|
|
63
75
|
let comments = $ref<Record<string, any>>([]);
|
|
@@ -85,7 +97,7 @@ const fetchData = async () => {
|
|
|
85
97
|
comments = [];
|
|
86
98
|
comments = (await bagel.get(
|
|
87
99
|
`comments/${props.ref_table}/${props.ref_id}`,
|
|
88
|
-
))
|
|
100
|
+
));
|
|
89
101
|
};
|
|
90
102
|
|
|
91
103
|
onMounted(fetchData);
|
|
@@ -94,7 +106,7 @@ watch(() => props.ref_id, fetchData);
|
|
|
94
106
|
const save = async () => {
|
|
95
107
|
if (!editComment) return;
|
|
96
108
|
await bagel.put(`comments/${editComment.id}`, editComment);
|
|
97
|
-
fetchData();
|
|
109
|
+
void fetchData(); // TODO: Nati: should be awaited?
|
|
98
110
|
editComment = null;
|
|
99
111
|
};
|
|
100
112
|
|
|
@@ -102,7 +114,7 @@ let bodyHtml = $ref('');
|
|
|
102
114
|
|
|
103
115
|
const deleteComment = async (id: string) => {
|
|
104
116
|
await bagel.delete(`comments/${id}`);
|
|
105
|
-
fetchData();
|
|
117
|
+
void fetchData(); // TODO: Nati: should be awaited?
|
|
106
118
|
};
|
|
107
119
|
|
|
108
120
|
const newComment = async () => {
|
|
@@ -114,7 +126,7 @@ const newComment = async () => {
|
|
|
114
126
|
type: 'Comment',
|
|
115
127
|
});
|
|
116
128
|
bodyHtml = '';
|
|
117
|
-
fetchData();
|
|
129
|
+
void fetchData(); // TODO: Nati: should be awaited?
|
|
118
130
|
};
|
|
119
131
|
</script>
|
|
120
132
|
|
|
@@ -126,9 +138,11 @@ const newComment = async () => {
|
|
|
126
138
|
position: relative;
|
|
127
139
|
gap: 0.5rem;
|
|
128
140
|
}
|
|
141
|
+
|
|
129
142
|
.comments-wrap p {
|
|
130
143
|
margin: 0;
|
|
131
144
|
}
|
|
145
|
+
|
|
132
146
|
.comments-wrap::before {
|
|
133
147
|
content: '';
|
|
134
148
|
inset-inline-start: 10px;
|
|
@@ -200,6 +214,7 @@ const newComment = async () => {
|
|
|
200
214
|
.comment .comment-actions .edit {
|
|
201
215
|
opacity: 0;
|
|
202
216
|
}
|
|
217
|
+
|
|
203
218
|
.comment-actions .edit {
|
|
204
219
|
margin-inline-end: auto;
|
|
205
220
|
}
|
|
@@ -208,13 +223,13 @@ const newComment = async () => {
|
|
|
208
223
|
opacity: 0.4;
|
|
209
224
|
}
|
|
210
225
|
|
|
211
|
-
.comment-actions
|
|
226
|
+
.comment-actions>div {
|
|
212
227
|
transition: all 200ms ease;
|
|
213
228
|
cursor: pointer;
|
|
214
229
|
opacity: 0.6;
|
|
215
230
|
}
|
|
216
231
|
|
|
217
|
-
.comment-actions
|
|
232
|
+
.comment-actions>div:hover {
|
|
218
233
|
color: var(--bgl-blue);
|
|
219
234
|
}
|
|
220
235
|
|
|
@@ -222,17 +237,20 @@ const newComment = async () => {
|
|
|
222
237
|
color: var(--bgl-red);
|
|
223
238
|
}
|
|
224
239
|
|
|
225
|
-
.comment-actions
|
|
240
|
+
.comment-actions>div:active {
|
|
226
241
|
filter: brightness(70%);
|
|
227
242
|
}
|
|
243
|
+
|
|
228
244
|
.icon-font.delete,
|
|
229
245
|
.icon-font.save {
|
|
230
246
|
display: none;
|
|
231
247
|
}
|
|
248
|
+
|
|
232
249
|
.editable .icon-font.delete,
|
|
233
250
|
.editable .icon-font.save {
|
|
234
251
|
display: block;
|
|
235
252
|
}
|
|
253
|
+
|
|
236
254
|
/* .editor-wrapper { */
|
|
237
255
|
/* margin-inline-start: 0.5rem; */
|
|
238
256
|
/* margin-top: 0.05em; */
|
|
@@ -245,6 +263,7 @@ const newComment = async () => {
|
|
|
245
263
|
.editable .editor-wrapper {
|
|
246
264
|
background-color: var(--bgl-bg);
|
|
247
265
|
}
|
|
266
|
+
|
|
248
267
|
.new-comment {
|
|
249
268
|
display: flex;
|
|
250
269
|
align-items: flex-end;
|
|
@@ -2,25 +2,29 @@
|
|
|
2
2
|
<div class="bagel-input mt-2">
|
|
3
3
|
{{ field.label }}
|
|
4
4
|
<div class="mb-2 mt-1">
|
|
5
|
-
<div
|
|
5
|
+
<div
|
|
6
|
+
class="bglform-contact"
|
|
7
|
+
v-for="(contact, i) in val"
|
|
8
|
+
:key="i"
|
|
9
|
+
>
|
|
6
10
|
<input
|
|
7
11
|
v-model="contact.email"
|
|
8
12
|
:placeholder="placeholders.email"
|
|
9
13
|
type="email"
|
|
10
14
|
v-if="field.id === 'email'"
|
|
11
|
-
|
|
15
|
+
>
|
|
12
16
|
<input
|
|
13
17
|
v-model="contact.phone"
|
|
14
18
|
:placeholder="placeholders.phone"
|
|
15
19
|
type="tel"
|
|
16
20
|
v-if="field.id === 'phone'"
|
|
17
|
-
|
|
21
|
+
>
|
|
18
22
|
<input
|
|
19
23
|
v-if="contact.email || contact.phone"
|
|
20
24
|
v-model="contact.label"
|
|
21
25
|
type="text"
|
|
22
26
|
:placeholder="placeholders.label"
|
|
23
|
-
|
|
27
|
+
>
|
|
24
28
|
<div class="bglform-contact-opt">
|
|
25
29
|
<!-- <input v-model="contact.primary" id="primary" type="checkbox" > -->
|
|
26
30
|
<CheckInput
|
|
@@ -31,10 +35,21 @@
|
|
|
31
35
|
}"
|
|
32
36
|
v-model="contact.primary"
|
|
33
37
|
/>
|
|
34
|
-
<MaterialIcon
|
|
38
|
+
<MaterialIcon
|
|
39
|
+
@click="del(i)"
|
|
40
|
+
icon="delete"
|
|
41
|
+
class="btn-float"
|
|
42
|
+
/>
|
|
35
43
|
</div>
|
|
36
44
|
</div>
|
|
37
|
-
<Btn
|
|
45
|
+
<Btn
|
|
46
|
+
color="light"
|
|
47
|
+
thin
|
|
48
|
+
@click="val.push({})"
|
|
49
|
+
icon="add"
|
|
50
|
+
>
|
|
51
|
+
Add
|
|
52
|
+
</Btn>
|
|
38
53
|
</div>
|
|
39
54
|
</div>
|
|
40
55
|
</template>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="card h-100 thin">
|
|
3
|
-
<TableSchema
|
|
3
|
+
<TableSchema
|
|
4
|
+
:schema="schema"
|
|
5
|
+
:data="data"
|
|
6
|
+
/>
|
|
4
7
|
</div>
|
|
5
8
|
</template>
|
|
6
9
|
|
|
7
10
|
<script setup lang="ts">
|
|
8
11
|
import { onMounted } from 'vue';
|
|
9
|
-
import { TableSchema } from '@/components';
|
|
10
12
|
import { useBagel } from 'src/plugins/bagel';
|
|
13
|
+
import { TableSchema } from '@/components';
|
|
11
14
|
|
|
12
15
|
const bagel = useBagel();
|
|
13
16
|
|
|
@@ -37,6 +40,6 @@ onMounted(() => {
|
|
|
37
40
|
const getData = async () => {
|
|
38
41
|
data = await bagel.get(`cms/form-submissions/${props.person_id}`);
|
|
39
42
|
};
|
|
40
|
-
getData();
|
|
43
|
+
void getData();
|
|
41
44
|
});
|
|
42
45
|
</script>
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
2
|
+
<div
|
|
3
|
+
v-if="data"
|
|
4
|
+
class="data"
|
|
5
|
+
>
|
|
6
|
+
<h3
|
|
7
|
+
class="mb-3 mt-0"
|
|
8
|
+
v-if="title"
|
|
9
|
+
>
|
|
4
10
|
{{ title }}
|
|
5
11
|
</h3>
|
|
6
|
-
<div
|
|
12
|
+
<div
|
|
13
|
+
v-for="field in schema || []"
|
|
14
|
+
:key="field.id"
|
|
15
|
+
class="data-row"
|
|
16
|
+
>
|
|
7
17
|
<div class="key">
|
|
8
18
|
{{ field.label ? parseLocale(field.label) : keyToLabel(field.id) }}
|
|
9
19
|
</div>
|
|
10
|
-
<component
|
|
20
|
+
<component
|
|
21
|
+
:is="field.$el || 'div'"
|
|
22
|
+
class="vlue"
|
|
23
|
+
>
|
|
11
24
|
{{ data[field.id] || field.defaultValue }}
|
|
12
25
|
</component>
|
|
13
26
|
</div>
|
|
14
27
|
<div v-if="!schema?.length">
|
|
15
28
|
<div
|
|
16
|
-
class="data-row"
|
|
29
|
+
class="data-row"
|
|
30
|
+
v-for="[key, value] in Object.entries(data).filter(
|
|
17
31
|
([key]) => !keysToIgnore.includes(key),
|
|
18
|
-
)"
|
|
32
|
+
)"
|
|
33
|
+
:key="key"
|
|
19
34
|
>
|
|
20
35
|
<div class="key">
|
|
21
36
|
{{ $t(keyToLabel(key)) }}
|
|
@@ -30,9 +45,7 @@
|
|
|
30
45
|
</template>
|
|
31
46
|
|
|
32
47
|
<script lang="ts" setup>
|
|
33
|
-
import { keyToLabel } from '@/utils';
|
|
34
|
-
|
|
35
|
-
import { parseLocale } from '@/utils';
|
|
48
|
+
import { keyToLabel, parseLocale } from '@/utils';
|
|
36
49
|
|
|
37
50
|
const keysToIgnore = ['id', 'person_id', 'person', 'created_at', 'updated_at'];
|
|
38
51
|
|
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
@drop.prevent.stop="onDrop"
|
|
9
9
|
>
|
|
10
10
|
<Transition name="pop">
|
|
11
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
ref="dropCircle"
|
|
13
|
+
v-if="draggingOver"
|
|
14
|
+
class="drop-circle"
|
|
15
|
+
/>
|
|
12
16
|
</Transition>
|
|
13
17
|
<div class="img-label">
|
|
14
18
|
<p>
|
|
@@ -23,7 +27,11 @@
|
|
|
23
27
|
>
|
|
24
28
|
<div class="load-file-bar">
|
|
25
29
|
<p>{{ item.file.name }}</p>
|
|
26
|
-
<div
|
|
30
|
+
<div
|
|
31
|
+
class="pie"
|
|
32
|
+
:style="`--p:${item.progress}`"
|
|
33
|
+
style="--b: 2px"
|
|
34
|
+
>
|
|
27
35
|
<span>{{ `${item.progress}` }}</span>
|
|
28
36
|
</div>
|
|
29
37
|
</div>
|
|
@@ -43,6 +51,7 @@
|
|
|
43
51
|
<script setup lang="ts">
|
|
44
52
|
import { useBagel } from 'src/plugins/bagel';
|
|
45
53
|
import { ref, onMounted, onUnmounted } from 'vue';
|
|
54
|
+
|
|
46
55
|
const bagel = useBagel();
|
|
47
56
|
|
|
48
57
|
const draggingOver = ref(false);
|
|
@@ -65,17 +74,17 @@ const props = withDefaults(
|
|
|
65
74
|
// folder?: string,
|
|
66
75
|
private?: 1 | 0;
|
|
67
76
|
singleFile?: boolean;
|
|
68
|
-
beforeUpload?:() => Promise<any>;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
beforeUpload?: () => Promise<any>;
|
|
78
|
+
form: {
|
|
79
|
+
dragDrop: string
|
|
80
|
+
browse: string
|
|
81
|
+
}
|
|
73
82
|
}>(),
|
|
74
83
|
{
|
|
75
84
|
private: 0,
|
|
76
85
|
entity: '',
|
|
77
86
|
id: '',
|
|
78
|
-
beforeUpload: async () => {},
|
|
87
|
+
beforeUpload: async () => { },
|
|
79
88
|
},
|
|
80
89
|
);
|
|
81
90
|
|
|
@@ -1,78 +1,123 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="table-list-wrap h-100">
|
|
3
|
-
<Transition name="fade">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
/>
|
|
13
23
|
</div>
|
|
14
|
-
</
|
|
15
|
-
</
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
</div>
|
|
25
|
+
</th>
|
|
26
|
+
</thead>
|
|
27
|
+
<tbody
|
|
28
|
+
ref="infinite"
|
|
29
|
+
class="rows infinite"
|
|
30
|
+
:class="{ loading }"
|
|
31
|
+
>
|
|
32
|
+
<tr
|
|
33
|
+
@click="selectElement(row)"
|
|
34
|
+
class="row row-item position-relative"
|
|
35
|
+
v-for="row in data"
|
|
36
|
+
:key="row.id"
|
|
37
|
+
>
|
|
38
|
+
<td
|
|
39
|
+
class="col"
|
|
40
|
+
v-for="field in columns"
|
|
41
|
+
:key="`${field.id}-${row.id}`"
|
|
20
42
|
>
|
|
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
|
-
field.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
43
|
+
<slot
|
|
44
|
+
v-if="slots[field.id]"
|
|
45
|
+
:name="field.id"
|
|
46
|
+
:row="row"
|
|
47
|
+
:field="field"
|
|
48
|
+
/>
|
|
49
|
+
<div v-else>
|
|
50
|
+
<div v-if="field.inputType === 'DateInput'">
|
|
51
|
+
{{ new Date(row[field.id]).toLocaleDateString() }}
|
|
52
|
+
</div>
|
|
53
|
+
<div v-else-if="field.inputType === 'CheckInput'">
|
|
54
|
+
<MaterialIcon
|
|
55
|
+
icon="check"
|
|
56
|
+
class="pill green"
|
|
57
|
+
v-if="row[field.id]"
|
|
58
|
+
/>
|
|
59
|
+
<MaterialIcon
|
|
60
|
+
icon="close"
|
|
61
|
+
class="pill"
|
|
62
|
+
v-else
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
<div v-else-if="field.inputType === 'ItemRef' && row[field.id]">
|
|
66
|
+
<Btn
|
|
67
|
+
v-if="field.refCollection"
|
|
68
|
+
color="gray"
|
|
69
|
+
class="thin"
|
|
70
|
+
@click="
|
|
71
|
+
$router.push(
|
|
72
|
+
`/${field.refCollection}/${row[field.id].id}`,
|
|
73
|
+
)"
|
|
74
|
+
>
|
|
75
|
+
{{
|
|
76
|
+
field.refFields
|
|
77
|
+
?.map((k) => row[field.id][k])
|
|
78
|
+
.join(' ') || row[field.id].id
|
|
79
|
+
}}
|
|
80
|
+
<MaterialIcon icon="arrow_forward" />
|
|
81
|
+
</Btn>
|
|
82
|
+
<Btn
|
|
83
|
+
icon="receipt"
|
|
84
|
+
is="a"
|
|
85
|
+
thin
|
|
86
|
+
v-else-if="field.link"
|
|
87
|
+
:href="row[field.id][field.link]"
|
|
88
|
+
target="_blank"
|
|
89
|
+
>
|
|
90
|
+
{{
|
|
91
|
+
field.refFields
|
|
92
|
+
?.map((k) => row[field.id][k])
|
|
93
|
+
.join(' ') || row[field.id].id
|
|
94
|
+
}}
|
|
95
|
+
</Btn>
|
|
96
|
+
<div
|
|
97
|
+
class="pill"
|
|
98
|
+
v-else
|
|
99
|
+
:class="getPillClass(row, field)"
|
|
100
|
+
>
|
|
101
|
+
{{
|
|
102
|
+
field.refFields
|
|
103
|
+
?.map((k) => row[field.id][k])
|
|
104
|
+
.join(' ') || row[field.id].id
|
|
105
|
+
}}
|
|
68
106
|
</div>
|
|
69
107
|
</div>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
108
|
+
<div
|
|
109
|
+
class="max-col-width"
|
|
110
|
+
v-else
|
|
111
|
+
>
|
|
112
|
+
{{ row[field.id] }}
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</td>
|
|
116
|
+
</tr>
|
|
117
|
+
</tbody>
|
|
118
|
+
</table>
|
|
119
|
+
</div>
|
|
120
|
+
<!-- </Transition> -->
|
|
76
121
|
</div>
|
|
77
122
|
</template>
|
|
78
123
|
|
|
@@ -110,12 +155,16 @@ const sort = (fieldname: string) => {
|
|
|
110
155
|
};
|
|
111
156
|
|
|
112
157
|
const columns = computed<BagelField[]>(
|
|
113
|
-
(): BagelField[] => props.schema
|
|
114
|
-
|
|
158
|
+
(): BagelField[] => props.schema ||
|
|
159
|
+
Object.keys(props.data[0]).map((k: string) => ({
|
|
115
160
|
id: k,
|
|
116
161
|
inputType: 'PlainText',
|
|
117
162
|
})),
|
|
118
163
|
);
|
|
164
|
+
|
|
165
|
+
function getPillClass(row: Record<string, any>, field: BagelField) {
|
|
166
|
+
return field.refFields?.map((k) => row[field.id][k]).join(' ') || row[field.id].id;
|
|
167
|
+
}
|
|
119
168
|
</script>
|
|
120
169
|
|
|
121
170
|
<style scoped>
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<FormKit
|
|
4
|
-
type="form"
|
|
4
|
+
type="form"
|
|
5
|
+
:modelValue="modelValue"
|
|
6
|
+
@update:modelValue="handleEmit"
|
|
7
|
+
@submit="runSubmit"
|
|
5
8
|
:submitLabel="$t('save')"
|
|
6
9
|
>
|
|
7
|
-
<FormKitSchema
|
|
10
|
+
<FormKitSchema
|
|
11
|
+
:schema="schema"
|
|
12
|
+
:data="data"
|
|
13
|
+
/>
|
|
8
14
|
</FormKit>
|
|
9
15
|
<Btn
|
|
10
|
-
class="del-top"
|
|
11
|
-
|
|
16
|
+
class="del-top"
|
|
17
|
+
v-if="modelValue?.id && onDelete"
|
|
18
|
+
@click="runDelete"
|
|
19
|
+
value="Delete"
|
|
20
|
+
flat
|
|
21
|
+
icon="delete"
|
|
22
|
+
color="red"
|
|
23
|
+
thin
|
|
12
24
|
/>
|
|
13
25
|
</div>
|
|
14
26
|
</template>
|
|
@@ -28,9 +40,11 @@ const runSubmit = (val: any) => emits('submit', val);
|
|
|
28
40
|
const props = withDefaults(defineProps<{
|
|
29
41
|
modelValue?: any;
|
|
30
42
|
schema: FormKitSchemaDefinition;
|
|
31
|
-
|
|
43
|
+
// eslint-disable-next-line no-unused-vars
|
|
44
|
+
onDelete?: ((id: string) => void);
|
|
45
|
+
// eslint-disable-next-line no-unused-vars
|
|
32
46
|
$t: (key: string) => string;
|
|
33
|
-
}>(),{
|
|
47
|
+
}>(), {
|
|
34
48
|
$t: (key: string) => key,
|
|
35
49
|
});
|
|
36
50
|
|