@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.
@@ -1,19 +1,19 @@
1
- var U = (r, e, t) => {
1
+ var M = (r, e, t) => {
2
2
  if (!e.has(r))
3
3
  throw TypeError("Cannot " + t);
4
4
  };
5
- var V = (r, e, t) => {
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 _ = (r, e, t) => (U(r, e, "access private method"), t);
11
- import { n as z, o as C } 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 xe, Q as Se, X as ke, Y as Ae, w as Ee, U as we, W as qe, u as Ce, 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 Ve } from "./image-preview-bundle.js";
13
- import { o as H, z as P } from "./vendor-bundle.js";
14
- import b from "jquery";
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 D from "flatpickr";
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 H().getColor(r), i = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
29
- G(i, e), e.classList.add("detected");
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 i;
36
- e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-light");
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 i;
39
- e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-dark");
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"), i = o.getContext("2d");
43
+ const o = document.createElement("canvas"), s = o.getContext("2d");
44
44
  if (o.width = 50, o.height = 50, r !== "" && e === "")
45
- i.fillStyle = r;
45
+ s.fillStyle = r;
46
46
  else if (r !== "" && e !== "") {
47
- const f = i.createLinearGradient(0, 0, o.width, o.height);
48
- f.addColorStop(0, r), f.addColorStop(1, e), i.fillStyle = f;
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
- i.fillRect(0, 0, o.width, o.height);
51
- const p = new Image();
52
- return p.src = o.toDataURL(), p.crossOrigin = "Anonymous", p.addEventListener("load", function() {
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
- }), p;
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"], i = getComputedStyle(e).getPropertyValue("--start-color"), p = getComputedStyle(e).getPropertyValue("--end-color");
61
- if (i === "" && p === "") {
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(i) > 0) {
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(i) > 0) {
67
+ } else if (o.indexOf(s) > 0) {
68
68
  console.warn(e, "=> TypeError!! ( #000 ) "), G(0, e);
69
69
  return;
70
70
  }
71
- W(i, p, e);
71
+ W(s, d, e);
72
72
  });
73
73
  }
74
74
  const O = {
75
75
  CG_A: function(r) {
76
- b("html,body").delay(100).animate(
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
- b("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), b("body").delay(1200).animate(
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
- b("main").append("<div id='CG_Bbg'></div>"), b("body").delay(1200).animate(
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
- b("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), b("body").delay(1200).animate(
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 e = b(r.currentTarget), t = e.attr("target"), o = e.attr("href");
151
- let i;
152
- e.hasClass("href-link") ? i = e.closest("[data-href]").attr("data-href") : i = o;
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 = a(f);
155
- const d = i.replace("http://", "");
156
- let n = d.split("/");
157
- n = a(n);
158
- function a(s) {
159
- const c = s.pop();
160
- return c.indexOf("#") > -1 || c.indexOf("html") > 0 ? s.push(c) : (c == "" || s.push(c), s.push("index.html")), s;
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
- t == "_blank" || r.ctrlKey || r.metaKey ? window.open(i) : d.indexOf("jpg") > -1 || d.indexOf("javascript") > -1 || R(i);
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 = b(r.currentTarget).closest("[data-href]");
176
+ const t = v(r.currentTarget).closest("[data-href]");
165
177
  t.hasClass("isHover") || t.addClass("isHover");
166
178
  }, Y = (r) => {
167
- const t = b(r.currentTarget).closest("[data-href]");
179
+ const t = v(r.currentTarget).closest("[data-href]");
168
180
  t.hasClass("isHover") && t.removeClass("isHover");
169
- }, ae = () => {
170
- b.easing.jswing = b.easing.swing, b.extend(b.easing, {
181
+ }, ae = (r = !0) => {
182
+ v.easing.jswing = v.easing.swing, v.extend(v.easing, {
171
183
  def: "easeOutQuad",
172
- easeOutQuad: function(r, e, t, o, i) {
173
- return -o * (e /= i) * (e - 2) + t;
184
+ easeOutQuad: function(e, t, o, s, d) {
185
+ return -s * (t /= d) * (t - 2) + o;
174
186
  },
175
- easeInOutCirc: function(r, e, t, o, i) {
176
- return (e /= i / 2) < 1 ? -o / 2 * (Math.sqrt(1 - e * e) - 1) + t : o / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
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
- }), b("body").on("click", "a:not(.nocg), .href-link", (r) => K(r)), b("body").on("mouseenter", "[data-href] a", (r) => X(r)), b("body").on("mouseleave", "[data-href] a", (r) => Y(r));
179
- }, q = {
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
- V(this, T);
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: P.Mandarin
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
- }, i = (p, f) => {
248
- const d = { ...p };
249
- for (let n of Object.keys(f))
250
- typeof f[n] == "object" && n in p ? d[n] = Array.isArray(d[n]) ? [...f[n]] : i(p[n], f[n]) : d[n] = f[n];
251
- return d;
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 ? i(o, t) : o, this.init();
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, _(t = e, T, j).call(t);
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 i = o.getAttribute("form-field");
282
+ const s = o.getAttribute("form-field");
269
283
  switch (o.getAttribute("field-type")) {
270
284
  case "isRadio":
271
- const f = o.querySelector("input:checked"), d = f.querySelector('input[type="text"]');
272
- t[i] = {
273
- id: parseInt(f.closest(".option-item").querySelector(".text").getAttribute("data-id")),
274
- value: d ? d.value : f.closest(".option-item").querySelector(".text").textContent
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 n = o.querySelectorAll("input:checked");
279
- t[i] = [...n].map((c) => {
280
- const u = c.querySelector('input[type="text"]');
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(c.closest(".option-item").querySelector(".text").getAttribute("data-id")),
283
- value: u ? u.value : c.closest(".option-item").querySelector(".text").textContent
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[i] = {
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[i] = {
297
- value: o.s.value.map((c) => c.id),
298
- display: o.s.value.map((c) => c.el.textContent)
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 s = o.closest(".file-wrap").querySelector(".fake-file-upload input");
305
- t[i] = s ? s.files : void 0;
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[i] = o.value;
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 d;
320
- const t = this, { options: o } = t, i = t.element.value, p = e || i;
321
- function f(n) {
322
- var s, c, u, l;
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 v in n) {
325
- const S = t.element.querySelector(`[form-field="${v}"]`), L = S.getAttribute("data-verify"), m = S.closest(".form-group");
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 = S.querySelector(".select-wrapper"), y = E.querySelector(".dropdown-icon");
329
- (s = E.querySelector(".validation-icon")) == null || s.remove(), E.insertBefore(C(a), y);
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
- (c = m.querySelector(".validation-icon")) == null || c.remove(), m.append(C(a));
347
+ (u = m.querySelector(".validation-icon")) == null || u.remove(), m.append(q(a));
334
348
  break;
335
349
  case "file":
336
- const h = S.closest(".file-wrap").querySelector(".fake-file-upload"), x = S.closest(".file-wrap").querySelector(".upload-icon");
337
- (u = h.querySelector(".validation-icon")) == null || u.remove(), x ? h.insertBefore(C(a), x) : h.append(C(a));
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
- (l = S.closest(".input-wrap").querySelector(".validation-icon")) == null || l.remove(), S.closest(".input-wrap").append(C(a));
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 (f(p), e) {
348
- const n = Object.keys(p)[0];
349
- t.element.querySelectorAll(`.error-text[name="${n}"]`).forEach((a) => a.remove());
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((n) => n.remove());
352
- for (const n in p) {
353
- let m = function(h, x, k) {
354
- const g = t.element.querySelector(`[form-field="${n}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(g), A = (F) => `<p class="error-text" name="${n}" index="${$}">${c} - ${q[o.locale][F]}</p>`;
355
- switch (x) {
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
- k.append(C(A(h)));
373
+ S.append(q(A(h)));
360
374
  break;
361
375
  case "detail":
362
- if (!k)
376
+ if (!S)
363
377
  return;
364
- k.append(C(A(h)));
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 x = [...h].sort((k, g) => k.getAttribute("index") - g.getAttribute("index"));
371
- t.detailOutputEl && (t.detailOutputEl.textContent = ""), x.forEach((k) => {
372
- var g;
373
- return (g = t.detailOutputEl) == null ? void 0 : g.appendChild(k);
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="${n}"]`), s = a.closest(".form-group"), c = (d = s.querySelector(".subject")) == null ? void 0 : d.textContent, u = a.getAttribute("data-verify"), l = () => typeof i[n] == "object" && !Array.isArray(i[n]) ? u === "file" ? i[n] : i[n].value : i[n], v = () => u === "file" ? l() === void 0 ? !0 : l() && l().length === 0 : Array.isArray(l()) && l().length === 0 || !Array.isArray(l()) && w.isEmpty(l()), S = () => u === "file" ? l() === void 0 ? !1 : l() && l().length > 0 : Array.isArray(l()) && l().length > 0 || !Array.isArray(l()) && !w.isEmpty(l()), L = s.classList.contains("required");
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 && v())
379
- switch (a.classList.remove("success"), a.classList.add("error"), s.classList.add("error"), u) {
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", q[o.locale].select), m("select", "underField", s.parentNode), m("select", "detail", t.detailOutputEl);
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 = s.querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].select), m("select", "underField", s.parentNode), m("select", "detail", t.detailOutputEl);
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", q[o.locale].file), m("file", "underField", s.parentNode), m("file", "detail", t.detailOutputEl);
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", q[o.locale].input), m("input", "underField", s.parentNode), m("input", "detail", t.detailOutputEl);
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 (S()) {
395
- let h = function(x, k) {
396
- const g = x.closest(".form-group");
397
- x.classList.toggle("error", !k), x.classList.toggle("success", k);
398
- const A = x.getAttribute("data-verify") === "phone" ? g.querySelector("*:not(input)[form-field]") : g.querySelector("*:not(dropdown-el)[form-field]"), F = !!A, I = x.classList.contains("success"), B = x.classList.contains("error"), M = A == null ? void 0 : A.classList.contains("success"), N = A == null ? void 0 : A.classList.contains("error");
399
- F ? M && !N && I ? (g.classList.remove("error"), g.classList.add("success")) : (N || B) && (g.classList.remove("success"), g.classList.add("error")) : I ? (g.classList.remove("error"), g.classList.add("success")) : (g.classList.add("error"), g.classList.remove("success"));
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 (u) {
415
+ switch (l) {
402
416
  case "phone":
403
- const x = s.querySelector("dropdown-el");
404
- w.isMobilePhone(l()) ? (h(a, !0), x && x.classList.contains("success") && (s.classList.remove("error"), s.classList.add("success"))) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
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(l(), {
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", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
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(l()) ? h(a, !0) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
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(l(), { no_symbols: !0 }) && w.isLength(l(), { min: 4, max: 4 }) ? h(a, !0) : (h(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", q[o.locale].format), m("format", "underField", s.parentNode), m("format", "detail", t.detailOutputEl));
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: i, allFileUpload: p, allDropdown: f } = e;
442
- [...e.allField].forEach((d) => {
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 n = d.closest(".form-group");
445
- n.classList.remove("success"), n.classList.remove("error"), d.classList.remove("success"), d.classList.remove("error"), (a = d.closest(".form-grid").querySelector(".error-text")) == null || a.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
446
- }), [...t].forEach((d) => {
447
- d.value = "";
448
- }), [...o].forEach((d) => {
449
- d.value = "";
450
- }), [...i].forEach((d) => {
451
- d.checked = !1;
452
- }), [...p].forEach((d) => {
453
- let n = d.getAttribute("data-default");
454
- const a = n.querySelector(".file-name");
455
- a.classList.remove("is-upload"), a.textContent = n;
456
- }), [...f].forEach((d) => {
457
- d.setAttribute("d4-value", ""), d.hasAttribute("control-elements") && [...d.getAttribute("control-elements").split(",")].forEach((a) => {
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: i, submitEl: p } = e.options;
465
- function f() {
466
- t.forEach((s) => {
467
- D(s.el, s.options);
468
- }), o.forEach((s) => {
469
- D(s.el, s.options);
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 d() {
473
- const s = document.querySelector(i), c = document.querySelector(p);
474
- s == null || s.addEventListener("click", function() {
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
- }), c == null || c.addEventListener("click", function() {
490
+ }), u == null || u.addEventListener("click", function() {
477
491
  e.submit();
478
492
  });
479
493
  }
480
- function n(s) {
494
+ function c(i) {
481
495
  var y;
482
- const c = s.closest(".form-group");
483
- if (s.files.length <= 0)
496
+ const u = i.closest(".form-group");
497
+ if (i.files.length <= 0)
484
498
  return;
485
- const u = s.closest(".file-wrap").querySelector(".fake-file-upload");
486
- u.getAttribute("data-default");
487
- const l = u.querySelector(".file-name"), v = Number(s.getAttribute("data-limit")), S = s.files[0], L = S.size / 1024 / 1024, m = S.name, E = s.cloneNode(!0);
488
- L > v ? (c.classList.add("error"), c.classList.remove("success"), E.value = "") : (c.classList.remove("error"), c.classList.add("success")), l.textContent = m, E.removeAttribute("form-field field-type data-limit"), (y = u.querySelector('input[type="file"]')) == null || y.remove(), u.append(E);
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 s(c) {
492
- const { target: u } = c;
493
- let l, v;
494
- u.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), l = u.closest(".form-check").getAttribute("form-field"), v = {
495
- [l]: e.element.value[l]
496
- }, e.options.verify && e.verify(v)), u.matches('[type="file"]') && (n(u), e.element.value = e.getValue(), l = u.getAttribute("form-field"), v = {
497
- [l]: e.element.value[l]
498
- }, e.options.verify && e.verify(v));
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
- z(function(c) {
503
- const { target: u } = c;
504
- if (u.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
505
- if (e.element.value = e.getValue(), !u.closest(".form-group").classList.contains("required") && u.hasAttribute("data-verify")) {
506
- w.isEmpty(u.value) && (u.classList.remove("error"), u.classList.remove("success"), u.closest(".form-group").classList.remove("error"));
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 l = u.getAttribute("form-field"), v = {
510
- [l]: e.element.value[l]
523
+ const n = l.getAttribute("form-field"), g = {
524
+ [n]: e.element.value[n]
511
525
  };
512
- e.options.verify && e.verify(v);
526
+ e.options.verify && e.verify(g);
513
527
  }
514
528
  })
515
- ), e.allCheckbox.forEach((c) => {
516
- c.addEventListener("change", s);
517
- }), e.allRadio.forEach((c) => {
518
- c.addEventListener("change", s);
519
- }), e.allDropdown.forEach((c) => {
520
- c.on("change", function() {
521
- const u = this.getAttribute("form-field");
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 l = e.element.value[u], v = typeof l == "object" && !Array.isArray(l) ? l.value : l, S = {
524
- [u]: l
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(v) && v.length > 0 || !Array.isArray(v) && !w.isEmpty(v)) && e.options.verify && e.verify(S);
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
- f(), d(), a();
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
- z as debounce,
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
- q as errorText,
562
+ C as errorText,
549
563
  ge as fixMobile100vh,
550
564
  be as formatFloat,
551
- xe as getSlideDataIndex,
552
- Se as getSlidesCount,
553
- ke as getTransformX,
565
+ ke as getSlideDataIndex,
566
+ xe as getSlidesCount,
567
+ Se as getTransformX,
554
568
  Ae as getTransformY,
555
- C as htmlStringToDOM,
569
+ q as htmlStringToDOM,
556
570
  Ee as imagePreview,
557
571
  ie as init,
558
572
  we as isVideo,
559
- qe as letterGrow,
560
- Ce as loaded,
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
- Ve as wordAnimation
583
+ De as wordAnimation
570
584
  };
571
585
  //# sourceMappingURL=tools-bundle.js.map