ablok-components 0.3.83 → 0.3.85

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,10 +1,10 @@
1
- import { defineComponent as w, computed as T, ref as _, resolveComponent as b, openBlock as r, createElementBlock as d, createElementVNode as o, toDisplayString as U, createCommentVNode as H, createVNode as u, withCtx as h, withDirectives as L, vModelText as N, withModifiers as y, nextTick as S } from "vue";
2
- import x from "../file-upload/file-upload.vue.js";
1
+ import { defineComponent as w, computed as T, ref as v, resolveComponent as y, openBlock as p, createElementBlock as _, createElementVNode as o, toDisplayString as x, createCommentVNode as U, createVNode as d, withCtx as g, withDirectives as H, vModelText as I, withModifiers as V, nextTick as L } from "vue";
2
+ import N from "../file-upload/file-upload.vue.js";
3
3
  /* empty css */
4
- const A = { class: "container" }, B = { class: "row" }, E = { class: "col-12" }, I = {
4
+ const S = { class: "container" }, A = { class: "row" }, B = { class: "col-12" }, E = {
5
5
  key: 0,
6
6
  class: "grid place-items-center text-center text-muted py-5 border border-bottom-0"
7
- }, D = { class: "m-0" }, F = { class: "preview-item border-bottom p-3" }, j = { class: "d-flex gap-3" }, q = { class: "col-2" }, z = { class: "col" }, G = ["onUpdate:modelValue", "id"], J = ["innerHTML"], K = { class: "col-auto d-flex flex-column gap-2" }, O = ["onClick"], P = ["onClick"], Q = { class: "d-flex align-items-end p-3" }, R = ["innerHTML"], Z = /* @__PURE__ */ w({
7
+ }, z = { class: "m-0" }, D = { class: "preview-item border-bottom p-3" }, F = { class: "d-flex gap-3" }, j = { class: "col-2" }, q = { class: "col" }, R = ["onUpdate:modelValue", "id"], G = ["innerHTML"], J = { class: "col-auto d-flex flex-column gap-2" }, K = ["onClick"], O = ["onClick"], P = { class: "d-flex align-items-end p-3" }, Q = { class: "btn btn-primary btn-sm ms-auto d-flex align-items-center gap-2" }, W = ["innerHTML"], ee = /* @__PURE__ */ w({
8
8
  __name: "bulk-upload",
9
9
  props: {
10
10
  storeId: String,
@@ -25,99 +25,108 @@ const A = { class: "container" }, B = { class: "row" }, E = { class: "col-12" },
25
25
  }
26
26
  },
27
27
  emits: ["update:modelValue"],
28
- setup(g, { emit: k }) {
29
- const V = g, C = k, s = T({
28
+ setup(k, { emit: M }) {
29
+ const f = k, b = M, n = T({
30
30
  get: () => {
31
- const e = V.modelValue || [];
32
- return a.value = e.map((t) => t.caption || ""), e.map((t) => ({ type: t.type, src: t.src }));
31
+ const e = f.modelValue || [];
32
+ return c.value = e.map((t) => t.caption || ""), e.map((t) => ({ type: t.type, src: t.src }));
33
33
  },
34
34
  set: (e) => {
35
- const t = s.value || [], c = Array.isArray(e) ? e : [];
36
- m([...t, ...c]);
35
+ const t = n.value || [], s = Array.isArray(e) ? e : [], i = s.length <= t.length && s.every((r) => t.some((l) => l.src === r.src));
36
+ u(i ? s : [...t, ...s]);
37
37
  }
38
- }), v = _(null), n = _({}), a = _({});
39
- async function M(e) {
40
- n.value[e] = !n.value[e], n.value[e] || m(), await S(), v.value?.querySelector(`#caption-${e}`)?.focus();
38
+ }), h = v(null), a = v({}), c = v({});
39
+ function C(e) {
40
+ const t = [...f.modelValue || []];
41
+ t.splice(e, 1), b("update:modelValue", t);
41
42
  }
42
- function m(e) {
43
- C("update:modelValue", (e || s.value).map((t, c) => ({
43
+ async function $(e) {
44
+ a.value[e] = !a.value[e], a.value[e] || u(), await L(), h.value?.querySelector(`#caption-${e}`)?.focus();
45
+ }
46
+ function u(e) {
47
+ b("update:modelValue", (e || n.value).map((t, s) => ({
44
48
  ...t,
45
- caption: a.value[c] || ""
49
+ caption: c.value[s] || ""
46
50
  })));
47
51
  }
48
52
  return (e, t) => {
49
- const c = b("base-image"), f = b("svg-icon");
50
- return r(), d("div", {
53
+ const s = y("base-image"), i = y("svg-icon");
54
+ return p(), _("div", {
51
55
  class: "bulk-upload",
52
56
  ref_key: "root",
53
- ref: v
57
+ ref: h
54
58
  }, [
55
- o("div", A, [
56
- o("div", B, [
57
- o("div", E, [
58
- s.value.length ? H("", !0) : (r(), d("div", I, [
59
- o("p", D, U(e.$t("fileInput.noFilesSelected")), 1)
59
+ o("div", S, [
60
+ o("div", A, [
61
+ o("div", B, [
62
+ n.value.length ? U("", !0) : (p(), _("div", E, [
63
+ o("p", z, x(e.$t("fileInput.noFilesSelected")), 1)
60
64
  ])),
61
- u(x, {
62
- modelValue: s.value,
63
- "onUpdate:modelValue": t[1] || (t[1] = (p) => s.value = p),
65
+ d(N, {
66
+ modelValue: n.value,
67
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => n.value = r),
64
68
  multiple: !0,
65
69
  accept: "image/*",
66
70
  "drop-files": !0,
67
71
  "to-data-url": !0,
68
72
  "local-url-format": "objectUrl",
69
- class: "d-flex flex-column align-items-end border"
73
+ class: "d-flex flex-column border"
70
74
  }, {
71
- "preview-item": h(({ bind: { item: p, index: l }, on: { removeFile: $ } }) => [
72
- o("div", F, [
73
- o("div", j, [
74
- o("div", q, [
75
- u(c, {
76
- src: p.src,
75
+ "preview-item": g(({ bind: { item: r, index: l } }) => [
76
+ o("div", D, [
77
+ o("div", F, [
78
+ o("div", j, [
79
+ d(s, {
80
+ src: r.src,
77
81
  alt: "",
78
82
  class: "img-thumbnail"
79
83
  }, null, 8, ["src"])
80
84
  ]),
81
- o("div", z, [
82
- n.value[l] ? L((r(), d("textarea", {
85
+ o("div", q, [
86
+ a.value[l] ? H((p(), _("textarea", {
83
87
  key: 0,
84
- "onUpdate:modelValue": (i) => a.value[l] = i,
88
+ "onUpdate:modelValue": (m) => c.value[l] = m,
85
89
  id: `caption-${l}`,
86
90
  class: "form-control rounded-0 h-100",
87
- onChangeCapture: t[0] || (t[0] = (i) => m())
88
- }, null, 40, G)), [
89
- [N, a.value[l]]
90
- ]) : (r(), d("p", {
91
+ onChangeCapture: t[0] || (t[0] = (m) => u())
92
+ }, null, 40, R)), [
93
+ [I, c.value[l]]
94
+ ]) : (p(), _("p", {
91
95
  key: 1,
92
96
  class: "m-0",
93
- innerHTML: a.value[l] || `<small>${e.$t("fileInput.noCaption")}</small>`
94
- }, null, 8, J))
97
+ innerHTML: c.value[l] || `<small>${e.$t("fileInput.noCaption")}</small>`
98
+ }, null, 8, G))
95
99
  ]),
96
- o("div", K, [
100
+ o("div", J, [
97
101
  o("button", {
98
- onClick: y((i) => $(l), ["prevent"]),
102
+ onClick: V((m) => C(l), ["prevent"]),
99
103
  class: "btn btn--close"
100
104
  }, [
101
- u(f, { symbol: "x" })
102
- ], 8, O),
105
+ d(i, { symbol: "x" })
106
+ ], 8, K),
103
107
  o("button", {
104
- onClick: y((i) => M(l), ["prevent"]),
108
+ onClick: V((m) => $(l), ["prevent"]),
105
109
  class: "btn btn--close"
106
110
  }, [
107
- u(f, {
108
- symbol: n.value[l] ? "check" : "edit-3"
111
+ d(i, {
112
+ symbol: a.value[l] ? "check" : "edit-3"
109
113
  }, null, 8, ["symbol"])
110
- ], 8, P)
114
+ ], 8, O)
111
115
  ])
112
116
  ])
113
117
  ])
114
118
  ]),
115
- button: h(() => [
116
- o("span", Q, [
117
- o("span", {
118
- class: "btn btn-primary btn-sm",
119
- innerHTML: e.$t("common.selectFile")
120
- }, null, 8, R)
119
+ button: g(() => [
120
+ o("span", P, [
121
+ o("span", Q, [
122
+ d(i, {
123
+ symbol: "upload",
124
+ size: "small"
125
+ }),
126
+ o("span", {
127
+ innerHTML: e.$t("common.selectFile")
128
+ }, null, 8, W)
129
+ ])
121
130
  ])
122
131
  ]),
123
132
  _: 1
@@ -130,5 +139,5 @@ const A = { class: "container" }, B = { class: "row" }, E = { class: "col-12" },
130
139
  }
131
140
  });
132
141
  export {
133
- Z as default
142
+ ee as default
134
143
  };
package/package.json CHANGED
@@ -1,23 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.83",
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.85",
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
+ }