@bagelink/vue 0.0.258 → 0.0.262

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/style.css CHANGED
@@ -546,11 +546,11 @@
546
546
  }
547
547
  }
548
548
 
549
- .modal-title[data-v-753a1016] {
549
+ .modal-title[data-v-82698669] {
550
550
  margin-top: 0.5rem;
551
551
  }
552
552
  @media screen and (max-width: 910px) {
553
- .modal-title[data-v-753a1016] {
553
+ .modal-title[data-v-82698669] {
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-555ad739] {
744
+ .list-arrows[data-v-2137a7a8] {
745
745
  opacity: 0;
746
746
  }
747
- .list-arrows .bgl_icon-font[data-v-555ad739] {
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-555ad739] {
750
+ .list-arrows.sorted[data-v-2137a7a8] {
751
751
  opacity: 1;
752
752
  }
753
- .col img[data-v-555ad739] {
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-555ad739] {
759
+ .list-arrows.sorted .desc[data-v-2137a7a8] {
760
760
  transform: rotate(180deg);
761
761
  }
762
- table[data-v-555ad739] {
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-555ad739] {
767
+ th[data-v-2137a7a8] {
768
768
  font-weight: 400;
769
769
  }
770
- .row[data-v-555ad739] {
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-555ad739] {
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-555ad739]::after {
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-555ad739] {
792
+ .first-row .col[data-v-2137a7a8] {
793
793
  cursor: pointer;
794
794
  background: var(--bgl-white);
795
795
  }
796
- .col[data-v-555ad739] {
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-555ad739] {
805
+ .col>div[data-v-2137a7a8] {
806
806
  display: flex;
807
807
  gap: 0.5rem;
808
808
  }
809
- .max-col-width[data-v-555ad739] {
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-555ad739] {
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-555ad739] {
825
+ .rows[data-v-2137a7a8] {
826
826
  font-size: 0.8125em;
827
827
  }
828
- .table-list[data-v-555ad739] {
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-555ad739] {
835
+ .BagelTable .table-list[data-v-2137a7a8] {
836
836
  overflow: unset;
837
837
  }
838
- .row-item[data-v-555ad739] {
838
+ .row-item[data-v-2137a7a8] {
839
839
  height: 50px;
840
840
  transition: all 200ms ease;
841
841
  }
842
- .row-item[data-v-555ad739]:hover {
842
+ .row-item[data-v-2137a7a8]:hover {
843
843
  background: var(--bgl-gray-light);
844
844
  }
845
- .infinite-wrapper[data-v-555ad739] {
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
- margin-top: -0.5rem;
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-8c868409] {
1679
+ .bagel-input textarea[data-v-e116816b] {
1680
1680
  min-height: unset;
1681
1681
  }
1682
- .bagel-input.text-input textarea[data-v-8c868409] {
1682
+ .bagel-input.text-input textarea[data-v-e116816b] {
1683
1683
  resize: none;
1684
1684
  }
1685
- .code textarea[data-v-8c868409] {
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-8c868409]:hover {
1690
+ .bagel-input.toggleEdit[data-v-e116816b]:hover {
1691
1691
  background-color: var(--input-bg);
1692
1692
  }
1693
- .bagel-input.small[data-v-8c868409] {
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-8c868409] {
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-8c868409] {
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-8c868409] {
1708
+ .textInputIconWrap[data-v-e116816b] {
1709
1709
  position: relative;
1710
1710
  }
1711
- .textInputIconWrap .bgl_icon-font[data-v-8c868409] {
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-8c868409] {
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-8c868409] {
1725
+ .txtInputIconStart textarea[data-v-e116816b] {
1726
1726
  padding-inline-start: 2rem;
1727
1727
  }
1728
- .bagel-input:hover .toggleEditBtn[data-v-8c868409],
1729
- .bagel-input.editMode .toggleEditBtn[data-v-8c868409] {
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-8c868409] {
1732
+ .bagel-input.small textarea[data-v-e116816b] {
1733
1733
  height: 30px;
1734
1734
  }
1735
1735
 
1736
- .bagel-input[data-v-a5b28c58] {
1736
+ .bagel-input[data-v-64dc9f53] {
1737
1737
  height: 100%;
1738
1738
  margin: 0;
1739
1739
  }
1740
- .bagel-input label[data-v-a5b28c58] {
1740
+ .bagel-input label[data-v-64dc9f53] {
1741
1741
  margin-bottom: 0;
1742
1742
  }
1743
- .bagel-input textarea[data-v-a5b28c58] {
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-a5b28c58] {
1749
+ .character-limit[data-v-64dc9f53] {
1750
1750
  font-size: 0.6rem;
1751
1751
  color: var(--input-color);
1752
1752
  position: absolute;
@@ -1913,7 +1913,7 @@ to {
1913
1913
  color: var(--bgl-white);
1914
1914
  }
1915
1915
 
1916
- .bagel-input .fileUploadWrap[data-v-7deb423e] {
1916
+ .bagel-input .fileUploadWrap[data-v-1be8d7b1] {
1917
1917
  outline: 1px solid var(--border-color);
1918
1918
  border-radius: var(--input-border-radius);
1919
1919
  text-align: center;
@@ -1923,7 +1923,7 @@ to {
1923
1923
  height: 132px;
1924
1924
  font-size: var(--input-font-size);
1925
1925
  }
1926
- .previewName[data-v-7deb423e] {
1926
+ .previewName[data-v-1be8d7b1] {
1927
1927
  padding: 0.5rem;
1928
1928
  text-align: start;
1929
1929
  color: var(--input-color);
@@ -1931,37 +1931,37 @@ to {
1931
1931
  grid-template-columns: 1fr 22px;
1932
1932
  align-items: center;
1933
1933
  }
1934
- .previewName p[data-v-7deb423e] {
1934
+ .previewName p[data-v-1be8d7b1] {
1935
1935
  overflow: hidden;
1936
1936
  text-overflow: ellipsis;
1937
1937
  white-space: nowrap;
1938
1938
  }
1939
- .imagePreviewWrap[data-v-7deb423e] {
1939
+ .imagePreviewWrap[data-v-1be8d7b1] {
1940
1940
  background: var(--input-bg);
1941
1941
  border-radius: var(--input-border-radius);
1942
1942
  height: 90px;
1943
1943
  padding: 5px;
1944
1944
  }
1945
- img.preview[data-v-7deb423e] {
1945
+ img.preview[data-v-1be8d7b1] {
1946
1946
  height: 80px;
1947
1947
  border-radius: var(--input-border-radius);
1948
1948
  object-fit: contain;
1949
1949
  }
1950
- .fileUploadWrap.dragover[data-v-7deb423e],
1951
- .fileUploadWrap[data-v-7deb423e]:hover {
1950
+ .fileUploadWrap.dragover[data-v-1be8d7b1],
1951
+ .fileUploadWrap[data-v-1be8d7b1]:hover {
1952
1952
  box-shadow: inset 0 0 10px #00000012;
1953
1953
  }
1954
- .bagel-input .fileUploadWrap.fileDropZone[data-v-7deb423e] {
1954
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-1be8d7b1] {
1955
1955
  background: var(--input-bg);
1956
1956
  display: flex;
1957
1957
  align-items: center;
1958
1958
  justify-content: center;
1959
1959
  color: var(--bgl-gray);
1960
1960
  }
1961
- .bagel-input .fileUploadWrap.fileDropZone[data-v-7deb423e]:after {
1961
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-1be8d7b1]:after {
1962
1962
  content: "Drop files here or click to upload";
1963
1963
  }
1964
- .pie[data-v-7deb423e] {
1964
+ .pie[data-v-1be8d7b1] {
1965
1965
  width: 30px;
1966
1966
  height: 30px;
1967
1967
  position: relative;
@@ -1969,7 +1969,7 @@ img.preview[data-v-7deb423e] {
1969
1969
  align-items: center;
1970
1970
  justify-content: center;
1971
1971
  }
1972
- .pie[data-v-7deb423e]:before {
1972
+ .pie[data-v-1be8d7b1]:before {
1973
1973
  content: "";
1974
1974
  position: absolute;
1975
1975
  border-radius: 50%;
@@ -1983,26 +1983,26 @@ img.preview[data-v-7deb423e] {
1983
1983
  #0000 calc(99% - var(--b)),
1984
1984
  #000 calc(100% - var(--b)));
1985
1985
  }
1986
- .pie .success[data-v-7deb423e] {
1986
+ .pie .success[data-v-1be8d7b1] {
1987
1987
  transform: scale(0);
1988
1988
  opacity: 0;
1989
1989
  transition: all 0.3s ease-in-out;
1990
1990
  }
1991
- .pie .progress[data-v-7deb423e] {
1991
+ .pie .progress[data-v-1be8d7b1] {
1992
1992
  position: absolute;
1993
1993
  font-size: 10px;
1994
1994
  }
1995
- .pie.complete .progress[data-v-7deb423e] {
1995
+ .pie.complete .progress[data-v-1be8d7b1] {
1996
1996
  display: none;
1997
1997
  }
1998
- .pie.complete .success[data-v-7deb423e] {
1998
+ .pie.complete .success[data-v-1be8d7b1] {
1999
1999
  transform: scale(1.3);
2000
2000
  opacity: 1;
2001
2001
  }
2002
- .pie.complete[data-v-7deb423e]:before {
2002
+ .pie.complete[data-v-1be8d7b1]:before {
2003
2003
  background: conic-gradient(var(--bgl-green) calc(var(--p) * 1%), #0000 0);
2004
2004
  }
2005
- .pie.complete[data-v-7deb423e] {
2005
+ .pie.complete[data-v-1be8d7b1] {
2006
2006
  color: var(--bgl-green);
2007
2007
  }
2008
2008
 
@@ -1,5 +1,5 @@
1
1
  export type StorageFile = {
2
- organization: string[];
2
+ organization?: string[];
3
3
  name: string;
4
4
  url: string;
5
5
  mimetype?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/types/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CAC5B,CAAA"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/types/file.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;CAC5B,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.258",
4
+ "version": "0.0.262",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,15 +1,38 @@
1
1
  <template>
2
- <div class="bg-dark" :class="{ 'is-side': side, 'is-active': isActive, 'bg-lignt': false }"
3
- @click="() => (dismissable ? closeModal() : '')" @keydown.esc="closeModal">
4
- <Card class="modal" @click.stop>
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 :style="{ float: side ? 'left' : 'right' }" flat icon="close" @click="closeModal" />
8
- <Title class="modal-title" tag="h3" v-if="title" :label="title" />
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 v-for="(action, i) in actions" :key="i" @click="closeModal" color="gray" v-bind="action" />
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 @onUpdate:isModalVisible="props['onUpdate:isModalVisible']" :side="side" ref="modal" :dismissable="dismissable"
3
- :title="title">
4
- <BagelForm ref="form" v-model="formData" :schema="computedFormSchema" />
5
- <template #footer v-if="onDelete || onSubmit">
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 thin flat value="Cancel" @click="closeModal()" />
8
- <Btn thin icon="delete" v-if="onDelete" flat value="Delete" @click="runDelete()" color="red" />
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 value="Submit" @click="runSubmit()" />
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,8 @@ 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);
34
64
  }>();
35
65
 
36
66
  const modal = $ref<InstanceType<typeof Modal>>();
@@ -49,8 +79,9 @@ const runSubmit = async () => {
49
79
  try {
50
80
  await props.onSubmit?.(formData.value);
51
81
  closeModal();
52
- } catch (err) {
53
- console.error(err);
82
+ } catch (err: any) {
83
+ if (props.onError) props.onError(err);
84
+ else bagel?.onError?.(err);
54
85
  }
55
86
  };
56
87
 
@@ -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 class="col" v-for="field in computedSchema" :key="field.id" @click="sort(field?.id || '')">
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 v-for="row in data" :key="row.id" @click="selectElement(row)" class="row row-item position-relative">
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
 
@@ -109,7 +109,12 @@ type QueueFile = {
109
109
  uploaded?: boolean;
110
110
  };
111
111
 
112
- const props = defineProps<{ label: string, multiple?: boolean, files?: StorageFile | StorageFile[], }>();
112
+ const props = defineProps<{
113
+ label: string,
114
+ multiple?: boolean,
115
+ files?: StorageFile | StorageFile[],
116
+ deleteEndpoint?: string;
117
+ }>();
113
118
 
114
119
  const file_ids = defineModel<string[] | string>('modelValue');
115
120
  const storageFiles = $ref<StorageFile[]>([]);
@@ -139,16 +144,21 @@ const fileToUrl = (file: File) => URL.createObjectURL(file);
139
144
  const removeFile = (file: StorageFile) => {
140
145
  const index = storageFiles.indexOf(file);
141
146
  storageFiles.splice(index, 1);
147
+
148
+ if (props.deleteEndpoint) void bagel.delete(`${props.deleteEndpoint}/${file.id}`);
142
149
  };
150
+
143
151
  const flushQueue = () => {
144
- fileQueue.forEach(async (file, i) => {
145
- if (!props.multiple) storageFiles.splice(0, 1);
146
- const serverFile = await bagel.uploadFile(file.file, {
147
- onUploadProgress: (e: any) => (file.progress = e.progress * 100 - 1),
148
- });
149
- storageFiles.push(serverFile);
150
- fileQueue.splice(i, 1);
151
- });
152
+ fileQueue.forEach(
153
+ async (file, i) => {
154
+ if (!props.multiple) storageFiles.splice(0, 1);
155
+ const serverFile = await bagel.uploadFile<StorageFile>(file.file, {
156
+ onUploadProgress: (e: any) => (file.progress = e.progress * 100 - 1),
157
+ });
158
+ storageFiles.push(serverFile);
159
+ fileQueue.splice(i, 1);
160
+ },
161
+ );
152
162
  };
153
163
 
154
164
  const browse = () => {
@@ -180,7 +190,13 @@ const dragover = (e: DragEvent) => {
180
190
  const drop = (e: DragEvent) => {
181
191
  preventDefault(e);
182
192
  if (e.dataTransfer) {
183
- Array.from(e.dataTransfer.files).forEach((file: File) => fileQueue.push({ name: file.name, file, progress: 0 }));
193
+ Array
194
+ .from(e.dataTransfer.files)
195
+ .forEach(
196
+ (file: File) => (
197
+ fileQueue.push({ name: file.name, file, progress: 0 })
198
+ ),
199
+ );
184
200
  }
185
201
  isDragOver = false;
186
202
  flushQueue();
@@ -1,11 +1,28 @@
1
1
  <template>
2
2
  <div class="pb-1">
3
- <label class="txt-start" :for="id">
3
+ <label
4
+ class="txt-start"
5
+ :for="id"
6
+ >
4
7
  {{ label }}
5
8
  <Multiselect
6
- ref="multiselect" :id="id" label="label" trackBy="value" :options="optionList" :required="required"
7
- :placeholder="placeholder" v-model="seletValue"
9
+ ref="multiselect"
10
+ :id="id"
11
+ label="label"
12
+ trackBy="value"
13
+ :options="optionList"
14
+ :required
15
+ :placeholder
16
+ v-model="seletValue"
17
+ v-bind="extraProps"
8
18
  />
19
+ <input
20
+ v-model="seletValue"
21
+ type="hidden"
22
+ :name="id"
23
+ :required
24
+ v-bind="extraProps"
25
+ >
9
26
  </label>
10
27
  </div>
11
28
  </template>
@@ -28,6 +45,7 @@ const props = defineProps<{
28
45
  placeholder?: string,
29
46
  defaultValue?: string | number,
30
47
  options: RawOption[] | string
48
+ extraProps?: Record<string, any>
31
49
  }>();
32
50
 
33
51
  let dataValue = $ref<string | number | undefined>(props.modelValue || props.defaultValue);
@@ -183,8 +201,9 @@ fieldset[disabled] .multiselect {
183
201
  font-size: var(--input-font-size);
184
202
  padding-inline-start: 0rem;
185
203
  }
204
+
186
205
  .multiselect--active .multiselect__input {
187
- margin-top: -0.5rem;
206
+ margin-top: -0.6rem;
188
207
  }
189
208
 
190
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: '',