ablok-components 0.3.86 → 0.3.87

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,4 +1,4 @@
1
- import { defineComponent as L, ref as y, toRef as N, computed as P, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as v, Fragment as V, renderList as T, renderSlot as S, createElementVNode as c, withModifiers as w, createVNode as m, Transition as M, withCtx as H, createCommentVNode as W } from "vue";
1
+ import { defineComponent as L, ref as y, toRef as M, computed as N, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as v, Fragment as V, renderList as P, renderSlot as S, createElementVNode as c, withModifiers as w, createVNode as p, Transition as T, withCtx as H, createCommentVNode as W } from "vue";
2
2
  import k from "../../atoms/svg-icon/svg-icon.vue.js";
3
3
  /* empty css */
4
4
  import q from "../../atoms/input-file/input-file.vue.js";
@@ -10,7 +10,7 @@ import { uniqueId as F } from "../../../utilities/helpers.js";
10
10
  const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTML"], K = {
11
11
  key: 0,
12
12
  class: "file-upload__loading-spinner"
13
- }, oe = /* @__PURE__ */ L({
13
+ }, ne = /* @__PURE__ */ L({
14
14
  __name: "file-upload",
15
15
  props: {
16
16
  modelValue: {
@@ -102,93 +102,96 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
102
102
  }
103
103
  },
104
104
  emits: ["update:modelValue", "update:src"],
105
- setup(a, { emit: U }) {
106
- const e = a, i = U, g = y(), p = y([]), o = y([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: C } = R(N(e, "localUrlFormat")), { isDragging: z } = E(g, {
105
+ setup(o, { emit: U }) {
106
+ const e = o, i = U, g = y(), m = y([]), n = y([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: z } = R(M(e, "localUrlFormat")), { isDragging: C } = E(g, {
107
107
  enabled: () => e.dropFiles,
108
108
  onDrop: (t) => {
109
- p.value = t;
109
+ m.value = t;
110
110
  }
111
- }), A = P(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : o.value);
111
+ }), A = N(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : n.value);
112
112
  function f(t) {
113
- const l = typeof t == "string" ? parseInt(t, 10) : t, n = Array.isArray(e.modelValue) && e.modelValue.length > 0, s = Array.isArray(o.value) && o.value.length > 0;
114
- if (s && l < o.value.length && (C(o.value[l]?.src), o.value.splice(l, 1)), n) {
115
- const r = [...e.modelValue];
116
- l < r.length && r.splice(l, 1), i("update:modelValue", r), e.multiple || i("update:src", r[0]?.src || "");
117
- } else if (s) {
118
- const r = e.multiple ? o.value : o.value[0];
119
- i("update:modelValue", r), e.multiple || i("update:src", o.value[0]?.src || "");
113
+ const l = typeof t == "string" ? parseInt(t, 10) : t, a = Array.isArray(e.modelValue) && e.modelValue.length > 0, r = Array.isArray(n.value) && n.value.length > 0;
114
+ if (r && l < n.value.length && (z(n.value[l]?.src), n.value.splice(l, 1)), a) {
115
+ const s = [...e.modelValue];
116
+ l < s.length && s.splice(l, 1), i("update:modelValue", s), e.multiple || i("update:src", s[0]?.src || "");
117
+ } else if (r) {
118
+ const s = e.multiple ? n.value : n.value[0];
119
+ i("update:modelValue", s), e.multiple || i("update:src", n.value[0]?.src || "");
120
120
  } else
121
121
  i("update:modelValue", e.multiple ? [] : void 0), i("update:src", "");
122
- p.value.splice(l, 1);
122
+ m.value.splice(l, 1);
123
123
  }
124
- return b(() => p.value, async (t) => {
124
+ return b(() => m.value, async (t) => {
125
125
  const l = await Promise.all(
126
- t.map(async (n) => ({
127
- src: e.toDataUrl ? await D(n) : await B(n),
128
- type: n.type
126
+ t.map(async (a) => ({
127
+ src: e.toDataUrl ? await D(a) : await B(a),
128
+ type: a.type,
129
+ name: a.name,
130
+ size: a.size,
131
+ lastModified: a.lastModified
129
132
  }))
130
133
  );
131
- o.value = l.filter((n) => n !== null);
132
- }, { deep: !0 }), b(() => o.value, async (t) => {
134
+ n.value = l;
135
+ }, { deep: !0 }), b(() => n.value, async (t) => {
133
136
  const l = e.multiple ? t : t[0];
134
137
  i("update:modelValue", l), e.multiple || i("update:src", t[0] && t[0].src);
135
138
  }, { deep: !0 }), (t, l) => (u(), d("div", {
136
139
  ref_key: "root",
137
140
  ref: g,
138
141
  class: h(["file-upload", {
139
- "has-dragging": a.dropFiles,
140
- "is-dragging": v(z)
142
+ "has-dragging": o.dropFiles,
143
+ "is-dragging": v(C)
141
144
  }])
142
145
  }, [
143
- (u(!0), d(V, null, T(A.value, (n, s) => (u(), d("div", {
144
- key: n.src,
145
- class: h(a.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
146
+ (u(!0), d(V, null, P(A.value, (a, r) => (u(), d("div", {
147
+ key: a.src,
148
+ class: h(o.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
146
149
  }, [
147
150
  S(t.$slots, "preview-item", {
148
- bind: { item: n, index: s },
151
+ bind: { item: a, index: r },
149
152
  on: { removeFile: f }
150
153
  }, () => [
151
- a.enablePreview ? (u(), d(V, { key: 0 }, [
154
+ o.enablePreview ? (u(), d(V, { key: 0 }, [
152
155
  c("img", {
153
- src: `${n.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
156
+ src: `${a.src}${o.previewWidth ? `?width=${o.previewWidth}` : ""}`,
154
157
  class: "img-thumbnail rounded"
155
158
  }, null, 8, _),
156
159
  c("button", {
157
- onClick: w((r) => f(s), ["prevent"]),
160
+ onClick: w((s) => f(r), ["prevent"]),
158
161
  class: "btn btn--close"
159
162
  }, [
160
- m(k, { symbol: "x" })
163
+ p(k, { symbol: "x" })
161
164
  ], 8, j)
162
165
  ], 64)) : (u(), d("button", {
163
166
  key: 1,
164
- onClick: w((r) => f(s), ["prevent"]),
167
+ onClick: w((s) => f(r), ["prevent"]),
165
168
  class: "btn btn--close btn-outline-contrast"
166
169
  }, [
167
- m(k, { symbol: "x" })
170
+ p(k, { symbol: "x" })
168
171
  ], 8, x))
169
172
  ])
170
173
  ], 2))), 128)),
171
- m(q, {
172
- modelValue: p.value,
173
- "onUpdate:modelValue": l[0] || (l[0] = (n) => p.value = n),
174
- id: a.id,
175
- name: a.name,
176
- accept: a.accept,
177
- "max-file-size": a.maxFileSize,
178
- multiple: a.multiple,
174
+ p(q, {
175
+ modelValue: m.value,
176
+ "onUpdate:modelValue": l[0] || (l[0] = (a) => m.value = a),
177
+ id: o.id,
178
+ name: o.name,
179
+ accept: o.accept,
180
+ "max-file-size": o.maxFileSize,
181
+ multiple: o.multiple,
179
182
  class: "d-none"
180
183
  }, null, 8, ["modelValue", "id", "name", "accept", "max-file-size", "multiple"]),
181
184
  c("label", {
182
- for: a.id,
185
+ for: o.id,
183
186
  class: "file-upload__label"
184
187
  }, [
185
188
  S(t.$slots, "button", {}, () => [
186
189
  c("span", {
187
190
  class: "btn btn-outline-contrast",
188
- innerHTML: v(O)(a.label || t.$t("common.selectFile"))
191
+ innerHTML: v(O)(o.label || t.$t("common.selectFile"))
189
192
  }, null, 8, J)
190
193
  ]),
191
- m(M, { name: "fade" }, {
194
+ p(T, { name: "fade" }, {
192
195
  default: H(() => [
193
196
  v($) ? (u(), d("span", K, [...l[1] || (l[1] = [
194
197
  c("span", {
@@ -206,5 +209,5 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
206
209
  }
207
210
  });
208
211
  export {
209
- oe as default
212
+ ne as default
210
213
  };
package/package.json CHANGED
@@ -1,23 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.86",
5
- "scripts": {
6
- "dev": "vite --host",
7
- "story:dev": "histoire dev",
8
- "story:build": "histoire build",
9
- "story:preview": "histoire preview",
10
- "build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
11
- "build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
12
- "preview": "vite preview",
13
- "build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
14
- "build-lib": "vite build && vue-tsc --emitDeclarationOnly",
15
- "release": "bash ./scripts/release.sh",
16
- "postrelease": "bash ./scripts/publish.sh",
17
- "test": "vitest run",
18
- "test:watch": "vitest",
19
- "test:ui": "vitest --ui"
20
- },
4
+ "version": "0.3.87",
21
5
  "dependencies": {
22
6
  "date-fns": "^3.0.0",
23
7
  "dompurify": "^3.3.1",
@@ -136,5 +120,21 @@
136
120
  "./package.json": "./package.json"
137
121
  },
138
122
  "types": "./dist/index.d.ts",
139
- "sideEffects": false
140
- }
123
+ "sideEffects": false,
124
+ "scripts": {
125
+ "dev": "vite --host",
126
+ "story:dev": "histoire dev",
127
+ "story:build": "histoire build",
128
+ "story:preview": "histoire preview",
129
+ "build": "vue-tsc --noEmit --project tsconfig.build.json && vite build",
130
+ "build:watch": "vue-tsc --noEmit --watch --project tsconfig.build.json & vite build --watch",
131
+ "preview": "vite preview",
132
+ "build-lib-bak": "vite build && vue-tsc --emitDeclarationOnly && mv dist/src dist/types",
133
+ "build-lib": "vite build && vue-tsc --emitDeclarationOnly",
134
+ "release": "bash ./scripts/release.sh",
135
+ "postrelease": "bash ./scripts/publish.sh",
136
+ "test": "vitest run",
137
+ "test:watch": "vitest",
138
+ "test:ui": "vitest --ui"
139
+ }
140
+ }