ablok-components 0.3.99 → 0.3.102
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
|
|
2
|
-
import { sanitizeInput as
|
|
3
|
-
import { sanitizeHtml as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as N, useTemplateRef as B, ref as p, computed as d, watch as w, onMounted as $, openBlock as s, createElementBlock as m, normalizeClass as v, createElementVNode as y, renderSlot as f, withDirectives as L, mergeProps as q, vModelDynamic as z, createCommentVNode as b, createVNode as E, Transition as M, withCtx as C, toDisplayString as D } from "vue";
|
|
2
|
+
import { sanitizeInput as H, uniqueId as g } from "../../../utilities/helpers.js";
|
|
3
|
+
import { sanitizeHtml as T } from "../../../composables/useSanitize.js";
|
|
4
|
+
const I = { class: "input-group input__input-group" }, O = ["type", "id", "name", "placeholder", "pattern", "disabled", "readonly", "required", "maxlength", "true-value", "false-value", "aria-label", "role", "autocomplete"], A = ["for", "innerHTML"], P = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "input__error alert alert-danger mt-3"
|
|
7
|
-
},
|
|
7
|
+
}, F = /* @__PURE__ */ N({
|
|
8
8
|
__name: "base-input",
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: {
|
|
@@ -91,16 +91,16 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
91
91
|
},
|
|
92
92
|
emits: ["update:modelValue", "update:valid"],
|
|
93
93
|
setup(e, { emit: h }) {
|
|
94
|
-
const l = e, c = h,
|
|
95
|
-
() =>
|
|
94
|
+
const l = e, c = h, i = B("input"), n = p(l.valid), u = p(), V = d(
|
|
95
|
+
() => T(`${l.label}${l.required ? " *" : ""}`)
|
|
96
96
|
), o = d({
|
|
97
97
|
get() {
|
|
98
98
|
return l.modelValue;
|
|
99
99
|
},
|
|
100
100
|
set(t) {
|
|
101
|
-
t = l.type === "number" ? l.max && Number(t) > l.max ? l.max : l.min !== void 0 && Number(t) < l.min ? l.min : Number(t) : t, l.sanitize && typeof t == "string" && !["checkbox", "radio", "number", "date", "datetime-local", "time", "month", "week", "email", "tel", "url"].includes(l.type) && (t =
|
|
101
|
+
t = l.type === "number" ? l.max && Number(t) > l.max ? l.max : l.min !== void 0 && Number(t) < l.min ? l.min : Number(t) : t, l.sanitize && typeof t == "string" && !["checkbox", "radio", "number", "date", "datetime-local", "time", "month", "week", "email", "tel", "url"].includes(l.type) && (t = H(t)), c("update:modelValue", t);
|
|
102
102
|
}
|
|
103
|
-
}),
|
|
103
|
+
}), x = d(() => {
|
|
104
104
|
if (l.type === "number") {
|
|
105
105
|
const { min: t, max: a } = l;
|
|
106
106
|
return {
|
|
@@ -110,29 +110,32 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
110
110
|
}
|
|
111
111
|
return {};
|
|
112
112
|
});
|
|
113
|
-
function
|
|
114
|
-
|
|
113
|
+
function S() {
|
|
114
|
+
r();
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
i.value
|
|
118
|
-
}
|
|
116
|
+
function r({ checkValidity: t = !0 } = {}) {
|
|
117
|
+
l.validate && i.value && (t ? n.value = i.value.checkValidity() : n.value = !0, n.value ? u.value = void 0 : u.value = i.value.validationMessage, c("update:valid", n.value));
|
|
118
|
+
}
|
|
119
|
+
return w(() => l.modelValue, () => {
|
|
120
|
+
n.value === !1 && r();
|
|
121
|
+
}), $(() => {
|
|
119
122
|
let t = (a) => {
|
|
120
123
|
o.value = typeof a.detail == "string" || typeof a.detail == "number" ? `${a.detail}` : "";
|
|
121
124
|
};
|
|
122
|
-
|
|
125
|
+
i.value?.addEventListener("focusin", (a) => {
|
|
123
126
|
window.addEventListener("update-focussed-input", t);
|
|
124
|
-
}),
|
|
127
|
+
}), i.value?.addEventListener("focusout", (a) => {
|
|
125
128
|
window.removeEventListener("update-focussed-input", t);
|
|
126
|
-
}), r();
|
|
129
|
+
}), r({ checkValidity: !1 });
|
|
127
130
|
}), (t, a) => (s(), m("div", {
|
|
128
|
-
class: v(["input", `input--${e.type}${
|
|
131
|
+
class: v(["input", `input--${e.type}${n.value ? "" : " input--invalid"}`])
|
|
129
132
|
}, [
|
|
130
|
-
y("div",
|
|
133
|
+
y("div", I, [
|
|
131
134
|
f(t.$slots, "input-prepend", { slotScope: "props" }),
|
|
132
|
-
|
|
135
|
+
L(y("input", q({
|
|
133
136
|
ref_key: "input",
|
|
134
|
-
ref:
|
|
135
|
-
"onUpdate:modelValue": a[0] || (a[0] = (
|
|
137
|
+
ref: i,
|
|
138
|
+
"onUpdate:modelValue": a[0] || (a[0] = (k) => o.value = k),
|
|
136
139
|
type: e.type === "color" ? "text" : e.type,
|
|
137
140
|
id: e.id,
|
|
138
141
|
name: e.name,
|
|
@@ -142,7 +145,7 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
142
145
|
readonly: e.readOnly,
|
|
143
146
|
required: e.required,
|
|
144
147
|
maxlength: e.maxlength
|
|
145
|
-
},
|
|
148
|
+
}, x.value, {
|
|
146
149
|
"true-value": e.trueValue,
|
|
147
150
|
"false-value": e.falseValue,
|
|
148
151
|
class: ["form-control", {
|
|
@@ -151,9 +154,9 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
151
154
|
"aria-label": e.label,
|
|
152
155
|
role: e.role,
|
|
153
156
|
autocomplete: e.autocomplete,
|
|
154
|
-
onChange:
|
|
155
|
-
}), null, 16,
|
|
156
|
-
[
|
|
157
|
+
onChange: S
|
|
158
|
+
}), null, 16, O), [
|
|
159
|
+
[z, o.value]
|
|
157
160
|
]),
|
|
158
161
|
f(t.$slots, "input-append", { slotScope: "props" })
|
|
159
162
|
]),
|
|
@@ -164,12 +167,12 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
164
167
|
class: v(["input__label", {
|
|
165
168
|
"form-check-label": e.type === "checkbox"
|
|
166
169
|
}]),
|
|
167
|
-
innerHTML:
|
|
168
|
-
}, null, 10,
|
|
170
|
+
innerHTML: V.value
|
|
171
|
+
}, null, 10, A)) : b("", !0)
|
|
169
172
|
]),
|
|
170
|
-
|
|
171
|
-
default:
|
|
172
|
-
!
|
|
173
|
+
E(M, { name: "fade" }, {
|
|
174
|
+
default: C(() => [
|
|
175
|
+
!n.value && u.value ? (s(), m("div", P, D(u.value), 1)) : b("", !0)
|
|
173
176
|
]),
|
|
174
177
|
_: 1
|
|
175
178
|
})
|
|
@@ -177,5 +180,5 @@ const T = { class: "input-group input__input-group" }, I = ["type", "id", "name"
|
|
|
177
180
|
}
|
|
178
181
|
});
|
|
179
182
|
export {
|
|
180
|
-
|
|
183
|
+
F as default
|
|
181
184
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as b, ref as v, onMounted as y, openBlock as E, createElementBlock as g, renderSlot as c, createElementVNode as s, createVNode as u } from "vue";
|
|
2
|
+
import a from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
3
3
|
/* empty css */
|
|
4
|
-
const _ = { class: "touch-wrapper__controls" },
|
|
4
|
+
const _ = { class: "touch-wrapper__controls" }, h = {
|
|
5
5
|
class: "btn-group",
|
|
6
6
|
role: "group"
|
|
7
|
-
},
|
|
7
|
+
}, C = /* @__PURE__ */ b({
|
|
8
8
|
__name: "touch-wrapper",
|
|
9
9
|
props: {
|
|
10
10
|
modelValue: {
|
|
@@ -13,65 +13,56 @@ const _ = { class: "touch-wrapper__controls" }, k = {
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
emits: ["update:modelValue"],
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
const e =
|
|
20
|
-
|
|
16
|
+
setup(i, { emit: d }) {
|
|
17
|
+
const m = i, p = d, o = v();
|
|
18
|
+
function n(t) {
|
|
19
|
+
const e = m.modelValue + t;
|
|
20
|
+
p("update:modelValue", t === 0 ? 1 : e >= 1 ? e : 1);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function f(t) {
|
|
23
23
|
if (t.ctrlKey) {
|
|
24
24
|
t.preventDefault();
|
|
25
25
|
const e = 0 - t.deltaY * 0.01;
|
|
26
|
-
|
|
26
|
+
n(e);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
function r(t) {
|
|
30
30
|
t.preventDefault();
|
|
31
31
|
const { scale: e } = t, l = e > 1 ? e * 0.01 : 0 - e;
|
|
32
|
-
|
|
32
|
+
n(l);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
}), (t, e) => (
|
|
34
|
+
return y(() => {
|
|
35
|
+
o.value && (o.value.addEventListener("wheel", f, !1), o.value.addEventListener("gesturestart", r, !1), o.value.addEventListener("gesturechange", r, !1), o.value.addEventListener("gestureend", r, !1));
|
|
36
|
+
}), (t, e) => (E(), g("div", {
|
|
37
37
|
ref_key: "touchElement",
|
|
38
|
-
ref:
|
|
38
|
+
ref: o,
|
|
39
39
|
class: "touch-wrapper"
|
|
40
40
|
}, [
|
|
41
41
|
c(t.$slots, "controls", {
|
|
42
|
-
on: { setScale:
|
|
42
|
+
on: { setScale: n }
|
|
43
43
|
}, () => [
|
|
44
44
|
s("div", _, [
|
|
45
|
-
s("div",
|
|
45
|
+
s("div", h, [
|
|
46
46
|
s("button", {
|
|
47
47
|
type: "button",
|
|
48
48
|
class: "btn",
|
|
49
|
-
onClick: e[0] || (e[0] = (l) =>
|
|
49
|
+
onClick: e[0] || (e[0] = (l) => n(-1))
|
|
50
50
|
}, [
|
|
51
|
-
u(
|
|
52
|
-
symbol: "minus",
|
|
53
|
-
"base-path": p(a).iconSprite
|
|
54
|
-
}, null, 8, ["base-path"])
|
|
51
|
+
u(a, { symbol: "minus" })
|
|
55
52
|
]),
|
|
56
53
|
s("button", {
|
|
57
54
|
type: "button",
|
|
58
55
|
class: "btn",
|
|
59
|
-
onClick: e[1] || (e[1] = (l) =>
|
|
56
|
+
onClick: e[1] || (e[1] = (l) => n(0))
|
|
60
57
|
}, [
|
|
61
|
-
u(
|
|
62
|
-
symbol: "maximize",
|
|
63
|
-
"base-path": p(a).iconSprite
|
|
64
|
-
}, null, 8, ["base-path"])
|
|
58
|
+
u(a, { symbol: "maximize" })
|
|
65
59
|
]),
|
|
66
60
|
s("button", {
|
|
67
61
|
type: "button",
|
|
68
62
|
class: "btn",
|
|
69
|
-
onClick: e[2] || (e[2] = (l) =>
|
|
63
|
+
onClick: e[2] || (e[2] = (l) => n(1))
|
|
70
64
|
}, [
|
|
71
|
-
u(
|
|
72
|
-
symbol: "plus",
|
|
73
|
-
"base-path": p(a).iconSprite
|
|
74
|
-
}, null, 8, ["base-path"])
|
|
65
|
+
u(a, { symbol: "plus" })
|
|
75
66
|
])
|
|
76
67
|
])
|
|
77
68
|
])
|
|
@@ -81,5 +72,5 @@ const _ = { class: "touch-wrapper__controls" }, k = {
|
|
|
81
72
|
}
|
|
82
73
|
});
|
|
83
74
|
export {
|
|
84
|
-
|
|
75
|
+
C as default
|
|
85
76
|
};
|