@xwadex/fesd 0.0.42 → 0.0.44

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