@bagelink/vue 0.0.229-beta.0 → 0.0.233-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.map +1 -1
- package/dist/components/Card.vue.d.ts +2 -0
- package/dist/components/Card.vue.d.ts.map +1 -1
- package/dist/components/ModalBglForm.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts +3 -39
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts +4 -0
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts +9 -22
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkbox.vue.d.ts +4 -10
- package/dist/components/form/inputs/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ColorPicker.vue.d.ts +6 -2
- package/dist/components/form/inputs/ColorPicker.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +44 -35
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +0 -10
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +1 -13
- 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 +1101 -3976
- package/dist/index.mjs +1102 -3977
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/plugins/modal.d.ts +1 -2
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +266 -1014
- package/dist/types/BagelForm.d.ts +2 -3
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AccordionItem.vue +25 -53
- package/src/components/Card.vue +2 -1
- package/src/components/ModalBglForm.vue +6 -22
- package/src/components/TableSchema.vue +1 -3
- package/src/components/form/BglField.vue +15 -3
- package/src/components/form/BglForm.vue +19 -18
- package/src/components/form/inputs/CheckInput.vue +17 -24
- package/src/components/form/inputs/Checkbox.vue +3 -24
- package/src/components/form/inputs/ColorPicker.vue +8 -19
- package/src/components/form/inputs/DateInput.vue +21 -2
- package/src/components/form/inputs/FileUpload.vue +11 -23
- package/src/components/form/inputs/SelectInput.vue +9 -11
- package/src/components/form/inputs/index.ts +0 -10
- package/src/components/formkit/index.ts +19 -27
- package/src/components/index.ts +0 -1
- package/src/plugins/bagel.ts +6 -6
- package/src/plugins/modal.ts +1 -2
- package/src/styles/modal.css +59 -57
- package/src/styles/theme.css +0 -18
- package/src/types/BagelForm.ts +7 -10
- package/src/components/ContactArray.vue +0 -113
- package/src/components/Drop.vue +0 -150
- package/src/components/form/inputs/CurrencyInput.vue +0 -137
- package/src/components/form/inputs/DatetimeInput.vue +0 -49
- package/src/components/form/inputs/DurationInput.vue +0 -55
- package/src/components/form/inputs/FloatInput.vue +0 -53
- package/src/components/form/inputs/IntInput.vue +0 -52
- package/src/components/form/inputs/LinkField.vue +0 -300
- package/src/components/form/inputs/Password.vue +0 -90
- package/src/components/form/inputs/PasswordInput.vue +0 -85
- package/src/components/form/inputs/PlainText.vue +0 -63
- package/src/components/form/inputs/ReadOnlyInput.vue +0 -28
- package/src/components/form/inputs/SelectField.vue +0 -202
- package/src/components/formkit/AddressArray.vue +0 -250
- package/src/components/formkit/BankDetailsArray.vue +0 -274
- package/src/components/formkit/ContactArrayFormKit.vue +0 -203
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
export { default as CheckInput } from './CheckInput.vue';
|
|
2
|
-
export { default as CurrencyInput } from './CurrencyInput.vue';
|
|
3
2
|
export { default as DateInput } from './DateInput.vue';
|
|
4
|
-
export { default as DatetimeInput } from './DatetimeInput.vue';
|
|
5
|
-
export { default as FloatInput } from './FloatInput.vue';
|
|
6
|
-
export { default as IntInput } from './IntInput.vue';
|
|
7
3
|
export { default as JSONInput } from './JSONInput.vue';
|
|
8
|
-
export { default as LinkField } from './LinkField.vue';
|
|
9
|
-
export { default as PasswordInput } from './PasswordInput.vue';
|
|
10
|
-
export { default as Password } from './Password.vue';
|
|
11
|
-
export { default as ReadOnlyInput } from './ReadOnlyInput.vue';
|
|
12
4
|
export { default as SelectInput } from './SelectInput.vue';
|
|
13
5
|
export { default as RichTextEditor } from './RichTextEditor.vue';
|
|
14
6
|
export { default as TableField } from './TableField.vue';
|
|
15
|
-
export { default as DurationInput } from './DurationInput.vue';
|
|
16
7
|
export { default as TextInput } from './TextInput.vue';
|
|
17
8
|
export { default as TextArea } from './TextArea.vue';
|
|
18
9
|
export { default as Checkbox } from './Checkbox.vue';
|
|
19
10
|
export { default as ColorPicker } from './ColorPicker.vue';
|
|
20
|
-
export { default as PlainText } from './PlainText.vue';
|
|
21
11
|
export { default as DatePicker } from './DatePicker.vue';
|
|
22
12
|
export { default as RadioPillsInput } from './RadioPillsInput.vue';
|
|
23
13
|
export { default as FileUpload } from './FileUpload.vue';
|
|
@@ -1,32 +1,24 @@
|
|
|
1
|
-
import { createInput } from '@formkit/vue';
|
|
2
|
-
import type { FormKitTypeDefinition } from '@formkit/core';
|
|
3
|
-
import ContactArrayFormKit from './ContactArrayFormKit.vue';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import TextVariableExamples from '../whatsapp/form/TextVariableExamples.vue';
|
|
1
|
+
// import { createInput } from '@formkit/vue';
|
|
2
|
+
// import type { FormKitTypeDefinition } from '@formkit/core';
|
|
3
|
+
// import ContactArrayFormKit from './ContactArrayFormKit.vue';
|
|
4
|
+
// import BankDetailsArray from './BankDetailsArray.vue';
|
|
5
|
+
// import MiscFieldsBtns from './MiscFields.vue';
|
|
6
|
+
// import Toggle from './Toggle.vue';
|
|
7
|
+
// import FileUploader from './FileUploader.vue';
|
|
8
|
+
// import TextVariableExamples from '../whatsapp/form/TextVariableExamples.vue';
|
|
10
9
|
|
|
11
|
-
const ContactArrayInput: FormKitTypeDefinition = createInput(ContactArrayFormKit);
|
|
12
|
-
const AddressInput: FormKitTypeDefinition = createInput(AddressArray);
|
|
13
|
-
const BankDetailsInput: FormKitTypeDefinition = createInput(BankDetailsArray);
|
|
14
|
-
const MiscFieldsInput: FormKitTypeDefinition = createInput(MiscFieldsBtns);
|
|
15
|
-
const ToggleSwitchInput: FormKitTypeDefinition = createInput(Toggle);
|
|
16
|
-
const FileUploadInput: FormKitTypeDefinition = createInput(FileUploader);
|
|
17
|
-
const TextVariablesInput: FormKitTypeDefinition = createInput(TextVariableExamples);
|
|
10
|
+
// const ContactArrayInput: FormKitTypeDefinition = createInput(ContactArrayFormKit);
|
|
11
|
+
// const AddressInput: FormKitTypeDefinition = createInput(AddressArray);
|
|
12
|
+
// const BankDetailsInput: FormKitTypeDefinition = createInput(BankDetailsArray);
|
|
13
|
+
// const MiscFieldsInput: FormKitTypeDefinition = createInput(MiscFieldsBtns);
|
|
14
|
+
// const ToggleSwitchInput: FormKitTypeDefinition = createInput(Toggle);
|
|
15
|
+
// const FileUploadInput: FormKitTypeDefinition = createInput(FileUploader);
|
|
16
|
+
// const TextVariablesInput: FormKitTypeDefinition = createInput(TextVariableExamples);
|
|
18
17
|
|
|
19
18
|
export {
|
|
20
|
-
|
|
21
|
-
ContactArrayInput,
|
|
22
|
-
AddressInput,
|
|
23
|
-
BankDetailsInput,
|
|
24
|
-
MiscFieldsInput,
|
|
25
|
-
ToggleSwitchInput,
|
|
26
|
-
FileUploadInput,
|
|
19
|
+
|
|
27
20
|
};
|
|
28
21
|
|
|
29
|
-
export { default as FileUploader } from './FileUploader.vue';
|
|
30
|
-
export type { BankDetailsContext } from './BankDetailsArray.vue';
|
|
31
|
-
export type {
|
|
32
|
-
export type { ContactArrContext } from './ContactArrayFormKit.vue';
|
|
22
|
+
// export { default as FileUploader } from './FileUploader.vue';
|
|
23
|
+
// export type { BankDetailsContext } from './BankDetailsArray.vue';
|
|
24
|
+
// export type { ContactArrContext } from './ContactArrayFormKit.vue';
|
package/src/components/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { default as Btn } from './Btn.vue';
|
|
|
6
6
|
export { default as Modal } from './Modal.vue';
|
|
7
7
|
export { default as ModalBglForm } from './ModalBglForm.vue';
|
|
8
8
|
export { default as AccordionItem } from './AccordionItem.vue';
|
|
9
|
-
export { default as Dropdown } from './Drop.vue';
|
|
10
9
|
export { default as ListView } from './ListView.vue';
|
|
11
10
|
export { default as ListItem } from './ListItem.vue';
|
|
12
11
|
export { default as TabbedLayout } from './TabbedLayout.vue';
|
package/src/plugins/bagel.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Bagel } from '@bagelink/sdk';
|
|
|
4
4
|
|
|
5
5
|
export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>;
|
|
6
6
|
export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<
|
|
7
|
-
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
8
|
(key: string) => string
|
|
9
9
|
>;
|
|
10
10
|
|
|
@@ -23,11 +23,11 @@ export function useI18nT() {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export interface BagelOptions {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
i18nT?: (key
|
|
26
|
+
host: string
|
|
27
|
+
// eslint-disable-next-line no-unused-vars
|
|
28
|
+
onError?: (err: Error) => void,
|
|
29
|
+
// eslint-disable-next-line no-unused-vars
|
|
30
|
+
i18nT?: (key: string) => string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export const BagelVue: Plugin = {
|
package/src/plugins/modal.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
5
|
import type { BglFormSchemaT, BtnOptions } from '@bagelink/vue';
|
|
6
6
|
import { Modal, ModalBglForm } from '@bagelink/vue';
|
|
7
|
-
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
8
7
|
|
|
9
8
|
interface ModalOptions {
|
|
10
9
|
title?: string;
|
|
@@ -22,7 +21,7 @@ interface ModalFormOptions extends ModalOptions {
|
|
|
22
21
|
onSubmit: (val: any) => void;
|
|
23
22
|
// eslint-disable-next-line no-unused-vars
|
|
24
23
|
onDelete?: (id: string) => void;
|
|
25
|
-
schema:
|
|
24
|
+
schema: BglFormSchemaT<any>;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
27
|
interface ModalApi {
|
package/src/styles/modal.css
CHANGED
|
@@ -1,92 +1,94 @@
|
|
|
1
1
|
.bg-dark {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
left: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
8
|
+
z-index: 999;
|
|
9
|
+
display: flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
align-items: center;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
opacity: 0;
|
|
14
|
+
transition: all ease-in-out 0.3s;
|
|
15
|
+
overflow: auto;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.modal {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
width: 96%;
|
|
20
|
+
max-width: 680px;
|
|
21
|
+
transform: scale(0.5);
|
|
22
|
+
opacity: 0;
|
|
23
|
+
transition: all ease-in-out 0.15s;
|
|
24
|
+
margin-top: 6rem;
|
|
25
|
+
margin-bottom: 4rem;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.small-modal .modal {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
max-width: 300px;
|
|
30
|
+
text-align: center;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.tool-bar {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
margin: -2rem -1rem 1rem;
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
position: -webkit-sticky;
|
|
38
|
+
position: sticky;
|
|
39
|
+
padding-top: 1rem;
|
|
40
|
+
top: -2rem;
|
|
41
|
+
z-index: 3;
|
|
42
|
+
background: var(--bgl-white);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
.modal-size {
|
|
46
|
-
|
|
46
|
+
cursor: pointer;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.is-side .modal {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
inset-inline-end: -600px;
|
|
51
|
+
transform: scale(1);
|
|
52
|
+
opacity: 1;
|
|
53
|
+
position: fixed;
|
|
54
|
+
top: 20px;
|
|
55
|
+
bottom: 20px;
|
|
56
|
+
max-width: 600px;
|
|
57
|
+
width: 90%;
|
|
58
|
+
margin-top: 0;
|
|
59
|
+
margin-bottom: 0;
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
.is-active .modal {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
transform: scale(1);
|
|
64
|
+
opacity: 1;
|
|
65
|
+
box-shadow: 6px 6px 20px 20px #0000001c;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
.is-active.is-side .modal {
|
|
67
|
-
|
|
69
|
+
inset-inline-end: 20px;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
.bg-dark.is-active {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
opacity: 1;
|
|
74
|
+
pointer-events: all;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
.is-side.bg-dark.is-active {
|
|
76
|
-
|
|
78
|
+
opacity: 1;
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
.is-side.is-active .modal {
|
|
80
|
-
|
|
82
|
+
pointer-events: all;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
@media screen and (max-width: 910px) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
.tool-bar {
|
|
87
|
+
margin: -2rem 0 1rem;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
88
90
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
91
|
+
.is-active.is-side .modal {
|
|
92
|
+
inset-inline-end: 5%;
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/styles/theme.css
CHANGED
|
@@ -369,12 +369,6 @@
|
|
|
369
369
|
transition: all 0.5s cubic-bezier(0.79, 0.01, 0.34, 0.99);
|
|
370
370
|
}
|
|
371
371
|
|
|
372
|
-
.FormRow {
|
|
373
|
-
display: grid;
|
|
374
|
-
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
375
|
-
gap: 1rem;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
372
|
.detail-main {
|
|
379
373
|
overflow-y: auto;
|
|
380
374
|
}
|
|
@@ -388,18 +382,6 @@
|
|
|
388
382
|
font-size: 9px;
|
|
389
383
|
}
|
|
390
384
|
|
|
391
|
-
.empty-box {
|
|
392
|
-
width: 100%;
|
|
393
|
-
background-color: var(--bgl-gray-light);
|
|
394
|
-
color: var(--bgl-gray);
|
|
395
|
-
text-align: center;
|
|
396
|
-
padding: 20px;
|
|
397
|
-
border-radius: 10px;
|
|
398
|
-
justify-content: center;
|
|
399
|
-
flex-direction: column;
|
|
400
|
-
display: flex;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
385
|
.field {
|
|
404
386
|
--field-count: 1;
|
|
405
387
|
--width: calc(100% / var(--field-count));
|
package/src/types/BagelForm.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { RequireAllOrNone } from 'type-fest';
|
|
2
|
-
|
|
3
1
|
export type AttributeValue = string | number | boolean | null | undefined | Record<string, any>;
|
|
4
2
|
|
|
5
3
|
export type AttributeFn<T = Record<string, any>> = (field: any, row: T) => AttributeValue;
|
|
@@ -8,27 +6,26 @@ export interface Attributes<T = any> {
|
|
|
8
6
|
[key: string]: AttributeValue | AttributeFn<T>
|
|
9
7
|
}
|
|
10
8
|
|
|
11
|
-
export type Field<T = Record<string, any>> =
|
|
9
|
+
export type Field<T = Record<string, any>> = {
|
|
12
10
|
$el?: any;
|
|
13
11
|
id?: string;
|
|
14
12
|
label?: string;
|
|
15
13
|
placeholder?: string;
|
|
16
14
|
children?: Field<T>[];
|
|
17
15
|
class?: AttributeValue | AttributeFn<T>,
|
|
18
|
-
options?: string | ({ label: string; value: string | number }|string|number)[],
|
|
16
|
+
options?: string | ({ label: string; value: string | number } | string | number)[],
|
|
19
17
|
attrs?: Attributes<T>;
|
|
20
18
|
required?: boolean;
|
|
21
19
|
hint?: string;
|
|
22
20
|
defaultValue?: any;
|
|
23
|
-
transform?: (val?: any, rowData?:Record<string, any>) => any;
|
|
24
|
-
onUpdate?: (val: any, fieldData?:any, rowData?:Record<string, any>) => void;
|
|
21
|
+
transform?: (val?: any, rowData?: Record<string, any>) => any;
|
|
22
|
+
onUpdate?: (val: any, fieldData?: any, rowData?: Record<string, any>) => void;
|
|
25
23
|
'v-if'?: string | boolean | ((val: any, row: T) => boolean);
|
|
26
|
-
}
|
|
27
|
-
'id' | '$el'>
|
|
24
|
+
}
|
|
28
25
|
|
|
29
26
|
export interface SelectBagelField {
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
inputType: 'SelectField';
|
|
28
|
+
options: string | { label: string; value: string | number }[];
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
export type BglFormSchemaT<T = Record<string, any>> = Field<T>[];
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input mt-2">
|
|
3
|
-
{{ label }}
|
|
4
|
-
<div class="mb-2 mt-1">
|
|
5
|
-
<div
|
|
6
|
-
class="bglform-contact"
|
|
7
|
-
v-for="(contact, i) in val"
|
|
8
|
-
:key="i"
|
|
9
|
-
>
|
|
10
|
-
<input
|
|
11
|
-
v-model="contact.email"
|
|
12
|
-
:placeholder="placeholders.email"
|
|
13
|
-
type="email"
|
|
14
|
-
v-if="id === 'email'"
|
|
15
|
-
>
|
|
16
|
-
<input
|
|
17
|
-
v-model="contact.phone"
|
|
18
|
-
:placeholder="placeholders.phone"
|
|
19
|
-
type="tel"
|
|
20
|
-
v-if="id === 'phone'"
|
|
21
|
-
>
|
|
22
|
-
<input
|
|
23
|
-
v-if="contact.email || contact.phone"
|
|
24
|
-
v-model="contact.label"
|
|
25
|
-
type="text"
|
|
26
|
-
:placeholder="placeholders.label"
|
|
27
|
-
>
|
|
28
|
-
<div class="bglform-contact-opt">
|
|
29
|
-
<!-- <input v-model="contact.primary" id="primary" type="checkbox" > -->
|
|
30
|
-
<CheckInput
|
|
31
|
-
label = "Primary"
|
|
32
|
-
v-model="contact.primary"
|
|
33
|
-
/>
|
|
34
|
-
<MaterialIcon
|
|
35
|
-
@click="val.splice(i, 1)"
|
|
36
|
-
icon="delete"
|
|
37
|
-
class="btn-float"
|
|
38
|
-
/>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<Btn
|
|
42
|
-
color="light"
|
|
43
|
-
thin
|
|
44
|
-
@click="val.push({})"
|
|
45
|
-
icon="add"
|
|
46
|
-
>
|
|
47
|
-
Add
|
|
48
|
-
</Btn>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
|
|
53
|
-
<script setup lang="ts">
|
|
54
|
-
import { MaterialIcon, Btn, CheckInput } from '.';
|
|
55
|
-
|
|
56
|
-
withDefaults(
|
|
57
|
-
defineProps<{
|
|
58
|
-
label?: string;
|
|
59
|
-
modelValue: any;
|
|
60
|
-
editMode?: boolean;
|
|
61
|
-
small?: boolean;
|
|
62
|
-
id: string;
|
|
63
|
-
placeholders: {
|
|
64
|
-
email: string
|
|
65
|
-
phone: string
|
|
66
|
-
label: string
|
|
67
|
-
}
|
|
68
|
-
}>(),
|
|
69
|
-
{
|
|
70
|
-
editMode: true,
|
|
71
|
-
small: false,
|
|
72
|
-
},
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
const val = defineModel<any[]>('modelValue', { default: [] });
|
|
76
|
-
</script>
|
|
77
|
-
<!--
|
|
78
|
-
<style>
|
|
79
|
-
.bglform-contact {
|
|
80
|
-
display: grid;
|
|
81
|
-
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
|
82
|
-
|
|
83
|
-
gap: 1rem;
|
|
84
|
-
position: relative;
|
|
85
|
-
}
|
|
86
|
-
.bglform-contact-opt {
|
|
87
|
-
display: flex;
|
|
88
|
-
align-items: center;
|
|
89
|
-
gap: 1rem;
|
|
90
|
-
justify-content: start;
|
|
91
|
-
width: 80px;
|
|
92
|
-
}
|
|
93
|
-
.bglform-contact-opt:after {
|
|
94
|
-
content: '';
|
|
95
|
-
grid-column: span 2;
|
|
96
|
-
}
|
|
97
|
-
.bagel-input.checkbox {
|
|
98
|
-
width: auto;
|
|
99
|
-
padding: 0;
|
|
100
|
-
min-width: 0;
|
|
101
|
-
}
|
|
102
|
-
.btn-float {
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
color: var(--bgl-gray);
|
|
105
|
-
transition: var(--bgl-transition);
|
|
106
|
-
}
|
|
107
|
-
.btn-float:hover {
|
|
108
|
-
color: var(--bgl-red);
|
|
109
|
-
}
|
|
110
|
-
.btn-float:active {
|
|
111
|
-
filter: brightness(0.8);
|
|
112
|
-
}
|
|
113
|
-
</style> -->
|
package/src/components/Drop.vue
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
<template>
|
|
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>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { MaterialIcon } from '@bagelink/vue';
|
|
18
|
-
|
|
19
|
-
type Option = {
|
|
20
|
-
label: string;
|
|
21
|
-
value: string;
|
|
22
|
-
} | string | number;
|
|
23
|
-
|
|
24
|
-
const emit = defineEmits(['update:modelValue']);
|
|
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
|
-
|
|
47
|
-
let isOpen = $ref(false);
|
|
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
|
-
});
|
|
55
|
-
|
|
56
|
-
function toggleDropdown() {
|
|
57
|
-
isOpen = !isOpen;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function selectOption(option: Option) {
|
|
61
|
-
selectedVal = optionToValue(option);
|
|
62
|
-
emit('update:modelValue', selectedVal);
|
|
63
|
-
isOpen = false;
|
|
64
|
-
}
|
|
65
|
-
</script>
|
|
66
|
-
|
|
67
|
-
<style>
|
|
68
|
-
.dropdown {
|
|
69
|
-
position: relative;
|
|
70
|
-
font-size: calc(var(--input-font-size) * 1.3);
|
|
71
|
-
/* width: 50px; */
|
|
72
|
-
z-index: 9;
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.dropdown-title {
|
|
77
|
-
white-space: nowrap;
|
|
78
|
-
color: var(--bgl-gray);
|
|
79
|
-
border-radius: var(--input-border-radius);
|
|
80
|
-
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%);
|
|
81
|
-
padding-left: calc(var(--btn-padding) / 2);
|
|
82
|
-
padding-right: calc(var(--btn-padding) / 2);
|
|
83
|
-
display: flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
min-height: var(--input-height);
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
transition: var(--bgl-transition);
|
|
88
|
-
background: var(--bgl-white);
|
|
89
|
-
justify-content: space-between;
|
|
90
|
-
user-select: none;
|
|
91
|
-
position: relative;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.dropdown-title.hasSelection {
|
|
95
|
-
color: var(--bgl-primary);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.open .dropdown {
|
|
99
|
-
min-width: 120px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.dropdown-title:hover {
|
|
103
|
-
filter: var(--bgl-hover-filter);
|
|
104
|
-
color: var(--bgl-primary);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.dropdown-title:active {
|
|
108
|
-
filter: var(--bgl-active-filter);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.dropdown-body {
|
|
112
|
-
border-radius: var(--input-border-radius);
|
|
113
|
-
position: absolute;
|
|
114
|
-
transition: var(--bgl-transition);
|
|
115
|
-
max-height: 0;
|
|
116
|
-
overflow: hidden;
|
|
117
|
-
background: var(--bgl-white);
|
|
118
|
-
inset-inline-start: 0;
|
|
119
|
-
inset-inline-end: 0;
|
|
120
|
-
overflow: auto;
|
|
121
|
-
box-shadow: 0 0 20px rgba(0, 0, 0, 0.20);
|
|
122
|
-
z-index: 99999999;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.dropdown-body * {
|
|
126
|
-
display: block;
|
|
127
|
-
cursor: pointer;
|
|
128
|
-
padding: calc(var(--btn-padding) / 2);
|
|
129
|
-
padding-bottom: calc(var(--btn-padding) / 4);
|
|
130
|
-
padding-top: calc(var(--btn-padding) / 4);
|
|
131
|
-
margin: 0;
|
|
132
|
-
color: inherit;
|
|
133
|
-
text-decoration: none;
|
|
134
|
-
line-height: 1;
|
|
135
|
-
transition: var(--bgl-transition);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.dropdown-body *:hover {
|
|
139
|
-
filter: var(--bgl-hover-filter);
|
|
140
|
-
color: var(--bgl-primary);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.dropdown-body *:active {
|
|
144
|
-
filter: var(--bgl-active-filter);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.dropdown.opendrop .dropdown-body {
|
|
148
|
-
max-height: 150px;
|
|
149
|
-
}
|
|
150
|
-
</style>
|