@bagelink/vue 0.0.318 → 0.0.322
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/Badge.vue.d.ts +2 -2
- package/dist/components/Badge.vue.d.ts.map +1 -1
- package/dist/components/Card.vue.d.ts +2 -2
- package/dist/components/ComboBox.vue.d.ts +13 -2
- package/dist/components/ComboBox.vue.d.ts.map +1 -1
- package/dist/components/ListView.vue.d.ts.map +1 -1
- package/dist/components/Modal.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/TextInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/layout/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/components/whatsapp/index.d.ts +0 -2
- package/dist/components/whatsapp/index.d.ts.map +1 -1
- package/dist/index.cjs +415 -566
- package/dist/index.mjs +415 -566
- package/dist/style.css +179 -213
- package/dist/types/BagelForm.d.ts +1 -1
- package/dist/types/BagelForm.d.ts.map +1 -1
- package/dist/types/materialIcons.d.ts +1 -1
- package/dist/types/materialIcons.d.ts.map +1 -1
- package/dist/utils/BagelFormUtils.d.ts +23 -0
- package/dist/utils/BagelFormUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Badge.vue +2 -2
- package/src/components/Carousel.vue +137 -137
- package/src/components/ComboBox.vue +72 -49
- package/src/components/ListView.vue +28 -27
- package/src/components/Modal.vue +25 -23
- package/src/components/form/BglField.vue +33 -48
- package/src/components/form/BglForm.vue +34 -15
- package/src/components/form/inputs/TextInput.vue +121 -151
- package/src/components/index.ts +1 -1
- package/src/components/layout/SidebarMenu.vue +4 -5
- package/src/components/whatsapp/index.ts +2 -2
- package/src/styles/layout.css +24 -1
- package/src/styles/text.css +4 -0
- package/src/types/BagelForm.ts +7 -7
- package/src/types/materialIcons.ts +1183 -3006
- package/src/utils/BagelFormUtils.ts +58 -0
- package/src/utils/index.ts +3 -0
package/src/components/Modal.vue
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="bg-dark" :class="{ 'is-side': side, 'is-active': isVisible, 'bg-lignt': false }"
|
|
4
|
+
@click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal"
|
|
5
|
+
>
|
|
6
|
+
<Card class="modal" @click.stop>
|
|
7
|
+
<header class="tool-bar">
|
|
8
|
+
<slot name="toolbar" />
|
|
9
|
+
<Btn :style="{ float: side ? 'left' : 'right' }" flat icon="close" @click="closeModal" />
|
|
10
|
+
<Title class="modal-title" tag="h3" v-if="title" :label="title" />
|
|
11
|
+
</header>
|
|
12
|
+
<slot />
|
|
13
|
+
<footer class="modal-footer mt-3">
|
|
14
|
+
<Btn v-for="(action, i) in actions" :key="i" @click="closeModal" color="gray" v-bind="action" />
|
|
15
|
+
<slot name="footer" />
|
|
16
|
+
</footer>
|
|
17
|
+
</Card>
|
|
18
|
+
</div>
|
|
17
19
|
</template>
|
|
18
20
|
|
|
19
21
|
<script lang="ts" setup>
|
|
20
22
|
import { onMounted, onUnmounted, watch } from 'vue';
|
|
21
23
|
import {
|
|
22
|
-
|
|
24
|
+
type BtnOptions, Btn, useEscape, Title, Card,
|
|
23
25
|
} from '@bagelink/vue';
|
|
24
26
|
import '../styles/modal.css';
|
|
25
27
|
|
|
@@ -34,16 +36,16 @@ const props = defineProps<{
|
|
|
34
36
|
let isVisible = $ref<boolean>(false);
|
|
35
37
|
|
|
36
38
|
watch(() => props.visible, (val) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
if (val === isVisible || val === undefined) return;
|
|
40
|
+
if (val) openModal();
|
|
41
|
+
else closeModal();
|
|
40
42
|
}, { immediate: true });
|
|
41
43
|
|
|
42
44
|
const emit = defineEmits(['update:visible']);
|
|
43
45
|
|
|
44
46
|
const closeModal = () => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
isVisible = false;
|
|
48
|
+
setTimeout(() => emit('update:visible', false), 200);
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
defineExpose({ closeModal });
|
|
@@ -51,13 +53,13 @@ defineExpose({ closeModal });
|
|
|
51
53
|
const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
|
|
52
54
|
|
|
53
55
|
function openModal() {
|
|
54
|
-
|
|
56
|
+
setTimeout(() => isVisible = true, 1);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
onMounted(() => document.addEventListener('keydown', escapeKeyClose));
|
|
58
60
|
|
|
59
61
|
onUnmounted(() => {
|
|
60
|
-
|
|
62
|
+
document.removeEventListener('keydown', escapeKeyClose);
|
|
61
63
|
});
|
|
62
64
|
</script>
|
|
63
65
|
|
|
@@ -1,73 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
:placeholder="field.placeholder || field.label"
|
|
11
|
-
v-model="fieldData"
|
|
12
|
-
:defaultValue="field.defaultValue"
|
|
13
|
-
:options="field.options"
|
|
14
|
-
:helptext="field.helptext"
|
|
15
|
-
@update:modelValue="($event: any) => field?.onUpdate?.($event, formData)"
|
|
16
|
-
>
|
|
17
|
-
{{ field.transform?.(fieldData, modelValue) || fieldData || '' }}
|
|
18
|
-
<BglField
|
|
19
|
-
v-model="formData"
|
|
20
|
-
v-for="(child, ii) in field.children"
|
|
21
|
-
:key="child.id || ii"
|
|
22
|
-
:field="child"
|
|
23
|
-
/>
|
|
24
|
-
</component>
|
|
2
|
+
<component :required="field.required" v-bind="bindAttrs(field?.attrs || {}, fieldData, modelValue)"
|
|
3
|
+
:class="classify(fieldData, modelValue, field.class, field.attrs?.class)" v-if="vIf" :is="is" :label="field.label"
|
|
4
|
+
:id="field.id" :placeholder="field.placeholder || field.label" v-model="fieldData"
|
|
5
|
+
:defaultValue="field.defaultValue" :options="bindAttrs({ options: field.options }, fieldData, modelValue).options"
|
|
6
|
+
:helptext="field.helptext" @update:modelValue="($event: any) => field?.onUpdate?.($event, formData)">
|
|
7
|
+
{{ field.transform?.(fieldData, modelValue) || fieldData || '' }}
|
|
8
|
+
<BglField v-model="formData" v-for="(child, ii) in field.children" :key="child.id || ii" :field="child" />
|
|
9
|
+
</component>
|
|
25
10
|
</template>
|
|
26
11
|
|
|
27
12
|
<script lang="ts" setup>
|
|
28
13
|
import {
|
|
29
|
-
|
|
14
|
+
type Field, bindAttrs, classify, ComboBox, TextInput, ToggleInput, CheckInput,
|
|
30
15
|
} from '@bagelink/vue';
|
|
31
16
|
|
|
32
17
|
const props = withDefaults(defineProps<{
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
field: Field
|
|
19
|
+
modelValue: Record<string, any>
|
|
35
20
|
}>(), {
|
|
36
|
-
|
|
21
|
+
modelValue: () => ({}),
|
|
37
22
|
});
|
|
38
23
|
|
|
39
24
|
const is = $computed(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
if (props.field.$el === 'text') return TextInput;
|
|
26
|
+
if (props.field.$el === 'select') return ComboBox;
|
|
27
|
+
if (props.field.$el === 'toggle') return ToggleInput;
|
|
28
|
+
if (props.field.$el === 'check') return CheckInput;
|
|
29
|
+
return props.field.$el || 'div';
|
|
45
30
|
});
|
|
46
31
|
|
|
47
32
|
const emit = defineEmits(['update:modelValue']);
|
|
48
33
|
|
|
49
34
|
const formData = $computed({
|
|
50
|
-
|
|
51
|
-
|
|
35
|
+
get: () => props.modelValue,
|
|
36
|
+
set: (val: any) => emit('update:modelValue', val),
|
|
52
37
|
});
|
|
53
38
|
|
|
54
39
|
const fieldData = $computed({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
set: (val: any) => {
|
|
41
|
+
if (!props.field.id) return;
|
|
42
|
+
const data = { ...props.modelValue } || {};
|
|
43
|
+
data[props.field.id] = val;
|
|
44
|
+
emit('update:modelValue', data);
|
|
45
|
+
},
|
|
46
|
+
get: () => (props.field.id ? props.modelValue[props.field.id] : props.field.defaultValue || ''),
|
|
62
47
|
});
|
|
63
48
|
|
|
64
49
|
const vIf = $computed(() => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
50
|
+
if (props.field['v-if'] === undefined) return true;
|
|
51
|
+
if (typeof props.field['v-if'] === 'boolean') return props.field['v-if'];
|
|
52
|
+
if (typeof props.field['v-if'] === 'string') return true;
|
|
53
|
+
if (typeof props.field['v-if'] === 'function') {
|
|
54
|
+
return props.field['v-if']?.(fieldData, formData);
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
72
57
|
});
|
|
73
58
|
</script>
|
|
@@ -2,32 +2,39 @@
|
|
|
2
2
|
<template v-if="id">
|
|
3
3
|
<BglField v-for="(field, i) in schema" :key="field.id || `${i}p`" :field="field" v-model="data" />
|
|
4
4
|
</template>
|
|
5
|
-
<form v-else ref="form" @submit.prevent="runSubmit">
|
|
5
|
+
<form v-else-if="(!slots.success || formStatus !== 'success')" ref="form" @submit.prevent="runSubmit">
|
|
6
6
|
<Title tag="h4" :label="label" v-if="label" />
|
|
7
7
|
<BglField v-for="(field, i) in schema" :key="field.id || `${i}p`" :field="field" v-model="data" />
|
|
8
8
|
<slot name="submit" />
|
|
9
|
-
<
|
|
9
|
+
<button @click="runSubmit">
|
|
10
|
+
Click
|
|
11
|
+
</button>
|
|
10
12
|
</form>
|
|
13
|
+
<slot v-if="formStatus === 'success'" name="success" />
|
|
14
|
+
<slot v-if="formStatus === 'error'" name="error" :message="error" />
|
|
11
15
|
</template>
|
|
12
16
|
|
|
13
17
|
<script lang="ts" setup>
|
|
18
|
+
import { useSlots } from 'vue';
|
|
14
19
|
import {
|
|
15
20
|
useModal, BglField, Title,
|
|
16
21
|
} from '@bagelink/vue';
|
|
17
22
|
|
|
18
23
|
import { type BglFormSchemaT } from '@bagelink/vue';
|
|
19
24
|
|
|
25
|
+
const slots = useSlots();
|
|
26
|
+
|
|
20
27
|
const { showModal } = useModal();
|
|
21
28
|
|
|
22
29
|
const props = withDefaults(
|
|
23
30
|
defineProps<{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
label?: string;
|
|
32
|
+
id?: string;
|
|
33
|
+
schema: BglFormSchemaT<any>;
|
|
34
|
+
modelValue?: Record<string, any>;
|
|
35
|
+
onDelete?: ((id: string) => void);
|
|
36
|
+
onSubmit?: ((data: any) => void);
|
|
37
|
+
}>(),
|
|
31
38
|
{
|
|
32
39
|
modelValue: () => ({}),
|
|
33
40
|
},
|
|
@@ -35,7 +42,7 @@ const props = withDefaults(
|
|
|
35
42
|
|
|
36
43
|
const instAt = new Date();
|
|
37
44
|
const timeSinceInst = () => new Date().getTime() - instAt.getTime();
|
|
38
|
-
|
|
45
|
+
let formData = $ref(props.modelValue);
|
|
39
46
|
const emit = defineEmits(['update:modelValue', 'submit', 'dirty']);
|
|
40
47
|
let isDirty = $ref(false);
|
|
41
48
|
const data = $computed({
|
|
@@ -44,9 +51,10 @@ const data = $computed({
|
|
|
44
51
|
emit('dirty');
|
|
45
52
|
isDirty = true;
|
|
46
53
|
}
|
|
54
|
+
formData = val;
|
|
47
55
|
emit('update:modelValue', val);
|
|
48
56
|
},
|
|
49
|
-
get: () => props.modelValue ||
|
|
57
|
+
get: () => props.modelValue || formData,
|
|
50
58
|
});
|
|
51
59
|
const form = $ref<HTMLFormElement>();
|
|
52
60
|
|
|
@@ -54,10 +62,21 @@ const validateForm = () => form?.reportValidity?.();
|
|
|
54
62
|
|
|
55
63
|
const clearForm = () => Object.assign(data, {});
|
|
56
64
|
|
|
65
|
+
type FormStatus = 'idle' | 'loading' | 'success' | 'error' ;
|
|
66
|
+
|
|
67
|
+
let formStatus = $ref<FormStatus>('idle');
|
|
68
|
+
|
|
57
69
|
const runSubmit = () => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
console.log('runSubmit');
|
|
71
|
+
try {
|
|
72
|
+
validateForm();
|
|
73
|
+
props.onSubmit(data);
|
|
74
|
+
// emit('submit', data);
|
|
75
|
+
clearForm();
|
|
76
|
+
formStatus = 'success';
|
|
77
|
+
} catch (e) {
|
|
78
|
+
formStatus = 'error';
|
|
79
|
+
}
|
|
61
80
|
};
|
|
62
81
|
|
|
63
82
|
const i18nT = (val: string) => val;
|
|
@@ -85,6 +104,6 @@ defineExpose({ validateForm, deleteItem, isDirty });
|
|
|
85
104
|
|
|
86
105
|
<style>
|
|
87
106
|
.del-top {
|
|
88
|
-
|
|
107
|
+
transform: translateY(-2.6rem);
|
|
89
108
|
}
|
|
90
109
|
</style>
|
|
@@ -1,107 +1,65 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:disabled="!editMode"
|
|
24
|
-
:required="required"
|
|
25
|
-
:pattern="pattern"
|
|
26
|
-
v-bind="nativeInputAttrs"
|
|
27
|
-
@dblclick="toggleEditAction"
|
|
28
|
-
>
|
|
29
|
-
<textarea
|
|
30
|
-
v-else
|
|
31
|
-
:title="title"
|
|
32
|
-
:id="id"
|
|
33
|
-
v-model="inputVal"
|
|
34
|
-
:type="type"
|
|
35
|
-
:rows="rows"
|
|
36
|
-
ref="input"
|
|
37
|
-
:placeholder="placeholder || label"
|
|
38
|
-
:disabled="!editMode"
|
|
39
|
-
:required="required"
|
|
40
|
-
:pattern="pattern"
|
|
41
|
-
v-bind="nativeInputAttrs"
|
|
42
|
-
@dblclick="toggleEditAction"
|
|
43
|
-
/>
|
|
44
|
-
<p v-if="helptext">{{ helptext }}</p>
|
|
45
|
-
</label>
|
|
46
|
-
|
|
47
|
-
<MaterialIcon
|
|
48
|
-
class="iconStart"
|
|
49
|
-
v-if="iconStart"
|
|
50
|
-
:icon="iconStart"
|
|
51
|
-
/>
|
|
52
|
-
<MaterialIcon
|
|
53
|
-
v-if="icon"
|
|
54
|
-
:icon="icon"
|
|
55
|
-
/>
|
|
56
|
-
<Btn
|
|
57
|
-
class="toggleEditBtn"
|
|
58
|
-
v-if="toggleEdit"
|
|
59
|
-
thin
|
|
60
|
-
@click="toggleEditAction"
|
|
61
|
-
:icon="editMode ? 'check'
|
|
62
|
-
: 'edit'"
|
|
63
|
-
flat
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
2
|
+
<div class="bagel-input text-input" :class="{
|
|
3
|
+
dense, small, shrink, toggleEdit, editMode, code,
|
|
4
|
+
textInputIconWrap: icon,
|
|
5
|
+
txtInputIconStart: iconStart,
|
|
6
|
+
}" :title="title">
|
|
7
|
+
<label :for="id">
|
|
8
|
+
{{ label }}
|
|
9
|
+
<input v-if="!multiline && !autoheight && !code" :title="title" :autocomplete="autocomplete" :id="id"
|
|
10
|
+
v-model="inputVal" :type="type" :rows="1" ref="input" :placeholder="placeholder || label" :disabled="!editMode"
|
|
11
|
+
:required="required" :pattern="pattern" v-bind="nativeInputAttrs" @dblclick="toggleEditAction">
|
|
12
|
+
<textarea v-else :title="title" :id="id" v-model="inputVal" :type="type" :rows="rows" ref="input"
|
|
13
|
+
:placeholder="placeholder || label" :disabled="!editMode" :required="required" :pattern="pattern"
|
|
14
|
+
v-bind="nativeInputAttrs" @dblclick="toggleEditAction" />
|
|
15
|
+
<p v-if="helptext">{{ helptext }}</p>
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<MaterialIcon class="iconStart" v-if="iconStart" :icon="iconStart" />
|
|
19
|
+
<MaterialIcon v-if="icon" :icon="icon" />
|
|
20
|
+
<Btn class="toggleEditBtn" v-if="toggleEdit" thin @click="toggleEditAction" :icon="editMode ? 'check'
|
|
21
|
+
: 'edit'" flat />
|
|
22
|
+
</div>
|
|
66
23
|
</template>
|
|
67
24
|
|
|
68
25
|
<script setup lang="ts">
|
|
69
|
-
import { watch } from 'vue';
|
|
26
|
+
import { onMounted, watch } from 'vue';
|
|
70
27
|
import {
|
|
71
|
-
|
|
28
|
+
debounce, Btn, type MaterialIcons, MaterialIcon,
|
|
72
29
|
} from '@bagelink/vue';
|
|
73
30
|
|
|
74
31
|
const emit = defineEmits(['update:modelValue', 'debounce']);
|
|
75
32
|
const props = withDefaults(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
33
|
+
defineProps<{
|
|
34
|
+
id?: string;
|
|
35
|
+
title?: string;
|
|
36
|
+
helptext?: string;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
modelValue?: string | number;
|
|
39
|
+
label?: string;
|
|
40
|
+
small?: boolean;
|
|
41
|
+
dense?: boolean;
|
|
42
|
+
required?: boolean;
|
|
43
|
+
pattern?: string;
|
|
44
|
+
shrink?: boolean;
|
|
45
|
+
toggleEdit?: boolean;
|
|
46
|
+
type?: string;
|
|
47
|
+
nativeInputAttrs?: Record<string, any>;
|
|
48
|
+
icon?: MaterialIcons;
|
|
49
|
+
iconStart?: MaterialIcons;
|
|
50
|
+
multiline?: boolean;
|
|
51
|
+
autoheight?: boolean;
|
|
52
|
+
code?: boolean;
|
|
53
|
+
lines?: number;
|
|
54
|
+
autocomplete?: string;
|
|
55
|
+
autofocus?: boolean;
|
|
56
|
+
}>(),
|
|
57
|
+
{
|
|
58
|
+
type: 'text',
|
|
59
|
+
toggleEdit: false,
|
|
60
|
+
modelValue: '',
|
|
61
|
+
autocomplete: 'off',
|
|
62
|
+
},
|
|
105
63
|
);
|
|
106
64
|
let inputVal = $ref<string | number>();
|
|
107
65
|
let editMode = $ref<boolean>(!props.toggleEdit);
|
|
@@ -109,118 +67,130 @@ let editMode = $ref<boolean>(!props.toggleEdit);
|
|
|
109
67
|
const input = $ref<HTMLInputElement>();
|
|
110
68
|
|
|
111
69
|
const toggleEditAction = () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
70
|
+
if (!props.toggleEdit) return;
|
|
71
|
+
if (editMode) {
|
|
72
|
+
editMode = false;
|
|
73
|
+
emit('debounce', inputVal);
|
|
74
|
+
emit('update:modelValue', inputVal as string);
|
|
75
|
+
} else {
|
|
76
|
+
editMode = true;
|
|
77
|
+
setTimeout(() => input?.focus(), 10);
|
|
78
|
+
}
|
|
121
79
|
};
|
|
122
80
|
|
|
123
81
|
const rows = $computed(() => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
82
|
+
if (props.lines) return props.lines;
|
|
83
|
+
if (props.autoheight) return `${inputVal}`?.split('\n').length || 1;
|
|
84
|
+
if (props.multiline || props.code) return 4;
|
|
85
|
+
return 1;
|
|
128
86
|
});
|
|
129
87
|
|
|
130
88
|
watch(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
89
|
+
() => inputVal,
|
|
90
|
+
(newVal) => {
|
|
91
|
+
if (props.toggleEdit) return;
|
|
92
|
+
if (newVal === props.modelValue) return;
|
|
93
|
+
emit('update:modelValue', newVal as string);
|
|
94
|
+
debounce(() => emit('debounce', newVal));
|
|
95
|
+
},
|
|
138
96
|
);
|
|
139
97
|
|
|
140
98
|
watch(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
99
|
+
() => props.modelValue,
|
|
100
|
+
(newVal) => {
|
|
101
|
+
if (newVal !== inputVal) inputVal = newVal;
|
|
102
|
+
},
|
|
103
|
+
{ immediate: true },
|
|
146
104
|
);
|
|
105
|
+
|
|
106
|
+
onMounted(() => {
|
|
107
|
+
if (props.autofocus) setTimeout(() => input?.focus(), 10);
|
|
108
|
+
});
|
|
147
109
|
</script>
|
|
148
110
|
|
|
149
111
|
<style>
|
|
150
112
|
.bagel-input.shrink,
|
|
151
113
|
.bagel-input.shrink input {
|
|
152
|
-
|
|
153
|
-
|
|
114
|
+
min-width: unset !important;
|
|
115
|
+
/* width: auto; */
|
|
116
|
+
}
|
|
117
|
+
.bagel-input label {
|
|
118
|
+
font-size: var(--label-font-size);
|
|
154
119
|
}
|
|
155
120
|
</style>
|
|
156
121
|
|
|
157
122
|
<style scoped>
|
|
158
123
|
.bagel-input textarea {
|
|
159
|
-
|
|
124
|
+
min-height: unset;
|
|
125
|
+
font-size: var(--input-font-size);
|
|
160
126
|
}
|
|
161
127
|
|
|
162
128
|
.bagel-input.text-input textarea {
|
|
163
|
-
|
|
129
|
+
resize: none;
|
|
164
130
|
}
|
|
165
131
|
|
|
166
132
|
.code textarea {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
133
|
+
font-family: 'Inconsolata', monospace;
|
|
134
|
+
background: var(--bgl-black) !important;
|
|
135
|
+
color: var(--bgl-white) !important;
|
|
170
136
|
}
|
|
171
137
|
|
|
172
138
|
.bagel-input.toggleEdit:hover {
|
|
173
|
-
|
|
139
|
+
background-color: var(--input-bg);
|
|
174
140
|
}
|
|
175
141
|
|
|
176
142
|
.bagel-input.small {
|
|
177
|
-
|
|
178
|
-
|
|
143
|
+
margin-bottom: 0;
|
|
144
|
+
height: 30px;
|
|
179
145
|
}
|
|
180
146
|
|
|
181
147
|
.bagel-input.dense label {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
gap: 0.5rem;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.bagel-input label {
|
|
154
|
+
font-size: var(--label-font-size);
|
|
185
155
|
}
|
|
186
156
|
|
|
187
157
|
.toggleEditBtn {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
158
|
+
position: absolute;
|
|
159
|
+
right: -24px;
|
|
160
|
+
top: 4;
|
|
161
|
+
opacity: 0;
|
|
192
162
|
}
|
|
193
163
|
|
|
194
164
|
.textInputIconWrap {
|
|
195
|
-
|
|
165
|
+
position: relative;
|
|
196
166
|
}
|
|
197
167
|
|
|
198
168
|
.textInputIconWrap .bgl_icon-font {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
169
|
+
position: absolute;
|
|
170
|
+
inset-inline-end: 0.7rem;
|
|
171
|
+
bottom: 50%;
|
|
172
|
+
line-height: 0;
|
|
173
|
+
color: var(--bgl-gray);
|
|
204
174
|
}
|
|
205
175
|
|
|
206
176
|
.txtInputIconStart .iconStart {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
177
|
+
position: absolute;
|
|
178
|
+
inset-inline-start: 0.7rem;
|
|
179
|
+
top: 50%;
|
|
180
|
+
line-height: 0;
|
|
181
|
+
color: var(--bgl-gray);
|
|
212
182
|
}
|
|
213
183
|
|
|
214
184
|
.txtInputIconStart textarea {
|
|
215
|
-
|
|
185
|
+
padding-inline-start: 2rem;
|
|
216
186
|
}
|
|
217
187
|
|
|
218
188
|
.bagel-input:hover .toggleEditBtn,
|
|
219
189
|
.bagel-input.editMode .toggleEditBtn {
|
|
220
|
-
|
|
190
|
+
opacity: 1;
|
|
221
191
|
}
|
|
222
192
|
|
|
223
193
|
.bagel-input.small textarea {
|
|
224
|
-
|
|
194
|
+
height: 30px;
|
|
225
195
|
}
|
|
226
196
|
</style>
|
package/src/components/index.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<slot v-if="isOpen" name="brand-open" />
|
|
7
7
|
<slot v-if="!navLinks" />
|
|
8
8
|
<Btn
|
|
9
|
-
v-for="(nav, i) in navLinks" :key="i" :to="nav.to" class="nav-button"
|
|
9
|
+
v-for="(nav, i) in navLinks" :key="i" :to="nav.to" class="nav-button px-075"
|
|
10
10
|
v-tooltip.right="{ content: nav.label, disabled: open, class: ['nav-tooltip'] }"
|
|
11
11
|
>
|
|
12
12
|
<template #default >
|
|
@@ -50,13 +50,12 @@ function toggleMenu() {
|
|
|
50
50
|
.wideNav .nav-button .bgl_btn-flex {
|
|
51
51
|
justify-content: flex-start !important;
|
|
52
52
|
}
|
|
53
|
-
</style>
|
|
54
|
-
|
|
55
|
-
<style scoped>
|
|
56
53
|
.nav-button.router-link-active {
|
|
57
|
-
background-color:
|
|
54
|
+
background-color: var(--bgl-primary-tint) !important;
|
|
58
55
|
}
|
|
56
|
+
</style>
|
|
59
57
|
|
|
58
|
+
<style scoped>
|
|
60
59
|
.bgl_sidebar {
|
|
61
60
|
background-color: var(--bgl-primary);
|
|
62
61
|
color: var(--bgl-white);
|