@bagelink/vue 0.0.322 → 0.0.335
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/ComboBox.vue.d.ts.map +1 -1
- package/dist/components/MaterialIcon.vue.d.ts +4 -2
- package/dist/components/MaterialIcon.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +0 -1
- package/dist/components/ModalBglForm.vue.d.ts.map +1 -1
- package/dist/components/Popover.vue.d.ts +10 -0
- package/dist/components/Popover.vue.d.ts.map +1 -0
- package/dist/components/form/BglForm.vue.d.ts +1 -9
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +0 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +22 -16
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextArea.vue.d.ts +3 -1
- package/dist/components/form/inputs/TextArea.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +1 -14
- package/dist/components/formkit/index.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 +783 -2035
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +785 -2037
- package/dist/style.css +2129 -695
- package/dist/types/index.d.ts +7 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/materialIcon.d.ts +2 -0
- package/dist/types/materialIcon.d.ts.map +1 -0
- 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 +49 -53
- package/src/components/form/inputs/SelectInput.vue +128 -484
- package/src/components/form/inputs/TextInput.vue +158 -112
- 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 +81 -0
- package/src/styles/bagel.css +2 -0
- package/src/styles/layout.css +162 -17
- package/src/styles/mobilLayout.css +1476 -0
- package/src/styles/text.css +153 -1
- package/src/types/index.ts +9 -1
- package/src/types/materialIcons.ts +1180 -1178
- package/src/utils/BagelFormUtils.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/src/components/ComboBox.vue +0 -165
- package/src/components/TabbedLayout.vue +0 -87
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</form>
|
|
13
|
-
<slot v-if="formStatus === 'success'" name="success" />
|
|
14
|
-
<slot v-if="formStatus === 'error'" name="error" :message="error" />
|
|
2
|
+
<template v-if="id">
|
|
3
|
+
<BglField v-for="(field, i) in schema" :key="field.id || `${i}p`" :field="field" v-model="data" />
|
|
4
|
+
</template>
|
|
5
|
+
<form v-else-if="(!slots.success || formStatus !== 'success')" ref="form" @submit.prevent="runSubmit">
|
|
6
|
+
<Title tag="h4" :label="label" v-if="label" />
|
|
7
|
+
<BglField v-for="(field, i) in schema" :key="field.id || `${i}p`" :field="field" v-model="data" />
|
|
8
|
+
<slot name="submit" />
|
|
9
|
+
</form>
|
|
10
|
+
<slot v-if="formStatus === 'success'" name="success" />
|
|
11
|
+
<slot v-if="formStatus === 'error'" name="error" />
|
|
15
12
|
</template>
|
|
16
13
|
|
|
17
14
|
<script lang="ts" setup>
|
|
18
15
|
import { useSlots } from 'vue';
|
|
19
16
|
import {
|
|
20
|
-
|
|
17
|
+
useModal, BglField, Title,
|
|
21
18
|
} from '@bagelink/vue';
|
|
22
19
|
|
|
23
20
|
import { type BglFormSchemaT } from '@bagelink/vue';
|
|
@@ -27,7 +24,7 @@ const slots = useSlots();
|
|
|
27
24
|
const { showModal } = useModal();
|
|
28
25
|
|
|
29
26
|
const props = withDefaults(
|
|
30
|
-
|
|
27
|
+
defineProps<{
|
|
31
28
|
label?: string;
|
|
32
29
|
id?: string;
|
|
33
30
|
schema: BglFormSchemaT<any>;
|
|
@@ -35,9 +32,9 @@ const props = withDefaults(
|
|
|
35
32
|
onDelete?: ((id: string) => void);
|
|
36
33
|
onSubmit?: ((data: any) => void);
|
|
37
34
|
}>(),
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
{
|
|
36
|
+
modelValue: () => ({}),
|
|
37
|
+
},
|
|
41
38
|
);
|
|
42
39
|
|
|
43
40
|
const instAt = new Date();
|
|
@@ -46,15 +43,15 @@ let formData = $ref(props.modelValue);
|
|
|
46
43
|
const emit = defineEmits(['update:modelValue', 'submit', 'dirty']);
|
|
47
44
|
let isDirty = $ref(false);
|
|
48
45
|
const data = $computed({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
set: (val: any) => {
|
|
47
|
+
if (timeSinceInst() > 100) {
|
|
48
|
+
emit('dirty');
|
|
49
|
+
isDirty = true;
|
|
50
|
+
}
|
|
51
|
+
formData = val;
|
|
52
|
+
emit('update:modelValue', val);
|
|
53
|
+
},
|
|
54
|
+
get: () => props.modelValue || formData,
|
|
58
55
|
});
|
|
59
56
|
const form = $ref<HTMLFormElement>();
|
|
60
57
|
|
|
@@ -62,41 +59,40 @@ const validateForm = () => form?.reportValidity?.();
|
|
|
62
59
|
|
|
63
60
|
const clearForm = () => Object.assign(data, {});
|
|
64
61
|
|
|
65
|
-
type FormStatus = 'idle' | 'loading' | 'success' | 'error'
|
|
62
|
+
type FormStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
66
63
|
|
|
67
64
|
let formStatus = $ref<FormStatus>('idle');
|
|
68
65
|
|
|
69
66
|
const runSubmit = () => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
67
|
+
try {
|
|
68
|
+
validateForm();
|
|
69
|
+
props.onSubmit?.(data);
|
|
70
|
+
// emit('submit', data);
|
|
71
|
+
clearForm();
|
|
72
|
+
formStatus = 'success';
|
|
73
|
+
} catch (e) {
|
|
74
|
+
formStatus = 'error';
|
|
75
|
+
}
|
|
80
76
|
};
|
|
81
77
|
|
|
82
78
|
const i18nT = (val: string) => val;
|
|
83
79
|
|
|
84
80
|
const deleteItem = () => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
showModal(
|
|
82
|
+
{
|
|
83
|
+
class: 'small-modal',
|
|
84
|
+
title: i18nT('Are you sure?'),
|
|
85
|
+
actions: [
|
|
86
|
+
{
|
|
87
|
+
value: 'Confirm',
|
|
88
|
+
color: 'red',
|
|
89
|
+
onClick: () => props.onDelete?.(data.value.id),
|
|
90
|
+
},
|
|
91
|
+
{ value: 'Cancel', color: 'gray' },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
{ default: i18nT('form.deleteMessage') },
|
|
95
|
+
);
|
|
100
96
|
};
|
|
101
97
|
|
|
102
98
|
defineExpose({ validateForm, deleteItem, isDirty });
|