@bagelink/vue 0.0.232-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 +1 -1
- 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 -11
- 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,90 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:class="{ small: small }"
|
|
5
|
-
:title="field.description"
|
|
6
|
-
v-if="field.id"
|
|
7
|
-
>
|
|
8
|
-
<label :for="field.id">
|
|
9
|
-
{{ field.label }}
|
|
10
|
-
<input
|
|
11
|
-
:id="field.id"
|
|
12
|
-
v-model="inputVal"
|
|
13
|
-
:type="inputType"
|
|
14
|
-
:placeholder="field.placeholder || field.label"
|
|
15
|
-
:class="{ 'no-edit': !editMode }"
|
|
16
|
-
:required="required"
|
|
17
|
-
:pattern="pattern"
|
|
18
|
-
v-bind="nativeInputAttrs"
|
|
19
|
-
>
|
|
20
|
-
</label>
|
|
21
|
-
<MaterialIcon
|
|
22
|
-
@click="showPassword"
|
|
23
|
-
:icon="seePassword ? 'visibility' : 'visibility_off'"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup lang="ts">
|
|
29
|
-
import { ref, watch, computed } from 'vue';
|
|
30
|
-
import { MaterialIcon, BagelField } from '@bagelink/vue';
|
|
31
|
-
|
|
32
|
-
const emits = defineEmits(['update:modelValue']);
|
|
33
|
-
let seePassword = $ref<boolean>(false);
|
|
34
|
-
const inputType = computed(() => (seePassword ? 'text' : 'password'));
|
|
35
|
-
|
|
36
|
-
function showPassword() {
|
|
37
|
-
seePassword = !seePassword;
|
|
38
|
-
}
|
|
39
|
-
const props = withDefaults(
|
|
40
|
-
defineProps<{
|
|
41
|
-
field: BagelField;
|
|
42
|
-
modelValue: any;
|
|
43
|
-
editMode?: boolean;
|
|
44
|
-
small?: boolean;
|
|
45
|
-
required?: boolean;
|
|
46
|
-
pattern?: string;
|
|
47
|
-
nativeInputAttrs?: Record<string, any>;
|
|
48
|
-
}>(),
|
|
49
|
-
{
|
|
50
|
-
editMode: true,
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
const inputVal = ref<string>(props.modelValue);
|
|
54
|
-
// watch(
|
|
55
|
-
// () => props.modelValue,
|
|
56
|
-
// (newVal) => {
|
|
57
|
-
// if (inputVal.value !== newVal) inputVal.value = newVal;
|
|
58
|
-
// },
|
|
59
|
-
// );
|
|
60
|
-
watch(inputVal, (newVal) => emits('update:modelValue', newVal));
|
|
61
|
-
// onMounted(() => (inputVal.value = props.modelValue));
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<style scoped>
|
|
65
|
-
.icon-font {
|
|
66
|
-
position: absolute;
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
z-index: 2;
|
|
69
|
-
color: var(--bgl-gray);
|
|
70
|
-
inset-inline-end: 0.75rem;
|
|
71
|
-
inset-block-start: calc(var(--input-height) / 2 + 3px);
|
|
72
|
-
transition: var(--bgl-transition);
|
|
73
|
-
user-select: none;
|
|
74
|
-
border-radius: 100%;
|
|
75
|
-
height: 24px;
|
|
76
|
-
width: 24px;
|
|
77
|
-
display: flex;
|
|
78
|
-
align-items: center;
|
|
79
|
-
justify-content: center;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.icon-font:hover {
|
|
83
|
-
background: var(--bgl-white);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.icon-font:active {
|
|
87
|
-
background: var(--bgl-white);
|
|
88
|
-
filter: brightness(90%);
|
|
89
|
-
}
|
|
90
|
-
</style>
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input" :title="description" :class="{ small: small }">
|
|
3
|
-
<label v-if="label">
|
|
4
|
-
<LangText :input="label" />
|
|
5
|
-
</label>
|
|
6
|
-
<div class="password-input-wrap">
|
|
7
|
-
<input
|
|
8
|
-
:value="modelValue"
|
|
9
|
-
:type="inputType"
|
|
10
|
-
@input="handleInput"
|
|
11
|
-
:placeholder="placeholder"
|
|
12
|
-
:class="{ 'no-edit': !editMode }"
|
|
13
|
-
/>
|
|
14
|
-
<div class="icon-font password-icon" @mousedown="toggleInputType">
|
|
15
|
-
visibility
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</template>
|
|
20
|
-
|
|
21
|
-
<script setup lang="ts">
|
|
22
|
-
const emits = defineEmits(["update:modelValue"]);
|
|
23
|
-
withDefaults(
|
|
24
|
-
defineProps<{
|
|
25
|
-
description?: string;
|
|
26
|
-
label?: string;
|
|
27
|
-
modelValue: any;
|
|
28
|
-
placeholder?: string;
|
|
29
|
-
editMode?: boolean;
|
|
30
|
-
small?: boolean;
|
|
31
|
-
}>(),
|
|
32
|
-
{
|
|
33
|
-
description: "",
|
|
34
|
-
editMode: true,
|
|
35
|
-
placeholder: "",
|
|
36
|
-
label: "",
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
let inputType = $ref("password");
|
|
41
|
-
const handleInput = (e: Event) => {
|
|
42
|
-
const el = e.target as HTMLInputElement;
|
|
43
|
-
emits("update:modelValue", el.value);
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function toggleInputType() {
|
|
47
|
-
inputType = "text";
|
|
48
|
-
document.addEventListener(
|
|
49
|
-
"mouseup",
|
|
50
|
-
() => {
|
|
51
|
-
inputType = "password";
|
|
52
|
-
},
|
|
53
|
-
{ once: true }
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<style scoped>
|
|
59
|
-
.password-input-wrap {
|
|
60
|
-
position: relative;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.password-icon {
|
|
64
|
-
position: absolute;
|
|
65
|
-
top: calc(var(--input-height) / 2 - 10px);
|
|
66
|
-
right: calc(var(--input-height) / 2 - 10px);
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
transition: var(--bgl-transition);
|
|
69
|
-
user-select: none;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.password-icon:hover {
|
|
73
|
-
filter: var(--bgl-hover-filter);
|
|
74
|
-
color: var(--bgl-primary);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.password-icon:active {
|
|
78
|
-
filter: var(--bgl-active-filter);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
[dir="rtl"] .password-icon {
|
|
82
|
-
left: calc(var(--input-height) / 2 - 10px);
|
|
83
|
-
right: unset;
|
|
84
|
-
}
|
|
85
|
-
</style>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:class="{ small }"
|
|
5
|
-
:title="field.description"
|
|
6
|
-
v-if="field.id"
|
|
7
|
-
>
|
|
8
|
-
<label :for="field.id">
|
|
9
|
-
{{ field.label }}
|
|
10
|
-
<input
|
|
11
|
-
:id="field.id"
|
|
12
|
-
v-model="inputVal"
|
|
13
|
-
type="text"
|
|
14
|
-
:placeholder="field.placeholder || field.label"
|
|
15
|
-
:class="{ 'no-edit': !editMode }"
|
|
16
|
-
:required="required"
|
|
17
|
-
:pattern="pattern"
|
|
18
|
-
v-bind="nativeInputAttrs"
|
|
19
|
-
>
|
|
20
|
-
</label>
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script setup lang="ts">
|
|
25
|
-
import { watch } from 'vue';
|
|
26
|
-
import { BagelField } from '@bagelink/vue';
|
|
27
|
-
|
|
28
|
-
const emit = defineEmits(['update:modelValue']);
|
|
29
|
-
const props = withDefaults(
|
|
30
|
-
defineProps<{
|
|
31
|
-
field: BagelField;
|
|
32
|
-
modelValue: any;
|
|
33
|
-
editMode?: boolean;
|
|
34
|
-
small?: boolean;
|
|
35
|
-
required?: boolean;
|
|
36
|
-
pattern?: string;
|
|
37
|
-
nativeInputAttrs?: Record<string, any>;
|
|
38
|
-
}>(),
|
|
39
|
-
{
|
|
40
|
-
editMode: true,
|
|
41
|
-
},
|
|
42
|
-
);
|
|
43
|
-
let inputVal = $ref<string>();
|
|
44
|
-
|
|
45
|
-
watch(
|
|
46
|
-
() => inputVal,
|
|
47
|
-
(newVal) => emit('update:modelValue', newVal),
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
watch(
|
|
51
|
-
() => props.modelValue,
|
|
52
|
-
(newVal) => {
|
|
53
|
-
if (newVal !== inputVal) inputVal = newVal;
|
|
54
|
-
},
|
|
55
|
-
{ immediate: true },
|
|
56
|
-
);
|
|
57
|
-
</script>
|
|
58
|
-
|
|
59
|
-
<style scoped>
|
|
60
|
-
.no-edit {
|
|
61
|
-
cursor: not-allowed;
|
|
62
|
-
}
|
|
63
|
-
</style>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:title="field.description"
|
|
5
|
-
:class="{ small: small }"
|
|
6
|
-
>
|
|
7
|
-
<label v-if="field.label">
|
|
8
|
-
{{ field.label }}
|
|
9
|
-
</label>
|
|
10
|
-
{{ modelValue }}
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { BagelField } from '@bagelink/vue';
|
|
16
|
-
|
|
17
|
-
defineProps<{
|
|
18
|
-
field: BagelField;
|
|
19
|
-
modelValue: any;
|
|
20
|
-
small?: boolean;
|
|
21
|
-
}>();
|
|
22
|
-
</script>
|
|
23
|
-
|
|
24
|
-
<style scoped>
|
|
25
|
-
.no-edit {
|
|
26
|
-
margin-bottom: 2px;
|
|
27
|
-
}
|
|
28
|
-
</style>
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div ref="selectInput" class="bagel-input" :title="label">
|
|
3
|
-
<label v-if="label" for="label" :class="{ active: showList }">{{ label }}</label>
|
|
4
|
-
<div class="custom-select" ref="selectEl" :class="{ 'open-select': showList }">
|
|
5
|
-
<TextInput @keydown.capture="handleKeydown" @click.stop="toggleShowList" :modelValue="displayValue"
|
|
6
|
-
:required="required" />
|
|
7
|
-
<Teleport to="#app">
|
|
8
|
-
<div ref="dropdown" class="custom-select-drop" :class="{ 'open-select': showList }">
|
|
9
|
-
<div v-for="option in optionList" :key="option.value" @click="handleSelect(option)">
|
|
10
|
-
{{ option.label }}
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</Teleport>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</template>
|
|
17
|
-
|
|
18
|
-
<script lang="ts" setup>
|
|
19
|
-
import {
|
|
20
|
-
onMounted, onUnmounted,
|
|
21
|
-
} from 'vue';
|
|
22
|
-
import { TextInput } from '.';
|
|
23
|
-
|
|
24
|
-
type Option = {
|
|
25
|
-
label: string;
|
|
26
|
-
value: string | number;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type RawOption = Option | string | number;
|
|
30
|
-
|
|
31
|
-
const selectEl = $ref<HTMLElement>();
|
|
32
|
-
const dropdown = $ref<HTMLElement>();
|
|
33
|
-
const selectInput = $ref<HTMLElement>();
|
|
34
|
-
let focusedIndex = $ref(-1);
|
|
35
|
-
|
|
36
|
-
let showList = $ref(false);
|
|
37
|
-
const selectedValue = defineModel<string | number>();
|
|
38
|
-
const props = withDefaults(
|
|
39
|
-
defineProps<{
|
|
40
|
-
options: RawOption[] | string;
|
|
41
|
-
label?: string;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
required?: boolean;
|
|
44
|
-
helptext?: string;
|
|
45
|
-
}
|
|
46
|
-
>(),
|
|
47
|
-
{
|
|
48
|
-
helptext: '',
|
|
49
|
-
label: '',
|
|
50
|
-
placeholder: '',
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
function handleKeydown(event: KeyboardEvent) {
|
|
55
|
-
if (event.key === 'Escape') {
|
|
56
|
-
showList = false;
|
|
57
|
-
}
|
|
58
|
-
// arrow down
|
|
59
|
-
if (event.key === 'ArrowDown') {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
focusedIndex++;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function optnToValueLabel(option: RawOption): Option {
|
|
66
|
-
if (typeof option === 'string' || typeof option === 'number') {
|
|
67
|
-
return { label: `${option}`, value: option };
|
|
68
|
-
}
|
|
69
|
-
return option;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const optionList = $computed<Option[]>(() => {
|
|
73
|
-
const optns = typeof props.options === 'string' ? props.options.split('\n|,') : props.options;
|
|
74
|
-
return optns.map(optnToValueLabel);
|
|
75
|
-
});
|
|
76
|
-
const displayValue = $computed(() => optionList.find((optn) => optn.value === selectedValue.value)?.label || '');
|
|
77
|
-
|
|
78
|
-
function handleSelect(option: Option) {
|
|
79
|
-
selectedValue.value = option.value;
|
|
80
|
-
showList = false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function closestScrollableParent(element?: HTMLElement | null) {
|
|
84
|
-
if (!element) return null;
|
|
85
|
-
while (element) {
|
|
86
|
-
const style = window.getComputedStyle(element);
|
|
87
|
-
if ((style.overflowY !== 'visible' && element.scrollHeight > element.clientHeight) ||
|
|
88
|
-
(style.overflowX !== 'visible' && element.scrollWidth > element.clientWidth)) {
|
|
89
|
-
return element;
|
|
90
|
-
}
|
|
91
|
-
element = element.parentElement;
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function positionDropdown() {
|
|
97
|
-
if (!selectEl || !dropdown) return;
|
|
98
|
-
const { top, left, width } = selectEl.getBoundingClientRect();
|
|
99
|
-
dropdown.style.top = `${top + 40}px`;
|
|
100
|
-
dropdown.style.left = `${left}px`;
|
|
101
|
-
dropdown.style.width = `${width}px`;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function toggleShowList() {
|
|
105
|
-
showList = !showList;
|
|
106
|
-
positionDropdown();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
onMounted(() => {
|
|
110
|
-
const scrollable = closestScrollableParent(selectInput);
|
|
111
|
-
scrollable?.addEventListener('scroll', positionDropdown);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
onUnmounted(() => {
|
|
115
|
-
closestScrollableParent(selectInput)?.removeEventListener('scroll', positionDropdown);
|
|
116
|
-
});
|
|
117
|
-
</script>
|
|
118
|
-
|
|
119
|
-
<style scoped>
|
|
120
|
-
.custom-select {
|
|
121
|
-
position: relative;
|
|
122
|
-
font-size: var(--input-font-size);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
.custom-select .input {
|
|
126
|
-
width: 100%;
|
|
127
|
-
cursor: pointer;
|
|
128
|
-
background: var(--input-bg);
|
|
129
|
-
min-height: var(--input-height);
|
|
130
|
-
border: none;
|
|
131
|
-
border-radius: var(--input-border-radius);
|
|
132
|
-
color: var(--input-color);
|
|
133
|
-
position: relative;
|
|
134
|
-
display: flex;
|
|
135
|
-
flex-direction: column;
|
|
136
|
-
text-align: start;
|
|
137
|
-
margin-inline-end: 20px;
|
|
138
|
-
justify-content: center;
|
|
139
|
-
margin-bottom: 2px;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.custom-select .input:after {
|
|
143
|
-
content: 'keyboard_arrow_down';
|
|
144
|
-
font-family: 'Material Symbols Outlined', serif;
|
|
145
|
-
position: absolute;
|
|
146
|
-
top: calc(var(--input-height) / 2 - 10px);
|
|
147
|
-
font-size: calc(var(--input-font-size) * 1.5);
|
|
148
|
-
right: calc(var(--input-height) / 4);
|
|
149
|
-
height: 100%;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
[dir='rtl'] .custom-select .input:after {
|
|
153
|
-
right: unset;
|
|
154
|
-
left: calc(var(--input-font-size) / 2);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
[dir='rtl'] .custom-select-drop {
|
|
158
|
-
inset-inline-start: unset;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.custom-select-drop {
|
|
162
|
-
position: absolute;
|
|
163
|
-
cursor: pointer;
|
|
164
|
-
font-size: 12px;
|
|
165
|
-
box-sizing: border-box;
|
|
166
|
-
min-width: 220px;
|
|
167
|
-
width: 100%;
|
|
168
|
-
background: var(--bgl-white);
|
|
169
|
-
box-shadow: 0 0 10px 0 var(--bgl-shadow);
|
|
170
|
-
border-radius: 10px;
|
|
171
|
-
z-index: 10000;
|
|
172
|
-
overflow-y: auto;
|
|
173
|
-
opacity: 0;
|
|
174
|
-
pointer-events: none;
|
|
175
|
-
/* max-height: 0; */
|
|
176
|
-
/*transition: var(--bgl-transition);*/
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.open-select.custom-select-drop {
|
|
180
|
-
opacity: 1;
|
|
181
|
-
max-height: 150px;
|
|
182
|
-
pointer-events: all;
|
|
183
|
-
/*transition: var(--bgl-transition);*/
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.custom-select-drop>* {
|
|
187
|
-
/*transition: var(--bgl-transition); */
|
|
188
|
-
padding: 0.5rem 0.75rem;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.custom-select-drop>*:hover {
|
|
192
|
-
background: var(--bgl-blue-light);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.custom-select-drop>*:active {
|
|
196
|
-
filter: var(--bgl-hover-filter);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.bagel-input label {
|
|
200
|
-
margin-bottom: 0;
|
|
201
|
-
}
|
|
202
|
-
</style>
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input">
|
|
3
|
-
<div class="mt-1">
|
|
4
|
-
<div
|
|
5
|
-
class="bglform-contact mb-3"
|
|
6
|
-
v-for="(address, i) in val"
|
|
7
|
-
:key="i"
|
|
8
|
-
>
|
|
9
|
-
<div
|
|
10
|
-
class="bglform-contact-confirm"
|
|
11
|
-
v-if="deleteCandidate === i"
|
|
12
|
-
>
|
|
13
|
-
<p class="txt14">
|
|
14
|
-
{{ formPlaceholders?.sure }}
|
|
15
|
-
</p>
|
|
16
|
-
<Btn
|
|
17
|
-
thin
|
|
18
|
-
color="red"
|
|
19
|
-
@click="deleteContact(address.id)"
|
|
20
|
-
>
|
|
21
|
-
{{ formPlaceholders?.delete }}
|
|
22
|
-
</Btn>
|
|
23
|
-
<Btn
|
|
24
|
-
thin
|
|
25
|
-
@click="deleteCandidate = -1"
|
|
26
|
-
>
|
|
27
|
-
{{ formPlaceholders?.cancel }}
|
|
28
|
-
</Btn>
|
|
29
|
-
</div>
|
|
30
|
-
<Checkbox
|
|
31
|
-
v-model="address.primary"
|
|
32
|
-
@update:model-value="($event) => primaryHandler(i, $event)"
|
|
33
|
-
/>
|
|
34
|
-
<input
|
|
35
|
-
class="bglform-contact-label"
|
|
36
|
-
v-model="address.label"
|
|
37
|
-
type="text"
|
|
38
|
-
:placeholder="formPlaceholders?.label"
|
|
39
|
-
>
|
|
40
|
-
<div class="bglform-contact-address">
|
|
41
|
-
<input
|
|
42
|
-
v-model="address.street"
|
|
43
|
-
:placeholder="formPlaceholders?.street"
|
|
44
|
-
type="text"
|
|
45
|
-
>
|
|
46
|
-
<div class="bglform-contact-address-flex">
|
|
47
|
-
<input
|
|
48
|
-
v-model="address.city"
|
|
49
|
-
:placeholder="formPlaceholders?.city"
|
|
50
|
-
type="text"
|
|
51
|
-
>
|
|
52
|
-
<input
|
|
53
|
-
v-model="address.postal_code"
|
|
54
|
-
:placeholder="formPlaceholders?.zip"
|
|
55
|
-
type="text"
|
|
56
|
-
>
|
|
57
|
-
</div>
|
|
58
|
-
<input
|
|
59
|
-
v-model="address.country"
|
|
60
|
-
:placeholder="formPlaceholders?.country"
|
|
61
|
-
type="text"
|
|
62
|
-
>
|
|
63
|
-
</div>
|
|
64
|
-
<div class="bglform-address-del">
|
|
65
|
-
<Btn
|
|
66
|
-
thin
|
|
67
|
-
@click="deleteCandidate = i"
|
|
68
|
-
icon="delete"
|
|
69
|
-
color="gray"
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
</div>
|
|
73
|
-
<Btn
|
|
74
|
-
class="add-btn"
|
|
75
|
-
flat
|
|
76
|
-
thin
|
|
77
|
-
@click="addNew"
|
|
78
|
-
>
|
|
79
|
-
{{ formPlaceholders?.add }}
|
|
80
|
-
{{ context?.label }}
|
|
81
|
-
</Btn>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</template>
|
|
85
|
-
|
|
86
|
-
<script setup lang="ts">
|
|
87
|
-
import { watch } from 'vue';
|
|
88
|
-
// import type { BagelField } from '@bagelink/vue';
|
|
89
|
-
|
|
90
|
-
import { Btn, useBagel } from '@bagelink/vue';
|
|
91
|
-
import Checkbox from '../form/inputs/Checkbox.vue';
|
|
92
|
-
|
|
93
|
-
export interface AddressArrContext {
|
|
94
|
-
label?: string;
|
|
95
|
-
id?: string;
|
|
96
|
-
value: any[];
|
|
97
|
-
node: Record<string, any>;
|
|
98
|
-
attrs: {
|
|
99
|
-
formPlaceholders?: {
|
|
100
|
-
add?: string;
|
|
101
|
-
cancel?: string;
|
|
102
|
-
city?: string;
|
|
103
|
-
country?: string;
|
|
104
|
-
delete?: string;
|
|
105
|
-
label?: string;
|
|
106
|
-
sure?: string;
|
|
107
|
-
zip?: string;
|
|
108
|
-
street?: string;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
const bagel = useBagel();
|
|
113
|
-
const props = defineProps<{
|
|
114
|
-
context: AddressArrContext;
|
|
115
|
-
}>();
|
|
116
|
-
const formPlaceholders = $computed(
|
|
117
|
-
() => props.context?.attrs?.formPlaceholders,
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
let val = $ref<any[]>([]);
|
|
121
|
-
const addNew = () => {
|
|
122
|
-
if (!val) val = [{}];
|
|
123
|
-
else val.push({});
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
let deleteCandidate = $ref<number>(-1);
|
|
127
|
-
|
|
128
|
-
const del = (i: number) => {
|
|
129
|
-
val.splice(i, 1);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const deleteContact = async (id: string) => {
|
|
133
|
-
await bagel.delete(`/person/contact/${id}`);
|
|
134
|
-
const index = val.findIndex((v) => v.id === id);
|
|
135
|
-
deleteCandidate = -1;
|
|
136
|
-
del(index);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const primaryHandler = (i: number, isPrimary: boolean) => {
|
|
140
|
-
if (!isPrimary) return;
|
|
141
|
-
val?.forEach((contact, index) => {
|
|
142
|
-
if (index !== i) contact.primary = false;
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
watch(
|
|
147
|
-
() => props.context?.value,
|
|
148
|
-
() => {
|
|
149
|
-
val = props.context?.value;
|
|
150
|
-
},
|
|
151
|
-
{ immediate: true },
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
watch(
|
|
155
|
-
() => val,
|
|
156
|
-
() => {
|
|
157
|
-
props.context?.node.input(val);
|
|
158
|
-
},
|
|
159
|
-
);
|
|
160
|
-
</script>
|
|
161
|
-
|
|
162
|
-
<style>
|
|
163
|
-
.bglform-contact-confirm {
|
|
164
|
-
position: absolute;
|
|
165
|
-
background: rgba(255, 255, 255, 0.5);
|
|
166
|
-
height: 100%;
|
|
167
|
-
width: 100%;
|
|
168
|
-
display: flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
justify-content: center;
|
|
171
|
-
gap: 0.5rem;
|
|
172
|
-
backdrop-filter: blur(1px);
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
175
|
-
<style scoped>
|
|
176
|
-
.bglform-contact {
|
|
177
|
-
display: flex;
|
|
178
|
-
gap: 0.5rem;
|
|
179
|
-
max-width: 700px;
|
|
180
|
-
position: relative;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.bglform-contact-label {
|
|
184
|
-
flex-basis: 140px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.bglform-contact-address {
|
|
188
|
-
display: flex;
|
|
189
|
-
flex-direction: column;
|
|
190
|
-
gap: 0.5rem;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.bglform-contact input[type="checkbox"] {
|
|
194
|
-
width: 30px;
|
|
195
|
-
min-width: 0;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.light.thin.flatBtn.btn {
|
|
199
|
-
padding-left: calc(var(--btn-padding) / 4);
|
|
200
|
-
padding-right: calc(var(--btn-padding) / 4);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.bglform-address-del {
|
|
204
|
-
margin-top: 6px;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.bglform-contact-address-flex {
|
|
208
|
-
display: flex;
|
|
209
|
-
gap: 0.5rem;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.add-btn {
|
|
213
|
-
display: flex;
|
|
214
|
-
gap: 0.5rem;
|
|
215
|
-
align-items: center;
|
|
216
|
-
margin-inline-start: 1rem;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.add-btn:active {
|
|
220
|
-
background: none !important;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.add-btn::before {
|
|
224
|
-
content: "+";
|
|
225
|
-
font-size: 10px;
|
|
226
|
-
background: var(--bgl-blue-light);
|
|
227
|
-
border-radius: 100%;
|
|
228
|
-
height: 14px;
|
|
229
|
-
width: 14px;
|
|
230
|
-
display: flex;
|
|
231
|
-
align-items: center;
|
|
232
|
-
justify-content: center;
|
|
233
|
-
color: var(--bgl-primary);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.add-btn:hover::before {
|
|
237
|
-
background: var(--bgl-primary);
|
|
238
|
-
color: var(--bgl-white);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@media screen and (max-width: 910px) {
|
|
242
|
-
.bglform-contact-address-flex {
|
|
243
|
-
flex-wrap: wrap;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.bglform-contact-label {
|
|
247
|
-
min-width: 0;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
</style>
|