domquery-com 1.0.0
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/LICENSE +22 -0
- package/README.ko.md +273 -0
- package/README.md +272 -0
- package/domquery.js +6290 -0
- package/domquery.min.js +361 -0
- package/package.json +53 -0
- package/src/Kcolor.js +909 -0
- package/src/ajax.js +1220 -0
- package/src/alert.js +3516 -0
- package/src/animate.js +1775 -0
- package/src/lazyLoadImages.js +202 -0
- package/src/pulling.js +473 -0
- package/src/select.js +3154 -0
- package/src_min/Kcolor.min.js +45 -0
- package/src_min/ajax.min.js +61 -0
- package/src_min/alert.min.js +240 -0
- package/src_min/animate.min.js +118 -0
- package/src_min/lazyLoadImages.min.js +13 -0
- package/src_min/pulling.min.js +23 -0
- package/src_min/select.min.js +186 -0
package/src/select.js
ADDED
|
@@ -0,0 +1,3154 @@
|
|
|
1
|
+
function rgbToRgba(v, l = .5) {
|
|
2
|
+
if (!v || v.startsWith("rgba")) return v;
|
|
3
|
+
var H = v.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
|
|
4
|
+
if (H) {
|
|
5
|
+
const [, r, y, n] = H;
|
|
6
|
+
return `rgba(${r}, ${y}, ${n}, ${l})`
|
|
7
|
+
}
|
|
8
|
+
if (H = v.match(/^#([a-fA-F0-9]{6})$/)) {
|
|
9
|
+
var q = H[1];
|
|
10
|
+
v = parseInt(q.substr(0, 2), 16);
|
|
11
|
+
H = parseInt(q.substr(2, 2), 16);
|
|
12
|
+
q = parseInt(q.substr(4, 2), 16);
|
|
13
|
+
return `rgba(${v}, ${H}, ${q}, ${l})`
|
|
14
|
+
}
|
|
15
|
+
return (H = v.match(/^#([a-fA-F0-9]{3})$/)) ? (q = H[1], v = parseInt(q[0] + q[0], 16), H = parseInt(q[1] + q[1], 16), q = parseInt(q[2] + q[2], 16), `rgba(${v}, ${H}, ${q}, ${l})`) : v
|
|
16
|
+
}
|
|
17
|
+
$.select = function(v, l, H) {
|
|
18
|
+
function q() {
|
|
19
|
+
var g = "undefined" !== typeof $ && $.isMobile ? $.isMobile() : {
|
|
20
|
+
isMobile: !1,
|
|
21
|
+
isTablet: !1,
|
|
22
|
+
isIOS: !1
|
|
23
|
+
};
|
|
24
|
+
return !0 === g.isMobile
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function r(g) {
|
|
28
|
+
const C = document.createElement("div");
|
|
29
|
+
C.innerHTML = g;
|
|
30
|
+
return C.textContent || C.innerText || ""
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function y(g, C = 0) {
|
|
34
|
+
return 1 === C ? g.replace(/\x3c!--(.*?)--\x3e/g, "$1").replace(/<[^>]*>/g, "") : g.replace(/\x3c!--(.*?)--\x3e/g, "$1")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function n(g, C, x) {
|
|
38
|
+
g = $(g);
|
|
39
|
+
x = g.find("option, li").eq(x);
|
|
40
|
+
if (!x.length) return {
|
|
41
|
+
text: g.find("option, li").first().text().trim(),
|
|
42
|
+
tag: null
|
|
43
|
+
};
|
|
44
|
+
var t = x.html().replace(/\x3c!--(.*?)--\x3e/g, "$1").trim();
|
|
45
|
+
C = [];
|
|
46
|
+
var F = x;
|
|
47
|
+
for (C.unshift(t); F.length;) {
|
|
48
|
+
var T = F.attr("class")?.split(" ") || [];
|
|
49
|
+
t = !1;
|
|
50
|
+
for (const f of T)
|
|
51
|
+
if (T = g.find(`[group="${f}"]`), T.length) {
|
|
52
|
+
F = T.html().replace(/\x3c!--(.*?)--\x3e/g, "$1").trim();
|
|
53
|
+
C.unshift(F);
|
|
54
|
+
F = T;
|
|
55
|
+
t = !0;
|
|
56
|
+
break
|
|
57
|
+
} if (!t) break
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
text: C.join(" > "),
|
|
61
|
+
tag: x.attr("tag")
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function Q(g, C) {
|
|
66
|
+
C = parseInt(C?.radioSize || "16") / 2;
|
|
67
|
+
return `<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: ${C}px; height: ${C}px; background-color: ${g}; border-radius: 50%;"></div>`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function U(g) {
|
|
71
|
+
g = parseInt(g);
|
|
72
|
+
return `<span style="\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\twidth: ${.3*g}px;\n\t\t\theight: ${.6*g}px;\n\t\t\tborder: solid white;\n\t\t\tborder-width: 0 ${.12*g}px ${.12*g}px 0;\n\t\t\ttransform: translate(-50%, -65%) rotate(45deg);\n\t\t\tdisplay: block;\n\t\t"></span>`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function A(g, C = "16px") {
|
|
76
|
+
return `<div style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: ${Math.max(.7*
|
|
77
|
+
parseInt(C),10)}px; font-weight: bold; line-height: 1; text-align: center; -webkit-font-smoothing: antialiased; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-tap-highlight-color: transparent;">${g}</div>`
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function Y(g = "50%", C = "10px") {
|
|
81
|
+
return {
|
|
82
|
+
position: "absolute",
|
|
83
|
+
right: C,
|
|
84
|
+
top: g,
|
|
85
|
+
transform: "translateY(-50%)",
|
|
86
|
+
width: "16px",
|
|
87
|
+
height: "16px"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function ca(g) {
|
|
92
|
+
let C = g.groupArrowStyle?.size || g.arrowSize,
|
|
93
|
+
x = g.arrowRight || Y().right,
|
|
94
|
+
t = g.groupArrowColor || g.arrowColor;
|
|
95
|
+
if ("checkbox" ===
|
|
96
|
+
g.pointer || g.pointer?.startsWith("checkbox_")) {
|
|
97
|
+
if (!g.groupArrowStyle?.size && g.checkboxSize) {
|
|
98
|
+
var F = parseFloat(g.checkboxSize);
|
|
99
|
+
isNaN(F) || (C = `${.6*F}px`)
|
|
100
|
+
}!g.groupArrowColor && g.checkboxColor && (t = g.checkboxColor)
|
|
101
|
+
} else "radio" === g.pointer ? (!g.groupArrowStyle?.size && g.radioSize && (F = parseFloat(g.radioSize), isNaN(F) || (C = `${.6*F}px`)), !g.groupArrowColor && g.radioColor && (t = g.radioColor)) : g.pointer && g.pointer.startsWith("question_") && !g.groupArrowColor && g.questionColor && (t = g.questionColor);
|
|
102
|
+
return {
|
|
103
|
+
arrowSizeValue: C,
|
|
104
|
+
arrowRightValue: x,
|
|
105
|
+
arrowColorValue: t
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function O(g) {
|
|
110
|
+
return {
|
|
111
|
+
wrapperClass: g + "-wrapper",
|
|
112
|
+
triggerClass: g + "-trigger",
|
|
113
|
+
optionsClass: g + "-options",
|
|
114
|
+
optionClass: g + "-option",
|
|
115
|
+
openClass: g + "-open"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function L(g) {
|
|
120
|
+
return {
|
|
121
|
+
border: `2px solid ${g||"#ccc"}`,
|
|
122
|
+
backgroundColor: "#fff"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function M(g) {
|
|
127
|
+
ua && ((g = g.find("select").first()[0]) && g._selectId && (g = window._gong_tea_yun_0.get(g._selectId + "_close")) && g.call(this, ua), ua = 0)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function B(g, C, x) {
|
|
131
|
+
const t = g.closest('[class*="-wrapper"]');
|
|
132
|
+
g.find("div").first().css({
|
|
133
|
+
"background-color": x.optionsStyle.background ||
|
|
134
|
+
"#fff"
|
|
135
|
+
});
|
|
136
|
+
M(t);
|
|
137
|
+
C ? x.slideToggle ? g.css("opacity", x.opacity || 0).slideToggle(C, {
|
|
138
|
+
easing: x.easing,
|
|
139
|
+
complete: domqueryFocus
|
|
140
|
+
}) : g.css("opacity", "").slideToggle(C, {
|
|
141
|
+
easing: x.easing,
|
|
142
|
+
complete: domqueryFocus
|
|
143
|
+
}) : (g.hide(), domqueryFocus())
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function N(g, C, x, t) {
|
|
147
|
+
if (!qa) {
|
|
148
|
+
qa = !0;
|
|
149
|
+
var F = g.closest('[class*="-wrapper"]');
|
|
150
|
+
M(F);
|
|
151
|
+
x.css({
|
|
152
|
+
"background-color": "rgba(0, 0, 0, 0)"
|
|
153
|
+
});
|
|
154
|
+
var T = F.find("select").first()[0]._selectId;
|
|
155
|
+
setTimeout(() => {
|
|
156
|
+
T && domquery(this).historyOff("select-" + T);
|
|
157
|
+
qa = !1
|
|
158
|
+
}, C + 300);
|
|
159
|
+
g.slideToggle(C, {
|
|
160
|
+
easing: t.easing,
|
|
161
|
+
complete: function() {
|
|
162
|
+
x.hide();
|
|
163
|
+
domqueryFocus()
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function z(g, C, x, t, F) {
|
|
170
|
+
if (!qa) {
|
|
171
|
+
qa = !0;
|
|
172
|
+
M(t);
|
|
173
|
+
t.data("upHTMe10Running", !0);
|
|
174
|
+
x.css({
|
|
175
|
+
"background-color": "rgba(0, 0, 0, 0)",
|
|
176
|
+
opacity: ""
|
|
177
|
+
});
|
|
178
|
+
var T = t.find("select").first()[0]._selectId;
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
!t.data("groupClicked") && T && domquery(this).historyOff("select-" + T);
|
|
181
|
+
qa = !1
|
|
182
|
+
}, C + 300);
|
|
183
|
+
g.css("opacity", "").slideToggle(C, {
|
|
184
|
+
easing: F.easing,
|
|
185
|
+
complete: function() {
|
|
186
|
+
x.css("pointer-events", "none").hide();
|
|
187
|
+
t.removeClass(F.openClass);
|
|
188
|
+
t.attr("data-state", "closed");
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
x.css("pointer-events", "")
|
|
191
|
+
}, 100);
|
|
192
|
+
domqueryFocus()
|
|
193
|
+
}
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function Z(g, C) {
|
|
199
|
+
var x = q(),
|
|
200
|
+
t = g.data("settings");
|
|
201
|
+
if (!x) {
|
|
202
|
+
const F = g[0].getBoundingClientRect(),
|
|
203
|
+
T = window.innerHeight;
|
|
204
|
+
C = C.find("div").first();
|
|
205
|
+
const f = t && t.height,
|
|
206
|
+
R = f || `${.6*T}px`;
|
|
207
|
+
x = T - F.bottom;
|
|
208
|
+
const V = F.top;
|
|
209
|
+
if (t.parentView) return g = {
|
|
210
|
+
position: "fixed",
|
|
211
|
+
left: F.left + "px",
|
|
212
|
+
width: F.width + "px",
|
|
213
|
+
zIndex: 1E3,
|
|
214
|
+
height: R,
|
|
215
|
+
overflowY: "auto",
|
|
216
|
+
overflowX: "hidden"
|
|
217
|
+
}, V > x && x < C[0].scrollHeight ? (g.bottom = T - F.top + "px", g.top = "auto", g.borderRadius = "4px 4px 0 0") : (g.top = F.bottom + "px", g.bottom = "auto", g.borderRadius = "0 0 4px 4px"),
|
|
218
|
+
g;
|
|
219
|
+
if (f) return {
|
|
220
|
+
top: "100%",
|
|
221
|
+
bottom: "auto",
|
|
222
|
+
borderRadius: "0 0 4px 4px",
|
|
223
|
+
borderTop: "none",
|
|
224
|
+
borderBottom: "1px solid #ccc"
|
|
225
|
+
};
|
|
226
|
+
g = g.find("select").first();
|
|
227
|
+
g = (g.length ? parseInt(g.height() || g.css("height")) : null) || C[0].scrollHeight;
|
|
228
|
+
t = {
|
|
229
|
+
top: "100%",
|
|
230
|
+
bottom: "auto",
|
|
231
|
+
borderRadius: "0 0 4px 4px",
|
|
232
|
+
borderTop: "none",
|
|
233
|
+
borderBottom: "1px solid #ccc"
|
|
234
|
+
};
|
|
235
|
+
x < g && V > x ? (t = {
|
|
236
|
+
top: "auto",
|
|
237
|
+
bottom: "100%",
|
|
238
|
+
borderRadius: "4px 4px 0 0",
|
|
239
|
+
borderBottom: "1px solid #ccc",
|
|
240
|
+
borderTop: "none"
|
|
241
|
+
}, V < g && C.css({
|
|
242
|
+
maxHeight: `${V-10}px`,
|
|
243
|
+
overflowY: "auto"
|
|
244
|
+
})) : x < g && C.css({
|
|
245
|
+
maxHeight: `${x-
|
|
246
|
+
10}px`,
|
|
247
|
+
overflowY: "auto"
|
|
248
|
+
});
|
|
249
|
+
return t
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
position: "fixed",
|
|
253
|
+
left: "0",
|
|
254
|
+
right: "0",
|
|
255
|
+
bottom: "0",
|
|
256
|
+
top: "auto",
|
|
257
|
+
borderRadius: t.MborderRadius || "4px 4px 0 0",
|
|
258
|
+
width: "100%",
|
|
259
|
+
Mheight: t.Mheight || "60vh",
|
|
260
|
+
height: t.height || "auto",
|
|
261
|
+
minHeight: t.minHeight || "auto",
|
|
262
|
+
maxHeight: t.maxHeight || (x ? t.Mheight || "60vh" : t.height || "300px"),
|
|
263
|
+
overflowY: "auto",
|
|
264
|
+
zIndex: "1000"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function aa(g) {
|
|
269
|
+
g.css({
|
|
270
|
+
"pointer-events": "none",
|
|
271
|
+
opacity: "0.6"
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function ja(g, C) {
|
|
276
|
+
C && g && Object.entries(C).forEach(([x, t]) => {
|
|
277
|
+
try {
|
|
278
|
+
g.style[x] = t
|
|
279
|
+
} catch (F) {
|
|
280
|
+
console.warn("Style application failed for property:",
|
|
281
|
+
x)
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function na(g, C) {
|
|
287
|
+
if (C.scrollColor) try {
|
|
288
|
+
g.find('[class*="-options"]');
|
|
289
|
+
const x = C.optionsStyle.background || "#fff",
|
|
290
|
+
t = C.optionStyle.borderBottomColor || "#ddd",
|
|
291
|
+
F = `scrollbar-${g.attr("id")||Math.random().toString(36).substr(2,9)}`;
|
|
292
|
+
$(`#${F}`).remove();
|
|
293
|
+
const T = document.createElement("style");
|
|
294
|
+
T.id = F;
|
|
295
|
+
T.textContent = `\n\t\t\t\t#${g.attr("id")} .${C.optionsClass}::-webkit-scrollbar,\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} div::-webkit-scrollbar {\n\t\t\t\t\twidth: 8px;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t#${g.attr("id")} .${C.optionsClass}::-webkit-scrollbar-track,\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} div::-webkit-scrollbar-track {\n\t\t\t\t\tbackground: ${x};\n\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t#${g.attr("id")} .${C.optionsClass}::-webkit-scrollbar-thumb,\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} div::-webkit-scrollbar-thumb {\n\t\t\t\t\tbackground: ${t};\n\t\t\t\t\tborder-radius: 4px;\n\t\t\t\t\tborder: 1px solid ${x};\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t#${g.attr("id")} .${C.optionsClass}::-webkit-scrollbar-thumb:hover,\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} div::-webkit-scrollbar-thumb:hover {\n\t\t\t\t\tbackground: ${t};\n\t\t\t\t\topacity: 0.8;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} {\n\t\t\t\t\tscrollbar-width: thin;\n\t\t\t\t\tscrollbar-color: ${t} ${x};\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t#${g.attr("id")} .${C.optionsClass} div {\n\t\t\t\t\tscrollbar-width: thin;\n\t\t\t\t\tscrollbar-color: ${t} ${x};\n\t\t\t\t}\n\t\t\t`;
|
|
296
|
+
document.head.appendChild(T);
|
|
297
|
+
g.data("scrollbarStyleId", F)
|
|
298
|
+
} catch (x) {
|
|
299
|
+
console.warn("\uc2a4\ud06c\ub864\ubc14 \uc0c9\uc0c1 \uc801\uc6a9 \uc911 \uc624\ub958:", x)
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
let qa = !1,
|
|
303
|
+
ua = 0;
|
|
304
|
+
window._isMouseDown_gong = !1;
|
|
305
|
+
window._isGroupClick = !1;
|
|
306
|
+
window._selectPreviousFocus || (window._selectPreviousFocus = null);
|
|
307
|
+
$(document).off("mousedown.selectTrigger touchstart.selectTrigger", '[class*="-trigger"]').on("mousedown.selectTrigger touchstart.selectTrigger", '[class*="-trigger"]', function(g) {
|
|
308
|
+
!(g = document.activeElement) || "INPUT" !==
|
|
309
|
+
g.tagName && "TEXTAREA" !== g.tagName && "true" !== g.getAttribute("contenteditable") || (window._selectPreviousFocus = g, void 0 !== g.selectionStart && (window._selectPreviousFocusPosition = g.selectionStart))
|
|
310
|
+
});
|
|
311
|
+
window.domqueryFocus = function() {
|
|
312
|
+
if (q()) try {
|
|
313
|
+
window._selectPreviousFocus && document.body.contains(window._selectPreviousFocus) ? setTimeout(() => {
|
|
314
|
+
try {
|
|
315
|
+
if (window._selectPreviousFocus.focus(), "INPUT" === window._selectPreviousFocus.tagName || "TEXTAREA" === window._selectPreviousFocus.tagName) {
|
|
316
|
+
const g = window._selectPreviousFocus.value.length;
|
|
317
|
+
window._selectPreviousFocus.setSelectionRange(g, g)
|
|
318
|
+
}
|
|
319
|
+
} catch (g) {}
|
|
320
|
+
window._selectPreviousFocus = null
|
|
321
|
+
}, 100) : window._selectPreviousFocus = null
|
|
322
|
+
} catch (g) {
|
|
323
|
+
window._selectPreviousFocus = null
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
window._gong_tea_yun_0 || (window._gong_tea_yun_0 = new Map);
|
|
327
|
+
window._gong_tea_yun_1 || (window._gong_tea_yun_1 = new Map);
|
|
328
|
+
if (!document.getElementById("custom-select-group-style")) {
|
|
329
|
+
const g = document.createElement("style");
|
|
330
|
+
g.id = "custom-select-group-style";
|
|
331
|
+
g.textContent = "\n\t\t\t.group-option {\n\t\t\t\tposition: relative;\n\t\t\t\tpadding-right: 30px !important;\n\t\t\t\tfont-style: italic;\n\t\t\t\tcolor: #666;\n\t\t\t\tfont-weight: bold;\n\t\t\t}\n\t\t\t.child-option {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t\t\n\t\t";
|
|
332
|
+
document.head.appendChild(g)
|
|
333
|
+
}
|
|
334
|
+
"function" === typeof v ? (H = v, l = {}, v = 0) : "function" === typeof l ? "object" === typeof v ? (H = l, l = v, v = 0) : (H = l, l = {}) : "object" === typeof v && (l = v, v = 0);
|
|
335
|
+
l = l || {};
|
|
336
|
+
v = parseInt(v) || 0;
|
|
337
|
+
this.elements.forEach(g => {
|
|
338
|
+
function C(c) {
|
|
339
|
+
if (!c) return "10px";
|
|
340
|
+
c = c.split(" ").filter(a => a.trim());
|
|
341
|
+
return 1 === c.length ? c[0] : 2 === c.length ? c[1] : 4 === c.length ? c[3] : "10px"
|
|
342
|
+
}
|
|
343
|
+
if (g._selectId) {
|
|
344
|
+
var x = $(g).parent();
|
|
345
|
+
if (x.length && x[0].className && "string" === typeof x[0].className && x[0].className.includes("-wrapper")) return
|
|
346
|
+
}
|
|
347
|
+
var t = Math.random().toString(36).substr(2,
|
|
348
|
+
9);
|
|
349
|
+
x = "select-" + t;
|
|
350
|
+
var F = O(x),
|
|
351
|
+
T = q();
|
|
352
|
+
T = "auto" === l.slideToggle ? T ? !1 : !0 : l.slideToggle || !1;
|
|
353
|
+
let f = {
|
|
354
|
+
...O(x),
|
|
355
|
+
height: l.height,
|
|
356
|
+
defaultText: "Select an option",
|
|
357
|
+
allowHTML: !0,
|
|
358
|
+
opacity: 0,
|
|
359
|
+
easing: "linear",
|
|
360
|
+
onclick: !1,
|
|
361
|
+
offclick: !1,
|
|
362
|
+
trigger: null,
|
|
363
|
+
triggerOnce: null,
|
|
364
|
+
onSelect: null,
|
|
365
|
+
activeBackground: "#f5f5f5",
|
|
366
|
+
highlightedClass: "highlighted",
|
|
367
|
+
pointer: null,
|
|
368
|
+
showArrow: !0,
|
|
369
|
+
arrowColor: "#333",
|
|
370
|
+
arrowSize: "5px",
|
|
371
|
+
arrowRight: "10px",
|
|
372
|
+
arrowTop: "50%",
|
|
373
|
+
tagMargin: l.tagMargin || "0 0 0 10px",
|
|
374
|
+
closeBox: l.closeBox || !1,
|
|
375
|
+
checkboxSize: l.checkboxSize || "16px",
|
|
376
|
+
questionSize: l.questionSize ||
|
|
377
|
+
"16px",
|
|
378
|
+
radioSize: l.radioSize || "16px",
|
|
379
|
+
scrollColor: l.scrollColor || !1,
|
|
380
|
+
triggerBgColor: l.triggerBgColor,
|
|
381
|
+
triggerColor: l.triggerColor,
|
|
382
|
+
triggerBorderColor: l.triggerBorderColor,
|
|
383
|
+
triggerBorderWidth: l.triggerBorderWidth,
|
|
384
|
+
triggerBorderRadius: l.triggerBorderRadius,
|
|
385
|
+
triggerFontSize: l.triggerFontSize,
|
|
386
|
+
triggerFontWeight: l.triggerFontWeight,
|
|
387
|
+
triggerPadding: l.triggerPadding,
|
|
388
|
+
triggerHeight: l.triggerHeight,
|
|
389
|
+
triggerLineHeight: l.triggerLineHeight,
|
|
390
|
+
triggerActiveBgColor: l.triggerActiveBgColor,
|
|
391
|
+
triggerActiveColor: l.triggerActiveColor,
|
|
392
|
+
triggerActiveBorderColor: l.triggerActiveBorderColor,
|
|
393
|
+
wrapperStyle: {
|
|
394
|
+
position: "relative",
|
|
395
|
+
caretColor: "transparent",
|
|
396
|
+
margin: "0",
|
|
397
|
+
padding: "0",
|
|
398
|
+
WebkitTapHighlightColor: "transparent",
|
|
399
|
+
WebkitTouchCallout: "none"
|
|
400
|
+
},
|
|
401
|
+
triggerStyle: {
|
|
402
|
+
padding: l.defaultPadding || "10px",
|
|
403
|
+
paddingRight: l.defaultPaddingRight || "40px",
|
|
404
|
+
margin: l.defaultMargin || "0",
|
|
405
|
+
border: `${l.defaultBorderWidth||"1px"} ${l.defaultBorderStyle||"solid"} ${l.defaultBorderColor||"#ccc"}`,
|
|
406
|
+
borderRadius: l.defaultBorderRadius || "4px",
|
|
407
|
+
cursor: l.defaultCursor || "pointer",
|
|
408
|
+
background: l.defaultBgColor ||
|
|
409
|
+
"#fff",
|
|
410
|
+
color: l.defaultColor || "#000",
|
|
411
|
+
position: l.defaultPosition || "relative",
|
|
412
|
+
WebkitTapHighlightColor: l.defaultTapHighlight || "transparent",
|
|
413
|
+
WebkitTouchCallout: l.defaultTouchCallout || "none",
|
|
414
|
+
boxSizing: l.defaultBoxSizing || "border-box"
|
|
415
|
+
},
|
|
416
|
+
overlayStyle: {
|
|
417
|
+
position: "fixed",
|
|
418
|
+
top: 0,
|
|
419
|
+
left: 0,
|
|
420
|
+
right: 0,
|
|
421
|
+
bottom: 0,
|
|
422
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
423
|
+
zIndex: 999,
|
|
424
|
+
transition: "background-color 0.3s ease",
|
|
425
|
+
display: "none"
|
|
426
|
+
},
|
|
427
|
+
optionsStyle: {
|
|
428
|
+
position: "absolute",
|
|
429
|
+
top: "100%",
|
|
430
|
+
left: "0",
|
|
431
|
+
right: "0",
|
|
432
|
+
margin: "0",
|
|
433
|
+
padding: "0",
|
|
434
|
+
background: "#fff",
|
|
435
|
+
border: "1px solid #ddd",
|
|
436
|
+
borderTop: "none",
|
|
437
|
+
borderRadius: "0 0 4px 4px",
|
|
438
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
439
|
+
zIndex: "1",
|
|
440
|
+
WebkitOverflowScrolling: "touch",
|
|
441
|
+
WebkitTapHighlightColor: "transparent",
|
|
442
|
+
touchAction: "manipulation"
|
|
443
|
+
},
|
|
444
|
+
optionStyle: {
|
|
445
|
+
padding: "10px",
|
|
446
|
+
cursor: "pointer",
|
|
447
|
+
fontWeight: "normal",
|
|
448
|
+
WebkitTapHighlightColor: "transparent",
|
|
449
|
+
WebkitTouchCallout: "none",
|
|
450
|
+
borderBottom: "1px solid #f5f0f0",
|
|
451
|
+
position: "relative"
|
|
452
|
+
},
|
|
453
|
+
selectedOptionStyle: {
|
|
454
|
+
background: "transparent",
|
|
455
|
+
fontWeight: "bold"
|
|
456
|
+
},
|
|
457
|
+
selectedBg: null,
|
|
458
|
+
disabledOptionStyle: {
|
|
459
|
+
filter: "opacity(0.5)",
|
|
460
|
+
cursor: "not-allowed",
|
|
461
|
+
fontStyle: "italic"
|
|
462
|
+
},
|
|
463
|
+
disabledStyle: {
|
|
464
|
+
filter: "opacity(0.5)",
|
|
465
|
+
cursor: "not-allowed",
|
|
466
|
+
textDecoration: "line-through"
|
|
467
|
+
},
|
|
468
|
+
questionStyle: {
|
|
469
|
+
...Y(),
|
|
470
|
+
...L(l.buttonColor),
|
|
471
|
+
borderRadius: "50%",
|
|
472
|
+
display: "flex",
|
|
473
|
+
alignItems: "center",
|
|
474
|
+
justifyContent: "center",
|
|
475
|
+
fontSize: "12px",
|
|
476
|
+
fontWeight: "bold",
|
|
477
|
+
color: l.buttonColor || "#666",
|
|
478
|
+
width: l.questionSize || "16px",
|
|
479
|
+
height: l.questionSize || "16px"
|
|
480
|
+
},
|
|
481
|
+
checkboxStyle: {
|
|
482
|
+
...Y(),
|
|
483
|
+
...L(l.buttonColor),
|
|
484
|
+
borderRadius: "3px",
|
|
485
|
+
zIndex: "1",
|
|
486
|
+
display: "block"
|
|
487
|
+
},
|
|
488
|
+
checkboxSelectedStyle: {
|
|
489
|
+
border: "2px solid #007bff",
|
|
490
|
+
backgroundColor: "#007bff",
|
|
491
|
+
"&::after": {
|
|
492
|
+
content: '""',
|
|
493
|
+
position: "absolute",
|
|
494
|
+
left: "5px",
|
|
495
|
+
top: "1px",
|
|
496
|
+
width: "4px",
|
|
497
|
+
height: "8px",
|
|
498
|
+
border: "solid white",
|
|
499
|
+
borderWidth: "0 2px 2px 0",
|
|
500
|
+
transform: "rotate(45deg)",
|
|
501
|
+
display: "block"
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
radioStyle: {
|
|
505
|
+
...Y(),
|
|
506
|
+
...L(l.buttonColor),
|
|
507
|
+
borderRadius: "50%"
|
|
508
|
+
},
|
|
509
|
+
radioSelectedStyle: {
|
|
510
|
+
border: "2px solid #007bff",
|
|
511
|
+
borderRadius: "50%",
|
|
512
|
+
backgroundColor: "#fff",
|
|
513
|
+
"&::after": {
|
|
514
|
+
content: '""',
|
|
515
|
+
position: "absolute",
|
|
516
|
+
top: "50%",
|
|
517
|
+
left: "50%",
|
|
518
|
+
transform: "translate(-50%, -50%)",
|
|
519
|
+
width: "8px",
|
|
520
|
+
height: "8px",
|
|
521
|
+
backgroundColor: "#007bff",
|
|
522
|
+
borderRadius: "50%"
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
radioDisabledStyle: {
|
|
526
|
+
border: "2px solid #ddd",
|
|
527
|
+
backgroundColor: "#f5f5f5",
|
|
528
|
+
cursor: "not-allowed"
|
|
529
|
+
},
|
|
530
|
+
dotStyle: {
|
|
531
|
+
position: "absolute",
|
|
532
|
+
right: "10px",
|
|
533
|
+
top: "50%",
|
|
534
|
+
transform: "translateY(-50%)",
|
|
535
|
+
width: "4px",
|
|
536
|
+
height: "4px",
|
|
537
|
+
borderRadius: "50%",
|
|
538
|
+
border: "2px solid #ccc",
|
|
539
|
+
backgroundColor: "#ccc"
|
|
540
|
+
},
|
|
541
|
+
dotSelectedStyle: {
|
|
542
|
+
border: `2px solid ${l.dotColor||"#007bff"}`,
|
|
543
|
+
backgroundColor: l.dotColor || "#007bff"
|
|
544
|
+
},
|
|
545
|
+
defaultBgColor: "#ffffff",
|
|
546
|
+
defaultColor: "#333333",
|
|
547
|
+
defaultBorderColor: "#cccccc",
|
|
548
|
+
triggerHoverBgColor: l.triggerHoverBgColor || "#f5f5f5",
|
|
549
|
+
triggerHoverColor: l.triggerHoverColor ||
|
|
550
|
+
"#000000",
|
|
551
|
+
triggerHoverBorderColor: l.triggerHoverBorderColor || "#999999",
|
|
552
|
+
radioColor: l.radioColor || "#007bff",
|
|
553
|
+
checkboxColor: l.checkboxColor || "#007bff",
|
|
554
|
+
questionColor: l.questionColor || "#007bff",
|
|
555
|
+
buttonColor: l.buttonColor || "#ccc",
|
|
556
|
+
dotColor: l.dotColor || "#007bff",
|
|
557
|
+
...l,
|
|
558
|
+
...F,
|
|
559
|
+
slideToggle: T
|
|
560
|
+
};
|
|
561
|
+
("checkbox" === f.pointer || f.pointer?.startsWith("checkbox_")) && setTimeout(() => {
|
|
562
|
+
const c = $(g),
|
|
563
|
+
a = c.find("option[selected]").filter(function() {
|
|
564
|
+
return "" !== $(this).val().trim() && !$(this).is(":disabled")
|
|
565
|
+
}).map(function() {
|
|
566
|
+
return {
|
|
567
|
+
value: $(this).val(),
|
|
568
|
+
text: $(this).text(),
|
|
569
|
+
index: $(this).index()
|
|
570
|
+
}
|
|
571
|
+
}).get().length,
|
|
572
|
+
b = c.closest('[class*="-wrapper"]');
|
|
573
|
+
b.attr("data-check-count", a);
|
|
574
|
+
const h = b.find(`.${f.triggerClass}`).find(".custom-checkbox");
|
|
575
|
+
h.css({
|
|
576
|
+
border: `2px solid ${0<a?f.checkboxColor:f.buttonColor}`,
|
|
577
|
+
backgroundColor: 0 < a ? f.checkboxColor : "#fff",
|
|
578
|
+
width: f.checkboxSize,
|
|
579
|
+
height: f.checkboxSize
|
|
580
|
+
});
|
|
581
|
+
0 < a && h.html(A(a, f.checkboxSize));
|
|
582
|
+
b.find('[class*="-option"]').each(function() {
|
|
583
|
+
const d = $(this);
|
|
584
|
+
var k = d.attr("data-value"),
|
|
585
|
+
u = c.find(`option[value="${k}"]`);
|
|
586
|
+
k = u.is("[selected]") &&
|
|
587
|
+
"" !== k.trim();
|
|
588
|
+
u = u.is(":disabled");
|
|
589
|
+
const m = d.find(".custom-checkbox");
|
|
590
|
+
m.length && (m.css({
|
|
591
|
+
border: `2px solid ${k?f.checkboxColor:f.buttonColor}`,
|
|
592
|
+
backgroundColor: k ? f.checkboxColor : u ? "#f5f5f5" : "#fff",
|
|
593
|
+
width: f.checkboxSize,
|
|
594
|
+
height: f.checkboxSize
|
|
595
|
+
}), k && m.html(U(f.checkboxSize)), d.attr("data-checked", k ? "true" : "false"))
|
|
596
|
+
})
|
|
597
|
+
}, 0);
|
|
598
|
+
g._selectId || (g._selectId = t);
|
|
599
|
+
H && window._gong_tea_yun_0.set(g._selectId + "_callback", H);
|
|
600
|
+
l.onSelect && window._gong_tea_yun_0.set(g._selectId + "_onSelect", l.onSelect);
|
|
601
|
+
l.open && window._gong_tea_yun_0.set(g._selectId +
|
|
602
|
+
"_open", l.open);
|
|
603
|
+
l.close && window._gong_tea_yun_0.set(g._selectId + "_close", l.close);
|
|
604
|
+
x = "select" === g.tagName.toLowerCase();
|
|
605
|
+
F = "ul" === g.tagName.toLowerCase();
|
|
606
|
+
if (x || F) {
|
|
607
|
+
if (F) {
|
|
608
|
+
var R = document.createElement("select");
|
|
609
|
+
R.className = g.className;
|
|
610
|
+
(x = g.getAttribute("onchange")) && R.setAttribute("onchange", x);
|
|
611
|
+
const c = new Set;
|
|
612
|
+
|
|
613
|
+
function a(b, h = 0) {
|
|
614
|
+
Array.from(b).forEach(d => {
|
|
615
|
+
if (!c.has(d))
|
|
616
|
+
if (c.add(d), d.hasAttribute("group")) {
|
|
617
|
+
var k = d.getAttribute("group");
|
|
618
|
+
const u = document.createElement("option");
|
|
619
|
+
u.innerHTML = d.innerHTML;
|
|
620
|
+
u.setAttribute("group",
|
|
621
|
+
k);
|
|
622
|
+
u.setAttribute("data-is-group", "true");
|
|
623
|
+
u.setAttribute("data-level", h);
|
|
624
|
+
d.className && (u.className = d.className);
|
|
625
|
+
R.appendChild(u);
|
|
626
|
+
const m = d.getAttribute("group");
|
|
627
|
+
d = Array.from(g.children).filter(D => D.classList.contains(m));
|
|
628
|
+
a(d, h + 1)
|
|
629
|
+
} else k = document.createElement("option"), k.value = d.getAttribute("value") || "", k.innerHTML = d.innerHTML, d.hasAttribute("img") && k.setAttribute("img", d.getAttribute("img")), d.getAttribute("tag") && k.setAttribute("tag", d.getAttribute("tag")), d.hasAttribute("disabled") && (k.disabled = !0), d.hasAttribute("selected") && (k.selected = !0), d.className && (k.className = d.className), k.setAttribute("data-level", h), R.appendChild(k)
|
|
630
|
+
})
|
|
631
|
+
}
|
|
632
|
+
a(g.children);
|
|
633
|
+
g.parentNode.replaceChild(R, g)
|
|
634
|
+
} else R = g;
|
|
635
|
+
R._selectId = g._selectId;
|
|
636
|
+
var V = document.createElement("div");
|
|
637
|
+
V.className = f.wrapperClass;
|
|
638
|
+
V.setAttribute("data-state", "closed");
|
|
639
|
+
V.setAttribute("tabindex", "0");
|
|
640
|
+
V.setAttribute("data-selected-index", "-1");
|
|
641
|
+
V.setAttribute("data-previous-index", "-1");
|
|
642
|
+
$(V).data("settings", f);
|
|
643
|
+
l.width && (V.style.width = l.width, V.style.boxSizing =
|
|
644
|
+
"border-box");
|
|
645
|
+
(x = R.querySelector("option:checked")) && x.value && (V.setAttribute("data-selected-value", x.value), x = Array.from(R.options).indexOf(x), V.setAttribute("data-selected-index", x));
|
|
646
|
+
ja(V, f.wrapperStyle);
|
|
647
|
+
x = document.createElement("div");
|
|
648
|
+
x.style.position = "relative";
|
|
649
|
+
var fa = document.createElement("div");
|
|
650
|
+
fa.className = f.triggerClass;
|
|
651
|
+
fa.setAttribute("tabindex", "-1");
|
|
652
|
+
ja(fa, {
|
|
653
|
+
padding: f.defaultPadding || "10px",
|
|
654
|
+
paddingRight: f.defaultPaddingRight || "40px",
|
|
655
|
+
margin: f.defaultMargin || "0",
|
|
656
|
+
border: `${f.defaultBorderWidth||
|
|
657
|
+
"1px"} solid ${f.defaultBorderColor||"#ccc"}`,
|
|
658
|
+
borderRadius: f.defaultBorderRadius || "4px",
|
|
659
|
+
cursor: "pointer",
|
|
660
|
+
backgroundColor: f.defaultBgColor,
|
|
661
|
+
color: f.defaultColor,
|
|
662
|
+
position: "relative",
|
|
663
|
+
width: "100%",
|
|
664
|
+
boxSizing: "border-box"
|
|
665
|
+
});
|
|
666
|
+
$(fa).on({
|
|
667
|
+
mouseenter: function(c) {
|
|
668
|
+
window._isMouseDown_gong || (c = $(this).closest(`.${f.wrapperClass}`).data("settings")) && c.triggerHoverBgColor && (this.style.backgroundColor = c.triggerHoverBgColor, this.style.color = c.triggerHoverColor || c.defaultColor, this.style.borderColor = c.triggerHoverBorderColor ||
|
|
669
|
+
c.defaultBorderColor)
|
|
670
|
+
},
|
|
671
|
+
mouseleave: function() {
|
|
672
|
+
const c = $(this).closest(`.${f.wrapperClass}`).data("settings");
|
|
673
|
+
c && (this.style.backgroundColor = c.defaultBgColor, this.style.color = c.defaultColor, this.style.borderColor = c.defaultBorderColor)
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
T = F = null;
|
|
677
|
+
f.triggerStyle && (f.triggerStyle.width ? F = f.triggerStyle.width : f.triggerStyle.maxWidth ? F = f.triggerStyle.maxWidth : f.triggerStyle.minWidth && (F = f.triggerStyle.minWidth), f.triggerStyle.height ? T = f.triggerStyle.height : f.triggerStyle.maxHeight ? T = f.triggerStyle.maxHeight :
|
|
678
|
+
f.triggerStyle.minHeight && (T = f.triggerStyle.minHeight));
|
|
679
|
+
F || (F = R.style.width, !F && R.style.maxWidth && (F = R.style.maxWidth), !F && R.style.minWidth && (F = R.style.minWidth));
|
|
680
|
+
T || (T = R.style.height, !T && R.style.maxHeight && (T = R.style.maxHeight), !T && R.style.minHeight && (T = R.style.minHeight));
|
|
681
|
+
ja(fa, f.triggerStyle);
|
|
682
|
+
fa.style.whiteSpace = "nowrap";
|
|
683
|
+
fa.style.overflow = "hidden";
|
|
684
|
+
fa.style.textOverflow = "ellipsis";
|
|
685
|
+
fa.style.paddingRight = f.defaultPaddingRight || "40px";
|
|
686
|
+
fa.style.height = "auto";
|
|
687
|
+
var ia = f.defaultText,
|
|
688
|
+
ya = R.querySelector("option:checked");
|
|
689
|
+
if (ya) {
|
|
690
|
+
var da = Array.from(R.options);
|
|
691
|
+
"checkbox" === f.pointer || f.pointer?.startsWith("checkbox_") ? (da = da.find(c => "" === c.value)) && (ia = f.allowHTML ? da.innerHTML : da.textContent) : (ia = da.indexOf(ya), ia = n(R, ya.value, ia).text, R._needsExpandGroup = !0)
|
|
692
|
+
}!f.showArrow || "radio" === f.pointer || "checkbox" === f.pointer || f.pointer && (f.pointer.startsWith("question_") || f.pointer.startsWith("checkbox_")) || (t = "custom-select-arrow-style-" + t, document.getElementById(t) || (da = document.createElement("style"), da.id = t, da.textContent =
|
|
693
|
+
`\n\t\t\t\t\t.${f.triggerClass}::after {\n\t\t\t\t\t content: '';\n\t\t\t\t\t position: absolute;\n\t\t\t\t\t right: ${f.arrowRight};\n\t\t\t\t\t top: ${f.arrowTop}; \n\t\t\t\t\t transform: translateY(-50%);\n\t\t\t\t\t width: 0;\n\t\t\t\t\t height: 0;\n\t\t\t\t\t border-left: ${f.arrowSize} solid transparent;\n\t\t\t\t\t border-right: ${f.arrowSize} solid transparent;\n\t\t\t\t\t border-top: ${f.arrowSize} solid ${f.arrowColor};\n\t\t\t\t\t transition: transform 0.3s ease;\n\t\t\t\t\t z-index: 1;\n\t\t\t\t\t}\n\t\t\t\t\t.${f.wrapperClass}.${f.openClass} .${f.triggerClass}::after {\n\t\t\t\t\t transform: translateY(-50%) rotate(180deg);\n\t\t\t\t\t z-index: 1; \n\t\t\t\t\t}\n\t\t\t\t\t.${f.triggerClass} {\n\t\t\t\t\t position: relative;\n\t\t\t\t\t z-index: 0;\n\t\t\t\t\t}\n\t\t\t\t`,
|
|
694
|
+
document.head.appendChild(da)));
|
|
695
|
+
if (f.allowHTML) {
|
|
696
|
+
fa.innerHTML = ia;
|
|
697
|
+
if (!f.pointer?.startsWith("question_") && !f.pointer?.startsWith("checkbox_") && "checkbox" !== f.pointer && (t = R.querySelector("option:checked"), !0 === f.tag && t && t.getAttribute("tag"))) {
|
|
698
|
+
t = t.getAttribute("tag");
|
|
699
|
+
ia = document.createElement("span");
|
|
700
|
+
da = f.tagStyle || {};
|
|
701
|
+
var oa = f.tagMap || {},
|
|
702
|
+
ka = {
|
|
703
|
+
position: "absolute",
|
|
704
|
+
right: "radio" === f.pointer ? "40px" : "30px",
|
|
705
|
+
top: "50%",
|
|
706
|
+
transform: "translateY(-50%)",
|
|
707
|
+
color: da.color || f.tagColor || "#666",
|
|
708
|
+
fontSize: da.fontSize || "12px",
|
|
709
|
+
margin: f.tagMargin
|
|
710
|
+
};
|
|
711
|
+
da.padding && (ka.padding = da.padding);
|
|
712
|
+
da.borderRadius && (ka.borderRadius = da.borderRadius);
|
|
713
|
+
da.fontWeight && (ka.fontWeight = da.fontWeight);
|
|
714
|
+
oa[t] && (ka.backgroundColor = oa[t]);
|
|
715
|
+
Object.assign(ia.style, ka);
|
|
716
|
+
ia.innerHTML = t;
|
|
717
|
+
fa.appendChild(ia)
|
|
718
|
+
}
|
|
719
|
+
if (f.pointer && f.pointer.startsWith("question_")) {
|
|
720
|
+
t = document.createElement("div");
|
|
721
|
+
t.className = "custom-question trigger-question";
|
|
722
|
+
Object.assign(t.style, {
|
|
723
|
+
...f.questionStyle,
|
|
724
|
+
width: f.questionSize,
|
|
725
|
+
height: f.questionSize
|
|
726
|
+
});
|
|
727
|
+
if (ia = R.querySelector("option[selected]")) {
|
|
728
|
+
Object.assign(t.style, {
|
|
729
|
+
border: `2px solid ${f.questionColor}`,
|
|
730
|
+
backgroundColor: f.questionColor
|
|
731
|
+
});
|
|
732
|
+
t.innerHTML = `<span style="color: white; font-size: calc(${f.questionSize} * 0.6);">\u2713</span>`;
|
|
733
|
+
ia = ia.getAttribute("tag");
|
|
734
|
+
if (!0 === f.tag && ia) {
|
|
735
|
+
da = document.createElement("span");
|
|
736
|
+
oa = f.tagStyle || {};
|
|
737
|
+
ka = f.tagMap || {};
|
|
738
|
+
const c = {
|
|
739
|
+
position: "absolute",
|
|
740
|
+
right: "40px",
|
|
741
|
+
top: "50%",
|
|
742
|
+
transform: "translateY(-50%)",
|
|
743
|
+
color: oa.color || f.tagColor || "#666",
|
|
744
|
+
fontSize: oa.fontSize || "12px"
|
|
745
|
+
};
|
|
746
|
+
oa.padding && (c.padding = oa.padding);
|
|
747
|
+
oa.borderRadius && (c.borderRadius = oa.borderRadius);
|
|
748
|
+
oa.fontWeight && (c.fontWeight = oa.fontWeight);
|
|
749
|
+
ka[ia] && (c.backgroundColor = ka[ia]);
|
|
750
|
+
Object.assign(da.style, c);
|
|
751
|
+
da.textContent = ia;
|
|
752
|
+
fa.appendChild(da)
|
|
753
|
+
}
|
|
754
|
+
V.setAttribute("data-aun", "true")
|
|
755
|
+
} else t.innerHTML = `<span style="font-size: calc(${f.questionSize} * 0.6);">?</span>`;
|
|
756
|
+
fa.appendChild(t)
|
|
757
|
+
}
|
|
758
|
+
if ("checkbox" === f.pointer || f.pointer?.startsWith("checkbox_")) fa.style.position = "relative", fa.style.paddingRight = "40px", t = document.createElement("div"), t.className = "custom-checkbox trigger-checkbox", Object.assign(t.style, {
|
|
759
|
+
...Y(),
|
|
760
|
+
border: `2px solid ${f.buttonColor}`,
|
|
761
|
+
borderRadius: "3px",
|
|
762
|
+
backgroundColor: "#fff",
|
|
763
|
+
zIndex: "2",
|
|
764
|
+
display: "block",
|
|
765
|
+
width: f.checkboxSize,
|
|
766
|
+
height: f.checkboxSize
|
|
767
|
+
}), fa.appendChild(t);
|
|
768
|
+
"radio" === f.pointer && (fa.style.position = "relative", fa.style.paddingRight = "40px", t = document.createElement("div"), t.className = "custom-radio trigger-radio", Object.assign(t.style, {
|
|
769
|
+
...Y(),
|
|
770
|
+
border: `2px solid ${f.buttonColor}`,
|
|
771
|
+
borderRadius: "50%",
|
|
772
|
+
backgroundColor: "#fff",
|
|
773
|
+
width: f.radioSize,
|
|
774
|
+
height: f.radioSize
|
|
775
|
+
}), (ia = R.querySelector("option:checked")) &&
|
|
776
|
+
ia.value && "" !== ia.value && (Object.assign(t.style, {
|
|
777
|
+
border: `2px solid ${f.radioColor}`
|
|
778
|
+
}), t.innerHTML = Q(f.radioColor, f)), fa.appendChild(t))
|
|
779
|
+
} else fa.textContent = ia, f.pointer?.startsWith("question_") || f.pointer?.startsWith("checkbox_") || "checkbox" === f.pointer || (t = R.querySelector("option:checked"), !0 === f.tag && t && t.getAttribute("tag") && (t = t.getAttribute("tag"), ia = document.createElement("span"), da = f.tagStyle || {}, oa = f.tagMap || {}, ka = {
|
|
780
|
+
position: "absolute",
|
|
781
|
+
right: "radio" === f.pointer ? "40px" : "30px",
|
|
782
|
+
top: "50%",
|
|
783
|
+
transform: "translateY(-50%)",
|
|
784
|
+
color: da.color || f.tagColor || "#666",
|
|
785
|
+
fontSize: da.fontSize || "12px",
|
|
786
|
+
margin: f.tagMargin
|
|
787
|
+
}, da.padding && (ka.padding = da.padding), da.borderRadius && (ka.borderRadius = da.borderRadius), da.fontWeight && (ka.fontWeight = da.fontWeight), oa[t] && (ka.backgroundColor = oa[t]), Object.assign(ia.style, ka), ia.textContent = t, fa.appendChild(ia)));
|
|
788
|
+
var ta = document.createElement("div");
|
|
789
|
+
ta.className = f.optionsClass;
|
|
790
|
+
ta.style.display = "none";
|
|
791
|
+
ta.style.width = "100%";
|
|
792
|
+
ta.style.boxSizing = "border-box";
|
|
793
|
+
"100%" === F ? (V.style.width = F, V.style.boxSizing =
|
|
794
|
+
"border-box", setTimeout(() => {
|
|
795
|
+
const c = parseInt(window.getComputedStyle(V).paddingLeft) + parseInt(window.getComputedStyle(V).paddingRight);
|
|
796
|
+
fa.style.width = `calc(100% - ${c}px)`;
|
|
797
|
+
ta.style.width = `calc(100% - ${c}px)`
|
|
798
|
+
}, 0)) : F && (V.style.width = F);
|
|
799
|
+
var va = document.createElement("div");
|
|
800
|
+
va.style.overflowY = "auto";
|
|
801
|
+
va.style.overflowX = "hidden";
|
|
802
|
+
va.style.width = "100%";
|
|
803
|
+
va.addEventListener("touchmove", function(c) {
|
|
804
|
+
c.stopPropagation()
|
|
805
|
+
}, {
|
|
806
|
+
passive: !0
|
|
807
|
+
});
|
|
808
|
+
Object.assign(va.style, {
|
|
809
|
+
userSelect: "none",
|
|
810
|
+
webkitUserSelect: "none",
|
|
811
|
+
mozUserSelect: "none",
|
|
812
|
+
msUserSelect: "none",
|
|
813
|
+
WebkitTouchCallout: "none"
|
|
814
|
+
});
|
|
815
|
+
Object.assign(fa.style, {
|
|
816
|
+
whiteSpace: "nowrap",
|
|
817
|
+
overflow: "hidden",
|
|
818
|
+
textOverflow: "ellipsis",
|
|
819
|
+
paddingRight: f.defaultPaddingRight || "40px",
|
|
820
|
+
height: "auto",
|
|
821
|
+
userSelect: "none",
|
|
822
|
+
webkitUserSelect: "none",
|
|
823
|
+
mozUserSelect: "none",
|
|
824
|
+
msUserSelect: "none",
|
|
825
|
+
WebkitTouchCallout: "none"
|
|
826
|
+
});
|
|
827
|
+
T && (va.style.maxHeight = T);
|
|
828
|
+
ta.appendChild(va);
|
|
829
|
+
ja(ta, {
|
|
830
|
+
...f.optionsStyle,
|
|
831
|
+
position: f.slideToggle ? "static" : "absolute",
|
|
832
|
+
zIndex: "1000"
|
|
833
|
+
});
|
|
834
|
+
var wa = {},
|
|
835
|
+
e = f.optionStyle?.padding ? C(f.optionStyle.padding) : "10px";
|
|
836
|
+
Array.from(R.options ||
|
|
837
|
+
g.children).forEach((c, a) => {
|
|
838
|
+
const b = document.createElement("div");
|
|
839
|
+
b.className = f.optionClass;
|
|
840
|
+
var h = function(m) {
|
|
841
|
+
let D = 0;
|
|
842
|
+
const J = m.className ? m.className.split(" ") : [];
|
|
843
|
+
if (0 === J.length) return D;
|
|
844
|
+
let E = J[0],
|
|
845
|
+
p = !0;
|
|
846
|
+
for (; p;) p = !1, Array.from(R.options || m.children).forEach(w => {
|
|
847
|
+
w.hasAttribute("group") && w.getAttribute("group") === E && (D++, w.className && (E = w.className.split(" ")[0], p = !0))
|
|
848
|
+
});
|
|
849
|
+
return D
|
|
850
|
+
}(c);
|
|
851
|
+
b.setAttribute("data-level", h);
|
|
852
|
+
h = c.getAttribute("group");
|
|
853
|
+
var d = c.className;
|
|
854
|
+
if (c.hasAttribute("group") || "true" === c.getAttribute("data-is-group")) {
|
|
855
|
+
b.classList.add("group-option");
|
|
856
|
+
b.setAttribute("data-group", h);
|
|
857
|
+
var k = e;
|
|
858
|
+
if (d) {
|
|
859
|
+
var u = d.split(" ")[0];
|
|
860
|
+
wa[u] && (u = parseFloat(wa[u]), isNaN(u) || (k = u + 10 + "px"))
|
|
861
|
+
}
|
|
862
|
+
h && (wa[h] = k);
|
|
863
|
+
k = document.createElement("div");
|
|
864
|
+
k.className = "custom-group-arrow";
|
|
865
|
+
u = ca(f);
|
|
866
|
+
let m = u.arrowSizeValue,
|
|
867
|
+
D = u.arrowRightValue;
|
|
868
|
+
Object.assign(k.style, {
|
|
869
|
+
position: "absolute",
|
|
870
|
+
right: D,
|
|
871
|
+
top: "50%",
|
|
872
|
+
transform: "translateY(-50%) rotate(0deg)",
|
|
873
|
+
width: "0",
|
|
874
|
+
height: "0",
|
|
875
|
+
borderLeft: `${m} solid transparent`,
|
|
876
|
+
borderRight: `${m} solid transparent`,
|
|
877
|
+
borderTop: `${m} solid ${u.arrowColorValue}`,
|
|
878
|
+
transition: "all 0.3s ease"
|
|
879
|
+
});
|
|
880
|
+
b.appendChild(k);
|
|
881
|
+
k = () => {
|
|
882
|
+
const J = parseFloat(m),
|
|
883
|
+
E = parseFloat(D);
|
|
884
|
+
isNaN(J) || isNaN(E) || b.style.setProperty("padding-right", `${2*J+E+10}px`, "important")
|
|
885
|
+
};
|
|
886
|
+
k();
|
|
887
|
+
b._updateGroupPadding = k;
|
|
888
|
+
b.style.whiteSpace = "nowrap";
|
|
889
|
+
b.style.overflow = "hidden";
|
|
890
|
+
b.style.textOverflow = "ellipsis"
|
|
891
|
+
}
|
|
892
|
+
d && d.split(" ").forEach(m => {
|
|
893
|
+
m && m.trim() && (b.classList.add("child-option"), b.classList.add(m))
|
|
894
|
+
});
|
|
895
|
+
b.setAttribute("data-value", c.value || c.getAttribute("value") || "");
|
|
896
|
+
k = {
|
|
897
|
+
...f.optionStyle
|
|
898
|
+
};
|
|
899
|
+
if ((u = b.classList.contains("child-option")) && k.padding) {
|
|
900
|
+
const m =
|
|
901
|
+
k.padding.split(" ");
|
|
902
|
+
2 === m.length ? (k.paddingTop = m[0], k.paddingBottom = m[0], k.paddingRight = m[1], delete k.padding) : 4 === m.length && (k.paddingTop = m[0], k.paddingRight = m[1], k.paddingBottom = m[2], delete k.padding)
|
|
903
|
+
}
|
|
904
|
+
ja(b, {
|
|
905
|
+
...k,
|
|
906
|
+
position: "relative",
|
|
907
|
+
paddingRight: c.getAttribute("tag") ? "100px" : "40px"
|
|
908
|
+
});
|
|
909
|
+
b.classList.contains("group-option") && h && wa[h] && b.style.setProperty("padding-left", wa[h], "important");
|
|
910
|
+
u && !b.classList.contains("group-option") && d && (k = d.split(" ")[0], d = e, wa[k] && (k = parseFloat(wa[k]), isNaN(k) || (d = k + 10 +
|
|
911
|
+
"px")), b.style.setProperty("padding-left", d, "important"));
|
|
912
|
+
b.classList.contains("group-option") && b._updateGroupPadding && b._updateGroupPadding();
|
|
913
|
+
b.style.whiteSpace = "nowrap";
|
|
914
|
+
b.style.overflow = "hidden";
|
|
915
|
+
b.style.textOverflow = "ellipsis";
|
|
916
|
+
a === R.options.length - 1 && (b.style.borderBottom = "none");
|
|
917
|
+
!f.dot || f.pointer?.startsWith("question_") || c.hasAttribute("group") || c.getAttribute("data-is-group") || b.querySelector(".custom-dot") || (a = document.createElement("div"), a.className = "custom-dot", Object.assign(a.style, f.dotStyle),
|
|
918
|
+
(c.selected || c.hasAttribute("selected")) && Object.assign(a.style, f.dotSelectedStyle), f.pointer && (a.style.right = "40px"), b.appendChild(a));
|
|
919
|
+
c.hasAttribute("img") && (a = c.getAttribute("img"), Object.assign(b.style, {
|
|
920
|
+
backgroundImage: `url(${a})`,
|
|
921
|
+
backgroundRepeat: "no-repeat"
|
|
922
|
+
}), a = new ResizeObserver(m => {
|
|
923
|
+
const D = m[0].contentRect.height;
|
|
924
|
+
if (0 < D) {
|
|
925
|
+
var J = $(m[0].target);
|
|
926
|
+
J.hasClass("child-option") ? (J = 20 * (parseInt(J.attr("data-level")) || 1), m[0].target.style.setProperty("--image-size", D + 8 + "px"), Object.assign(m[0].target.style, {
|
|
927
|
+
backgroundSize: `${D}px`,
|
|
928
|
+
backgroundPosition: `${J}px center`,
|
|
929
|
+
paddingLeft: `${J+1.5*D}px`
|
|
930
|
+
})) : Object.assign(m[0].target.style, {
|
|
931
|
+
backgroundSize: `${D}px`,
|
|
932
|
+
backgroundPosition: "15px center",
|
|
933
|
+
paddingLeft: `${2*D}px`
|
|
934
|
+
})
|
|
935
|
+
}
|
|
936
|
+
}), a.observe(b), window._resizeObservers || (window._resizeObservers = new WeakMap), window._resizeObservers.set(b, a));
|
|
937
|
+
if (a = c.getAttribute("tag")) d = f.tagStyle || {}, k = f.tagMap || {}, u = {
|
|
938
|
+
position: "absolute",
|
|
939
|
+
right: f.pointer ? "40px" : "30px",
|
|
940
|
+
top: "50%",
|
|
941
|
+
transform: "translateY(-50%)",
|
|
942
|
+
color: d.color || f.tagColor || "#666",
|
|
943
|
+
fontSize: d.fontSize || "12px",
|
|
944
|
+
margin: f.tagMargin
|
|
945
|
+
}, d.padding && (u.padding = d.padding), d.borderRadius && (u.borderRadius = d.borderRadius), d.fontWeight && (u.fontWeight = d.fontWeight), k[a] && (u.backgroundColor = k[a]), d = $("<span>").css(u), f.allowHTML ? d.html(a) : d.text(a), b.appendChild(d[0]);
|
|
946
|
+
"checkbox" !== f.pointer && !f.pointer?.startsWith("checkbox_") || c.hasAttribute("group") || "true" === c.getAttribute("data-is-group") || b.classList.contains("group-option") || (b.style.position = "relative", b.style.paddingRight = "40px", a = c.selected ||
|
|
947
|
+
c.hasAttribute("selected"), b.setAttribute("data-checked", a ? "true" : "false"), d = document.createElement("div"), d.className = "custom-checkbox option-checkbox", Object.assign(d.style, {
|
|
948
|
+
...Y(),
|
|
949
|
+
border: a ? `2px solid ${f.checkboxColor}` : `2px solid ${f.buttonColor}`,
|
|
950
|
+
borderRadius: "3px",
|
|
951
|
+
backgroundColor: a ? f.checkboxColor : "#fff",
|
|
952
|
+
zIndex: "2",
|
|
953
|
+
display: "block",
|
|
954
|
+
width: f.checkboxSize,
|
|
955
|
+
height: f.checkboxSize
|
|
956
|
+
}), a && (d.innerHTML = U(f.checkboxSize)), b.appendChild(d));
|
|
957
|
+
"radio" !== f.pointer || h || (b.style.position = "relative", b.style.paddingRight =
|
|
958
|
+
"40px", a = document.createElement("div"), a.className = "custom-radio", Object.assign(a.style, {
|
|
959
|
+
...Y(),
|
|
960
|
+
border: `2px solid ${f.buttonColor}`,
|
|
961
|
+
borderRadius: "50%",
|
|
962
|
+
backgroundColor: "#fff",
|
|
963
|
+
zIndex: "2",
|
|
964
|
+
width: f.radioSize,
|
|
965
|
+
height: f.radioSize
|
|
966
|
+
}), (c.selected || c.hasAttribute("selected")) && (c.value || c.getAttribute("value")) && (Object.assign(a.style, {
|
|
967
|
+
border: `2px solid ${f.radioColor}`
|
|
968
|
+
}), a.innerHTML = Q(f.radioColor, f)), (c.disabled || c.hasAttribute("disabled")) && Object.assign(a.style, {
|
|
969
|
+
border: `2px solid ${f.buttonColor}`,
|
|
970
|
+
backgroundColor: "#f5f5f5",
|
|
971
|
+
cursor: "not-allowed"
|
|
972
|
+
}), b.appendChild(a));
|
|
973
|
+
f.pointer && f.pointer.startsWith("question_") && !h && (a = document.createElement("div"), a.className = "custom-question option-question", Object.assign(a.style, f.questionStyle), a.innerHTML = "?", b.appendChild(a));
|
|
974
|
+
f.allowHTML ? (a = c.innerHTML, a = a.replace(/\x3c!--([\s\S]*?)--\x3e/g, (m, D) => D.trim()), b.insertAdjacentHTML("afterbegin", a)) : b.insertAdjacentText("afterbegin", c.textContent);
|
|
975
|
+
!c.disabled && !c.hasAttribute("disabled") || h || (b.classList.add("disabled"), ja(b, f.disabledStyle));
|
|
976
|
+
!c.selected && !c.hasAttribute("selected") || h || (b.classList.add("selected"), ja(b, f.selectedOptionStyle));
|
|
977
|
+
va.appendChild(b)
|
|
978
|
+
});
|
|
979
|
+
x.appendChild(fa);
|
|
980
|
+
V.appendChild(x);
|
|
981
|
+
V.appendChild(ta);
|
|
982
|
+
f.scrollColor && (V.id || (V.id = "select-scroll-" + Math.random().toString(36).substr(2, 9)), na($(V), f));
|
|
983
|
+
x = R.parentNode;
|
|
984
|
+
F = R.nextSibling;
|
|
985
|
+
R.style.display = "none";
|
|
986
|
+
V.insertBefore(R, V.firstChild);
|
|
987
|
+
F ? x.insertBefore(V, F) : x.appendChild(V);
|
|
988
|
+
R._needsExpandGroup && (setTimeout(() => {
|
|
989
|
+
if ($(V).find(`[class*="-option"][data-value="${ya.value}"]`).length) {
|
|
990
|
+
const c =
|
|
991
|
+
ya.className?.split(" ") || [],
|
|
992
|
+
a = new Set;
|
|
993
|
+
|
|
994
|
+
function b(h) {
|
|
995
|
+
if (h && !a.has(h)) {
|
|
996
|
+
a.add(h);
|
|
997
|
+
var d = $(V).find(`[data-group="${h}"]`);
|
|
998
|
+
d.length && (d.addClass("expanded"), d.find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(180deg)"), $(V).find(`.${h}`).show(), (d.attr("class")?.split(" ") || []).forEach(k => {
|
|
999
|
+
"group-option" !== k && "expanded" !== k && b(k)
|
|
1000
|
+
}))
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
c.forEach(h => b(h))
|
|
1004
|
+
}
|
|
1005
|
+
}, 0), delete R._needsExpandGroup);
|
|
1006
|
+
$(V).data("isTriggeredOnce", !1);
|
|
1007
|
+
!0 === f.onclick && setTimeout(() => {
|
|
1008
|
+
const c = $(V).find(`.${f.triggerClass}`);
|
|
1009
|
+
$(V).data("isInitialOpen", !0);
|
|
1010
|
+
c.trigger("click")
|
|
1011
|
+
}, 0);
|
|
1012
|
+
V.setAttribute("data-duration", v);
|
|
1013
|
+
V.setAttribute("data-slide-toggle", f.slideToggle)
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
if (!window._gong_tea_yun_2) {
|
|
1017
|
+
window._gong_tea_yun_2 = !0;
|
|
1018
|
+
let g = !1,
|
|
1019
|
+
C = !1,
|
|
1020
|
+
x = !1,
|
|
1021
|
+
t = !1,
|
|
1022
|
+
F = null,
|
|
1023
|
+
T = !1,
|
|
1024
|
+
f = !1;
|
|
1025
|
+
$(document).on("mousedown", '[class*="-wrapper"], [class*="-trigger"], [class*="-options"], [class*="-option"]', function(e) {
|
|
1026
|
+
e.stopPropagation();
|
|
1027
|
+
x = C = !0;
|
|
1028
|
+
R = !1;
|
|
1029
|
+
T = !0;
|
|
1030
|
+
window._isMouseDown_gong = !0;
|
|
1031
|
+
e = $(this).closest('[class*="-wrapper"]');
|
|
1032
|
+
window._gong_tea_yun_3 = e
|
|
1033
|
+
});
|
|
1034
|
+
$(document).on("mouseup",
|
|
1035
|
+
function(e) {
|
|
1036
|
+
window._isMouseDown_gong = !1;
|
|
1037
|
+
if (C) {
|
|
1038
|
+
var c = x,
|
|
1039
|
+
a = 0 < $(e.target).closest('[class*="-wrapper"]').length;
|
|
1040
|
+
x = C = !1;
|
|
1041
|
+
c && f && a && (e.stopPropagation(), e.preventDefault(), $(e.target).closest('[class*="-wrapper"]'));
|
|
1042
|
+
window._gong_tea_yun_3 = null;
|
|
1043
|
+
f = !1;
|
|
1044
|
+
setTimeout(() => {
|
|
1045
|
+
T = !1
|
|
1046
|
+
}, 300)
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
$(document).on("keydown", '[class*="-wrapper"], [class*="-trigger"]', function(e) {
|
|
1050
|
+
var c = $(this).closest('[class*="-wrapper"]');
|
|
1051
|
+
if (c.length) {
|
|
1052
|
+
var a = c.data("settings");
|
|
1053
|
+
if (a) {
|
|
1054
|
+
var b = c.find(`.${a.triggerClass}`),
|
|
1055
|
+
h = c.find(`.${a.optionClass}:not(.disabled)`),
|
|
1056
|
+
d = c.hasClass(a.openClass),
|
|
1057
|
+
k = c.find(`.${a.optionClass}.${a.highlightedClass}`);
|
|
1058
|
+
switch (e.keyCode) {
|
|
1059
|
+
case 13:
|
|
1060
|
+
return e.preventDefault(), e.stopPropagation(), d ? k.length ? k.hasClass("group-option") ? k.trigger("click") : (e = new MouseEvent("click", {
|
|
1061
|
+
bubbles: !0,
|
|
1062
|
+
cancelable: !0,
|
|
1063
|
+
view: window
|
|
1064
|
+
}), c = a.offclick, a.offclick = !1, k[0].dispatchEvent(e), a.offclick = c) : b.trigger("click") : (b.trigger("click"), k.length || h.first().addClass(a.highlightedClass).css("background-color", a.activeBackground)), !1;
|
|
1065
|
+
case 40:
|
|
1066
|
+
case 38:
|
|
1067
|
+
e.preventDefault();
|
|
1068
|
+
e.stopPropagation();
|
|
1069
|
+
e = 38 === e.keyCode;
|
|
1070
|
+
if (!d) return b.trigger("click"), k.length || h.first().addClass(a.highlightedClass).css("background-color", a.activeBackground), !1;
|
|
1071
|
+
d = c.find(`.${a.optionClass}:not(.disabled)`).filter(function() {
|
|
1072
|
+
return "none" !== $(this).css("display")
|
|
1073
|
+
});
|
|
1074
|
+
b = c.find(`.${a.optionsClass} > div`).first();
|
|
1075
|
+
h = b.height();
|
|
1076
|
+
b.scrollTop();
|
|
1077
|
+
k.is(":last-child");
|
|
1078
|
+
k.position();
|
|
1079
|
+
k.outerHeight();
|
|
1080
|
+
c.find(`.${a.optionClass}`).removeClass(a.highlightedClass);
|
|
1081
|
+
c.find(`.${a.optionClass}`).each(function() {
|
|
1082
|
+
const u = $(this);
|
|
1083
|
+
if (u.hasClass("selected") && a.selectedBg) {
|
|
1084
|
+
var m = !0 === a.selectedBg ? rgbToRgba(a.activeBackground, .5) : a.selectedBg;
|
|
1085
|
+
u.attr("style", (u.attr("style") || "") + `; background-color: ${m} !important;`);
|
|
1086
|
+
u.css("opacity", "1")
|
|
1087
|
+
} else m = (u.attr("style") || "").replace(/background-color:[^;]+;?/g, ""), u.attr("style", m)
|
|
1088
|
+
});
|
|
1089
|
+
k.length ? (c = d.index(k), k = e ? d.eq(Math.max(0, c - 1)) : c < d.length - 1 ? d.eq(c + 1) : k) : k = d.first();
|
|
1090
|
+
k.length && (k.hasClass("selected") && a.selectedBg ? k.css("opacity", "0.7") : k.addClass(a.highlightedClass).css("background-color",
|
|
1091
|
+
a.activeBackground), c = k.position().top, d = c + k.outerHeight(), !e && (d >= h || k.is(":last-child")) ? b.scrollTop(d + 1 - h) : e && (0 >= c || k.is(":first-child")) && b.scrollTop(c));
|
|
1092
|
+
return !1;
|
|
1093
|
+
case 27:
|
|
1094
|
+
return e.preventDefault(), e.stopPropagation(), d && b.trigger("click"), !1;
|
|
1095
|
+
case 32:
|
|
1096
|
+
return e.preventDefault(), e.stopPropagation(), d || b.trigger("click"), !1
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
$(document).on("mouseenter", '[class*="-option"]', function(e) {
|
|
1102
|
+
e.stopPropagation();
|
|
1103
|
+
e = $(this);
|
|
1104
|
+
var c = e.closest('[class*="-wrapper"]');
|
|
1105
|
+
const a = c.data("settings");
|
|
1106
|
+
a && !e.hasClass("disabled") &&
|
|
1107
|
+
(e.hasClass("selected") && a.selectedBg ? e.css("opacity", "0.7") : (c.find('[class*="-option"]:not(.disabled)').not(e).each(function() {
|
|
1108
|
+
$(this).removeClass(a.highlightedClass);
|
|
1109
|
+
if ($(this).hasClass("selected")) a.selectedBg && (b = !0 === a.selectedBg ? rgbToRgba(a.activeBackground, .5) : a.selectedBg, $(this).attr("style", ($(this).attr("style") || "") + `; background-color: ${b} !important;`));
|
|
1110
|
+
else {
|
|
1111
|
+
var b = ($(this).attr("style") || "").replace(/background-color:[^;]+;?/g, "");
|
|
1112
|
+
$(this).attr("style", b)
|
|
1113
|
+
}
|
|
1114
|
+
}), e.addClass(a.highlightedClass),
|
|
1115
|
+
(e.hasClass("selected") || ("checkbox" === a.pointer || a.pointer?.startsWith("checkbox_")) && "true" === e.attr("data-checked")) && a.selectedBg ? (c = !0 === a.selectedBg ? rgbToRgba(a.activeBackground, .5) : a.selectedBg, e.attr("style", (e.attr("style") || "") + `; background-color: ${c} !important;`)) : e.css("background-color", a.activeBackground)))
|
|
1116
|
+
});
|
|
1117
|
+
$(document).on("mouseleave", '[class*="-option"]', function() {
|
|
1118
|
+
const e = $(this),
|
|
1119
|
+
c = e.closest('[class*="-wrapper"]').data("settings");
|
|
1120
|
+
if (c && !e.hasClass("disabled")) {
|
|
1121
|
+
var a = e.hasClass("selected") ||
|
|
1122
|
+
("checkbox" === c.pointer || c.pointer?.startsWith("checkbox_")) && "true" === e.attr("data-checked");
|
|
1123
|
+
a && c.selectedBg ? e.css("opacity", "1") : (e.removeClass(c.highlightedClass), a && c.selectedBg ? (a = !0 === c.selectedBg ? rgbToRgba(c.activeBackground, .5) : c.selectedBg, e.attr("style", (e.attr("style") || "") + `; background-color: ${a} !important;`)) : (a = (e.attr("style") || "").replace(/background-color:[^;]+;?/g, ""), e.attr("style", a), setTimeout(() => {
|
|
1124
|
+
e.hasClass(c.highlightedClass) || e.css("background-color", c.optionsStyle.background ||
|
|
1125
|
+
"")
|
|
1126
|
+
}, 0)))
|
|
1127
|
+
}
|
|
1128
|
+
});
|
|
1129
|
+
let R = !1;
|
|
1130
|
+
$(document).on("mousemove", '[class*="-wrapper"]', function(e) {
|
|
1131
|
+
C && x && (R = !0)
|
|
1132
|
+
});
|
|
1133
|
+
$(document).on("mousemove", '[class*="-option"]:not(.disabled)', function() {});
|
|
1134
|
+
let V = null;
|
|
1135
|
+
$(document).on("touchstart", '[class*="-option"]', function(e) {
|
|
1136
|
+
V && clearTimeout(V);
|
|
1137
|
+
const c = $(this);
|
|
1138
|
+
t = !0;
|
|
1139
|
+
if (c.hasClass("disabled")) F = null;
|
|
1140
|
+
else {
|
|
1141
|
+
var a = c.closest('[class*="-wrapper"]'),
|
|
1142
|
+
b = a.data("settings");
|
|
1143
|
+
b && (F = this, a.find('[class*="-option"]').removeClass(b.highlightedClass), a.find('[class*="-option"]').each(function() {
|
|
1144
|
+
const h =
|
|
1145
|
+
$(this);
|
|
1146
|
+
if (h.hasClass("selected") && b.selectedBg) {
|
|
1147
|
+
var d = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg;
|
|
1148
|
+
h.attr("style", (h.attr("style") || "") + `; background-color: ${d} !important;`)
|
|
1149
|
+
} else d = (h.attr("style") || "").replace(/background-color:[^;]+;?/g, ""), h.attr("style", d)
|
|
1150
|
+
}), V = setTimeout(() => {
|
|
1151
|
+
if (F === this)
|
|
1152
|
+
if (c.hasClass("selected") && b.selectedBg) c.css("opacity", "0.7");
|
|
1153
|
+
else if (c.addClass(b.highlightedClass), c.hasClass("selected") && b.selectedBg) {
|
|
1154
|
+
const h = !0 === b.selectedBg ? rgbToRgba(b.activeBackground,
|
|
1155
|
+
.5) : b.selectedBg;
|
|
1156
|
+
c.attr("style", (c.attr("style") || "") + `; background-color: ${h} !important;`)
|
|
1157
|
+
} else c.css("background-color", b.activeBackground)
|
|
1158
|
+
}, 0), e.stopPropagation())
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
$(document).on("touchmove", '[class*="-wrapper"]', function(e) {
|
|
1162
|
+
t && $(this).data("settings")
|
|
1163
|
+
}, {
|
|
1164
|
+
passive: !1
|
|
1165
|
+
});
|
|
1166
|
+
$(document).on("touchend", function() {
|
|
1167
|
+
if (t) {
|
|
1168
|
+
if (F) {
|
|
1169
|
+
const e = $(F).closest('[class*="-wrapper"]'),
|
|
1170
|
+
c = e.data("settings");
|
|
1171
|
+
c && (e.find('[class*="-option"]').removeClass(c.highlightedClass), e.find('[class*="-option"]').each(function() {
|
|
1172
|
+
const a =
|
|
1173
|
+
$(this);
|
|
1174
|
+
if (a.hasClass("selected") && c.selectedBg) {
|
|
1175
|
+
var b = !0 === c.selectedBg ? rgbToRgba(c.activeBackground, .5) : c.selectedBg;
|
|
1176
|
+
a.attr("style", (a.attr("style") || "") + `; background-color: ${b} !important;`);
|
|
1177
|
+
a.css("opacity", "1")
|
|
1178
|
+
} else b = (a.attr("style") || "").replace(/background-color:[^;]+;?/g, ""), a.attr("style", b)
|
|
1179
|
+
}))
|
|
1180
|
+
}
|
|
1181
|
+
t = !1;
|
|
1182
|
+
F = null
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
$(document).on("touchend", '[class*="-option"]:not(.disabled)', function(e) {
|
|
1186
|
+
60 > Date.now() - 0 && this === F && $(this).trigger("click");
|
|
1187
|
+
e.stopPropagation()
|
|
1188
|
+
});
|
|
1189
|
+
$(document).on("click", "[data-group]",
|
|
1190
|
+
function(e) {
|
|
1191
|
+
function c(E) {
|
|
1192
|
+
function p(G) {
|
|
1193
|
+
b.find("." + G).each(function() {
|
|
1194
|
+
var K = $(this);
|
|
1195
|
+
w.add(this);
|
|
1196
|
+
if (K.attr("group") || K.data("group")) K = K.attr("group") || K.data("group"), p(K)
|
|
1197
|
+
})
|
|
1198
|
+
}
|
|
1199
|
+
const w = new Set;
|
|
1200
|
+
E = E.data("group");
|
|
1201
|
+
p(E);
|
|
1202
|
+
return w
|
|
1203
|
+
}
|
|
1204
|
+
e.preventDefault();
|
|
1205
|
+
e.stopPropagation();
|
|
1206
|
+
T = window._isGroupClick = !0;
|
|
1207
|
+
const a = $(this).closest('[class*="-wrapper"]'),
|
|
1208
|
+
b = a.find('[class*="-options"]'),
|
|
1209
|
+
h = b.find("div").first(),
|
|
1210
|
+
d = a.data("settings"),
|
|
1211
|
+
k = parseInt(a.attr("data-duration"));
|
|
1212
|
+
e = q() ? b : h;
|
|
1213
|
+
const u = () => {
|
|
1214
|
+
window._heightCache || (window._heightCache =
|
|
1215
|
+
new Map);
|
|
1216
|
+
let E = 0;
|
|
1217
|
+
const p = [];
|
|
1218
|
+
b.find("li, option").each(function() {
|
|
1219
|
+
"none" !== $(this).css("display") && p.push(this)
|
|
1220
|
+
});
|
|
1221
|
+
p.forEach(w => {
|
|
1222
|
+
const G = $(w);
|
|
1223
|
+
var K = w.id || G.data("height-id");
|
|
1224
|
+
w = window._heightCache.get(K);
|
|
1225
|
+
w || (w = G.outerHeight(!0), K ? window._heightCache.set(K, w) : (K = "height-" + Math.random().toString(36).substr(2, 9), G.data("height-id", K), window._heightCache.set(K, w)));
|
|
1226
|
+
E += w
|
|
1227
|
+
});
|
|
1228
|
+
requestAnimationFrame(() => {
|
|
1229
|
+
const w = Math.min(E, d.Mheight),
|
|
1230
|
+
G = d.optionsStyle.background || "#fff";
|
|
1231
|
+
h.css({
|
|
1232
|
+
height: w,
|
|
1233
|
+
overflowY: "auto",
|
|
1234
|
+
WebkitOverflowScrolling: "touch",
|
|
1235
|
+
backgroundColor: G
|
|
1236
|
+
});
|
|
1237
|
+
b.css({
|
|
1238
|
+
height: w,
|
|
1239
|
+
backgroundColor: G
|
|
1240
|
+
})
|
|
1241
|
+
});
|
|
1242
|
+
1E3 < window._heightCache.size && window._heightCache.clear()
|
|
1243
|
+
};
|
|
1244
|
+
var m = $(this).data("group"),
|
|
1245
|
+
D = $(this).hasClass("expanded");
|
|
1246
|
+
$(this).toggleClass("expanded");
|
|
1247
|
+
const J = $(this).find(".custom-group-arrow");
|
|
1248
|
+
if (D) {
|
|
1249
|
+
J.css("transform", "translateY(-50%) rotate(0deg)");
|
|
1250
|
+
e = c($(this));
|
|
1251
|
+
const E = {};
|
|
1252
|
+
e.forEach(p => {
|
|
1253
|
+
const w = $(p);
|
|
1254
|
+
if (w.attr("group") || w.data("group")) {
|
|
1255
|
+
const G = p.id || `group_${Math.random().toString(36).substr(2,9)}`;
|
|
1256
|
+
p.id || (p.id = G);
|
|
1257
|
+
E[G] = w.hasClass("expanded")
|
|
1258
|
+
}
|
|
1259
|
+
});
|
|
1260
|
+
$(this).data("childStates", E);
|
|
1261
|
+
e.forEach(p => {
|
|
1262
|
+
const w = $(p);
|
|
1263
|
+
if (w.attr("group") || w.data("group")) w.removeClass("expanded"), w.find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(0deg)");
|
|
1264
|
+
w.css("opacity", "0.1").slideUp(k, function() {
|
|
1265
|
+
w.css("opacity", "1");
|
|
1266
|
+
u()
|
|
1267
|
+
})
|
|
1268
|
+
})
|
|
1269
|
+
} else {
|
|
1270
|
+
J.css("transform", "translateY(-50%) rotate(180deg)");
|
|
1271
|
+
D = b.find("." + m);
|
|
1272
|
+
m = !$(this).closest("li").hasClass(m);
|
|
1273
|
+
D.show();
|
|
1274
|
+
D.first().outerHeight(!0);
|
|
1275
|
+
D.hide();
|
|
1276
|
+
D.css("opacity", "0.1").slideDown(k, function() {
|
|
1277
|
+
$(this).css("opacity", "1");
|
|
1278
|
+
u()
|
|
1279
|
+
});
|
|
1280
|
+
m && (m = D.first().outerHeight(), D = e[0] || e, e.animate && "function" === typeof e.animate ? e.animate({
|
|
1281
|
+
scrollTop: m
|
|
1282
|
+
}, k) : D && "function" === typeof D.scrollTo ? D.scrollTo({
|
|
1283
|
+
top: m,
|
|
1284
|
+
behavior: "smooth"
|
|
1285
|
+
}) : D && (D.scrollTop = m));
|
|
1286
|
+
const E = $(this).data("childStates");
|
|
1287
|
+
E && Object.keys(E).forEach(p => {
|
|
1288
|
+
E[p] && (p = $(`#${p}`), p.length && (p.addClass("expanded").find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(180deg)"), (p = p.attr("group") || p.data("group")) && b.find("." + p).css("opacity", "0.1").slideDown(k, function() {
|
|
1289
|
+
$(this).css("opacity",
|
|
1290
|
+
"1");
|
|
1291
|
+
u()
|
|
1292
|
+
})))
|
|
1293
|
+
})
|
|
1294
|
+
}
|
|
1295
|
+
setTimeout(() => {
|
|
1296
|
+
T = window._isGroupClick = !1;
|
|
1297
|
+
a.data("groupClicked", !1)
|
|
1298
|
+
}, 300);
|
|
1299
|
+
return !1
|
|
1300
|
+
});
|
|
1301
|
+
|
|
1302
|
+
function fa(e, c, a, b) {
|
|
1303
|
+
const h = a.pointer.split("_")[1],
|
|
1304
|
+
d = h + "_return";
|
|
1305
|
+
if ("function" === typeof window[h]) {
|
|
1306
|
+
e[0].setAttribute("data-aun", "true");
|
|
1307
|
+
b = e.find("select, ul").first();
|
|
1308
|
+
c = c.index();
|
|
1309
|
+
var k = b.find("option").eq(c);
|
|
1310
|
+
const u = k.val(),
|
|
1311
|
+
m = y(k.html(), 1),
|
|
1312
|
+
D = y(k.html());
|
|
1313
|
+
k = k.attr("tag");
|
|
1314
|
+
b = r(n(b[0], u, c).text);
|
|
1315
|
+
window[h]({
|
|
1316
|
+
value: u,
|
|
1317
|
+
text: m,
|
|
1318
|
+
html: D,
|
|
1319
|
+
tag: k,
|
|
1320
|
+
group: b,
|
|
1321
|
+
index: c
|
|
1322
|
+
});
|
|
1323
|
+
window[h + "_close"] = function() {
|
|
1324
|
+
const J = $('[data-state="opened"][data-aun="true"]').filter(function() {
|
|
1325
|
+
const W =
|
|
1326
|
+
$(this).data("settings");
|
|
1327
|
+
return W && W.pointer === `question_${h}`
|
|
1328
|
+
});
|
|
1329
|
+
if (!J.length) return !1;
|
|
1330
|
+
const E = J.data("settings"),
|
|
1331
|
+
p = J.find(`.${E.optionsClass}`),
|
|
1332
|
+
w = parseInt(J.attr("data-duration")),
|
|
1333
|
+
G = q(),
|
|
1334
|
+
K = $(".select-overlay");
|
|
1335
|
+
K.css("background-color", "rgba(0, 0, 0, 0)");
|
|
1336
|
+
setTimeout(() => {
|
|
1337
|
+
K.hide()
|
|
1338
|
+
}, w);
|
|
1339
|
+
J[0].removeAttribute("data-aun");
|
|
1340
|
+
J.removeClass(E.openClass);
|
|
1341
|
+
J.attr("data-state", "closed");
|
|
1342
|
+
G && !E.slideToggle ? N(p, w, K, E) : B(p, w, E);
|
|
1343
|
+
return !0
|
|
1344
|
+
};
|
|
1345
|
+
window[d] = function(J, E, p) {
|
|
1346
|
+
e.data("forcedClose", !0);
|
|
1347
|
+
const w = e.find(`.${a.triggerClass}`),
|
|
1348
|
+
G = e.find(`.${a.optionsClass}`),
|
|
1349
|
+
K = parseInt(e.attr("data-duration")),
|
|
1350
|
+
W = q(),
|
|
1351
|
+
ea = $(".select-overlay");
|
|
1352
|
+
ea.css("background-color", "rgba(0, 0, 0, 0)");
|
|
1353
|
+
setTimeout(() => {
|
|
1354
|
+
ea.hide()
|
|
1355
|
+
}, K);
|
|
1356
|
+
var I = "";
|
|
1357
|
+
let P = null;
|
|
1358
|
+
"function" === typeof E ? P = E : (I = E, P = p);
|
|
1359
|
+
E = J.split(": ")[1];
|
|
1360
|
+
E = e.find("select, ul").first().find(`option[value="${E}"]`);
|
|
1361
|
+
I = I || E.attr("tag");
|
|
1362
|
+
if (a.allowHTML)
|
|
1363
|
+
if (!0 === a.tag && I) {
|
|
1364
|
+
E = a.tagStyle || {};
|
|
1365
|
+
p = a.tagMap || {};
|
|
1366
|
+
const ra = {
|
|
1367
|
+
position: "absolute",
|
|
1368
|
+
top: "50%",
|
|
1369
|
+
transform: "translateY(-50%)",
|
|
1370
|
+
color: E.color || a.tagColor || "#666",
|
|
1371
|
+
fontSize: E.fontSize ||
|
|
1372
|
+
"12px",
|
|
1373
|
+
right: "radio" === a.pointer || a.pointer.includes("question_") ? "40px" : "30px",
|
|
1374
|
+
margin: a.tagMargin
|
|
1375
|
+
};
|
|
1376
|
+
E.padding && (ra.padding = E.padding);
|
|
1377
|
+
E.borderRadius && (ra.borderRadius = E.borderRadius);
|
|
1378
|
+
E.fontWeight && (ra.fontWeight = E.fontWeight);
|
|
1379
|
+
p[I] && (ra.backgroundColor = p[I]);
|
|
1380
|
+
I = $("<span>").css(ra).html(I);
|
|
1381
|
+
w.html(J).append(I)
|
|
1382
|
+
} else w.html(J);
|
|
1383
|
+
else w.text(J);
|
|
1384
|
+
e.attr("data-aun", "true");
|
|
1385
|
+
J = $("<div>").addClass("custom-question trigger-question").css({
|
|
1386
|
+
...a.questionStyle,
|
|
1387
|
+
border: `2px solid ${a.questionColor}`,
|
|
1388
|
+
backgroundColor: a.questionColor,
|
|
1389
|
+
width: a.questionSize,
|
|
1390
|
+
height: a.questionSize
|
|
1391
|
+
}).html(`<span style="color: white; font-size: calc(${a.questionSize} * 0.6);">\u2713</span>`);
|
|
1392
|
+
w.append(J);
|
|
1393
|
+
e.removeClass(a.openClass);
|
|
1394
|
+
e.attr("data-state", "closed");
|
|
1395
|
+
W && !a.slideToggle ? N(G, K, ea, a) : G.slideToggle(K, {
|
|
1396
|
+
easing: a.easing
|
|
1397
|
+
});
|
|
1398
|
+
"function" === typeof P && P();
|
|
1399
|
+
delete window[d];
|
|
1400
|
+
return !0
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return !1
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
function ia(e, c, a, b) {
|
|
1407
|
+
if (!c.hasClass(a.optionClass) || c.data("processing")) return !1;
|
|
1408
|
+
c.data("processing", !0);
|
|
1409
|
+
try {
|
|
1410
|
+
b.stopImmediatePropagation();
|
|
1411
|
+
b.preventDefault();
|
|
1412
|
+
let h = c.find(".custom-checkbox");
|
|
1413
|
+
const d = c[0].getBoundingClientRect(),
|
|
1414
|
+
k = b.clientX || b.originalEvent?.touches?.[0]?.clientX,
|
|
1415
|
+
u = b.clientY || b.originalEvent?.touches?.[0]?.clientY,
|
|
1416
|
+
m = c.hasClass("group-option") || c.attr("data-group") || c.data("group");
|
|
1417
|
+
if (!(h.length && h[0] || m)) {
|
|
1418
|
+
c.css({
|
|
1419
|
+
position: "relative",
|
|
1420
|
+
paddingRight: "40px"
|
|
1421
|
+
});
|
|
1422
|
+
const I = document.createElement("div");
|
|
1423
|
+
I.className = "custom-checkbox option-checkbox";
|
|
1424
|
+
const P = "true" === c.attr("data-checked");
|
|
1425
|
+
Object.assign(I.style, {
|
|
1426
|
+
...Y(),
|
|
1427
|
+
border: P ? `2px solid ${a.checkboxColor}` : `2px solid ${a.buttonColor}`,
|
|
1428
|
+
borderRadius: "3px",
|
|
1429
|
+
backgroundColor: P ? a.checkboxColor : "#fff",
|
|
1430
|
+
zIndex: "2",
|
|
1431
|
+
display: "block",
|
|
1432
|
+
width: a.checkboxSize,
|
|
1433
|
+
height: a.checkboxSize
|
|
1434
|
+
});
|
|
1435
|
+
P && (I.innerHTML = U(a.checkboxSize));
|
|
1436
|
+
c.append(I);
|
|
1437
|
+
h = c.find(".custom-checkbox")
|
|
1438
|
+
}
|
|
1439
|
+
if (!(k >= d.left - 1 && k <= d.right + 1 && u >= d.top - 1 && u <= d.bottom + 1)) return c.data("processing", !1), !1;
|
|
1440
|
+
const D = "true" === c.attr("data-checked"),
|
|
1441
|
+
J = e.find('[data-checked="true"]').get(),
|
|
1442
|
+
E = (b = !D) ? J.length + 1 : J.length - 1,
|
|
1443
|
+
p = e.find("select").first(),
|
|
1444
|
+
w = c.index(),
|
|
1445
|
+
G = p.find("option").eq(w),
|
|
1446
|
+
K = {
|
|
1447
|
+
value: G.val(),
|
|
1448
|
+
text: y(G.html(),
|
|
1449
|
+
1),
|
|
1450
|
+
html: y(G.html()),
|
|
1451
|
+
tag: G.attr("tag"),
|
|
1452
|
+
checked: b,
|
|
1453
|
+
index: w,
|
|
1454
|
+
count: E,
|
|
1455
|
+
group: r(n(p[0], G.val(), w).text)
|
|
1456
|
+
};
|
|
1457
|
+
if (a.pointer?.startsWith("checkbox_")) {
|
|
1458
|
+
const I = a.pointer.split("checkbox_")[1];
|
|
1459
|
+
if ("function" === typeof window[I] && !1 === window[I](K)) return c.data("processing", !1), !1
|
|
1460
|
+
}
|
|
1461
|
+
c.attr("data-checked", b.toString());
|
|
1462
|
+
e.attr("data-check-count", E);
|
|
1463
|
+
|
|
1464
|
+
function W(I, P, ra) {
|
|
1465
|
+
return {
|
|
1466
|
+
position: "absolute",
|
|
1467
|
+
right: "10px",
|
|
1468
|
+
top: "50%",
|
|
1469
|
+
transform: "translateY(-50%)",
|
|
1470
|
+
width: `calc(${I} + ${4}px)`,
|
|
1471
|
+
height: `calc(${I} + ${4}px)`,
|
|
1472
|
+
borderRadius: "3px",
|
|
1473
|
+
border: `${2}px solid ${ra?P:a.buttonColor}`,
|
|
1474
|
+
backgroundColor: ra ? P : "#fff",
|
|
1475
|
+
WebkitTapHighlightColor: "transparent",
|
|
1476
|
+
display: "block",
|
|
1477
|
+
zIndex: "2",
|
|
1478
|
+
boxSizing: "border-box",
|
|
1479
|
+
padding: "0"
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
if (!(h.length && h[0] || m)) {
|
|
1483
|
+
c.css({
|
|
1484
|
+
position: "relative",
|
|
1485
|
+
paddingRight: "40px"
|
|
1486
|
+
});
|
|
1487
|
+
const I = document.createElement("div");
|
|
1488
|
+
I.className = "custom-checkbox option-checkbox";
|
|
1489
|
+
Object.assign(I.style, {
|
|
1490
|
+
...Y(),
|
|
1491
|
+
borderRadius: "3px",
|
|
1492
|
+
zIndex: "2",
|
|
1493
|
+
display: "block",
|
|
1494
|
+
width: a.checkboxSize,
|
|
1495
|
+
height: a.checkboxSize
|
|
1496
|
+
});
|
|
1497
|
+
c.append(I);
|
|
1498
|
+
h = c.find(".custom-checkbox")
|
|
1499
|
+
}
|
|
1500
|
+
const ea =
|
|
1501
|
+
e.find(`.${a.triggerClass}`).find(".custom-checkbox");
|
|
1502
|
+
b ? (h.css(W(a.checkboxSize, a.checkboxColor, !0)).html(U(a.checkboxSize)), 0 < E && ea.css(W(a.checkboxSize, a.checkboxColor, !0)).html(A(E, a.checkboxSize))) : (h.css(W(a.checkboxSize, a.buttonColor, !1)).empty(), 0 === E ? ea.css(W(a.checkboxSize, a.buttonColor, !1)).empty() : ea.css(W(a.checkboxSize, a.checkboxColor, !0)).html(A(E, a.checkboxSize)));
|
|
1503
|
+
if (a.selectedBg) {
|
|
1504
|
+
const I = !0 === a.selectedBg ? rgbToRgba(a.activeBackground, .5) : a.selectedBg;
|
|
1505
|
+
$("#dynamic-selected-bg-style").length ||
|
|
1506
|
+
$("head").append(`<style id="dynamic-selected-bg-style">.selected-bg-active { background-color: ${I} !important; }</style>`);
|
|
1507
|
+
e.find(`.${a.optionClass}`).each(function() {
|
|
1508
|
+
const P = $(this);
|
|
1509
|
+
"true" === P.attr("data-checked") ? (P.addClass("selected").addClass("selected-bg-active"), P[0].style.setProperty("background-color", I, "important")) : (P.removeClass("selected").removeClass("selected-bg-active"), P[0].style.removeProperty("background-color"));
|
|
1510
|
+
P.css("font-weight", "normal")
|
|
1511
|
+
})
|
|
1512
|
+
} else b ? (c.addClass("selected"),
|
|
1513
|
+
c.css("font-weight", "bold")) : (c.removeClass("selected"), c.css("font-weight", "normal"));
|
|
1514
|
+
if (a.closeBox) {
|
|
1515
|
+
const I = $(".select-overlay");
|
|
1516
|
+
I.css("pointer-events", "none").hide();
|
|
1517
|
+
setTimeout(() => {
|
|
1518
|
+
I.css("pointer-events", "");
|
|
1519
|
+
c.data("processing", !1)
|
|
1520
|
+
}, 50)
|
|
1521
|
+
} else {
|
|
1522
|
+
const I = parseInt(e.attr("data-duration")),
|
|
1523
|
+
P = e.find(`.${a.optionsClass}`),
|
|
1524
|
+
ra = q(),
|
|
1525
|
+
za = $(".select-overlay");
|
|
1526
|
+
ra && !a.slideToggle ? z(P, I, za, e, a) : (e.removeClass(a.openClass), za.css("pointer-events", "none").hide(), I ? P.slideToggle(I, {
|
|
1527
|
+
easing: a.easing,
|
|
1528
|
+
complete: () => {
|
|
1529
|
+
setTimeout(() => {
|
|
1530
|
+
za.css("pointer-events", "");
|
|
1531
|
+
c.data("processing", !1)
|
|
1532
|
+
}, 50)
|
|
1533
|
+
}
|
|
1534
|
+
}) : (P.hide(), za.css("pointer-events", ""), setTimeout(() => {
|
|
1535
|
+
c.data("processing", !1)
|
|
1536
|
+
}, 50)))
|
|
1537
|
+
}
|
|
1538
|
+
return !1
|
|
1539
|
+
} catch (h) {
|
|
1540
|
+
return console.error("[handleCheckboxPointer] \uc5d0\ub7ec \ubc1c\uc0dd:", h), c.data("processing", !1), !1
|
|
1541
|
+
} finally {
|
|
1542
|
+
setTimeout(() => {
|
|
1543
|
+
c.data("processing") && (console.warn("[handleCheckboxPointer] \ud50c\ub798\uadf8 \uac15\uc81c \ud574\uc81c"), c.data("processing", !1))
|
|
1544
|
+
}, 1E3)
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
function ya(e, c, a) {
|
|
1549
|
+
const b = e.find(`.${a.triggerClass}`),
|
|
1550
|
+
h = parseInt(e.attr("data-selected-index"));
|
|
1551
|
+
let d = b.find(".custom-radio");
|
|
1552
|
+
d.length ? d = d[0] : (d = document.createElement("div"), d.className = "custom-radio trigger-radio");
|
|
1553
|
+
Object.assign(d.style, {
|
|
1554
|
+
...Y(),
|
|
1555
|
+
border: void 0 !== c ? `2px solid ${a.radioColor}` : `2px solid ${a.buttonColor}`,
|
|
1556
|
+
borderRadius: "50%",
|
|
1557
|
+
backgroundColor: "#fff",
|
|
1558
|
+
width: a.radioSize,
|
|
1559
|
+
height: a.radioSize
|
|
1560
|
+
});
|
|
1561
|
+
d.innerHTML = void 0 !== c ? Q(a.radioColor, a) : "";
|
|
1562
|
+
e.find(".custom-radio").not(".trigger-radio").each(function() {
|
|
1563
|
+
const u = $(this).closest('[class*="-option"]');
|
|
1564
|
+
var m = u.attr("data-value");
|
|
1565
|
+
const D = u.index();
|
|
1566
|
+
m = m === c && D === h;
|
|
1567
|
+
Object.assign(this.style, {
|
|
1568
|
+
border: m ? `2px solid ${a.radioColor}` : `2px solid ${a.buttonColor}`,
|
|
1569
|
+
backgroundColor: "#fff"
|
|
1570
|
+
});
|
|
1571
|
+
m ? (this.innerHTML = Q(a.radioColor, a), u.addClass("selected"), a.selectedBg || u.css("font-weight", "bold")) : (this.innerHTML = "", u.removeClass("selected").css("font-weight", "normal"))
|
|
1572
|
+
});
|
|
1573
|
+
b.find(".custom-radio").remove();
|
|
1574
|
+
b.append(d);
|
|
1575
|
+
var k = e.find("select").first();
|
|
1576
|
+
e = k.find("option").eq(h);
|
|
1577
|
+
e.length && (k = n(k[0], e.val(), h), e.html().replace(/\x3c!--(.*?)--\x3e/g, "$1").trim(), b.html(k.text +
|
|
1578
|
+
d.outerHTML));
|
|
1579
|
+
domqueryFocus()
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
function da(e, c) {
|
|
1583
|
+
e.attr("data-selected-value", "");
|
|
1584
|
+
e.attr("data-selected-index", "-1");
|
|
1585
|
+
const a = e.find(`.${c.triggerClass}`),
|
|
1586
|
+
b = e.find("select, ul").first();
|
|
1587
|
+
var h = b.find("option").first();
|
|
1588
|
+
h = c.allowHTML ? h.html() : h.text();
|
|
1589
|
+
a.find(".custom-radio").remove();
|
|
1590
|
+
const d = document.createElement("div");
|
|
1591
|
+
d.className = "custom-radio trigger-radio";
|
|
1592
|
+
Object.assign(d.style, {
|
|
1593
|
+
...Y(),
|
|
1594
|
+
border: `2px solid ${c.buttonColor}`,
|
|
1595
|
+
borderRadius: "50%",
|
|
1596
|
+
backgroundColor: "#fff",
|
|
1597
|
+
width: c.radioSize,
|
|
1598
|
+
height: c.radioSize
|
|
1599
|
+
});
|
|
1600
|
+
c.allowHTML ? a.html(h + d.outerHTML) : (a.text(h), a.append(d));
|
|
1601
|
+
e.find(".custom-radio").not(".trigger-radio").each(function() {
|
|
1602
|
+
const k = $(this).closest(`.${c.optionClass}`);
|
|
1603
|
+
$(this).css({
|
|
1604
|
+
border: `2px solid ${c.buttonColor}`,
|
|
1605
|
+
backgroundColor: "#fff"
|
|
1606
|
+
}).empty();
|
|
1607
|
+
k.removeClass("selected").css("font-weight", "normal");
|
|
1608
|
+
c.selectedBg && k.removeClass("selected-bg-active").css("background-color", "")
|
|
1609
|
+
});
|
|
1610
|
+
b.find("option").prop("selected", !1);
|
|
1611
|
+
ka(e)
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
function oa(e, c) {
|
|
1615
|
+
e.attr("data-check-count", "0");
|
|
1616
|
+
e.find(`.${c.triggerClass}`).find(".custom-checkbox").css({
|
|
1617
|
+
border: `2px solid ${c.buttonColor}`,
|
|
1618
|
+
backgroundColor: "#fff"
|
|
1619
|
+
}).empty();
|
|
1620
|
+
e.find(".custom-checkbox").not(".trigger-checkbox").each(function() {
|
|
1621
|
+
const a = $(this).closest(`.${c.optionClass}`);
|
|
1622
|
+
a.attr("data-checked", "false");
|
|
1623
|
+
$(this).css({
|
|
1624
|
+
border: `2px solid ${c.buttonColor}`,
|
|
1625
|
+
backgroundColor: "#fff"
|
|
1626
|
+
}).empty();
|
|
1627
|
+
c.selectedBg && a.removeClass("selected-bg-active").css("background-color", "")
|
|
1628
|
+
});
|
|
1629
|
+
ka(e)
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
function ka(e) {
|
|
1633
|
+
const c = e.find('[class*="-options"]');
|
|
1634
|
+
parseInt(e.attr("data-duration"));
|
|
1635
|
+
c.find("[data-group]").each(function() {
|
|
1636
|
+
const a = $(this),
|
|
1637
|
+
b = a.find(".custom-group-arrow"),
|
|
1638
|
+
h = a.data("group");
|
|
1639
|
+
a.hasClass("expanded") && (a.removeClass("expanded"), b.css("transform", "translateY(-50%) rotate(0deg)"));
|
|
1640
|
+
c.find("." + h).each(function() {
|
|
1641
|
+
const d = $(this);
|
|
1642
|
+
if (d.attr("group") || d.data("group")) d.removeClass("expanded"), d.find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(0deg)");
|
|
1643
|
+
d.hide()
|
|
1644
|
+
})
|
|
1645
|
+
})
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
function ta(e, c) {
|
|
1649
|
+
const a = ["custom-checkbox", "custom-radio", "custom-question", "custom-dot"];
|
|
1650
|
+
Array.from(e.childNodes).forEach(h => {
|
|
1651
|
+
(h.nodeType === Node.TEXT_NODE || h.nodeType === Node.ELEMENT_NODE &&
|
|
1652
|
+
!a.some(d => h.classList.contains(d))) && h.remove()
|
|
1653
|
+
});
|
|
1654
|
+
c = document.createTextNode(c.replace(/<[^>]*>/g, ""));
|
|
1655
|
+
const b = Array.from(e.childNodes).find(h => h.nodeType === Node.ELEMENT_NODE && a.some(d => h.classList.contains(d)));
|
|
1656
|
+
b ? e.insertBefore(c, b) : e.appendChild(c)
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
function va(e, c) {
|
|
1660
|
+
const a = e.find(`.${c.triggerClass}`),
|
|
1661
|
+
b = e.find("select, ul").first().find("li, option").first().html(),
|
|
1662
|
+
h = "checkbox" === c.pointer || c.pointer?.startsWith("checkbox_");
|
|
1663
|
+
a.css({
|
|
1664
|
+
backgroundImage: "none",
|
|
1665
|
+
backgroundSize: "initial",
|
|
1666
|
+
backgroundPosition: "initial",
|
|
1667
|
+
backgroundRepeat: "no-repeat",
|
|
1668
|
+
...(h ? {} : {
|
|
1669
|
+
paddingLeft: c.defaultPadding || "10px"
|
|
1670
|
+
})
|
|
1671
|
+
});
|
|
1672
|
+
if (window._triggerResizeObservers) {
|
|
1673
|
+
const d = window._triggerResizeObservers.get(a[0]);
|
|
1674
|
+
d && (d.disconnect(), window._triggerResizeObservers.delete(a[0]))
|
|
1675
|
+
}
|
|
1676
|
+
h ? ta(a[0], b) : a.html(b);
|
|
1677
|
+
c.selectedBg && e.find(`.${c.optionClass}`).each(function() {
|
|
1678
|
+
$(this).removeClass("selected-bg-active").css("background-color", "")
|
|
1679
|
+
});
|
|
1680
|
+
ka(e)
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
function wa(e, c, a) {
|
|
1684
|
+
const b = e.find("select, ul").first();
|
|
1685
|
+
c = c.find(`.${a.optionClass}`).first();
|
|
1686
|
+
if ("checkbox" === a.pointer ||
|
|
1687
|
+
a.pointer?.startsWith("checkbox_")) c.hide();
|
|
1688
|
+
else if ("radio" === a.pointer) - 1 < parseInt(e.attr("data-selected-index") || "-1") ? c.show() : c.hide();
|
|
1689
|
+
else {
|
|
1690
|
+
a = e.attr("data-selected-value");
|
|
1691
|
+
const h = parseInt(e.attr("data-selected-index"));
|
|
1692
|
+
0 < b.find("option[group]").length ? -1 === h && void 0 === a || 0 === h && (!a || "" === a) ? (c.hide(), ka(e)) : c.show() : (-1 !== h || a && "" !== a) && (0 !== h || a && "" !== a) ? c.show() : c.hide()
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
$(document).on("click", '[class*="-option"]', function(e) {
|
|
1696
|
+
e.stopPropagation();
|
|
1697
|
+
ua = 3;
|
|
1698
|
+
var c = $(this);
|
|
1699
|
+
const a = c.closest('[class*="-wrapper"]'),
|
|
1700
|
+
b = a.data("settings");
|
|
1701
|
+
if (b && c.hasClass(b.optionClass)) {
|
|
1702
|
+
if (a.data("optionClickProcessing")) return !1;
|
|
1703
|
+
a.data("optionClickProcessing", !0);
|
|
1704
|
+
setTimeout(() => {
|
|
1705
|
+
a.removeData("optionClickProcessing")
|
|
1706
|
+
}, 500);
|
|
1707
|
+
var h = a.find("select, ul").first(),
|
|
1708
|
+
d = c.attr("value") || c.attr("data-value"),
|
|
1709
|
+
k = c.index();
|
|
1710
|
+
c.hasClass("selected") && "checkbox" !== b.pointer && !b.pointer?.startsWith("checkbox_") && (c.removeClass("selected"), c.removeClass(b.highlightedClass), c.removeClass("selected-bg-active"), c.css("font-weight", "normal"), b.selectedBg &&
|
|
1711
|
+
c[0].style.removeProperty("background-color"), c[0].classList.remove("selected"), c[0].classList.remove(b.highlightedClass), c[0].classList.remove("selected-bg-active"));
|
|
1712
|
+
a.attr("data-current-index", k);
|
|
1713
|
+
if ((c.attr("group") || c.attr("data-group")) && !c.attr("value")) return e.preventDefault(), a.data("groupClicked", !0), !1;
|
|
1714
|
+
a.data("groupClicked", !1);
|
|
1715
|
+
"undefined" !== typeof R && R && (R = !1);
|
|
1716
|
+
R = !1;
|
|
1717
|
+
if ("undefined" !== typeof g && g) e.preventDefault(), e.stopPropagation(), a.removeData("optionClickProcessing");
|
|
1718
|
+
else {
|
|
1719
|
+
if (c.hasClass("disabled")) return e.preventDefault(),
|
|
1720
|
+
a.removeData("optionClickProcessing"), !1;
|
|
1721
|
+
if (b.pointer && b.pointer.startsWith("question_") && (e.preventDefault(), e.stopPropagation(), !1 === fa(a, c, b, e))) return a.removeData("optionClickProcessing"), !1;
|
|
1722
|
+
if (0 === c.index() || "" === c.attr("data-value") || !c.attr("data-value")) switch (b.pointer) {
|
|
1723
|
+
case "radio":
|
|
1724
|
+
da(a, b);
|
|
1725
|
+
break;
|
|
1726
|
+
case "checkbox":
|
|
1727
|
+
oa(a, b);
|
|
1728
|
+
break;
|
|
1729
|
+
default:
|
|
1730
|
+
va(a, b)
|
|
1731
|
+
}
|
|
1732
|
+
0 < h.find("option[group]").length && 0 === k && (!d || "" === d) && ka(a);
|
|
1733
|
+
if ("radio" !== b.pointer || 0 !== k && d && "" !== d) {
|
|
1734
|
+
if ("checkbox" === b.pointer || b.pointer?.startsWith("checkbox_")) return e.preventDefault(),
|
|
1735
|
+
e.stopPropagation(), e.stopImmediatePropagation(), d = ia(a, c, b, e), a.removeData("optionClickProcessing"), d;
|
|
1736
|
+
if (0 === k && (!d || "" === d)) {
|
|
1737
|
+
if (a.data("processingReset")) return !1;
|
|
1738
|
+
a.data("processingReset", !0);
|
|
1739
|
+
try {
|
|
1740
|
+
a.attr("data-selected-value", "");
|
|
1741
|
+
a.attr("data-selected-index", "-1");
|
|
1742
|
+
var u = h[0];
|
|
1743
|
+
const W = h.find("li, option").first().html();
|
|
1744
|
+
var m = h.find("option").eq(0);
|
|
1745
|
+
const ea = a.find(`.${b.triggerClass}`);
|
|
1746
|
+
if ("checkbox" === b.pointer || b.pointer?.startsWith("checkbox_")) {
|
|
1747
|
+
const I = b.allowHTML ? W : h.find("li, option").first().text();
|
|
1748
|
+
ta(ea[0], I)
|
|
1749
|
+
} else b.allowHTML ? ea.html(W) : ea.text(h.find("li, option").first().text());
|
|
1750
|
+
h.find("option, li").prop("selected", !1);
|
|
1751
|
+
W && h.find("option").eq(0).prop("selected", !0);
|
|
1752
|
+
a.find('[class*="-option"]').removeClass("selected").removeClass(b.highlightedClass).css("font-weight", "normal");
|
|
1753
|
+
b.dot && a.find(".custom-dot").each(function() {
|
|
1754
|
+
Object.assign(this.style, {
|
|
1755
|
+
...b.dotStyle,
|
|
1756
|
+
border: `2px solid ${b.buttonColor}`,
|
|
1757
|
+
backgroundColor: "#fff"
|
|
1758
|
+
})
|
|
1759
|
+
});
|
|
1760
|
+
if (u._selectId) {
|
|
1761
|
+
m.html().replace(/\x3c!--(.*?)--\x3e/g, "$1").trim();
|
|
1762
|
+
k = function(I, P = 0) {
|
|
1763
|
+
return 1 === P ? I.replace(/\x3c!--(.*?)--\x3e/g, "$1").replace(/<[^>]*>/g, "") : I.replace(/\x3c!--(.*?)--\x3e/g, "$1")
|
|
1764
|
+
};
|
|
1765
|
+
d = "";
|
|
1766
|
+
try {
|
|
1767
|
+
if ("function" === typeof n) {
|
|
1768
|
+
const I = n(u, "", 0);
|
|
1769
|
+
I && (d = I.text)
|
|
1770
|
+
}
|
|
1771
|
+
} catch (I) {
|
|
1772
|
+
console.warn("Error in findGroupPath:", I)
|
|
1773
|
+
}
|
|
1774
|
+
var D = {
|
|
1775
|
+
value: "",
|
|
1776
|
+
text: k(m.html(), 1),
|
|
1777
|
+
html: k(m.html()),
|
|
1778
|
+
tag: m.attr("tag"),
|
|
1779
|
+
element: m[0],
|
|
1780
|
+
select: u,
|
|
1781
|
+
index: 0,
|
|
1782
|
+
group: function(I) {
|
|
1783
|
+
const P = document.createElement("div");
|
|
1784
|
+
P.innerHTML = I;
|
|
1785
|
+
return P.textContent || P.innerText || ""
|
|
1786
|
+
}(d)
|
|
1787
|
+
},
|
|
1788
|
+
J = window._gong_tea_yun_0.get(u._selectId +
|
|
1789
|
+
"_callback");
|
|
1790
|
+
J && J.call(this, D);
|
|
1791
|
+
var E = window._gong_tea_yun_0.get(u._selectId + "_onSelect");
|
|
1792
|
+
E && E.call(this, D);
|
|
1793
|
+
h.trigger("change")
|
|
1794
|
+
}
|
|
1795
|
+
var p = parseInt(a.attr("data-duration")) || 0,
|
|
1796
|
+
w = a.find(`.${b.optionsClass}`);
|
|
1797
|
+
q() && !b.slideToggle ? z(w, p, $(".select-overlay"), a, b) : (a.removeClass(b.openClass), a.attr("data-state", "closed"), w.slideToggle(p, {
|
|
1798
|
+
easing: b.easing,
|
|
1799
|
+
complete: function() {
|
|
1800
|
+
setTimeout(() => {
|
|
1801
|
+
a.removeData("processingReset")
|
|
1802
|
+
}, 100)
|
|
1803
|
+
}
|
|
1804
|
+
}))
|
|
1805
|
+
} catch (W) {
|
|
1806
|
+
console.error("Reset error:", W), a.removeData("processingReset")
|
|
1807
|
+
}
|
|
1808
|
+
return !1
|
|
1809
|
+
}
|
|
1810
|
+
u =
|
|
1811
|
+
a.find("select").first()[0];
|
|
1812
|
+
a.find('[class*="-option"]').each(function(W) {
|
|
1813
|
+
W = $(this);
|
|
1814
|
+
W.removeClass("selected").removeClass(b.highlightedClass).removeClass("selected-bg-active").css("font-weight", "normal");
|
|
1815
|
+
this.classList.remove("selected");
|
|
1816
|
+
this.classList.remove(b.highlightedClass);
|
|
1817
|
+
this.classList.remove("selected-bg-active");
|
|
1818
|
+
b.selectedBg && this.style.removeProperty("background-color");
|
|
1819
|
+
"radio" === b.pointer && W.find(".custom-radio").removeClass("selected")
|
|
1820
|
+
});
|
|
1821
|
+
c.addClass("selected").addClass(b.highlightedClass);
|
|
1822
|
+
b.selectedBg ? (c.addClass("selected-bg-active"), m = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg, $("#dynamic-selected-bg-style").length || $("head").append(`<style id="dynamic-selected-bg-style">.selected-bg-active { background-color: ${m} !important; }</style>`), c[0].style.setProperty("background-color", m, "important"), c.css("font-weight", "normal")) : c.css("font-weight", "bold");
|
|
1823
|
+
"radio" === b.pointer && c.find(".custom-radio").addClass("selected");
|
|
1824
|
+
b.dot && (a.find(".custom-dot").each(function() {
|
|
1825
|
+
Object.assign(this.style,
|
|
1826
|
+
b.dotStyle)
|
|
1827
|
+
}), c.find(".custom-dot").css(b.dotSelectedStyle));
|
|
1828
|
+
(d || "" === d) && a.attr({
|
|
1829
|
+
"data-selected-value": d,
|
|
1830
|
+
"data-selected-index": k
|
|
1831
|
+
});
|
|
1832
|
+
h.find("option").prop("selected", !1);
|
|
1833
|
+
h.find("option").eq(k).prop("selected", !0);
|
|
1834
|
+
h.trigger("change");
|
|
1835
|
+
if (u._selectId) {
|
|
1836
|
+
h = h.find("option").eq(k);
|
|
1837
|
+
c = n(u, d, k);
|
|
1838
|
+
m = a.find(`.${b.triggerClass}`);
|
|
1839
|
+
m.empty();
|
|
1840
|
+
if (h.attr("img")) p = h.attr("img"), Object.assign(m[0].style, {
|
|
1841
|
+
backgroundImage: `url(${p})`,
|
|
1842
|
+
backgroundRepeat: "no-repeat"
|
|
1843
|
+
}), p = new ResizeObserver(W => {
|
|
1844
|
+
const ea = W[0].contentRect.height;
|
|
1845
|
+
0 < ea && Object.assign(W[0].target.style, {
|
|
1846
|
+
backgroundSize: `${ea}px`,
|
|
1847
|
+
backgroundPosition: `${ea/2}px center`,
|
|
1848
|
+
paddingLeft: `calc(${2*ea}px)`
|
|
1849
|
+
})
|
|
1850
|
+
}), p.observe(m[0]), window._triggerResizeObservers || (window._triggerResizeObservers = new WeakMap), (w = window._triggerResizeObservers.get(m[0])) && w.disconnect(), window._triggerResizeObservers.set(m[0], p);
|
|
1851
|
+
else if (Object.assign(m[0].style, {
|
|
1852
|
+
backgroundImage: "none",
|
|
1853
|
+
backgroundPosition: "initial",
|
|
1854
|
+
backgroundSize: "initial",
|
|
1855
|
+
paddingLeft: b.defaultPadding || "10px"
|
|
1856
|
+
}), window._triggerResizeObservers &&
|
|
1857
|
+
(p = window._triggerResizeObservers.get(m[0]))) p.disconnect(), window._triggerResizeObservers.delete(m[0]);
|
|
1858
|
+
b.allowHTML ? m.html(c.text) : m.text(c.text);
|
|
1859
|
+
"radio" === b.pointer && (a.attr({
|
|
1860
|
+
"data-selected-value": d,
|
|
1861
|
+
"data-selected-index": k
|
|
1862
|
+
}), ya(a, d, b));
|
|
1863
|
+
p = h.attr("tag") || "";
|
|
1864
|
+
!0 === b.tag && p && (w = document.createElement("span"), D = b.tagStyle || {}, J = b.tagMap || {}, E = {
|
|
1865
|
+
position: "absolute",
|
|
1866
|
+
top: "50%",
|
|
1867
|
+
transform: "translateY(-50%)",
|
|
1868
|
+
color: D.color || b.tagColor || "#666",
|
|
1869
|
+
fontSize: D.fontSize || "12px",
|
|
1870
|
+
right: "radio" === b.pointer ? "40px" : "30px",
|
|
1871
|
+
margin: b.tagMargin
|
|
1872
|
+
}, D.padding && (E.padding = D.padding), D.borderRadius && (E.borderRadius = D.borderRadius), D.fontWeight && (E.fontWeight = D.fontWeight), J[p] && (E.backgroundColor = J[p]), Object.assign(w.style, E), b.allowHTML ? w.innerHTML = p : w.textContent = p, m.append(w));
|
|
1873
|
+
d = {
|
|
1874
|
+
value: d,
|
|
1875
|
+
text: y(h.html(), 1),
|
|
1876
|
+
html: y(h.html()),
|
|
1877
|
+
tag: p,
|
|
1878
|
+
element: h[0],
|
|
1879
|
+
select: u,
|
|
1880
|
+
index: k,
|
|
1881
|
+
group: r(c.text)
|
|
1882
|
+
};
|
|
1883
|
+
(k = window._gong_tea_yun_0.get(u._selectId + "_callback")) && k.call(this, d);
|
|
1884
|
+
(k = window._gong_tea_yun_0.get(u._selectId + "_onSelect")) && k.call(this, d)
|
|
1885
|
+
}
|
|
1886
|
+
a.removeData("optionClickProcessing");
|
|
1887
|
+
d = parseInt(a.attr("data-duration")) || 0;
|
|
1888
|
+
k = a.find(`.${b.optionsClass}`);
|
|
1889
|
+
var G = $(".select-overlay"),
|
|
1890
|
+
K = function() {
|
|
1891
|
+
a.find('[class*="-option"]').removeClass("selected");
|
|
1892
|
+
[50, 100, 200].forEach(W => {
|
|
1893
|
+
setTimeout(() => {
|
|
1894
|
+
const ea = a.find('[class*="-option"].selected');
|
|
1895
|
+
0 < ea.length && ea.removeClass("selected")
|
|
1896
|
+
}, W)
|
|
1897
|
+
})
|
|
1898
|
+
};
|
|
1899
|
+
q() && !b.slideToggle ? (z(k, d, G, a, b), K()) : (a.removeClass(b.openClass), a.attr("data-state", "closed"), G.css("background-color", "rgba(0, 0, 0, 0)"), b.slideToggle && void 0 !== b.opacity ? k.slideToggle(d, {
|
|
1900
|
+
easing: b.easing,
|
|
1901
|
+
complete: function() {
|
|
1902
|
+
G.hide();
|
|
1903
|
+
M(a);
|
|
1904
|
+
domqueryFocus();
|
|
1905
|
+
K()
|
|
1906
|
+
}
|
|
1907
|
+
}) : k.css("opacity", "").slideToggle(d, {
|
|
1908
|
+
easing: b.easing,
|
|
1909
|
+
complete: function() {
|
|
1910
|
+
G.hide();
|
|
1911
|
+
M(a);
|
|
1912
|
+
domqueryFocus();
|
|
1913
|
+
K()
|
|
1914
|
+
}
|
|
1915
|
+
}))
|
|
1916
|
+
} else da(a, b), d = parseInt(a.attr("data-duration")) || 0, k = a.find(`.${b.optionsClass}`), q() && !b.slideToggle ? z(k, d, $(".select-overlay"), a, b) : (a.removeClass(b.openClass), k.slideToggle(d, {
|
|
1917
|
+
easing: b.easing
|
|
1918
|
+
})), a.removeData("optionClickProcessing")
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
$(document).on("click", '[class*="-trigger"]', function(e) {
|
|
1923
|
+
function c(p) {
|
|
1924
|
+
function w() {
|
|
1925
|
+
E || (E = !0, a.data("isInitialOpen") &&
|
|
1926
|
+
a.removeData("isInitialOpen"), b.trigger && domquery(b.trigger).trigger("click"), b.triggerOnce && !a.data("isTriggeredOnce") && (domquery(b.triggerOnce).trigger("click"), a.data("isTriggeredOnce", !0)))
|
|
1927
|
+
}
|
|
1928
|
+
p = q();
|
|
1929
|
+
var G = a.find("select").first()[0];
|
|
1930
|
+
G._selectId && (G = window._gong_tea_yun_0.get(G._selectId + "_open")) && G.call(this);
|
|
1931
|
+
wa(a, d, b);
|
|
1932
|
+
const K = parseInt(a.attr("data-selected-index")),
|
|
1933
|
+
W = a.attr("data-selected-value");
|
|
1934
|
+
G = W;
|
|
1935
|
+
let ea = K;
|
|
1936
|
+
const I = a.find('[class*="-option"].selected').first();
|
|
1937
|
+
I.length && !G && 0 >= ea && (G = I.attr("value") ||
|
|
1938
|
+
I.attr("data-value"), ea = I.index());
|
|
1939
|
+
if (0 < ea || G) {
|
|
1940
|
+
var P;
|
|
1941
|
+
G ? P = d.find(`[value="${G}"], [data-value="${G}"]`) : 0 < ea && (P = d.find(`.${b.optionClass}`).eq(ea));
|
|
1942
|
+
if (P && P.length && (P = (P.attr("class")?.split(" ") || []).filter(S => S !== b.optionClass && "selected" !== S && S !== b.highlightedClass), 0 < P.length)) {
|
|
1943
|
+
const S = new Set,
|
|
1944
|
+
X = ha => {
|
|
1945
|
+
if (ha && !S.has(ha)) {
|
|
1946
|
+
S.add(ha);
|
|
1947
|
+
var ba = d.find(`[data-group="${ha}"]`);
|
|
1948
|
+
ba.length && (ba.addClass("expanded"), ba.find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(180deg)"), d.find(`.${ha}`).show(),
|
|
1949
|
+
(ba.attr("class")?.split(" ") || []).forEach(xa => {
|
|
1950
|
+
"group-option" !== xa && "expanded" !== xa && X(xa)
|
|
1951
|
+
}))
|
|
1952
|
+
}
|
|
1953
|
+
};
|
|
1954
|
+
P.forEach(ha => X(ha));
|
|
1955
|
+
P = d.css("display");
|
|
1956
|
+
d.css("display", "block");
|
|
1957
|
+
d.outerHeight(!0);
|
|
1958
|
+
d.css("display", P)
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
const ra = () => {
|
|
1962
|
+
if (("checkbox" === b.pointer || b.pointer?.startsWith("checkbox_")) && b.selectedBg) {
|
|
1963
|
+
const S = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg;
|
|
1964
|
+
$("#dynamic-selected-bg-style").length || $("head").append(`<style id="dynamic-selected-bg-style">.selected-bg-active { background-color: ${S} !important; }</style>`);
|
|
1965
|
+
a.find('[data-checked="true"]').each(function() {
|
|
1966
|
+
const X = $(this);
|
|
1967
|
+
X.addClass("selected").addClass("selected-bg-active");
|
|
1968
|
+
X[0].style.setProperty("background-color", S, "important");
|
|
1969
|
+
X.css("font-weight", "normal")
|
|
1970
|
+
});
|
|
1971
|
+
a.find(`.${b.optionClass}`).not('[data-checked="true"]').each(function() {
|
|
1972
|
+
const X = $(this);
|
|
1973
|
+
X.removeClass("selected").removeClass("selected-bg-active");
|
|
1974
|
+
X[0].style.removeProperty("background-color");
|
|
1975
|
+
X.css("font-weight", "normal")
|
|
1976
|
+
})
|
|
1977
|
+
}
|
|
1978
|
+
},
|
|
1979
|
+
za = () => {
|
|
1980
|
+
var S = W;
|
|
1981
|
+
let X = K;
|
|
1982
|
+
const ha = a.find('[class*="-option"].selected').first();
|
|
1983
|
+
ha.length && !S && 0 >= X && (S = ha.attr("value") || ha.attr("data-value"), X = ha.index(), (S || 0 < X) && a.attr({
|
|
1984
|
+
"data-selected-value": S || "",
|
|
1985
|
+
"data-selected-index": X
|
|
1986
|
+
}));
|
|
1987
|
+
a.find('[class*="-option"]').each(function() {
|
|
1988
|
+
const ba = $(this);
|
|
1989
|
+
ba.removeClass("selected").removeClass(b.highlightedClass).removeClass("selected-bg-active").css("font-weight", "normal");
|
|
1990
|
+
b.selectedBg && ba[0].style.removeProperty("background-color");
|
|
1991
|
+
this.classList.remove("selected");
|
|
1992
|
+
this.classList.remove(b.highlightedClass);
|
|
1993
|
+
this.classList.remove("selected-bg-active")
|
|
1994
|
+
});
|
|
1995
|
+
if (0 < X || S) {
|
|
1996
|
+
let ba;
|
|
1997
|
+
S ? ba = d.find(`[value="${S}"], [data-value="${S}"]`) : 0 < X && (ba = d.find(`.${b.optionClass}`).eq(X));
|
|
1998
|
+
if (ba && ba.length) {
|
|
1999
|
+
S = (ba.attr("class")?.split(" ") || []).filter(ma => ma !== b.optionClass && "selected" !== ma && ma !== b.highlightedClass);
|
|
2000
|
+
const xa = new Set,
|
|
2001
|
+
sa = ma => {
|
|
2002
|
+
if (ma && !xa.has(ma)) {
|
|
2003
|
+
xa.add(ma);
|
|
2004
|
+
var la = d.find(`[data-group="${ma}"]`);
|
|
2005
|
+
la.length && (la.addClass("expanded"), la.find(".custom-group-arrow").css("transform", "translateY(-50%) rotate(180deg)"), d.find(`.${ma}`).show(), (la.attr("class")?.split(" ") || []).forEach(pa => {
|
|
2006
|
+
"group-option" !== pa && "expanded" !== pa && sa(pa)
|
|
2007
|
+
}))
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
S.forEach(ma => sa(ma));
|
|
2011
|
+
ba.addClass("selected").addClass(b.highlightedClass);
|
|
2012
|
+
ba[0].classList.add("selected");
|
|
2013
|
+
ba[0].classList.add(b.highlightedClass);
|
|
2014
|
+
b.selectedBg ? (S = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg, ba.attr("style", (ba.attr("style") || "") + `; background-color: ${S} !important;`)) : ba.css("font-weight", "bold");
|
|
2015
|
+
if (b.selectedBg) {
|
|
2016
|
+
const ma = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg;
|
|
2017
|
+
setTimeout(() => {
|
|
2018
|
+
ba.attr("style", (ba.attr("style") || "") + `; background-color: ${ma} !important;`)
|
|
2019
|
+
}, 50);
|
|
2020
|
+
setTimeout(() => {
|
|
2021
|
+
ba.attr("style", (ba.attr("style") || "") + `; background-color: ${ma} !important;`)
|
|
2022
|
+
}, 200)
|
|
2023
|
+
}
|
|
2024
|
+
void 0 !== b.autoScrollToSelected && b.autoScrollToSelected && (S = parseInt(a.attr("data-duration")) || 300, setTimeout(() => {
|
|
2025
|
+
d.find("div").first().length && ba.length && ba[0] && "function" === typeof ba[0].scrollIntoView && ba[0].scrollIntoView({
|
|
2026
|
+
block: "center",
|
|
2027
|
+
behavior: "smooth"
|
|
2028
|
+
})
|
|
2029
|
+
}, S))
|
|
2030
|
+
} else ra()
|
|
2031
|
+
}
|
|
2032
|
+
ra()
|
|
2033
|
+
};
|
|
2034
|
+
window.requestAnimationFrame ? requestAnimationFrame(() => {
|
|
2035
|
+
requestAnimationFrame(za)
|
|
2036
|
+
}) : setTimeout(za, 0);
|
|
2037
|
+
"radio" === b.pointer && (P = a.find(".trigger-radio"), P.length && (Object.assign(P[0].style, {
|
|
2038
|
+
border: `2px solid ${b.buttonColor}`,
|
|
2039
|
+
backgroundColor: "#fff",
|
|
2040
|
+
width: b.radioSize,
|
|
2041
|
+
height: b.radioSize
|
|
2042
|
+
}), P[0].innerHTML = ""));
|
|
2043
|
+
$('[class*="-wrapper"]').not(a).each(function() {
|
|
2044
|
+
const S = $(this),
|
|
2045
|
+
X = S.data("settings");
|
|
2046
|
+
if (X) {
|
|
2047
|
+
if (X.pointer && X.pointer.startsWith("question_") && "true" === S.attr("data-aun")) {
|
|
2048
|
+
var ha = X.pointer.split("_")[1];
|
|
2049
|
+
if ("function" === typeof window[ha + "_close"]) return window[ha +
|
|
2050
|
+
"_close"](), domqueryFocus(), !1
|
|
2051
|
+
}
|
|
2052
|
+
ha = S.find(`.${X.optionsClass}`);
|
|
2053
|
+
if (ha.is(":visible")) {
|
|
2054
|
+
const ba = parseInt(S.attr("data-duration"));
|
|
2055
|
+
S.removeClass(X.openClass).attr("data-state", "closed");
|
|
2056
|
+
ba ? X.slideToggle ? ha.css("opacity", X.opacity || 0).slideToggle(ba, {
|
|
2057
|
+
easing: b.easing
|
|
2058
|
+
}) : ha.slideToggle(ba, {
|
|
2059
|
+
easing: b.easing
|
|
2060
|
+
}) : (X.slideToggle && ha.css("opacity", X.opacity || 0), ha.hide())
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
});
|
|
2064
|
+
a.addClass(b.openClass);
|
|
2065
|
+
a.attr("data-state", "opened");
|
|
2066
|
+
aa(a.find('[class*="-option"]'));
|
|
2067
|
+
P = !0 === b.slideToggle;
|
|
2068
|
+
if (!P && (G = Z(a, d), d.css(G), !p)) $(window).off("scroll.select").on("scroll.select",
|
|
2069
|
+
function() {
|
|
2070
|
+
if (d.is(":visible")) {
|
|
2071
|
+
const S = Z(a, d);
|
|
2072
|
+
d.css({
|
|
2073
|
+
top: S.top,
|
|
2074
|
+
bottom: S.bottom,
|
|
2075
|
+
left: S.left
|
|
2076
|
+
})
|
|
2077
|
+
} else $(window).off("scroll.select")
|
|
2078
|
+
});
|
|
2079
|
+
P ? (p = b.optionStyle.backgroundColor || b.optionsStyle.background, d.css({
|
|
2080
|
+
opacity: b.opacity || 0,
|
|
2081
|
+
"background-color": p
|
|
2082
|
+
}), d.find("div").first().css("background-color", p), d.find(`.${b.optionClass}`).css("background-color", p), d.slideToggle(k, {
|
|
2083
|
+
easing: b.easing,
|
|
2084
|
+
complete: w
|
|
2085
|
+
})) : (() => new Promise(S => {
|
|
2086
|
+
const X = a.parent();
|
|
2087
|
+
X.find(".select-overlay").length ? S(X.find(".select-overlay")) : (X.append('<div class="select-overlay"></div>'),
|
|
2088
|
+
setTimeout(() => {
|
|
2089
|
+
const ha = X.find(".select-overlay");
|
|
2090
|
+
S(ha)
|
|
2091
|
+
}, 0))
|
|
2092
|
+
}))().then(S => {
|
|
2093
|
+
window._selectCloseTimer && clearTimeout(window._selectCloseTimer);
|
|
2094
|
+
g = !0;
|
|
2095
|
+
S.off("click.selectOverlay");
|
|
2096
|
+
if (!a.data("groupClicked")) {
|
|
2097
|
+
var X = a.find("select, ul").first()[0]._selectId;
|
|
2098
|
+
X && q() && !b.slideToggle && domquery(this).historyOn("select-" + X, sa => {
|
|
2099
|
+
ua = 2;
|
|
2100
|
+
if (0 === sa) {
|
|
2101
|
+
ua = 1;
|
|
2102
|
+
const ma = "undefined" !== typeof $ && $.isMobile ? $.isMobile() : {
|
|
2103
|
+
isMobile: !1
|
|
2104
|
+
};
|
|
2105
|
+
sa = $('[class*="-wrapper"][class*="open"]').filter(function() {
|
|
2106
|
+
const la = $(this).data("settings");
|
|
2107
|
+
return la && !la.slideToggle && !0 === ma.isMobile
|
|
2108
|
+
});
|
|
2109
|
+
sa.length && sa.each(function() {
|
|
2110
|
+
const la = $(this),
|
|
2111
|
+
pa = la.data("settings"),
|
|
2112
|
+
Ca = la.find(`.${pa.optionsClass}`),
|
|
2113
|
+
Da = parseInt(la.attr("data-duration")),
|
|
2114
|
+
Aa = $(".select-overlay");
|
|
2115
|
+
M(la);
|
|
2116
|
+
if ("radio" === pa.pointer) {
|
|
2117
|
+
const Ea = la.attr("data-selected-value"),
|
|
2118
|
+
Fa = parseInt(la.attr("data-selected-index")),
|
|
2119
|
+
Ba = la.find(".trigger-radio");
|
|
2120
|
+
void 0 !== Ea && 0 <= Fa && (Object.assign(Ba[0].style, {
|
|
2121
|
+
border: `2px solid ${pa.radioColor}`,
|
|
2122
|
+
backgroundColor: "#fff",
|
|
2123
|
+
width: pa.radioSize,
|
|
2124
|
+
height: pa.radioSize
|
|
2125
|
+
}),
|
|
2126
|
+
Ba.html(Q(pa.radioColor, pa)))
|
|
2127
|
+
}
|
|
2128
|
+
Aa.css({
|
|
2129
|
+
"background-color": "rgba(0, 0, 0, 0)"
|
|
2130
|
+
});
|
|
2131
|
+
Ca.slideToggle(Da, {
|
|
2132
|
+
easing: pa.easing,
|
|
2133
|
+
complete: function() {
|
|
2134
|
+
Aa.hide();
|
|
2135
|
+
domqueryFocus();
|
|
2136
|
+
la.removeClass(pa.openClass);
|
|
2137
|
+
la.attr("data-state", "closed")
|
|
2138
|
+
}
|
|
2139
|
+
})
|
|
2140
|
+
})
|
|
2141
|
+
}
|
|
2142
|
+
})
|
|
2143
|
+
}
|
|
2144
|
+
X = Z(a, d);
|
|
2145
|
+
const ha = b.optionsStyle.background || "#fff";
|
|
2146
|
+
S.css({
|
|
2147
|
+
position: "absolute",
|
|
2148
|
+
top: 0,
|
|
2149
|
+
left: 0,
|
|
2150
|
+
right: 0,
|
|
2151
|
+
bottom: 0,
|
|
2152
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
2153
|
+
zIndex: 999,
|
|
2154
|
+
display: "block",
|
|
2155
|
+
transition: "background-color 0.3s ease"
|
|
2156
|
+
});
|
|
2157
|
+
d.css({
|
|
2158
|
+
...X,
|
|
2159
|
+
opacity: 1,
|
|
2160
|
+
display: "none",
|
|
2161
|
+
backgroundColor: ha,
|
|
2162
|
+
height: b.height ||
|
|
2163
|
+
"auto",
|
|
2164
|
+
Mheight: b.Mheight || "60vh",
|
|
2165
|
+
minHeight: b.minHeight || "auto",
|
|
2166
|
+
maxHeight: b.maxHeight || (g ? b.Mheight || "60vh" : b.height || "300px"),
|
|
2167
|
+
overflowY: "auto",
|
|
2168
|
+
zIndex: 1E3
|
|
2169
|
+
});
|
|
2170
|
+
d.find("div").first().css("background-color", ha);
|
|
2171
|
+
d.find(`.${b.optionClass}`).css("background-color", ha);
|
|
2172
|
+
let ba = !1,
|
|
2173
|
+
xa = !0;
|
|
2174
|
+
domquery(d).slideToggle(k, {
|
|
2175
|
+
easing: b.easing,
|
|
2176
|
+
complete: () => {
|
|
2177
|
+
w();
|
|
2178
|
+
g = xa = !1
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
setTimeout(() => {
|
|
2182
|
+
S.css("background-color", "rgba(0, 0, 0, 0)")
|
|
2183
|
+
}, 0);
|
|
2184
|
+
S.on("click.selectOverlay", function(sa) {
|
|
2185
|
+
if (ba || xa) return !1;
|
|
2186
|
+
ua = 2;
|
|
2187
|
+
const ma = a.find(`.${b.triggerClass}`);
|
|
2188
|
+
ma.css("pointer-events", "none");
|
|
2189
|
+
ba = !0;
|
|
2190
|
+
sa.preventDefault();
|
|
2191
|
+
sa.stopPropagation();
|
|
2192
|
+
S.off("click.selectOverlay");
|
|
2193
|
+
if ("radio" === b.pointer) {
|
|
2194
|
+
sa = a.attr("data-selected-value");
|
|
2195
|
+
const la = parseInt(a.attr("data-selected-index")),
|
|
2196
|
+
pa = a.find(".trigger-radio");
|
|
2197
|
+
void 0 === sa && -1 === la ? pa.css({
|
|
2198
|
+
border: `2px solid ${b.buttonColor}`,
|
|
2199
|
+
backgroundColor: "#fff",
|
|
2200
|
+
width: b.radioSize,
|
|
2201
|
+
height: b.radioSize
|
|
2202
|
+
}).html("") : void 0 !== sa && 0 <= la && pa.css({
|
|
2203
|
+
border: `2px solid ${b.radioColor}`,
|
|
2204
|
+
backgroundColor: "#fff",
|
|
2205
|
+
width: b.radioSize,
|
|
2206
|
+
height: b.radioSize
|
|
2207
|
+
}).html(Q(b.radioColor,
|
|
2208
|
+
b))
|
|
2209
|
+
}
|
|
2210
|
+
S.css("background-color", "rgba(0, 0, 0, 0)");
|
|
2211
|
+
window._selectCloseTimer = setTimeout(() => {
|
|
2212
|
+
S.hide();
|
|
2213
|
+
d.hide();
|
|
2214
|
+
a.removeClass(b.openClass);
|
|
2215
|
+
a.attr("data-state", "closed");
|
|
2216
|
+
a.data("groupClicked", !1);
|
|
2217
|
+
T = ba = g = !1;
|
|
2218
|
+
setTimeout(() => {
|
|
2219
|
+
ma.css("pointer-events", "auto")
|
|
2220
|
+
}, 0)
|
|
2221
|
+
}, k)
|
|
2222
|
+
});
|
|
2223
|
+
setTimeout(() => {
|
|
2224
|
+
a.data("groupClicked", !1)
|
|
2225
|
+
}, k)
|
|
2226
|
+
});
|
|
2227
|
+
setTimeout(function() {
|
|
2228
|
+
u.css({
|
|
2229
|
+
"pointer-events": "",
|
|
2230
|
+
opacity: ""
|
|
2231
|
+
})
|
|
2232
|
+
}, k || 0)
|
|
2233
|
+
}
|
|
2234
|
+
e.stopPropagation();
|
|
2235
|
+
const a = $(this).closest('[class*="-wrapper"]'),
|
|
2236
|
+
b = a.data("settings");
|
|
2237
|
+
if (b) {
|
|
2238
|
+
var h = $(".select-overlay");
|
|
2239
|
+
h.length &&
|
|
2240
|
+
h.is(":visible") && h.css("pointer-events", "none").hide();
|
|
2241
|
+
var d = a.find(`.${b.optionsClass}`),
|
|
2242
|
+
k = parseInt(a.attr("data-duration"));
|
|
2243
|
+
h = d.is(":visible");
|
|
2244
|
+
var u = $('[class*="-option"]'),
|
|
2245
|
+
m = $('[class*="-wrapper"]').not(a).filter(function() {
|
|
2246
|
+
return $(this).find('[class*="-options"]').is(":visible")
|
|
2247
|
+
});
|
|
2248
|
+
if (h && !b.offclick) {
|
|
2249
|
+
h = parseInt(a.attr("data-duration"));
|
|
2250
|
+
if ("radio" === b.pointer) {
|
|
2251
|
+
m = a.attr("data-selected-value");
|
|
2252
|
+
var D = parseInt(a.attr("data-selected-index")),
|
|
2253
|
+
J = a.find(".trigger-radio");
|
|
2254
|
+
void 0 !== m && 0 <= D && (Object.assign(J[0].style, {
|
|
2255
|
+
border: `2px solid ${b.radioColor}`,
|
|
2256
|
+
backgroundColor: "#fff",
|
|
2257
|
+
width: b.radioSize,
|
|
2258
|
+
height: b.radioSize
|
|
2259
|
+
}), J.html(Q(b.radioColor, b)))
|
|
2260
|
+
}
|
|
2261
|
+
q() && !b.slideToggle ? z(d, h, $(".select-overlay"), a, b) : (a.removeClass(b.openClass), a.attr("data-state", "closed"), h ? b.slideToggle ? d.css("opacity", b.opacity || 0).slideToggle(h, {
|
|
2262
|
+
easing: b.easing,
|
|
2263
|
+
complete: domqueryFocus
|
|
2264
|
+
}) : d.slideToggle(h, {
|
|
2265
|
+
easing: b.easing,
|
|
2266
|
+
complete: domqueryFocus
|
|
2267
|
+
}) : (d.hide(), domqueryFocus()));
|
|
2268
|
+
return !1
|
|
2269
|
+
}
|
|
2270
|
+
if (0 < m.length) return m.each(function() {
|
|
2271
|
+
const p = $(this),
|
|
2272
|
+
w = p.data("settings");
|
|
2273
|
+
if (w) {
|
|
2274
|
+
var G = p.find(`.${w.optionsClass}`),
|
|
2275
|
+
K = parseInt(p.attr("data-duration"));
|
|
2276
|
+
p.removeClass(w.openClass).attr("data-state", "closed");
|
|
2277
|
+
K ? w.slideToggle ? G.css("opacity", w.opacity || 0).slideToggle(K, {
|
|
2278
|
+
easing: w.easing
|
|
2279
|
+
}) : G.slideToggle(K, {
|
|
2280
|
+
easing: w.easing
|
|
2281
|
+
}) : G.hide()
|
|
2282
|
+
}
|
|
2283
|
+
}), !1;
|
|
2284
|
+
if (b.pointer && b.pointer.startsWith("question_")) {
|
|
2285
|
+
m = b.pointer.split("_")[1];
|
|
2286
|
+
D = a[0].hasAttribute("data-aun");
|
|
2287
|
+
J = a.find("select").first();
|
|
2288
|
+
const p = parseInt(a.attr("data-current-index")),
|
|
2289
|
+
w = J.find("option").eq(p);
|
|
2290
|
+
J = {
|
|
2291
|
+
value: w.val(),
|
|
2292
|
+
text: y(w.html(), 1),
|
|
2293
|
+
html: y(w.html()),
|
|
2294
|
+
tag: w.attr("tag"),
|
|
2295
|
+
group: r(n(J[0], w.val(), p).text),
|
|
2296
|
+
index: p
|
|
2297
|
+
};
|
|
2298
|
+
if (D && (e.preventDefault(), e.stopPropagation(), "function" === typeof window[m + "_cancel"])) return window[m + "_reset"] = function() {
|
|
2299
|
+
const G = a.find(`.${b.triggerClass}`);
|
|
2300
|
+
var K = a.find("select, ul").first();
|
|
2301
|
+
K.find("option, li").first().prop("selected", !0);
|
|
2302
|
+
K = K.find("option, li").first().text();
|
|
2303
|
+
G.text(K);
|
|
2304
|
+
K = document.createElement("div");
|
|
2305
|
+
K.className = "custom-question trigger-question";
|
|
2306
|
+
Object.assign(K.style, {
|
|
2307
|
+
...b.questionStyle,
|
|
2308
|
+
width: b.questionSize,
|
|
2309
|
+
height: b.questionSize,
|
|
2310
|
+
fontSize: `calc(${b.questionSize} * 0.6)`
|
|
2311
|
+
});
|
|
2312
|
+
K.innerHTML = "?";
|
|
2313
|
+
G.append(K);
|
|
2314
|
+
a.removeClass(b.openClass);
|
|
2315
|
+
a[0].removeAttribute("data-aun")
|
|
2316
|
+
}, window[m + "_cancel"](J), !1;
|
|
2317
|
+
a.find(`.${b.optionClass}`).each(function() {
|
|
2318
|
+
const G = $(this);
|
|
2319
|
+
G.find(".custom-question, .custom-group-arrow").remove();
|
|
2320
|
+
if (G.hasClass("group-option")) {
|
|
2321
|
+
var K = document.createElement("div");
|
|
2322
|
+
K.className = "custom-group-arrow";
|
|
2323
|
+
const ea = ca(b);
|
|
2324
|
+
let I = ea.arrowSizeValue;
|
|
2325
|
+
var W = ea.arrowRightValue;
|
|
2326
|
+
Object.assign(K.style, {
|
|
2327
|
+
position: "absolute",
|
|
2328
|
+
right: W,
|
|
2329
|
+
top: "50%",
|
|
2330
|
+
transform: "translateY(-50%) rotate(0deg)",
|
|
2331
|
+
width: "0",
|
|
2332
|
+
height: "0",
|
|
2333
|
+
borderLeft: `${I} solid transparent`,
|
|
2334
|
+
borderRight: `${I} solid transparent`,
|
|
2335
|
+
borderTop: `${I} solid ${ea.arrowColorValue}`,
|
|
2336
|
+
transition: "all 0.3s ease"
|
|
2337
|
+
});
|
|
2338
|
+
G.append(K);
|
|
2339
|
+
K = parseFloat(I);
|
|
2340
|
+
W = parseFloat(W);
|
|
2341
|
+
isNaN(K) || isNaN(W) || G[0].style.setProperty("padding-right", `${2*K+W+10}px`, "important")
|
|
2342
|
+
} else W = document.createElement("div"), W.className = "custom-question option-question", Object.assign(W.style, b.questionStyle), W.innerHTML = `<span style="font-size: calc(${b.questionSize} * 0.6);">?</span>`,
|
|
2343
|
+
G.append(W)
|
|
2344
|
+
})
|
|
2345
|
+
}
|
|
2346
|
+
m = $('[class*="-wrapper"][class*="open"]').filter(function() {
|
|
2347
|
+
const p = $(this).data("settings");
|
|
2348
|
+
return p && p.pointer && p.pointer.startsWith("question_") && "true" === $(this).attr("data-aun")
|
|
2349
|
+
});
|
|
2350
|
+
if (m.length) h = m.data("settings").pointer.split("_")[1], "function" === typeof window[h + "_close"] && (window[h + "_close"](), domqueryFocus());
|
|
2351
|
+
else {
|
|
2352
|
+
if ("checkbox" === b.pointer || b.pointer?.startsWith("checkbox_")) m = a.find(`.${b.triggerClass}`), a.find(`.${b.optionClass}`).each(function() {
|
|
2353
|
+
const p = $(this);
|
|
2354
|
+
if (p.hasClass("group-option") ||
|
|
2355
|
+
p.attr("data-group") || p.data("group")) p.find(".custom-checkbox").remove();
|
|
2356
|
+
else {
|
|
2357
|
+
var w = "true" === p.attr("data-checked");
|
|
2358
|
+
p.find(".custom-checkbox").remove();
|
|
2359
|
+
const G = document.createElement("div");
|
|
2360
|
+
G.className = "custom-checkbox option-checkbox";
|
|
2361
|
+
Object.assign(G.style, {
|
|
2362
|
+
...Y(),
|
|
2363
|
+
border: w ? `2px solid ${b.checkboxColor}` : `2px solid ${b.buttonColor}`,
|
|
2364
|
+
borderRadius: "3px",
|
|
2365
|
+
backgroundColor: w ? b.checkboxColor : "#fff",
|
|
2366
|
+
zIndex: "2",
|
|
2367
|
+
display: "block",
|
|
2368
|
+
width: b.checkboxSize,
|
|
2369
|
+
height: b.checkboxSize
|
|
2370
|
+
});
|
|
2371
|
+
w ? (G.innerHTML = U(b.checkboxSize),
|
|
2372
|
+
b.selectedBg && (w = !0 === b.selectedBg ? rgbToRgba(b.activeBackground, .5) : b.selectedBg, p.addClass("selected").addClass("selected-bg-active"), p[0].style.setProperty("background-color", w, "important"), p.css("font-weight", "normal"))) : b.selectedBg && (p.removeClass("selected").removeClass("selected-bg-active"), p[0].style.removeProperty("background-color"), p.css("font-weight", "normal"));
|
|
2373
|
+
p.append(G)
|
|
2374
|
+
}
|
|
2375
|
+
}), m.find(".custom-checkbox").length || (D = document.createElement("div"), D.className = "custom-checkbox trigger-checkbox",
|
|
2376
|
+
J = parseInt(a.attr("data-check-count")) || 0, Object.assign(D.style, {
|
|
2377
|
+
...Y(),
|
|
2378
|
+
position: "absolute",
|
|
2379
|
+
right: "10px",
|
|
2380
|
+
top: "50%",
|
|
2381
|
+
transform: "translateY(-50%)",
|
|
2382
|
+
border: 0 < J ? `2px solid ${b.checkboxColor}` : `2px solid ${b.buttonColor}`,
|
|
2383
|
+
borderRadius: "3px",
|
|
2384
|
+
backgroundColor: 0 < J ? b.checkboxColor : "#fff",
|
|
2385
|
+
zIndex: "2",
|
|
2386
|
+
display: "block",
|
|
2387
|
+
width: b.checkboxSize,
|
|
2388
|
+
height: b.checkboxSize
|
|
2389
|
+
}), 0 < J && (D.innerHTML = A(J, b.checkboxSize)), m.append(D));
|
|
2390
|
+
if (!b.offclick || !a.hasClass(b.openClass)) {
|
|
2391
|
+
var E = !1;
|
|
2392
|
+
if (h) a.removeClass(b.openClass), a.attr("data-state",
|
|
2393
|
+
"closed"), aa(u), u.removeClass(b.highlightedClass), u.each(function() {
|
|
2394
|
+
const p = $(this);
|
|
2395
|
+
p.hasClass("selected") && b.selectedBg ? (p.addClass("selected-bg-active"), p.css("opacity", "1")) : p.removeClass("selected-bg-active")
|
|
2396
|
+
}), "radio" === b.pointer && (h = a.attr("data-selected-value"), m = a.find(".trigger-radio"), m.length && (void 0 !== h ? (Object.assign(m[0].style, {
|
|
2397
|
+
border: `2px solid ${b.radioColor}`,
|
|
2398
|
+
backgroundColor: "#fff",
|
|
2399
|
+
width: b.radioSize,
|
|
2400
|
+
height: b.radioSize
|
|
2401
|
+
}), m[0].innerHTML = void 0 !== h ? Q(b.radioColor, b) : "") : (Object.assign(m[0].style, {
|
|
2402
|
+
border: `2px solid ${b.buttonColor}`,
|
|
2403
|
+
backgroundColor: "#fff",
|
|
2404
|
+
width: b.radioSize,
|
|
2405
|
+
height: b.radioSize
|
|
2406
|
+
}), m[0].innerHTML = ""))), B(d, k, b);
|
|
2407
|
+
else {
|
|
2408
|
+
if (b.delay && 0 < parseInt(b.delay)) {
|
|
2409
|
+
if ("true" === a.attr("data-delay-pending")) return !1;
|
|
2410
|
+
a.attr("data-delay-pending", "true");
|
|
2411
|
+
const p = this;
|
|
2412
|
+
e.preventDefault();
|
|
2413
|
+
e.stopPropagation();
|
|
2414
|
+
setTimeout(function() {
|
|
2415
|
+
a.removeAttr("data-delay-pending");
|
|
2416
|
+
c.call(p, e)
|
|
2417
|
+
}, parseInt(b.delay));
|
|
2418
|
+
return !1
|
|
2419
|
+
}
|
|
2420
|
+
c.call(this, e)
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
});
|
|
2426
|
+
$(document).on("click", function(e) {
|
|
2427
|
+
if (T) T = !1;
|
|
2428
|
+
else {
|
|
2429
|
+
var c = $(e.target),
|
|
2430
|
+
a = c.closest('[class*="-wrapper"]');
|
|
2431
|
+
if (c.closest(".group-option").length || a.data("groupClicked")) return e.preventDefault(), e.stopPropagation(), !1;
|
|
2432
|
+
e = $('[class*="-wrapper"][class*="open"]');
|
|
2433
|
+
e.length && !c.closest('[class*="-wrapper"]').length && (ua = 2, e.each(function() {
|
|
2434
|
+
const b = $(this),
|
|
2435
|
+
h = b.data("settings");
|
|
2436
|
+
if (h && !0 !== h.offclick && (!h.pointer || !h.pointer.startsWith("question_") || "true" !== b.attr("data-aun"))) {
|
|
2437
|
+
var d = b.find(`.${h.optionsClass}`),
|
|
2438
|
+
k = parseInt(b.attr("data-duration")),
|
|
2439
|
+
u = function() {
|
|
2440
|
+
b.find('[class*="-option"]').removeClass("selected");
|
|
2441
|
+
[50, 100, 200].forEach(m => {
|
|
2442
|
+
setTimeout(() => {
|
|
2443
|
+
const D = b.find('[class*="-option"].selected');
|
|
2444
|
+
0 < D.length && D.removeClass("selected")
|
|
2445
|
+
}, m)
|
|
2446
|
+
})
|
|
2447
|
+
};
|
|
2448
|
+
if (q() && !h.slideToggle) z(d, k, $(".select-overlay"), b, h), u();
|
|
2449
|
+
else {
|
|
2450
|
+
b.removeClass(h.openClass);
|
|
2451
|
+
b.attr("data-state", "closed");
|
|
2452
|
+
if ("radio" === h.pointer) {
|
|
2453
|
+
const m = b.attr("data-selected-value"),
|
|
2454
|
+
D = parseInt(b.attr("data-selected-index")),
|
|
2455
|
+
J = b.find(".trigger-radio");
|
|
2456
|
+
void 0 !== m && 0 <= D && (Object.assign(J[0].style, {
|
|
2457
|
+
border: `2px solid ${h.radioColor}`,
|
|
2458
|
+
backgroundColor: "#fff",
|
|
2459
|
+
width: h.radioSize,
|
|
2460
|
+
height: h.radioSize
|
|
2461
|
+
}), J.html(Q(h.radioColor, h)))
|
|
2462
|
+
}
|
|
2463
|
+
k ? h.slideToggle ? d.css("opacity", h.opacity || 0).slideToggle(k, {
|
|
2464
|
+
easing: h.easing,
|
|
2465
|
+
complete: function() {
|
|
2466
|
+
M(b);
|
|
2467
|
+
u();
|
|
2468
|
+
domqueryFocus()
|
|
2469
|
+
}
|
|
2470
|
+
}) : d.slideToggle(k, {
|
|
2471
|
+
easing: h.easing,
|
|
2472
|
+
complete: function() {
|
|
2473
|
+
M(b);
|
|
2474
|
+
u();
|
|
2475
|
+
domqueryFocus()
|
|
2476
|
+
}
|
|
2477
|
+
}) : (u(), d.hide(), M(b), domqueryFocus())
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
}))
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
$(document).on("focusin", function(e) {
|
|
2484
|
+
e = $(e.target);
|
|
2485
|
+
const c = e.closest('[class*="-wrapper"]');
|
|
2486
|
+
e.is("body") || $('[class*="-wrapper"][class*="open"]').each(function() {
|
|
2487
|
+
const a = $(this);
|
|
2488
|
+
if (!c.length || a[0] !== c[0]) {
|
|
2489
|
+
var b =
|
|
2490
|
+
a.data("settings");
|
|
2491
|
+
if (b && !0 !== b.offclick && (!b.pointer || !b.pointer.startsWith("question_") || "true" !== a.attr("data-aun"))) {
|
|
2492
|
+
var h = a.find(`.${b.optionsClass}`),
|
|
2493
|
+
d = parseInt(a.attr("data-duration"));
|
|
2494
|
+
if (q() && !b.slideToggle) z(h, d, $(".select-overlay"), a, b);
|
|
2495
|
+
else {
|
|
2496
|
+
a.removeClass(b.openClass);
|
|
2497
|
+
a.attr("data-state", "closed");
|
|
2498
|
+
if ("radio" === b.pointer) {
|
|
2499
|
+
const k = a.attr("data-selected-value"),
|
|
2500
|
+
u = parseInt(a.attr("data-selected-index")),
|
|
2501
|
+
m = a.find(".trigger-radio");
|
|
2502
|
+
void 0 !== k && 0 <= u && (Object.assign(m[0].style, {
|
|
2503
|
+
border: `2px solid ${b.radioColor}`,
|
|
2504
|
+
backgroundColor: "#fff",
|
|
2505
|
+
width: b.radioSize,
|
|
2506
|
+
height: b.radioSize
|
|
2507
|
+
}), m.html(Q(b.radioColor, b)))
|
|
2508
|
+
}
|
|
2509
|
+
d ? b.slideToggle ? h.css("opacity", b.opacity || 0).slideToggle(d, {
|
|
2510
|
+
easing: b.easing,
|
|
2511
|
+
complete: function() {
|
|
2512
|
+
M(a);
|
|
2513
|
+
domqueryFocus()
|
|
2514
|
+
}
|
|
2515
|
+
}) : h.slideToggle(d, {
|
|
2516
|
+
easing: b.easing,
|
|
2517
|
+
complete: function() {
|
|
2518
|
+
M(a);
|
|
2519
|
+
domqueryFocus()
|
|
2520
|
+
}
|
|
2521
|
+
}) : (h.hide(), M(a), domqueryFocus())
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
})
|
|
2526
|
+
});
|
|
2527
|
+
$(document).on("focusout", '[class*="-wrapper"]', function(e) {
|
|
2528
|
+
const c = $(this),
|
|
2529
|
+
a = c.data("settings");
|
|
2530
|
+
a && !0 !== a.offclick && setTimeout(() => {
|
|
2531
|
+
if ($('[class*="-wrapper"][class*="open"]').length &&
|
|
2532
|
+
!(0 < $(document.activeElement).closest('[class*="-wrapper"]').length || a.pointer && a.pointer.startsWith("question_") && "true" === c.attr("data-aun"))) {
|
|
2533
|
+
var b = c.find(`.${a.optionsClass}`),
|
|
2534
|
+
h = parseInt(c.attr("data-duration"));
|
|
2535
|
+
if (q() && !a.slideToggle) z(b, h, $(".select-overlay"), c, a);
|
|
2536
|
+
else {
|
|
2537
|
+
c.removeClass(a.openClass);
|
|
2538
|
+
c.attr("data-state", "closed");
|
|
2539
|
+
if ("radio" === a.pointer) {
|
|
2540
|
+
const d = c.attr("data-selected-value"),
|
|
2541
|
+
k = parseInt(c.attr("data-selected-index")),
|
|
2542
|
+
u = c.find(".trigger-radio");
|
|
2543
|
+
void 0 !== d && 0 <= k && (Object.assign(u[0].style, {
|
|
2544
|
+
border: `2px solid ${a.radioColor}`,
|
|
2545
|
+
backgroundColor: "#fff",
|
|
2546
|
+
width: a.radioSize,
|
|
2547
|
+
height: a.radioSize
|
|
2548
|
+
}), u.html(Q(a.radioColor, a)))
|
|
2549
|
+
}
|
|
2550
|
+
h ? a.slideToggle ? b.css("opacity", a.opacity || 0).slideToggle(h, {
|
|
2551
|
+
easing: a.easing
|
|
2552
|
+
}) : b.slideToggle(h, {
|
|
2553
|
+
easing: a.easing
|
|
2554
|
+
}) : b.hide()
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
}, 0)
|
|
2558
|
+
});
|
|
2559
|
+
$(window).on("resize", function() {
|
|
2560
|
+
$('[class*="-wrapper"][class*="open"]').each(function() {
|
|
2561
|
+
var e = $(this),
|
|
2562
|
+
c = e.data("settings");
|
|
2563
|
+
c && !0 !== c.slideToggle && (c = e.find(`.${c.optionsClass}`), e = Z(e, c), c.css(e))
|
|
2564
|
+
})
|
|
2565
|
+
})
|
|
2566
|
+
}
|
|
2567
|
+
return this
|
|
2568
|
+
};
|
|
2569
|
+
$.fn.select = function(v, l, H) {
|
|
2570
|
+
const q = function(r, y, n) {
|
|
2571
|
+
if (n) {
|
|
2572
|
+
var Q = y.val();
|
|
2573
|
+
n.pointer ? "radio" === n.pointer ? r.find(".custom-radio").each(function() {
|
|
2574
|
+
const U = $(this).closest('[class*="-option"]').attr("data-value") === Q;
|
|
2575
|
+
$(this).css({
|
|
2576
|
+
border: U ? `2px solid ${n.radioColor}` : `2px solid ${n.buttonColor}`,
|
|
2577
|
+
backgroundColor: "#fff"
|
|
2578
|
+
}).html(U ? upHTMe(n.radioColor, n) : "")
|
|
2579
|
+
}) : "checkbox" === n.pointer ? r.find(".custom-checkbox").each(function() {
|
|
2580
|
+
const U = $(this).closest('[class*="-option"]').attr("data-value") === Q,
|
|
2581
|
+
A = n.checkboxColor ||
|
|
2582
|
+
"#2196F3",
|
|
2583
|
+
Y = n.checkboxSize || "16px";
|
|
2584
|
+
U ? $(this).css({
|
|
2585
|
+
border: `2px solid ${A}`,
|
|
2586
|
+
backgroundColor: A
|
|
2587
|
+
}).html(upHTMe2(Y)) : $(this).css({
|
|
2588
|
+
border: `2px solid ${n.buttonColor||"#ccc"}`,
|
|
2589
|
+
backgroundColor: "#fff"
|
|
2590
|
+
}).html("")
|
|
2591
|
+
}) : n.pointer.startsWith("question_") && r.find(".custom-question").each(function() {
|
|
2592
|
+
$(this).closest('[class*="-option"]').attr("data-value") === Q ? $(this).addClass("active") : $(this).removeClass("active")
|
|
2593
|
+
}) : n.dot && r.find(".custom-dot").each(function() {
|
|
2594
|
+
$(this).closest('[class*="-option"]').attr("data-value") ===
|
|
2595
|
+
Q ? $(this).css(n.dotSelectedStyle || {}) : $(this).css(n.dotStyle || {})
|
|
2596
|
+
})
|
|
2597
|
+
}
|
|
2598
|
+
};
|
|
2599
|
+
if ("string" === typeof v) {
|
|
2600
|
+
if ("value" === v) return "" === l || null === l || void 0 === l ? this.each(function() {
|
|
2601
|
+
const r = $(this).find('option[value=""]');
|
|
2602
|
+
if (r.length) return $(this).select("index", r.index())
|
|
2603
|
+
}) : this.each(function() {
|
|
2604
|
+
const r = $(this);
|
|
2605
|
+
if (this._selectId) {
|
|
2606
|
+
var y = r.find(`option[value="${l}"]`);
|
|
2607
|
+
if (y.length) {
|
|
2608
|
+
var n = $(".select-" + (this._selectId + "-wrapper"));
|
|
2609
|
+
const U = n.data("settings");
|
|
2610
|
+
r.find("option").prop("selected", !1);
|
|
2611
|
+
y.prop("selected", !0);
|
|
2612
|
+
n.attr({
|
|
2613
|
+
"data-selected-value": y.val(),
|
|
2614
|
+
"data-selected-index": y.index()
|
|
2615
|
+
});
|
|
2616
|
+
var Q = n.find('[class*="-option"]');
|
|
2617
|
+
Q.removeClass("selected").removeClass("selected-bg-active").css("font-weight", "normal");
|
|
2618
|
+
U.selectedBg && Q.each(function() {
|
|
2619
|
+
const O = $(this),
|
|
2620
|
+
L = (O.attr("style") || "").replace(/background-color:[^;]+;?/g, "");
|
|
2621
|
+
O.attr("style", L)
|
|
2622
|
+
});
|
|
2623
|
+
const A = n.find(`[data-value="${y.val()}"]`);
|
|
2624
|
+
if (A.length) {
|
|
2625
|
+
setTimeout(() => {
|
|
2626
|
+
A.addClass("selected");
|
|
2627
|
+
U.selectedBg ? (A.addClass("selected-bg-active"), A[0].style.setProperty("background-color",
|
|
2628
|
+
!0 === U.selectedBg ? rgbToRgba(U.activeBackground, .5) : U.selectedBg, "important"), A.css("font-weight", "normal")) : A.css("font-weight", "bold")
|
|
2629
|
+
}, 300);
|
|
2630
|
+
const O = n.find('[class*="-options"]');
|
|
2631
|
+
if (O.length) {
|
|
2632
|
+
Q = (A.attr("class")?.split(" ") || []).filter(L => L !== U.optionClass && "selected" !== L && L !== U.highlightedClass && !L.includes("wrapper") && !L.includes("options"));
|
|
2633
|
+
if (0 < Q.length) {
|
|
2634
|
+
const L = new Set,
|
|
2635
|
+
M = B => {
|
|
2636
|
+
if (B && !L.has(B)) {
|
|
2637
|
+
L.add(B);
|
|
2638
|
+
var N = O.find(`[data-group="${B}"]`);
|
|
2639
|
+
N.length && (N.addClass("expanded"), N.find(".custom-group-arrow").css("transform",
|
|
2640
|
+
"translateY(-50%) rotate(180deg)"), O.find(`.${B}`).show(), (N.attr("class")?.split(" ") || []).forEach(z => {
|
|
2641
|
+
"group-option" !== z && "expanded" !== z && M(z)
|
|
2642
|
+
}))
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2645
|
+
Q.forEach(B => M(B))
|
|
2646
|
+
}
|
|
2647
|
+
void 0 !== U.autoScrollToSelected && U.autoScrollToSelected && (Q = parseInt(n.attr("data-duration")) || 300, setTimeout(() => {
|
|
2648
|
+
O.find("div").first().length && A.length && A[0] && "function" === typeof A[0].scrollIntoView && A[0].scrollIntoView({
|
|
2649
|
+
block: "center",
|
|
2650
|
+
behavior: "smooth"
|
|
2651
|
+
})
|
|
2652
|
+
}, Q))
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
q(n, y, U);
|
|
2656
|
+
n = n.find('[class*="-trigger"]');
|
|
2657
|
+
|
|
2658
|
+
function Y(O, L) {
|
|
2659
|
+
var M = L.attr("class");
|
|
2660
|
+
if (!M) return L.text();
|
|
2661
|
+
const B = [];
|
|
2662
|
+
M = M.split(" ");
|
|
2663
|
+
for (let z = 0; z < M.length; z++) {
|
|
2664
|
+
var N = O.find(`option[group="${M[z]}"]`);
|
|
2665
|
+
if (N.length && (B.push(N.text()), N = N.attr("class"))) {
|
|
2666
|
+
N = N.split(" ");
|
|
2667
|
+
for (let Z = 0; Z < N.length; Z++) {
|
|
2668
|
+
const aa = O.find(`option[group="${N[Z]}"]`);
|
|
2669
|
+
aa.length && B.unshift(aa.text())
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
B.push(L.text());
|
|
2674
|
+
return [...(new Set(B))].join(" > ")
|
|
2675
|
+
}
|
|
2676
|
+
let ca;
|
|
2677
|
+
if (r.find("option[group]").length) try {
|
|
2678
|
+
ca = "function" === typeof findGroupPath ? findGroupPath(this, y.val(), y.index()).text : Y(r, y)
|
|
2679
|
+
} catch (O) {
|
|
2680
|
+
console.warn("\uadf8\ub8f9 \uacbd\ub85c \uad6c\uc131 \uc911 \uc624\ub958 \ubc1c\uc0dd:",
|
|
2681
|
+
O), ca = y.text()
|
|
2682
|
+
} else ca = y.text();
|
|
2683
|
+
y = n.find(".custom-radio, .custom-checkbox, .custom-question, .custom-dot").clone();
|
|
2684
|
+
Q = n.find('span[style*="position: absolute"]').clone();
|
|
2685
|
+
U && U.allowHTML ? n.html(ca) : n.text(ca);
|
|
2686
|
+
y.length && n.append(y);
|
|
2687
|
+
Q.length && n.append(Q);
|
|
2688
|
+
r.val(l)
|
|
2689
|
+
}
|
|
2690
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
2691
|
+
});
|
|
2692
|
+
if ("index" === v && "number" === typeof l) return this.each(function() {
|
|
2693
|
+
var r = $(this);
|
|
2694
|
+
if (this._selectId) {
|
|
2695
|
+
var y = r.find("option").eq(l);
|
|
2696
|
+
if (y.length) {
|
|
2697
|
+
var n = $(".select-" + (this._selectId +
|
|
2698
|
+
"-wrapper"));
|
|
2699
|
+
const U = n.data("settings");
|
|
2700
|
+
r.find("option").prop("selected", !1);
|
|
2701
|
+
y.prop("selected", !0);
|
|
2702
|
+
n.attr({
|
|
2703
|
+
"data-selected-value": y.val(),
|
|
2704
|
+
"data-selected-index": l
|
|
2705
|
+
});
|
|
2706
|
+
var Q = n.find('[class*="-option"]');
|
|
2707
|
+
Q.removeClass("selected").removeClass("selected-bg-active").css("font-weight", "normal");
|
|
2708
|
+
U.selectedBg && Q.each(function() {
|
|
2709
|
+
const O = $(this),
|
|
2710
|
+
L = (O.attr("style") || "").replace(/background-color:[^;]+;?/g, "");
|
|
2711
|
+
O.attr("style", L)
|
|
2712
|
+
});
|
|
2713
|
+
const A = n.find(`[data-value="${y.val()}"]`);
|
|
2714
|
+
A.length && setTimeout(() => {
|
|
2715
|
+
A.addClass("selected");
|
|
2716
|
+
U.selectedBg ? (A.addClass("selected-bg-active"), A[0].style.setProperty("background-color", U.selectedBg, "important"), A.css("font-weight", "normal")) : A.css("font-weight", "bold")
|
|
2717
|
+
}, 300);
|
|
2718
|
+
q(n, y, U);
|
|
2719
|
+
n = n.find('[class*="-trigger"]');
|
|
2720
|
+
|
|
2721
|
+
function Y(O, L) {
|
|
2722
|
+
var M = L.attr("class");
|
|
2723
|
+
if (!M) return L.text();
|
|
2724
|
+
const B = [];
|
|
2725
|
+
M = M.split(" ");
|
|
2726
|
+
for (let z = 0; z < M.length; z++) {
|
|
2727
|
+
var N = O.find(`option[group="${M[z]}"]`);
|
|
2728
|
+
if (N.length && (B.push(N.text()), N = N.attr("class"))) {
|
|
2729
|
+
N = N.split(" ");
|
|
2730
|
+
for (let Z = 0; Z < N.length; Z++) {
|
|
2731
|
+
const aa = O.find(`option[group="${N[Z]}"]`);
|
|
2732
|
+
aa.length && B.unshift(aa.text())
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
B.push(L.text());
|
|
2737
|
+
return [...(new Set(B))].join(" > ")
|
|
2738
|
+
}
|
|
2739
|
+
let ca;
|
|
2740
|
+
if (r.find("option[group]").length) try {
|
|
2741
|
+
ca = "function" === typeof findGroupPath ? findGroupPath(this, y.val(), l).text : Y(r, y)
|
|
2742
|
+
} catch (O) {
|
|
2743
|
+
console.warn("\uadf8\ub8f9 \uacbd\ub85c \uad6c\uc131 \uc911 \uc624\ub958 \ubc1c\uc0dd:", O), ca = y.text()
|
|
2744
|
+
} else ca = y.text();
|
|
2745
|
+
r = n.find(".custom-radio, .custom-checkbox, .custom-question, .custom-dot").clone();
|
|
2746
|
+
Q = n.find('span[style*="position: absolute"]').clone();
|
|
2747
|
+
U && U.allowHTML ? n.html(ca) :
|
|
2748
|
+
n.text(ca);
|
|
2749
|
+
r.length && n.append(r);
|
|
2750
|
+
Q.length && n.append(Q);
|
|
2751
|
+
"function" === typeof H && H.call(this, {
|
|
2752
|
+
index: l,
|
|
2753
|
+
value: y.val(),
|
|
2754
|
+
text: y.text(),
|
|
2755
|
+
path: ca
|
|
2756
|
+
})
|
|
2757
|
+
}
|
|
2758
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
2759
|
+
});
|
|
2760
|
+
if ("value" === v) return this.each(function() {
|
|
2761
|
+
var r = $(this);
|
|
2762
|
+
if (this._selectId) {
|
|
2763
|
+
var y = r.find(`option[value="${l}"]`);
|
|
2764
|
+
if (y.length) {
|
|
2765
|
+
var n = $(".select-" + (this._selectId + "-wrapper"));
|
|
2766
|
+
const U = y.index(),
|
|
2767
|
+
A = n.data("settings");
|
|
2768
|
+
r.find("option").prop("selected", !1);
|
|
2769
|
+
y.prop("selected", !0);
|
|
2770
|
+
n.attr({
|
|
2771
|
+
"data-selected-value": l,
|
|
2772
|
+
"data-selected-index": U
|
|
2773
|
+
});
|
|
2774
|
+
var Q = n.find('[class*="-option"]');
|
|
2775
|
+
Q.removeClass("selected").removeClass("selected-bg-active").css("font-weight", "normal");
|
|
2776
|
+
A.selectedBg && Q.each(function() {
|
|
2777
|
+
const L = $(this),
|
|
2778
|
+
M = (L.attr("style") || "").replace(/background-color:[^;]+;?/g, "");
|
|
2779
|
+
L.attr("style", M)
|
|
2780
|
+
});
|
|
2781
|
+
const Y = n.find(`[data-value="${l}"]`);
|
|
2782
|
+
Y.length && setTimeout(() => {
|
|
2783
|
+
Y.addClass("selected");
|
|
2784
|
+
A.selectedBg ? (Y.addClass("selected-bg-active"), Y[0].style.setProperty("background-color", A.selectedBg, "important"), Y.css("font-weight",
|
|
2785
|
+
"normal")) : Y.css("font-weight", "bold")
|
|
2786
|
+
}, 300);
|
|
2787
|
+
A && A.pointer ? "radio" === A.pointer ? n.find(".custom-radio").each(function() {
|
|
2788
|
+
const L = $(this).closest('[class*="-option"]').attr("data-value") === l;
|
|
2789
|
+
$(this).css({
|
|
2790
|
+
border: L ? `2px solid ${A.radioColor}` : `2px solid ${A.buttonColor}`,
|
|
2791
|
+
backgroundColor: "#fff"
|
|
2792
|
+
}).html(L ? `<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: ${parseInt(A.radioSize)/2}px; height: ${parseInt(A.radioSize)/2}px; background-color: ${A.radioColor}; border-radius: 50%;"></div>` :
|
|
2793
|
+
"")
|
|
2794
|
+
}) : "checkbox" === A.pointer ? n.find(".custom-checkbox").each(function() {
|
|
2795
|
+
const L = $(this).closest('[class*="-option"]').attr("data-value") === l,
|
|
2796
|
+
M = A.checkboxColor || "#2196F3";
|
|
2797
|
+
L ? $(this).css({
|
|
2798
|
+
border: `2px solid ${M}`,
|
|
2799
|
+
backgroundColor: M
|
|
2800
|
+
}).html('<svg viewBox="0 0 24 24" style="fill: white; width: 90%; height: 90%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></svg>') : $(this).css({
|
|
2801
|
+
border: `2px solid ${A.buttonColor||
|
|
2802
|
+
"#ccc"}`,
|
|
2803
|
+
backgroundColor: "#fff"
|
|
2804
|
+
}).html("")
|
|
2805
|
+
}) : A.pointer.startsWith("question_") && n.find(".custom-question").each(function() {
|
|
2806
|
+
$(this).closest('[class*="-option"]').attr("data-value") === l ? $(this).addClass("active") : $(this).removeClass("active")
|
|
2807
|
+
}) : A && A.dot && n.find(".custom-dot").each(function() {
|
|
2808
|
+
const L = $(this).closest('[class*="-option"]').attr("data-value") === l;
|
|
2809
|
+
$(this).css({
|
|
2810
|
+
border: L ? `2px solid ${A.dotColor}` : `2px solid ${A.buttonColor}`,
|
|
2811
|
+
backgroundColor: L ? A.dotColor : "#fff"
|
|
2812
|
+
})
|
|
2813
|
+
});
|
|
2814
|
+
n = n.find('[class*="-trigger"]');
|
|
2815
|
+
|
|
2816
|
+
function ca(L, M) {
|
|
2817
|
+
var B = M.attr("class");
|
|
2818
|
+
if (!B) return M.text();
|
|
2819
|
+
const N = [];
|
|
2820
|
+
B = B.split(" ");
|
|
2821
|
+
for (let Z = 0; Z < B.length; Z++) {
|
|
2822
|
+
var z = L.find(`option[group="${B[Z]}"]`);
|
|
2823
|
+
if (z.length && (N.push(z.text()), z = z.attr("class"))) {
|
|
2824
|
+
z = z.split(" ");
|
|
2825
|
+
for (let aa = 0; aa < z.length; aa++) {
|
|
2826
|
+
const ja = L.find(`option[group="${z[aa]}"]`);
|
|
2827
|
+
ja.length && N.unshift(ja.text())
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
N.push(M.text());
|
|
2832
|
+
return [...(new Set(N))].join(" > ")
|
|
2833
|
+
}
|
|
2834
|
+
let O;
|
|
2835
|
+
if (r.find("option[group]").length) try {
|
|
2836
|
+
O = "function" === typeof findGroupPath ? findGroupPath(this, l, U).text : ca(r, y)
|
|
2837
|
+
} catch (L) {
|
|
2838
|
+
console.warn("\uadf8\ub8f9 \uacbd\ub85c \uad6c\uc131 \uc911 \uc624\ub958 \ubc1c\uc0dd:",
|
|
2839
|
+
L), O = y.text()
|
|
2840
|
+
} else O = y.text();
|
|
2841
|
+
r = n.find(".custom-radio, .custom-checkbox, .custom-question, .custom-dot").clone();
|
|
2842
|
+
Q = n.find('span[style*="position: absolute"]').clone();
|
|
2843
|
+
A && A.allowHTML ? n.html(O) : n.text(O);
|
|
2844
|
+
r.length && n.append(r);
|
|
2845
|
+
Q.length && n.append(Q);
|
|
2846
|
+
"function" === typeof H && H.call(this, {
|
|
2847
|
+
index: U,
|
|
2848
|
+
value: l,
|
|
2849
|
+
text: y.text(),
|
|
2850
|
+
path: O
|
|
2851
|
+
})
|
|
2852
|
+
}
|
|
2853
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
2854
|
+
})
|
|
2855
|
+
}
|
|
2856
|
+
return $.select.call(this, v, l, H)
|
|
2857
|
+
};
|
|
2858
|
+
$.fn.selectSet = function(v, l, H) {
|
|
2859
|
+
return this.each(function() {
|
|
2860
|
+
function q(B, N, z) {
|
|
2861
|
+
const [Z, aa] = N.split(":");
|
|
2862
|
+
if ("selected" === Z) "selected" === aa && (r.find("option").prop("selected", !1), B.prop("selected", !0), Q(A, r, B), r.trigger("change"));
|
|
2863
|
+
else if ("val" === Z)
|
|
2864
|
+
if (N = B.val(), B.val(aa), z) {
|
|
2865
|
+
const na = B.attr("group");
|
|
2866
|
+
B.attr("group", aa);
|
|
2867
|
+
r.find(`option.${na}`).each(function() {
|
|
2868
|
+
$(this).removeClass(na).addClass(aa)
|
|
2869
|
+
});
|
|
2870
|
+
B = A.find(`[data-group="${na}"]`);
|
|
2871
|
+
B.length && (B.attr("data-group", aa), A.find(`.${na}`).each(function() {
|
|
2872
|
+
$(this).removeClass(na).addClass(aa)
|
|
2873
|
+
}))
|
|
2874
|
+
} else z =
|
|
2875
|
+
A.find(`[data-value="${N}"]`), z.length && z.attr("data-value", aa), B.prop("selected") && U(A, y);
|
|
2876
|
+
else if ("text" === Z)
|
|
2877
|
+
if (B.text(aa), z) {
|
|
2878
|
+
z = B.attr("group");
|
|
2879
|
+
z = A.find(`[data-group="${z}"]`);
|
|
2880
|
+
if (z.length) {
|
|
2881
|
+
N = z.find(".custom-group-arrow").clone();
|
|
2882
|
+
var ja = z.contents().filter(function() {
|
|
2883
|
+
return 3 === this.nodeType
|
|
2884
|
+
});
|
|
2885
|
+
ja.length ? ja[0].nodeValue = aa : (Y && Y.allowHTML ? z.html(aa) : z.text(aa), N.length && z.append(N))
|
|
2886
|
+
}
|
|
2887
|
+
B = B.attr("group");
|
|
2888
|
+
r.find(`option.${B}`).filter(function() {
|
|
2889
|
+
return $(this).prop("selected")
|
|
2890
|
+
}).length && U(A, y)
|
|
2891
|
+
} else {
|
|
2892
|
+
z = B.val();
|
|
2893
|
+
z = A.find(`[data-value="${z}"]`);
|
|
2894
|
+
if (z.length) {
|
|
2895
|
+
N = z.find(".custom-radio, .custom-checkbox, .custom-question, .custom-dot, .custom-group-arrow").clone();
|
|
2896
|
+
ja = z.find('span[style*="position: absolute"]').clone();
|
|
2897
|
+
let na = z.contents().filter(function() {
|
|
2898
|
+
return 3 === this.nodeType
|
|
2899
|
+
});
|
|
2900
|
+
na.length ? na[0].nodeValue = aa : (Y && Y.allowHTML ? z.html(aa) : z.text(aa), N.length && z.append(N), ja.length && z.append(ja))
|
|
2901
|
+
}
|
|
2902
|
+
B.prop("selected") && U(A, y)
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
const r = $(this),
|
|
2906
|
+
y = this;
|
|
2907
|
+
var n = this._selectId;
|
|
2908
|
+
if (n) {
|
|
2909
|
+
var Q = function(B, N, z) {
|
|
2910
|
+
const Z = B.data("settings"),
|
|
2911
|
+
aa = z.val();
|
|
2912
|
+
z = z.index();
|
|
2913
|
+
B.attr({
|
|
2914
|
+
"data-selected-value": aa,
|
|
2915
|
+
"data-selected-index": z
|
|
2916
|
+
});
|
|
2917
|
+
B.find('[class*="-option"]').removeClass("selected").css("font-weight", "normal");
|
|
2918
|
+
const ja = B.find(`[data-value="${aa}"]`);
|
|
2919
|
+
ja.length && setTimeout(() => {
|
|
2920
|
+
ja.addClass("selected");
|
|
2921
|
+
Z.selectedBg || ja.css("font-weight", "bold")
|
|
2922
|
+
}, 300);
|
|
2923
|
+
"radio" === Z.pointer ? B.find(".custom-radio").each(function() {
|
|
2924
|
+
const na = $(this).closest('[class*="-option"]').attr("data-value") === aa;
|
|
2925
|
+
$(this).css({
|
|
2926
|
+
border: na ? `2px solid ${Z.radioColor}` : `2px solid ${Z.buttonColor}`,
|
|
2927
|
+
backgroundColor: "#fff"
|
|
2928
|
+
}).html(na ? `<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: ${parseInt(Z.radioSize)/2}px; height: ${parseInt(Z.radioSize)/2}px; background-color: ${Z.radioColor}; border-radius: 50%;"></div>` : "")
|
|
2929
|
+
}) : Z.dot && B.find(".custom-dot").each(function() {
|
|
2930
|
+
const na = $(this).closest('[class*="-option"]').attr("data-value") === aa;
|
|
2931
|
+
$(this).css({
|
|
2932
|
+
border: na ? `2px solid ${Z.dotColor}` : `2px solid ${Z.buttonColor}`,
|
|
2933
|
+
backgroundColor: na ? Z.dotColor : "#fff"
|
|
2934
|
+
})
|
|
2935
|
+
});
|
|
2936
|
+
U(B, N[0])
|
|
2937
|
+
},
|
|
2938
|
+
U = function(B, N) {
|
|
2939
|
+
const z = B.data("settings");
|
|
2940
|
+
B = B.find('[class*="-trigger"]');
|
|
2941
|
+
var Z = $(N);
|
|
2942
|
+
const aa = Z.find("option:selected");
|
|
2943
|
+
if (aa.length) {
|
|
2944
|
+
var ja = aa.index(),
|
|
2945
|
+
na = aa.val();
|
|
2946
|
+
if (Z.find("option[group]").length && "function" === typeof findGroupPath) try {
|
|
2947
|
+
var qa = findGroupPath(N, na, ja).text
|
|
2948
|
+
} catch (ua) {
|
|
2949
|
+
console.warn("Error getting group path:", ua), qa = aa.text()
|
|
2950
|
+
} else qa = aa.text();
|
|
2951
|
+
N = B.find(".custom-radio, .custom-checkbox, .custom-question, .custom-dot").clone();
|
|
2952
|
+
Z = B.find('span[style*="position: absolute"]').clone();
|
|
2953
|
+
z && z.allowHTML ? B.html(qa) : B.text(qa);
|
|
2954
|
+
N.length && B.append(N);
|
|
2955
|
+
Z.length && B.append(Z);
|
|
2956
|
+
"radio" === z.pointer && (qa = B.find(".custom-radio"), qa.length && qa.css({
|
|
2957
|
+
border: `2px solid ${z.radioColor}`,
|
|
2958
|
+
backgroundColor: "#fff"
|
|
2959
|
+
}).html(`<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: ${parseInt(z.radioSize)/2}px; height: ${parseInt(z.radioSize)/2}px; background-color: ${z.radioColor}; border-radius: 50%;"></div>`))
|
|
2960
|
+
}
|
|
2961
|
+
},
|
|
2962
|
+
A = $(".select-" + (n + "-wrapper")),
|
|
2963
|
+
Y = A.data("settings");
|
|
2964
|
+
n = !1;
|
|
2965
|
+
if ("string" === typeof v && v.startsWith("group:")) {
|
|
2966
|
+
n = !0;
|
|
2967
|
+
var ca = v.substring(6);
|
|
2968
|
+
ca = r.find(`option[group="${ca}"]`)
|
|
2969
|
+
} else "number" !== typeof v && isNaN(parseInt(v)) ? "string" === typeof v && (ca = r.find(`option[value="${v}"]`)) : (ca = parseInt(v), ca = r.find("option").eq(ca), ca.attr("group") && (n = !0));
|
|
2970
|
+
if (ca.length) {
|
|
2971
|
+
if ("string" === typeof l && l.startsWith("{") && l.endsWith("}")) {
|
|
2972
|
+
var O = l.match(/\{([^}]+)\}/g);
|
|
2973
|
+
if (O)
|
|
2974
|
+
for (var L of O) O = L.substring(1, L.length - 1), q(ca, O, n)
|
|
2975
|
+
} else "string" === typeof l && q(ca, l, n);
|
|
2976
|
+
if ("function" === typeof H) {
|
|
2977
|
+
var M =
|
|
2978
|
+
r.find("option:selected");
|
|
2979
|
+
L = M.index();
|
|
2980
|
+
n = M.val();
|
|
2981
|
+
ca = M.text();
|
|
2982
|
+
O = "";
|
|
2983
|
+
if (M.length && M.attr("class")) {
|
|
2984
|
+
M = M.attr("class").split(" ");
|
|
2985
|
+
for (const B of M)
|
|
2986
|
+
if (M = r.find(`option[group="${B}"]`), M.length) {
|
|
2987
|
+
O = M.text();
|
|
2988
|
+
break
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
H.call(this, {
|
|
2992
|
+
index: L,
|
|
2993
|
+
value: n,
|
|
2994
|
+
text: ca,
|
|
2995
|
+
group: O
|
|
2996
|
+
})
|
|
2997
|
+
}
|
|
2998
|
+
} else console.warn(`Target option not found: ${v}`)
|
|
2999
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
3000
|
+
})
|
|
3001
|
+
};
|
|
3002
|
+
$.fn.selectGet = function(v) {
|
|
3003
|
+
var l = $(this);
|
|
3004
|
+
if ("number" === typeof v) return l = l.find("option").eq(v), l.length ? l : $();
|
|
3005
|
+
if ("string" === typeof v && !["val", "value", "text", "index", "group"].includes(v)) {
|
|
3006
|
+
var H = l.find(`option[value="${v}"]`);
|
|
3007
|
+
if (H.length) return H;
|
|
3008
|
+
l = l.find("option").filter(function() {
|
|
3009
|
+
return $(this).text() === v
|
|
3010
|
+
});
|
|
3011
|
+
return l.length ? l : $()
|
|
3012
|
+
}
|
|
3013
|
+
var q = l.find("option:selected");
|
|
3014
|
+
if (!q.length) return $();
|
|
3015
|
+
if (v && "val" !== v && "value" !== v) {
|
|
3016
|
+
if ("text" === v) return q.text();
|
|
3017
|
+
if ("index" === v) return q.index();
|
|
3018
|
+
if ("group" === v) {
|
|
3019
|
+
H = "";
|
|
3020
|
+
try {
|
|
3021
|
+
if (q.attr("class")) {
|
|
3022
|
+
const r = q.attr("class").split(" ");
|
|
3023
|
+
q = [];
|
|
3024
|
+
for (const y of r) {
|
|
3025
|
+
const n = l.find(`option[group="${y}"]`);
|
|
3026
|
+
if (n.length && (q.unshift(n.text()), n.attr("class"))) {
|
|
3027
|
+
const Q = n.attr("class").split(" ");
|
|
3028
|
+
for (const U of Q) {
|
|
3029
|
+
const A = l.find(`option[group="${U}"]`);
|
|
3030
|
+
A.length && q.unshift(A.text())
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
H = q.join(" > ")
|
|
3035
|
+
}
|
|
3036
|
+
} catch (r) {
|
|
3037
|
+
console.warn("Error finding group path:", r)
|
|
3038
|
+
}
|
|
3039
|
+
return H
|
|
3040
|
+
}
|
|
3041
|
+
} else return q.val();
|
|
3042
|
+
return q
|
|
3043
|
+
};
|
|
3044
|
+
$.fn.selectAdd = function(v, l) {
|
|
3045
|
+
return this.each(function() {
|
|
3046
|
+
const H = $(this);
|
|
3047
|
+
if (this._selectId) {
|
|
3048
|
+
var q;
|
|
3049
|
+
if ("string" === typeof v) {
|
|
3050
|
+
var r = (n, Q, U, A = {}) => ({
|
|
3051
|
+
prefix: n,
|
|
3052
|
+
minParts: Q,
|
|
3053
|
+
fields: U,
|
|
3054
|
+
optionalFields: A,
|
|
3055
|
+
parse: function(Y) {
|
|
3056
|
+
if (Y.length < this.minParts) return null;
|
|
3057
|
+
const ca = {};
|
|
3058
|
+
this.fields.forEach((O, L) => {
|
|
3059
|
+
ca[O] = Y[L + 1] || ""
|
|
3060
|
+
});
|
|
3061
|
+
Object.entries(this.optionalFields).forEach(([O, L]) => {
|
|
3062
|
+
O = parseInt(O);
|
|
3063
|
+
Y[O] && Y[O].trim() && (ca[L] = Y[O])
|
|
3064
|
+
});
|
|
3065
|
+
return ca
|
|
3066
|
+
}
|
|
3067
|
+
});
|
|
3068
|
+
window._selectParsers || (window._selectParsers = [], window._selectParsers.push(r("group:",
|
|
3069
|
+
3, ["group", "text"])), window._selectParsers.push(r("option:", 4, ["value", "text", "groupClass"], {
|
|
3070
|
+
4: "tag",
|
|
3071
|
+
5: "img"
|
|
3072
|
+
})));
|
|
3073
|
+
var y = window._selectParsers;
|
|
3074
|
+
r = v.split(":");
|
|
3075
|
+
(y = y.find(n => v.startsWith(n.prefix))) && (q = y.parse(r));
|
|
3076
|
+
q || (q = v)
|
|
3077
|
+
} else q = v;
|
|
3078
|
+
q.group ? (r = document.createElement("option"), r.setAttribute("group", q.group), r.textContent = q.text || "", q.parentGroup && (r.className = q.parentGroup), H[0].appendChild(r)) : (r = document.createElement("option"), r.value = q.value || "", r.textContent = q.text || "", q.groupClass && (r.className =
|
|
3079
|
+
q.groupClass), q.tag && r.setAttribute("tag", q.tag), q.img && r.setAttribute("img", q.img), q.groupClass ? (y = Array.from(H[0].querySelectorAll(`.${q.groupClass}`)), 0 < y.length ? (y = y[y.length - 1], y.nextSibling ? H[0].insertBefore(r, y.nextSibling) : H[0].appendChild(r)) : (y = H[0].querySelector(`option[group="${q.groupClass}"]`)) && y.nextSibling ? H[0].insertBefore(r, y.nextSibling) : H[0].appendChild(r)) : H[0].appendChild(r));
|
|
3080
|
+
refreshSelectUI(H);
|
|
3081
|
+
"function" === typeof l && l.call(this, {
|
|
3082
|
+
type: q.group ? "group" : "option",
|
|
3083
|
+
group: q.group ||
|
|
3084
|
+
q.groupClass,
|
|
3085
|
+
value: q.value,
|
|
3086
|
+
text: q.text
|
|
3087
|
+
})
|
|
3088
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
3089
|
+
})
|
|
3090
|
+
};
|
|
3091
|
+
|
|
3092
|
+
function refreshSelectUI(v) {
|
|
3093
|
+
const l = v.closest('[class*="-wrapper"]');
|
|
3094
|
+
if (l.length) {
|
|
3095
|
+
const H = l[0].parentNode,
|
|
3096
|
+
q = l[0].nextSibling;
|
|
3097
|
+
v[0].style.display = "";
|
|
3098
|
+
q ? H.insertBefore(v[0], q) : H.appendChild(v[0]);
|
|
3099
|
+
l.remove()
|
|
3100
|
+
}
|
|
3101
|
+
v.select(300, {
|
|
3102
|
+
duration: 300,
|
|
3103
|
+
slideToggle: !0,
|
|
3104
|
+
opacity: 1
|
|
3105
|
+
})
|
|
3106
|
+
}
|
|
3107
|
+
$.fn.selectAdd.registerParser = function(v, l, H, q) {
|
|
3108
|
+
window._selectParsers || (window._selectParsers = []);
|
|
3109
|
+
window._selectParsers.push(createParser(v, l, H, q))
|
|
3110
|
+
};
|
|
3111
|
+
$.fn.selectRemove = function(v, l) {
|
|
3112
|
+
return this.each(function() {
|
|
3113
|
+
const H = $(this);
|
|
3114
|
+
if (this._selectId) {
|
|
3115
|
+
var q = "";
|
|
3116
|
+
if ("string" === typeof v)
|
|
3117
|
+
if (v.startsWith("group:")) {
|
|
3118
|
+
q = v.substring(6);
|
|
3119
|
+
var r = H.find(`option[group="${q}"], option.${q}`);
|
|
3120
|
+
q = "group"
|
|
3121
|
+
} else v.startsWith("value:") ? (q = v.substring(6), r = H.find(`option[value="${q}"]`)) : v.startsWith("index:") ? (q = parseInt(v.substring(6)), r = H.find("option").eq(q)) : r = H.find(`option[value="${v}"]`), q = "option";
|
|
3122
|
+
if (r && 0 < r.length) {
|
|
3123
|
+
q = {
|
|
3124
|
+
type: q,
|
|
3125
|
+
count: r.length,
|
|
3126
|
+
items: r.map(function() {
|
|
3127
|
+
return {
|
|
3128
|
+
value: $(this).val(),
|
|
3129
|
+
text: $(this).text(),
|
|
3130
|
+
isGroup: void 0 !== $(this).attr("group"),
|
|
3131
|
+
groupName: $(this).attr("group") || $(this).attr("class")
|
|
3132
|
+
}
|
|
3133
|
+
}).get()
|
|
3134
|
+
};
|
|
3135
|
+
r.remove();
|
|
3136
|
+
r = H.closest('[class*="-wrapper"]');
|
|
3137
|
+
if (r.length) {
|
|
3138
|
+
const y = r[0].parentNode,
|
|
3139
|
+
n = r[0].nextSibling;
|
|
3140
|
+
H[0].style.display = "";
|
|
3141
|
+
n ? y.insertBefore(H[0], n) : y.appendChild(H[0]);
|
|
3142
|
+
r.remove()
|
|
3143
|
+
}
|
|
3144
|
+
r = parseInt(H.data("duration") || 300);
|
|
3145
|
+
H.select(r, {
|
|
3146
|
+
duration: r,
|
|
3147
|
+
slideToggle: !0,
|
|
3148
|
+
opacity: 1
|
|
3149
|
+
});
|
|
3150
|
+
"function" === typeof l && l.call(this, q)
|
|
3151
|
+
}
|
|
3152
|
+
} else console.warn("Select element was not initialized with $.select() method")
|
|
3153
|
+
})
|
|
3154
|
+
};
|