@xwadex/fesd 0.0.67 → 0.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fesd-bundle.css +1 -9
- package/dist/fesd-bundle.js +480 -516
- package/dist/fesd-bundle.js.map +1 -1
- package/dist/image-preview-bundle.js +1923 -2025
- package/dist/image-preview-bundle.js.map +1 -1
- package/dist/tools-bundle.js +277 -316
- package/dist/tools-bundle.js.map +1 -1
- package/dist/vendor-bundle.js +1960 -2122
- package/dist/vendor-bundle.js.map +1 -1
- package/package.json +3 -3
package/dist/tools-bundle.js
CHANGED
|
@@ -1,78 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
var D = (r, e, t) => {
|
|
6
|
-
if (e.has(r))
|
|
7
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
-
e instanceof WeakSet ? e.add(r) : e.set(r, t);
|
|
9
|
-
};
|
|
10
|
-
var V = (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 { w as ue, z as de, y as fe, F as pe, E as me, J as ye, K as he, B as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as Ae, u as we, U as Ee, W as qe, t as Ce, r as Le, V as Oe, p as Te, q as Fe, G as Ge, S as $e, x as Ie, H as Ne, N as De } from "./image-preview-bundle.js";
|
|
13
|
-
import { o as H, z as Q } from "./vendor-bundle.js";
|
|
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";
|
|
14
4
|
import h from "jquery";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
function
|
|
18
|
-
if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null)
|
|
19
|
-
|
|
20
|
-
let r, e = 5;
|
|
5
|
+
import x from "validator";
|
|
6
|
+
import $ from "flatpickr";
|
|
7
|
+
function J() {
|
|
8
|
+
if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null) return;
|
|
9
|
+
let l, e = 5;
|
|
21
10
|
const t = document.querySelector(".back-home").getAttribute("href"), o = document.querySelector(".back-home .countdown");
|
|
22
|
-
|
|
23
|
-
e--, o.textContent = e, e === 0 && (clearInterval(
|
|
11
|
+
l = setInterval(() => {
|
|
12
|
+
e--, o.textContent = e, e === 0 && (clearInterval(l), window.location.href = t);
|
|
24
13
|
}, 1e3);
|
|
25
14
|
}
|
|
26
|
-
function
|
|
27
|
-
if (
|
|
28
|
-
const o = new
|
|
29
|
-
|
|
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");
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
|
-
function
|
|
21
|
+
function O(l, e) {
|
|
33
22
|
const t = e.getAttribute("addClassEl");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-light");
|
|
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");
|
|
37
25
|
}) : e.classList.add("is-light") : t && t !== "" ? t.split(",").forEach((o) => {
|
|
38
|
-
|
|
39
|
-
e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-dark");
|
|
26
|
+
e.closest(o) || console.error(`closest "${o}" not found`), e.closest(o)?.classList.add("is-dark");
|
|
40
27
|
}) : e.classList.add("is-dark");
|
|
41
28
|
}
|
|
42
|
-
function
|
|
43
|
-
const o = document.createElement("canvas"),
|
|
44
|
-
if (o.width = 50, o.height = 50,
|
|
45
|
-
|
|
46
|
-
else if (
|
|
47
|
-
const
|
|
48
|
-
|
|
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;
|
|
49
36
|
}
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
}),
|
|
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;
|
|
55
42
|
}
|
|
56
|
-
function
|
|
43
|
+
function X() {
|
|
57
44
|
[...document.querySelectorAll(".detect-shade:not(.detected)")].forEach((e) => {
|
|
58
45
|
if (e.tagName === "IMG")
|
|
59
46
|
return;
|
|
60
|
-
const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"],
|
|
61
|
-
if (
|
|
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 === "") {
|
|
62
49
|
console.error(e, "=> No color set!");
|
|
63
50
|
return;
|
|
64
|
-
} else if (t.indexOf(
|
|
65
|
-
console.warn(e, "=> TypeError!! ( #FFF ) "),
|
|
51
|
+
} else if (t.indexOf(n) > 0) {
|
|
52
|
+
console.warn(e, "=> TypeError!! ( #FFF ) "), O(255, e);
|
|
66
53
|
return;
|
|
67
|
-
} else if (o.indexOf(
|
|
68
|
-
console.warn(e, "=> TypeError!! ( #000 ) "),
|
|
54
|
+
} else if (o.indexOf(n) > 0) {
|
|
55
|
+
console.warn(e, "=> TypeError!! ( #000 ) "), O(0, e);
|
|
69
56
|
return;
|
|
70
57
|
}
|
|
71
|
-
|
|
58
|
+
P(n, u, e);
|
|
72
59
|
});
|
|
73
60
|
}
|
|
74
|
-
const
|
|
75
|
-
CG_A: function(
|
|
61
|
+
const M = {
|
|
62
|
+
CG_A: function(l) {
|
|
76
63
|
h("html,body").delay(100).animate(
|
|
77
64
|
{ opacity: "0" },
|
|
78
65
|
{
|
|
@@ -80,12 +67,12 @@ const O = {
|
|
|
80
67
|
duration: 800,
|
|
81
68
|
easing: "easeOutQuad",
|
|
82
69
|
complete: function() {
|
|
83
|
-
window.location.assign(
|
|
70
|
+
window.location.assign(l);
|
|
84
71
|
}
|
|
85
72
|
}
|
|
86
73
|
);
|
|
87
74
|
},
|
|
88
|
-
CG_B: function(
|
|
75
|
+
CG_B: function(l) {
|
|
89
76
|
h("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), h("body").delay(1200).animate(
|
|
90
77
|
{ opacity: "0" },
|
|
91
78
|
{
|
|
@@ -94,13 +81,13 @@ const O = {
|
|
|
94
81
|
easing: "easeOutQuad",
|
|
95
82
|
complete: function() {
|
|
96
83
|
setTimeout(function() {
|
|
97
|
-
window.location.assign(
|
|
84
|
+
window.location.assign(l);
|
|
98
85
|
}, 100);
|
|
99
86
|
}
|
|
100
87
|
}
|
|
101
88
|
);
|
|
102
89
|
},
|
|
103
|
-
CG_C: function(
|
|
90
|
+
CG_C: function(l) {
|
|
104
91
|
h("main").append("<div id='CG_Bbg'></div>"), h("body").delay(1200).animate(
|
|
105
92
|
{ opacity: "0" },
|
|
106
93
|
{
|
|
@@ -109,13 +96,13 @@ const O = {
|
|
|
109
96
|
easing: "easeOutQuad",
|
|
110
97
|
complete: function() {
|
|
111
98
|
setTimeout(function() {
|
|
112
|
-
window.location.assign(
|
|
99
|
+
window.location.assign(l);
|
|
113
100
|
}, 100);
|
|
114
101
|
}
|
|
115
102
|
}
|
|
116
103
|
);
|
|
117
104
|
},
|
|
118
|
-
CG_D: function(
|
|
105
|
+
CG_D: function(l) {
|
|
119
106
|
h("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), h("body").delay(1200).animate(
|
|
120
107
|
{ opacity: "0" },
|
|
121
108
|
{
|
|
@@ -124,75 +111,62 @@ const O = {
|
|
|
124
111
|
easing: "easeOutQuad",
|
|
125
112
|
complete: function() {
|
|
126
113
|
setTimeout(function() {
|
|
127
|
-
window.location.assign(
|
|
114
|
+
window.location.assign(l);
|
|
128
115
|
}, 100);
|
|
129
116
|
}
|
|
130
117
|
}
|
|
131
118
|
);
|
|
132
119
|
}
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
O.CG_B(r);
|
|
140
|
-
break;
|
|
141
|
-
case 3:
|
|
142
|
-
O.CG_C(r);
|
|
143
|
-
break;
|
|
144
|
-
case 4:
|
|
145
|
-
O.CG_D(r);
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}, j = (r, e) => {
|
|
149
|
-
r.preventDefault();
|
|
150
|
-
const t = h(r.currentTarget), o = t.attr("target"), i = t.attr("href");
|
|
151
|
-
let f;
|
|
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;
|
|
152
126
|
if (e) {
|
|
153
127
|
if (t.is("[data-nolink]")) {
|
|
154
|
-
|
|
128
|
+
l.stopPropagation(), l.preventDefault();
|
|
155
129
|
return;
|
|
156
130
|
}
|
|
157
|
-
t.hasClass("href-link") ?
|
|
131
|
+
t.hasClass("href-link") ? u = t.closest("[data-href]").attr("data-href") : u = n;
|
|
158
132
|
} else {
|
|
159
133
|
if (t.is("[data-nolink]")) {
|
|
160
|
-
|
|
134
|
+
l.stopPropagation(), l.preventDefault();
|
|
161
135
|
return;
|
|
162
136
|
}
|
|
163
|
-
t.hasClass("click-block") ?
|
|
137
|
+
t.hasClass("click-block") ? u = t.closest("[data-href]").attr("data-href") : u = n;
|
|
164
138
|
}
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
let
|
|
169
|
-
|
|
170
|
-
function
|
|
171
|
-
const
|
|
172
|
-
return
|
|
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;
|
|
173
147
|
}
|
|
174
|
-
o == "_blank" ||
|
|
175
|
-
},
|
|
176
|
-
const t = h(
|
|
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]");
|
|
177
151
|
t.hasClass("isHover") || t.addClass("isHover");
|
|
178
|
-
},
|
|
179
|
-
const t = h(
|
|
152
|
+
}, H = (l) => {
|
|
153
|
+
const t = h(l.currentTarget).closest("[data-href]");
|
|
180
154
|
t.hasClass("isHover") && t.removeClass("isHover");
|
|
181
|
-
},
|
|
155
|
+
}, Z = (l = !0) => {
|
|
182
156
|
h.easing.jswing = h.easing.swing, h.extend(h.easing, {
|
|
183
157
|
def: "easeOutQuad",
|
|
184
|
-
easeOutQuad: function(e, t, o,
|
|
185
|
-
return -
|
|
158
|
+
easeOutQuad: function(e, t, o, n, u) {
|
|
159
|
+
return -n * (t /= u) * (t - 2) + o;
|
|
186
160
|
},
|
|
187
|
-
easeInOutCirc: function(e, t, o,
|
|
188
|
-
return (t /=
|
|
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;
|
|
189
163
|
}
|
|
190
|
-
}),
|
|
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) {
|
|
191
165
|
e.stopPropagation();
|
|
192
|
-
})) : (h("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) =>
|
|
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) {
|
|
193
167
|
e.stopPropagation();
|
|
194
|
-
})), h("body").on("mouseenter", "[data-href] a", (e) =>
|
|
195
|
-
},
|
|
168
|
+
})), h("body").on("mouseenter", "[data-href] a", (e) => z(e)), h("body").on("mouseleave", "[data-href] a", (e) => H(e));
|
|
169
|
+
}, S = {
|
|
196
170
|
"zh-TW": {
|
|
197
171
|
format: "格式錯誤",
|
|
198
172
|
input: "尚未填寫",
|
|
@@ -224,13 +198,8 @@ const O = {
|
|
|
224
198
|
select: ""
|
|
225
199
|
}
|
|
226
200
|
};
|
|
227
|
-
|
|
228
|
-
class le {
|
|
201
|
+
class ee {
|
|
229
202
|
constructor(e, t) {
|
|
230
|
-
/**
|
|
231
|
-
* 綁事件
|
|
232
|
-
*/
|
|
233
|
-
D(this, T);
|
|
234
203
|
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
204
|
const o = {
|
|
236
205
|
locale: "zh-TW",
|
|
@@ -238,7 +207,7 @@ class le {
|
|
|
238
207
|
{
|
|
239
208
|
el: ".datepicker-input",
|
|
240
209
|
options: {
|
|
241
|
-
locale:
|
|
210
|
+
locale: j.Mandarin
|
|
242
211
|
}
|
|
243
212
|
}
|
|
244
213
|
],
|
|
@@ -260,18 +229,82 @@ class le {
|
|
|
260
229
|
underField: !1,
|
|
261
230
|
detailOutput: !1
|
|
262
231
|
}
|
|
263
|
-
},
|
|
264
|
-
const
|
|
265
|
-
for (let
|
|
266
|
-
typeof
|
|
267
|
-
return
|
|
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;
|
|
268
237
|
};
|
|
269
|
-
this.options = t ?
|
|
238
|
+
this.options = t ? n(o, t) : o, this.init();
|
|
270
239
|
}
|
|
271
240
|
init() {
|
|
272
|
-
var t;
|
|
273
241
|
const e = this;
|
|
274
|
-
e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null,
|
|
242
|
+
e.element.value = e.getValue(), e.detailOutputEl = e.options.errorText.detailOutput ? document.querySelector(e.options.errorText.detailOutput) : null, e.#e();
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 綁事件
|
|
246
|
+
*/
|
|
247
|
+
#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);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function a() {
|
|
257
|
+
const c = document.querySelector(n), i = document.querySelector(u);
|
|
258
|
+
c?.addEventListener("click", function() {
|
|
259
|
+
e.clear();
|
|
260
|
+
}), i?.addEventListener("click", function() {
|
|
261
|
+
e.submit();
|
|
262
|
+
});
|
|
263
|
+
}
|
|
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);
|
|
271
|
+
}
|
|
272
|
+
function d() {
|
|
273
|
+
e.element.addEventListener(
|
|
274
|
+
"input",
|
|
275
|
+
V(function(c) {
|
|
276
|
+
const { target: i } = c;
|
|
277
|
+
if (i.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
|
|
278
|
+
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"));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const r = i.getAttribute("form-field"), y = {
|
|
283
|
+
[r]: e.element.value[r]
|
|
284
|
+
};
|
|
285
|
+
e.options.verify && e.verify(y);
|
|
286
|
+
}
|
|
287
|
+
})
|
|
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() {
|
|
298
|
+
const i = this.getAttribute("form-field");
|
|
299
|
+
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
|
|
302
|
+
};
|
|
303
|
+
(Array.isArray(y) && y.length > 0 || !Array.isArray(y) && !x.isEmpty(y)) && e.options.verify && e.verify(w);
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
f(), a(), d();
|
|
275
308
|
}
|
|
276
309
|
/**
|
|
277
310
|
* 取得表單所有的值
|
|
@@ -281,51 +314,54 @@ class le {
|
|
|
281
314
|
const e = this;
|
|
282
315
|
let t = {};
|
|
283
316
|
return [...e.allField].forEach((o) => {
|
|
284
|
-
|
|
285
|
-
const i = o.getAttribute("form-field");
|
|
317
|
+
const n = o.getAttribute("form-field");
|
|
286
318
|
switch (o.getAttribute("field-type")) {
|
|
319
|
+
// 單選Radio
|
|
287
320
|
case "isRadio":
|
|
288
|
-
const
|
|
289
|
-
if (!
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
value: c ? c.value : d.closest(".option-item").querySelector(".text").textContent
|
|
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
|
|
295
327
|
};
|
|
296
328
|
break;
|
|
329
|
+
// 複選Checkbox
|
|
297
330
|
case "isCheckBox":
|
|
298
|
-
const
|
|
299
|
-
t[
|
|
300
|
-
const
|
|
331
|
+
const s = o.querySelectorAll("input:checked");
|
|
332
|
+
t[n] = [...s].map((i) => {
|
|
333
|
+
const r = i.querySelector('input[type="text"]');
|
|
301
334
|
return {
|
|
302
|
-
id: parseInt(
|
|
303
|
-
value:
|
|
335
|
+
id: parseInt(i.closest(".option-item").querySelector(".text").getAttribute("data-id")),
|
|
336
|
+
value: r ? r.value : i.closest(".option-item").querySelector(".text").textContent
|
|
304
337
|
};
|
|
305
338
|
});
|
|
306
339
|
break;
|
|
340
|
+
// 下拉選單
|
|
307
341
|
case "isSelect":
|
|
308
342
|
switch (o.hasAttribute("multiple") ? "multiple" : "single") {
|
|
309
343
|
case "single":
|
|
310
|
-
t[
|
|
344
|
+
t[n] = {
|
|
311
345
|
value: o.s.value.id ? o.s.value.id : "",
|
|
312
346
|
display: o.s.value.el ? o.s.value.el.textContent : ""
|
|
313
347
|
};
|
|
314
348
|
break;
|
|
315
349
|
case "multiple":
|
|
316
|
-
t[
|
|
317
|
-
value: o.s.value.map((
|
|
318
|
-
display: o.s.value.map((
|
|
350
|
+
t[n] = {
|
|
351
|
+
value: o.s.value.map((i) => i.id),
|
|
352
|
+
display: o.s.value.map((i) => i.el.textContent)
|
|
319
353
|
};
|
|
320
354
|
break;
|
|
321
355
|
}
|
|
322
356
|
break;
|
|
357
|
+
// 檔案上傳
|
|
323
358
|
case "isFile":
|
|
324
|
-
const
|
|
325
|
-
t[
|
|
359
|
+
const c = o.closest(".file-wrap")?.querySelector('input[type="file"]');
|
|
360
|
+
t[n] = c?.files ?? void 0;
|
|
326
361
|
break;
|
|
362
|
+
// 其他
|
|
327
363
|
default:
|
|
328
|
-
t[
|
|
364
|
+
t[n] = o.value;
|
|
329
365
|
break;
|
|
330
366
|
}
|
|
331
367
|
}), t;
|
|
@@ -336,115 +372,105 @@ class le {
|
|
|
336
372
|
* @returns
|
|
337
373
|
*/
|
|
338
374
|
verify(e) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const k = t.element.querySelector(`[form-field="${q}"]`), L = k.getAttribute("data-verify"), p = k.closest(".form-group");
|
|
346
|
-
switch (L) {
|
|
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");
|
|
380
|
+
switch (i) {
|
|
347
381
|
case "select":
|
|
348
|
-
const
|
|
349
|
-
|
|
382
|
+
const y = c.querySelector(".select-wrapper"), w = y.querySelector(".dropdown-icon");
|
|
383
|
+
y.querySelector(".validation-icon")?.remove(), y.insertBefore(C(s), w);
|
|
350
384
|
break;
|
|
351
385
|
case "radio":
|
|
352
386
|
case "checkbox":
|
|
353
|
-
|
|
387
|
+
r.querySelector(".validation-icon")?.remove(), r.append(C(s));
|
|
354
388
|
break;
|
|
355
389
|
case "file":
|
|
356
|
-
const
|
|
357
|
-
|
|
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));
|
|
358
392
|
break;
|
|
359
|
-
case "date":
|
|
360
|
-
case "textarea":
|
|
361
393
|
default:
|
|
362
|
-
|
|
394
|
+
c.closest(".input-wrap").querySelector(".validation-icon")?.remove(), c.closest(".input-wrap").append(C(s));
|
|
363
395
|
break;
|
|
364
396
|
}
|
|
365
397
|
}
|
|
366
398
|
}
|
|
367
|
-
if (
|
|
368
|
-
const
|
|
369
|
-
t.element.querySelectorAll(`.error-text[name="${
|
|
399
|
+
if (f(u), e) {
|
|
400
|
+
const a = Object.keys(u)[0];
|
|
401
|
+
t.element.querySelectorAll(`.error-text[name="${a}"]`).forEach((s) => s.remove());
|
|
370
402
|
} else
|
|
371
|
-
t.element.querySelectorAll(".error-text").forEach((
|
|
372
|
-
for (const
|
|
373
|
-
let p = function(v, b,
|
|
374
|
-
const g = t.element.querySelector(`[form-field="${
|
|
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>`;
|
|
375
407
|
switch (b) {
|
|
376
408
|
case "underField":
|
|
377
|
-
if (!o.errorText.underField)
|
|
378
|
-
|
|
379
|
-
x.append(C(S(v)));
|
|
409
|
+
if (!o.errorText.underField) return;
|
|
410
|
+
k.append(C(E(v)));
|
|
380
411
|
break;
|
|
381
412
|
case "detail":
|
|
382
|
-
if (!
|
|
383
|
-
|
|
384
|
-
x.append(C(S(v)));
|
|
413
|
+
if (!k) return;
|
|
414
|
+
k.append(C(E(v)));
|
|
385
415
|
break;
|
|
386
416
|
}
|
|
387
|
-
},
|
|
417
|
+
}, q = function() {
|
|
388
418
|
const v = t.detailOutputEl.querySelectorAll(".error-text");
|
|
389
419
|
[...v].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
|
|
390
|
-
const b = [...v].sort((
|
|
391
|
-
t.detailOutputEl && (t.detailOutputEl.textContent = ""), b.forEach((
|
|
392
|
-
var g;
|
|
393
|
-
return (g = t.detailOutputEl) == null ? void 0 : g.appendChild(x);
|
|
394
|
-
});
|
|
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));
|
|
395
422
|
};
|
|
396
|
-
const
|
|
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");
|
|
397
424
|
let m;
|
|
398
|
-
if (
|
|
399
|
-
switch (
|
|
425
|
+
if (A && y())
|
|
426
|
+
switch (s.classList.remove("success"), s.classList.add("error"), d.classList.add("error"), i) {
|
|
400
427
|
case "select":
|
|
401
|
-
m =
|
|
428
|
+
m = s.querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].select), p("select", "underField", d.parentNode), p("select", "detail", t.detailOutputEl);
|
|
402
429
|
break;
|
|
403
430
|
case "radio":
|
|
404
431
|
case "checkbox":
|
|
405
|
-
m =
|
|
432
|
+
m = d.querySelector(".validation-icon"), m.setAttribute("error-text", S[o.locale].select), p("select", "underField", d.parentNode), p("select", "detail", t.detailOutputEl);
|
|
406
433
|
break;
|
|
407
434
|
case "file":
|
|
408
|
-
m =
|
|
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);
|
|
409
436
|
break;
|
|
410
437
|
default:
|
|
411
|
-
m =
|
|
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);
|
|
412
439
|
break;
|
|
413
440
|
}
|
|
414
|
-
if (
|
|
415
|
-
let v = function(b,
|
|
441
|
+
if (w()) {
|
|
442
|
+
let v = function(b, k) {
|
|
416
443
|
const g = b.closest(".form-group");
|
|
417
|
-
b.classList.toggle("error", !
|
|
418
|
-
const
|
|
419
|
-
|
|
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"));
|
|
420
447
|
};
|
|
421
|
-
switch (
|
|
448
|
+
switch (i) {
|
|
422
449
|
case "phone":
|
|
423
|
-
const b =
|
|
424
|
-
|
|
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));
|
|
425
452
|
break;
|
|
426
453
|
case "password":
|
|
427
|
-
|
|
454
|
+
x.isStrongPassword(r(), {
|
|
428
455
|
minLength: 8,
|
|
429
456
|
minLowercase: 1,
|
|
430
457
|
minUppercase: 0,
|
|
431
458
|
minNumbers: 1,
|
|
432
459
|
minSymbols: 0
|
|
433
|
-
}) ? v(
|
|
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));
|
|
434
461
|
break;
|
|
435
462
|
case "email":
|
|
436
|
-
|
|
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));
|
|
437
464
|
break;
|
|
438
465
|
case "verifyCode":
|
|
439
|
-
|
|
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));
|
|
440
467
|
break;
|
|
441
|
-
case "select":
|
|
442
468
|
default:
|
|
443
|
-
v(
|
|
469
|
+
v(s, !0);
|
|
444
470
|
break;
|
|
445
471
|
}
|
|
446
472
|
}
|
|
447
|
-
t.detailOutputEl &&
|
|
473
|
+
t.detailOutputEl && q();
|
|
448
474
|
}
|
|
449
475
|
}
|
|
450
476
|
/**
|
|
@@ -458,129 +484,64 @@ class le {
|
|
|
458
484
|
* 清除表單所有欄位
|
|
459
485
|
*/
|
|
460
486
|
clear() {
|
|
461
|
-
const e = this, { allInput: t, allTextarea: o, allCheckbox:
|
|
462
|
-
[...e.allField].forEach((
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
document.querySelector(l).classList.remove("disabled");
|
|
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");
|
|
479
504
|
});
|
|
480
505
|
}), e.element.value = e.getValue();
|
|
481
506
|
}
|
|
482
507
|
}
|
|
483
|
-
T = new WeakSet(), P = function() {
|
|
484
|
-
const e = this, { datepicker: t, timepicker: o, clearEl: i, submitEl: f } = e.options;
|
|
485
|
-
function y() {
|
|
486
|
-
t.forEach((s) => {
|
|
487
|
-
_(s.el, s.options);
|
|
488
|
-
}), o.forEach((s) => {
|
|
489
|
-
_(s.el, s.options);
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
function d() {
|
|
493
|
-
const s = document.querySelector(i), n = document.querySelector(f);
|
|
494
|
-
s == null || s.addEventListener("click", function() {
|
|
495
|
-
e.clear();
|
|
496
|
-
}), n == null || n.addEventListener("click", function() {
|
|
497
|
-
e.submit();
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
function c(s) {
|
|
501
|
-
var m;
|
|
502
|
-
const n = s.closest(".form-group");
|
|
503
|
-
if (s.files.length <= 0)
|
|
504
|
-
return;
|
|
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);
|
|
509
|
-
}
|
|
510
|
-
function l() {
|
|
511
|
-
e.element.addEventListener(
|
|
512
|
-
"input",
|
|
513
|
-
z(function(s) {
|
|
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"));
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
const a = n.getAttribute("form-field"), u = {
|
|
521
|
-
[a]: e.element.value[a]
|
|
522
|
-
};
|
|
523
|
-
e.options.verify && e.verify(u);
|
|
524
|
-
}
|
|
525
|
-
})
|
|
526
|
-
), e.element.addEventListener("change", (s) => {
|
|
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]
|
|
533
|
-
}, e.verify(u));
|
|
534
|
-
}), e.allDropdown.forEach((s) => {
|
|
535
|
-
s.on("change", function() {
|
|
536
|
-
const n = this.getAttribute("form-field");
|
|
537
|
-
e.element.value = e.getValue();
|
|
538
|
-
const a = e.element.value[n], u = typeof a == "object" && !Array.isArray(a) ? a.value : a, q = {
|
|
539
|
-
[n]: a
|
|
540
|
-
};
|
|
541
|
-
(Array.isArray(u) && u.length > 0 || !Array.isArray(u) && !w.isEmpty(u)) && e.options.verify && e.verify(q);
|
|
542
|
-
});
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
y(), d(), l();
|
|
546
|
-
};
|
|
547
508
|
export {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
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,
|
|
522
|
+
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,
|
|
570
531
|
C as htmlStringToDOM,
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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
|
|
585
546
|
};
|
|
586
547
|
//# sourceMappingURL=tools-bundle.js.map
|