@bagelink/vue 0.0.138 → 0.0.142
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/FormSchema.vue.d.ts +2 -2
- package/dist/components/FormSchema.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/formkit/AddressArray.vue.d.ts +15 -11
- package/dist/components/formkit/AddressArray.vue.d.ts.map +1 -1
- package/dist/components/formkit/BankDetailsArray.vue.d.ts +17 -13
- package/dist/components/formkit/BankDetailsArray.vue.d.ts.map +1 -1
- package/dist/components/formkit/ContactArrayFormKit.vue.d.ts +13 -9
- package/dist/components/formkit/ContactArrayFormKit.vue.d.ts.map +1 -1
- package/dist/components/formkit/FileUploader.vue.d.ts +4 -4
- package/dist/components/formkit/FileUploader.vue.d.ts.map +1 -1
- package/dist/index.cjs +99 -59
- package/dist/index.mjs +100 -60
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +37 -37
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/FormSchema.vue +1 -1
- package/src/components/Modal.vue +21 -8
- package/src/components/ModalForm.vue +23 -8
- package/src/components/formkit/AddressArray.vue +25 -22
- package/src/components/formkit/BankDetailsArray.vue +29 -24
- package/src/components/formkit/ContactArrayFormKit.vue +22 -16
- package/src/components/formkit/FileUploader.vue +2 -2
- package/src/plugins/modal.ts +12 -10
- package/src/utils/index.ts +6 -0
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
v-if="deleteCandidate === i"
|
|
12
12
|
>
|
|
13
13
|
<p class="txt14">
|
|
14
|
-
{{
|
|
14
|
+
{{ formPlaceholders?.sure }}
|
|
15
15
|
</p>
|
|
16
16
|
<Btn
|
|
17
17
|
thin
|
|
18
18
|
color="red"
|
|
19
19
|
@click="deleteContact(contact.id)"
|
|
20
20
|
>
|
|
21
|
-
{{
|
|
21
|
+
{{ formPlaceholders?.delete }}
|
|
22
22
|
</Btn>
|
|
23
23
|
<Btn
|
|
24
24
|
thin
|
|
25
25
|
@click="deleteCandidate = -1"
|
|
26
26
|
>
|
|
27
|
-
{{
|
|
27
|
+
{{ formPlaceholders?.cancel }}
|
|
28
28
|
</Btn>
|
|
29
29
|
</div>
|
|
30
30
|
<Checkbox
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
class="bglform-contact-label"
|
|
36
36
|
v-model="contact.label"
|
|
37
37
|
type="text"
|
|
38
|
-
:placeholder="
|
|
38
|
+
:placeholder="formPlaceholders?.label"
|
|
39
39
|
>
|
|
40
40
|
|
|
41
41
|
<input
|
|
42
42
|
v-model="contact.email"
|
|
43
|
-
:placeholder="
|
|
43
|
+
:placeholder="formPlaceholders?.email"
|
|
44
44
|
v-if="context?.id === 'email'"
|
|
45
45
|
type="email"
|
|
46
46
|
>
|
|
47
47
|
<input
|
|
48
48
|
v-model="contact.phone"
|
|
49
|
-
:placeholder="
|
|
49
|
+
:placeholder="formPlaceholders?.phone"
|
|
50
50
|
v-if="context?.id === 'phone'"
|
|
51
51
|
type="tel"
|
|
52
52
|
>
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
thin
|
|
69
69
|
@click="val.push({})"
|
|
70
70
|
>
|
|
71
|
-
{{
|
|
71
|
+
{{ formPlaceholders?.add }} {{ context?.label }}
|
|
72
72
|
</Btn>
|
|
73
73
|
</div>
|
|
74
74
|
</div>
|
|
@@ -83,16 +83,20 @@ import Checkbox from '../form/inputs/Checkbox.vue';
|
|
|
83
83
|
|
|
84
84
|
export interface ContactArrContext {
|
|
85
85
|
label?: string;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
id?: string;
|
|
87
|
+
value: any[];
|
|
88
|
+
node: Record<string, any>;
|
|
89
|
+
attrs: {
|
|
90
|
+
formPlaceholders?: {
|
|
91
|
+
sure?: string
|
|
92
|
+
delete?: string
|
|
93
|
+
cancel?: string
|
|
94
|
+
label?: string
|
|
95
|
+
email?: string
|
|
96
|
+
phone?: string
|
|
97
|
+
add?: string
|
|
98
|
+
};
|
|
94
99
|
};
|
|
95
|
-
[key: string]: any;
|
|
96
100
|
}
|
|
97
101
|
const bagel = useBagel();
|
|
98
102
|
|
|
@@ -100,6 +104,8 @@ const props = defineProps<{
|
|
|
100
104
|
context: ContactArrContext
|
|
101
105
|
}>();
|
|
102
106
|
|
|
107
|
+
const formPlaceholders = $computed(() => props.context?.attrs?.formPlaceholders);
|
|
108
|
+
|
|
103
109
|
let val = $ref<any[]>([]);
|
|
104
110
|
let deleteCandidate = $ref<number>(-1);
|
|
105
111
|
|
|
@@ -106,8 +106,8 @@ const files = $ref<UploadFile[]>([]);
|
|
|
106
106
|
|
|
107
107
|
const props = withDefaults(defineProps<{
|
|
108
108
|
context: Record<string, any>;
|
|
109
|
-
dragDropLabel
|
|
110
|
-
browseLabel
|
|
109
|
+
dragDropLabel?: string;
|
|
110
|
+
browseLabel?: string;
|
|
111
111
|
}>(), {
|
|
112
112
|
dragDropLabel: 'Drag and drop your files here',
|
|
113
113
|
browseLabel: 'or browse',
|
package/src/plugins/modal.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
h, InjectionKey,
|
|
2
|
+
h, InjectionKey, inject, defineComponent,
|
|
3
3
|
} from 'vue';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
5
|
import type { BtnOptions } from '@bagelink/vue';
|
|
@@ -51,30 +51,32 @@ interface ModalComponentProps {
|
|
|
51
51
|
|
|
52
52
|
export const ModalPlugin: Plugin = {
|
|
53
53
|
install: (app) => {
|
|
54
|
-
const modalStack = ref<ModalComponentProps[]>([]);
|
|
54
|
+
const modalStack = $ref<ModalComponentProps[]>([]);
|
|
55
|
+
|
|
56
|
+
const hideModal = (index: number) => {
|
|
57
|
+
// console.log('hideModal', index);
|
|
58
|
+
modalStack.splice(index, 1);
|
|
59
|
+
};
|
|
60
|
+
|
|
55
61
|
const showModal = (
|
|
56
62
|
isForm: boolean,
|
|
57
63
|
options: ModalOptions | ModalFormOptions,
|
|
58
64
|
slots: Record<string, any> = {},
|
|
59
65
|
) => {
|
|
60
|
-
modalStack.
|
|
66
|
+
modalStack.push({
|
|
61
67
|
modalOptions: options,
|
|
62
68
|
isModalForm: isForm,
|
|
63
69
|
componentSlots: slots,
|
|
64
70
|
});
|
|
65
71
|
};
|
|
66
72
|
|
|
67
|
-
const hideModal = (index: number) => {
|
|
68
|
-
// console.log('hideModal', index);
|
|
69
|
-
modalStack.value.splice(index, 1);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
73
|
app.provide(ModalSymbol, {
|
|
73
74
|
modalForm: (options: ModalFormOptions, slots?: Record<string, any>) => showModal(true, options, slots),
|
|
74
75
|
showModal: (options: ModalOptions, slots?: Record<string, any>) => showModal(false, options, slots),
|
|
75
|
-
hideModal: (index = modalStack.
|
|
76
|
+
hideModal: (index = modalStack.length - 1) => hideModal(index),
|
|
76
77
|
// modalOptions,
|
|
77
78
|
});
|
|
79
|
+
|
|
78
80
|
const ModalComponent = defineComponent({
|
|
79
81
|
data() {
|
|
80
82
|
return {
|
|
@@ -82,7 +84,7 @@ export const ModalPlugin: Plugin = {
|
|
|
82
84
|
};
|
|
83
85
|
},
|
|
84
86
|
render() {
|
|
85
|
-
return modalStack.
|
|
87
|
+
return modalStack.map((modal, index) => {
|
|
86
88
|
const renderComponent = modal.isModalForm ? ModalForm : Modal;
|
|
87
89
|
return h(
|
|
88
90
|
renderComponent,
|
package/src/utils/index.ts
CHANGED
|
@@ -50,4 +50,10 @@ export const useFormkit = () => {
|
|
|
50
50
|
|
|
51
51
|
export const initials = (...strArr: string[]) => strArr.map((str) => str?.charAt(0)).join('');
|
|
52
52
|
|
|
53
|
+
export function useEscape(event: KeyboardEvent, closeModel: () => void) {
|
|
54
|
+
if (event.key === 'Escape') {
|
|
55
|
+
closeModel();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
export { formatString } from './strings';
|