@bagelink/vue 0.0.170 → 0.0.172

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.
@@ -2,17 +2,22 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
2
2
  context: Record<string, any>;
3
3
  dragDropLabel?: string | undefined;
4
4
  browseLabel?: string | undefined;
5
+ multiple?: boolean | undefined;
5
6
  }>, {
6
7
  dragDropLabel: string;
7
8
  browseLabel: string;
9
+ multiple: boolean;
8
10
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
9
11
  context: Record<string, any>;
10
12
  dragDropLabel?: string | undefined;
11
13
  browseLabel?: string | undefined;
14
+ multiple?: boolean | undefined;
12
15
  }>, {
13
16
  dragDropLabel: string;
14
17
  browseLabel: string;
18
+ multiple: boolean;
15
19
  }>>>, {
20
+ multiple: boolean;
16
21
  dragDropLabel: string;
17
22
  browseLabel: string;
18
23
  }, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploader.vue.d.ts","sourceRoot":"","sources":["../../../src/components/formkit/FileUploader.vue"],"names":[],"mappings":"AAiFA;;aAmbW,OAAO,MAAM,EAAE,GAAG,CAAC;;;;;;;aAAnB,OAAO,MAAM,EAAE,GAAG,CAAC;;;;;;;mBACZ,MAAM;iBACR,MAAM;;AAJtB,wBAUG;AAGH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,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AE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
package/dist/index.cjs CHANGED
@@ -17743,7 +17743,8 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17743
17743
  props: {
17744
17744
  context: {},
17745
17745
  dragDropLabel: { default: "Drag and drop your files here" },
17746
- browseLabel: { default: "or browse" }
17746
+ browseLabel: { default: "or browse" },
17747
+ multiple: { type: Boolean, default: false }
17747
17748
  },
17748
17749
  setup(__props) {
17749
17750
  const bagel = useBagel();
@@ -17761,9 +17762,12 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17761
17762
  var _a, _b;
17762
17763
  return ((_b = (_a = props2 == null ? void 0 : props2.context) == null ? void 0 : _a.attrs) == null ? void 0 : _b.browseLabel) || (props2 == null ? void 0 : props2.browseLabel);
17763
17764
  });
17765
+ const computedMultiple = vue.computed(() => {
17766
+ var _a, _b;
17767
+ return !!(((_b = (_a = props2 == null ? void 0 : props2.context) == null ? void 0 : _a.attrs) == null ? void 0 : _b.multiple) || (props2 == null ? void 0 : props2.multiple));
17768
+ });
17764
17769
  const allowUpload = vue.computed(() => {
17765
- var _a;
17766
- const tooManyFiles = !((_a = props2.context) == null ? void 0 : _a.attrs.multiple) && files.value.length > 0;
17770
+ const tooManyFiles = !computedMultiple.value && files.value.length > 0;
17767
17771
  return !tooManyFiles;
17768
17772
  });
17769
17773
  const openFileDialog = () => {
@@ -17783,9 +17787,9 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17783
17787
  (_h = (_g = (_f = dropCircle.value) == null ? void 0 : _f.style) == null ? void 0 : _g.setProperty) == null ? void 0 : _h.call(_g, "top", `${top2}px`);
17784
17788
  }
17785
17789
  function emitValue() {
17786
- var _a, _b;
17787
- if (!((_a = props2.context) == null ? void 0 : _a.attrs.multiple))
17788
- return (_b = props2.context) == null ? void 0 : _b.node.input(files.value[0].serverFile);
17790
+ var _a;
17791
+ if (!computedMultiple.value)
17792
+ return (_a = props2.context) == null ? void 0 : _a.node.input(files.value[0].serverFile);
17789
17793
  return alert("not implemented");
17790
17794
  }
17791
17795
  const isImg = (file) => {
@@ -17839,16 +17843,16 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17839
17843
  uploadFiles();
17840
17844
  }
17841
17845
  vue.onMounted(() => {
17842
- var _a, _b, _c, _d, _e, _f, _g, _h;
17846
+ var _a, _b, _c, _d, _e, _f, _g;
17843
17847
  (_a = dropZoneEl.value) == null ? void 0 : _a.addEventListener("dragover", animateCircle);
17844
- if (!((_b = props2.context) == null ? void 0 : _b.attrs.multiple) && ((_c = props2.context) == null ? void 0 : _c.value)) {
17848
+ if (!computedMultiple.value && ((_b = props2.context) == null ? void 0 : _b.value)) {
17845
17849
  files.value.push({
17846
- serverFile: (_d = props2.context) == null ? void 0 : _d.value,
17850
+ serverFile: (_c = props2.context) == null ? void 0 : _c.value,
17847
17851
  uploaded: true,
17848
17852
  uploading: false,
17849
17853
  progress: 100,
17850
- dataUrl: (_f = (_e = props2.context) == null ? void 0 : _e.value) == null ? void 0 : _f.url,
17851
- name: (_h = (_g = props2.context) == null ? void 0 : _g.value) == null ? void 0 : _h.name
17854
+ dataUrl: (_e = (_d = props2.context) == null ? void 0 : _d.value) == null ? void 0 : _e.url,
17855
+ name: (_g = (_f = props2.context) == null ? void 0 : _f.value) == null ? void 0 : _g.name
17852
17856
  });
17853
17857
  }
17854
17858
  });
@@ -17869,7 +17873,6 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17869
17873
  void addFiles(filesToAdd);
17870
17874
  }
17871
17875
  return (_ctx, _cache) => {
17872
- var _a;
17873
17876
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$B, [
17874
17877
  vue.createElementVNode("div", {
17875
17878
  ref_key: "dropZoneEl",
@@ -17941,7 +17944,7 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
17941
17944
  onChange: handleFileInput,
17942
17945
  ref_key: "fileInputEl",
17943
17946
  ref: fileInputEl,
17944
- multiple: ((_a = _ctx.context) == null ? void 0 : _a.attrs.multiple) || false
17947
+ multiple: computedMultiple.value
17945
17948
  }, null, 40, _hoisted_8$1)
17946
17949
  ]);
17947
17950
  };
package/dist/index.mjs CHANGED
@@ -17741,7 +17741,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17741
17741
  props: {
17742
17742
  context: {},
17743
17743
  dragDropLabel: { default: "Drag and drop your files here" },
17744
- browseLabel: { default: "or browse" }
17744
+ browseLabel: { default: "or browse" },
17745
+ multiple: { type: Boolean, default: false }
17745
17746
  },
17746
17747
  setup(__props) {
17747
17748
  const bagel = useBagel();
@@ -17759,9 +17760,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17759
17760
  var _a, _b;
17760
17761
  return ((_b = (_a = props2 == null ? void 0 : props2.context) == null ? void 0 : _a.attrs) == null ? void 0 : _b.browseLabel) || (props2 == null ? void 0 : props2.browseLabel);
17761
17762
  });
17763
+ const computedMultiple = computed(() => {
17764
+ var _a, _b;
17765
+ return !!(((_b = (_a = props2 == null ? void 0 : props2.context) == null ? void 0 : _a.attrs) == null ? void 0 : _b.multiple) || (props2 == null ? void 0 : props2.multiple));
17766
+ });
17762
17767
  const allowUpload = computed(() => {
17763
- var _a;
17764
- const tooManyFiles = !((_a = props2.context) == null ? void 0 : _a.attrs.multiple) && files.value.length > 0;
17768
+ const tooManyFiles = !computedMultiple.value && files.value.length > 0;
17765
17769
  return !tooManyFiles;
17766
17770
  });
17767
17771
  const openFileDialog = () => {
@@ -17781,9 +17785,9 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17781
17785
  (_h = (_g = (_f = dropCircle.value) == null ? void 0 : _f.style) == null ? void 0 : _g.setProperty) == null ? void 0 : _h.call(_g, "top", `${top2}px`);
17782
17786
  }
17783
17787
  function emitValue() {
17784
- var _a, _b;
17785
- if (!((_a = props2.context) == null ? void 0 : _a.attrs.multiple))
17786
- return (_b = props2.context) == null ? void 0 : _b.node.input(files.value[0].serverFile);
17788
+ var _a;
17789
+ if (!computedMultiple.value)
17790
+ return (_a = props2.context) == null ? void 0 : _a.node.input(files.value[0].serverFile);
17787
17791
  return alert("not implemented");
17788
17792
  }
17789
17793
  const isImg = (file) => {
@@ -17837,16 +17841,16 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17837
17841
  uploadFiles();
17838
17842
  }
17839
17843
  onMounted(() => {
17840
- var _a, _b, _c, _d, _e, _f, _g, _h;
17844
+ var _a, _b, _c, _d, _e, _f, _g;
17841
17845
  (_a = dropZoneEl.value) == null ? void 0 : _a.addEventListener("dragover", animateCircle);
17842
- if (!((_b = props2.context) == null ? void 0 : _b.attrs.multiple) && ((_c = props2.context) == null ? void 0 : _c.value)) {
17846
+ if (!computedMultiple.value && ((_b = props2.context) == null ? void 0 : _b.value)) {
17843
17847
  files.value.push({
17844
- serverFile: (_d = props2.context) == null ? void 0 : _d.value,
17848
+ serverFile: (_c = props2.context) == null ? void 0 : _c.value,
17845
17849
  uploaded: true,
17846
17850
  uploading: false,
17847
17851
  progress: 100,
17848
- dataUrl: (_f = (_e = props2.context) == null ? void 0 : _e.value) == null ? void 0 : _f.url,
17849
- name: (_h = (_g = props2.context) == null ? void 0 : _g.value) == null ? void 0 : _h.name
17852
+ dataUrl: (_e = (_d = props2.context) == null ? void 0 : _d.value) == null ? void 0 : _e.url,
17853
+ name: (_g = (_f = props2.context) == null ? void 0 : _f.value) == null ? void 0 : _g.name
17850
17854
  });
17851
17855
  }
17852
17856
  });
@@ -17867,7 +17871,6 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17867
17871
  void addFiles(filesToAdd);
17868
17872
  }
17869
17873
  return (_ctx, _cache) => {
17870
- var _a;
17871
17874
  return openBlock(), createElementBlock("div", _hoisted_1$B, [
17872
17875
  createElementVNode("div", {
17873
17876
  ref_key: "dropZoneEl",
@@ -17939,7 +17942,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
17939
17942
  onChange: handleFileInput,
17940
17943
  ref_key: "fileInputEl",
17941
17944
  ref: fileInputEl,
17942
- multiple: ((_a = _ctx.context) == null ? void 0 : _a.attrs.multiple) || false
17945
+ multiple: computedMultiple.value
17943
17946
  }, null, 40, _hoisted_8$1)
17944
17947
  ]);
17945
17948
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.170",
4
+ "version": "0.0.172",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -75,7 +75,7 @@
75
75
  type="file"
76
76
  @change="handleFileInput"
77
77
  ref="fileInputEl"
78
- :multiple="context?.attrs.multiple || false"
78
+ :multiple="computedMultiple"
79
79
  >
80
80
  </div>
81
81
  </template>
@@ -109,18 +109,21 @@ const props = withDefaults(
109
109
  context: Record<string, any>;
110
110
  dragDropLabel?: string;
111
111
  browseLabel?: string;
112
+ multiple?: boolean;
112
113
  }>(),
113
114
  {
114
115
  dragDropLabel: 'Drag and drop your files here',
115
116
  browseLabel: 'or browse',
117
+ multiple: false,
116
118
  },
117
119
  );
118
120
 
119
121
  const computedDragDropLabel = $computed(() => props?.context?.attrs?.dragDropLabel || props?.dragDropLabel);
120
122
  const computedDrowseLabel = $computed(() => props?.context?.attrs?.browseLabel || props?.browseLabel);
123
+ const computedMultiple = $computed(() => !!(props?.context?.attrs?.multiple || props?.multiple));
121
124
 
122
125
  const allowUpload = $computed(() => {
123
- const tooManyFiles = !props.context?.attrs.multiple && files.length > 0;
126
+ const tooManyFiles = !computedMultiple && files.length > 0;
124
127
  return !tooManyFiles;
125
128
  });
126
129
 
@@ -140,7 +143,7 @@ function animateCircle(e: DragEvent) {
140
143
  function emitValue() {
141
144
  // const fileValues = files.map((f) => f.serverFile?.id);
142
145
  // console.log({ files });
143
- if (!props.context?.attrs.multiple) return props.context?.node.input(files[0].serverFile);
146
+ if (!computedMultiple) return props.context?.node.input(files[0].serverFile);
144
147
  // eslint-disable-next-line no-alert
145
148
  return alert('not implemented');
146
149
  }
@@ -199,7 +202,7 @@ async function addFiles(addedFiles: FileList) {
199
202
 
200
203
  onMounted(() => {
201
204
  dropZoneEl?.addEventListener('dragover', animateCircle);
202
- if (!props.context?.attrs.multiple && props.context?.value) {
205
+ if (!computedMultiple && props.context?.value) {
203
206
  files.push({
204
207
  serverFile: props.context?.value,
205
208
  uploaded: true,