@bagelink/vue 0.0.216 → 0.0.223
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/Avatar.vue.d.ts +20 -0
- package/dist/components/Avatar.vue.d.ts.map +1 -0
- package/dist/components/Card.vue.d.ts +27 -0
- package/dist/components/Card.vue.d.ts.map +1 -0
- package/dist/components/ModalBglForm.vue.d.ts +50 -31
- package/dist/components/ModalBglForm.vue.d.ts.map +1 -1
- package/dist/components/NavBar.vue.d.ts +16 -12
- package/dist/components/NavBar.vue.d.ts.map +1 -1
- package/dist/components/form/BglField.vue.d.ts +12 -19
- package/dist/components/form/BglField.vue.d.ts.map +1 -1
- package/dist/components/form/BglForm.vue.d.ts.map +1 -1
- package/dist/components/form/index.d.ts +0 -3
- package/dist/components/form/index.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/DateInput.vue.d.ts +36 -38
- package/dist/components/form/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TableField.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/index.d.ts +0 -2
- package/dist/components/form/inputs/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +13318 -13575
- package/dist/index.mjs +13319 -13576
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +132 -123
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +9 -10
- package/src/components/Avatar.vue +47 -0
- package/src/components/Card.vue +13 -0
- package/src/components/ContactArray.vue +10 -39
- package/src/components/ModalBglForm.vue +13 -25
- package/src/components/NavBar.vue +25 -9
- package/src/components/PersonPreview.vue +1 -1
- package/src/components/RTXEditor.vue +69 -69
- package/src/components/form/BglField.vue +13 -10
- package/src/components/form/BglForm.vue +3 -9
- package/src/components/form/index.ts +0 -3
- package/src/components/form/inputs/CheckInput.vue +20 -18
- package/src/components/form/inputs/DateInput.vue +14 -23
- package/src/components/form/inputs/TableField.vue +1 -5
- package/src/components/form/inputs/index.ts +0 -2
- package/src/components/index.ts +2 -0
- package/src/plugins/modal.ts +0 -1
- package/src/styles/inputs.css +2 -2
- package/src/styles/layout.css +1 -1
- package/src/styles/theme.css +7 -6
- package/src/types/index.ts +1 -0
- package/src/utils/index.ts +4 -1
- package/src/components/form/ItemRef.vue +0 -44
- package/src/components/form/MaterialIcon.vue +0 -19
- package/src/components/form/PlainInputField.vue +0 -79
- package/src/components/form/inputs/DynamicLinkField.vue +0 -137
- package/src/components/form/inputs/EmailInput.vue +0 -58
|
@@ -10,12 +10,14 @@
|
|
|
10
10
|
v-model="inputVal"
|
|
11
11
|
:class="{ 'no-edit': !editMode }"
|
|
12
12
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
<div class="check-square">
|
|
14
|
+
<svg
|
|
15
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
16
|
+
height="24" viewBox="0 -960 960 960"
|
|
17
|
+
width="24"
|
|
18
|
+
>
|
|
19
|
+
<path d="M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z"/></svg>
|
|
20
|
+
</div>
|
|
19
21
|
<label :for="id">
|
|
20
22
|
{{ label }}
|
|
21
23
|
</label>
|
|
@@ -51,13 +53,16 @@ const inputVal = defineModel<boolean>('modelValue', { default: false });
|
|
|
51
53
|
</style>
|
|
52
54
|
<style scoped>
|
|
53
55
|
.bgl-checkbox{
|
|
54
|
-
position: relative;
|
|
56
|
+
position: relative;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: row;
|
|
59
|
+
align-items: center;
|
|
55
60
|
}
|
|
56
61
|
.bgl-checkbox input[type=checkbox]{
|
|
57
62
|
display: none;
|
|
58
63
|
}
|
|
59
64
|
.bgl-checkbox label{
|
|
60
|
-
padding-inline-start:
|
|
65
|
+
padding-inline-start: 0.5rem;
|
|
61
66
|
transition: var(--bgl-transition);
|
|
62
67
|
cursor: pointer;
|
|
63
68
|
user-select: none;
|
|
@@ -68,34 +73,31 @@ position: relative;
|
|
|
68
73
|
.bgl-checkbox:active{
|
|
69
74
|
filter: var(--bgl-active-filter);
|
|
70
75
|
}
|
|
71
|
-
.bgl-checkbox
|
|
72
|
-
content: "";
|
|
76
|
+
.bgl-checkbox .check-square{
|
|
73
77
|
width: calc(var(--input-height) / 2.5);
|
|
74
78
|
height: calc(var(--input-height) / 2.5);
|
|
75
79
|
background: var(--bgl-white);
|
|
76
|
-
display: inline-block;
|
|
77
|
-
position: absolute;
|
|
78
|
-
margin-top: 0.25rem;
|
|
79
|
-
inset-inline-start: 0;
|
|
80
80
|
border-radius: calc(var(--input-border-radius) / 2) ;
|
|
81
81
|
border: var(--bgl-primary) 1px solid;
|
|
82
|
+
position: relative;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
justify-content: center;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
input:checked ~
|
|
88
|
+
input:checked ~ .check-square{
|
|
85
89
|
background: var(--bgl-primary);
|
|
86
90
|
}
|
|
87
91
|
.bgl-checkbox svg{
|
|
88
92
|
width: calc(var(--input-height) / 2.5);
|
|
89
93
|
height: calc(var(--input-height) / 2.5);
|
|
90
94
|
position: absolute;
|
|
91
|
-
inset-inline-start: 0.05rem;
|
|
92
|
-
margin-top: 0.3rem;
|
|
93
95
|
z-index: 2;
|
|
94
96
|
fill: var(--bgl-white);
|
|
95
97
|
opacity: 0;
|
|
96
98
|
pointer-events: none;
|
|
97
99
|
}
|
|
98
|
-
input:checked ~ svg{
|
|
100
|
+
input:checked ~ .check-square svg{
|
|
99
101
|
opacity: 1;
|
|
100
102
|
}
|
|
101
103
|
</style>
|
|
@@ -1,55 +1,46 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
class="bagel-input"
|
|
4
|
-
:title="
|
|
4
|
+
:title="label"
|
|
5
5
|
:class="{ small: small }"
|
|
6
6
|
>
|
|
7
|
-
<label v-if="
|
|
8
|
-
{{
|
|
7
|
+
<label v-if="label">
|
|
8
|
+
{{ label }}
|
|
9
9
|
</label>
|
|
10
|
-
<
|
|
10
|
+
<VDatepicker v-model="date" :enable-time-picker="enableTime"/>
|
|
11
|
+
<!-- <input
|
|
11
12
|
type="date"
|
|
12
13
|
v-model="date"
|
|
13
|
-
@update:modelValue="handleInput"
|
|
14
14
|
:placeholder="field.placeholder || field.label"
|
|
15
15
|
class="date-picker"
|
|
16
16
|
:disabled="!editMode"
|
|
17
17
|
:enableTimePicker="false"
|
|
18
18
|
:textInputOptions="{ format: 'yyyy-MM-dd' }"
|
|
19
|
-
>
|
|
19
|
+
> -->
|
|
20
20
|
</div>
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script setup lang="ts">
|
|
24
|
-
import
|
|
25
|
-
import
|
|
24
|
+
import VDatepicker from '@vuepic/vue-datepicker';
|
|
25
|
+
import '@vuepic/vue-datepicker/dist/main.css';
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
withDefaults(
|
|
28
28
|
defineProps<{
|
|
29
|
-
|
|
30
|
-
modelValue: any;
|
|
29
|
+
label?: string;
|
|
31
30
|
editMode?: boolean;
|
|
32
31
|
small?: boolean;
|
|
32
|
+
enableTime?: boolean;
|
|
33
33
|
}>(),
|
|
34
34
|
{
|
|
35
|
+
enableTime: false,
|
|
35
36
|
editMode: true,
|
|
36
37
|
small: false,
|
|
37
38
|
},
|
|
38
39
|
);
|
|
39
40
|
|
|
40
|
-
const date =
|
|
41
|
-
|
|
42
|
-
const emit = defineEmits(['update:modelValue']);
|
|
43
|
-
|
|
44
|
-
const handleInput = () => {
|
|
45
|
-
emit('update:modelValue', date.value.toISOString().split('T').shift());
|
|
46
|
-
};
|
|
41
|
+
const date = defineModel<string>('modelValue', { default: '' });
|
|
47
42
|
</script>
|
|
48
43
|
|
|
49
44
|
<style scoped>
|
|
50
|
-
|
|
51
|
-
.date-picker {
|
|
52
|
-
padding-inline-start: 10px;
|
|
53
|
-
}
|
|
54
|
-
*/
|
|
45
|
+
|
|
55
46
|
</style>
|
|
@@ -76,13 +76,9 @@
|
|
|
76
76
|
|
|
77
77
|
<script setup lang="ts">
|
|
78
78
|
import { VueDraggableNext } from 'vue-draggable-next';
|
|
79
|
-
// import { EntityMeta } from 'bagel-sdk/types';
|
|
80
79
|
import { onMounted, ref } from 'vue';
|
|
81
|
-
import { Btn, formatString } from '@bagelink/vue';
|
|
80
|
+
import { Btn, formatString, MaterialIcon } from '@bagelink/vue';
|
|
82
81
|
|
|
83
|
-
import MaterialIcon from '../MaterialIcon.vue';
|
|
84
|
-
|
|
85
|
-
// import { ButtonIcon } from 'src/components/buttons'
|
|
86
82
|
let bagel: any;
|
|
87
83
|
let api: any;
|
|
88
84
|
const props = withDefaults(
|
|
@@ -2,7 +2,6 @@ export { default as CheckInput } from './CheckInput.vue';
|
|
|
2
2
|
export { default as CurrencyInput } from './CurrencyInput.vue';
|
|
3
3
|
export { default as DateInput } from './DateInput.vue';
|
|
4
4
|
export { default as DatetimeInput } from './DatetimeInput.vue';
|
|
5
|
-
export { default as EmailInput } from './EmailInput.vue';
|
|
6
5
|
export { default as FloatInput } from './FloatInput.vue';
|
|
7
6
|
export { default as IntInput } from './IntInput.vue';
|
|
8
7
|
export { default as JSONInput } from './JSONInput.vue';
|
|
@@ -18,7 +17,6 @@ export { default as TextInput } from './TextInput.vue';
|
|
|
18
17
|
export { default as TextArea } from './TextArea.vue';
|
|
19
18
|
export { default as Checkbox } from './Checkbox.vue';
|
|
20
19
|
export { default as ColorPicker } from './ColorPicker.vue';
|
|
21
|
-
export { default as DynamicLinkField } from './DynamicLinkField.vue';
|
|
22
20
|
export { default as PlainText } from './PlainText.vue';
|
|
23
21
|
export { default as DatePicker } from './DatePicker.vue';
|
|
24
22
|
export { default as RadioPillsInput } from './RadioPillsInput.vue';
|
package/src/components/index.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { default as RouterWrapper } from './RouterWrapper.vue';
|
|
|
19
19
|
export { default as ContactSubmissions } from './ContactSubmissions.vue';
|
|
20
20
|
export { default as PersonPreview } from './PersonPreview.vue';
|
|
21
21
|
export { default as DataPreview } from './DataPreview.vue';
|
|
22
|
+
export { default as Card } from './Card.vue';
|
|
23
|
+
export { default as Avatar } from './Avatar.vue';
|
|
22
24
|
|
|
23
25
|
export * from './charts';
|
|
24
26
|
export * from './formkit';
|
package/src/plugins/modal.ts
CHANGED
package/src/styles/inputs.css
CHANGED
|
@@ -17,7 +17,7 @@ select {
|
|
|
17
17
|
|
|
18
18
|
.bagel-input::placeholder .bagel-input label {
|
|
19
19
|
display: block;
|
|
20
|
-
font-size: var(--
|
|
20
|
+
font-size: var(--label-font-size);
|
|
21
21
|
margin-bottom: 2px;
|
|
22
22
|
line-height: 1.3;
|
|
23
23
|
}
|
|
@@ -183,7 +183,7 @@ button.formkit-input:active {
|
|
|
183
183
|
|
|
184
184
|
.formkit-outer label {
|
|
185
185
|
display: block;
|
|
186
|
-
font-size: var(--
|
|
186
|
+
font-size: var(--label-font-size);
|
|
187
187
|
margin-bottom: 2px;
|
|
188
188
|
line-height: 1.3;
|
|
189
189
|
color: var(--label-color);
|
package/src/styles/layout.css
CHANGED
package/src/styles/theme.css
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
--bgl-yellow: #ffbb00;
|
|
25
25
|
--bgl-yellow-light: #fff6d5;
|
|
26
26
|
--bgl-green: #75c98f;
|
|
27
|
-
--border-color: #
|
|
27
|
+
--border-color: #00000020;
|
|
28
28
|
--bgl-bg: #f4f6fa;
|
|
29
29
|
--bgl-shadow: #4c577d26;
|
|
30
30
|
--whatsapp-gray: #89959f;
|
|
@@ -32,15 +32,16 @@
|
|
|
32
32
|
--whatsapp-blue: #71bce6;
|
|
33
33
|
--input-border-radius: 7px;
|
|
34
34
|
--card-border-radius: 15px;
|
|
35
|
-
--
|
|
36
|
-
--btn-padding: 30px;
|
|
37
|
-
--input-bg: #f5f8fa;
|
|
35
|
+
--placeholder-color: #00000040;
|
|
38
36
|
--label-color: #00000080;
|
|
37
|
+
--label-font-size: 12px;
|
|
38
|
+
--input-bg: #f5f8fa;
|
|
39
39
|
--input-color: #000000;
|
|
40
|
-
--placeholder-color: #00000040;
|
|
41
40
|
--input-height: 40px;
|
|
41
|
+
--input-font-size: 14px;
|
|
42
|
+
--btn-border-radius: 10px;
|
|
43
|
+
--btn-padding: 30px;
|
|
42
44
|
--btn-height: 40px;
|
|
43
|
-
--input-font-size: 12px;
|
|
44
45
|
--bgl-transition: all 200ms ease;
|
|
45
46
|
--bgl-hover-filter: brightness(90%);
|
|
46
47
|
--bgl-active-filter: brightness(70%);
|
package/src/types/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type { MaterialIcons } from './materialIcons';
|
|
|
2
2
|
export type { BankDetailsInterface, NewPerson, Person } from './Person';
|
|
3
3
|
export type { Tables, TableToTypeMapping } from '@bagelink/sdk';
|
|
4
4
|
export type { StorageFile } from './file';
|
|
5
|
+
export type { NavLink } from '../components/NavBar.vue';
|
|
5
6
|
|
|
6
7
|
export * from './BtnOptions';
|
|
7
8
|
export * from './BagelForm';
|
package/src/utils/index.ts
CHANGED
|
@@ -26,7 +26,10 @@ export const useFormkit = () => {
|
|
|
26
26
|
return formkit;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export const initials = (...strArr: string[]) =>
|
|
29
|
+
export const initials = (...strArr: string[]) => {
|
|
30
|
+
strArr = strArr.map((str) => str.split(/\s/)).flat();
|
|
31
|
+
return strArr.map((str) => str?.charAt(0)).join('');
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
export function useEscape(event: KeyboardEvent, closeModel: () => void) {
|
|
32
35
|
if (event.key === 'Escape') {
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
{{ field?.label || field.id }}
|
|
4
|
-
|
|
5
|
-
<Btn
|
|
6
|
-
color="gray"
|
|
7
|
-
@click="openModal()"
|
|
8
|
-
v-if="field.refCollection"
|
|
9
|
-
>
|
|
10
|
-
{{ content }}
|
|
11
|
-
<MaterialIcon icon="arrow_forward" />
|
|
12
|
-
</Btn>
|
|
13
|
-
<span
|
|
14
|
-
v-else
|
|
15
|
-
class="pill"
|
|
16
|
-
>
|
|
17
|
-
{{ content }}
|
|
18
|
-
</span>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script lang="ts" setup>
|
|
23
|
-
import { ref, computed } from 'vue';
|
|
24
|
-
|
|
25
|
-
import type { Router } from 'vue-router';
|
|
26
|
-
import { Btn, MaterialIcon, BagelField } from '@bagelink/vue';
|
|
27
|
-
|
|
28
|
-
const openRef = ref(false);
|
|
29
|
-
|
|
30
|
-
const props = defineProps<{
|
|
31
|
-
modelValue: Record<string, any>;
|
|
32
|
-
field: BagelField;
|
|
33
|
-
router: Router;
|
|
34
|
-
}>();
|
|
35
|
-
|
|
36
|
-
const content = computed(() => props.field.refFields?.map((k) => props.modelValue?.[k] || '').join(' '));
|
|
37
|
-
|
|
38
|
-
const openModal = () => {
|
|
39
|
-
console.log(`openning ${props.modelValue?.id}`);
|
|
40
|
-
openRef.value = true;
|
|
41
|
-
void props.router.push(`/${props.field.refCollection}/${props.modelValue?.id}`);
|
|
42
|
-
};
|
|
43
|
-
</script>
|
|
44
|
-
s
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="icon-font"
|
|
4
|
-
:style="{ fontSize: `${size}rem` }"
|
|
5
|
-
>
|
|
6
|
-
{{ icon }}
|
|
7
|
-
</div>
|
|
8
|
-
</template>
|
|
9
|
-
|
|
10
|
-
<script setup lang="ts">
|
|
11
|
-
import type { MaterialIcons } from '@bagelink/vue';
|
|
12
|
-
|
|
13
|
-
defineProps<{
|
|
14
|
-
icon: MaterialIcons
|
|
15
|
-
size?: number
|
|
16
|
-
}>();
|
|
17
|
-
</script>
|
|
18
|
-
|
|
19
|
-
<style scoped></style>
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="bagel-input">
|
|
3
|
-
<label :for="formatString(name, 'pascal')">
|
|
4
|
-
<LangText :input="formatString(name, 'titleCase')" />
|
|
5
|
-
</label>
|
|
6
|
-
<input
|
|
7
|
-
v-if="type === 'checkbox'"
|
|
8
|
-
ref="el"
|
|
9
|
-
:checked="modelValue"
|
|
10
|
-
class="ctl"
|
|
11
|
-
type="checkbox"
|
|
12
|
-
@change="handleCheck"
|
|
13
|
-
>
|
|
14
|
-
<input
|
|
15
|
-
v-else-if="type === 'number'"
|
|
16
|
-
ref="el"
|
|
17
|
-
:name="formatString(name, 'pascal')"
|
|
18
|
-
:type="type"
|
|
19
|
-
:value="modelValue"
|
|
20
|
-
class="ctl"
|
|
21
|
-
@input="handleInput"
|
|
22
|
-
>
|
|
23
|
-
<input
|
|
24
|
-
v-else-if="type === 'text'"
|
|
25
|
-
ref="el"
|
|
26
|
-
:name="formatString(name, 'pascal')"
|
|
27
|
-
:type="type"
|
|
28
|
-
:value="modelValue"
|
|
29
|
-
class="ctl"
|
|
30
|
-
@input="handleInput"
|
|
31
|
-
>
|
|
32
|
-
<textarea
|
|
33
|
-
v-else-if="type === 'textarea'"
|
|
34
|
-
ref="el"
|
|
35
|
-
:name="formatString(name, 'pascal')"
|
|
36
|
-
:type="type"
|
|
37
|
-
:value="modelValue"
|
|
38
|
-
class="ctl"
|
|
39
|
-
@input="handleInput"
|
|
40
|
-
/>
|
|
41
|
-
<div>
|
|
42
|
-
<LangText :input="errorMessage" />
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script lang="ts" setup>
|
|
48
|
-
import { onMounted, ref } from 'vue';
|
|
49
|
-
|
|
50
|
-
import { formatString } from '@bagelink/vue';
|
|
51
|
-
import LangText from '../LangText.vue';
|
|
52
|
-
|
|
53
|
-
const props = defineProps<{
|
|
54
|
-
type: 'text' | 'number' | 'password' | 'email' | 'checkbox' | 'textarea';
|
|
55
|
-
name: string;
|
|
56
|
-
value?: any;
|
|
57
|
-
modelValue: any;
|
|
58
|
-
errorMessage?: string;
|
|
59
|
-
focus?: boolean;
|
|
60
|
-
}>();
|
|
61
|
-
|
|
62
|
-
const emits = defineEmits(['update:modelValue']);
|
|
63
|
-
const el = ref<HTMLInputElement | null>(null);
|
|
64
|
-
const handleInput = (e: Event) => {
|
|
65
|
-
const el = e.target as HTMLInputElement;
|
|
66
|
-
emits('update:modelValue', el.value);
|
|
67
|
-
};
|
|
68
|
-
const handleCheck = (e: Event) => {
|
|
69
|
-
const el = e.target as HTMLInputElement;
|
|
70
|
-
emits('update:modelValue', el.checked ? 1 : 0);
|
|
71
|
-
};
|
|
72
|
-
onMounted(() => {
|
|
73
|
-
if (props.focus) {
|
|
74
|
-
el.value?.focus();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
</script>
|
|
78
|
-
|
|
79
|
-
<style scoped></style>
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:class="{ small: small }"
|
|
5
|
-
>
|
|
6
|
-
<label v-if="label">
|
|
7
|
-
<LangText :input="label" />
|
|
8
|
-
</label>
|
|
9
|
-
|
|
10
|
-
<input
|
|
11
|
-
@keydown.enter="handleEnter"
|
|
12
|
-
autocomplete="off"
|
|
13
|
-
@click="showList = true"
|
|
14
|
-
name="link-input"
|
|
15
|
-
v-model="selectedItem"
|
|
16
|
-
@focus="initList"
|
|
17
|
-
@input="handleInput"
|
|
18
|
-
:disabled="!editMode"
|
|
19
|
-
>
|
|
20
|
-
|
|
21
|
-
<div
|
|
22
|
-
class="custom-select"
|
|
23
|
-
name="link-input"
|
|
24
|
-
:class="{ 'open-select': showList && linkOptions.length > 0 }"
|
|
25
|
-
>
|
|
26
|
-
<div class="custom-select-drop">
|
|
27
|
-
<div
|
|
28
|
-
v-for="item in linkOptions"
|
|
29
|
-
:key="formatString(item.value, 'pascal')"
|
|
30
|
-
@click.stop="handleSelect(item)"
|
|
31
|
-
>
|
|
32
|
-
{{
|
|
33
|
-
useId || entity === 'Entity' ? item.value
|
|
34
|
-
: item.label || item.description || item.value
|
|
35
|
-
}}
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script lang="ts" setup>
|
|
43
|
-
import { onMounted, ref } from 'vue';
|
|
44
|
-
import { formatString } from '@bagelink/vue';
|
|
45
|
-
|
|
46
|
-
// TODO: remove this Nati ?
|
|
47
|
-
|
|
48
|
-
const props = withDefaults(
|
|
49
|
-
defineProps<{
|
|
50
|
-
label?: string;
|
|
51
|
-
modelValue: any;
|
|
52
|
-
useId?: false;
|
|
53
|
-
bagelApp?: any;
|
|
54
|
-
entity: string;
|
|
55
|
-
editMode: boolean;
|
|
56
|
-
filters?: any;
|
|
57
|
-
small?: boolean;
|
|
58
|
-
}>(),
|
|
59
|
-
{
|
|
60
|
-
label: '',
|
|
61
|
-
useId: false,
|
|
62
|
-
filters: {},
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
const showList = ref(false);
|
|
66
|
-
const linkOptions = ref<any>([]);
|
|
67
|
-
const item = ref<ListItem>();
|
|
68
|
-
const emits = defineEmits(['update:modelValue', 'selected']);
|
|
69
|
-
const selectedItem = ref<any>();
|
|
70
|
-
|
|
71
|
-
function handleSelect(item: ListItem) {
|
|
72
|
-
showList.value = false;
|
|
73
|
-
selectedItem.value = item;
|
|
74
|
-
if (props.useId) {
|
|
75
|
-
selectedItem.value = item.value;
|
|
76
|
-
} else {
|
|
77
|
-
selectedItem.value = item.label || item.description || item.value;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
emits('update:modelValue', item.value);
|
|
81
|
-
emits('selected');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
async function getLinkOptions(inputString: string) {
|
|
85
|
-
linkOptions.value = await props.bagelApp?.entity.getLinkedFieldList({
|
|
86
|
-
entity: props.entity,
|
|
87
|
-
txt: inputString,
|
|
88
|
-
reference_entity: '',
|
|
89
|
-
filters: props.filters,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
interface ListItem {
|
|
94
|
-
value: string;
|
|
95
|
-
label?: string;
|
|
96
|
-
description?: string;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async function initList(e: Event) {
|
|
100
|
-
await getLinkOptions(getElValue(e));
|
|
101
|
-
showList.value = true;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function getElValue(e: Event) {
|
|
105
|
-
const el = e.target as HTMLInputElement;
|
|
106
|
-
return el.value.trim();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function handleEnter(e: Event) {
|
|
110
|
-
emits('update:modelValue', getElValue(e));
|
|
111
|
-
emits('selected');
|
|
112
|
-
showList.value = false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function handleClick(e: any) {
|
|
116
|
-
const { target } = e;
|
|
117
|
-
if (target.name != 'link-input' && showList.value == true) {
|
|
118
|
-
showList.value = false;
|
|
119
|
-
emits('update:modelValue', item.value);
|
|
120
|
-
emits('selected');
|
|
121
|
-
}
|
|
122
|
-
// showList.value = false
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const handleInput = async (e: Event) => {
|
|
126
|
-
showList.value = true;
|
|
127
|
-
const el = e.target as HTMLInputElement;
|
|
128
|
-
emits('update:modelValue', el.value);
|
|
129
|
-
await getLinkOptions(el.value);
|
|
130
|
-
};
|
|
131
|
-
onMounted(() => {
|
|
132
|
-
selectedItem.value = props.modelValue;
|
|
133
|
-
document.addEventListener('click', handleClick);
|
|
134
|
-
});
|
|
135
|
-
</script>
|
|
136
|
-
|
|
137
|
-
<style scoped></style>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="bagel-input"
|
|
4
|
-
:title="description"
|
|
5
|
-
:class="{ small: small }"
|
|
6
|
-
>
|
|
7
|
-
<label v-if="label">
|
|
8
|
-
<LangText :input="label" />
|
|
9
|
-
</label>
|
|
10
|
-
<input
|
|
11
|
-
:value="modelValue"
|
|
12
|
-
maxlength="140"
|
|
13
|
-
type="email"
|
|
14
|
-
@input="handleInput"
|
|
15
|
-
:class="{ 'no-edit': !editMode }"
|
|
16
|
-
:placeholder="placeholder"
|
|
17
|
-
>
|
|
18
|
-
<!-- :placeholder="bagelApp.translate(placeholder, true)" -->
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
// TODO: remove this Nati?
|
|
24
|
-
|
|
25
|
-
const emits = defineEmits(['update:modelValue']);
|
|
26
|
-
|
|
27
|
-
// const props =
|
|
28
|
-
withDefaults(
|
|
29
|
-
defineProps<{
|
|
30
|
-
description?: string;
|
|
31
|
-
label?: string;
|
|
32
|
-
modelValue: any;
|
|
33
|
-
placeholder?: string;
|
|
34
|
-
editMode?: boolean;
|
|
35
|
-
small?: boolean;
|
|
36
|
-
}>(),
|
|
37
|
-
{
|
|
38
|
-
description: '',
|
|
39
|
-
editMode: true,
|
|
40
|
-
placeholder: '',
|
|
41
|
-
label: '',
|
|
42
|
-
},
|
|
43
|
-
);
|
|
44
|
-
const handleInput = (e: Event) => {
|
|
45
|
-
const el = e.target as HTMLInputElement;
|
|
46
|
-
emits('update:modelValue', el.value);
|
|
47
|
-
};
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<style scoped>
|
|
51
|
-
input[type='email'] {
|
|
52
|
-
direction: ltr;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
[dir='rtl'] input[type='email'] {
|
|
56
|
-
text-align: end;
|
|
57
|
-
}
|
|
58
|
-
</style>
|