@bagelink/vue 0.0.260 → 0.0.264
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/Card.vue.d.ts +2 -2
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/ModalForm.vue.d.ts +10 -1
- package/dist/components/ModalForm.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/JSONInput.vue.d.ts +1 -1
- package/dist/components/form/inputs/JSONInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichTextEditor.vue.d.ts +1 -1
- package/dist/components/form/inputs/RichTextEditor.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/SelectInput.vue.d.ts +2 -0
- package/dist/components/form/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextArea.vue.d.ts +3 -1
- package/dist/components/form/inputs/TextArea.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/index.cjs +72 -39
- package/dist/index.mjs +72 -39
- package/dist/plugins/modal.d.ts +17 -6
- package/dist/plugins/modal.d.ts.map +1 -1
- package/dist/style.css +42 -42
- package/package.json +1 -1
- package/src/components/Modal.vue +29 -6
- package/src/components/ModalForm.vue +52 -12
- package/src/components/TableSchema.vue +11 -3
- package/src/components/form/BglForm.vue +1 -1
- package/src/components/form/inputs/SelectInput.vue +12 -3
- package/src/components/form/inputs/TextArea.vue +2 -0
- package/src/components/form/inputs/TextInput.vue +55 -15
- package/src/plugins/modal.ts +20 -12
package/dist/style.css
CHANGED
|
@@ -546,11 +546,11 @@
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
-
.modal-title[data-v-
|
|
549
|
+
.modal-title[data-v-5c602c4d] {
|
|
550
550
|
margin-top: 0.5rem;
|
|
551
551
|
}
|
|
552
552
|
@media screen and (max-width: 910px) {
|
|
553
|
-
.modal-title[data-v-
|
|
553
|
+
.modal-title[data-v-5c602c4d] {
|
|
554
554
|
margin-top: 1rem;
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -741,37 +741,37 @@
|
|
|
741
741
|
border-radius: var(--btn-border-radius);
|
|
742
742
|
}
|
|
743
743
|
|
|
744
|
-
.list-arrows[data-v-
|
|
744
|
+
.list-arrows[data-v-2137a7a8] {
|
|
745
745
|
opacity: 0;
|
|
746
746
|
}
|
|
747
|
-
.list-arrows .bgl_icon-font[data-v-
|
|
747
|
+
.list-arrows .bgl_icon-font[data-v-2137a7a8] {
|
|
748
748
|
transition: all ease-in-out 0.2s;
|
|
749
749
|
}
|
|
750
|
-
.list-arrows.sorted[data-v-
|
|
750
|
+
.list-arrows.sorted[data-v-2137a7a8] {
|
|
751
751
|
opacity: 1;
|
|
752
752
|
}
|
|
753
|
-
.col img[data-v-
|
|
753
|
+
.col img[data-v-2137a7a8] {
|
|
754
754
|
height: 35px;
|
|
755
755
|
margin-top: -14px;
|
|
756
756
|
margin-bottom: -14px;
|
|
757
757
|
border-radius: 5px;
|
|
758
758
|
}
|
|
759
|
-
.list-arrows.sorted .desc[data-v-
|
|
759
|
+
.list-arrows.sorted .desc[data-v-2137a7a8] {
|
|
760
760
|
transform: rotate(180deg);
|
|
761
761
|
}
|
|
762
|
-
table[data-v-
|
|
762
|
+
table[data-v-2137a7a8] {
|
|
763
763
|
border-collapse: separate;
|
|
764
764
|
border-spacing: 0 15px;
|
|
765
765
|
border-collapse: collapse;
|
|
766
766
|
}
|
|
767
|
-
th[data-v-
|
|
767
|
+
th[data-v-2137a7a8] {
|
|
768
768
|
font-weight: 400;
|
|
769
769
|
}
|
|
770
|
-
.row[data-v-
|
|
770
|
+
.row[data-v-2137a7a8] {
|
|
771
771
|
border-bottom: 1px solid var(--border-color);
|
|
772
772
|
cursor: pointer;
|
|
773
773
|
}
|
|
774
|
-
.row.first-row[data-v-
|
|
774
|
+
.row.first-row[data-v-2137a7a8] {
|
|
775
775
|
font-size: 0.8rem;
|
|
776
776
|
color: var(--bgl-black-tint);
|
|
777
777
|
position: sticky;
|
|
@@ -781,7 +781,7 @@ th[data-v-555ad739] {
|
|
|
781
781
|
height: 50px;
|
|
782
782
|
vertical-align: bottom;
|
|
783
783
|
}
|
|
784
|
-
.row.first-row[data-v-
|
|
784
|
+
.row.first-row[data-v-2137a7a8]::after {
|
|
785
785
|
content: "";
|
|
786
786
|
border-bottom: 1px solid var(--border-color);
|
|
787
787
|
position: absolute;
|
|
@@ -789,11 +789,11 @@ th[data-v-555ad739] {
|
|
|
789
789
|
right: 0;
|
|
790
790
|
bottom: -1px;
|
|
791
791
|
}
|
|
792
|
-
.first-row .col[data-v-
|
|
792
|
+
.first-row .col[data-v-2137a7a8] {
|
|
793
793
|
cursor: pointer;
|
|
794
794
|
background: var(--bgl-white);
|
|
795
795
|
}
|
|
796
|
-
.col[data-v-
|
|
796
|
+
.col[data-v-2137a7a8] {
|
|
797
797
|
white-space: nowrap;
|
|
798
798
|
padding: 14px;
|
|
799
799
|
transition: var(--bgl-transition);
|
|
@@ -802,16 +802,16 @@ th[data-v-555ad739] {
|
|
|
802
802
|
padding-right: 1rem;
|
|
803
803
|
align-items: center;
|
|
804
804
|
}
|
|
805
|
-
.col>div[data-v-
|
|
805
|
+
.col>div[data-v-2137a7a8] {
|
|
806
806
|
display: flex;
|
|
807
807
|
gap: 0.5rem;
|
|
808
808
|
}
|
|
809
|
-
.max-col-width[data-v-
|
|
809
|
+
.max-col-width[data-v-2137a7a8] {
|
|
810
810
|
max-width: 30vw;
|
|
811
811
|
overflow: hidden;
|
|
812
812
|
text-overflow: ellipsis;
|
|
813
813
|
}
|
|
814
|
-
.col.check .bgl_icon-font[data-v-
|
|
814
|
+
.col.check .bgl_icon-font[data-v-2137a7a8] {
|
|
815
815
|
border-radius: 100%;
|
|
816
816
|
background: var(--bgl-blue-20);
|
|
817
817
|
color: var(--bgl-primary);
|
|
@@ -822,27 +822,27 @@ th[data-v-555ad739] {
|
|
|
822
822
|
justify-content: center;
|
|
823
823
|
margin-top: -2px;
|
|
824
824
|
}
|
|
825
|
-
.rows[data-v-
|
|
825
|
+
.rows[data-v-2137a7a8] {
|
|
826
826
|
font-size: 0.8125em;
|
|
827
827
|
}
|
|
828
|
-
.table-list[data-v-
|
|
828
|
+
.table-list[data-v-2137a7a8] {
|
|
829
829
|
height: 100%;
|
|
830
830
|
position: relative;
|
|
831
831
|
padding-left: 0 !important;
|
|
832
832
|
padding-right: 0 !important;
|
|
833
833
|
overflow: auto;
|
|
834
834
|
}
|
|
835
|
-
.BagelTable .table-list[data-v-
|
|
835
|
+
.BagelTable .table-list[data-v-2137a7a8] {
|
|
836
836
|
overflow: unset;
|
|
837
837
|
}
|
|
838
|
-
.row-item[data-v-
|
|
838
|
+
.row-item[data-v-2137a7a8] {
|
|
839
839
|
height: 50px;
|
|
840
840
|
transition: all 200ms ease;
|
|
841
841
|
}
|
|
842
|
-
.row-item[data-v-
|
|
842
|
+
.row-item[data-v-2137a7a8]:hover {
|
|
843
843
|
background: var(--bgl-gray-light);
|
|
844
844
|
}
|
|
845
|
-
.infinite-wrapper[data-v-
|
|
845
|
+
.infinite-wrapper[data-v-2137a7a8] {
|
|
846
846
|
overflow-y: auto;
|
|
847
847
|
width: 100%;
|
|
848
848
|
}
|
|
@@ -1230,7 +1230,7 @@ fieldset[disabled] .multiselect {
|
|
|
1230
1230
|
padding-inline-start: 0rem;
|
|
1231
1231
|
}
|
|
1232
1232
|
.multiselect--active .multiselect__input {
|
|
1233
|
-
|
|
1233
|
+
margin-top: -0.6rem;
|
|
1234
1234
|
}
|
|
1235
1235
|
.multiselect__input::placeholder {
|
|
1236
1236
|
color: var(--input-color);
|
|
@@ -1676,77 +1676,77 @@ to {
|
|
|
1676
1676
|
/* width: auto; */
|
|
1677
1677
|
}
|
|
1678
1678
|
|
|
1679
|
-
.bagel-input textarea[data-v-
|
|
1679
|
+
.bagel-input textarea[data-v-e116816b] {
|
|
1680
1680
|
min-height: unset;
|
|
1681
1681
|
}
|
|
1682
|
-
.bagel-input.text-input textarea[data-v-
|
|
1682
|
+
.bagel-input.text-input textarea[data-v-e116816b] {
|
|
1683
1683
|
resize: none;
|
|
1684
1684
|
}
|
|
1685
|
-
.code textarea[data-v-
|
|
1685
|
+
.code textarea[data-v-e116816b] {
|
|
1686
1686
|
font-family: 'Inconsolata', monospace;
|
|
1687
1687
|
background: var(--bgl-black) !important;
|
|
1688
1688
|
color: var(--bgl-white) !important;
|
|
1689
1689
|
}
|
|
1690
|
-
.bagel-input.toggleEdit[data-v-
|
|
1690
|
+
.bagel-input.toggleEdit[data-v-e116816b]:hover {
|
|
1691
1691
|
background-color: var(--input-bg);
|
|
1692
1692
|
}
|
|
1693
|
-
.bagel-input.small[data-v-
|
|
1693
|
+
.bagel-input.small[data-v-e116816b] {
|
|
1694
1694
|
margin-bottom: 0;
|
|
1695
1695
|
height: 30px;
|
|
1696
1696
|
}
|
|
1697
|
-
.bagel-input.dense label[data-v-
|
|
1697
|
+
.bagel-input.dense label[data-v-e116816b] {
|
|
1698
1698
|
display: flex;
|
|
1699
1699
|
align-items: center;
|
|
1700
1700
|
gap: 0.5rem;
|
|
1701
1701
|
}
|
|
1702
|
-
.toggleEditBtn[data-v-
|
|
1702
|
+
.toggleEditBtn[data-v-e116816b] {
|
|
1703
1703
|
position: absolute;
|
|
1704
1704
|
right: -24px;
|
|
1705
1705
|
top: 4;
|
|
1706
1706
|
opacity: 0;
|
|
1707
1707
|
}
|
|
1708
|
-
.textInputIconWrap[data-v-
|
|
1708
|
+
.textInputIconWrap[data-v-e116816b] {
|
|
1709
1709
|
position: relative;
|
|
1710
1710
|
}
|
|
1711
|
-
.textInputIconWrap .bgl_icon-font[data-v-
|
|
1711
|
+
.textInputIconWrap .bgl_icon-font[data-v-e116816b] {
|
|
1712
1712
|
position: absolute;
|
|
1713
1713
|
inset-inline-end: 0.7rem;
|
|
1714
1714
|
bottom: 50%;
|
|
1715
1715
|
line-height: 0;
|
|
1716
1716
|
color: var(--bgl-gray);
|
|
1717
1717
|
}
|
|
1718
|
-
.txtInputIconStart .iconStart[data-v-
|
|
1718
|
+
.txtInputIconStart .iconStart[data-v-e116816b] {
|
|
1719
1719
|
position: absolute;
|
|
1720
1720
|
inset-inline-start: 0.7rem;
|
|
1721
1721
|
top: 50%;
|
|
1722
1722
|
line-height: 0;
|
|
1723
1723
|
color: var(--bgl-gray);
|
|
1724
1724
|
}
|
|
1725
|
-
.txtInputIconStart textarea[data-v-
|
|
1725
|
+
.txtInputIconStart textarea[data-v-e116816b] {
|
|
1726
1726
|
padding-inline-start: 2rem;
|
|
1727
1727
|
}
|
|
1728
|
-
.bagel-input:hover .toggleEditBtn[data-v-
|
|
1729
|
-
.bagel-input.editMode .toggleEditBtn[data-v-
|
|
1728
|
+
.bagel-input:hover .toggleEditBtn[data-v-e116816b],
|
|
1729
|
+
.bagel-input.editMode .toggleEditBtn[data-v-e116816b] {
|
|
1730
1730
|
opacity: 1;
|
|
1731
1731
|
}
|
|
1732
|
-
.bagel-input.small textarea[data-v-
|
|
1732
|
+
.bagel-input.small textarea[data-v-e116816b] {
|
|
1733
1733
|
height: 30px;
|
|
1734
1734
|
}
|
|
1735
1735
|
|
|
1736
|
-
.bagel-input[data-v-
|
|
1736
|
+
.bagel-input[data-v-64dc9f53] {
|
|
1737
1737
|
height: 100%;
|
|
1738
1738
|
margin: 0;
|
|
1739
1739
|
}
|
|
1740
|
-
.bagel-input label[data-v-
|
|
1740
|
+
.bagel-input label[data-v-64dc9f53] {
|
|
1741
1741
|
margin-bottom: 0;
|
|
1742
1742
|
}
|
|
1743
|
-
.bagel-input textarea[data-v-
|
|
1743
|
+
.bagel-input textarea[data-v-64dc9f53] {
|
|
1744
1744
|
height: 100%;
|
|
1745
1745
|
resize: none;
|
|
1746
1746
|
background: var(--input-bg);
|
|
1747
1747
|
margin-bottom: 0.5rem;
|
|
1748
1748
|
}
|
|
1749
|
-
.character-limit[data-v-
|
|
1749
|
+
.character-limit[data-v-64dc9f53] {
|
|
1750
1750
|
font-size: 0.6rem;
|
|
1751
1751
|
color: var(--input-color);
|
|
1752
1752
|
position: absolute;
|
package/package.json
CHANGED
package/src/components/Modal.vue
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="bg-dark"
|
|
4
|
+
:class="{ 'is-side': side, 'is-active': isActive, 'bg-lignt': false }"
|
|
5
|
+
@click="() => (dismissable ? closeModal() : '')"
|
|
6
|
+
@keydown.esc="closeModal"
|
|
7
|
+
>
|
|
8
|
+
<Card
|
|
9
|
+
class="modal"
|
|
10
|
+
@click.stop
|
|
11
|
+
>
|
|
5
12
|
<header class="tool-bar">
|
|
6
13
|
<slot name="toolbar" />
|
|
7
|
-
<Btn
|
|
8
|
-
|
|
14
|
+
<Btn
|
|
15
|
+
:style="{ float: side ? 'left' : 'right' }"
|
|
16
|
+
flat
|
|
17
|
+
icon="close"
|
|
18
|
+
@click="closeModal"
|
|
19
|
+
/>
|
|
20
|
+
<Title
|
|
21
|
+
class="modal-title"
|
|
22
|
+
tag="h3"
|
|
23
|
+
v-if="title"
|
|
24
|
+
:label="title"
|
|
25
|
+
/>
|
|
9
26
|
</header>
|
|
10
27
|
<slot />
|
|
11
28
|
<footer class="modal-footer mt-3">
|
|
12
|
-
<Btn
|
|
29
|
+
<Btn
|
|
30
|
+
v-for="(action, i) in actions"
|
|
31
|
+
:key="i"
|
|
32
|
+
@click="closeModal"
|
|
33
|
+
color="gray"
|
|
34
|
+
v-bind="action"
|
|
35
|
+
/>
|
|
13
36
|
<slot name="footer" />
|
|
14
37
|
</footer>
|
|
15
38
|
</Card>
|
|
@@ -1,24 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Modal
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<Modal
|
|
3
|
+
@onUpdate:isModalVisible="props['onUpdate:isModalVisible']"
|
|
4
|
+
:side="side"
|
|
5
|
+
ref="modal"
|
|
6
|
+
:dismissable="dismissable"
|
|
7
|
+
:title="title"
|
|
8
|
+
>
|
|
9
|
+
<BagelForm
|
|
10
|
+
ref="form"
|
|
11
|
+
v-model="formData"
|
|
12
|
+
:schema="computedFormSchema"
|
|
13
|
+
/>
|
|
14
|
+
<template
|
|
15
|
+
#footer
|
|
16
|
+
v-if="onDelete || onSubmit"
|
|
17
|
+
>
|
|
6
18
|
<div>
|
|
7
|
-
<Btn
|
|
8
|
-
|
|
19
|
+
<Btn
|
|
20
|
+
thin
|
|
21
|
+
flat
|
|
22
|
+
value="Cancel"
|
|
23
|
+
@click="closeModal"
|
|
24
|
+
/>
|
|
25
|
+
<Btn
|
|
26
|
+
thin
|
|
27
|
+
icon="delete"
|
|
28
|
+
v-if="onDelete"
|
|
29
|
+
flat
|
|
30
|
+
value="Delete"
|
|
31
|
+
@click="runDelete"
|
|
32
|
+
color="red"
|
|
33
|
+
/>
|
|
9
34
|
</div>
|
|
10
|
-
<Btn
|
|
35
|
+
<Btn
|
|
36
|
+
value="Submit"
|
|
37
|
+
@click="runSubmit"
|
|
38
|
+
/>
|
|
11
39
|
</template>
|
|
12
40
|
</Modal>
|
|
13
41
|
</template>
|
|
14
42
|
|
|
15
43
|
<script lang="ts" setup>
|
|
16
44
|
import {
|
|
17
|
-
Modal,
|
|
18
|
-
Btn,
|
|
19
|
-
BagelForm, type BglFormSchemaT, type BtnOptions,
|
|
45
|
+
Modal, Btn, BagelForm, type BglFormSchemaT, type BtnOptions, useBagel,
|
|
20
46
|
} from '@bagelink/vue';
|
|
21
47
|
|
|
48
|
+
const bagel = useBagel();
|
|
49
|
+
|
|
22
50
|
const props = defineProps<{
|
|
23
51
|
side?: boolean;
|
|
24
52
|
title?: string;
|
|
@@ -31,6 +59,11 @@ const props = defineProps<{
|
|
|
31
59
|
onDelete?: ((id: string) => void);
|
|
32
60
|
// eslint-disable-next-line no-unused-vars
|
|
33
61
|
'onUpdate:isModalVisible'?: ((visible: boolean) => void);
|
|
62
|
+
// eslint-disable-next-line no-unused-vars
|
|
63
|
+
onError?: ((err: any) => void);
|
|
64
|
+
|
|
65
|
+
modelValue?: Record<string, any>;
|
|
66
|
+
|
|
34
67
|
}>();
|
|
35
68
|
|
|
36
69
|
const modal = $ref<InstanceType<typeof Modal>>();
|
|
@@ -49,8 +82,9 @@ const runSubmit = async () => {
|
|
|
49
82
|
try {
|
|
50
83
|
await props.onSubmit?.(formData.value);
|
|
51
84
|
closeModal();
|
|
52
|
-
} catch (err) {
|
|
53
|
-
|
|
85
|
+
} catch (err: any) {
|
|
86
|
+
if (props.onError) props.onError(err);
|
|
87
|
+
else bagel?.onError?.(err);
|
|
54
88
|
}
|
|
55
89
|
};
|
|
56
90
|
|
|
@@ -58,6 +92,12 @@ const runDelete = () => {
|
|
|
58
92
|
props.onDelete?.(formData.value?.id);
|
|
59
93
|
closeModal();
|
|
60
94
|
};
|
|
95
|
+
|
|
96
|
+
function setFormValues(values: Record<string, any>) {
|
|
97
|
+
Object.assign(formData, values);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
defineExpose({ setFormValues });
|
|
61
101
|
</script>
|
|
62
102
|
|
|
63
103
|
<style scoped>
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
<div class="table-list-wrap h-100">
|
|
3
3
|
<table class="infinite-wrapper">
|
|
4
4
|
<thead class="row first-row">
|
|
5
|
-
<th
|
|
5
|
+
<th
|
|
6
|
+
class="col"
|
|
7
|
+
v-for="field in computedSchema"
|
|
8
|
+
:key="field.id" @click="sort(field?.id || '')"
|
|
9
|
+
>
|
|
6
10
|
<div class="flex">
|
|
7
11
|
{{ field.id }}
|
|
8
12
|
<div class="list-arrows" :class="{ sorted: sortField === field.id }">
|
|
@@ -12,7 +16,12 @@
|
|
|
12
16
|
</th>
|
|
13
17
|
</thead>
|
|
14
18
|
<tbody ref="infinite" class="rows infinite" :class="{ loading }">
|
|
15
|
-
<tr
|
|
19
|
+
<tr
|
|
20
|
+
v-for="row in data"
|
|
21
|
+
:key="row.id"
|
|
22
|
+
@click="selectElement(row)"
|
|
23
|
+
class="row row-item position-relative"
|
|
24
|
+
>
|
|
16
25
|
<td class="col" v-for="field in computedSchema" :key="`${field.id}-${row.id}`">
|
|
17
26
|
<slot v-if="field.id && slots[field.id]" :name="field.id" :row="row" :field="field" />
|
|
18
27
|
<div v-else>
|
|
@@ -22,7 +31,6 @@
|
|
|
22
31
|
</tr>
|
|
23
32
|
</tbody>
|
|
24
33
|
</table>
|
|
25
|
-
<!-- </Transition> -->
|
|
26
34
|
</div>
|
|
27
35
|
</template>
|
|
28
36
|
|
|
@@ -50,10 +50,10 @@ const props = withDefaults(
|
|
|
50
50
|
},
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
+
const instAt = new Date();
|
|
53
54
|
const timeSinceInst = () => new Date().getTime() - instAt.getTime();
|
|
54
55
|
|
|
55
56
|
const emit = defineEmits(['update:modelValue', 'submit', 'dirty']);
|
|
56
|
-
const instAt = new Date();
|
|
57
57
|
let isDirty = $ref(false);
|
|
58
58
|
const data = $computed({
|
|
59
59
|
set: (val: any) => {
|
|
@@ -11,10 +11,18 @@
|
|
|
11
11
|
label="label"
|
|
12
12
|
trackBy="value"
|
|
13
13
|
:options="optionList"
|
|
14
|
-
:required
|
|
15
|
-
:placeholder
|
|
14
|
+
:required
|
|
15
|
+
:placeholder
|
|
16
16
|
v-model="seletValue"
|
|
17
|
+
v-bind="extraProps"
|
|
17
18
|
/>
|
|
19
|
+
<input
|
|
20
|
+
v-model="seletValue"
|
|
21
|
+
type="hidden"
|
|
22
|
+
:name="id"
|
|
23
|
+
:required
|
|
24
|
+
v-bind="extraProps"
|
|
25
|
+
>
|
|
18
26
|
</label>
|
|
19
27
|
</div>
|
|
20
28
|
</template>
|
|
@@ -37,6 +45,7 @@ const props = defineProps<{
|
|
|
37
45
|
placeholder?: string,
|
|
38
46
|
defaultValue?: string | number,
|
|
39
47
|
options: RawOption[] | string
|
|
48
|
+
extraProps?: Record<string, any>
|
|
40
49
|
}>();
|
|
41
50
|
|
|
42
51
|
let dataValue = $ref<string | number | undefined>(props.modelValue || props.defaultValue);
|
|
@@ -194,7 +203,7 @@ fieldset[disabled] .multiselect {
|
|
|
194
203
|
}
|
|
195
204
|
|
|
196
205
|
.multiselect--active .multiselect__input {
|
|
197
|
-
|
|
206
|
+
margin-top: -0.6rem;
|
|
198
207
|
}
|
|
199
208
|
|
|
200
209
|
.multiselect__input::placeholder {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
@input="handleInput"
|
|
20
20
|
:class="{ 'no-edit': !editMode }"
|
|
21
21
|
v-bind="nativeInputAttrs"
|
|
22
|
+
:required
|
|
22
23
|
/>
|
|
23
24
|
</div>
|
|
24
25
|
</template>
|
|
@@ -38,6 +39,7 @@ withDefaults(
|
|
|
38
39
|
small?: boolean;
|
|
39
40
|
nativeInputAttrs?: Record<string, any>;
|
|
40
41
|
showCharacterLimit?: boolean;
|
|
42
|
+
required?: boolean;
|
|
41
43
|
}>(),
|
|
42
44
|
{
|
|
43
45
|
description: '',
|
|
@@ -1,23 +1,63 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
|
|
2
|
+
<div
|
|
3
|
+
class="bagel-input text-input"
|
|
4
|
+
:class="{
|
|
5
|
+
dense, small, shrink, toggleEdit, editMode, code,
|
|
6
|
+
textInputIconWrap: icon,
|
|
7
|
+
txtInputIconStart: iconStart,
|
|
8
|
+
}"
|
|
9
|
+
:title="title"
|
|
10
|
+
>
|
|
11
|
+
<label
|
|
12
|
+
:for="id"
|
|
13
|
+
>
|
|
6
14
|
{{ label }}
|
|
7
|
-
<input
|
|
8
|
-
v-
|
|
9
|
-
:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
<input
|
|
16
|
+
v-if="!multiline && !autoheight && !code"
|
|
17
|
+
:title="title"
|
|
18
|
+
:autocomplete="autocomplete"
|
|
19
|
+
:id="id"
|
|
20
|
+
v-model="inputVal"
|
|
21
|
+
:type="type"
|
|
22
|
+
:rows="1" ref="input"
|
|
23
|
+
:placeholder="placeholder || label"
|
|
24
|
+
:disabled="!editMode"
|
|
25
|
+
:required="required"
|
|
26
|
+
:pattern="pattern"
|
|
27
|
+
v-bind="nativeInputAttrs"
|
|
28
|
+
@dblclick="toggleEditAction"
|
|
29
|
+
>
|
|
30
|
+
<textarea
|
|
31
|
+
v-else
|
|
32
|
+
:title="title"
|
|
33
|
+
:id="id"
|
|
34
|
+
v-model="inputVal"
|
|
35
|
+
:type="type"
|
|
36
|
+
:rows="rows" ref="input"
|
|
37
|
+
:placeholder="placeholder || label"
|
|
38
|
+
:disabled="!editMode"
|
|
39
|
+
:required="required"
|
|
40
|
+
:pattern="pattern"
|
|
41
|
+
v-bind="nativeInputAttrs"
|
|
42
|
+
@dblclick="toggleEditAction"
|
|
43
|
+
/>
|
|
14
44
|
<p v-if="helptext">{{ helptext }}</p>
|
|
15
45
|
</label>
|
|
16
46
|
|
|
17
|
-
<MaterialIcon
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
47
|
+
<MaterialIcon
|
|
48
|
+
class="iconStart" v-if="iconStart"
|
|
49
|
+
:icon="iconStart"
|
|
50
|
+
/>
|
|
51
|
+
<MaterialIcon
|
|
52
|
+
v-if="icon"
|
|
53
|
+
:icon="icon"
|
|
54
|
+
/>
|
|
55
|
+
<Btn
|
|
56
|
+
class="toggleEditBtn" v-if="toggleEdit" thin @click="toggleEditAction"
|
|
57
|
+
:icon="editMode ? 'check'
|
|
58
|
+
: 'edit'"
|
|
59
|
+
flat
|
|
60
|
+
/>
|
|
21
61
|
</div>
|
|
22
62
|
</template>
|
|
23
63
|
|
package/src/plugins/modal.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { Plugin } from 'vue';
|
|
|
5
5
|
import type { BglFormSchemaT, BtnOptions } from '@bagelink/vue';
|
|
6
6
|
import { Modal, ModalForm } from '@bagelink/vue';
|
|
7
7
|
|
|
8
|
-
interface ModalOptions {
|
|
8
|
+
export interface ModalOptions {
|
|
9
9
|
title?: string;
|
|
10
10
|
dismissable?: boolean;
|
|
11
11
|
side?: boolean;
|
|
@@ -13,19 +13,31 @@ interface ModalOptions {
|
|
|
13
13
|
class?: string;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
interface ModalFormOptions {
|
|
16
|
+
export interface ModalFormOptions {
|
|
17
17
|
side?: boolean;
|
|
18
18
|
title?: string;
|
|
19
19
|
dismissable?: boolean;
|
|
20
20
|
schema: BglFormSchemaT<any> | (() => BglFormSchemaT);
|
|
21
|
-
modelValue?: Record<string, any>;
|
|
22
21
|
onSubmit?: (formData: any) => Promise<any>;
|
|
23
22
|
onDelete?: (id: string) => Promise<void>;
|
|
23
|
+
onError?: ((err: any) => void);
|
|
24
|
+
modelValue?: Record<string, any>;
|
|
25
|
+
'onUpdate:modelValue'?: (val: any) => void;
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
interface
|
|
28
|
+
export interface ModalComponentProps {
|
|
29
|
+
componentSlots: Record<string, any>,
|
|
30
|
+
modalType: 'modal' | 'modalForm',
|
|
31
|
+
modalOptions: ModalOptions | ModalFormOptions
|
|
32
|
+
}
|
|
33
|
+
export interface ModalFormComponentProps {
|
|
34
|
+
componentSlots: Record<string, any>,
|
|
35
|
+
modalType: 'modalForm',
|
|
36
|
+
modalOptions: ModalFormOptions
|
|
37
|
+
}
|
|
38
|
+
export interface ModalApi {
|
|
27
39
|
showModal: (options: ModalOptions, slots?: Record<string, any>) => void;
|
|
28
|
-
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) =>
|
|
40
|
+
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => ModalFormComponentProps | undefined;
|
|
29
41
|
hideModal: (index?: number) => void;
|
|
30
42
|
}
|
|
31
43
|
|
|
@@ -37,12 +49,6 @@ export const useModal = (): ModalApi => {
|
|
|
37
49
|
return modalApi;
|
|
38
50
|
};
|
|
39
51
|
|
|
40
|
-
interface ModalComponentProps {
|
|
41
|
-
componentSlots: Record<string, any>,
|
|
42
|
-
modalType: 'modal' | 'modalForm',
|
|
43
|
-
modalOptions: ModalOptions | ModalFormOptions
|
|
44
|
-
}
|
|
45
|
-
|
|
46
52
|
export const ModalPlugin: Plugin = {
|
|
47
53
|
install: (app) => {
|
|
48
54
|
const modalStack = $ref<ModalComponentProps[]>([]);
|
|
@@ -61,11 +67,13 @@ export const ModalPlugin: Plugin = {
|
|
|
61
67
|
modalType,
|
|
62
68
|
componentSlots: slots,
|
|
63
69
|
});
|
|
70
|
+
if (modalType === 'modalForm') return modalStack.at(-1) as ModalFormComponentProps | undefined;
|
|
71
|
+
return modalStack.at(-1);
|
|
64
72
|
};
|
|
65
73
|
|
|
66
74
|
app.provide(ModalSymbol, {
|
|
67
75
|
showModal: (options: ModalOptions, slots?: Record<string, any>) => showModal('modal', options, slots),
|
|
68
|
-
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => showModal('modalForm', options, slots),
|
|
76
|
+
showModalForm: (options: ModalFormOptions, slots?: Record<string, any>) => showModal('modalForm', options, slots) as ModalFormComponentProps,
|
|
69
77
|
hideModal: (index = modalStack.length - 1) => hideModal(index),
|
|
70
78
|
// modalOptions,
|
|
71
79
|
});
|