@xwadex/fesd 0.0.31 → 0.0.33
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.
- package/dist/image-preview-bundle.js +4 -11
- package/dist/image-preview-bundle.js.map +1 -1
- package/dist/tools-bundle.js +196 -193
- package/dist/tools-bundle.js.map +1 -1
- package/package.json +1 -1
package/dist/tools-bundle.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var
|
1
|
+
var M = (r, e, t) => {
|
2
2
|
if (!e.has(r))
|
3
3
|
throw TypeError("Cannot " + t);
|
4
4
|
};
|
@@ -7,12 +7,12 @@ var D = (r, e, t) => {
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
8
8
|
e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
9
9
|
};
|
10
|
-
var V = (r, e, t) => (
|
10
|
+
var V = (r, e, t) => (M(r, e, "access private method"), t);
|
11
11
|
import { n as z, o as q } from "./image-preview-bundle.js";
|
12
|
-
import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as
|
12
|
+
import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as Ee, w as Ae, U as we, W as Ce, u as qe, t as Le, V as Oe, q as Te, r as Fe, p as Ge, S as $e, y as Ie, H as Ne, N as De } from "./image-preview-bundle.js";
|
13
13
|
import { o as H, z as Q } from "./vendor-bundle.js";
|
14
|
-
import
|
15
|
-
import
|
14
|
+
import v from "jquery";
|
15
|
+
import A from "validator";
|
16
16
|
import _ from "flatpickr";
|
17
17
|
function se() {
|
18
18
|
if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null)
|
@@ -25,55 +25,55 @@ function se() {
|
|
25
25
|
}
|
26
26
|
function W(r, e = r) {
|
27
27
|
if (r.complete) {
|
28
|
-
const o = new H().getColor(r),
|
29
|
-
G(
|
28
|
+
const o = new H().getColor(r), i = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
|
29
|
+
G(i, e), e.classList.add("detected");
|
30
30
|
}
|
31
31
|
}
|
32
32
|
function G(r, e) {
|
33
33
|
const t = e.getAttribute("addClassEl");
|
34
34
|
r >= 192 ? t && t !== "" ? t.split(",").forEach((o) => {
|
35
|
-
var
|
36
|
-
e.closest(o) || console.error(`closest "${o}" not found`), (
|
35
|
+
var i;
|
36
|
+
e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-light");
|
37
37
|
}) : e.classList.add("is-light") : t && t !== "" ? t.split(",").forEach((o) => {
|
38
|
-
var
|
39
|
-
e.closest(o) || console.error(`closest "${o}" not found`), (
|
38
|
+
var i;
|
39
|
+
e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-dark");
|
40
40
|
}) : e.classList.add("is-dark");
|
41
41
|
}
|
42
42
|
function R(r, e, t) {
|
43
|
-
const o = document.createElement("canvas"),
|
43
|
+
const o = document.createElement("canvas"), i = o.getContext("2d");
|
44
44
|
if (o.width = 50, o.height = 50, r !== "" && e === "")
|
45
|
-
|
45
|
+
i.fillStyle = r;
|
46
46
|
else if (r !== "" && e !== "") {
|
47
|
-
const p =
|
48
|
-
p.addColorStop(0, r), p.addColorStop(1, e),
|
47
|
+
const p = i.createLinearGradient(0, 0, o.width, o.height);
|
48
|
+
p.addColorStop(0, r), p.addColorStop(1, e), i.fillStyle = p;
|
49
49
|
}
|
50
|
-
|
51
|
-
const
|
52
|
-
return
|
50
|
+
i.fillRect(0, 0, o.width, o.height);
|
51
|
+
const f = new Image();
|
52
|
+
return f.src = o.toDataURL(), f.crossOrigin = "Anonymous", f.addEventListener("load", function() {
|
53
53
|
W(this, t);
|
54
|
-
}),
|
54
|
+
}), f;
|
55
55
|
}
|
56
56
|
function ie() {
|
57
57
|
[...document.querySelectorAll(".detect-shade:not(.detected)")].forEach((e) => {
|
58
58
|
if (e.tagName === "IMG")
|
59
59
|
return;
|
60
|
-
const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"],
|
61
|
-
if (
|
60
|
+
const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], i = getComputedStyle(e).getPropertyValue("--start-color"), f = getComputedStyle(e).getPropertyValue("--end-color");
|
61
|
+
if (i === "" && f === "") {
|
62
62
|
console.error(e, "=> No color set!");
|
63
63
|
return;
|
64
|
-
} else if (t.indexOf(
|
64
|
+
} else if (t.indexOf(i) > 0) {
|
65
65
|
console.warn(e, "=> TypeError!! ( #FFF ) "), G(255, e);
|
66
66
|
return;
|
67
|
-
} else if (o.indexOf(
|
67
|
+
} else if (o.indexOf(i) > 0) {
|
68
68
|
console.warn(e, "=> TypeError!! ( #000 ) "), G(0, e);
|
69
69
|
return;
|
70
70
|
}
|
71
|
-
R(
|
71
|
+
R(i, f, e);
|
72
72
|
});
|
73
73
|
}
|
74
74
|
const O = {
|
75
75
|
CG_A: function(r) {
|
76
|
-
|
76
|
+
v("html,body").delay(100).animate(
|
77
77
|
{ opacity: "0" },
|
78
78
|
{
|
79
79
|
queue: !0,
|
@@ -86,7 +86,7 @@ const O = {
|
|
86
86
|
);
|
87
87
|
},
|
88
88
|
CG_B: function(r) {
|
89
|
-
|
89
|
+
v("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), v("body").delay(1200).animate(
|
90
90
|
{ opacity: "0" },
|
91
91
|
{
|
92
92
|
queue: !0,
|
@@ -101,7 +101,7 @@ const O = {
|
|
101
101
|
);
|
102
102
|
},
|
103
103
|
CG_C: function(r) {
|
104
|
-
|
104
|
+
v("main").append("<div id='CG_Bbg'></div>"), v("body").delay(1200).animate(
|
105
105
|
{ opacity: "0" },
|
106
106
|
{
|
107
107
|
queue: !0,
|
@@ -116,7 +116,7 @@ const O = {
|
|
116
116
|
);
|
117
117
|
},
|
118
118
|
CG_D: function(r) {
|
119
|
-
|
119
|
+
v("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), v("body").delay(1200).animate(
|
120
120
|
{ opacity: "0" },
|
121
121
|
{
|
122
122
|
queue: !0,
|
@@ -147,52 +147,52 @@ const O = {
|
|
147
147
|
}
|
148
148
|
}, j = (r, e) => {
|
149
149
|
r.preventDefault();
|
150
|
-
const t =
|
151
|
-
let
|
150
|
+
const t = v(r.currentTarget), o = t.attr("target"), i = t.attr("href");
|
151
|
+
let f;
|
152
152
|
if (e) {
|
153
153
|
if (t.is("[data-nolink]")) {
|
154
154
|
r.stopPropagation(), r.preventDefault();
|
155
155
|
return;
|
156
156
|
}
|
157
|
-
t.hasClass("href-link") ?
|
157
|
+
t.hasClass("href-link") ? f = t.closest("[data-href]").attr("data-href") : f = i;
|
158
158
|
} else {
|
159
159
|
if (t.is("[data-nolink]")) {
|
160
160
|
r.stopPropagation(), r.preventDefault();
|
161
161
|
return;
|
162
162
|
}
|
163
|
-
t.hasClass("click-block") ?
|
163
|
+
t.hasClass("click-block") ? f = t.closest("[data-href]").attr("data-href") : f = i;
|
164
164
|
}
|
165
|
-
let
|
166
|
-
|
167
|
-
const
|
168
|
-
let
|
169
|
-
|
170
|
-
function
|
171
|
-
const
|
172
|
-
return
|
165
|
+
let d = window.location.pathname.replace("http://", "").split("/");
|
166
|
+
d = s(d);
|
167
|
+
const u = f.replace("http://", "");
|
168
|
+
let l = u.split("/");
|
169
|
+
l = s(l);
|
170
|
+
function s(n) {
|
171
|
+
const a = n.pop();
|
172
|
+
return a.indexOf("#") > -1 || a.indexOf("html") > 0 ? n.push(a) : (a == "" || n.push(a), n.push("index.html")), n;
|
173
173
|
}
|
174
|
-
o == "_blank" || r.ctrlKey || r.metaKey ? window.open(
|
174
|
+
o == "_blank" || r.ctrlKey || r.metaKey ? window.open(f) : u.indexOf("jpg") > -1 || u.indexOf("javascript") > -1 || K(f);
|
175
175
|
}, X = (r) => {
|
176
|
-
const t =
|
176
|
+
const t = v(r.currentTarget).closest("[data-href]");
|
177
177
|
t.hasClass("isHover") || t.addClass("isHover");
|
178
178
|
}, Y = (r) => {
|
179
|
-
const t =
|
179
|
+
const t = v(r.currentTarget).closest("[data-href]");
|
180
180
|
t.hasClass("isHover") && t.removeClass("isHover");
|
181
181
|
}, ae = (r = !0) => {
|
182
|
-
|
182
|
+
v.easing.jswing = v.easing.swing, v.extend(v.easing, {
|
183
183
|
def: "easeOutQuad",
|
184
|
-
easeOutQuad: function(e, t, o,
|
185
|
-
return -
|
184
|
+
easeOutQuad: function(e, t, o, i, f) {
|
185
|
+
return -i * (t /= f) * (t - 2) + o;
|
186
186
|
},
|
187
|
-
easeInOutCirc: function(e, t, o,
|
188
|
-
return (t /=
|
187
|
+
easeInOutCirc: function(e, t, o, i, f) {
|
188
|
+
return (t /= f / 2) < 1 ? -i / 2 * (Math.sqrt(1 - t * t) - 1) + o : i / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + o;
|
189
189
|
}
|
190
|
-
}), r ? (
|
190
|
+
}), r ? (v("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => j(e, r)), v("body").on("click", "a:not(.nocg)", function(e) {
|
191
191
|
e.stopPropagation();
|
192
|
-
})) : (
|
192
|
+
})) : (v("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => j(e, r)), v("body").on("click", "a:not(.nocg)", function(e) {
|
193
193
|
e.stopPropagation();
|
194
|
-
})),
|
195
|
-
},
|
194
|
+
})), v("body").on("mouseenter", "[data-href] a", (e) => X(e)), v("body").on("mouseleave", "[data-href] a", (e) => Y(e));
|
195
|
+
}, w = {
|
196
196
|
"zh-TW": {
|
197
197
|
format: "格式錯誤",
|
198
198
|
input: "尚未填寫",
|
@@ -231,7 +231,7 @@ class le {
|
|
231
231
|
* 綁事件
|
232
232
|
*/
|
233
233
|
D(this, T);
|
234
|
-
this.element = document.querySelector(e), this.allField = this.element.querySelectorAll(`${e} [form-field]`), this.allInput = this.element.querySelectorAll(`${e} input`), this.allTextarea = this.element.querySelectorAll(`${e} textarea`), this.allCheckbox = this.element.querySelectorAll(`${e} input[type="checkbox"]`), this.allRadio = this.element.querySelectorAll(`${e} input[type="radio"]`), this.allFileUpload = this.element.querySelectorAll(`${e} fake-file-upload`), this.allDropdown = this.element.querySelectorAll(`${e} dropdown-el`), this.submitEvent = new Event("submit");
|
234
|
+
this.element = document.querySelector(e), this.allField = this.element.querySelectorAll(`${e} [form-field]`), this.allInput = this.element.querySelectorAll(`${e} input`), this.allTextarea = this.element.querySelectorAll(`${e} textarea`), this.allCheckbox = this.element.querySelectorAll(`${e} input[type="checkbox"]`), this.allRadio = this.element.querySelectorAll(`${e} input[type="radio"]`), this.allFileUpload = this.element.querySelectorAll(`${e} .fake-file-upload`), this.allDropdown = this.element.querySelectorAll(`${e} dropdown-el`), this.submitEvent = new Event("submit");
|
235
235
|
const o = {
|
236
236
|
locale: "zh-TW",
|
237
237
|
datepicker: [
|
@@ -260,13 +260,13 @@ class le {
|
|
260
260
|
underField: !1,
|
261
261
|
detailOutput: !1
|
262
262
|
}
|
263
|
-
},
|
264
|
-
const
|
265
|
-
for (let
|
266
|
-
typeof p[
|
267
|
-
return
|
263
|
+
}, i = (f, p) => {
|
264
|
+
const d = { ...f };
|
265
|
+
for (let u of Object.keys(p))
|
266
|
+
typeof p[u] == "object" && u in f ? d[u] = Array.isArray(d[u]) ? [...p[u]] : i(f[u], p[u]) : d[u] = p[u];
|
267
|
+
return d;
|
268
268
|
};
|
269
|
-
this.options = t ?
|
269
|
+
this.options = t ? i(o, t) : o, this.init();
|
270
270
|
}
|
271
271
|
init() {
|
272
272
|
var t;
|
@@ -281,50 +281,50 @@ class le {
|
|
281
281
|
const e = this;
|
282
282
|
let t = {};
|
283
283
|
return [...e.allField].forEach((o) => {
|
284
|
-
const
|
284
|
+
const i = o.getAttribute("form-field");
|
285
285
|
switch (o.getAttribute("field-type")) {
|
286
286
|
case "isRadio":
|
287
287
|
const p = o.querySelector("input:checked");
|
288
288
|
if (!p)
|
289
289
|
return;
|
290
|
-
const
|
291
|
-
t[
|
290
|
+
const d = p.querySelector('input[type="text"]');
|
291
|
+
t[i] = {
|
292
292
|
id: parseInt(p.closest(".option-item").querySelector(".text").getAttribute("data-id")),
|
293
|
-
value:
|
293
|
+
value: d ? d.value : p.closest(".option-item").querySelector(".text").textContent
|
294
294
|
};
|
295
295
|
break;
|
296
296
|
case "isCheckBox":
|
297
|
-
const
|
298
|
-
t[
|
299
|
-
const
|
297
|
+
const u = o.querySelectorAll("input:checked");
|
298
|
+
t[i] = [...u].map((n) => {
|
299
|
+
const a = n.querySelector('input[type="text"]');
|
300
300
|
return {
|
301
|
-
id: parseInt(
|
302
|
-
value:
|
301
|
+
id: parseInt(n.closest(".option-item").querySelector(".text").getAttribute("data-id")),
|
302
|
+
value: a ? a.value : n.closest(".option-item").querySelector(".text").textContent
|
303
303
|
};
|
304
304
|
});
|
305
305
|
break;
|
306
306
|
case "isSelect":
|
307
307
|
switch (o.hasAttribute("multiple") ? "multiple" : "single") {
|
308
308
|
case "single":
|
309
|
-
t[
|
309
|
+
t[i] = {
|
310
310
|
value: o.s.value.id ? o.s.value.id : "",
|
311
311
|
display: o.s.value.el ? o.s.value.el.textContent : ""
|
312
312
|
};
|
313
313
|
break;
|
314
314
|
case "multiple":
|
315
|
-
t[
|
316
|
-
value: o.s.value.map((
|
317
|
-
display: o.s.value.map((
|
315
|
+
t[i] = {
|
316
|
+
value: o.s.value.map((n) => n.id),
|
317
|
+
display: o.s.value.map((n) => n.el.textContent)
|
318
318
|
};
|
319
319
|
break;
|
320
320
|
}
|
321
321
|
break;
|
322
322
|
case "isFile":
|
323
|
-
const
|
324
|
-
t[
|
323
|
+
const s = o.closest(".file-wrap").querySelector(".fake-file-upload input");
|
324
|
+
t[i] = s ? s.files : void 0;
|
325
325
|
break;
|
326
326
|
default:
|
327
|
-
t[
|
327
|
+
t[i] = o.value;
|
328
328
|
break;
|
329
329
|
}
|
330
330
|
}), t;
|
@@ -335,115 +335,115 @@ class le {
|
|
335
335
|
* @returns
|
336
336
|
*/
|
337
337
|
verify(e) {
|
338
|
-
var
|
339
|
-
const t = this, { options: o } = t,
|
340
|
-
function p(
|
341
|
-
var
|
342
|
-
const
|
343
|
-
for (const
|
344
|
-
const x = t.element.querySelector(`[form-field="${
|
338
|
+
var d;
|
339
|
+
const t = this, { options: o } = t, i = t.element.value, f = e || i;
|
340
|
+
function p(u) {
|
341
|
+
var s, n, a, c;
|
342
|
+
const l = '<div class="validation-icon"></div>';
|
343
|
+
for (const b in u) {
|
344
|
+
const x = t.element.querySelector(`[form-field="${b}"]`), L = x.getAttribute("data-verify"), y = x.closest(".form-group");
|
345
345
|
switch (L) {
|
346
346
|
case "select":
|
347
|
-
const
|
348
|
-
(
|
347
|
+
const C = x.querySelector(".select-wrapper"), m = C.querySelector(".dropdown-icon");
|
348
|
+
(s = C.querySelector(".validation-icon")) == null || s.remove(), C.insertBefore(q(l), m);
|
349
349
|
break;
|
350
350
|
case "radio":
|
351
351
|
case "checkbox":
|
352
|
-
(
|
352
|
+
(n = y.querySelector(".validation-icon")) == null || n.remove(), y.append(q(l));
|
353
353
|
break;
|
354
354
|
case "file":
|
355
|
-
const
|
356
|
-
(
|
355
|
+
const h = x.closest(".file-wrap").querySelector(".fake-file-upload"), g = x.closest(".file-wrap").querySelector(".upload-icon");
|
356
|
+
(a = h.querySelector(".validation-icon")) == null || a.remove(), g ? h.insertBefore(q(l), g) : h.append(q(l));
|
357
357
|
break;
|
358
358
|
case "date":
|
359
359
|
case "textarea":
|
360
360
|
default:
|
361
|
-
(
|
361
|
+
(c = x.closest(".input-wrap").querySelector(".validation-icon")) == null || c.remove(), x.closest(".input-wrap").append(q(l));
|
362
362
|
break;
|
363
363
|
}
|
364
364
|
}
|
365
365
|
}
|
366
|
-
if (p(
|
367
|
-
const
|
368
|
-
t.element.querySelectorAll(`.error-text[name="${
|
366
|
+
if (p(f), e) {
|
367
|
+
const u = Object.keys(f)[0];
|
368
|
+
t.element.querySelectorAll(`.error-text[name="${u}"]`).forEach((l) => l.remove());
|
369
369
|
} else
|
370
|
-
t.element.querySelectorAll(".error-text").forEach((
|
371
|
-
for (const
|
372
|
-
let
|
373
|
-
const
|
374
|
-
switch (
|
370
|
+
t.element.querySelectorAll(".error-text").forEach((u) => u.remove());
|
371
|
+
for (const u in f) {
|
372
|
+
let y = function(h, g, S) {
|
373
|
+
const k = t.element.querySelector(`[form-field="${u}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(k), E = (F) => `<p class="error-text" name="${u}" index="${$}">${n} - ${w[o.locale][F]}</p>`;
|
374
|
+
switch (g) {
|
375
375
|
case "underField":
|
376
376
|
if (!o.errorText.underField)
|
377
377
|
return;
|
378
|
-
S.append(q(
|
378
|
+
S.append(q(E(h)));
|
379
379
|
break;
|
380
380
|
case "detail":
|
381
381
|
if (!S)
|
382
382
|
return;
|
383
|
-
S.append(q(
|
383
|
+
S.append(q(E(h)));
|
384
384
|
break;
|
385
385
|
}
|
386
|
-
},
|
387
|
-
const
|
388
|
-
[...
|
389
|
-
const
|
390
|
-
t.detailOutputEl && (t.detailOutputEl.textContent = ""),
|
391
|
-
var
|
392
|
-
return (
|
386
|
+
}, C = function() {
|
387
|
+
const h = t.detailOutputEl.querySelectorAll(".error-text");
|
388
|
+
[...h].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
|
389
|
+
const g = [...h].sort((S, k) => S.getAttribute("index") - k.getAttribute("index"));
|
390
|
+
t.detailOutputEl && (t.detailOutputEl.textContent = ""), g.forEach((S) => {
|
391
|
+
var k;
|
392
|
+
return (k = t.detailOutputEl) == null ? void 0 : k.appendChild(S);
|
393
393
|
});
|
394
394
|
};
|
395
|
-
const
|
396
|
-
let
|
397
|
-
if (L &&
|
398
|
-
switch (
|
395
|
+
const l = t.element.querySelector(`[form-field="${u}"]`), s = l.closest(".form-group"), n = (d = s.querySelector(".subject")) == null ? void 0 : d.textContent, a = l.getAttribute("data-verify"), c = () => typeof i[u] == "object" && !Array.isArray(i[u]) ? a === "file" ? i[u] : i[u].value : i[u], b = () => a === "file" ? c() === void 0 ? !0 : c() && c().length === 0 : Array.isArray(c()) && c().length === 0 || !Array.isArray(c()) && A.isEmpty(c()), x = () => a === "file" ? c() === void 0 ? !1 : c() && c().length > 0 : Array.isArray(c()) && c().length > 0 || !Array.isArray(c()) && !A.isEmpty(c()), L = s.classList.contains("required");
|
396
|
+
let m;
|
397
|
+
if (L && b())
|
398
|
+
switch (l.classList.remove("success"), l.classList.add("error"), s.classList.add("error"), a) {
|
399
399
|
case "select":
|
400
|
-
|
400
|
+
m = l.querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].select), y("select", "underField", s.parentNode), y("select", "detail", t.detailOutputEl);
|
401
401
|
break;
|
402
402
|
case "radio":
|
403
403
|
case "checkbox":
|
404
|
-
|
404
|
+
m = s.querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].select), y("select", "underField", s.parentNode), y("select", "detail", t.detailOutputEl);
|
405
405
|
break;
|
406
406
|
case "file":
|
407
|
-
|
407
|
+
m = l.closest(".file-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].file), y("file", "underField", s.parentNode), y("file", "detail", t.detailOutputEl);
|
408
408
|
break;
|
409
409
|
default:
|
410
|
-
|
410
|
+
m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].input), y("input", "underField", s.parentNode), y("input", "detail", t.detailOutputEl);
|
411
411
|
break;
|
412
412
|
}
|
413
413
|
if (x()) {
|
414
|
-
let
|
415
|
-
const
|
416
|
-
|
417
|
-
const
|
418
|
-
F ?
|
414
|
+
let h = function(g, S) {
|
415
|
+
const k = g.closest(".form-group");
|
416
|
+
g.classList.toggle("error", !S), g.classList.toggle("success", S);
|
417
|
+
const E = g.getAttribute("data-verify") === "phone" ? k.querySelector("*:not(input)[form-field]") : k.querySelector("*:not(dropdown-el)[form-field]"), F = !!E, I = g.classList.contains("success"), U = g.classList.contains("error"), B = E == null ? void 0 : E.classList.contains("success"), N = E == null ? void 0 : E.classList.contains("error");
|
418
|
+
F ? B && !N && I ? (k.classList.remove("error"), k.classList.add("success")) : (N || U) && (k.classList.remove("success"), k.classList.add("error")) : I ? (k.classList.remove("error"), k.classList.add("success")) : (k.classList.add("error"), k.classList.remove("success"));
|
419
419
|
};
|
420
|
-
switch (
|
420
|
+
switch (a) {
|
421
421
|
case "phone":
|
422
|
-
const
|
423
|
-
|
422
|
+
const g = s.querySelector("dropdown-el");
|
423
|
+
A.isMobilePhone(c()) ? (h(l, !0), g && g.classList.contains("success") && (s.classList.remove("error"), s.classList.add("success"))) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
|
424
424
|
break;
|
425
425
|
case "password":
|
426
|
-
|
426
|
+
A.isStrongPassword(c(), {
|
427
427
|
minLength: 8,
|
428
428
|
minLowercase: 1,
|
429
429
|
minUppercase: 0,
|
430
430
|
minNumbers: 1,
|
431
431
|
minSymbols: 0
|
432
|
-
}) ?
|
432
|
+
}) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
|
433
433
|
break;
|
434
434
|
case "email":
|
435
|
-
|
435
|
+
A.isEmail(c()) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
|
436
436
|
break;
|
437
437
|
case "verifyCode":
|
438
|
-
|
438
|
+
A.isNumeric(c(), { no_symbols: !0 }) && A.isLength(c(), { min: 4, max: 4 }) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
|
439
439
|
break;
|
440
440
|
case "select":
|
441
441
|
default:
|
442
|
-
|
442
|
+
h(l, !0);
|
443
443
|
break;
|
444
444
|
}
|
445
445
|
}
|
446
|
-
t.detailOutputEl &&
|
446
|
+
t.detailOutputEl && C();
|
447
447
|
}
|
448
448
|
}
|
449
449
|
/**
|
@@ -457,96 +457,99 @@ class le {
|
|
457
457
|
* 清除表單所有欄位
|
458
458
|
*/
|
459
459
|
clear() {
|
460
|
-
const e = this, { allInput: t, allTextarea: o, allCheckbox:
|
461
|
-
[...e.allField].forEach((
|
462
|
-
var
|
463
|
-
const
|
464
|
-
|
465
|
-
}), [...t].forEach((
|
466
|
-
|
467
|
-
}), [...o].forEach((
|
468
|
-
|
469
|
-
}), [...
|
470
|
-
|
471
|
-
}), [...
|
472
|
-
let
|
473
|
-
const
|
474
|
-
|
475
|
-
}), [...p].forEach((
|
476
|
-
|
477
|
-
document.querySelector(
|
460
|
+
const e = this, { allInput: t, allTextarea: o, allCheckbox: i, allFileUpload: f, allDropdown: p } = e;
|
461
|
+
[...e.allField].forEach((d) => {
|
462
|
+
var l;
|
463
|
+
const u = d.closest(".form-group");
|
464
|
+
u.classList.remove("success"), u.classList.remove("error"), d.classList.remove("success"), d.classList.remove("error"), (l = d.closest(".form-grid").querySelector(".error-text")) == null || l.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
|
465
|
+
}), [...t].forEach((d) => {
|
466
|
+
d.value = "";
|
467
|
+
}), [...o].forEach((d) => {
|
468
|
+
d.value = "";
|
469
|
+
}), [...i].forEach((d) => {
|
470
|
+
d.checked = !1;
|
471
|
+
}), [...f].forEach((d) => {
|
472
|
+
let u = d.getAttribute("data-default");
|
473
|
+
const l = d.querySelector(".file-name"), s = d.querySelector('input[type="file"]');
|
474
|
+
l.classList.remove("is-upload"), l.textContent = u, s && (s.value = "");
|
475
|
+
}), [...p].forEach((d) => {
|
476
|
+
d.setAttribute("d4-value", ""), d.hasAttribute("control-elements") && [...d.getAttribute("control-elements").split(",")].forEach((l) => {
|
477
|
+
document.querySelector(l).classList.remove("disabled");
|
478
478
|
});
|
479
479
|
}), e.element.value = e.getValue();
|
480
480
|
}
|
481
481
|
}
|
482
482
|
T = new WeakSet(), P = function() {
|
483
|
-
const e = this, { datepicker: t, timepicker: o, clearEl:
|
483
|
+
const e = this, { datepicker: t, timepicker: o, clearEl: i, submitEl: f } = e.options;
|
484
484
|
function p() {
|
485
|
-
t.forEach((
|
486
|
-
_(
|
487
|
-
}), o.forEach((
|
488
|
-
_(
|
485
|
+
t.forEach((s) => {
|
486
|
+
_(s.el, s.options);
|
487
|
+
}), o.forEach((s) => {
|
488
|
+
_(s.el, s.options);
|
489
489
|
});
|
490
490
|
}
|
491
|
-
function
|
492
|
-
const
|
493
|
-
|
491
|
+
function d() {
|
492
|
+
const s = document.querySelector(i), n = document.querySelector(f);
|
493
|
+
s == null || s.addEventListener("click", function() {
|
494
494
|
e.clear();
|
495
|
-
}),
|
495
|
+
}), n == null || n.addEventListener("click", function() {
|
496
496
|
e.submit();
|
497
497
|
});
|
498
498
|
}
|
499
|
-
function
|
500
|
-
var
|
501
|
-
const
|
502
|
-
if (
|
499
|
+
function u(s) {
|
500
|
+
var g;
|
501
|
+
const n = s.closest(".form-group");
|
502
|
+
if (s.files.length <= 0)
|
503
503
|
return;
|
504
|
-
const
|
505
|
-
|
506
|
-
|
507
|
-
|
504
|
+
const a = s.closest(".file-wrap").querySelector(".fake-file-upload"), c = a.getAttribute("data-default"), b = a.querySelector(".file-name"), x = Number(s.getAttribute("data-limit")), L = s.files[0], y = L.size / 1024 / 1024, C = L.name, m = s.cloneNode(!0);
|
505
|
+
y > x ? (n.classList.add("error"), n.classList.remove("success"), m.value = "", b.textContent = c) : (n.classList.remove("error"), n.classList.add("success"), b.textContent = C), ["form-field", "field-type", "data-limit"].forEach((S) => {
|
506
|
+
m.removeAttribute(S);
|
507
|
+
}), (g = a.querySelector('input[type="file"]')) == null || g.remove(), a.append(m);
|
508
508
|
}
|
509
|
-
function
|
510
|
-
function
|
511
|
-
const { target:
|
512
|
-
let
|
513
|
-
|
514
|
-
[
|
515
|
-
}, e.options.verify && e.verify(
|
516
|
-
[
|
517
|
-
}, e.options.verify && e.verify(
|
509
|
+
function l() {
|
510
|
+
function s(n) {
|
511
|
+
const { target: a } = n;
|
512
|
+
let c, b;
|
513
|
+
a.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), c = a.closest(".form-check").getAttribute("form-field"), b = {
|
514
|
+
[c]: e.element.value[c]
|
515
|
+
}, e.options.verify && e.verify(b)), a.matches('[type="file"]') && (u(a), e.element.value = e.getValue(), c = a.getAttribute("form-field"), b = {
|
516
|
+
[c]: e.element.value[c]
|
517
|
+
}, e.options.verify && e.verify(b));
|
518
518
|
}
|
519
519
|
e.element.addEventListener(
|
520
520
|
"input",
|
521
|
-
z(function(
|
522
|
-
const { target:
|
523
|
-
if (
|
524
|
-
if (e.element.value = e.getValue(), !
|
525
|
-
|
521
|
+
z(function(n) {
|
522
|
+
const { target: a } = n;
|
523
|
+
if (a.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
|
524
|
+
if (e.element.value = e.getValue(), !a.closest(".form-group").classList.contains("required") && a.hasAttribute("data-verify")) {
|
525
|
+
A.isEmpty(a.value) && (a.classList.remove("error"), a.classList.remove("success"), a.closest(".form-group").classList.remove("error"));
|
526
526
|
return;
|
527
527
|
}
|
528
|
-
const
|
529
|
-
[
|
528
|
+
const c = a.getAttribute("form-field"), b = {
|
529
|
+
[c]: e.element.value[c]
|
530
530
|
};
|
531
|
-
e.options.verify && e.verify(
|
531
|
+
e.options.verify && e.verify(b);
|
532
532
|
}
|
533
533
|
})
|
534
|
-
), e.allCheckbox.forEach((
|
535
|
-
|
536
|
-
}), e.allRadio.forEach((
|
537
|
-
|
538
|
-
}), e.
|
539
|
-
|
540
|
-
|
534
|
+
), e.allCheckbox.forEach((n) => {
|
535
|
+
n.addEventListener("change", s);
|
536
|
+
}), e.allRadio.forEach((n) => {
|
537
|
+
n.addEventListener("change", s);
|
538
|
+
}), e.allFileUpload.forEach((n) => {
|
539
|
+
const a = n.previousElementSibling;
|
540
|
+
a && a.matches('input[type="file"]') && a.addEventListener("change", s);
|
541
|
+
}), e.allDropdown.forEach((n) => {
|
542
|
+
n.on("change", function() {
|
543
|
+
const a = this.getAttribute("form-field");
|
541
544
|
e.element.value = e.getValue();
|
542
|
-
const
|
543
|
-
[
|
545
|
+
const c = e.element.value[a], b = typeof c == "object" && !Array.isArray(c) ? c.value : c, x = {
|
546
|
+
[a]: c
|
544
547
|
};
|
545
|
-
(Array.isArray(
|
548
|
+
(Array.isArray(b) && b.length > 0 || !Array.isArray(b) && !A.isEmpty(b)) && e.options.verify && e.verify(x);
|
546
549
|
});
|
547
550
|
});
|
548
551
|
}
|
549
|
-
p(),
|
552
|
+
p(), d(), l();
|
550
553
|
};
|
551
554
|
export {
|
552
555
|
le as CustomForm,
|
@@ -564,15 +567,15 @@ export {
|
|
564
567
|
ve as detectMacOSVersion,
|
565
568
|
W as detectShade,
|
566
569
|
se as errorPage,
|
567
|
-
|
570
|
+
w as errorText,
|
568
571
|
ge as fixMobile100vh,
|
569
572
|
be as formatFloat,
|
570
573
|
ke as getSlideDataIndex,
|
571
574
|
xe as getSlidesCount,
|
572
575
|
Se as getTransformX,
|
573
|
-
|
576
|
+
Ee as getTransformY,
|
574
577
|
q as htmlStringToDOM,
|
575
|
-
|
578
|
+
Ae as imagePreview,
|
576
579
|
ie as init,
|
577
580
|
we as isVideo,
|
578
581
|
Ce as letterGrow,
|