@bagelink/vue 1.2.93 → 1.2.99

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
@@ -2549,7 +2549,7 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2549
2549
  .bgl-toggle input:checked + label[data-v-c5e45931] {
2550
2550
  color: var(--bgl-primary) !important;
2551
2551
  }
2552
- .fileUploadWrap[data-v-d8f3ff01] {
2552
+ .fileUploadWrap[data-v-38a4d4a9] {
2553
2553
  outline: 1px solid var(--border-color);
2554
2554
  border-radius: var(--input-border-radius);
2555
2555
  text-align: center;
@@ -2561,7 +2561,7 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2561
2561
  background: var(--input-bg);
2562
2562
  height: 215px;
2563
2563
  }
2564
- .bagel-input .fileUploadWrap.fileDropZone[data-v-d8f3ff01] {
2564
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-38a4d4a9] {
2565
2565
  background: var(--input-bg);
2566
2566
  display: flex;
2567
2567
  align-items: center;
@@ -2569,14 +2569,14 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2569
2569
  color: var(--bgl-gray);
2570
2570
  flex-direction: column;
2571
2571
  }
2572
- .fileUploadWrap.dragover[data-v-d8f3ff01],
2573
- .fileUploadWrap[data-v-d8f3ff01]:hover {
2572
+ .fileUploadWrap.dragover[data-v-38a4d4a9],
2573
+ .fileUploadWrap[data-v-38a4d4a9]:hover {
2574
2574
  box-shadow: inset 0 0 10px #00000012;
2575
2575
  }
2576
- .fileUploadWrap[style*='height: auto;'][data-v-d8f3ff01] {
2576
+ .fileUploadWrap[style*='height: auto;'][data-v-38a4d4a9] {
2577
2577
  min-height: 215px;
2578
2578
  }
2579
- .multi-image-item-preview[data-v-d8f3ff01] {
2579
+ .multi-image-item-preview[data-v-38a4d4a9] {
2580
2580
  border: 1px solid var(--border-color) !important;
2581
2581
  border-radius: var(--input-border-radius);
2582
2582
  margin: 0.5rem !important;
@@ -2590,12 +2590,12 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2590
2590
  gap: 1rem;
2591
2591
  align-items: center;
2592
2592
  }
2593
- .multi-image-item-preview p[data-v-d8f3ff01] {
2593
+ .multi-image-item-preview p[data-v-38a4d4a9] {
2594
2594
  overflow: hidden;
2595
2595
  text-overflow: ellipsis;
2596
2596
  white-space: nowrap;
2597
2597
  }
2598
- .multi-preview[data-v-d8f3ff01] {
2598
+ .multi-preview[data-v-38a4d4a9] {
2599
2599
  width: 40px;
2600
2600
  height: 40px;
2601
2601
  border-radius: var(--input-border-radius);
@@ -2606,17 +2606,17 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2606
2606
  align-items: center;
2607
2607
  display: flex;
2608
2608
  }
2609
- .bgl-single-preview[data-v-d8f3ff01] {
2609
+ .bgl-single-preview[data-v-38a4d4a9] {
2610
2610
  height: 100%;
2611
2611
  position: relative;
2612
2612
  }
2613
- .bgl-single-preview + .fileUploadPlaceHolder[data-v-d8f3ff01] {
2613
+ .bgl-single-preview + .fileUploadPlaceHolder[data-v-38a4d4a9] {
2614
2614
  position: absolute;
2615
2615
  inset: 0;
2616
2616
  margin: auto;
2617
2617
  top: calc(50% - 2rem);
2618
2618
  }
2619
- .single-image-item-preview[data-v-d8f3ff01] {
2619
+ .single-image-item-preview[data-v-38a4d4a9] {
2620
2620
  height: 100%;
2621
2621
  min-height: 100%;
2622
2622
  position: relative;
@@ -2624,13 +2624,13 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2624
2624
  align-items: center;
2625
2625
  justify-content: center;
2626
2626
  }
2627
- .fileUploadWrap[style*='height: auto'] .single-image-item-preview[data-v-d8f3ff01] {
2627
+ .fileUploadWrap[style*='height: auto'] .single-image-item-preview[data-v-38a4d4a9] {
2628
2628
  min-height: 215px;
2629
2629
  }
2630
- .fileUploadWrap[style*='height: auto'] .single-preview[data-v-d8f3ff01] {
2630
+ .fileUploadWrap[style*='height: auto'] .single-preview[data-v-38a4d4a9] {
2631
2631
  margin: 0rem !important;
2632
2632
  }
2633
- .single-preview[data-v-d8f3ff01] {
2633
+ .single-preview[data-v-38a4d4a9] {
2634
2634
  border-radius: var(--input-border-radius);
2635
2635
  margin: 1rem;
2636
2636
  padding: 0px;
@@ -2640,7 +2640,7 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2640
2640
  background: var(--bgl-gray-light);
2641
2641
  width: 90%;
2642
2642
  }
2643
- .single-image-item-preview[data-v-d8f3ff01]:hover::after {
2643
+ .single-image-item-preview[data-v-38a4d4a9]:hover::after {
2644
2644
  content: 'zoom_in';
2645
2645
  font-size: 32px;
2646
2646
  font-family: 'Material Symbols Outlined', serif;
@@ -2650,20 +2650,20 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2650
2650
  z-index: 9;
2651
2651
  pointer-events: none;
2652
2652
  }
2653
- .single-image-item-preview:hover img[data-v-d8f3ff01] {
2653
+ .single-image-item-preview:hover img[data-v-38a4d4a9] {
2654
2654
  filter: brightness(70%);
2655
2655
  }
2656
- .bgl_fill-image.single-image-item-preview[data-v-d8f3ff01] {
2656
+ .bgl_fill-image.single-image-item-preview[data-v-38a4d4a9] {
2657
2657
  height: 100%;
2658
2658
  }
2659
- .bgl_fill-image.single-image-item-preview .single-preview[data-v-d8f3ff01] {
2659
+ .bgl_fill-image.single-image-item-preview .single-preview[data-v-38a4d4a9] {
2660
2660
  border-radius: unset;
2661
2661
  object-fit: cover;
2662
2662
  box-shadow: unset;
2663
2663
  width: 100%;
2664
2664
  height: auto;
2665
2665
  }
2666
- .single-image-item-preview .pie[data-v-d8f3ff01] {
2666
+ .single-image-item-preview .pie[data-v-38a4d4a9] {
2667
2667
  transform-origin: top;
2668
2668
  transform: scale(1.4);
2669
2669
  position: absolute;
@@ -2677,31 +2677,31 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2677
2677
  border: none !important;
2678
2678
  padding: 0 !important;
2679
2679
  }
2680
- .bgl_oval-upload[data-v-d8f3ff01] {
2680
+ .bgl_oval-upload[data-v-38a4d4a9] {
2681
2681
  border-radius: 100% !important;
2682
2682
  overflow: hidden;
2683
2683
  }
2684
- .bgl_oval-upload p[data-v-d8f3ff01] {
2684
+ .bgl_oval-upload p[data-v-38a4d4a9] {
2685
2685
  padding: 0.75rem !important;
2686
2686
  font-size: 12px;
2687
2687
  }
2688
- .bgl_oval-upload .fileUploadPlaceHolder[data-v-d8f3ff01] {
2688
+ .bgl_oval-upload .fileUploadPlaceHolder[data-v-38a4d4a9] {
2689
2689
  top: 0;
2690
2690
  }
2691
- .bgl_oval-upload .pie[data-v-d8f3ff01] {
2691
+ .bgl_oval-upload .pie[data-v-38a4d4a9] {
2692
2692
  transform: scale(1);
2693
2693
  }
2694
- .bgl_oval-upload span.bgl_icon-font.color-primary[data-v-d8f3ff01] {
2694
+ .bgl_oval-upload span.bgl_icon-font.color-primary[data-v-38a4d4a9] {
2695
2695
  transform: scale(0.4) !important;
2696
2696
  }
2697
- .bgl_oval-upload .single-image-item-preview[data-v-d8f3ff01] {
2697
+ .bgl_oval-upload .single-image-item-preview[data-v-38a4d4a9] {
2698
2698
  height: 100%;
2699
2699
  }
2700
- .bgl_oval-upload .single-preview[data-v-d8f3ff01] {
2700
+ .bgl_oval-upload .single-preview[data-v-38a4d4a9] {
2701
2701
  margin: 0;
2702
2702
  height: 100% !important;
2703
2703
  }
2704
- .pie[data-v-d8f3ff01] {
2704
+ .pie[data-v-38a4d4a9] {
2705
2705
  width: 30px;
2706
2706
  height: 30px;
2707
2707
  position: relative;
@@ -2709,7 +2709,7 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2709
2709
  align-items: center;
2710
2710
  justify-content: center;
2711
2711
  }
2712
- .pie[data-v-d8f3ff01]:before {
2712
+ .pie[data-v-38a4d4a9]:before {
2713
2713
  content: '';
2714
2714
  position: absolute;
2715
2715
  border-radius: 50%;
@@ -2727,26 +2727,26 @@ input[type="range"][data-v-46e22f3e]:active::-webkit-slider-thumb {
2727
2727
  #000 calc(100% - var(--b))
2728
2728
  );
2729
2729
  }
2730
- .pie .success[data-v-d8f3ff01] {
2730
+ .pie .success[data-v-38a4d4a9] {
2731
2731
  transform: scale(0);
2732
2732
  opacity: 0;
2733
2733
  transition: all 0.3s ease-in-out;
2734
2734
  }
2735
- .pie .progress[data-v-d8f3ff01] {
2735
+ .pie .progress[data-v-38a4d4a9] {
2736
2736
  position: absolute;
2737
2737
  font-size: 10px;
2738
2738
  }
2739
- .pie.complete .progress[data-v-d8f3ff01] {
2739
+ .pie.complete .progress[data-v-38a4d4a9] {
2740
2740
  display: none;
2741
2741
  }
2742
- .pie.complete .success[data-v-d8f3ff01] {
2742
+ .pie.complete .success[data-v-38a4d4a9] {
2743
2743
  transform: scale(1.3);
2744
2744
  opacity: 1;
2745
2745
  }
2746
- .pie.complete[data-v-d8f3ff01]:before {
2746
+ .pie.complete[data-v-38a4d4a9]:before {
2747
2747
  background: conic-gradient(var(--bgl-green) calc(var(--p) * 1%), #0000 0);
2748
2748
  }
2749
- .pie.complete[data-v-d8f3ff01] {
2749
+ .pie.complete[data-v-38a4d4a9] {
2750
2750
  color: var(--bgl-green);
2751
2751
  }
2752
2752
 
@@ -4389,25 +4389,25 @@ body:has(.bg-dark.is-active) {
4389
4389
  padding: 0 4px;
4390
4390
  }
4391
4391
 
4392
- .bgl_pill-btn[data-v-764b6b8b]{
4392
+ .bgl_pill-btn[data-v-ae730ec5]{
4393
4393
  color: var(--pill-btn-color);
4394
4394
  background: var(--pill-btn-bg);
4395
4395
  width: calc(var(--pill-height) / 1.25)!important;
4396
4396
  height: calc(var(--pill-height) / 1.25)!important;
4397
4397
  }
4398
- .loading[data-v-764b6b8b] {
4398
+ .loading[data-v-ae730ec5] {
4399
4399
  border: 1px solid var(--bgl-light-text);
4400
4400
  border-bottom: 2px solid var(--bgl-light-text);
4401
- animation: spin-764b6b8b 1s linear infinite;
4401
+ animation: spin-ae730ec5 1s linear infinite;
4402
4402
  border-radius: 100px;
4403
4403
  width: 1rem;
4404
4404
  height: 1rem;
4405
4405
  margin: auto;
4406
4406
  }
4407
- .bgl_flatPill .loading[data-v-764b6b8b] {
4407
+ .bgl_flatPill .loading[data-v-ae730ec5] {
4408
4408
  border-bottom: 2px solid var(--bgl-text-color);
4409
4409
  }
4410
- @keyframes spin-764b6b8b {
4410
+ @keyframes spin-ae730ec5 {
4411
4411
  0% {
4412
4412
  transform: rotate(0deg);
4413
4413
  }
@@ -4415,11 +4415,11 @@ body:has(.bg-dark.is-active) {
4415
4415
  transform: rotate(360deg);
4416
4416
  }
4417
4417
  }
4418
- .bgl_pill[data-v-764b6b8b] {
4418
+ .bgl_pill[data-v-ae730ec5] {
4419
4419
  padding-inline: 0.25rem;
4420
4420
  transition: var(--bgl-transition);
4421
- background-color: var(--dbb738e2);
4422
- color: var(--418961aa);
4421
+ background-color: var(--09d70b6a);
4422
+ color: var(--69df9534);
4423
4423
  display: inline-block;
4424
4424
  margin-inline-end: 0.25rem;
4425
4425
  border-radius: var(--pill-border-radius);
@@ -4427,26 +4427,26 @@ body:has(.bg-dark.is-active) {
4427
4427
  vertical-align: middle;
4428
4428
  margin-bottom: 0.25rem;
4429
4429
  }
4430
- .bgl_pill[disabled="true"][data-v-764b6b8b] {
4430
+ .bgl_pill[disabled="true"][data-v-ae730ec5] {
4431
4431
  opacity: 0.5;
4432
4432
  cursor: not-allowed;
4433
4433
  }
4434
- .bgl_pill-flex[data-v-764b6b8b] {
4434
+ .bgl_pill-flex[data-v-ae730ec5] {
4435
4435
  display: flex;
4436
4436
  align-items: center;
4437
4437
  gap: 0.25rem;
4438
4438
  justify-content: center;
4439
4439
  height: 100%;
4440
4440
  }
4441
- .bgl_pill.bgl_flatPill[data-v-764b6b8b] {
4441
+ .bgl_pill.bgl_flatPill[data-v-ae730ec5] {
4442
4442
  background: transparent;
4443
4443
  }
4444
- .bgl_pill.round[data-v-764b6b8b] {
4444
+ .bgl_pill.round[data-v-ae730ec5] {
4445
4445
  border-radius: 1000px;
4446
4446
  }
4447
- .bgl_pill-border[data-v-764b6b8b] {
4448
- outline: 1px solid var(--dbb738e2);
4449
- color: var(--dbb738e2);
4447
+ .bgl_pill-border[data-v-ae730ec5] {
4448
+ outline: 1px solid var(--09d70b6a);
4449
+ color: var(--09d70b6a);
4450
4450
  background: transparent;
4451
4451
  }
4452
4452
 
@@ -4641,22 +4641,22 @@ td[data-v-857ccb8b]:has(:checked){
4641
4641
  -moz-user-drag: none;
4642
4642
  }
4643
4643
 
4644
- .bgl-lightbox[data-v-fb2d5763]:has(.bgl_vid) {
4644
+ .bgl-lightbox[data-v-4789af69]:has(.bgl_vid) {
4645
4645
  width: 90vw;
4646
4646
  }
4647
- .lightbox-image[data-v-fb2d5763]{
4647
+ .lightbox-image[data-v-4789af69]{
4648
4648
  object-fit: contain;
4649
4649
  }
4650
- .bgl-lightbox-overlay[data-v-fb2d5763] {
4650
+ .bgl-lightbox-overlay[data-v-4789af69] {
4651
4651
  background: rgba(0, 0, 0, 0.8);
4652
4652
  }
4653
- .bgl-lightbox[data-v-fb2d5763] {
4653
+ .bgl-lightbox[data-v-4789af69] {
4654
4654
  max-height: 90%;
4655
4655
  }
4656
- .bgl-lightbox-item[data-v-fb2d5763]{
4657
- animation: 500ms ease bgl-lightbox-load-fb2d5763;
4656
+ .bgl-lightbox-item[data-v-4789af69]{
4657
+ animation: 500ms ease bgl-lightbox-load-4789af69;
4658
4658
  }
4659
- @keyframes bgl-lightbox-load-fb2d5763 {
4659
+ @keyframes bgl-lightbox-load-4789af69 {
4660
4660
  from {
4661
4661
  scale:0.7;
4662
4662
  }
@@ -4664,44 +4664,44 @@ to {
4664
4664
  scale:1;
4665
4665
  }
4666
4666
  }
4667
- .bgl-lightbox-item[data-v-fb2d5763] * {
4667
+ .bgl-lightbox-item[data-v-4789af69] * {
4668
4668
  max-height: calc(80vh - 90px);
4669
4669
  border-radius: 3px;
4670
4670
  margin: auto;
4671
- animation: 200ms ease bgl-lightbox-load-fb2d5763;
4671
+ animation: 200ms ease bgl-lightbox-load-4789af69;
4672
4672
  transition: max-height 200ms ease;
4673
4673
  }
4674
- .bgl-lightbox-item.zoomed[data-v-fb2d5763] * {
4674
+ .bgl-lightbox-item.zoomed[data-v-4789af69] * {
4675
4675
  max-height: calc(100vh - 90px);
4676
4676
  height: calc(100vh - 90px);
4677
4677
  }
4678
- .navigation[data-v-fb2d5763] {
4678
+ .navigation[data-v-4789af69] {
4679
4679
  top: 50%;
4680
4680
  transform: translateY(-50%);
4681
4681
  }
4682
- .thumbnail[data-v-fb2d5763] {
4682
+ .thumbnail[data-v-4789af69] {
4683
4683
  height: 50px;
4684
4684
  width: 50px;
4685
4685
  }
4686
- .thumbnail[data-v-fb2d5763]:hover {
4686
+ .thumbnail[data-v-4789af69]:hover {
4687
4687
  opacity: 1;
4688
4688
  }
4689
- .thumbnail[data-v-fb2d5763]:active {
4689
+ .thumbnail[data-v-4789af69]:active {
4690
4690
  opacity: 0.8;
4691
4691
  }
4692
- .thumbnail.active[data-v-fb2d5763] {
4692
+ .thumbnail.active[data-v-4789af69] {
4693
4693
  opacity: 1;
4694
4694
  outline: 2px solid white;
4695
4695
  }
4696
- .file-info[data-v-fb2d5763]{
4696
+ .file-info[data-v-4789af69]{
4697
4697
  max-width: 420px
4698
4698
  }
4699
4699
  @media screen and (max-width: 910px) {
4700
- .file-info[data-v-fb2d5763]{
4700
+ .file-info[data-v-4789af69]{
4701
4701
  max-width: 220px;
4702
4702
  text-align: center !important;
4703
4703
  }
4704
- .file-info[data-v-fb2d5763] *{
4704
+ .file-info[data-v-4789af69] *{
4705
4705
  text-align: center !important;
4706
4706
  margin-inline: 0 !important;
4707
4707
  max-width: 100% !important;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.2.93",
4
+ "version": "1.2.99",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -100,7 +100,7 @@ const computedBackgroundColor = $computed(
100
100
  <div v-if="loading" class="loading" />
101
101
  <div v-else>
102
102
  <div v-if="btnEnd" class="flex h-100">
103
- <Btn class="bgl_pill-btn" round thin v-bind="btnEnd" />
103
+ <Btn class="bgl_pill-btn" round thin flat v-bind="btnEnd" />
104
104
  </div>
105
105
  </div>
106
106
  </div>
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
- import type { BglFile, QueueFile, UploadInputProps } from './upload.types'
3
- import { Btn, IMAGE_FORMATS_REGEXP, Icon, useBagel, Card, Image, pathKeyToURL, bagelInjectionKey } from '@bagelink/vue'
4
- import { watch } from 'vue'
5
- import { files } from './upload'
2
+ import type { UploadInputProps } from './upload.types'
3
+ import { Btn, IMAGE_FORMATS_REGEXP, Icon, Card, Image, pathKeyToURL } from '@bagelink/vue'
4
+ import { useFileUpload } from './useFileUpload'
6
5
 
7
6
  const props = withDefaults(defineProps<UploadInputProps>(), {
8
7
  height: '215px',
@@ -11,122 +10,48 @@ const props = withDefaults(defineProps<UploadInputProps>(), {
11
10
  })
12
11
 
13
12
  const emit = defineEmits(['update:modelValue', 'addFileStart'])
14
- const bagel = useBagel(bagelInjectionKey)
15
13
 
16
- files.setBaseUrl(bagel.host)
17
-
18
- const fileQueue = $ref<QueueFile[]>([])
19
- let storageFiles = $ref<BglFile[]>([])
20
- const pk = $ref<string[]>([props.modelValue].flat().filter(Boolean) as string[])
21
-
22
- const pathKeys = $computed<string[]>(() => {
23
- const sf = storageFiles.map(file => file.path_key)
24
- return [...pk, ...sf]
14
+ const {
15
+ fileQueue,
16
+ pathKeys,
17
+ removeFile,
18
+ flushQueue,
19
+ fileToUrl,
20
+ addFile,
21
+ browse,
22
+ } = useFileUpload({
23
+ disabled: props.disabled,
24
+ dirPath: props.dirPath,
25
+ multiple: props.multiple,
26
+ accept: props.accept
25
27
  })
26
28
 
27
- watch(() => pk, (value) => {
28
- if (props.multiple) emit('update:modelValue', value)
29
- else emit('update:modelValue', value[0] || undefined)
30
- }, { deep: true })
31
-
32
29
  const isImage = (str: string) => IMAGE_FORMATS_REGEXP.test(str)
33
- const fileToUrl = (file: File) => URL.createObjectURL(file)
34
30
 
35
31
  let isDragOver = $ref(false)
36
32
 
37
- // File handling methods
38
- async function removeFile(path_key: string) {
39
- storageFiles = storageFiles.filter(file => file.path_key !== path_key)
40
- const pki = pk.indexOf(path_key)
41
- if (pki !== -1) pk.splice(pki, 1)
42
-
43
- try {
44
- await files.delete(path_key)
45
- } catch (error) {
46
- console.error(error)
47
- }
48
- }
49
-
50
- async function flushQueue() {
51
- emit('addFileStart')
52
- for (const file of fileQueue) {
53
- file.uploading = true
54
- if (!props.multiple) pk.splice(0, 1)
55
- try {
56
- const { data } = await files.upload(file.file, {
57
- onUploadProgress: (e: ProgressEvent) => {
58
- file.progress = (e.loaded / e.total) * 100 - 1
59
- },
60
- dirPath: props.dirPath,
61
- })
62
- pk.push(data.path_key)
63
- } catch (error) {
64
- console.error('error flushing queue', error)
65
- }
66
- }
67
- fileQueue.splice(0, fileQueue.length)
68
- }
69
-
70
- // Event handlers
71
- function browse() {
72
- if (props.disabled) return
73
- const input = document.createElement('input')
74
- input.type = 'file'
75
- input.multiple = props.multiple
76
- input.accept = props.accept
77
- input.onchange = (e: Event) => {
78
- const files = Array.from((e.target as HTMLInputElement).files || [])
79
- fileQueue.push(...files.map(file => ({ name: file.name, file, progress: 0 })))
80
- flushQueue()
81
- }
82
- input.click()
83
- }
84
-
85
33
  function handleDrag(e: DragEvent, isDragging = false) {
86
34
  e.preventDefault()
87
35
  e.stopPropagation()
88
36
  if (!props.disabled) isDragOver = isDragging
89
37
  }
90
38
 
91
- function handleDrop(e: DragEvent) {
39
+ async function handleDrop(e: DragEvent) {
92
40
  if (props.disabled) return
93
41
  e.preventDefault()
94
42
  e.stopPropagation()
95
-
96
- if (e.dataTransfer?.files) {
97
- fileQueue.push(...Array.from(e.dataTransfer.files)
98
- .map(file => ({ name: file.name, file, progress: 0 })))
99
- flushQueue()
100
- }
43
+ emit('addFileStart')
44
+ addFile(e.dataTransfer?.files)
45
+ await flushQueue()
46
+ emit('update:modelValue', pathKeys.value)
101
47
  isDragOver = false
102
48
  }
103
-
104
- if (props.dirPath) {
105
- files.list(props.dirPath)
106
- .then(response => storageFiles.push(...([response.data].flat())))
107
- .catch(console.error)
108
- }
109
-
110
- watch(() => props.dirPath, () => {
111
- if (props.dirPath) {
112
- files.list(props.dirPath)
113
- .then(response => storageFiles.push(...([response.data].flat())))
114
- .catch(console.error)
115
- }
116
- })
117
49
  </script>
118
50
 
119
51
  <template>
120
52
  <div class="bagel-input">
121
53
  <label v-if="label">{{ label }}</label>
122
- <input
123
- v-if="required && !pathKeys.length"
124
- placeholder="required"
125
- type="text"
126
- required
127
- class="pixel"
128
- >
129
-
54
+ <input v-if="required && !pathKeys.length" placeholder="required" type="text" required class="pixel">
130
55
  <Card
131
56
  v-if="theme === 'basic'"
132
57
  outline
@@ -140,7 +65,7 @@ watch(() => props.dirPath, () => {
140
65
  icon="upload"
141
66
  outline
142
67
  :value="btnPlaceholder || 'Upload'"
143
- @click="browse"
68
+ @click="browse(true)"
144
69
  />
145
70
 
146
71
  <template v-for="path_key in pathKeys" :key="path_key">
@@ -158,7 +83,7 @@ watch(() => props.dirPath, () => {
158
83
  color="gray"
159
84
  thin
160
85
  icon="autorenew"
161
- @click="browse"
86
+ @click="browse(true)"
162
87
  />
163
88
  <Btn
164
89
  icon="download"
@@ -197,7 +122,7 @@ watch(() => props.dirPath, () => {
197
122
  'bgl_oval-upload': oval,
198
123
  }"
199
124
  :style="{ width, height }"
200
- @click="browse"
125
+ @click="browse(true)"
201
126
  @dragover="(e) => handleDrag(e, true)"
202
127
  @drop="handleDrop"
203
128
  @dragleave="(e) => handleDrag(e)"
@@ -281,7 +206,7 @@ watch(() => props.dirPath, () => {
281
206
  color="gray"
282
207
  thin
283
208
  icon="autorenew"
284
- @click="browse"
209
+ @click="browse(true)"
285
210
  />
286
211
  <Btn
287
212
  v-tooltip="'Download'"