@bagelink/vue 0.0.236-beta.0 → 0.0.239
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/Btn.vue.d.ts +6 -1
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/ListItem.vue.d.ts +4 -0
- package/dist/components/ListItem.vue.d.ts.map +1 -1
- package/dist/components/Modal.vue.d.ts +3 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts +48 -41
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts +2 -0
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/Title.vue.d.ts +9 -0
- package/dist/components/Title.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 +2 -2
- package/dist/components/form/inputs/SelectInput.vue.d.ts +4 -4
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/ToggleInput.vue.d.ts +6 -6
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/whatsapp/form/MsgTemplate.vue.d.ts +4 -3
- package/dist/components/whatsapp/form/MsgTemplate.vue.d.ts.map +1 -1
- package/dist/index.cjs +1931 -2000
- package/dist/index.mjs +1932 -2001
- package/dist/plugins/bagel.d.ts +1 -1
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +90 -84
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/components/Btn.vue +12 -25
- package/src/components/DataPreview.vue +4 -15
- package/src/components/ListItem.vue +5 -5
- package/src/components/Modal.vue +16 -24
- package/src/components/ModalForm.vue +25 -55
- package/src/components/TableSchema.vue +11 -54
- package/src/components/Title.vue +5 -1
- package/src/components/form/BglField.vue +6 -12
- package/src/components/form/BglForm.vue +1 -1
- package/src/components/form/inputs/DateInput.vue +6 -2
- package/src/components/form/inputs/SelectInput.vue +2 -2
- package/src/components/index.ts +1 -2
- package/src/components/whatsapp/form/MsgTemplate.vue +6 -12
- package/src/plugins/modal.ts +3 -6
- package/src/styles/theme.css +11 -3
- package/src/utils/index.ts +6 -5
- package/tsconfig.json +7 -3
- package/src/components/FormKitTable.vue +0 -280
- package/src/components/FormSchema.vue +0 -76
- package/src/components/ModalBglForm.vue +0 -106
package/src/components/Modal.vue
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="bg-dark" :class="{ 'is-side': side, 'is-active': isActive }"
|
|
4
|
+
@click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal"
|
|
5
|
+
>
|
|
6
|
+
<Card class="modal" @click.stop>
|
|
6
7
|
<header class="tool-bar">
|
|
7
8
|
<slot name="toolbar" />
|
|
8
9
|
<Btn :style="{ float: side ? 'left' : 'right' }" flat icon="close" @click="closeModal" />
|
|
9
|
-
<
|
|
10
|
-
{{ title }}
|
|
11
|
-
</h3>
|
|
10
|
+
<Title class="modal-title" tag="h3" v-if="title" :label="title" />
|
|
12
11
|
</header>
|
|
13
12
|
<slot />
|
|
14
13
|
<footer class="modal-footer mt-3">
|
|
15
14
|
<Btn v-for="(action, i) in actions" :key="i" @click="closeModal" color="gray" v-bind="action" />
|
|
16
15
|
<slot name="footer" />
|
|
17
16
|
</footer>
|
|
18
|
-
</
|
|
17
|
+
</Card>
|
|
19
18
|
</div>
|
|
20
19
|
</template>
|
|
21
20
|
|
|
22
21
|
<script lang="ts" setup>
|
|
23
22
|
import { onMounted, onUnmounted } from 'vue';
|
|
24
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
type BtnOptions, Btn, useEscape, Title, Card,
|
|
25
|
+
} from '@bagelink/vue';
|
|
25
26
|
import '../styles/modal.css';
|
|
26
27
|
|
|
27
28
|
const props = defineProps<{
|
|
@@ -37,27 +38,18 @@ const emit = defineEmits(['update:isModalVisible']);
|
|
|
37
38
|
|
|
38
39
|
const closeModal = () => {
|
|
39
40
|
isActive = false;
|
|
40
|
-
setTimeout(() =>
|
|
41
|
-
emit('update:isModalVisible', false);
|
|
42
|
-
}, 200);
|
|
41
|
+
setTimeout(() => emit('update:isModalVisible', false), 200);
|
|
43
42
|
};
|
|
44
43
|
|
|
44
|
+
defineExpose({ closeModal });
|
|
45
|
+
|
|
45
46
|
const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
|
|
46
47
|
|
|
47
48
|
onMounted(() => {
|
|
48
|
-
setTimeout(() =>
|
|
49
|
-
|
|
50
|
-
}, 1);
|
|
51
|
-
|
|
52
|
-
document.addEventListener(
|
|
53
|
-
'keydown',
|
|
54
|
-
escapeKeyClose,
|
|
55
|
-
);
|
|
49
|
+
setTimeout(() => isActive = true, 1);
|
|
50
|
+
document.addEventListener('keydown', escapeKeyClose);
|
|
56
51
|
});
|
|
57
52
|
onUnmounted(() => {
|
|
58
|
-
document.removeEventListener(
|
|
59
|
-
'keydown',
|
|
60
|
-
escapeKeyClose,
|
|
61
|
-
);
|
|
53
|
+
document.removeEventListener('keydown', escapeKeyClose);
|
|
62
54
|
});
|
|
63
55
|
</script>
|
|
@@ -1,60 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<Btn
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<BglForm :onDelete="onDelete ? runDelete : undefined" :modelValue="modelValue" @update:modelValue="handleEmit"
|
|
13
|
-
@submit="runSubmit" :schema="props.schema" />
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
2
|
+
<Modal :side="side" ref="modal" :dismissable="dismissable" :title="title">
|
|
3
|
+
<BagelForm v-model="formData" :schema="computedFormSchema" />
|
|
4
|
+
<template #footer v-if="onDelete || onSubmit">
|
|
5
|
+
<div>
|
|
6
|
+
<Btn thin flat value="Cancel" @click="closeModal()" />
|
|
7
|
+
<Btn thin icon="delete" v-if="onDelete" flat value="Delete" @click="runDelete()" color="red" />
|
|
8
|
+
</div>
|
|
9
|
+
<Btn value="Submit" @click="runSubmit()" />
|
|
10
|
+
</template>
|
|
11
|
+
</Modal>
|
|
16
12
|
</template>
|
|
17
13
|
|
|
18
14
|
<script lang="ts" setup>
|
|
19
|
-
import { onMounted, onUnmounted } from 'vue';
|
|
20
15
|
import {
|
|
21
|
-
|
|
16
|
+
Modal,
|
|
17
|
+
Btn,
|
|
18
|
+
BagelForm, type BglFormSchemaT, type BtnOptions,
|
|
22
19
|
} from '@bagelink/vue';
|
|
23
|
-
import '../styles/modal.css';
|
|
24
|
-
import { BglForm, BglFormSchemaT } from 'dist';
|
|
25
|
-
|
|
26
|
-
// import { BagelField } from '@bagelink/vue';
|
|
27
20
|
|
|
28
21
|
const props = defineProps<{
|
|
29
22
|
side?: boolean;
|
|
30
23
|
title?: string;
|
|
31
24
|
dismissable?: boolean;
|
|
32
25
|
actions?: BtnOptions[];
|
|
33
|
-
schema: BglFormSchemaT;
|
|
34
|
-
modelValue?: Record<string, any>;
|
|
26
|
+
schema: BglFormSchemaT | (() => BglFormSchemaT);
|
|
35
27
|
// eslint-disable-next-line no-unused-vars
|
|
36
28
|
onSubmit?: ((formData: any) => Promise<void>);
|
|
37
29
|
// eslint-disable-next-line no-unused-vars
|
|
38
30
|
onDelete?: ((id: string) => void);
|
|
39
31
|
}>();
|
|
40
32
|
|
|
41
|
-
|
|
33
|
+
const modal = $ref<InstanceType<typeof Modal>>();
|
|
42
34
|
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
35
|
+
const computedFormSchema = $computed(() => {
|
|
36
|
+
if (typeof props.schema === 'function') return props.schema();
|
|
37
|
+
return props.schema;
|
|
38
|
+
});
|
|
47
39
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
emit('update:isModalVisible', false);
|
|
52
|
-
}, 200);
|
|
53
|
-
};
|
|
40
|
+
const formData = defineModel<Record<string, any>>('modelValue', { default: {} });
|
|
41
|
+
|
|
42
|
+
const closeModal = () => modal?.closeModal();
|
|
54
43
|
|
|
55
|
-
const runSubmit = async (
|
|
44
|
+
const runSubmit = async () => {
|
|
56
45
|
try {
|
|
57
|
-
await props.onSubmit?.(formData);
|
|
46
|
+
await props.onSubmit?.(formData.value);
|
|
58
47
|
closeModal();
|
|
59
48
|
} catch (err) {
|
|
60
49
|
console.error(err);
|
|
@@ -62,28 +51,9 @@ const runSubmit = async (formData: any) => {
|
|
|
62
51
|
};
|
|
63
52
|
|
|
64
53
|
const runDelete = () => {
|
|
65
|
-
props.onDelete?.(
|
|
54
|
+
props.onDelete?.(formData.value?.id);
|
|
66
55
|
closeModal();
|
|
67
56
|
};
|
|
68
|
-
|
|
69
|
-
const escapeKeyClose = (e: KeyboardEvent) => props?.dismissable && useEscape(e, () => closeModal());
|
|
70
|
-
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
isActive = true;
|
|
74
|
-
}, 1);
|
|
75
|
-
|
|
76
|
-
document.addEventListener(
|
|
77
|
-
'keydown',
|
|
78
|
-
escapeKeyClose,
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
onUnmounted(() => {
|
|
82
|
-
document.removeEventListener(
|
|
83
|
-
'keydown',
|
|
84
|
-
escapeKeyClose,
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
57
|
</script>
|
|
88
58
|
|
|
89
59
|
<style scoped>
|
|
@@ -2,62 +2,21 @@
|
|
|
2
2
|
<div class="table-list-wrap h-100">
|
|
3
3
|
<table class="infinite-wrapper">
|
|
4
4
|
<thead class="row first-row">
|
|
5
|
-
<th
|
|
6
|
-
class="col"
|
|
7
|
-
v-for="field in computedSchema"
|
|
8
|
-
:key="field.id"
|
|
9
|
-
@click="sort(field?.id || '')"
|
|
10
|
-
>
|
|
5
|
+
<th class="col" v-for="field in computedSchema" :key="field.id" @click="sort(field?.id || '')">
|
|
11
6
|
<div class="flex">
|
|
12
7
|
{{ field.id }}
|
|
13
|
-
<div
|
|
14
|
-
class="
|
|
15
|
-
:class="{ sorted: sortField === field.id }"
|
|
16
|
-
>
|
|
17
|
-
<MaterialIcon
|
|
18
|
-
:class="{ desc: sortDirection === 'DESC' }"
|
|
19
|
-
icon="keyboard_arrow_up"
|
|
20
|
-
/>
|
|
8
|
+
<div class="list-arrows" :class="{ sorted: sortField === field.id }">
|
|
9
|
+
<MaterialIcon :class="{ desc: sortDirection === 'DESC' }" icon="keyboard_arrow_up" />
|
|
21
10
|
</div>
|
|
22
11
|
</div>
|
|
23
12
|
</th>
|
|
24
13
|
</thead>
|
|
25
|
-
<tbody
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
>
|
|
30
|
-
<tr
|
|
31
|
-
@click="selectElement(row)"
|
|
32
|
-
class="row row-item position-relative"
|
|
33
|
-
v-for="row in data"
|
|
34
|
-
:key="row.id"
|
|
35
|
-
>
|
|
36
|
-
<td
|
|
37
|
-
class="col"
|
|
38
|
-
v-for="field in computedSchema"
|
|
39
|
-
:key="`${field.id}-${row.id}`"
|
|
40
|
-
>
|
|
41
|
-
<slot
|
|
42
|
-
v-if="field.id && slots[field.id]"
|
|
43
|
-
:name="field.id"
|
|
44
|
-
:row="row"
|
|
45
|
-
:field="field"
|
|
46
|
-
/>
|
|
14
|
+
<tbody ref="infinite" class="rows infinite" :class="{ loading }">
|
|
15
|
+
<tr v-for="row in data" :key="row.id" @click="selectElement(row)" class="row row-item position-relative">
|
|
16
|
+
<td class="col" v-for="field in computedSchema" :key="`${field.id}-${row.id}`">
|
|
17
|
+
<slot v-if="field.id && slots[field.id]" :name="field.id" :row="row" :field="field" />
|
|
47
18
|
<div v-else>
|
|
48
|
-
<
|
|
49
|
-
:is="field.$el || 'div'"
|
|
50
|
-
v-if="iffer(field, row)"
|
|
51
|
-
v-bind="bindAttrs(field.attrs, denullify(row, field.id), row)"
|
|
52
|
-
:class="classify(denullify(row, field.id), row, field.class, field.attrs?.class)"
|
|
53
|
-
:src="field.$el === 'img' && field.id ? row[field.id]?.url : ''"
|
|
54
|
-
:modelValue="field.id ? row[field.id] : ''"
|
|
55
|
-
@update:modelValue="($event: any) => field?.onUpdate?.($event, denullify(row, field.id), row)"
|
|
56
|
-
>
|
|
57
|
-
{{
|
|
58
|
-
field?.transform?.(denullify(row, field.id), row) || denullify(row, field.id) || ""
|
|
59
|
-
}}
|
|
60
|
-
</component>
|
|
19
|
+
<BglField :field="field" :modelValue="row" />
|
|
61
20
|
</div>
|
|
62
21
|
</td>
|
|
63
22
|
</tr>
|
|
@@ -71,11 +30,8 @@
|
|
|
71
30
|
import { useSlots } from 'vue';
|
|
72
31
|
import {
|
|
73
32
|
type BglFormSchemaT,
|
|
74
|
-
bindAttrs,
|
|
75
|
-
classify,
|
|
76
|
-
denullify,
|
|
77
33
|
MaterialIcon,
|
|
78
|
-
|
|
34
|
+
BglField,
|
|
79
35
|
} from '@bagelink/vue';
|
|
80
36
|
|
|
81
37
|
const slots = useSlots();
|
|
@@ -93,7 +49,7 @@ const computedSchema = $computed(() => {
|
|
|
93
49
|
return props.schema;
|
|
94
50
|
});
|
|
95
51
|
|
|
96
|
-
const emit = defineEmits(['select']);
|
|
52
|
+
const emit = defineEmits(['select', 'orderBy']);
|
|
97
53
|
|
|
98
54
|
const selectElement = (data: Record<string, any>) => emit('select', data);
|
|
99
55
|
|
|
@@ -108,6 +64,7 @@ const sort = (fieldname: string) => {
|
|
|
108
64
|
sortField = fieldname;
|
|
109
65
|
sortDirection = 'ASC';
|
|
110
66
|
}
|
|
67
|
+
emit('orderBy', `${fieldname} ${sortDirection}`.trim());
|
|
111
68
|
};
|
|
112
69
|
</script>
|
|
113
70
|
|
package/src/components/Title.vue
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component :is="tag">
|
|
3
3
|
<slot />
|
|
4
|
-
{{ label }}
|
|
4
|
+
{{ label || value }}
|
|
5
5
|
</component>
|
|
6
6
|
</template>
|
|
7
7
|
|
|
8
8
|
<script lang="ts" setup>
|
|
9
9
|
defineProps({
|
|
10
|
+
value: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: '',
|
|
13
|
+
},
|
|
10
14
|
label: {
|
|
11
15
|
type: String,
|
|
12
16
|
default: '',
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component :required="field.required" v-bind="bindAttrs(field?.attrs || {}, fieldData, modelValue)"
|
|
3
|
-
:class="classify(fieldData, modelValue, field.class, field.attrs?.class)" v-if="
|
|
4
|
-
:id="field.id" :placeholder="field.placeholder || field.label" v-model="fieldData"
|
|
5
|
-
:defaultValue="field.defaultValue" :options="field.options" :hint="field.hint"
|
|
3
|
+
:class="classify(fieldData, modelValue, field.class, field.attrs?.class)" v-if="iffer(field, fieldData)" :is="is"
|
|
4
|
+
:label="field.label" :id="field.id" :placeholder="field.placeholder || field.label" v-model="fieldData"
|
|
5
|
+
:defaultValue="field.defaultValue" :options="field.options" :hint="field.hint"
|
|
6
|
+
@update:modelValue="($event: any) => field?.onUpdate?.($event, denullify(fieldData, field.id), formData)">
|
|
7
|
+
{{ field.transform?.(fieldData, modelValue) || fieldData || '' }}
|
|
6
8
|
<BglField v-model="formData" v-for="(child, ii) in field.children" :key="child.id || ii" :field="child" />
|
|
7
9
|
</component>
|
|
8
10
|
</template>
|
|
9
11
|
|
|
10
12
|
<script lang="ts" setup>
|
|
11
13
|
import {
|
|
12
|
-
type Field, bindAttrs, classify, SelectInput, TextInput, ToggleInput, CheckInput,
|
|
14
|
+
type Field, bindAttrs, classify, SelectInput, TextInput, ToggleInput, CheckInput, iffer, denullify,
|
|
13
15
|
} from '@bagelink/vue';
|
|
14
16
|
|
|
15
17
|
const props = withDefaults(defineProps<{
|
|
@@ -43,12 +45,4 @@ const fieldData = $computed({
|
|
|
43
45
|
},
|
|
44
46
|
get: () => (props.field.id ? props.modelValue[props.field.id] : ''),
|
|
45
47
|
});
|
|
46
|
-
|
|
47
|
-
const vIf = $computed(() => {
|
|
48
|
-
if (props.field['v-if'] === undefined) return true;
|
|
49
|
-
if (typeof props.field['v-if'] === 'boolean') return props.field['v-if'];
|
|
50
|
-
if (typeof props.field['v-if'] === 'string') return !!props.modelValue.value[props.field['v-if']];
|
|
51
|
-
if (typeof props.field['v-if'] === 'function') return props.field['v-if']!(fieldData.value, props.modelValue);
|
|
52
|
-
return true;
|
|
53
|
-
});
|
|
54
48
|
</script>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<label v-if="label">
|
|
4
4
|
{{ label }}
|
|
5
5
|
</label>
|
|
6
|
-
<VDatepicker ref="datePicker" :auto-apply="true" v-model="date" :enable-time-picker="enableTime"/>
|
|
6
|
+
<VDatepicker ref="datePicker" :auto-apply="true" v-model="date" :enable-time-picker="enableTime" />
|
|
7
7
|
</div>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ let date = $computed<string | Date>({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
onMounted(() => {
|
|
48
|
-
if (props.defaultValue)
|
|
48
|
+
if (props.defaultValue) date = props.defaultValue;
|
|
49
49
|
});
|
|
50
50
|
</script>
|
|
51
51
|
|
|
@@ -53,4 +53,8 @@ onMounted(() => {
|
|
|
53
53
|
.dp__input_wrap input {
|
|
54
54
|
padding-inline-start: 2rem !important;
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
.dp__calendar_row>div:last-child {
|
|
58
|
+
pointer-events: auto !important;
|
|
59
|
+
}
|
|
56
60
|
</style>
|
|
@@ -20,8 +20,8 @@ type RawOption = Option | string | number;
|
|
|
20
20
|
|
|
21
21
|
const props = defineProps<{
|
|
22
22
|
required?: boolean,
|
|
23
|
-
label
|
|
24
|
-
id
|
|
23
|
+
label?: string,
|
|
24
|
+
id?: string,
|
|
25
25
|
modelValue?: string | number,
|
|
26
26
|
placeholder?: string,
|
|
27
27
|
defaultValue?: string | number,
|
package/src/components/index.ts
CHANGED
|
@@ -4,14 +4,13 @@ export { default as MaterialIcon } from './MaterialIcon.vue';
|
|
|
4
4
|
export { default as NavBar } from './NavBar.vue';
|
|
5
5
|
export { default as Btn } from './Btn.vue';
|
|
6
6
|
export { default as Modal } from './Modal.vue';
|
|
7
|
-
export { default as
|
|
7
|
+
export { default as ModalForm } from './ModalForm.vue';
|
|
8
8
|
export { default as AccordionItem } from './AccordionItem.vue';
|
|
9
9
|
export { default as ListView } from './ListView.vue';
|
|
10
10
|
export { default as ListItem } from './ListItem.vue';
|
|
11
11
|
export { default as TabbedLayout } from './TabbedLayout.vue';
|
|
12
12
|
export { default as Comments } from './Comments.vue';
|
|
13
13
|
export { default as PageTitle } from './PageTitle.vue';
|
|
14
|
-
export { default as FormSchema } from './FormSchema.vue';
|
|
15
14
|
export { default as TableSchema } from './TableSchema.vue';
|
|
16
15
|
export { default as TopBar } from './TopBar.vue';
|
|
17
16
|
export { default as RouterWrapper } from './RouterWrapper.vue';
|
|
@@ -4,16 +4,9 @@
|
|
|
4
4
|
<div class="view-wrapper card thin">
|
|
5
5
|
<div class="whatsapp-wrap">
|
|
6
6
|
<div class="create-template-form">
|
|
7
|
-
<
|
|
8
|
-
:schema="whatsappTemplateSchema()"
|
|
9
|
-
v-model="localWhatsappData"
|
|
10
|
-
@submit="upsertTemplate"
|
|
11
|
-
/>
|
|
7
|
+
<BagelForm :schema="whatsappTemplateSchema" v-model="localWhatsappData" @submit="upsertTemplate" />
|
|
12
8
|
</div>
|
|
13
|
-
<div
|
|
14
|
-
class="whatsapp-preview"
|
|
15
|
-
:class="{ whatsappHebrew: localWhatsappData?.language === 'he' }"
|
|
16
|
-
>
|
|
9
|
+
<div class="whatsapp-preview" :class="{ whatsappHebrew: localWhatsappData?.language === 'he' }">
|
|
17
10
|
{{ previewLabel }}
|
|
18
11
|
<div class="whatsapp-msg">
|
|
19
12
|
<b>{{
|
|
@@ -35,9 +28,10 @@
|
|
|
35
28
|
<script setup lang="ts">
|
|
36
29
|
import { onMounted } from 'vue';
|
|
37
30
|
|
|
38
|
-
import type { FormKitSchemaDefinition } from '@formkit/core';
|
|
39
31
|
import type { RouteLocationNormalizedLoaded, Router } from 'vue-router';
|
|
40
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
useBagel, PageTitle, BagelForm, BglFormSchemaT,
|
|
34
|
+
} from '@bagelink/vue';
|
|
41
35
|
import {
|
|
42
36
|
BodyComponent,
|
|
43
37
|
HeaderComponent,
|
|
@@ -48,7 +42,7 @@ import {
|
|
|
48
42
|
|
|
49
43
|
const props = withDefaults(
|
|
50
44
|
defineProps<{
|
|
51
|
-
whatsappTemplateSchema:
|
|
45
|
+
whatsappTemplateSchema: BglFormSchemaT<LocalTemplateData>;
|
|
52
46
|
router: Router;
|
|
53
47
|
route: RouteLocationNormalizedLoaded;
|
|
54
48
|
previewLabel?: string;
|
package/src/plugins/modal.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from 'vue';
|
|
4
4
|
import type { Plugin } from 'vue';
|
|
5
5
|
import type { BglFormSchemaT, BtnOptions } from '@bagelink/vue';
|
|
6
|
-
import { Modal,
|
|
6
|
+
import { Modal, ModalForm } from '@bagelink/vue';
|
|
7
7
|
|
|
8
8
|
interface ModalOptions {
|
|
9
9
|
title?: string;
|
|
@@ -84,12 +84,9 @@ export const ModalPlugin: Plugin = {
|
|
|
84
84
|
},
|
|
85
85
|
render() {
|
|
86
86
|
return modalStack.map((modal, index) => {
|
|
87
|
-
|
|
88
|
-
if (modal.modalType === 'modalForm') renderComponent = ModalBglForm;
|
|
89
|
-
else renderComponent = Modal;
|
|
90
|
-
|
|
87
|
+
const renderComponent = modal.modalType === 'modalForm' ? ModalForm : Modal;
|
|
91
88
|
return h(
|
|
92
|
-
renderComponent,
|
|
89
|
+
renderComponent as any,
|
|
93
90
|
{
|
|
94
91
|
...modal.modalOptions,
|
|
95
92
|
'onUpdate:isModalVisible': () => hideModal(index),
|
package/src/styles/theme.css
CHANGED
|
@@ -97,6 +97,14 @@
|
|
|
97
97
|
gap: 1rem;
|
|
98
98
|
display: flex;
|
|
99
99
|
justify-content: space-between;
|
|
100
|
+
align-items: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.modal-footer>div {
|
|
104
|
+
gap: 1rem;
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
align-items: center;
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
* {
|
|
@@ -467,7 +475,7 @@
|
|
|
467
475
|
|
|
468
476
|
.list-view {
|
|
469
477
|
grid-area: list-view;
|
|
470
|
-
grid-template-areas: "list-header"
|
|
478
|
+
grid-template-areas: "list-header""list-content";
|
|
471
479
|
grid-template-columns: 1fr;
|
|
472
480
|
overflow-y: auto;
|
|
473
481
|
grid-template-rows: -webkit-max-content 1fr;
|
|
@@ -497,7 +505,7 @@
|
|
|
497
505
|
opacity: 0;
|
|
498
506
|
}
|
|
499
507
|
|
|
500
|
-
.grid
|
|
508
|
+
.grid>* {
|
|
501
509
|
min-height: 0;
|
|
502
510
|
}
|
|
503
511
|
|
|
@@ -605,4 +613,4 @@
|
|
|
605
613
|
-webkit-margin-start: 0.5rem;
|
|
606
614
|
margin-inline-start: 0.5rem;
|
|
607
615
|
}
|
|
608
|
-
}
|
|
616
|
+
}
|
package/src/utils/index.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function classify(fieldVal?: any, row?: any, ...classes: any[]) {
|
|
|
39
39
|
|
|
40
40
|
export function bindAttrs<T = Record<string, any>>(attrs?: Attributes, fieldVal?: any, row?: T) {
|
|
41
41
|
if (!attrs) return {};
|
|
42
|
-
const exclude = ['class'
|
|
42
|
+
const exclude = ['class'];
|
|
43
43
|
const arr = Object.entries(attrs).filter(([key]) => !exclude.includes(key)).map(([key, value]) => [
|
|
44
44
|
key,
|
|
45
45
|
typeof value === 'function' ? value(fieldVal, row) : value,
|
|
@@ -49,10 +49,11 @@ export function bindAttrs<T = Record<string, any>>(attrs?: Attributes, fieldVal?
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export const iffer = (field: any, itemData: any) => {
|
|
52
|
-
if (field['v-if']
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return field['v-if']
|
|
52
|
+
if (field['v-if'] === undefined) return true;
|
|
53
|
+
if (typeof field['v-if'] === 'boolean') return field['v-if'];
|
|
54
|
+
if (typeof field['v-if'] === 'string') return !!itemData.value[field['v-if']];
|
|
55
|
+
if (typeof field['v-if'] === 'function') return field['v-if']!(itemData?.[field.id], itemData);
|
|
56
|
+
return true;
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
export const denullify = (itemData?: Record<string, any>, fieldID?: string) => (fieldID && itemData ? itemData[fieldID] : null);
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"target": "ESNext",
|
|
4
5
|
"baseUrl": ".",
|
|
5
|
-
"rootDir": "
|
|
6
|
+
"rootDir": "..",
|
|
6
7
|
"module": "ESNext",
|
|
7
8
|
"strict": true,
|
|
8
9
|
"jsx": "preserve",
|
|
@@ -29,6 +30,9 @@
|
|
|
29
30
|
"@vue-macros/reactivity-transform/macros-global"
|
|
30
31
|
],
|
|
31
32
|
"paths": {
|
|
33
|
+
"@bagelink/sdk": [
|
|
34
|
+
"../sdk/src/index.ts"
|
|
35
|
+
],
|
|
32
36
|
"@bagelink/vue": [
|
|
33
37
|
"./src/index.ts"
|
|
34
38
|
],
|
|
@@ -41,6 +45,6 @@
|
|
|
41
45
|
"**/**/*.ts",
|
|
42
46
|
"**/**/*.vue",
|
|
43
47
|
"**/**/*.d.ts",
|
|
44
|
-
"./vite.config.ts"
|
|
45
|
-
]
|
|
48
|
+
"./vite.config.ts"
|
|
49
|
+
],
|
|
46
50
|
}
|