@xwadex/fesd 0.0.20 → 0.0.22
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 +220 -204
- package/dist/tools-bundle.js.map +1 -1
- package/package.json +1 -1
package/dist/tools-bundle.js
CHANGED
@@ -2,18 +2,18 @@ var U = (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 z, o 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 H, z as
|
14
|
-
import
|
10
|
+
var V = (r, e, t) => (U(r, e, "access private method"), t);
|
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 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 H, z as Q } from "./vendor-bundle.js";
|
14
|
+
import h 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;
|
@@ -23,57 +23,57 @@ function se() {
|
|
23
23
|
e--, o.textContent = e, e === 0 && (clearInterval(r), window.location.href = t);
|
24
24
|
}, 1e3);
|
25
25
|
}
|
26
|
-
function
|
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), 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
|
-
function
|
43
|
-
const o = document.createElement("canvas"),
|
42
|
+
function R(r, e, t) {
|
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
|
53
|
-
|
54
|
-
}),
|
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
|
+
W(this, t);
|
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
|
-
|
71
|
+
R(s, d, e);
|
72
72
|
});
|
73
73
|
}
|
74
74
|
const O = {
|
75
75
|
CG_A: function(r) {
|
76
|
-
|
76
|
+
h("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
|
+
h("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), h("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
|
+
h("main").append("<div id='CG_Bbg'></div>"), h("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
|
+
h("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), h("body").delay(1200).animate(
|
120
120
|
{ opacity: "0" },
|
121
121
|
{
|
122
122
|
queue: !0,
|
@@ -130,7 +130,7 @@ const O = {
|
|
130
130
|
}
|
131
131
|
);
|
132
132
|
}
|
133
|
-
},
|
133
|
+
}, K = (r) => {
|
134
134
|
switch (1) {
|
135
135
|
case 1:
|
136
136
|
O.CG_A(r);
|
@@ -145,38 +145,54 @@ const O = {
|
|
145
145
|
O.CG_D(r);
|
146
146
|
break;
|
147
147
|
}
|
148
|
-
},
|
148
|
+
}, j = (r, e) => {
|
149
149
|
r.preventDefault();
|
150
|
-
const
|
151
|
-
let
|
152
|
-
|
150
|
+
const t = h(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 || K(d);
|
163
175
|
}, X = (r) => {
|
164
|
-
const t =
|
176
|
+
const t = h(r.currentTarget).closest("[data-href]");
|
165
177
|
t.hasClass("isHover") || t.addClass("isHover");
|
166
178
|
}, Y = (r) => {
|
167
|
-
const t =
|
179
|
+
const t = h(r.currentTarget).closest("[data-href]");
|
168
180
|
t.hasClass("isHover") && t.removeClass("isHover");
|
169
|
-
}, ae = () => {
|
170
|
-
|
181
|
+
}, ae = (r = !0) => {
|
182
|
+
h.easing.jswing = h.easing.swing, h.extend(h.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
|
+
}), r ? (h("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
|
191
|
+
e.stopPropagation();
|
192
|
+
})) : (h("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
|
193
|
+
e.stopPropagation();
|
194
|
+
})), h("body").on("mouseenter", "[data-href] a", (e) => X(e)), h("body").on("mouseleave", "[data-href] a", (e) => Y(e));
|
195
|
+
}, C = {
|
180
196
|
"zh-TW": {
|
181
197
|
format: "格式錯誤",
|
182
198
|
input: "尚未填寫",
|
@@ -208,13 +224,13 @@ const O = {
|
|
208
224
|
select: ""
|
209
225
|
}
|
210
226
|
};
|
211
|
-
var T,
|
227
|
+
var T, P;
|
212
228
|
class le {
|
213
229
|
constructor(e, t) {
|
214
230
|
/**
|
215
231
|
* 綁事件
|
216
232
|
*/
|
217
|
-
|
233
|
+
D(this, T);
|
218
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");
|
219
235
|
const o = {
|
220
236
|
locale: "zh-TW",
|
@@ -222,7 +238,7 @@ class le {
|
|
222
238
|
{
|
223
239
|
el: ".datepicker-input",
|
224
240
|
options: {
|
225
|
-
locale:
|
241
|
+
locale: Q.Mandarin
|
226
242
|
}
|
227
243
|
}
|
228
244
|
],
|
@@ -244,18 +260,18 @@ class le {
|
|
244
260
|
underField: !1,
|
245
261
|
detailOutput: !1
|
246
262
|
}
|
247
|
-
},
|
248
|
-
const
|
249
|
-
for (let
|
250
|
-
typeof
|
251
|
-
return
|
263
|
+
}, s = (d, p) => {
|
264
|
+
const f = { ...d };
|
265
|
+
for (let c of Object.keys(p))
|
266
|
+
typeof p[c] == "object" && c in d ? f[c] = Array.isArray(f[c]) ? [...p[c]] : s(d[c], p[c]) : f[c] = p[c];
|
267
|
+
return f;
|
252
268
|
};
|
253
|
-
this.options = t ?
|
269
|
+
this.options = t ? s(o, t) : o, this.init();
|
254
270
|
}
|
255
271
|
init() {
|
256
272
|
var t;
|
257
273
|
const e = this;
|
258
|
-
e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null,
|
274
|
+
e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null, V(t = e, T, P).call(t);
|
259
275
|
}
|
260
276
|
/**
|
261
277
|
* 取得表單所有的值
|
@@ -265,47 +281,47 @@ class le {
|
|
265
281
|
const e = this;
|
266
282
|
let t = {};
|
267
283
|
return [...e.allField].forEach((o) => {
|
268
|
-
const
|
284
|
+
const s = o.getAttribute("form-field");
|
269
285
|
switch (o.getAttribute("field-type")) {
|
270
286
|
case "isRadio":
|
271
|
-
const
|
272
|
-
t[
|
273
|
-
id: parseInt(
|
274
|
-
value:
|
287
|
+
const p = o.querySelector("input:checked"), f = p.querySelector('input[type="text"]');
|
288
|
+
t[s] = {
|
289
|
+
id: parseInt(p.closest(".option-item").querySelector(".text").getAttribute("data-id")),
|
290
|
+
value: f ? f.value : p.closest(".option-item").querySelector(".text").textContent
|
275
291
|
};
|
276
292
|
break;
|
277
293
|
case "isCheckBox":
|
278
|
-
const
|
279
|
-
t[
|
280
|
-
const
|
294
|
+
const c = o.querySelectorAll("input:checked");
|
295
|
+
t[s] = [...c].map((u) => {
|
296
|
+
const l = u.querySelector('input[type="text"]');
|
281
297
|
return {
|
282
|
-
id: parseInt(
|
283
|
-
value:
|
298
|
+
id: parseInt(u.closest(".option-item").querySelector(".text").getAttribute("data-id")),
|
299
|
+
value: l ? l.value : u.closest(".option-item").querySelector(".text").textContent
|
284
300
|
};
|
285
301
|
});
|
286
302
|
break;
|
287
303
|
case "isSelect":
|
288
304
|
switch (o.hasAttribute("multiple") ? "multiple" : "single") {
|
289
305
|
case "single":
|
290
|
-
t[
|
306
|
+
t[s] = {
|
291
307
|
value: o.s.value.id ? o.s.value.id : "",
|
292
308
|
display: o.s.value.el ? o.s.value.el.textContent : ""
|
293
309
|
};
|
294
310
|
break;
|
295
311
|
case "multiple":
|
296
|
-
t[
|
297
|
-
value: o.s.value.map((
|
298
|
-
display: o.s.value.map((
|
312
|
+
t[s] = {
|
313
|
+
value: o.s.value.map((u) => u.id),
|
314
|
+
display: o.s.value.map((u) => u.el.textContent)
|
299
315
|
};
|
300
316
|
break;
|
301
317
|
}
|
302
318
|
break;
|
303
319
|
case "isFile":
|
304
|
-
const
|
305
|
-
t[
|
320
|
+
const i = o.closest(".file-wrap").querySelector(".fake-file-upload input");
|
321
|
+
t[s] = i ? i.files : void 0;
|
306
322
|
break;
|
307
323
|
default:
|
308
|
-
t[
|
324
|
+
t[s] = o.value;
|
309
325
|
break;
|
310
326
|
}
|
311
327
|
}), t;
|
@@ -316,111 +332,111 @@ class le {
|
|
316
332
|
* @returns
|
317
333
|
*/
|
318
334
|
verify(e) {
|
319
|
-
var
|
320
|
-
const t = this, { options: o } = t,
|
321
|
-
function
|
322
|
-
var
|
335
|
+
var f;
|
336
|
+
const t = this, { options: o } = t, s = t.element.value, d = e || s;
|
337
|
+
function p(c) {
|
338
|
+
var i, u, l, n;
|
323
339
|
const a = '<div class="validation-icon"></div>';
|
324
|
-
for (const
|
325
|
-
const
|
340
|
+
for (const g in c) {
|
341
|
+
const x = t.element.querySelector(`[form-field="${g}"]`), L = x.getAttribute("data-verify"), m = x.closest(".form-group");
|
326
342
|
switch (L) {
|
327
343
|
case "select":
|
328
|
-
const E =
|
329
|
-
(
|
344
|
+
const E = x.querySelector(".select-wrapper"), y = E.querySelector(".dropdown-icon");
|
345
|
+
(i = E.querySelector(".validation-icon")) == null || i.remove(), E.insertBefore(q(a), y);
|
330
346
|
break;
|
331
347
|
case "radio":
|
332
348
|
case "checkbox":
|
333
|
-
(
|
349
|
+
(u = m.querySelector(".validation-icon")) == null || u.remove(), m.append(q(a));
|
334
350
|
break;
|
335
351
|
case "file":
|
336
|
-
const
|
337
|
-
(
|
352
|
+
const v = x.closest(".file-wrap").querySelector(".fake-file-upload"), k = x.closest(".file-wrap").querySelector(".upload-icon");
|
353
|
+
(l = v.querySelector(".validation-icon")) == null || l.remove(), k ? v.insertBefore(q(a), k) : v.append(q(a));
|
338
354
|
break;
|
339
355
|
case "date":
|
340
356
|
case "textarea":
|
341
357
|
default:
|
342
|
-
(
|
358
|
+
(n = x.closest(".input-wrap").querySelector(".validation-icon")) == null || n.remove(), x.closest(".input-wrap").append(q(a));
|
343
359
|
break;
|
344
360
|
}
|
345
361
|
}
|
346
362
|
}
|
347
|
-
if (
|
348
|
-
const
|
349
|
-
t.element.querySelectorAll(`.error-text[name="${
|
363
|
+
if (p(d), e) {
|
364
|
+
const c = Object.keys(d)[0];
|
365
|
+
t.element.querySelectorAll(`.error-text[name="${c}"]`).forEach((a) => a.remove());
|
350
366
|
} else
|
351
|
-
t.element.querySelectorAll(".error-text").forEach((
|
352
|
-
for (const
|
353
|
-
let m = function(
|
354
|
-
const
|
355
|
-
switch (
|
367
|
+
t.element.querySelectorAll(".error-text").forEach((c) => c.remove());
|
368
|
+
for (const c in d) {
|
369
|
+
let m = function(v, k, S) {
|
370
|
+
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>`;
|
371
|
+
switch (k) {
|
356
372
|
case "underField":
|
357
373
|
if (!o.errorText.underField)
|
358
374
|
return;
|
359
|
-
|
375
|
+
S.append(q(A(v)));
|
360
376
|
break;
|
361
377
|
case "detail":
|
362
|
-
if (!
|
378
|
+
if (!S)
|
363
379
|
return;
|
364
|
-
|
380
|
+
S.append(q(A(v)));
|
365
381
|
break;
|
366
382
|
}
|
367
383
|
}, E = function() {
|
368
|
-
const
|
369
|
-
[...
|
370
|
-
const
|
371
|
-
t.detailOutputEl && (t.detailOutputEl.textContent = ""),
|
372
|
-
var
|
373
|
-
return (
|
384
|
+
const v = t.detailOutputEl.querySelectorAll(".error-text");
|
385
|
+
[...v].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
|
386
|
+
const k = [...v].sort((S, b) => S.getAttribute("index") - b.getAttribute("index"));
|
387
|
+
t.detailOutputEl && (t.detailOutputEl.textContent = ""), k.forEach((S) => {
|
388
|
+
var b;
|
389
|
+
return (b = t.detailOutputEl) == null ? void 0 : b.appendChild(S);
|
374
390
|
});
|
375
391
|
};
|
376
|
-
const a = t.element.querySelector(`[form-field="${
|
392
|
+
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
393
|
let y;
|
378
|
-
if (L &&
|
379
|
-
switch (a.classList.remove("success"), a.classList.add("error"),
|
394
|
+
if (L && g())
|
395
|
+
switch (a.classList.remove("success"), a.classList.add("error"), i.classList.add("error"), l) {
|
380
396
|
case "select":
|
381
|
-
y = a.querySelector(".validation-icon"), y.setAttribute("error-text",
|
397
|
+
y = a.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
|
382
398
|
break;
|
383
399
|
case "radio":
|
384
400
|
case "checkbox":
|
385
|
-
y =
|
401
|
+
y = i.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
|
386
402
|
break;
|
387
403
|
case "file":
|
388
|
-
y = a.closest(".file-wrap").querySelector(".validation-icon"), y.setAttribute("error-text",
|
404
|
+
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
405
|
break;
|
390
406
|
default:
|
391
|
-
y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text",
|
407
|
+
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
408
|
break;
|
393
409
|
}
|
394
|
-
if (
|
395
|
-
let
|
396
|
-
const
|
397
|
-
|
398
|
-
const A =
|
399
|
-
F ? M && !N && I ? (
|
410
|
+
if (x()) {
|
411
|
+
let v = function(k, S) {
|
412
|
+
const b = k.closest(".form-group");
|
413
|
+
k.classList.toggle("error", !S), k.classList.toggle("success", S);
|
414
|
+
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"), B = k.classList.contains("error"), M = A == null ? void 0 : A.classList.contains("success"), N = A == null ? void 0 : A.classList.contains("error");
|
415
|
+
F ? M && !N && I ? (b.classList.remove("error"), b.classList.add("success")) : (N || B) && (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
416
|
};
|
401
|
-
switch (
|
417
|
+
switch (l) {
|
402
418
|
case "phone":
|
403
|
-
const
|
404
|
-
w.isMobilePhone(
|
419
|
+
const k = i.querySelector("dropdown-el");
|
420
|
+
w.isMobilePhone(n()) ? (v(a, !0), k && k.classList.contains("success") && (i.classList.remove("error"), i.classList.add("success"))) : (v(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
421
|
break;
|
406
422
|
case "password":
|
407
|
-
w.isStrongPassword(
|
423
|
+
w.isStrongPassword(n(), {
|
408
424
|
minLength: 8,
|
409
425
|
minLowercase: 1,
|
410
426
|
minUppercase: 0,
|
411
427
|
minNumbers: 1,
|
412
428
|
minSymbols: 0
|
413
|
-
}) ?
|
429
|
+
}) ? v(a, !0) : (v(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
430
|
break;
|
415
431
|
case "email":
|
416
|
-
w.isEmail(
|
432
|
+
w.isEmail(n()) ? v(a, !0) : (v(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
433
|
break;
|
418
434
|
case "verifyCode":
|
419
|
-
w.isNumeric(
|
435
|
+
w.isNumeric(n(), { no_symbols: !0 }) && w.isLength(n(), { min: 4, max: 4 }) ? v(a, !0) : (v(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
436
|
break;
|
421
437
|
case "select":
|
422
438
|
default:
|
423
|
-
|
439
|
+
v(a, !0);
|
424
440
|
break;
|
425
441
|
}
|
426
442
|
}
|
@@ -438,96 +454,96 @@ class le {
|
|
438
454
|
* 清除表單所有欄位
|
439
455
|
*/
|
440
456
|
clear() {
|
441
|
-
const e = this, { allInput: t, allTextarea: o, allCheckbox:
|
442
|
-
[...e.allField].forEach((
|
457
|
+
const e = this, { allInput: t, allTextarea: o, allCheckbox: s, allFileUpload: d, allDropdown: p } = e;
|
458
|
+
[...e.allField].forEach((f) => {
|
443
459
|
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
|
-
|
460
|
+
const c = f.closest(".form-group");
|
461
|
+
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 = "");
|
462
|
+
}), [...t].forEach((f) => {
|
463
|
+
f.value = "";
|
464
|
+
}), [...o].forEach((f) => {
|
465
|
+
f.value = "";
|
466
|
+
}), [...s].forEach((f) => {
|
467
|
+
f.checked = !1;
|
468
|
+
}), [...d].forEach((f) => {
|
469
|
+
let c = f.getAttribute("data-default");
|
470
|
+
const a = c.querySelector(".file-name");
|
471
|
+
a.classList.remove("is-upload"), a.textContent = c;
|
472
|
+
}), [...p].forEach((f) => {
|
473
|
+
f.setAttribute("d4-value", ""), f.hasAttribute("control-elements") && [...f.getAttribute("control-elements").split(",")].forEach((a) => {
|
458
474
|
document.querySelector(a).classList.remove("disabled");
|
459
475
|
});
|
460
476
|
}), e.element.value = e.getValue();
|
461
477
|
}
|
462
478
|
}
|
463
|
-
T = new WeakSet(),
|
464
|
-
const e = this, { datepicker: t, timepicker: o, clearEl:
|
465
|
-
function
|
466
|
-
t.forEach((
|
467
|
-
|
468
|
-
}), o.forEach((
|
469
|
-
|
479
|
+
T = new WeakSet(), P = function() {
|
480
|
+
const e = this, { datepicker: t, timepicker: o, clearEl: s, submitEl: d } = e.options;
|
481
|
+
function p() {
|
482
|
+
t.forEach((i) => {
|
483
|
+
_(i.el, i.options);
|
484
|
+
}), o.forEach((i) => {
|
485
|
+
_(i.el, i.options);
|
470
486
|
});
|
471
487
|
}
|
472
|
-
function
|
473
|
-
const
|
474
|
-
|
488
|
+
function f() {
|
489
|
+
const i = document.querySelector(s), u = document.querySelector(d);
|
490
|
+
i == null || i.addEventListener("click", function() {
|
475
491
|
e.clear();
|
476
|
-
}),
|
492
|
+
}), u == null || u.addEventListener("click", function() {
|
477
493
|
e.submit();
|
478
494
|
});
|
479
495
|
}
|
480
|
-
function
|
496
|
+
function c(i) {
|
481
497
|
var y;
|
482
|
-
const
|
483
|
-
if (
|
498
|
+
const u = i.closest(".form-group");
|
499
|
+
if (i.files.length <= 0)
|
484
500
|
return;
|
485
|
-
const
|
486
|
-
|
487
|
-
const
|
488
|
-
L >
|
501
|
+
const l = i.closest(".file-wrap").querySelector(".fake-file-upload");
|
502
|
+
l.getAttribute("data-default");
|
503
|
+
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);
|
504
|
+
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
505
|
}
|
490
506
|
function a() {
|
491
|
-
function
|
492
|
-
const { target:
|
493
|
-
let
|
494
|
-
|
495
|
-
[
|
496
|
-
}, e.options.verify && e.verify(
|
497
|
-
[
|
498
|
-
}, e.options.verify && e.verify(
|
507
|
+
function i(u) {
|
508
|
+
const { target: l } = u;
|
509
|
+
let n, g;
|
510
|
+
l.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), n = l.closest(".form-check").getAttribute("form-field"), g = {
|
511
|
+
[n]: e.element.value[n]
|
512
|
+
}, e.options.verify && e.verify(g)), l.matches('[type="file"]') && (c(l), e.element.value = e.getValue(), n = l.getAttribute("form-field"), g = {
|
513
|
+
[n]: e.element.value[n]
|
514
|
+
}, e.options.verify && e.verify(g));
|
499
515
|
}
|
500
516
|
e.element.addEventListener(
|
501
517
|
"input",
|
502
|
-
z(function(
|
503
|
-
const { target:
|
504
|
-
if (
|
505
|
-
if (e.element.value = e.getValue(), !
|
506
|
-
w.isEmpty(
|
518
|
+
z(function(u) {
|
519
|
+
const { target: l } = u;
|
520
|
+
if (l.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
|
521
|
+
if (e.element.value = e.getValue(), !l.closest(".form-group").classList.contains("required") && l.hasAttribute("data-verify")) {
|
522
|
+
w.isEmpty(l.value) && (l.classList.remove("error"), l.classList.remove("success"), l.closest(".form-group").classList.remove("error"));
|
507
523
|
return;
|
508
524
|
}
|
509
|
-
const
|
510
|
-
[
|
525
|
+
const n = l.getAttribute("form-field"), g = {
|
526
|
+
[n]: e.element.value[n]
|
511
527
|
};
|
512
|
-
e.options.verify && e.verify(
|
528
|
+
e.options.verify && e.verify(g);
|
513
529
|
}
|
514
530
|
})
|
515
|
-
), e.allCheckbox.forEach((
|
516
|
-
|
517
|
-
}), e.allRadio.forEach((
|
518
|
-
|
519
|
-
}), e.allDropdown.forEach((
|
520
|
-
|
521
|
-
const
|
531
|
+
), e.allCheckbox.forEach((u) => {
|
532
|
+
u.addEventListener("change", i);
|
533
|
+
}), e.allRadio.forEach((u) => {
|
534
|
+
u.addEventListener("change", i);
|
535
|
+
}), e.allDropdown.forEach((u) => {
|
536
|
+
u.on("change", function() {
|
537
|
+
const l = this.getAttribute("form-field");
|
522
538
|
e.element.value = e.getValue();
|
523
|
-
const
|
524
|
-
[
|
539
|
+
const n = e.element.value[l], g = typeof n == "object" && !Array.isArray(n) ? n.value : n, x = {
|
540
|
+
[l]: n
|
525
541
|
};
|
526
|
-
(Array.isArray(
|
542
|
+
(Array.isArray(g) && g.length > 0 || !Array.isArray(g) && !w.isEmpty(g)) && e.options.verify && e.verify(x);
|
527
543
|
});
|
528
544
|
});
|
529
545
|
}
|
530
|
-
|
546
|
+
p(), f(), a();
|
531
547
|
};
|
532
548
|
export {
|
533
549
|
le as CustomForm,
|
@@ -539,25 +555,25 @@ export {
|
|
539
555
|
me as clickToggleClass,
|
540
556
|
G as colorPick,
|
541
557
|
ye as countDown,
|
542
|
-
|
558
|
+
R as createColorCube,
|
543
559
|
z as debounce,
|
544
560
|
he as delay,
|
545
561
|
ve as detectMacOSVersion,
|
546
|
-
|
562
|
+
W as detectShade,
|
547
563
|
se as errorPage,
|
548
|
-
|
564
|
+
C as errorText,
|
549
565
|
ge as fixMobile100vh,
|
550
566
|
be as formatFloat,
|
551
|
-
|
552
|
-
|
553
|
-
|
567
|
+
ke as getSlideDataIndex,
|
568
|
+
xe as getSlidesCount,
|
569
|
+
Se as getTransformX,
|
554
570
|
Ae as getTransformY,
|
555
|
-
|
571
|
+
q as htmlStringToDOM,
|
556
572
|
Ee as imagePreview,
|
557
573
|
ie as init,
|
558
574
|
we as isVideo,
|
559
|
-
|
560
|
-
|
575
|
+
Ce as letterGrow,
|
576
|
+
qe as loaded,
|
561
577
|
Le as loading,
|
562
578
|
Oe as numberGrow,
|
563
579
|
Te as scrollLock,
|
@@ -566,6 +582,6 @@ export {
|
|
566
582
|
$e as slideImgDetect,
|
567
583
|
Ie as tabChange,
|
568
584
|
Ne as throttle,
|
569
|
-
|
585
|
+
De as wordAnimation
|
570
586
|
};
|
571
587
|
//# sourceMappingURL=tools-bundle.js.map
|