ablok-components 0.3.81 → 0.3.84

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.
@@ -0,0 +1,128 @@
1
+ declare const _default: import('../../../../vue/dist/vue.esm-bundler.js').DefineComponent<import('../../../../vue/dist/vue.esm-bundler.js').ExtractPropTypes<{
2
+ storeId: StringConstructor;
3
+ modelValue: {
4
+ type: {
5
+ (arrayLength: number): {
6
+ type?: string;
7
+ caption?: string;
8
+ src?: any;
9
+ }[];
10
+ (...items: {
11
+ type?: string;
12
+ caption?: string;
13
+ src?: any;
14
+ }[]): {
15
+ type?: string;
16
+ caption?: string;
17
+ src?: any;
18
+ }[];
19
+ new (arrayLength: number): {
20
+ type?: string;
21
+ caption?: string;
22
+ src?: any;
23
+ }[];
24
+ new (...items: {
25
+ type?: string;
26
+ caption?: string;
27
+ src?: any;
28
+ }[]): {
29
+ type?: string;
30
+ caption?: string;
31
+ src?: any;
32
+ }[];
33
+ isArray(arg: any): arg is any[];
34
+ readonly prototype: any[];
35
+ from<T>(arrayLike: ArrayLike<T>): T[];
36
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
37
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
38
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
39
+ of<T>(...items: T[]): T[];
40
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
41
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
42
+ readonly [Symbol.species]: ArrayConstructor;
43
+ };
44
+ default: never[];
45
+ };
46
+ disabled: {
47
+ type: BooleanConstructor;
48
+ default: boolean;
49
+ };
50
+ size: {
51
+ type: NumberConstructor;
52
+ default: () => number;
53
+ };
54
+ messages: {
55
+ type: null;
56
+ };
57
+ }>, {}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {
58
+ "update:modelValue": (...args: any[]) => void;
59
+ }, string, import('../../../../vue/dist/vue.esm-bundler.js').PublicProps, Readonly<import('../../../../vue/dist/vue.esm-bundler.js').ExtractPropTypes<{
60
+ storeId: StringConstructor;
61
+ modelValue: {
62
+ type: {
63
+ (arrayLength: number): {
64
+ type?: string;
65
+ caption?: string;
66
+ src?: any;
67
+ }[];
68
+ (...items: {
69
+ type?: string;
70
+ caption?: string;
71
+ src?: any;
72
+ }[]): {
73
+ type?: string;
74
+ caption?: string;
75
+ src?: any;
76
+ }[];
77
+ new (arrayLength: number): {
78
+ type?: string;
79
+ caption?: string;
80
+ src?: any;
81
+ }[];
82
+ new (...items: {
83
+ type?: string;
84
+ caption?: string;
85
+ src?: any;
86
+ }[]): {
87
+ type?: string;
88
+ caption?: string;
89
+ src?: any;
90
+ }[];
91
+ isArray(arg: any): arg is any[];
92
+ readonly prototype: any[];
93
+ from<T>(arrayLike: ArrayLike<T>): T[];
94
+ from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
95
+ from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
96
+ from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
97
+ of<T>(...items: T[]): T[];
98
+ fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
99
+ fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
100
+ readonly [Symbol.species]: ArrayConstructor;
101
+ };
102
+ default: never[];
103
+ };
104
+ disabled: {
105
+ type: BooleanConstructor;
106
+ default: boolean;
107
+ };
108
+ size: {
109
+ type: NumberConstructor;
110
+ default: () => number;
111
+ };
112
+ messages: {
113
+ type: null;
114
+ };
115
+ }>> & Readonly<{
116
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
117
+ }>, {
118
+ size: number;
119
+ modelValue: {
120
+ type?: string;
121
+ caption?: string;
122
+ src?: any;
123
+ }[];
124
+ disabled: boolean;
125
+ }, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {
126
+ root: HTMLDivElement;
127
+ }, HTMLDivElement>;
128
+ export default _default;
@@ -0,0 +1,143 @@
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
+ /* empty css */
4
+ const S = { class: "container" }, A = { class: "row" }, B = { class: "col-12" }, E = {
5
+ key: 0,
6
+ class: "grid place-items-center text-center text-muted py-5 border border-bottom-0"
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
+ __name: "bulk-upload",
9
+ props: {
10
+ storeId: String,
11
+ modelValue: {
12
+ type: Array,
13
+ default: []
14
+ },
15
+ disabled: {
16
+ type: Boolean,
17
+ default: !1
18
+ },
19
+ size: {
20
+ type: Number,
21
+ default: () => 120
22
+ },
23
+ messages: {
24
+ type: null
25
+ }
26
+ },
27
+ emits: ["update:modelValue"],
28
+ setup(k, { emit: M }) {
29
+ const f = k, b = M, n = T({
30
+ get: () => {
31
+ const e = f.modelValue || [];
32
+ return c.value = e.map((t) => t.caption || ""), e.map((t) => ({ type: t.type, src: t.src }));
33
+ },
34
+ set: (e) => {
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
+ }
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);
42
+ }
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) => ({
48
+ ...t,
49
+ caption: c.value[s] || ""
50
+ })));
51
+ }
52
+ return (e, t) => {
53
+ const s = y("base-image"), i = y("svg-icon");
54
+ return p(), _("div", {
55
+ class: "bulk-upload",
56
+ ref_key: "root",
57
+ ref: h
58
+ }, [
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)
64
+ ])),
65
+ d(N, {
66
+ modelValue: n.value,
67
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => n.value = r),
68
+ multiple: !0,
69
+ accept: "image/*",
70
+ "drop-files": !0,
71
+ "to-data-url": !0,
72
+ "local-url-format": "objectUrl",
73
+ class: "d-flex flex-column border"
74
+ }, {
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,
81
+ alt: "",
82
+ class: "img-thumbnail"
83
+ }, null, 8, ["src"])
84
+ ]),
85
+ o("div", q, [
86
+ a.value[l] ? H((p(), _("textarea", {
87
+ key: 0,
88
+ "onUpdate:modelValue": (m) => c.value[l] = m,
89
+ id: `caption-${l}`,
90
+ class: "form-control rounded-0 h-100",
91
+ onChangeCapture: t[0] || (t[0] = (m) => u())
92
+ }, null, 40, R)), [
93
+ [I, c.value[l]]
94
+ ]) : (p(), _("p", {
95
+ key: 1,
96
+ class: "m-0",
97
+ innerHTML: c.value[l] || `<small>${e.$t("fileInput.noCaption")}</small>`
98
+ }, null, 8, G))
99
+ ]),
100
+ o("div", J, [
101
+ o("button", {
102
+ onClick: V((m) => C(l), ["prevent"]),
103
+ class: "btn btn--close"
104
+ }, [
105
+ d(i, { symbol: "x" })
106
+ ], 8, K),
107
+ o("button", {
108
+ onClick: V((m) => $(l), ["prevent"]),
109
+ class: "btn btn--close"
110
+ }, [
111
+ d(i, {
112
+ symbol: a.value[l] ? "check" : "edit-3"
113
+ }, null, 8, ["symbol"])
114
+ ], 8, O)
115
+ ])
116
+ ])
117
+ ])
118
+ ]),
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
+ ])
130
+ ])
131
+ ]),
132
+ _: 1
133
+ }, 8, ["modelValue"])
134
+ ])
135
+ ])
136
+ ])
137
+ ], 512);
138
+ };
139
+ }
140
+ });
141
+ export {
142
+ ee as default
143
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./bulk-upload.vue.js";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -1,14 +1,20 @@
1
1
  import { PropType } from '../../../../vue/dist/vue.esm-bundler.js';
2
2
  import { LocalUrlFormat } from '../../../composables/useLocalFileUrl';
3
+ declare function removeFile(index: number | string): void;
3
4
  declare function __VLS_template(): {
4
5
  attrs: Partial<{}>;
5
6
  slots: {
6
7
  'preview-item'?(_: {
7
- item: {
8
- type?: string;
9
- src?: string;
8
+ bind: {
9
+ item: {
10
+ type?: string;
11
+ src?: string;
12
+ };
13
+ index: number;
14
+ };
15
+ on: {
16
+ removeFile: typeof removeFile;
10
17
  };
11
- index: number;
12
18
  }): any;
13
19
  button?(_: {}): any;
14
20
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as L, ref as f, toRef as N, computed as P, watch as b, openBlock as u, createElementBlock as d, normalizeClass as h, unref as y, 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 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";
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
- }, ne = /* @__PURE__ */ L({
13
+ }, oe = /* @__PURE__ */ L({
14
14
  __name: "file-upload",
15
15
  props: {
16
16
  modelValue: {
@@ -103,65 +103,65 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
103
103
  },
104
104
  emits: ["update:modelValue", "update:src"],
105
105
  setup(a, { emit: U }) {
106
- const e = a, i = U, v = f(), p = f([]), n = f([]), { pending: $, uploadFile: B } = I(e), { toLocalUrl: D, revoke: C } = R(N(e, "localUrlFormat")), { isDragging: z } = E(v, {
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, {
107
107
  enabled: () => e.dropFiles,
108
108
  onDrop: (t) => {
109
109
  p.value = t;
110
110
  }
111
- }), A = P(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : n.value);
112
- function g(t) {
113
- const l = typeof t == "string" ? parseInt(t, 10) : t, o = Array.isArray(e.modelValue) && e.modelValue.length > 0, s = Array.isArray(n.value) && n.value.length > 0;
114
- if (s && l < n.value.length && (C(n.value[l]?.src), n.value.splice(l, 1)), o) {
111
+ }), A = P(() => e.modelValue?.length ? e.modelValue : e.src ? [{ type: "", src: e.src }] : o.value);
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
115
  const r = [...e.modelValue];
116
116
  l < r.length && r.splice(l, 1), i("update:modelValue", r), e.multiple || i("update:src", r[0]?.src || "");
117
117
  } else if (s) {
118
- const r = e.multiple ? n.value : n.value[0];
119
- i("update:modelValue", r), e.multiple || i("update:src", n.value[0]?.src || "");
118
+ const r = e.multiple ? o.value : o.value[0];
119
+ i("update:modelValue", r), e.multiple || i("update:src", o.value[0]?.src || "");
120
120
  } else
121
121
  i("update:modelValue", e.multiple ? [] : void 0), i("update:src", "");
122
122
  p.value.splice(l, 1);
123
123
  }
124
124
  return b(() => p.value, async (t) => {
125
125
  const l = await Promise.all(
126
- t.map(async (o) => ({
127
- src: e.toDataUrl ? await D(o) : await B(o),
128
- type: o.type
126
+ t.map(async (n) => ({
127
+ src: e.toDataUrl ? await D(n) : await B(n),
128
+ type: n.type
129
129
  }))
130
130
  );
131
- n.value = l.filter((o) => o !== null);
132
- }, { deep: !0 }), b(() => n.value, async (t) => {
131
+ o.value = l.filter((n) => n !== null);
132
+ }, { deep: !0 }), b(() => o.value, async (t) => {
133
133
  const l = e.multiple ? t : t[0];
134
134
  i("update:modelValue", l), e.multiple || i("update:src", t[0] && t[0].src);
135
135
  }, { deep: !0 }), (t, l) => (u(), d("div", {
136
136
  ref_key: "root",
137
- ref: v,
137
+ ref: g,
138
138
  class: h(["file-upload", {
139
139
  "has-dragging": a.dropFiles,
140
- "is-dragging": y(z)
140
+ "is-dragging": v(z)
141
141
  }])
142
142
  }, [
143
- (u(!0), d(V, null, T(A.value, (o, s) => (u(), d("div", {
144
- key: o.src,
143
+ (u(!0), d(V, null, T(A.value, (n, s) => (u(), d("div", {
144
+ key: n.src,
145
145
  class: h(a.enablePreview ? "file-upload__thumbnail" : "file-upload__reset")
146
146
  }, [
147
147
  S(t.$slots, "preview-item", {
148
- item: o,
149
- index: s
148
+ bind: { item: n, index: s },
149
+ on: { removeFile: f }
150
150
  }, () => [
151
151
  a.enablePreview ? (u(), d(V, { key: 0 }, [
152
152
  c("img", {
153
- src: `${o.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
153
+ src: `${n.src}${a.previewWidth ? `?width=${a.previewWidth}` : ""}`,
154
154
  class: "img-thumbnail rounded"
155
155
  }, null, 8, _),
156
156
  c("button", {
157
- onClick: w((r) => g(s), ["prevent"]),
157
+ onClick: w((r) => f(s), ["prevent"]),
158
158
  class: "btn btn--close"
159
159
  }, [
160
160
  m(k, { symbol: "x" })
161
161
  ], 8, j)
162
162
  ], 64)) : (u(), d("button", {
163
163
  key: 1,
164
- onClick: w((r) => g(s), ["prevent"]),
164
+ onClick: w((r) => f(s), ["prevent"]),
165
165
  class: "btn btn--close btn-outline-contrast"
166
166
  }, [
167
167
  m(k, { symbol: "x" })
@@ -170,7 +170,7 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
170
170
  ], 2))), 128)),
171
171
  m(q, {
172
172
  modelValue: p.value,
173
- "onUpdate:modelValue": l[0] || (l[0] = (o) => p.value = o),
173
+ "onUpdate:modelValue": l[0] || (l[0] = (n) => p.value = n),
174
174
  id: a.id,
175
175
  name: a.name,
176
176
  accept: a.accept,
@@ -185,12 +185,12 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
185
185
  S(t.$slots, "button", {}, () => [
186
186
  c("span", {
187
187
  class: "btn btn-outline-contrast",
188
- innerHTML: y(O)(a.label || t.$t("common.selectFile"))
188
+ innerHTML: v(O)(a.label || t.$t("common.selectFile"))
189
189
  }, null, 8, J)
190
190
  ]),
191
191
  m(M, { name: "fade" }, {
192
192
  default: H(() => [
193
- y($) ? (u(), d("span", K, [...l[1] || (l[1] = [
193
+ v($) ? (u(), d("span", K, [...l[1] || (l[1] = [
194
194
  c("span", {
195
195
  class: "spinner-border",
196
196
  role: "status"
@@ -206,5 +206,5 @@ const _ = ["src"], j = ["onClick"], x = ["onClick"], G = ["for"], J = ["innerHTM
206
206
  }
207
207
  });
208
208
  export {
209
- ne as default
209
+ oe as default
210
210
  };
package/dist/i18n.d.ts CHANGED
@@ -96,6 +96,8 @@ declare const i18n: import('vue-i18n').I18n<{
96
96
  dropTargetLabel: string;
97
97
  shoot: string;
98
98
  fileTooLarge: string;
99
+ noFilesSelected: string;
100
+ noCaption: string;
99
101
  };
100
102
  editor: {
101
103
  header: {
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export { default as BaseCamera } from './components/molecules/base-camera/base-c
28
28
  export { default as BaseMap } from './components/molecules/base-map/base-map.vue';
29
29
  export { default as LocationList } from './components/molecules/location-list/location-list.vue';
30
30
  export { default as FileUpload } from './components/molecules/file-upload/file-upload.vue';
31
+ export { default as BulkUpload } from './components/molecules/bulk-upload/bulk-upload.vue';
31
32
  export { default as UploadGroup } from './components/molecules/upload-group/upload-group.vue';
32
33
  export { default as AssetUploader } from './components/organisms/asset-uploader/asset-uploader.vue';
33
34
  export { default as PresetUploader } from './components/organisms/preset-uploader/preset-uploader.vue';