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