ablok-components 0.3.96 → 0.3.97

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,18 +1,18 @@
1
- import { defineComponent as Z, shallowRef as T, onMounted as U, computed as y, watch as C, openBlock as i, createElementBlock as g, normalizeClass as N, renderSlot as A, createElementVNode as s, unref as R, createCommentVNode as h, createBlock as v, resolveDynamicComponent as S } from "vue";
2
- import { uniqueId as B } from "../../../utilities/helpers.js";
1
+ import { defineComponent as P, shallowRef as j, onMounted as F, computed as S, ref as Y, watch as z, openBlock as o, createElementBlock as V, normalizeClass as E, renderSlot as w, createElementVNode as c, unref as K, createCommentVNode as x, createBlock as b, resolveDynamicComponent as A } from "vue";
2
+ import { uniqueId as M } from "../../../utilities/helpers.js";
3
3
  /* empty css */
4
- import { useI18n as j } from "vue-i18n";
5
- import { sanitizeHtml as L } from "../../../composables/useSanitize.js";
6
- import { fr as P } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr.js";
7
- import { de as Y } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de.js";
8
- import { enUS as I } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US.js";
9
- const z = { class: "row" }, E = { class: "col-12" }, F = ["for", "innerHTML"], K = { key: 0 }, G = { class: "input-group justify-content-center" }, J = {
4
+ import { useI18n as G } from "vue-i18n";
5
+ import { sanitizeHtml as J } from "../../../composables/useSanitize.js";
6
+ import { fr as Q } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/fr.js";
7
+ import { de as W } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/de.js";
8
+ import { enUS as O } from "../../../node_modules/.pnpm/date-fns@3.6.0/node_modules/date-fns/locale/en-US.js";
9
+ const X = { class: "row" }, _ = { class: "col-12" }, ee = ["for", "innerHTML"], te = { key: 0 }, le = { class: "input-group justify-content-center" }, ae = {
10
10
  key: 0,
11
11
  class: "row"
12
- }, Q = { class: "col-12 col-md-6" }, W = { class: "col-12 col-md-6" }, X = {
12
+ }, ne = { class: "col-12 col-md-6" }, re = { class: "col-12 col-md-6" }, ue = {
13
13
  key: 1,
14
14
  class: "row"
15
- }, _ = { class: "col-12" }, de = /* @__PURE__ */ Z({
15
+ }, oe = { class: "col-12" }, ve = /* @__PURE__ */ P({
16
16
  __name: "input-datepicker",
17
17
  props: {
18
18
  modelValue: {
@@ -33,11 +33,11 @@ const z = { class: "row" }, E = { class: "col-12" }, F = ["for", "innerHTML"], K
33
33
  },
34
34
  name: {
35
35
  type: String,
36
- default: () => B()
36
+ default: () => M()
37
37
  },
38
38
  id: {
39
39
  type: String,
40
- default: () => B()
40
+ default: () => M()
41
41
  },
42
42
  label: {
43
43
  type: String,
@@ -85,159 +85,187 @@ const z = { class: "row" }, E = { class: "col-12" }, F = ["for", "innerHTML"], K
85
85
  }
86
86
  },
87
87
  emits: ["update:modelValue", "update:from", "update:to"],
88
- setup(a, { emit: k }) {
89
- const c = T(null);
90
- U(async () => {
88
+ setup(a, { emit: R }) {
89
+ const m = j(null);
90
+ F(async () => {
91
91
  const { VueDatePicker: e } = await import("@vuepic/vue-datepicker");
92
- c.value = e;
92
+ m.value = e;
93
93
  });
94
- const n = a, m = k, { t: ee, locale: x } = j(), O = {
95
- en: I,
96
- de: Y,
97
- fr: P
98
- }, d = y(() => {
99
- const e = n.locale || x.value;
100
- return O[e] || I;
101
- }), p = y(() => n.inline || !n.picker ? { openMenu: !1, format: d.value } : !0), o = y({
94
+ const l = a, i = R, { t: ie, locale: U } = G(), H = {
95
+ en: O,
96
+ de: W,
97
+ fr: Q
98
+ }, s = S(() => {
99
+ const e = l.locale || U.value;
100
+ return H[e] || O;
101
+ }), N = S(() => l.inline || !l.picker ? { openMenu: !1, format: s.value } : !0);
102
+ function k(e) {
103
+ return !e || Number.isNaN(e.getTime()) ? null : e.toISOString().replace("Z", "");
104
+ }
105
+ function f(e) {
106
+ return !e || Array.isArray(e) ? null : k(/* @__PURE__ */ new Date(`${e}Z`));
107
+ }
108
+ function y(e) {
109
+ if (!e || Array.isArray(e)) return null;
110
+ const t = new Date(e);
111
+ return Number.isNaN(t.getTime()) ? null : (t.setUTCHours(t.getHours()), k(t));
112
+ }
113
+ function B() {
114
+ let e = l.from || (Array.isArray(l.modelValue) ? l.modelValue[0] : null), t = l.to || (Array.isArray(l.modelValue) ? l.modelValue[1] : null);
115
+ return l.utcStore ? (e = e ? g(e) : null, t = t ? g(t) : null) : (e = f(e), t = f(t)), [e, t];
116
+ }
117
+ const d = Y(B());
118
+ z(() => [l.modelValue, l.from, l.to, l.utcStore], () => {
119
+ if (!l.range) return;
120
+ const e = B();
121
+ (e[0] !== d.value[0] || e[1] !== d.value[1]) && (d.value = e);
122
+ });
123
+ function Z(e, t) {
124
+ l.utcStore ? (e = e ? p(e) : null, t = t ? p(t) : null) : (e = y(e), t = y(t)), i("update:modelValue", [e, t]), i("update:from", e), i("update:to", t);
125
+ }
126
+ function T(e, t) {
127
+ d.value = [e ?? null, t ?? null], Z(e ?? null, t ?? null);
128
+ }
129
+ const $ = S({
102
130
  get() {
103
- if (n.range) {
104
- let e = n.from || (Array.isArray(n.modelValue) ? n.modelValue[0] : null), t = n.to || (Array.isArray(n.modelValue) ? n.modelValue[1] : null);
105
- return n.utcStore ? (e = e ? b(e) : null, t = t ? b(t) : null) : (e = e ? (/* @__PURE__ */ new Date(`${e}Z`)).toISOString().replace("Z", "") : null, t = t ? (/* @__PURE__ */ new Date(`${t}Z`)).toISOString().replace("Z", "") : null), [
131
+ if (l.range) {
132
+ let e = l.from || (Array.isArray(l.modelValue) ? l.modelValue[0] : null), t = l.to || (Array.isArray(l.modelValue) ? l.modelValue[1] : null);
133
+ return l.utcStore ? (e = e ? g(e) : null, t = t ? g(t) : null) : (e = f(e), t = f(t)), [
106
134
  ...e ? [e] : [],
107
135
  ...t ? [t] : []
108
136
  ];
109
137
  } else {
110
- if (n.utcStore) {
111
- const l = n.modelValue;
112
- return l && b(l) || "";
138
+ if (l.utcStore) {
139
+ const e = l.modelValue;
140
+ return e && g(e) || "";
113
141
  }
114
- const e = n.modelValue ? /* @__PURE__ */ new Date(`${n.modelValue}Z`) : null, t = e && e.toISOString();
115
- return t && t.replace("Z", "");
142
+ return f(l.modelValue) || "";
116
143
  }
117
144
  },
118
145
  set(e) {
119
- if (n.range && Array.isArray(e)) {
120
- let [t, l] = e;
121
- n.utcStore ? (t = D(t) || null, l = D(l) || null) : (t = t && new Date(t), t?.setUTCHours(t.getHours()), t = t?.toISOString()?.replace("Z", ""), l = l && new Date(l), l?.setUTCHours(l.getHours()), l = l?.toISOString()?.replace("Z", "")), m("update:modelValue", [t, l]), m("update:from", t), m("update:to", l);
122
- } else if (n.utcStore) {
123
- const t = D(e);
124
- m("update:modelValue", t);
125
- } else {
126
- const t = e && new Date(e);
127
- t?.setUTCHours(t?.getHours()), e = t && t.toISOString(), m("update:modelValue", e && e.replace("Z", ""));
128
- }
146
+ if (l.range && Array.isArray(e)) {
147
+ let [t, n] = e;
148
+ l.utcStore ? (t = p(t) || null, n = p(n) || null) : (t = y(t), n = y(n)), i("update:modelValue", [t, n]), i("update:from", t), i("update:to", n);
149
+ } else if (l.utcStore) {
150
+ const t = p(e);
151
+ i("update:modelValue", t);
152
+ } else
153
+ i("update:modelValue", y(e));
129
154
  }
130
- }), $ = y({
155
+ }), D = S({
131
156
  get() {
132
- return Array.isArray(o.value) ? o.value[0] : o.value;
157
+ return d.value[0];
133
158
  },
134
159
  set(e) {
135
- o.value = Array.isArray(o.value) ? [e, o.value[0]] : e;
160
+ T(e, d.value[1]);
136
161
  }
137
- }), V = y({
162
+ }), h = S({
138
163
  get() {
139
- return Array.isArray(o.value) ? o.value[1] : o.value;
164
+ return d.value[1];
140
165
  },
141
166
  set(e) {
142
- o.value = Array.isArray(o.value) ? [o.value[0], e] : e;
167
+ T(d.value[0], e);
143
168
  }
144
169
  });
145
- C(() => [$.value, V.value], (e, t) => {
146
- n.range && e.some((l) => l === void 0) && t.every(Boolean) && (o.value = []);
147
- });
148
- function q(e) {
170
+ function I(e) {
149
171
  if (!e)
150
172
  return;
151
- const t = e.getDate(), l = e.getMonth() + 1, f = e.getFullYear(), r = e.getMinutes(), u = e.getHours();
152
- switch (d.value) {
173
+ const t = e.getDate(), n = e.getMonth() + 1, v = e.getFullYear(), r = e.getMinutes(), u = e.getHours();
174
+ switch (s.value) {
153
175
  case "de":
154
- return `${t}.${l}.${f} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
176
+ return `${t}.${n}.${v} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
155
177
  case "fr":
156
- return `${t}/${l}/${f} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
178
+ return `${t}/${n}/${v} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
157
179
  default:
158
- return `${l}/${t}/${f} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
180
+ return `${n}/${t}/${v} ${u < 10 ? "0" + u : u}:${r < 10 ? "0" + r : r}`;
159
181
  }
160
182
  }
161
- function b(e) {
162
- if (!e) return null;
163
- const t = e instanceof Date ? new Date(e) : /* @__PURE__ */ new Date(`${e}Z`), l = t.getFullYear(), f = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), M = String(t.getMinutes()).padStart(2, "0"), H = String(t.getSeconds()).padStart(2, "0");
164
- return `${l}-${f}-${r}T${u}:${M}:${H}`;
183
+ function g(e) {
184
+ if (!e || Array.isArray(e)) return null;
185
+ const t = e instanceof Date ? new Date(e) : /* @__PURE__ */ new Date(`${e}Z`);
186
+ if (Number.isNaN(t.getTime())) return null;
187
+ const n = t.getFullYear(), v = String(t.getMonth() + 1).padStart(2, "0"), r = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), C = String(t.getMinutes()).padStart(2, "0"), L = String(t.getSeconds()).padStart(2, "0");
188
+ return `${n}-${v}-${r}T${u}:${C}:${L}`;
165
189
  }
166
- function D(e) {
167
- return e ? (e instanceof Date ? new Date(e) : new Date(String(e))).toISOString().split(".")[0] : null;
190
+ function p(e) {
191
+ if (!e || Array.isArray(e)) return null;
192
+ const t = e instanceof Date ? new Date(e) : new Date(String(e));
193
+ return Number.isNaN(t.getTime()) ? null : t.toISOString().split(".")[0];
168
194
  }
169
- const w = (e) => (Array.isArray(e) ? e = e.map((t) => q(t)).join(" - ") : e = q(e), e);
170
- return (e, t) => (i(), g("div", {
171
- class: N(["input", "input--datepicker"])
195
+ const q = (e) => (Array.isArray(e) ? e = e.map((t) => I(t)).join(" - ") : e = I(e), e);
196
+ return (e, t) => (o(), V("div", {
197
+ class: E(["input", "input--datepicker"])
172
198
  }, [
173
- A(e.$slots, "label", {}, () => [
174
- s("div", z, [
175
- s("div", E, [
176
- a.label ? (i(), g("label", {
199
+ w(e.$slots, "label", {}, () => [
200
+ c("div", X, [
201
+ c("div", _, [
202
+ a.label ? (o(), V("label", {
177
203
  key: 0,
178
204
  for: a.id,
179
205
  class: "input__label",
180
- innerHTML: R(L)(`${a.label}${a.required ? " *" : ""}`)
181
- }, null, 8, F)) : h("", !0)
206
+ innerHTML: K(J)(`${a.label}${a.required ? " *" : ""}`)
207
+ }, null, 8, ee)) : x("", !0)
182
208
  ])
183
209
  ])
184
210
  ]),
185
- a.textInput ? (i(), g("div", K, [
186
- s("div", G, [
187
- A(e.$slots, "input-prepend", { slotScope: "props" }),
188
- a.range && !a.textRange ? (i(), g("div", J, [
189
- s("div", Q, [
190
- (i(), v(S(c.value), {
211
+ a.textInput ? (o(), V("div", te, [
212
+ c("div", le, [
213
+ w(e.$slots, "input-prepend", { slotScope: "props" }),
214
+ a.range && !a.textRange ? (o(), V("div", ae, [
215
+ c("div", ne, [
216
+ (o(), b(A(m.value), {
191
217
  uid: `${a.id}-from`,
192
- modelValue: $.value,
193
- "onUpdate:modelValue": t[0] || (t[0] = (l) => $.value = l),
194
- locale: d.value,
195
- format: w,
196
- "text-input": p.value,
218
+ modelValue: D.value,
219
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => D.value = n),
220
+ locale: s.value,
221
+ format: q,
222
+ "text-input": N.value,
197
223
  disabled: a.disabled,
198
224
  "read-only": a.readOnly,
199
225
  required: a.required,
226
+ "max-date": h.value,
200
227
  "auto-apply": !0
201
- }, null, 8, ["uid", "modelValue", "locale", "text-input", "disabled", "read-only", "required"]))
228
+ }, null, 8, ["uid", "modelValue", "locale", "text-input", "disabled", "read-only", "required", "max-date"]))
202
229
  ]),
203
- s("div", W, [
204
- (i(), v(S(c.value), {
230
+ c("div", re, [
231
+ (o(), b(A(m.value), {
205
232
  uid: `${a.id}-to`,
206
- modelValue: V.value,
207
- "onUpdate:modelValue": t[1] || (t[1] = (l) => V.value = l),
208
- locale: d.value,
209
- format: w,
210
- "text-input": p.value,
233
+ modelValue: h.value,
234
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => h.value = n),
235
+ locale: s.value,
236
+ format: q,
237
+ "text-input": N.value,
211
238
  disabled: a.disabled,
212
239
  "read-only": a.readOnly,
213
240
  required: a.required,
241
+ "min-date": D.value,
214
242
  "auto-apply": !0
215
- }, null, 8, ["uid", "modelValue", "locale", "text-input", "disabled", "read-only", "required"]))
243
+ }, null, 8, ["uid", "modelValue", "locale", "text-input", "disabled", "read-only", "required", "min-date"]))
216
244
  ])
217
- ])) : (i(), v(S(c.value), {
245
+ ])) : (o(), b(A(m.value), {
218
246
  key: 1,
219
247
  uid: `${a.id}-input-to`,
220
- modelValue: o.value,
221
- "onUpdate:modelValue": t[2] || (t[2] = (l) => o.value = l),
222
- format: w,
223
- locale: d.value,
248
+ modelValue: $.value,
249
+ "onUpdate:modelValue": t[2] || (t[2] = (n) => $.value = n),
250
+ format: q,
251
+ locale: s.value,
224
252
  range: a.textRange,
225
- "text-input": p.value,
253
+ "text-input": N.value,
226
254
  disabled: a.disabled,
227
255
  "read-only": a.readOnly,
228
256
  required: a.required,
229
257
  "auto-apply": !0
230
258
  }, null, 8, ["uid", "modelValue", "locale", "range", "text-input", "disabled", "read-only", "required"])),
231
- A(e.$slots, "input-append", { slotScope: "props" })
259
+ w(e.$slots, "input-append", { slotScope: "props" })
232
260
  ])
233
- ])) : h("", !0),
234
- a.inline ? (i(), g("div", X, [
235
- s("div", _, [
236
- (i(), v(S(c.value), {
261
+ ])) : x("", !0),
262
+ a.inline ? (o(), V("div", ue, [
263
+ c("div", oe, [
264
+ (o(), b(A(m.value), {
237
265
  uid: `${a.id}-inline`,
238
- modelValue: o.value,
239
- "onUpdate:modelValue": t[3] || (t[3] = (l) => o.value = l),
240
- locale: d.value,
266
+ modelValue: $.value,
267
+ "onUpdate:modelValue": t[3] || (t[3] = (n) => $.value = n),
268
+ locale: s.value,
241
269
  cancelText: "abbrechen",
242
270
  selectText: "auswählen",
243
271
  range: a.range,
@@ -254,10 +282,10 @@ const z = { class: "row" }, E = { class: "col-12" }, F = ["for", "innerHTML"], K
254
282
  "month-name-format": "long"
255
283
  }, null, 8, ["uid", "modelValue", "locale", "range", "multi-calendars", "partial-range", "disabled", "read-only", "required"]))
256
284
  ])
257
- ])) : h("", !0)
285
+ ])) : x("", !0)
258
286
  ]));
259
287
  }
260
288
  });
261
289
  export {
262
- de as default
290
+ ve as default
263
291
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.96",
4
+ "version": "0.3.97",
5
5
  "dependencies": {
6
6
  "date-fns": "^3.0.0",
7
7
  "dompurify": "^3.3.1",