@bagelink/vue 0.0.728 → 0.0.732

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.
@@ -1 +1 @@
1
- {"version":3,"file":"FileUpload.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/FileUpload.vue"],"names":[],"mappings":"AAqfA,OAAO,EAAkD,KAAK,WAAW,EAAY,MAAM,eAAe,CAAA;AA8B1G,KAAK,MAAM,GAAG,MAAM,WAAW,CAAA;AAE/B,KAAK,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAAA;AAqGzC,iBAAS,MAAM,SAgBd;AA8BD,iBAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;sBA3JZ,MAAM;wBACJ,OAAO;mBACZ,MAAM;uBACF,OAAO;;QAgcQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;sBAncnB,MAAM;wBACJ,OAAO;mBACZ,MAAM;uBACF,OAAO;;;QAice,GAAG;EA2BpC;AACD,QAAA,MAAM,eAAe;YAnfZ,MAAM;eACH,OAAO;YACV,WAAW,GAAG,WAAW,EAAE;cACzB,MAAM;iBACH,OAAO;YACZ,MAAM;aACL,MAAM,GAAG,MAAM;YAChB,MAAM;WACP,OAAO;WACP,OAAO;;;;;YATN,MAAM;eACH,OAAO;YACV,WAAW,GAAG,WAAW,EAAE;cACzB,MAAM;iBACH,OAAO;YACZ,MAAM;aACL,MAAM,GAAG,MAAM;YAChB,MAAM;WACP,OAAO;WACP,OAAO;;;;UAifb,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"FileUpload.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/form/inputs/FileUpload.vue"],"names":[],"mappings":"AAmgBA,OAAO,EAAmC,KAAK,WAAW,EAAY,MAAM,eAAe,CAAA;AA8B3F,KAAK,MAAM,GAAG,MAAM,WAAW,CAAA;AAE/B,KAAK,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,CAAA;AAmHzC,iBAAS,MAAM,SAgBd;AA8BD,iBAAS,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;sBAzKZ,MAAM;wBACJ,OAAO;mBACZ,MAAM;uBACF,OAAO;;QA8cQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;sBAjdnB,MAAM;wBACJ,OAAO;mBACZ,MAAM;uBACF,OAAO;;;QA+ce,GAAG;EA2BpC;AACD,QAAA,MAAM,eAAe;YAjgBZ,MAAM;eACH,OAAO;YACV,WAAW,GAAG,WAAW,EAAE;cACzB,MAAM;iBACH,OAAO;YACZ,MAAM;aACL,MAAM,GAAG,MAAM;YAChB,MAAM;WACP,OAAO;WACP,OAAO;;;;;YATN,MAAM;eACH,OAAO;YACV,WAAW,GAAG,WAAW,EAAE;cACzB,MAAM;iBACH,OAAO;YACZ,MAAM;aACL,MAAM,GAAG,MAAM;YAChB,MAAM;WACP,OAAO;WACP,OAAO;;;;UA+fb,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/lightbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAA+B,MAAM,KAAK,CAAA;;iBAoD7C,GAAG;;AADjB,wBAIC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/lightbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAA+B,MAAM,KAAK,CAAA;;iBA6D7C,GAAG;;AADjB,wBAIC"}
@@ -3,5 +3,6 @@ export interface LightboxItem {
3
3
  type: string;
4
4
  name: string;
5
5
  thumbnail?: string;
6
+ group?: string;
6
7
  }
7
8
  //# sourceMappingURL=lightbox.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lightbox.types.d.ts","sourceRoot":"","sources":["../../../src/components/lightbox/lightbox.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB"}
1
+ {"version":3,"file":"lightbox.types.d.ts","sourceRoot":"","sources":["../../../src/components/lightbox/lightbox.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACd"}
package/dist/index.cjs CHANGED
@@ -5270,7 +5270,7 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
5270
5270
  }, "Open file", 8, _hoisted_5$g)
5271
5271
  ]))
5272
5272
  ]),
5273
- vue.unref(group).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$b, [
5273
+ vue.unref(group) && vue.unref(group).length > 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$b, [
5274
5274
  vue.createVNode(vue.unref(Btn), {
5275
5275
  class: "navigation-btn oval user-select-none",
5276
5276
  icon: "arrow_back",
@@ -5316,30 +5316,42 @@ const _export_sfc = (sfc, props2) => {
5316
5316
  }
5317
5317
  return target;
5318
5318
  };
5319
- const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-b3a3d091"]]);
5319
+ const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-c3c26420"]]);
5320
5320
  const groups = {};
5321
5321
  const lightboxDirective = {
5322
5322
  mounted(el, binding) {
5323
5323
  el.classList.add("hover");
5324
- let { group, src, type: type3, name, thumbnail } = binding.value || {};
5325
- src = src || binding.value || el.getAttribute("src") || "";
5326
- type3 = type3 || determineFileType(src);
5327
- const item = { src, type: type3, name, thumbnail };
5328
- if (group) {
5329
- if (!groups[group]) groups[group] = [];
5330
- groups[group].push(item);
5324
+ const item = bindingToItem(binding, el);
5325
+ if (item.group) {
5326
+ if (!groups[item.group]) groups[item.group] = [];
5327
+ const currentIndex = groups[item.group].findIndex((i2) => i2.src === item.src);
5328
+ if (currentIndex === -1) groups[item.group].push(item);
5331
5329
  }
5332
5330
  el.addEventListener("click", (e) => {
5333
- e.stopPropagation();
5334
- const lightboxInstance = createLightboxInstance();
5335
- if (!lightboxInstance || !lightboxInstance.open) return;
5336
- const open = lightboxInstance.open;
5337
- open(item, groups[group]);
5331
+ openClickHandler(e, el, binding);
5338
5332
  });
5339
5333
  },
5340
5334
  unmounted(el, binding) {
5335
+ el.removeEventListener("click", (e) => {
5336
+ openClickHandler(e, el, binding);
5337
+ });
5341
5338
  }
5342
5339
  };
5340
+ function openClickHandler(e, el, binding) {
5341
+ e.stopPropagation();
5342
+ const item = bindingToItem(binding, el);
5343
+ const lightboxInstance = createLightboxInstance();
5344
+ if (!lightboxInstance || !lightboxInstance.open) return;
5345
+ const open = lightboxInstance.open;
5346
+ const group = item && item.group ? groups[item.group] : void 0;
5347
+ open(item, group);
5348
+ }
5349
+ function bindingToItem(binding, el) {
5350
+ let { group, src, type: type3, name, thumbnail } = binding.value || {};
5351
+ src = src || binding.value || el.getAttribute("src") || "";
5352
+ type3 = type3 || determineFileType(src);
5353
+ return { src, type: type3, name, thumbnail, group };
5354
+ }
5343
5355
  const youtubeRegex = /youtube\.com|youtu\.be/;
5344
5356
  const vimeoRegex = /vimeo\.com/;
5345
5357
  function determineFileType(url) {
@@ -19848,6 +19860,19 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
19848
19860
  },
19849
19861
  { immediate: true }
19850
19862
  );
19863
+ vue.watch(() => props2.modelValue, () => {
19864
+ const newModelValue = props2.modelValue || [];
19865
+ const currentValue = [file_bindkeys.value].flat();
19866
+ const newValue = [newModelValue].flat();
19867
+ const isSame = currentValue.every((id) => newValue.includes(id)) && newValue.every((id) => currentValue.includes(id)) && currentValue.length === newValue.length;
19868
+ if (!isSame) {
19869
+ file_bindkeys.value = newModelValue;
19870
+ for (const fle of storageFiles.value) {
19871
+ const index2 = [file_bindkeys.value].flat().findIndex((key) => fle[bindKey2] === key);
19872
+ if (index2 === -1) storageFiles.value.splice(index2, 1);
19873
+ }
19874
+ }
19875
+ });
19851
19876
  function updateModelValue() {
19852
19877
  let idValue;
19853
19878
  if (props2.multiple) {
@@ -20068,7 +20093,7 @@ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
20068
20093
  };
20069
20094
  }
20070
20095
  });
20071
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d4a17ec6"]]);
20096
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a0ae528d"]]);
20072
20097
  const _withScopeId$1 = (n2) => (vue.pushScopeId("data-v-06b95183"), n2 = n2(), vue.popScopeId(), n2);
20073
20098
  const _hoisted_1$j = ["title"];
20074
20099
  const _hoisted_2$e = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("span", { class: "slider round" }, null, -1));
package/dist/index.mjs CHANGED
@@ -5268,7 +5268,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
5268
5268
  }, "Open file", 8, _hoisted_5$g)
5269
5269
  ]))
5270
5270
  ]),
5271
- unref(group).length ? (openBlock(), createElementBlock("div", _hoisted_6$b, [
5271
+ unref(group) && unref(group).length > 1 ? (openBlock(), createElementBlock("div", _hoisted_6$b, [
5272
5272
  createVNode(unref(Btn), {
5273
5273
  class: "navigation-btn oval user-select-none",
5274
5274
  icon: "arrow_back",
@@ -5314,30 +5314,42 @@ const _export_sfc = (sfc, props2) => {
5314
5314
  }
5315
5315
  return target;
5316
5316
  };
5317
- const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-b3a3d091"]]);
5317
+ const Lightbox$1 = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-c3c26420"]]);
5318
5318
  const groups = {};
5319
5319
  const lightboxDirective = {
5320
5320
  mounted(el, binding) {
5321
5321
  el.classList.add("hover");
5322
- let { group, src, type: type3, name, thumbnail } = binding.value || {};
5323
- src = src || binding.value || el.getAttribute("src") || "";
5324
- type3 = type3 || determineFileType(src);
5325
- const item = { src, type: type3, name, thumbnail };
5326
- if (group) {
5327
- if (!groups[group]) groups[group] = [];
5328
- groups[group].push(item);
5322
+ const item = bindingToItem(binding, el);
5323
+ if (item.group) {
5324
+ if (!groups[item.group]) groups[item.group] = [];
5325
+ const currentIndex = groups[item.group].findIndex((i2) => i2.src === item.src);
5326
+ if (currentIndex === -1) groups[item.group].push(item);
5329
5327
  }
5330
5328
  el.addEventListener("click", (e) => {
5331
- e.stopPropagation();
5332
- const lightboxInstance = createLightboxInstance();
5333
- if (!lightboxInstance || !lightboxInstance.open) return;
5334
- const open = lightboxInstance.open;
5335
- open(item, groups[group]);
5329
+ openClickHandler(e, el, binding);
5336
5330
  });
5337
5331
  },
5338
5332
  unmounted(el, binding) {
5333
+ el.removeEventListener("click", (e) => {
5334
+ openClickHandler(e, el, binding);
5335
+ });
5339
5336
  }
5340
5337
  };
5338
+ function openClickHandler(e, el, binding) {
5339
+ e.stopPropagation();
5340
+ const item = bindingToItem(binding, el);
5341
+ const lightboxInstance = createLightboxInstance();
5342
+ if (!lightboxInstance || !lightboxInstance.open) return;
5343
+ const open = lightboxInstance.open;
5344
+ const group = item && item.group ? groups[item.group] : void 0;
5345
+ open(item, group);
5346
+ }
5347
+ function bindingToItem(binding, el) {
5348
+ let { group, src, type: type3, name, thumbnail } = binding.value || {};
5349
+ src = src || binding.value || el.getAttribute("src") || "";
5350
+ type3 = type3 || determineFileType(src);
5351
+ return { src, type: type3, name, thumbnail, group };
5352
+ }
5341
5353
  const youtubeRegex = /youtube\.com|youtu\.be/;
5342
5354
  const vimeoRegex = /vimeo\.com/;
5343
5355
  function determineFileType(url) {
@@ -19846,6 +19858,19 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
19846
19858
  },
19847
19859
  { immediate: true }
19848
19860
  );
19861
+ watch(() => props2.modelValue, () => {
19862
+ const newModelValue = props2.modelValue || [];
19863
+ const currentValue = [file_bindkeys.value].flat();
19864
+ const newValue = [newModelValue].flat();
19865
+ const isSame = currentValue.every((id) => newValue.includes(id)) && newValue.every((id) => currentValue.includes(id)) && currentValue.length === newValue.length;
19866
+ if (!isSame) {
19867
+ file_bindkeys.value = newModelValue;
19868
+ for (const fle of storageFiles.value) {
19869
+ const index2 = [file_bindkeys.value].flat().findIndex((key) => fle[bindKey2] === key);
19870
+ if (index2 === -1) storageFiles.value.splice(index2, 1);
19871
+ }
19872
+ }
19873
+ });
19849
19874
  function updateModelValue() {
19850
19875
  let idValue;
19851
19876
  if (props2.multiple) {
@@ -20066,7 +20091,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
20066
20091
  };
20067
20092
  }
20068
20093
  });
20069
- const $el = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d4a17ec6"]]);
20094
+ const $el = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-a0ae528d"]]);
20070
20095
  const _withScopeId$1 = (n2) => (pushScopeId("data-v-06b95183"), n2 = n2(), popScopeId(), n2);
20071
20096
  const _hoisted_1$j = ["title"];
20072
20097
  const _hoisted_2$e = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", { class: "slider round" }, null, -1));
package/dist/style.css CHANGED
@@ -1,14 +1,14 @@
1
1
  @import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@100;200;300;400;500;600;700;800;900&display=swap");
2
- .bgl-lightbox-overlay[data-v-b3a3d091] {
2
+ .bgl-lightbox-overlay[data-v-c3c26420] {
3
3
  background: rgba(0, 0, 0, 0.8);
4
4
  }
5
- .bgl-lightbox[data-v-b3a3d091] {
5
+ .bgl-lightbox[data-v-c3c26420] {
6
6
  max-height: 90%;
7
7
  }
8
- .bgl-lightbox-item[data-v-b3a3d091]{
9
- animation: 500ms ease bgl-lightbox-load-b3a3d091;
8
+ .bgl-lightbox-item[data-v-c3c26420]{
9
+ animation: 500ms ease bgl-lightbox-load-c3c26420;
10
10
  }
11
- @keyframes bgl-lightbox-load-b3a3d091 {
11
+ @keyframes bgl-lightbox-load-c3c26420 {
12
12
  from {
13
13
  scale:0.7;
14
14
  }
@@ -16,32 +16,32 @@ to {
16
16
  scale:1;
17
17
  }
18
18
  }
19
- .bgl-lightbox-item[data-v-b3a3d091] * {
19
+ .bgl-lightbox-item[data-v-c3c26420] * {
20
20
  max-width: 90%;
21
21
  max-height: calc(80vh - 90px);
22
22
  border-radius: 3px;
23
23
  margin: auto;
24
- animation: 200ms ease bgl-lightbox-load-b3a3d091;
24
+ animation: 200ms ease bgl-lightbox-load-c3c26420;
25
25
  }
26
- .navigation[data-v-b3a3d091] {
26
+ .navigation[data-v-c3c26420] {
27
27
  top: 50%;
28
28
  transform: translateY(-50%);
29
29
  }
30
- .navigation-btn[data-v-b3a3d091] {
30
+ .navigation-btn[data-v-c3c26420] {
31
31
  width: var(--input-height);
32
32
  height: var(--input-height);
33
33
  }
34
- .thumbnail[data-v-b3a3d091] {
34
+ .thumbnail[data-v-c3c26420] {
35
35
  height: 50px;
36
36
  width: 50px;
37
37
  }
38
- .thumbnail[data-v-b3a3d091]:hover {
38
+ .thumbnail[data-v-c3c26420]:hover {
39
39
  opacity: 1;
40
40
  }
41
- .thumbnail[data-v-b3a3d091]:active {
41
+ .thumbnail[data-v-c3c26420]:active {
42
42
  opacity: 0.8;
43
43
  }
44
- .thumbnail.active[data-v-b3a3d091] {
44
+ .thumbnail.active[data-v-c3c26420] {
45
45
  opacity: 1;
46
46
  outline: 2px solid white;
47
47
  }
@@ -1801,7 +1801,7 @@ display: block;
1801
1801
  color: var(--bgl-white);
1802
1802
  }
1803
1803
 
1804
- .fileUploadWrap[data-v-d4a17ec6] {
1804
+ .fileUploadWrap[data-v-a0ae528d] {
1805
1805
  outline: 1px solid var(--border-color);
1806
1806
  border-radius: var(--input-border-radius);
1807
1807
  text-align: center;
@@ -1813,7 +1813,7 @@ display: block;
1813
1813
  background: var(--input-bg);
1814
1814
  height: 215px;
1815
1815
  }
1816
- .bagel-input .fileUploadWrap.fileDropZone[data-v-d4a17ec6] {
1816
+ .bagel-input .fileUploadWrap.fileDropZone[data-v-a0ae528d] {
1817
1817
  background: var(--input-bg);
1818
1818
  display: flex;
1819
1819
  align-items: center;
@@ -1821,14 +1821,14 @@ display: block;
1821
1821
  color: var(--bgl-gray);
1822
1822
  flex-direction: column;
1823
1823
  }
1824
- .fileUploadWrap.dragover[data-v-d4a17ec6],
1825
- .fileUploadWrap[data-v-d4a17ec6]:hover {
1824
+ .fileUploadWrap.dragover[data-v-a0ae528d],
1825
+ .fileUploadWrap[data-v-a0ae528d]:hover {
1826
1826
  box-shadow: inset 0 0 10px #00000012;
1827
1827
  }
1828
- .fileUploadWrap[style*="height: auto;"][data-v-d4a17ec6] {
1828
+ .fileUploadWrap[style*="height: auto;"][data-v-a0ae528d] {
1829
1829
  min-height: 215px;
1830
1830
  }
1831
- .multi-image-item-preview[data-v-d4a17ec6] {
1831
+ .multi-image-item-preview[data-v-a0ae528d] {
1832
1832
  border: 1px solid var(--border-color) !important;
1833
1833
  border-radius: var(--input-border-radius);
1834
1834
  margin: 0.5rem !important;
@@ -1842,12 +1842,12 @@ display: block;
1842
1842
  gap: 1rem;
1843
1843
  align-items: center;
1844
1844
  }
1845
- .multi-image-item-preview p[data-v-d4a17ec6] {
1845
+ .multi-image-item-preview p[data-v-a0ae528d] {
1846
1846
  overflow: hidden;
1847
1847
  text-overflow: ellipsis;
1848
1848
  white-space: nowrap;
1849
1849
  }
1850
- .multi-preview[data-v-d4a17ec6]{
1850
+ .multi-preview[data-v-a0ae528d]{
1851
1851
  width: 40px;
1852
1852
  height: 40px;
1853
1853
  border-radius: var(--input-border-radius);
@@ -1858,17 +1858,17 @@ display: block;
1858
1858
  align-items: center;
1859
1859
  display: flex;
1860
1860
  }
1861
- .bgl-single-preview[data-v-d4a17ec6]{
1861
+ .bgl-single-preview[data-v-a0ae528d]{
1862
1862
  height: 100%;
1863
1863
  position: relative;
1864
1864
  }
1865
- .bgl-single-preview + .fileUploadPlaceHolder[data-v-d4a17ec6]{
1865
+ .bgl-single-preview + .fileUploadPlaceHolder[data-v-a0ae528d]{
1866
1866
  position: absolute;
1867
1867
  inset: 0;
1868
1868
  margin: auto;
1869
1869
  top: calc(50% - 2rem);
1870
1870
  }
1871
- .single-image-item-preview[data-v-d4a17ec6] {
1871
+ .single-image-item-preview[data-v-a0ae528d] {
1872
1872
  height: 100%;
1873
1873
  min-height: 100%;
1874
1874
  position: relative;
@@ -1876,13 +1876,13 @@ display: block;
1876
1876
  align-items: center;
1877
1877
  justify-content: center;
1878
1878
  }
1879
- .fileUploadWrap[style*="height: auto"] .single-image-item-preview[data-v-d4a17ec6] {
1879
+ .fileUploadWrap[style*="height: auto"] .single-image-item-preview[data-v-a0ae528d] {
1880
1880
  min-height: 215px;
1881
1881
  }
1882
- .fileUploadWrap[style*="height: auto"] .single-preview[data-v-d4a17ec6] {
1882
+ .fileUploadWrap[style*="height: auto"] .single-preview[data-v-a0ae528d] {
1883
1883
  margin: 0rem !important;
1884
1884
  }
1885
- .single-preview[data-v-d4a17ec6]{
1885
+ .single-preview[data-v-a0ae528d]{
1886
1886
  border-radius: var(--input-border-radius);
1887
1887
  margin: 1rem;
1888
1888
  padding: 0px;
@@ -1892,17 +1892,17 @@ display: block;
1892
1892
  background: var(--bgl-gray-light);
1893
1893
  box-shadow: 0 0 10px #00000012;
1894
1894
  }
1895
- .bgl_fill-image.single-image-item-preview[data-v-d4a17ec6] {
1895
+ .bgl_fill-image.single-image-item-preview[data-v-a0ae528d] {
1896
1896
  height: 100%;
1897
1897
  }
1898
- .bgl_fill-image.single-image-item-preview .single-preview[data-v-d4a17ec6]{
1898
+ .bgl_fill-image.single-image-item-preview .single-preview[data-v-a0ae528d]{
1899
1899
  border-radius: unset;
1900
1900
  object-fit: cover;
1901
1901
  box-shadow: unset;
1902
1902
  width: 100%;
1903
1903
  height: auto;
1904
1904
  }
1905
- .single-image-item-preview .pie[data-v-d4a17ec6] {
1905
+ .single-image-item-preview .pie[data-v-a0ae528d] {
1906
1906
  transform-origin: top;
1907
1907
  transform: scale(1.4);
1908
1908
  position: absolute;
@@ -1916,31 +1916,31 @@ display: block;
1916
1916
  border: none !important;
1917
1917
  padding: 0 !important;
1918
1918
  }
1919
- .bgl_oval-upload[data-v-d4a17ec6] {
1919
+ .bgl_oval-upload[data-v-a0ae528d] {
1920
1920
  border-radius: 100% !important;
1921
1921
  overflow: hidden;
1922
1922
  }
1923
- .bgl_oval-upload p[data-v-d4a17ec6] {
1923
+ .bgl_oval-upload p[data-v-a0ae528d] {
1924
1924
  padding: 0.75rem !important;
1925
1925
  font-size: 12px
1926
1926
  }
1927
- .bgl_oval-upload .fileUploadPlaceHolder[data-v-d4a17ec6]{
1927
+ .bgl_oval-upload .fileUploadPlaceHolder[data-v-a0ae528d]{
1928
1928
  top: 0;
1929
1929
  }
1930
- .bgl_oval-upload .pie[data-v-d4a17ec6] {
1930
+ .bgl_oval-upload .pie[data-v-a0ae528d] {
1931
1931
  transform: scale(1);
1932
1932
  }
1933
- .bgl_oval-upload span.bgl_icon-font.color-primary[data-v-d4a17ec6] {
1933
+ .bgl_oval-upload span.bgl_icon-font.color-primary[data-v-a0ae528d] {
1934
1934
  transform: scale(0.4) !important;
1935
1935
  }
1936
- .bgl_oval-upload .single-image-item-preview[data-v-d4a17ec6]{
1936
+ .bgl_oval-upload .single-image-item-preview[data-v-a0ae528d]{
1937
1937
  height: 100%;
1938
1938
  }
1939
- .bgl_oval-upload .single-preview[data-v-d4a17ec6] {
1939
+ .bgl_oval-upload .single-preview[data-v-a0ae528d] {
1940
1940
  margin: 0;
1941
1941
  height: 100% !important;
1942
1942
  }
1943
- .pie[data-v-d4a17ec6] {
1943
+ .pie[data-v-a0ae528d] {
1944
1944
  width: 30px;
1945
1945
  height: 30px;
1946
1946
  position: relative;
@@ -1948,7 +1948,7 @@ display: block;
1948
1948
  align-items: center;
1949
1949
  justify-content: center;
1950
1950
  }
1951
- .pie[data-v-d4a17ec6]:before {
1951
+ .pie[data-v-a0ae528d]:before {
1952
1952
  content: '';
1953
1953
  position: absolute;
1954
1954
  border-radius: 50%;
@@ -1966,26 +1966,26 @@ display: block;
1966
1966
  #000 calc(100% - var(--b))
1967
1967
  );
1968
1968
  }
1969
- .pie .success[data-v-d4a17ec6] {
1969
+ .pie .success[data-v-a0ae528d] {
1970
1970
  transform: scale(0);
1971
1971
  opacity: 0;
1972
1972
  transition: all 0.3s ease-in-out;
1973
1973
  }
1974
- .pie .progress[data-v-d4a17ec6] {
1974
+ .pie .progress[data-v-a0ae528d] {
1975
1975
  position: absolute;
1976
1976
  font-size: 10px;
1977
1977
  }
1978
- .pie.complete .progress[data-v-d4a17ec6] {
1978
+ .pie.complete .progress[data-v-a0ae528d] {
1979
1979
  display: none;
1980
1980
  }
1981
- .pie.complete .success[data-v-d4a17ec6] {
1981
+ .pie.complete .success[data-v-a0ae528d] {
1982
1982
  transform: scale(1.3);
1983
1983
  opacity: 1;
1984
1984
  }
1985
- .pie.complete[data-v-d4a17ec6]:before {
1985
+ .pie.complete[data-v-a0ae528d]:before {
1986
1986
  background: conic-gradient(var(--bgl-green) calc(var(--p) * 1%), #0000 0);
1987
1987
  }
1988
- .pie.complete[data-v-d4a17ec6] {
1988
+ .pie.complete[data-v-a0ae528d] {
1989
1989
  color: var(--bgl-green);
1990
1990
  }
1991
1991
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "0.0.728",
4
+ "version": "0.0.732",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Neveh Allon",
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { onMounted, watch } from 'vue'
3
- import { Btn, IMAGE_FORMATS, IMAGE_FORMATS_REGEXP, Icon, type StorageFile, useBagel } from '@bagelink/vue'
3
+ import { Btn, IMAGE_FORMATS_REGEXP, Icon, type StorageFile, useBagel } from '@bagelink/vue'
4
4
 
5
5
  const props = defineProps<{
6
6
  label?: string
@@ -83,6 +83,20 @@ watch(
83
83
  { immediate: true }
84
84
  )
85
85
 
86
+ watch(() => props.modelValue, () => {
87
+ const newModelValue: FSValue = props.modelValue || []
88
+ const currentValue = [file_bindkeys].flat()
89
+ const newValue = [newModelValue].flat()
90
+ const isSame = currentValue.every(id => newValue.includes(id)) && newValue.every(id => currentValue.includes(id)) && currentValue.length === newValue.length
91
+ if (!isSame) {
92
+ file_bindkeys = newModelValue
93
+ for (const fle of storageFiles) {
94
+ const index = [file_bindkeys].flat().findIndex(key => fle[bindKey] === key)
95
+ if (index === -1) storageFiles.splice(index, 1)
96
+ }
97
+ }
98
+ })
99
+
86
100
  function updateModelValue() {
87
101
  let idValue: FSValue
88
102
  if (props.multiple) {
@@ -105,7 +105,7 @@ defineExpose({ open, close })
105
105
  </div>
106
106
  </template>
107
107
  </div>
108
- <div v-if="group.length" class="navigation flex space-between w-100 absolute">
108
+ <div v-if="group && group.length > 1" class="navigation flex space-between w-100 absolute">
109
109
  <Btn
110
110
  class="navigation-btn oval user-select-none"
111
111
  icon="arrow_back"
@@ -9,27 +9,36 @@ const groups: Record<string, LightboxItem[]> = {}
9
9
  const lightboxDirective: Directive = {
10
10
  mounted(el: HTMLElement, binding) {
11
11
  el.classList.add('hover')
12
- let { group, src, type, name, thumbnail } = binding.value || {}
13
- src = src || binding.value || el.getAttribute('src') || ''
14
- type = type || determineFileType(src)
15
- const item: LightboxItem = { src, type, name, thumbnail }
16
- if (group) {
17
- if (!groups[group]) groups[group] = []
18
- groups[group].push(item)
12
+ const item = bindingToItem(binding, el)
13
+ if (item.group) {
14
+ if (!groups[item.group]) groups[item.group] = []
15
+ const currentIndex = groups[item.group].findIndex(i => i.src === item.src)
16
+ if (currentIndex === -1) groups[item.group].push(item)
19
17
  }
20
- el.addEventListener('click', (e) => {
21
- e.stopPropagation()
22
- const lightboxInstance = createLightboxInstance()
23
- if (!lightboxInstance || !lightboxInstance.open) return
24
- const open = lightboxInstance.open as OpenFunction
25
- open(item, groups[group])
26
- })
18
+ el.addEventListener('click', (e) => { openClickHandler(e, el, binding) })
27
19
  },
28
20
  unmounted(el: HTMLElement, binding) {
29
- // TODO: remove click event handler
21
+ el.removeEventListener('click', (e) => { openClickHandler(e, el, binding) })
30
22
  }
31
23
  }
32
24
 
25
+ function openClickHandler(e: MouseEvent, el: HTMLElement, binding: DirectiveBinding) {
26
+ e.stopPropagation()
27
+ const item = bindingToItem(binding, el)
28
+ const lightboxInstance = createLightboxInstance()
29
+ if (!lightboxInstance || !lightboxInstance.open) return
30
+ const open = lightboxInstance.open as OpenFunction
31
+ const group = item && item.group ? groups[item.group] : undefined
32
+ open(item, group)
33
+ }
34
+
35
+ function bindingToItem(binding: DirectiveBinding, el: HTMLElement): LightboxItem {
36
+ let { group, src, type, name, thumbnail } = binding.value || {}
37
+ src = src || binding.value || el.getAttribute('src') || ''
38
+ type = type || determineFileType(src)
39
+ return { src, type, name, thumbnail, group }
40
+ }
41
+
33
42
  const youtubeRegex = /youtube\.com|youtu\.be/
34
43
  const vimeoRegex = /vimeo\.com/
35
44
 
@@ -3,4 +3,5 @@ export interface LightboxItem {
3
3
  type: string
4
4
  name: string
5
5
  thumbnail?: string
6
+ group?: string
6
7
  }