@fewangsit/wangsvue-fats 1.0.1-alpha.35 → 1.0.1-alpha.36

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.
@@ -50,8 +50,8 @@ const I = (i, s) => {
50
50
  _: 3
51
51
  }, 8, ["mouse-move", "touch-move", "touch-resize", "wheel-resize"]));
52
52
  }
53
- }), S = /* @__PURE__ */ I(R, [["__scopeId", "data-v-9031c32d"]]);
53
+ }), b = /* @__PURE__ */ I(R, [["__scopeId", "data-v-5cd98b2d"]]);
54
54
  export {
55
- S as B,
55
+ b as B,
56
56
  I as _
57
57
  };
@@ -988,7 +988,7 @@ const zt = (W, $) => W.every((t) => $.includes(t)), jt = ["id"], Vt = ["onClick"
988
988
  ], 16);
989
989
  };
990
990
  }
991
- }), Fl = /* @__PURE__ */ Lt(sl, [["__scopeId", "data-v-015be0a0"]]);
991
+ }), Fl = /* @__PURE__ */ Lt(sl, [["__scopeId", "data-v-37d9df20"]]);
992
992
  export {
993
993
  Fl as D
994
994
  };
@@ -231,8 +231,8 @@ const H = /* @__PURE__ */ nA(vA), j = "data:image/png;base64,iVBORw0KGgoAAAANSUh
231
231
  t[4] || (t[4] = e("span", null, "Preview", -1)),
232
232
  a(eA, {
233
233
  icon: "info",
234
- info: `This preview is only for showing the side of the\r
235
- label that printed or not. It does not show the\r
234
+ info: `This preview is only for showing the side of the
235
+ label that printed or not. It does not show the
236
236
  exact amount you entered.`,
237
237
  severity: "primary"
238
238
  })
package/image/index.d.ts CHANGED
@@ -271,17 +271,22 @@ export interface ImageProps {
271
271
  unstyled?: boolean;
272
272
 
273
273
  /**
274
- * Get image url for specifics project from its server.
275
- * @returns The full URL of the image from the server.
276
- * @param path - the Image path from API Response JSON
277
- * @param width - the image width in pixels
278
- * @param height - the image height in pixels
274
+ * Returns the full image URL or a Data URI for an image resource, based on the provided path and dimensions.
275
+ *
276
+ * If the image is publicly accessible, this typically returns a fully qualified URL.
277
+ * If the image requires authentication or protected access, this may return a Data URI (e.g., Base64-encoded).
278
+ *
279
+ * @param path - The image path as provided in the API response JSON. Can be null or undefined.
280
+ * @param width - Optional width of the image in pixels.
281
+ * @param height - Optional height of the image in pixels.
282
+ *
283
+ * @returns A string representing either the full image URL or a Data URI. Returns `undefined` if the path is invalid.
279
284
  */
280
285
  getImageURL?: (
281
286
  path?: string | null,
282
287
  width?: number,
283
288
  height?: number,
284
- ) => string | undefined;
289
+ ) => string | undefined | Promise<string | undefined>;
285
290
 
286
291
  /**
287
292
  * The placeholder to be shown when the image failed to load, or the src is not provided.
package/image/index.es.js CHANGED
@@ -1,10 +1,11 @@
1
- import { defineComponent as j, computed as p, onMounted as G, onUnmounted as M, shallowRef as f, createBlock as W, openBlock as n, unref as q, mergeProps as I, withCtx as b, createElementBlock as m, normalizeStyle as k, Fragment as _, createElementVNode as U, renderList as T, withDirectives as A, vShow as H, withModifiers as D, createVNode as C, normalizeClass as z } from "vue";
2
- import { u as J } from "../plugins/WangsVue.es.js";
3
- import { m as K } from "../utils/mergePropsWithDefaults.util.es.js";
4
- import { s as Q } from "../vendor/primevue/image/image.esm.es.js";
5
- import { _ as O } from "../button/index.es.js";
6
- import { _ as X } from "../icon/index.es.js";
7
- const Y = ["src"], Z = ["src"], ee = ["src"], te = ["src", "onClick"], ne = /* @__PURE__ */ j({
1
+ import { defineComponent as M, computed as I, onMounted as W, onUnmounted as Z, shallowRef as d, createBlock as q, openBlock as u, unref as D, withCtx as b, createElementBlock as g, normalizeStyle as k, Fragment as z, createElementVNode as $, renderList as O, withDirectives as x, vShow as H, withModifiers as P, createVNode as C, normalizeClass as _, mergeProps as T } from "vue";
2
+ import { c as J } from "../vendor/@vueuse/core/index.es.js";
3
+ import { u as K } from "../plugins/WangsVue.es.js";
4
+ import { m as Q } from "../utils/mergePropsWithDefaults.util.es.js";
5
+ import { s as X } from "../vendor/primevue/image/image.esm.es.js";
6
+ import { _ as E } from "../button/index.es.js";
7
+ import { _ as Y } from "../icon/index.es.js";
8
+ const ee = ["src"], te = ["src"], ae = ["src"], re = ["src", "onClick"], me = /* @__PURE__ */ M({
8
9
  __name: "Image",
9
10
  props: {
10
11
  src: {},
@@ -24,101 +25,112 @@ const Y = ["src"], Z = ["src"], ee = ["src"], te = ["src", "onClick"], ne = /* @
24
25
  getImageURL: {},
25
26
  placeholder: {}
26
27
  },
27
- setup(x) {
28
- const r = x, { defaultProps: E } = J("Image"), c = p(() => K(r, E));
29
- G(() => {
28
+ setup(F) {
29
+ const a = F, { defaultProps: N } = K("Image"), i = I(() => Q(a, N));
30
+ W(() => {
30
31
  setTimeout(() => {
31
- $();
32
+ L();
32
33
  }, 3e3);
33
- }), M(() => {
34
- h();
34
+ }), Z(() => {
35
+ w();
35
36
  });
36
- const o = f(0), v = f(), L = f(), w = f(!1), F = p(() => {
37
+ const s = d(0), p = d(), S = d(), f = d(!1), V = I(() => {
37
38
  var e;
38
- return r.preview === !1 ? !1 : !w.value && !((e = u.value) != null && e.toString().includes("data:image/png;base64")) && u.value !== c.value.placeholder;
39
- }), N = () => {
40
- const e = r.galleries ?? [];
41
- o.value = (o.value + 1) % e.length, y();
42
- }, P = () => {
43
- const e = r.galleries ?? [];
44
- o.value = (o.value - 1 + e.length) % e.length, y();
45
- }, $ = () => {
39
+ return a.preview === !1 ? !1 : !f.value && !((e = m.value) != null && e.toString().includes("data:image/png;base64")) && m.value !== i.value.placeholder;
40
+ }), j = () => {
41
+ const e = a.galleries ?? [];
42
+ s.value = (s.value + 1) % e.length, h();
43
+ }, A = () => {
44
+ const e = a.galleries ?? [];
45
+ s.value = (s.value - 1 + e.length) % e.length, h();
46
+ }, L = () => {
46
47
  var e;
47
- h(), (e = r.galleries) != null && e.length && (v.value = window.setInterval(() => {
48
- const t = r.galleries ?? [];
49
- o.value = (o.value + 1) % t.length;
48
+ w(), (e = a.galleries) != null && e.length && (p.value = window.setInterval(() => {
49
+ const t = a.galleries ?? [];
50
+ s.value = (s.value + 1) % t.length;
50
51
  }, 3e3));
51
- }, h = () => {
52
- v.value && (window.clearInterval(v.value), v.value = void 0);
53
- }, B = p(() => r.width != null ? r.width : r.size === "small" ? 30 : r.size === "medium" ? 80 : 125), u = p(() => {
54
- var e, t;
55
- return !r.src || w.value ? c.value.placeholder : typeof r.src == "string" ? r.src.includes("http") || // From public image
56
- r.src.includes("data:image/png;base64") ? r.src : (t = (e = c.value).getImageURL) == null ? void 0 : t.call(e, r.src, B.value) : r.src;
57
- }), V = p(() => {
58
- var t, l, a, g;
59
- const e = u.value;
52
+ }, w = () => {
53
+ p.value && (window.clearInterval(p.value), p.value = void 0);
54
+ }, R = I(() => a.width != null ? a.width : a.size === "small" ? 30 : a.size === "medium" ? 80 : 125), m = J(
55
+ async () => {
56
+ var e, t;
57
+ return !a.src || f.value ? i.value.placeholder : typeof a.src == "string" ? (a.src.includes("http") || // From public image
58
+ /^data:image\/[a-zA-Z0-9.+-]+;base64,/.test(a.src) ? a.src : await ((t = (e = i.value).getImageURL) == null ? void 0 : t.call(e, a.src, R.value))) || i.value.placeholder : a.src;
59
+ },
60
+ i.value.placeholder
61
+ // Show placeholder while fetching image
62
+ ), y = d(), G = async () => {
63
+ var t, r, o, c;
64
+ if (y.value != null) return;
65
+ let e = m.value;
60
66
  if (typeof e == "string") {
61
- const s = (l = (t = c.value).getImageURL) == null ? void 0 : l.call(t, "preview"), i = s && !(s != null && s.includes("undefined")) ? new URL(s).origin : "", R = i && e.includes(i);
62
- return e.includes("http") && !R || // From public resource
63
- e.includes("data:image/svg+xml") ? e : (g = (a = c.value).getImageURL) == null ? void 0 : g.call(a, r.src);
67
+ const l = (r = (t = i.value).getImageURL) == null ? void 0 : r.call(t, "preview"), n = typeof l == "string" && !(l != null && l.includes("undefined")) ? new URL(l).origin : "", B = n && e.includes(n) || // For getImageURL that return the image full url
68
+ l instanceof Promise;
69
+ e = e.includes("http") && !B || // From public resource
70
+ e.includes("data:image/svg+xml") ? e : await ((c = (o = i.value).getImageURL) == null ? void 0 : c.call(o, a.src));
64
71
  }
65
- return e;
66
- }), y = (e) => {
67
- h(), typeof e == "number" && (o.value = e), L.value ? window.clearTimeout(L.value) : window.setTimeout($, 3e3);
68
- }, d = (e) => {
69
- var l;
70
- const t = (l = e.target) == null ? void 0 : l.src;
71
- (t === u.value || t.includes(u.value.toString())) && (w.value = !0);
72
- }, S = (e) => {
73
- var l, a;
72
+ y.value = e || i.value.placeholder;
73
+ }, h = (e) => {
74
+ w(), typeof e == "number" && (s.value = e), S.value ? window.clearTimeout(S.value) : window.setTimeout(L, 3e3);
75
+ }, v = (e) => {
76
+ var r;
77
+ const t = (r = e.target) == null ? void 0 : r.src;
78
+ (t === m.value || t.includes(m.value.toString())) && (f.value = !0);
79
+ }, U = (e) => {
80
+ var r, o, c;
74
81
  const t = e;
75
- return typeof t == "string" ? t.includes("http") ? t : (a = (l = c.value).getImageURL) == null ? void 0 : a.call(l, t) : t;
82
+ return typeof t == "string" ? t.includes("http") ? t : (c = (o = (r = i.value).getImageURL) == null ? void 0 : o.call(r, t)) == null ? void 0 : c.toString() : t;
76
83
  };
77
84
  return (e, t) => {
78
- var l;
79
- return n(), W(q(Q), I(e.$props, {
80
- preview: F.value,
81
- pt: { root: (l = e.$preset.image) == null ? void 0 : l.root({ props: e.$props }) }
82
- }), {
85
+ var r;
86
+ return u(), q(D(X), {
87
+ "image-class": e.imageClass,
88
+ "image-style": e.imageStyle,
89
+ preview: V.value,
90
+ pt: { root: (r = e.$preset.image) == null ? void 0 : r.root({ props: e.$props }) },
91
+ "zoom-in-disabled": e.zoomInDisabled,
92
+ "zoom-out-disabled": e.zoomOutDisabled,
93
+ onShow: G
94
+ }, {
83
95
  image: b(() => {
84
- var a;
96
+ var o;
85
97
  return [
86
- U("img", I((a = e.$preset.image) == null ? void 0 : a.image({ props: e.$props, context: { imageSize: B.value } }), {
87
- onerror: d,
88
- src: u.value,
98
+ $("img", T((o = e.$preset.image) == null ? void 0 : o.image({ props: e.$props, context: { imageSize: R.value } }), {
99
+ onerror: v,
100
+ src: D(m),
89
101
  alt: ""
90
- }), null, 16, Y)
102
+ }), null, 16, ee)
91
103
  ];
92
104
  }),
93
105
  indicatoricon: b(() => [
94
- C(X, I(e.$preset.image.icon, { icon: "eye" }), null, 16)
106
+ C(Y, T(e.$preset.image.icon, { icon: "eye" }), null, 16)
95
107
  ]),
96
- preview: b((a) => {
97
- var g;
108
+ preview: b((o) => {
109
+ var c;
98
110
  return [
99
- (g = e.galleries) != null && g.length ? (n(), m(_, { key: 1 }, [
100
- (n(!0), m(_, null, T(e.galleries, ({ src: s }, i) => A((n(), m("img", {
101
- key: i,
102
- onerror: d,
103
- src: S(s),
104
- style: k(a.style),
111
+ (c = e.galleries) != null && c.length ? (u(), g(z, { key: 1 }, [
112
+ (u(!0), g(z, null, O(e.galleries, ({ src: l }, n) => x((u(), g("img", {
113
+ key: n,
114
+ onerror: v,
115
+ src: U(l),
116
+ style: k(o.style),
105
117
  alt: "",
106
118
  "data-wv-section": "image-gallery"
107
- }, null, 12, ee)), [
108
- [H, i === o.value]
119
+ }, null, 12, ae)), [
120
+ [H, n === s.value]
109
121
  ])), 128)),
110
- U("div", {
111
- onClick: t[0] || (t[0] = D(() => {
122
+ $("div", {
123
+ onClick: t[0] || (t[0] = P(() => {
112
124
  }, ["stop"])),
113
125
  class: "fixed bottom-0 left-0 flex justify-center items-center w-full p-4 mx-auto flex-row bg-black/80",
114
126
  "data-wv-section": "gallery-thumbnail"
115
127
  }, [
116
- C(O, {
117
- class: z([
128
+ C(E, {
129
+ class: _([
118
130
  "text-surface-0 rotate-180 sticky left-0 !w-8 !h-8 [&_i]:w-5 [&_i]:h-5",
119
131
  "rounded-full mr-3"
120
132
  ]),
121
- onClick: P,
133
+ onClick: A,
122
134
  "aria-label": "Previous Image",
123
135
  "data-wv-section": "prev-button",
124
136
  icon: "arrow-right",
@@ -126,25 +138,25 @@ const Y = ["src"], Z = ["src"], ee = ["src"], te = ["src", "onClick"], ne = /* @
126
138
  severity: "secondary",
127
139
  text: ""
128
140
  }),
129
- (n(!0), m(_, null, T(e.galleries, ({ src: s }, i) => (n(), m("img", {
130
- key: i,
131
- class: z([
141
+ (u(!0), g(z, null, O(e.galleries, ({ src: l }, n) => (u(), g("img", {
142
+ key: n,
143
+ class: _([
132
144
  "h-10 w-10 object-cover cursor-pointer opacity-50 hover:opacity-100 transition-opacity",
133
- { "!opacity-100": o.value == i }
145
+ { "!opacity-100": s.value == n }
134
146
  ]),
135
- onerror: d,
136
- src: S(s),
137
- style: k(a.style),
138
- onClick: D((R) => y(i), ["stop"]),
147
+ onerror: v,
148
+ src: U(l),
149
+ style: k(o.style),
150
+ onClick: P((B) => h(n), ["stop"]),
139
151
  alt: "",
140
152
  "data-wv-section": "thumbnail-image"
141
- }, null, 14, te))), 128)),
142
- C(O, {
143
- class: z([
153
+ }, null, 14, re))), 128)),
154
+ C(E, {
155
+ class: _([
144
156
  "text-surface-0 sticky !w-8 !h-8 [&_i]:w-5 [&_i]:h-5",
145
157
  "rounded-full ml-3"
146
158
  ]),
147
- onClick: N,
159
+ onClick: j,
148
160
  "aria-label": "Next Image",
149
161
  "data-wv-section": "next-button",
150
162
  icon: "arrow-right",
@@ -152,20 +164,20 @@ const Y = ["src"], Z = ["src"], ee = ["src"], te = ["src", "onClick"], ne = /* @
152
164
  text: ""
153
165
  })
154
166
  ])
155
- ], 64)) : (n(), m("img", {
167
+ ], 64)) : (u(), g("img", {
156
168
  key: 0,
157
- onerror: d,
158
- src: V.value,
159
- style: k(a.style),
169
+ onerror: v,
170
+ src: y.value,
171
+ style: k(o.style),
160
172
  alt: ""
161
- }, null, 12, Z))
173
+ }, null, 12, te))
162
174
  ];
163
175
  }),
164
176
  _: 1
165
- }, 16, ["preview", "pt"]);
177
+ }, 8, ["image-class", "image-style", "preview", "pt", "zoom-in-disabled", "zoom-out-disabled"]);
166
178
  };
167
179
  }
168
180
  });
169
181
  export {
170
- ne as _
182
+ me as _
171
183
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fewangsit/wangsvue-fats",
3
- "version": "1.0.1-alpha.35",
3
+ "version": "1.0.1-alpha.36",
4
4
  "author": "Wangsit FE Developer",
5
5
  "description": "Fixed Asset Tagsamurai VueJS Component Library",
6
6
  "type": "module",