@xwadex/fesd 0.0.70 → 0.0.71

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,172 +1,63 @@
1
- import { n as V, x as C } from "./image-preview-bundle.js";
2
- import { e as re, f as se, h as ie, i as ae, j as le, l as ne, o as ce, p as ue, q as de, r as fe, t as pe, u as me, v as he, w as ye, y as ve, G as ge, H as be, J as ke, K as xe, L as Se, N as Ae, O as we, Q as Ce, S as Ee, U as qe, V as Le, Y as Oe } from "./image-preview-bundle.js";
3
- import { o as _, z as j } from "./vendor-bundle.js";
4
- import h from "jquery";
5
- import x from "validator";
6
- import $ from "flatpickr";
7
- function J() {
1
+ import { p as $, B as A } from "./image-preview-bundle.js";
2
+ import { e as _, f as K, h as Q, i as J, j as Z, k as ee, l as te, n as re, q as oe, r as se, s as le, t as ie, v as ae, w as ce, x as ne, y as ue, z as de, E as fe, K as pe, L as me, N as ye, O as he, P as ve, Q as be, S as ge, V as Se, W as ke, X as xe, Y as Ee, $ as Ae } from "./image-preview-bundle.js";
3
+ import { o as j, z as D } from "./vendor-bundle.js";
4
+ import S from "validator";
5
+ import N from "flatpickr";
6
+ function W() {
8
7
  if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null) return;
9
- let l, e = 5;
10
- const t = document.querySelector(".back-home").getAttribute("href"), o = document.querySelector(".back-home .countdown");
11
- l = setInterval(() => {
12
- e--, o.textContent = e, e === 0 && (clearInterval(l), window.location.href = t);
8
+ let y, e = 5;
9
+ const r = document.querySelector(".back-home").getAttribute("href"), t = document.querySelector(".back-home .countdown");
10
+ y = setInterval(() => {
11
+ e--, t.textContent = e, e === 0 && (clearInterval(y), window.location.href = r);
13
12
  }, 1e3);
14
13
  }
15
- function B(l, e = l) {
16
- if (l.complete) {
17
- const o = new _().getColor(l), n = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
18
- O(n, e), e.classList.add("detected");
14
+ function B(y, e = y) {
15
+ if (y.complete) {
16
+ const t = new j().getColor(y), c = t[0] * 0.299 + t[1] * 0.587 + t[2] * 0.114;
17
+ C(c, e), e.classList.add("detected");
19
18
  }
20
19
  }
21
- function O(l, e) {
22
- const t = e.getAttribute("addClassEl");
23
- l >= 192 ? t && t !== "" ? t.split(",").forEach((o) => {
24
- e.closest(o) || console.error(`closest "${o}" not found`), e.closest(o)?.classList.add("is-light");
25
- }) : e.classList.add("is-light") : t && t !== "" ? t.split(",").forEach((o) => {
26
- e.closest(o) || console.error(`closest "${o}" not found`), e.closest(o)?.classList.add("is-dark");
20
+ function C(y, e) {
21
+ const r = e.getAttribute("addClassEl");
22
+ y >= 192 ? r && r !== "" ? r.split(",").forEach((t) => {
23
+ e.closest(t) || console.error(`closest "${t}" not found`), e.closest(t)?.classList.add("is-light");
24
+ }) : e.classList.add("is-light") : r && r !== "" ? r.split(",").forEach((t) => {
25
+ e.closest(t) || console.error(`closest "${t}" not found`), e.closest(t)?.classList.add("is-dark");
27
26
  }) : e.classList.add("is-dark");
28
27
  }
29
- function P(l, e, t) {
30
- const o = document.createElement("canvas"), n = o.getContext("2d");
31
- if (o.width = 50, o.height = 50, l !== "" && e === "")
32
- n.fillStyle = l;
33
- else if (l !== "" && e !== "") {
34
- const f = n.createLinearGradient(0, 0, o.width, o.height);
35
- f.addColorStop(0, l), f.addColorStop(1, e), n.fillStyle = f;
28
+ function G(y, e, r) {
29
+ const t = document.createElement("canvas"), c = t.getContext("2d");
30
+ if (t.width = 50, t.height = 50, y !== "" && e === "")
31
+ c.fillStyle = y;
32
+ else if (y !== "" && e !== "") {
33
+ const u = c.createLinearGradient(0, 0, t.width, t.height);
34
+ u.addColorStop(0, y), u.addColorStop(1, e), c.fillStyle = u;
36
35
  }
37
- n.fillRect(0, 0, o.width, o.height);
38
- const u = new Image();
39
- return u.src = o.toDataURL(), u.crossOrigin = "Anonymous", u.addEventListener("load", function() {
40
- B(this, t);
41
- }), u;
36
+ c.fillRect(0, 0, t.width, t.height);
37
+ const f = new Image();
38
+ return f.src = t.toDataURL(), f.crossOrigin = "Anonymous", f.addEventListener("load", function() {
39
+ B(this, r);
40
+ }), f;
42
41
  }
43
- function X() {
42
+ function R() {
44
43
  [...document.querySelectorAll(".detect-shade:not(.detected)")].forEach((e) => {
45
44
  if (e.tagName === "IMG")
46
45
  return;
47
- const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], n = getComputedStyle(e).getPropertyValue("--start-color"), u = getComputedStyle(e).getPropertyValue("--end-color");
48
- if (n === "" && u === "") {
46
+ const r = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], t = ["#000", "#000000"], c = getComputedStyle(e).getPropertyValue("--start-color"), f = getComputedStyle(e).getPropertyValue("--end-color");
47
+ if (c === "" && f === "") {
49
48
  console.error(e, "=> No color set!");
50
49
  return;
51
- } else if (t.indexOf(n) > 0) {
52
- console.warn(e, "=> TypeError!! ( #FFF ) "), O(255, e);
50
+ } else if (r.indexOf(c) > 0) {
51
+ console.warn(e, "=> TypeError!! ( #FFF ) "), C(255, e);
53
52
  return;
54
- } else if (o.indexOf(n) > 0) {
55
- console.warn(e, "=> TypeError!! ( #000 ) "), O(0, e);
53
+ } else if (t.indexOf(c) > 0) {
54
+ console.warn(e, "=> TypeError!! ( #000 ) "), C(0, e);
56
55
  return;
57
56
  }
58
- P(n, u, e);
57
+ G(c, f, e);
59
58
  });
60
59
  }
61
- const M = {
62
- CG_A: function(l) {
63
- h("html,body").delay(100).animate(
64
- { opacity: "0" },
65
- {
66
- queue: !0,
67
- duration: 800,
68
- easing: "easeOutQuad",
69
- complete: function() {
70
- window.location.assign(l);
71
- }
72
- }
73
- );
74
- },
75
- CG_B: function(l) {
76
- h("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), h("body").delay(1200).animate(
77
- { opacity: "0" },
78
- {
79
- queue: !0,
80
- duration: 200,
81
- easing: "easeOutQuad",
82
- complete: function() {
83
- setTimeout(function() {
84
- window.location.assign(l);
85
- }, 100);
86
- }
87
- }
88
- );
89
- },
90
- CG_C: function(l) {
91
- h("main").append("<div id='CG_Bbg'></div>"), h("body").delay(1200).animate(
92
- { opacity: "0" },
93
- {
94
- queue: !0,
95
- duration: 200,
96
- easing: "easeOutQuad",
97
- complete: function() {
98
- setTimeout(function() {
99
- window.location.assign(l);
100
- }, 100);
101
- }
102
- }
103
- );
104
- },
105
- CG_D: function(l) {
106
- h("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), h("body").delay(1200).animate(
107
- { opacity: "0" },
108
- {
109
- queue: !0,
110
- duration: 200,
111
- easing: "easeOutQuad",
112
- complete: function() {
113
- setTimeout(function() {
114
- window.location.assign(l);
115
- }, 100);
116
- }
117
- }
118
- );
119
- }
120
- }, U = (l) => {
121
- M.CG_A(l);
122
- }, I = (l, e) => {
123
- l.preventDefault();
124
- const t = h(l.currentTarget), o = t.attr("target"), n = t.attr("href");
125
- let u;
126
- if (e) {
127
- if (t.is("[data-nolink]")) {
128
- l.stopPropagation(), l.preventDefault();
129
- return;
130
- }
131
- t.hasClass("href-link") ? u = t.closest("[data-href]").attr("data-href") : u = n;
132
- } else {
133
- if (t.is("[data-nolink]")) {
134
- l.stopPropagation(), l.preventDefault();
135
- return;
136
- }
137
- t.hasClass("click-block") ? u = t.closest("[data-href]").attr("data-href") : u = n;
138
- }
139
- let a = window.location.pathname.replace("http://", "").split("/");
140
- a = c(a);
141
- const s = u.replace("http://", "");
142
- let d = s.split("/");
143
- d = c(d);
144
- function c(i) {
145
- const r = i.pop();
146
- return r.indexOf("#") > -1 || r.indexOf("html") > 0 ? i.push(r) : (r == "" || i.push(r), i.push("index.html")), i;
147
- }
148
- o == "_blank" || l.ctrlKey || l.metaKey ? window.open(u) : s.indexOf("jpg") > -1 || s.indexOf("javascript") > -1 || U(u);
149
- }, z = (l) => {
150
- const t = h(l.currentTarget).closest("[data-href]");
151
- t.hasClass("isHover") || t.addClass("isHover");
152
- }, H = (l) => {
153
- const t = h(l.currentTarget).closest("[data-href]");
154
- t.hasClass("isHover") && t.removeClass("isHover");
155
- }, Z = (l = !0) => {
156
- h.easing.jswing = h.easing.swing, h.extend(h.easing, {
157
- def: "easeOutQuad",
158
- easeOutQuad: function(e, t, o, n, u) {
159
- return -n * (t /= u) * (t - 2) + o;
160
- },
161
- easeInOutCirc: function(e, t, o, n, u) {
162
- return (t /= u / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + o : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + o;
163
- }
164
- }), l ? (h("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => I(e, l)), h("body").on("click", "a:not(.nocg)", function(e) {
165
- e.stopPropagation();
166
- })) : (h("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => I(e, l)), h("body").on("click", "a:not(.nocg)", function(e) {
167
- e.stopPropagation();
168
- })), h("body").on("mouseenter", "[data-href] a", (e) => z(e)), h("body").on("mouseleave", "[data-href] a", (e) => H(e));
169
- }, S = {
60
+ const k = {
170
61
  "zh-TW": {
171
62
  format: "格式錯誤",
172
63
  input: "尚未填寫",
@@ -198,16 +89,16 @@ const M = {
198
89
  select: ""
199
90
  }
200
91
  };
201
- class ee {
202
- constructor(e, t) {
92
+ class H {
93
+ constructor(e, r) {
203
94
  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");
204
- const o = {
95
+ const t = {
205
96
  locale: "zh-TW",
206
97
  datepicker: [
207
98
  {
208
99
  el: ".datepicker-input",
209
100
  options: {
210
- locale: j.Mandarin
101
+ locale: D.Mandarin
211
102
  }
212
103
  }
213
104
  ],
@@ -229,13 +120,13 @@ class ee {
229
120
  underField: !1,
230
121
  detailOutput: !1
231
122
  }
232
- }, n = (u, f) => {
233
- const a = { ...u };
234
- for (let s of Object.keys(f))
235
- typeof f[s] == "object" && s in u ? a[s] = Array.isArray(a[s]) ? [...f[s]] : n(u[s], f[s]) : a[s] = f[s];
236
- return a;
123
+ }, c = (f, u) => {
124
+ const l = { ...f };
125
+ for (let o of Object.keys(u))
126
+ typeof u[o] == "object" && o in f ? l[o] = Array.isArray(l[o]) ? [...u[o]] : c(f[o], u[o]) : l[o] = u[o];
127
+ return l;
237
128
  };
238
- this.options = t ? n(o, t) : o, this.init();
129
+ this.options = r ? c(t, r) : t, this.init();
239
130
  }
240
131
  init() {
241
132
  const e = this;
@@ -245,66 +136,66 @@ class ee {
245
136
  * 綁事件
246
137
  */
247
138
  #e() {
248
- const e = this, { datepicker: t, timepicker: o, clearEl: n, submitEl: u } = e.options;
249
- function f() {
250
- t.forEach((c) => {
251
- $(c.el, c.options);
252
- }), o.forEach((c) => {
253
- $(c.el, c.options);
139
+ const e = this, { datepicker: r, timepicker: t, clearEl: c, submitEl: f } = e.options;
140
+ function u() {
141
+ r.forEach((a) => {
142
+ N(a.el, a.options);
143
+ }), t.forEach((a) => {
144
+ N(a.el, a.options);
254
145
  });
255
146
  }
256
- function a() {
257
- const c = document.querySelector(n), i = document.querySelector(u);
258
- c?.addEventListener("click", function() {
147
+ function l() {
148
+ const a = document.querySelector(c), i = document.querySelector(f);
149
+ a?.addEventListener("click", function() {
259
150
  e.clear();
260
151
  }), i?.addEventListener("click", function() {
261
152
  e.submit();
262
153
  });
263
154
  }
264
- function s(c) {
265
- const i = c.closest(".form-group");
266
- if (c.files.length <= 0) return;
267
- const r = c.closest(".file-wrap").querySelector(".fake-file-upload");
268
- r.getAttribute("data-default");
269
- const y = r.querySelector(".file-name"), w = Number(c.getAttribute("data-limit")), A = c.files[0], p = A.size / 1024 / 1024, q = A.name, m = c.cloneNode(!0);
270
- p > w ? (i.classList.add("error"), i.classList.remove("success"), m.value = "") : (i.classList.remove("error"), i.classList.add("success")), y.textContent = q, m.removeAttribute("form-field field-type data-limit"), r.querySelector('input[type="file"]')?.remove(), r.append(m);
155
+ function o(a) {
156
+ const i = a.closest(".form-group");
157
+ if (a.files.length <= 0) return;
158
+ const s = a.closest(".file-wrap").querySelector(".fake-file-upload");
159
+ s.getAttribute("data-default");
160
+ const m = s.querySelector(".file-name"), E = Number(a.getAttribute("data-limit")), x = a.files[0], d = x.size / 1024 / 1024, L = x.name, p = a.cloneNode(!0);
161
+ d > E ? (i.classList.add("error"), i.classList.remove("success"), p.value = "") : (i.classList.remove("error"), i.classList.add("success")), m.textContent = L, p.removeAttribute("form-field field-type data-limit"), s.querySelector('input[type="file"]')?.remove(), s.append(p);
271
162
  }
272
- function d() {
163
+ function n() {
273
164
  e.element.addEventListener(
274
165
  "input",
275
- V(function(c) {
276
- const { target: i } = c;
166
+ $(function(a) {
167
+ const { target: i } = a;
277
168
  if (i.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
278
169
  if (e.element.value = e.getValue(), !i.closest(".form-group").classList.contains("required") && i.hasAttribute("data-verify")) {
279
- x.isEmpty(i.value) && (i.classList.remove("error"), i.classList.remove("success"), i.closest(".form-group").classList.remove("error"));
170
+ S.isEmpty(i.value) && (i.classList.remove("error"), i.classList.remove("success"), i.closest(".form-group").classList.remove("error"));
280
171
  return;
281
172
  }
282
- const r = i.getAttribute("form-field"), y = {
283
- [r]: e.element.value[r]
173
+ const s = i.getAttribute("form-field"), m = {
174
+ [s]: e.element.value[s]
284
175
  };
285
- e.options.verify && e.verify(y);
176
+ e.options.verify && e.verify(m);
286
177
  }
287
178
  })
288
- ), e.element.addEventListener("change", (c) => {
289
- const { target: i } = c;
290
- let r, y;
291
- i.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), r = i.closest(".form-check").getAttribute("form-field"), y = {
292
- [r]: e.element.value[r]
293
- }, e.verify(y)), i.matches('[type="file"]') && (s(i), e.element.value = e.getValue(), r = i.getAttribute("form-field"), y = {
294
- [r]: e.element.value[r]
295
- }, e.verify(y));
296
- }), e.allDropdown.forEach((c) => {
297
- c.on("change", function() {
179
+ ), e.element.addEventListener("change", (a) => {
180
+ const { target: i } = a;
181
+ let s, m;
182
+ i.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), s = i.closest(".form-check").getAttribute("form-field"), m = {
183
+ [s]: e.element.value[s]
184
+ }, e.verify(m)), i.matches('[type="file"]') && (o(i), e.element.value = e.getValue(), s = i.getAttribute("form-field"), m = {
185
+ [s]: e.element.value[s]
186
+ }, e.verify(m));
187
+ }), e.allDropdown.forEach((a) => {
188
+ a.on("change", function() {
298
189
  const i = this.getAttribute("form-field");
299
190
  e.element.value = e.getValue();
300
- const r = e.element.value[i], y = typeof r == "object" && !Array.isArray(r) ? r.value : r, w = {
301
- [i]: r
191
+ const s = e.element.value[i], m = typeof s == "object" && !Array.isArray(s) ? s.value : s, E = {
192
+ [i]: s
302
193
  };
303
- (Array.isArray(y) && y.length > 0 || !Array.isArray(y) && !x.isEmpty(y)) && e.options.verify && e.verify(w);
194
+ (Array.isArray(m) && m.length > 0 || !Array.isArray(m) && !S.isEmpty(m)) && e.options.verify && e.verify(E);
304
195
  });
305
196
  });
306
197
  }
307
- f(), a(), d();
198
+ u(), l(), n();
308
199
  }
309
200
  /**
310
201
  * 取得表單所有的值
@@ -312,59 +203,59 @@ class ee {
312
203
  */
313
204
  getValue() {
314
205
  const e = this;
315
- let t = {};
316
- return [...e.allField].forEach((o) => {
317
- const n = o.getAttribute("form-field");
318
- switch (o.getAttribute("field-type")) {
206
+ let r = {};
207
+ return [...e.allField].forEach((t) => {
208
+ const c = t.getAttribute("form-field");
209
+ switch (t.getAttribute("field-type")) {
319
210
  // 單選Radio
320
211
  case "isRadio":
321
- const f = o.querySelector("input:checked");
322
- if (!f) return;
323
- const a = f.querySelector('input[type="text"]');
324
- t[n] = {
325
- id: parseInt(f.closest(".option-item").querySelector(".text").getAttribute("data-id")),
326
- value: a ? a.value : f.closest(".option-item").querySelector(".text").textContent
212
+ const u = t.querySelector("input:checked");
213
+ if (!u) return;
214
+ const l = u.querySelector('input[type="text"]');
215
+ r[c] = {
216
+ id: parseInt(u.closest(".option-item").querySelector(".text").getAttribute("data-id")),
217
+ value: l ? l.value : u.closest(".option-item").querySelector(".text").textContent
327
218
  };
328
219
  break;
329
220
  // 複選Checkbox
330
221
  case "isCheckBox":
331
- const s = o.querySelectorAll("input:checked");
332
- t[n] = [...s].map((i) => {
333
- const r = i.querySelector('input[type="text"]');
222
+ const o = t.querySelectorAll("input:checked");
223
+ r[c] = [...o].map((i) => {
224
+ const s = i.querySelector('input[type="text"]');
334
225
  return {
335
226
  id: parseInt(i.closest(".option-item").querySelector(".text").getAttribute("data-id")),
336
- value: r ? r.value : i.closest(".option-item").querySelector(".text").textContent
227
+ value: s ? s.value : i.closest(".option-item").querySelector(".text").textContent
337
228
  };
338
229
  });
339
230
  break;
340
231
  // 下拉選單
341
232
  case "isSelect":
342
- switch (o.hasAttribute("multiple") ? "multiple" : "single") {
233
+ switch (t.hasAttribute("multiple") ? "multiple" : "single") {
343
234
  case "single":
344
- t[n] = {
345
- value: o.s.value.id ? o.s.value.id : "",
346
- display: o.s.value.el ? o.s.value.el.textContent : ""
235
+ r[c] = {
236
+ value: t.s.value.id ? t.s.value.id : "",
237
+ display: t.s.value.el ? t.s.value.el.textContent : ""
347
238
  };
348
239
  break;
349
240
  case "multiple":
350
- t[n] = {
351
- value: o.s.value.map((i) => i.id),
352
- display: o.s.value.map((i) => i.el.textContent)
241
+ r[c] = {
242
+ value: t.s.value.map((i) => i.id),
243
+ display: t.s.value.map((i) => i.el.textContent)
353
244
  };
354
245
  break;
355
246
  }
356
247
  break;
357
248
  // 檔案上傳
358
249
  case "isFile":
359
- const c = o.closest(".file-wrap")?.querySelector('input[type="file"]');
360
- t[n] = c?.files ?? void 0;
250
+ const a = t.closest(".file-wrap")?.querySelector('input[type="file"]');
251
+ r[c] = a?.files ?? void 0;
361
252
  break;
362
253
  // 其他
363
254
  default:
364
- t[n] = o.value;
255
+ r[c] = t.value;
365
256
  break;
366
257
  }
367
- }), t;
258
+ }), r;
368
259
  }
369
260
  /**
370
261
  * 表單驗證
@@ -372,105 +263,105 @@ class ee {
372
263
  * @returns
373
264
  */
374
265
  verify(e) {
375
- const t = this, { options: o } = t, n = t.element.value, u = e || n;
376
- function f(a) {
377
- const s = '<div class="validation-icon"></div>';
378
- for (const d in a) {
379
- const c = t.element.querySelector(`[form-field="${d}"]`), i = c.getAttribute("data-verify"), r = c.closest(".form-group");
266
+ const r = this, { options: t } = r, c = r.element.value, f = e || c;
267
+ function u(l) {
268
+ const o = '<div class="validation-icon"></div>';
269
+ for (const n in l) {
270
+ const a = r.element.querySelector(`[form-field="${n}"]`), i = a.getAttribute("data-verify"), s = a.closest(".form-group");
380
271
  switch (i) {
381
272
  case "select":
382
- const y = c.querySelector(".select-wrapper"), w = y.querySelector(".dropdown-icon");
383
- y.querySelector(".validation-icon")?.remove(), y.insertBefore(C(s), w);
273
+ const m = a.querySelector(".select-wrapper"), E = m.querySelector(".dropdown-icon");
274
+ m.querySelector(".validation-icon")?.remove(), m.insertBefore(A(o), E);
384
275
  break;
385
276
  case "radio":
386
277
  case "checkbox":
387
- r.querySelector(".validation-icon")?.remove(), r.append(C(s));
278
+ s.querySelector(".validation-icon")?.remove(), s.append(A(o));
388
279
  break;
389
280
  case "file":
390
- const A = c.closest(".file-wrap").querySelector(".fake-file-upload"), p = c.closest(".file-wrap").querySelector(".upload-icon");
391
- A.querySelector(".validation-icon")?.remove(), p ? A.insertBefore(C(s), p) : A.append(C(s));
281
+ const x = a.closest(".file-wrap").querySelector(".fake-file-upload"), d = a.closest(".file-wrap").querySelector(".upload-icon");
282
+ x.querySelector(".validation-icon")?.remove(), d ? x.insertBefore(A(o), d) : x.append(A(o));
392
283
  break;
393
284
  default:
394
- c.closest(".input-wrap").querySelector(".validation-icon")?.remove(), c.closest(".input-wrap").append(C(s));
285
+ a.closest(".input-wrap").querySelector(".validation-icon")?.remove(), a.closest(".input-wrap").append(A(o));
395
286
  break;
396
287
  }
397
288
  }
398
289
  }
399
- if (f(u), e) {
400
- const a = Object.keys(u)[0];
401
- t.element.querySelectorAll(`.error-text[name="${a}"]`).forEach((s) => s.remove());
290
+ if (u(f), e) {
291
+ const l = Object.keys(f)[0];
292
+ r.element.querySelectorAll(`.error-text[name="${l}"]`).forEach((o) => o.remove());
402
293
  } else
403
- t.element.querySelectorAll(".error-text").forEach((a) => a.remove());
404
- for (const a in u) {
405
- let p = function(v, b, k) {
406
- const g = t.element.querySelector(`[form-field="${a}"]`), F = [...t.element.querySelectorAll("[form-field]")].indexOf(g), E = (L) => `<p class="error-text" name="${a}" index="${F}">${c} - ${S[o.locale][L]}</p>`;
294
+ r.element.querySelectorAll(".error-text").forEach((l) => l.remove());
295
+ for (const l in f) {
296
+ let d = function(h, b, g) {
297
+ const v = r.element.querySelector(`[form-field="${l}"]`), F = [...r.element.querySelectorAll("[form-field]")].indexOf(v), q = (w) => `<p class="error-text" name="${l}" index="${F}">${a} - ${k[t.locale][w]}</p>`;
407
298
  switch (b) {
408
299
  case "underField":
409
- if (!o.errorText.underField) return;
410
- k.append(C(E(v)));
300
+ if (!t.errorText.underField) return;
301
+ g.append(A(q(h)));
411
302
  break;
412
303
  case "detail":
413
- if (!k) return;
414
- k.append(C(E(v)));
304
+ if (!g) return;
305
+ g.append(A(q(h)));
415
306
  break;
416
307
  }
417
- }, q = function() {
418
- const v = t.detailOutputEl.querySelectorAll(".error-text");
419
- [...v].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
420
- const b = [...v].sort((k, g) => k.getAttribute("index") - g.getAttribute("index"));
421
- t.detailOutputEl && (t.detailOutputEl.textContent = ""), b.forEach((k) => t.detailOutputEl?.appendChild(k));
308
+ }, L = function() {
309
+ const h = r.detailOutputEl.querySelectorAll(".error-text");
310
+ [...h].length > 0 ? r.element.classList.add("something-wrong") : r.element.classList.remove("something-wrong");
311
+ const b = [...h].sort((g, v) => g.getAttribute("index") - v.getAttribute("index"));
312
+ r.detailOutputEl && (r.detailOutputEl.textContent = ""), b.forEach((g) => r.detailOutputEl?.appendChild(g));
422
313
  };
423
- const s = t.element.querySelector(`[form-field="${a}"]`), d = s.closest(".form-group"), c = d.querySelector(".subject")?.textContent, i = s.getAttribute("data-verify"), r = () => typeof n[a] == "object" && !Array.isArray(n[a]) ? i === "file" ? n[a] : n[a].value : n[a], y = () => i === "file" ? r() === void 0 ? !0 : r() && r().length === 0 : Array.isArray(r()) && r().length === 0 || !Array.isArray(r()) && x.isEmpty(r()), w = () => i === "file" ? r() === void 0 ? !1 : r() && r().length > 0 : Array.isArray(r()) && r().length > 0 || !Array.isArray(r()) && !x.isEmpty(r()), A = d.classList.contains("required");
424
- let m;
425
- if (A && y())
426
- switch (s.classList.remove("success"), s.classList.add("error"), d.classList.add("error"), i) {
314
+ const o = r.element.querySelector(`[form-field="${l}"]`), n = o.closest(".form-group"), a = n.querySelector(".subject")?.textContent, i = o.getAttribute("data-verify"), s = () => typeof c[l] == "object" && !Array.isArray(c[l]) ? i === "file" ? c[l] : c[l].value : c[l], m = () => i === "file" ? s() === void 0 ? !0 : s() && s().length === 0 : Array.isArray(s()) && s().length === 0 || !Array.isArray(s()) && S.isEmpty(s()), E = () => i === "file" ? s() === void 0 ? !1 : s() && s().length > 0 : Array.isArray(s()) && s().length > 0 || !Array.isArray(s()) && !S.isEmpty(s()), x = n.classList.contains("required");
315
+ let p;
316
+ if (x && m())
317
+ switch (o.classList.remove("success"), o.classList.add("error"), n.classList.add("error"), i) {
427
318
  case "select":
428
- m = s.querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].select), p("select", "underField", d.parentNode), p("select", "detail", t.detailOutputEl);
319
+ p = o.querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].select), d("select", "underField", n.parentNode), d("select", "detail", r.detailOutputEl);
429
320
  break;
430
321
  case "radio":
431
322
  case "checkbox":
432
- m = d.querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].select), p("select", "underField", d.parentNode), p("select", "detail", t.detailOutputEl);
323
+ p = n.querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].select), d("select", "underField", n.parentNode), d("select", "detail", r.detailOutputEl);
433
324
  break;
434
325
  case "file":
435
- m = s.closest(".file-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].file), p("file", "underField", d.parentNode), p("file", "detail", t.detailOutputEl);
326
+ p = o.closest(".file-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].file), d("file", "underField", n.parentNode), d("file", "detail", r.detailOutputEl);
436
327
  break;
437
328
  default:
438
- m = s.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].input), p("input", "underField", d.parentNode), p("input", "detail", t.detailOutputEl);
329
+ p = o.closest(".input-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].input), d("input", "underField", n.parentNode), d("input", "detail", r.detailOutputEl);
439
330
  break;
440
331
  }
441
- if (w()) {
442
- let v = function(b, k) {
443
- const g = b.closest(".form-group");
444
- b.classList.toggle("error", !k), b.classList.toggle("success", k);
445
- const E = b.getAttribute("data-verify") === "phone" ? g.querySelector("*:not(input)[form-field]") : g.querySelector("*:not(dropdown-el)[form-field]"), L = !!E, T = b.classList.contains("success"), N = b.classList.contains("error"), D = E?.classList.contains("success"), G = E?.classList.contains("error");
446
- L ? D && !G && T ? (g.classList.remove("error"), g.classList.add("success")) : (G || N) && (g.classList.remove("success"), g.classList.add("error")) : T ? (g.classList.remove("error"), g.classList.add("success")) : (g.classList.add("error"), g.classList.remove("success"));
332
+ if (E()) {
333
+ let h = function(b, g) {
334
+ const v = b.closest(".form-group");
335
+ b.classList.toggle("error", !g), b.classList.toggle("success", g);
336
+ const q = b.getAttribute("data-verify") === "phone" ? v.querySelector("*:not(input)[form-field]") : v.querySelector("*:not(dropdown-el)[form-field]"), w = !!q, O = b.classList.contains("success"), I = b.classList.contains("error"), V = q?.classList.contains("success"), T = q?.classList.contains("error");
337
+ w ? V && !T && O ? (v.classList.remove("error"), v.classList.add("success")) : (T || I) && (v.classList.remove("success"), v.classList.add("error")) : O ? (v.classList.remove("error"), v.classList.add("success")) : (v.classList.add("error"), v.classList.remove("success"));
447
338
  };
448
339
  switch (i) {
449
340
  case "phone":
450
- const b = d.querySelector("dropdown-el");
451
- x.isMobilePhone(r()) ? (v(s, !0), b && b.classList.contains("success") && (d.classList.remove("error"), d.classList.add("success"))) : (v(s, !1), m = s.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].format), p("format", "underField", d.parentNode), p("format", "detail", t.detailOutputEl));
341
+ const b = n.querySelector("dropdown-el");
342
+ S.isMobilePhone(s()) ? (h(o, !0), b && b.classList.contains("success") && (n.classList.remove("error"), n.classList.add("success"))) : (h(o, !1), p = o.closest(".input-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].format), d("format", "underField", n.parentNode), d("format", "detail", r.detailOutputEl));
452
343
  break;
453
344
  case "password":
454
- x.isStrongPassword(r(), {
345
+ S.isStrongPassword(s(), {
455
346
  minLength: 8,
456
347
  minLowercase: 1,
457
348
  minUppercase: 0,
458
349
  minNumbers: 1,
459
350
  minSymbols: 0
460
- }) ? v(s, !0) : (v(s, !1), m = s.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].format), p("format", "underField", d.parentNode), p("format", "detail", t.detailOutputEl));
351
+ }) ? h(o, !0) : (h(o, !1), p = o.closest(".input-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].format), d("format", "underField", n.parentNode), d("format", "detail", r.detailOutputEl));
461
352
  break;
462
353
  case "email":
463
- x.isEmail(r()) ? v(s, !0) : (v(s, !1), m = s.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].format), p("format", "underField", d.parentNode), p("format", "detail", t.detailOutputEl));
354
+ S.isEmail(s()) ? h(o, !0) : (h(o, !1), p = o.closest(".input-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].format), d("format", "underField", n.parentNode), d("format", "detail", r.detailOutputEl));
464
355
  break;
465
356
  case "verifyCode":
466
- x.isNumeric(r(), { no_symbols: !0 }) && x.isLength(r(), { min: 4, max: 4 }) ? v(s, !0) : (v(s, !1), m = s.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].format), p("format", "underField", d.parentNode), p("format", "detail", t.detailOutputEl));
357
+ S.isNumeric(s(), { no_symbols: !0 }) && S.isLength(s(), { min: 4, max: 4 }) ? h(o, !0) : (h(o, !1), p = o.closest(".input-wrap").querySelector(".validation-icon"), p.setAttribute("error-text", k[t.locale].format), d("format", "underField", n.parentNode), d("format", "detail", r.detailOutputEl));
467
358
  break;
468
359
  default:
469
- v(s, !0);
360
+ h(o, !0);
470
361
  break;
471
362
  }
472
363
  }
473
- t.detailOutputEl && q();
364
+ r.detailOutputEl && L();
474
365
  }
475
366
  }
476
367
  /**
@@ -484,64 +375,66 @@ class ee {
484
375
  * 清除表單所有欄位
485
376
  */
486
377
  clear() {
487
- const e = this, { allInput: t, allTextarea: o, allCheckbox: n, allFileUpload: u, allDropdown: f } = e;
488
- [...e.allField].forEach((a) => {
489
- const s = a.closest(".form-group");
490
- s.classList.remove("success"), s.classList.remove("error"), a.classList.remove("success"), a.classList.remove("error"), a.closest(".form-grid").querySelector(".error-text")?.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
491
- }), [...t].forEach((a) => {
492
- a.value = "";
493
- }), [...o].forEach((a) => {
494
- a.value = "";
495
- }), [...n].forEach((a) => {
496
- a.checked = !1;
497
- }), [...u].forEach((a) => {
498
- let s = a.getAttribute("data-default");
499
- const d = a.querySelector(".file-name"), c = a.closest(".file-wrap").querySelector('input[type="file"]');
500
- d.classList.remove("is-upload"), d.textContent = s, c && (c.value = "");
501
- }), [...f].forEach((a) => {
502
- a.setAttribute("d4-value", ""), a.hasAttribute("control-elements") && [...a.getAttribute("control-elements").split(",")].forEach((d) => {
503
- document.querySelector(d).classList.remove("disabled");
378
+ const e = this, { allInput: r, allTextarea: t, allCheckbox: c, allFileUpload: f, allDropdown: u } = e;
379
+ [...e.allField].forEach((l) => {
380
+ const o = l.closest(".form-group");
381
+ o.classList.remove("success"), o.classList.remove("error"), l.classList.remove("success"), l.classList.remove("error"), l.closest(".form-grid").querySelector(".error-text")?.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
382
+ }), [...r].forEach((l) => {
383
+ l.value = "";
384
+ }), [...t].forEach((l) => {
385
+ l.value = "";
386
+ }), [...c].forEach((l) => {
387
+ l.checked = !1;
388
+ }), [...f].forEach((l) => {
389
+ let o = l.getAttribute("data-default");
390
+ const n = l.querySelector(".file-name"), a = l.closest(".file-wrap").querySelector('input[type="file"]');
391
+ n.classList.remove("is-upload"), n.textContent = o, a && (a.value = "");
392
+ }), [...u].forEach((l) => {
393
+ l.setAttribute("d4-value", ""), l.hasAttribute("control-elements") && [...l.getAttribute("control-elements").split(",")].forEach((n) => {
394
+ document.querySelector(n).classList.remove("disabled");
504
395
  });
505
396
  }), e.element.value = e.getValue();
506
397
  }
507
398
  }
508
399
  export {
509
- ee as CustomForm,
510
- re as ajaxUpdate,
511
- se as appleDebug,
512
- ie as bodyScrollbarInit,
513
- Z as cgpagechange,
514
- ae as clickSwitchClass,
515
- le as clickToggleClass,
516
- O as colorPick,
517
- ne as countDown,
518
- P as createColorCube,
519
- V as debounce,
520
- ce as delay,
521
- ue as detectMacOSVersion,
400
+ H as CustomForm,
401
+ _ as ajaxUpdate,
402
+ K as appleDebug,
403
+ Q as bodyScrollbarInit,
404
+ J as cgpagechange,
405
+ Z as clickEvent,
406
+ ee as clickSwitchClass,
407
+ te as clickToggleClass,
408
+ C as colorPick,
409
+ re as countDown,
410
+ G as createColorCube,
411
+ $ as debounce,
412
+ oe as delay,
413
+ se as detectMacOSVersion,
522
414
  B as detectShade,
523
- J as errorPage,
524
- S as errorText,
525
- de as fixMobile100vh,
526
- fe as formatFloat,
527
- pe as getSlideDataIndex,
528
- me as getSlidesCount,
529
- he as getTransformX,
530
- ye as getTransformY,
531
- C as htmlStringToDOM,
532
- ve as imagePreview,
533
- X as init,
534
- ge as isVideo,
535
- be as letterGrow,
536
- ke as loaded,
537
- xe as loading,
538
- Se as numberGrow,
539
- Ae as scrollLock,
540
- we as scrollUnlock,
541
- Ce as sleep,
542
- Ee as slideImgDetect,
543
- qe as tabChange,
544
- Le as throttle,
545
- Oe as wordAnimation
415
+ W as errorPage,
416
+ k as errorText,
417
+ le as fixMobile100vh,
418
+ ie as formatFloat,
419
+ ae as getHrefLink,
420
+ ce as getSlideDataIndex,
421
+ ne as getSlidesCount,
422
+ ue as getTransformX,
423
+ de as getTransformY,
424
+ A as htmlStringToDOM,
425
+ fe as imagePreview,
426
+ R as init,
427
+ pe as isVideo,
428
+ me as letterGrow,
429
+ ye as loaded,
430
+ he as loading,
431
+ ve as numberGrow,
432
+ be as scrollLock,
433
+ ge as scrollUnlock,
434
+ Se as sleep,
435
+ ke as slideImgDetect,
436
+ xe as tabChange,
437
+ Ee as throttle,
438
+ Ae as wordAnimation
546
439
  };
547
440
  //# sourceMappingURL=tools-bundle.js.map