@daracl/form 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/daracl.form.css +163 -63
- package/dist/daracl.form.min.css +2 -2
- package/dist/daracl.form.min.umd.js +30 -30
- package/dist/daracl.form.min.umd.js.map +1 -1
- package/dist/daracl.form.umd.js +26 -6
- package/dist/daracl.form.umd.js.map +1 -1
- package/dist/index.cjs +26 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +24 -24
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +397 -392
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/style/base/_base.scss +18 -9
- package/style/components/_field-container.scss +2 -1
- package/style/components/_file-list.scss +30 -4
- package/style/components/_form-field.scss +3 -2
- package/style/components/_form-group.scss +5 -1
- package/style/components/_grid-field.scss +0 -1
- package/style/components/_icon.scss +12 -2
- package/style/components/_label.scss +16 -10
- package/style/components/_tab.scss +1 -2
- package/style/daracl.form.css +204 -128
- package/style/daracl.form.css.map +1 -1
- package/style/daracl.form.min.css +1 -1
- package/style/daracl.form.min.css.map +1 -1
- package/style/daracl.form.scss +24 -15
- package/style/themes/_common.scss +6 -1
- package/style/themes/_dark.scss +24 -12
- package/style/themes/_light.scss +10 -4
package/dist/index.min.js
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @daracl/form v0.0.
|
|
2
|
+
* @daracl/form v0.0.19
|
|
3
3
|
* Copyright 2023-2026 darainfo;
|
|
4
4
|
* Licensed MIT
|
|
5
5
|
*/
|
|
6
|
-
import { isArray as Se, leftPad as w, isNumeric as Re, leftPadClamp as P, isFunction as
|
|
6
|
+
import { isArray as Se, leftPad as w, isNumeric as Re, leftPadClamp as P, isFunction as H } from "@daracl/core";
|
|
7
7
|
const ae = {
|
|
8
8
|
"&": "&",
|
|
9
9
|
"<": "<",
|
|
10
10
|
">": ">",
|
|
11
11
|
'"': """,
|
|
12
12
|
"'": "'"
|
|
13
|
-
}, Q = (
|
|
14
|
-
let e =
|
|
13
|
+
}, Q = (l) => {
|
|
14
|
+
let e = l;
|
|
15
15
|
return e && Object.keys(ae).forEach((t) => {
|
|
16
16
|
e = e.replaceAll(t, ae[t]);
|
|
17
17
|
}), e;
|
|
18
|
-
},
|
|
19
|
-
if (y(
|
|
20
|
-
let e =
|
|
18
|
+
}, He = (l, e) => l.hasOwnProperty(e), D = (l) => l === null || l === "" || typeof l > "u" || typeof l == "string" && (l === "" || l.replace(/\s/g, "") === ""), y = (l) => typeof l > "u", be = (l) => typeof l == "function", oe = (l) => typeof l == "string", M = (l) => D(l) ? !1 : (l = +l, !isNaN(l)), L = (l) => Se(l), C = (l) => y(l) || l == null, j = (l) => l && l.renderType === "tab", Le = (l) => l && l.renderType === "grid", Ye = (l) => (l.$xssName = Te(l), l.label = Q(l.label), l), Ce = (l) => Le(l.$parent) || j(l.$parent), Te = (l) => {
|
|
19
|
+
if (y(l.$xssName)) {
|
|
20
|
+
let e = l.name;
|
|
21
21
|
return e && Object.keys(ae).forEach((t) => {
|
|
22
22
|
e = e.replaceAll(t, "_");
|
|
23
23
|
}), "df_" + e;
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
}, _e = (
|
|
25
|
+
return l.$xssName;
|
|
26
|
+
}, _e = (l) => {
|
|
27
27
|
let e = 0;
|
|
28
|
-
if (
|
|
29
|
-
for (let t = 0; t <
|
|
30
|
-
let i =
|
|
28
|
+
if (l.length == 0) return e;
|
|
29
|
+
for (let t = 0; t < l.length; t++) {
|
|
30
|
+
let i = l.charCodeAt(t);
|
|
31
31
|
e = (e << 5) - e + i, e = e & e;
|
|
32
32
|
}
|
|
33
33
|
return String(e).replaceAll(/-/g, "_");
|
|
34
|
-
}, je = (
|
|
34
|
+
}, je = (l) => l.renderType === "hidden", z = (l) => {
|
|
35
35
|
const e = document.createElement("template");
|
|
36
|
-
return e.innerHTML =
|
|
36
|
+
return e.innerHTML = l, e.content.firstElementChild;
|
|
37
37
|
};
|
|
38
|
-
function de(
|
|
39
|
-
if (typeof
|
|
38
|
+
function de(l) {
|
|
39
|
+
if (typeof l != "object" || l === null)
|
|
40
40
|
return !1;
|
|
41
|
-
let e =
|
|
41
|
+
let e = l;
|
|
42
42
|
for (; Object.getPrototypeOf(e) !== null; )
|
|
43
43
|
e = Object.getPrototypeOf(e);
|
|
44
|
-
return Object.getPrototypeOf(
|
|
44
|
+
return Object.getPrototypeOf(l) === e;
|
|
45
45
|
}
|
|
46
|
-
function ke(
|
|
47
|
-
return typeof
|
|
46
|
+
function ke(l) {
|
|
47
|
+
return typeof l == "object" && l !== null && !L(l);
|
|
48
48
|
}
|
|
49
|
-
function ze(
|
|
50
|
-
return
|
|
49
|
+
function ze(l) {
|
|
50
|
+
return l instanceof Date && !isNaN(l.valueOf());
|
|
51
51
|
}
|
|
52
|
-
const he = (...
|
|
53
|
-
let e =
|
|
52
|
+
const he = (...l) => {
|
|
53
|
+
let e = l[0];
|
|
54
54
|
if (!de(e) || C(e))
|
|
55
55
|
return e;
|
|
56
56
|
let t = 1;
|
|
57
57
|
Object.keys(e).length > 0 && (t = 0, e = L(e) ? [] : {});
|
|
58
|
-
const i =
|
|
58
|
+
const i = l.length;
|
|
59
59
|
for (; t < i; t += 1)
|
|
60
|
-
G(e,
|
|
60
|
+
G(e, l[t]);
|
|
61
61
|
return e;
|
|
62
62
|
};
|
|
63
|
-
function G(
|
|
64
|
-
return ke(e) ? We(
|
|
63
|
+
function G(l, e) {
|
|
64
|
+
return ke(e) ? We(l, e) : L(e) ? Pe(l, e) : ze(e) ? new e.constructor(e) : e;
|
|
65
65
|
}
|
|
66
|
-
function We(
|
|
66
|
+
function We(l, e) {
|
|
67
67
|
if (be(e))
|
|
68
68
|
return e;
|
|
69
69
|
for (const t of Object.keys(e)) {
|
|
70
70
|
const i = e[t];
|
|
71
|
-
y(i) || (i === null || be(i) ?
|
|
71
|
+
y(i) || (i === null || be(i) ? l[t] = i : C(l[t]) ? l[t] = G(L(i) ? [] : {}, i) : ke(i) ? G(l[t], i) : l[t] = i);
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return l;
|
|
74
74
|
}
|
|
75
|
-
function Pe(
|
|
76
|
-
const t = de(
|
|
75
|
+
function Pe(l, e) {
|
|
76
|
+
const t = de(l);
|
|
77
77
|
for (let i = 0; i < e.length; i += 1) {
|
|
78
|
-
const
|
|
78
|
+
const s = e[i];
|
|
79
79
|
let n;
|
|
80
|
-
|
|
80
|
+
s == null ? n = s : n = G(L(s) ? [] : {}, s), t ? l[i] = n : l.push(n);
|
|
81
81
|
}
|
|
82
|
-
return
|
|
82
|
+
return l;
|
|
83
83
|
}
|
|
84
84
|
class f {
|
|
85
85
|
constructor(e, t, i) {
|
|
86
|
-
var
|
|
87
|
-
this.enableView = !0, this.daraForm = e, this.field = t, this.rowElement = i, this.createField(), t.tooltip && ((
|
|
86
|
+
var s;
|
|
87
|
+
this.enableView = !0, this.daraForm = e, this.field = t, this.rowElement = i, this.createField(), t.tooltip && ((s = i.querySelector(".df-tooltip")) == null || s.setAttribute("tooltip", t.tooltip));
|
|
88
88
|
}
|
|
89
89
|
setDefaultInfo() {
|
|
90
90
|
if (y(this.field.defaultValue) ? this.setValue("", !1) : this.setValue(this.field.defaultValue, !1), !y(this.field.placeholder)) {
|
|
@@ -114,26 +114,26 @@ class f {
|
|
|
114
114
|
const t = e.descriptionClass ? Q(e.descriptionClass) : "", i = e.descriptionStyle ? 'style="' + Q(e.descriptionStyle) + '"' : "";
|
|
115
115
|
return e.description ? `<div class="df-description ${t}" ${i}>${e.description}</div>` : "";
|
|
116
116
|
}
|
|
117
|
-
changeEventCall(e, t, i,
|
|
117
|
+
changeEventCall(e, t, i, s) {
|
|
118
118
|
var n;
|
|
119
119
|
if (e.onChange) {
|
|
120
120
|
let a = {
|
|
121
121
|
field: e,
|
|
122
122
|
evt: t,
|
|
123
123
|
oldValue: e.$value,
|
|
124
|
-
value:
|
|
124
|
+
value: s
|
|
125
125
|
};
|
|
126
126
|
if ((n = e.listItem) != null && n.list) {
|
|
127
127
|
let o = [];
|
|
128
128
|
const r = f.valuesValueKey(e);
|
|
129
129
|
for (let d of e.listItem.list) {
|
|
130
130
|
let h = d[r];
|
|
131
|
-
if (oe(
|
|
132
|
-
if (h ==
|
|
131
|
+
if (oe(s)) {
|
|
132
|
+
if (h == s) {
|
|
133
133
|
o.push(d);
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
|
-
} else L(
|
|
136
|
+
} else L(s) && s.includes(h) && o.push(d);
|
|
137
137
|
}
|
|
138
138
|
a.valueItems = o;
|
|
139
139
|
}
|
|
@@ -167,12 +167,12 @@ class f {
|
|
|
167
167
|
if (t)
|
|
168
168
|
t.textContent = e;
|
|
169
169
|
else {
|
|
170
|
-
const
|
|
171
|
-
if (
|
|
170
|
+
const s = this.rowElement.querySelector(".df-field");
|
|
171
|
+
if (s) {
|
|
172
172
|
const n = new DOMParser();
|
|
173
173
|
this.field.description = e;
|
|
174
174
|
const a = n.parseFromString(f.getDescriptionTemplate(this.field), "text/html").querySelector(".df-description");
|
|
175
|
-
a && ((i =
|
|
175
|
+
a && ((i = s.parentNode) == null || i.insertBefore(a, s.nextSibling));
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
}
|
|
@@ -193,8 +193,8 @@ class f {
|
|
|
193
193
|
}
|
|
194
194
|
static valuesLabelValue(e, t) {
|
|
195
195
|
let i = !1;
|
|
196
|
-
const
|
|
197
|
-
return i ?
|
|
196
|
+
const s = e.replace(/\{\{([A-Za-z0-9_.]*)\}\}/g, (n, a) => (i = !0, t[a] || ""));
|
|
197
|
+
return i ? s : t[e] || "";
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
const Be = {
|
|
@@ -209,44 +209,44 @@ const Be = {
|
|
|
209
209
|
"upper-char": /^(?=.*?[A-Z])(?=.*?[a-z])/,
|
|
210
210
|
"upper-char-special": /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[#?!@$%^&*-])/,
|
|
211
211
|
"upper-char-special-number": /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]/
|
|
212
|
-
}, Ie = (
|
|
212
|
+
}, Ie = (l, e, t) => {
|
|
213
213
|
if (!e.$instance.isEnableView())
|
|
214
214
|
return { name: e.name, constraint: [] };
|
|
215
215
|
typeof t > "u" && (t = { name: e.name, constraint: [] });
|
|
216
216
|
const i = e.regexpType;
|
|
217
|
-
return i && !Be[i].test(
|
|
218
|
-
},
|
|
219
|
-
if (e.validator && (t.validator = e.validator(e,
|
|
217
|
+
return i && !Be[i].test(l) && (t.regexp = i), t;
|
|
218
|
+
}, Oe = (l, e, t) => {
|
|
219
|
+
if (e.validator && (t.validator = e.validator(e, l), typeof t.validator == "object") || (t = Ie(l, e, t), t.regexp))
|
|
220
220
|
return t;
|
|
221
221
|
if (e.different) {
|
|
222
|
-
const i = e.different.field,
|
|
223
|
-
if (!C(
|
|
222
|
+
const i = e.different.field, s = e.$instance.getForm().getField(i);
|
|
223
|
+
if (!C(s) && e.$instance.getValue() == s.$instance.getValue())
|
|
224
224
|
return t.message = e.different.message, t;
|
|
225
225
|
}
|
|
226
226
|
if (e.identical) {
|
|
227
|
-
const i = e.identical.field,
|
|
228
|
-
if (!C(
|
|
227
|
+
const i = e.identical.field, s = e.$instance.getForm().getField(i);
|
|
228
|
+
if (!C(s) && e.$instance.getValue() != s.$instance.getValue())
|
|
229
229
|
return t.message = e.identical.message, t;
|
|
230
230
|
}
|
|
231
231
|
return !0;
|
|
232
|
-
}, ue = (
|
|
232
|
+
}, ue = (l, e) => {
|
|
233
233
|
if (!e.$instance.isEnableView())
|
|
234
234
|
return !0;
|
|
235
|
-
const t = { name: e.name, constraint: [] }, i = Number(
|
|
236
|
-
if (e.required && D(
|
|
235
|
+
const t = { name: e.name, constraint: [] }, i = Number(l);
|
|
236
|
+
if (e.required && D(l))
|
|
237
237
|
return t.constraint.push(v.REQUIRED), t;
|
|
238
|
-
if (!M(
|
|
238
|
+
if (!M(l))
|
|
239
239
|
return t.constraint.push(v.NAN), t;
|
|
240
|
-
if (
|
|
240
|
+
if (Oe(l, e, t) !== !0)
|
|
241
241
|
return t;
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
244
|
-
const n = M(
|
|
242
|
+
const s = e.rule;
|
|
243
|
+
if (s) {
|
|
244
|
+
const n = M(s.minimum), a = M(s.maximum);
|
|
245
245
|
let o = !1, r = !1, d = !1, h = !1;
|
|
246
|
-
n && (
|
|
246
|
+
n && (s.exclusiveMinimum && i <= s.minimum ? r = !0 : i < s.minimum && (o = !0)), a && (s.exclusiveMaximum && i >= s.maximum ? h = !0 : i > s.maximum && (d = !0)), n && a && (o || r || d || h) ? s.exclusiveMinimum && s.exclusiveMaximum && (r || h) ? t.constraint.push(v.BETWEEN_EXCLUSIVE_MINMAX) : r ? t.constraint.push(v.BETWEEN_EXCLUSIVE_MIN) : h ? t.constraint.push(v.BETWEEN_EXCLUSIVE_MAX) : t.constraint.push(v.BETWEEN) : (r && t.constraint.push(v.EXCLUSIVE_MIN), h && t.constraint.push(v.EXCLUSIVE_MAX), o && t.constraint.push(v.MIN), d && t.constraint.push(v.MAX));
|
|
247
247
|
}
|
|
248
248
|
return t.constraint.length > 0 ? t : !0;
|
|
249
|
-
}, $ = (
|
|
249
|
+
}, $ = (l, e, t) => {
|
|
250
250
|
if (t === !0) {
|
|
251
251
|
e.classList.remove("invalid"), e.classList.contains("valid") || e.classList.add("valid");
|
|
252
252
|
const i = e.querySelector(".df-help-message");
|
|
@@ -254,33 +254,33 @@ const Be = {
|
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
256
|
if (e.classList.remove("valid"), e.classList.contains("invalid") || e.classList.add("invalid"), t !== !1) {
|
|
257
|
-
const i = I.validMessage(
|
|
257
|
+
const i = I.validMessage(l, t);
|
|
258
258
|
t.message && i.push(t.message);
|
|
259
|
-
const
|
|
260
|
-
if (
|
|
259
|
+
const s = e.querySelector(".df-help-message");
|
|
260
|
+
if (s && i.length > 0) {
|
|
261
261
|
const n = [];
|
|
262
262
|
i.forEach((a) => {
|
|
263
263
|
n.push(`<div>${a}</div>`);
|
|
264
|
-
}),
|
|
264
|
+
}), s.innerHTML = n.join("");
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
}, b = (
|
|
268
|
-
|
|
269
|
-
}, ce = (
|
|
267
|
+
}, b = (l) => {
|
|
268
|
+
l.classList.remove("invalid"), l.classList.remove("valid");
|
|
269
|
+
}, ce = (l, e, t) => {
|
|
270
270
|
e.addEventListener("input", (i) => {
|
|
271
|
-
|
|
271
|
+
O(l, i, t, t.getValue()), t.valid();
|
|
272
272
|
});
|
|
273
|
-
}, Xe = (
|
|
273
|
+
}, Xe = (l, e, t) => {
|
|
274
274
|
e.addEventListener("keyup", (i) => {
|
|
275
|
-
const
|
|
276
|
-
M(
|
|
275
|
+
const s = i.target.value;
|
|
276
|
+
M(s) || (e.value = s.replace(/[^0-9\.\-\+]/g, ""), i.preventDefault()), O(l, i, t, t.getValue()), t.valid();
|
|
277
277
|
});
|
|
278
|
-
}, Ue = (
|
|
278
|
+
}, Ue = (l, e, t) => {
|
|
279
279
|
e.addEventListener("change", (i) => {
|
|
280
|
-
|
|
280
|
+
O(l, i, t, t.getValue()), t.valid();
|
|
281
281
|
});
|
|
282
|
-
},
|
|
283
|
-
t.changeEventCall(
|
|
282
|
+
}, O = (l, e, t, i) => {
|
|
283
|
+
t.changeEventCall(l, e, t, i);
|
|
284
284
|
};
|
|
285
285
|
class Ke extends f {
|
|
286
286
|
constructor(e, t, i) {
|
|
@@ -320,20 +320,20 @@ class Ke extends f {
|
|
|
320
320
|
return $(this.field, this.rowElement, e), e;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
const R = (
|
|
323
|
+
const R = (l, e) => {
|
|
324
324
|
if (!e.$instance.isEnableView())
|
|
325
325
|
return !0;
|
|
326
326
|
let t = { name: e.name, constraint: [] };
|
|
327
|
-
if (e.required && D(
|
|
327
|
+
if (e.required && D(l))
|
|
328
328
|
return t.constraint.push(v.REQUIRED), t;
|
|
329
|
-
const i =
|
|
329
|
+
const i = Oe(l, e, t);
|
|
330
330
|
if (i !== !0)
|
|
331
331
|
return i;
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
const n =
|
|
332
|
+
const s = e.rule;
|
|
333
|
+
if (s) {
|
|
334
|
+
const n = l.length, a = M(s.minLength), o = M(s.maxLength);
|
|
335
335
|
let r = !1, d = !1;
|
|
336
|
-
if (a && n <
|
|
336
|
+
if (a && n < s.minLength && (r = !0), o && n > s.maxLength && (d = !0), a && o && (r || d) ? t.constraint.push(v.BETWEEN) : (r && t.constraint.push(v.MIN_LENGTH), d && t.constraint.push(v.MAX_LENGTH)), t.constraint.length > 0)
|
|
337
337
|
return t;
|
|
338
338
|
}
|
|
339
339
|
return !0;
|
|
@@ -346,9 +346,9 @@ class Ze extends f {
|
|
|
346
346
|
ce(this.field, this.element, this);
|
|
347
347
|
}
|
|
348
348
|
createField() {
|
|
349
|
-
var
|
|
349
|
+
var s;
|
|
350
350
|
const e = this.field, t = this.rowElement.querySelector(".df-field-container");
|
|
351
|
-
let i = (
|
|
351
|
+
let i = (s = e.rendererOptions) == null ? void 0 : s.rows;
|
|
352
352
|
i = +i > 0 ? i : 3, t.innerHTML = `
|
|
353
353
|
<div class="df-field">
|
|
354
354
|
<textarea name="${e.$xssName}" rows="${i}" class="df-form-field df-textarea df-help-icon"></textarea>
|
|
@@ -382,14 +382,14 @@ class fe extends f {
|
|
|
382
382
|
constructor(e, t, i) {
|
|
383
383
|
var o, r, d, h, u;
|
|
384
384
|
super(i, e, t);
|
|
385
|
-
let
|
|
386
|
-
y(e.defaultValue) || (
|
|
385
|
+
let s = "";
|
|
386
|
+
y(e.defaultValue) || (s = e.defaultValue);
|
|
387
387
|
const n = fe.valuesValueKey(e);
|
|
388
388
|
let a = !1;
|
|
389
389
|
(r = (o = this.field.listItem) == null ? void 0 : o.list) == null || r.forEach((c) => {
|
|
390
390
|
let p = c[n];
|
|
391
|
-
c.selected && (this.defaultSelected = p), p ==
|
|
392
|
-
}), a ? this.defaultSelected =
|
|
391
|
+
c.selected && (this.defaultSelected = p), p == s && (a = !0);
|
|
392
|
+
}), a ? this.defaultSelected = s : this.defaultSelected || ((d = e.rendererOptions) == null ? void 0 : d.disableDefaultOption) === !0 && (this.defaultSelected = ((u = (h = this.field.listItem) == null ? void 0 : h.list) == null ? void 0 : u.length) > 0 && this.field.listItem.list[0][n] || ""), y(this.defaultSelected) && (this.defaultSelected = ""), this.mounted(), this.setDefaultOption(), this.setValue(this.defaultSelected, !1);
|
|
393
393
|
}
|
|
394
394
|
mounted() {
|
|
395
395
|
Ue(this.field, this.element, this);
|
|
@@ -436,11 +436,11 @@ class fe extends f {
|
|
|
436
436
|
dropdownValuesTemplate(e) {
|
|
437
437
|
var n, a, o;
|
|
438
438
|
const t = f.valuesLabelKey(e), i = f.valuesValueKey(e);
|
|
439
|
-
let
|
|
440
|
-
return ((n = e.rendererOptions) == null ? void 0 : n.disableDefaultOption) !== !0 && (
|
|
439
|
+
let s = "";
|
|
440
|
+
return ((n = e.rendererOptions) == null ? void 0 : n.disableDefaultOption) !== !0 && (s += `<option value="">${I.getMessage("selection")}</option>`), (o = (a = e.listItem) == null ? void 0 : a.list) == null || o.forEach((r) => {
|
|
441
441
|
const d = `${r.selected ? "selected" : ""} ${r.disabled ? "disabled" : ""}`;
|
|
442
|
-
y(r[i]) && r.label ?
|
|
443
|
-
}),
|
|
442
|
+
y(r[i]) && r.label ? s += `<option value="${r.value || ""}" ${d}>${r.label}</option>` : s += `<option value="${r[i]}" ${d}>${f.valuesLabelValue(t, r)}</option>`;
|
|
443
|
+
}), s;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
class Qe extends f {
|
|
@@ -481,9 +481,9 @@ class Qe extends f {
|
|
|
481
481
|
return $(this.field, this.rowElement, e), e;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
function A(
|
|
484
|
+
function A(l, e, t, i) {
|
|
485
485
|
var c, p, x, V, T, W, ve, ye, Ee;
|
|
486
|
-
const
|
|
486
|
+
const s = {
|
|
487
487
|
rowStyleClass: me(e.orientation),
|
|
488
488
|
fieldClass: "",
|
|
489
489
|
fieldStyle: "",
|
|
@@ -493,39 +493,39 @@ function A(s, e, t, i) {
|
|
|
493
493
|
valueClass: "",
|
|
494
494
|
valueStyle: "",
|
|
495
495
|
tabAlignClass: ""
|
|
496
|
-
}, n = ((c = t == null ? void 0 : t.style) == null ? void 0 : c.labelWidth) ??
|
|
497
|
-
let a = ((p = t == null ? void 0 : t.style) == null ? void 0 : p.valueWidth) ??
|
|
498
|
-
const o = ((x = t == null ? void 0 : t.style) == null ? void 0 : x.position) ??
|
|
499
|
-
|
|
496
|
+
}, n = ((c = t == null ? void 0 : t.style) == null ? void 0 : c.labelWidth) ?? l.style.labelWidth ?? "3";
|
|
497
|
+
let a = ((p = t == null ? void 0 : t.style) == null ? void 0 : p.valueWidth) ?? l.style.valueWidth ?? "9";
|
|
498
|
+
const o = ((x = t == null ? void 0 : t.style) == null ? void 0 : x.position) ?? l.style.position, r = (V = e.style) == null ? void 0 : V.width, d = F[(T = e.style) == null ? void 0 : T.position] ?? F[o] ?? F.top;
|
|
499
|
+
s.fieldClass = `${d[0] ? "df-" + d[0] : ""} ${((W = e.style) == null ? void 0 : W.customClass) || ""}`, r && (M(r) ? s.fieldClass += M(r) ? ` df-col-xs-${r}` : "" : s.fieldStyle = M(r) ? "" : `width:${r};`), s.tabAlignClass = "df-tab-al-" + (["right", "center"].includes((ve = e.style) == null ? void 0 : ve.tabAlign) ? e.style.tabAlign : "left");
|
|
500
500
|
const h = ((ye = e.style) == null ? void 0 : ye.labelWidth) || n;
|
|
501
|
-
if (
|
|
501
|
+
if (s.labelAlignClass = d[1], !i && h && !["top", "bottom"].includes(d[0]))
|
|
502
502
|
if (M(h)) {
|
|
503
503
|
const $e = +h;
|
|
504
|
-
a = 12 - $e,
|
|
504
|
+
a = 12 - $e, s.labelClass = `df-col-xs-${$e}`, s.valueClass = s.labelStyle ? "df-col-full" : `df-col-xs-${a}`;
|
|
505
505
|
} else
|
|
506
|
-
|
|
506
|
+
s.labelStyle = `width:${h};`;
|
|
507
507
|
const u = ((Ee = e.style) == null ? void 0 : Ee.valueWidth) || a;
|
|
508
|
-
return i && !["left", "right"].includes(d[0]) ?
|
|
508
|
+
return i && !["left", "right"].includes(d[0]) ? s.valueClass = "df-col-full" : u && !["top", "bottom"].includes(d[0]) ? M(u) ? s.valueClass = s.labelStyle ? "df-col-full" : `df-col-xs-${u}` : s.valueStyle = `width:${u};` : s.valueClass = s.labelStyle ? "df-col-full" : "", s.fieldClass = se(s.fieldClass), s.labelClass = se(s.labelClass), s.valueClass = se(s.valueClass), s;
|
|
509
509
|
}
|
|
510
|
-
function me(
|
|
511
|
-
return
|
|
510
|
+
function me(l) {
|
|
511
|
+
return l === "horizontal" ? "df-horizontal" : "df-vertical";
|
|
512
512
|
}
|
|
513
|
-
function se(
|
|
514
|
-
return
|
|
513
|
+
function se(l) {
|
|
514
|
+
return l.replace(/\s+/g, " ").trim();
|
|
515
515
|
}
|
|
516
516
|
class pe extends f {
|
|
517
517
|
constructor(e, t, i) {
|
|
518
518
|
var o, r;
|
|
519
519
|
super(i, e, t), this.defaultCheckValue = [], this.defaultCheckValue = [];
|
|
520
|
-
let
|
|
521
|
-
y(e.defaultValue) || (L(e.defaultValue) ?
|
|
520
|
+
let s = [];
|
|
521
|
+
y(e.defaultValue) || (L(e.defaultValue) ? s = e.defaultValue : s = [e.defaultValue]);
|
|
522
522
|
const n = pe.valuesValueKey(e);
|
|
523
523
|
y(this.field.listItem) && this.setValueItems([{ label: "", value: "Y" }]);
|
|
524
524
|
let a = !1;
|
|
525
525
|
(r = (o = this.field.listItem) == null ? void 0 : o.list) == null || r.forEach((d) => {
|
|
526
526
|
let h = d[n];
|
|
527
|
-
d.selected && this.defaultCheckValue.push(h || !0),
|
|
528
|
-
}), this.defaultCheckValue = a ?
|
|
527
|
+
d.selected && this.defaultCheckValue.push(h || !0), s.includes(h) && (a = !0);
|
|
528
|
+
}), this.defaultCheckValue = a ? s : this.defaultCheckValue, this.mounted(), this.setDefaultOption(), this.setValue(this.defaultCheckValue, !1);
|
|
529
529
|
}
|
|
530
530
|
mounted() {
|
|
531
531
|
this.initEvent();
|
|
@@ -533,7 +533,7 @@ class pe extends f {
|
|
|
533
533
|
initEvent() {
|
|
534
534
|
this.rowElement.querySelectorAll(this.getSelector()).forEach((t) => {
|
|
535
535
|
t.addEventListener("change", (i) => {
|
|
536
|
-
|
|
536
|
+
O(this.field, i, this, this.getValue()), this.valid();
|
|
537
537
|
});
|
|
538
538
|
});
|
|
539
539
|
}
|
|
@@ -542,13 +542,13 @@ class pe extends f {
|
|
|
542
542
|
}
|
|
543
543
|
createField() {
|
|
544
544
|
var o, r;
|
|
545
|
-
const e = this.field, t = this.rowElement.querySelector(".df-field-container"), i = [],
|
|
545
|
+
const e = this.field, t = this.rowElement.querySelector(".df-field-container"), i = [], s = e.$xssName, n = f.valuesLabelKey(e), a = f.valuesValueKey(e);
|
|
546
546
|
i.push(' <div class="df-field"><div class="df-field-group">'), (r = (o = e.listItem) == null ? void 0 : o.list) == null || r.forEach((d) => {
|
|
547
547
|
const h = d[a];
|
|
548
548
|
i.push(`
|
|
549
549
|
<span class="df-field-item ${me(e.listItem.orientation ?? Ae.horizontal)}">
|
|
550
550
|
<label>
|
|
551
|
-
<input type="checkbox" name="${
|
|
551
|
+
<input type="checkbox" name="${s}" value="${h ? Q(h) : ""}" class="df-form-field df-checkbox" ${d.selected ? "checked" : ""} ${d.disabled ? "disabled" : ""} />
|
|
552
552
|
${f.valuesLabelValue(n, d)}
|
|
553
553
|
</label>
|
|
554
554
|
</span>
|
|
@@ -568,8 +568,8 @@ class pe extends f {
|
|
|
568
568
|
if (e.length > 1) {
|
|
569
569
|
const t = [];
|
|
570
570
|
return e.forEach((i) => {
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
const s = i;
|
|
572
|
+
s.checked && t.push(s.value);
|
|
573
573
|
}), t;
|
|
574
574
|
} else {
|
|
575
575
|
const t = this.rowElement.querySelector(`[name="${this.field.$xssName}"]`);
|
|
@@ -614,14 +614,14 @@ class ge extends f {
|
|
|
614
614
|
constructor(e, t, i) {
|
|
615
615
|
var o, r, d, h, u;
|
|
616
616
|
super(i, e, t), this.defaultCheckValue = "";
|
|
617
|
-
let
|
|
618
|
-
y(e.defaultValue) || (
|
|
617
|
+
let s = [];
|
|
618
|
+
y(e.defaultValue) || (s = e.defaultValue);
|
|
619
619
|
const n = ge.valuesValueKey(e);
|
|
620
620
|
let a = !1;
|
|
621
621
|
(r = (o = this.field.listItem) == null ? void 0 : o.list) == null || r.forEach((c) => {
|
|
622
622
|
let p = c[n];
|
|
623
|
-
c.selected && (this.defaultCheckValue = p),
|
|
624
|
-
}), a ? this.defaultCheckValue =
|
|
623
|
+
c.selected && (this.defaultCheckValue = p), s == p && (a = !0);
|
|
624
|
+
}), a ? this.defaultCheckValue = s : this.defaultCheckValue || (this.defaultCheckValue = ((h = (d = this.field.listItem) == null ? void 0 : d.list) == null ? void 0 : h.length) > 0 ? (u = this.field.listItem) == null ? void 0 : u.list[0][n] : ""), this.mounted(), this.setDefaultOption(), this.setValue(this.defaultCheckValue, !1);
|
|
625
625
|
}
|
|
626
626
|
mounted() {
|
|
627
627
|
this.initEvent();
|
|
@@ -629,7 +629,7 @@ class ge extends f {
|
|
|
629
629
|
initEvent() {
|
|
630
630
|
this.rowElement.querySelectorAll(this.getSelector()).forEach((t) => {
|
|
631
631
|
t.addEventListener("change", (i) => {
|
|
632
|
-
|
|
632
|
+
O(this.field, i, this, this.getValue()), this.valid();
|
|
633
633
|
});
|
|
634
634
|
});
|
|
635
635
|
}
|
|
@@ -638,13 +638,13 @@ class ge extends f {
|
|
|
638
638
|
}
|
|
639
639
|
createField() {
|
|
640
640
|
var o, r;
|
|
641
|
-
const e = this.field, t = this.rowElement.querySelector(".df-field-container"), i = [],
|
|
641
|
+
const e = this.field, t = this.rowElement.querySelector(".df-field-container"), i = [], s = e.$xssName, n = f.valuesLabelKey(e), a = f.valuesValueKey(e);
|
|
642
642
|
i.push('<div class="df-field"><div class="df-field-group">'), (r = (o = e.listItem) == null ? void 0 : o.list) == null || r.forEach((d) => {
|
|
643
643
|
const h = d[a];
|
|
644
644
|
i.push(
|
|
645
645
|
`<span class="df-field-item ${me(e.orientation ?? Ae.horizontal)}">
|
|
646
646
|
<label>
|
|
647
|
-
<input type="radio" name="${
|
|
647
|
+
<input type="radio" name="${s}" value="${h}" class="df-form-field df-radio" ${d.selected ? "checked" : ""} ${d.disabled ? "disabled" : ""}/>
|
|
648
648
|
${f.valuesLabelValue(n, d)}
|
|
649
649
|
</label>
|
|
650
650
|
</span>
|
|
@@ -676,8 +676,8 @@ class ge extends f {
|
|
|
676
676
|
this.rowElement.querySelector(`[name="${this.field.$xssName}"]`).checked = !1;
|
|
677
677
|
return;
|
|
678
678
|
}
|
|
679
|
-
this.rowElement.querySelectorAll(this.getSelector()).forEach((
|
|
680
|
-
let n =
|
|
679
|
+
this.rowElement.querySelectorAll(this.getSelector()).forEach((s) => {
|
|
680
|
+
let n = s;
|
|
681
681
|
n.value == e ? n.checked = !0 : n.checked = !1;
|
|
682
682
|
});
|
|
683
683
|
}
|
|
@@ -735,26 +735,26 @@ class Ge extends f {
|
|
|
735
735
|
return $(this.field, this.rowElement, e), e;
|
|
736
736
|
}
|
|
737
737
|
}
|
|
738
|
-
const Je = (
|
|
738
|
+
const Je = (l, e, t) => {
|
|
739
739
|
const i = { name: e.name, constraint: [] };
|
|
740
740
|
return e.required && t.length < 1 ? (i.constraint.push(v.REQUIRED), i) : i.constraint.length > 0 ? i : !0;
|
|
741
741
|
};
|
|
742
742
|
class et extends f {
|
|
743
743
|
constructor(e, t, i) {
|
|
744
|
-
var
|
|
745
|
-
super(i, e, t), this.removeIds = [], this.uploadFiles = {}, this.fileList = [], this.fileSeq = 0, this.element = t.querySelector(`[name="${e.$xssName}"]`), this.fileList = ((
|
|
744
|
+
var s;
|
|
745
|
+
super(i, e, t), this.removeIds = [], this.uploadFiles = {}, this.fileList = [], this.fileSeq = 0, this.element = t.querySelector(`[name="${e.$xssName}"]`), this.fileList = ((s = e.listItem) == null ? void 0 : s.list) || [], this.mounted(), this.setDefaultOption();
|
|
746
746
|
}
|
|
747
747
|
mounted() {
|
|
748
748
|
this.element.addEventListener("change", (e) => {
|
|
749
749
|
var i;
|
|
750
750
|
const t = (i = e.target) == null ? void 0 : i.files;
|
|
751
751
|
if (t) {
|
|
752
|
-
let
|
|
752
|
+
let s = [];
|
|
753
753
|
for (let n of t)
|
|
754
|
-
|
|
755
|
-
this.addFiles(
|
|
754
|
+
s.push(n);
|
|
755
|
+
this.addFiles(s);
|
|
756
756
|
}
|
|
757
|
-
|
|
757
|
+
O(this.field, e, this, this.fileList), this.valid();
|
|
758
758
|
}), this.fileList.forEach((e) => {
|
|
759
759
|
e.$seq = this.fileSeq += 1;
|
|
760
760
|
}), this.setFileList(this.fileList);
|
|
@@ -779,14 +779,14 @@ class et extends f {
|
|
|
779
779
|
addFiles(e) {
|
|
780
780
|
let t = !1;
|
|
781
781
|
const i = [];
|
|
782
|
-
for (let
|
|
783
|
-
if (this.fileList.filter((o) => o.fileName ==
|
|
784
|
-
this.fileSeq += 1, this.uploadFiles[this.fileSeq] =
|
|
782
|
+
for (let s of e) {
|
|
783
|
+
if (this.fileList.filter((o) => o.fileName == s.name && o.fileSize == s.size && o.lastModified == s.lastModified).length > 0) continue;
|
|
784
|
+
this.fileSeq += 1, this.uploadFiles[this.fileSeq] = s;
|
|
785
785
|
let a = {
|
|
786
|
-
fileName:
|
|
786
|
+
fileName: s.name,
|
|
787
787
|
$seq: this.fileSeq,
|
|
788
|
-
fileSize:
|
|
789
|
-
lastModified:
|
|
788
|
+
fileSize: s.size,
|
|
789
|
+
lastModified: s.lastModified
|
|
790
790
|
};
|
|
791
791
|
i.push(a), t = !0;
|
|
792
792
|
}
|
|
@@ -796,14 +796,14 @@ class et extends f {
|
|
|
796
796
|
const i = this.rowElement.querySelector(".df-file-list");
|
|
797
797
|
if (i) {
|
|
798
798
|
t === !0 && (i.innerHTML = "");
|
|
799
|
-
const
|
|
799
|
+
const s = [];
|
|
800
800
|
e.forEach((n) => {
|
|
801
|
-
|
|
801
|
+
s.push(`
|
|
802
802
|
<div class="df-file-item" data-seq="${n.$seq}">
|
|
803
|
-
${n.fileId ? '<span class="df-file-icon df-file-download"></span>' : '<span class="df-file-icon"></span>'} <span class="df-file-icon df-file-remove"></span>
|
|
803
|
+
${n.fileId ? '<span class="df-file-icon df-file-download"></span>' : '<span class="df-file-icon df-empty-icon"></span>'} <span class="df-file-icon df-file-remove"></span>
|
|
804
804
|
<span class="df-file-name">${n.fileName}</span >
|
|
805
805
|
</div>`);
|
|
806
|
-
}), i.insertAdjacentHTML("beforeend",
|
|
806
|
+
}), i.insertAdjacentHTML("beforeend", s.join("")), e.forEach((n) => {
|
|
807
807
|
this.removeFileEvent(n, i), this.downloadFileEvent(n, i);
|
|
808
808
|
});
|
|
809
809
|
}
|
|
@@ -816,8 +816,8 @@ class et extends f {
|
|
|
816
816
|
*/
|
|
817
817
|
downloadFileEvent(e, t) {
|
|
818
818
|
const i = t.querySelector(`[data-seq="${e.$seq}"] .df-file-download`);
|
|
819
|
-
i && i.addEventListener("click", (
|
|
820
|
-
const n =
|
|
819
|
+
i && i.addEventListener("click", (s) => {
|
|
820
|
+
const n = s.target.closest(".df-file-item");
|
|
821
821
|
if (n) {
|
|
822
822
|
const a = n.getAttribute("data-seq");
|
|
823
823
|
if (a) {
|
|
@@ -842,8 +842,8 @@ class et extends f {
|
|
|
842
842
|
*/
|
|
843
843
|
removeFileEvent(e, t) {
|
|
844
844
|
const i = t.querySelector(`[data-seq="${e.$seq}"] .df-file-remove`);
|
|
845
|
-
i && i.addEventListener("click", (
|
|
846
|
-
const n =
|
|
845
|
+
i && i.addEventListener("click", (s) => {
|
|
846
|
+
const n = s.target.closest(".df-file-item");
|
|
847
847
|
if (n) {
|
|
848
848
|
const a = n.getAttribute("data-seq");
|
|
849
849
|
if (a) {
|
|
@@ -1022,7 +1022,7 @@ class nt extends f {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
mounted() {
|
|
1024
1024
|
this.element.addEventListener("input", (e) => {
|
|
1025
|
-
this.rangeNumElement.innerHTML = e.target.value, this.element.setAttribute("title", e.target.value),
|
|
1025
|
+
this.rangeNumElement.innerHTML = e.target.value, this.element.setAttribute("title", e.target.value), O(this.field, e, this, this.getValue()), this.valid();
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
createField() {
|
|
@@ -1121,65 +1121,65 @@ let ee = 0, S = {
|
|
|
1121
1121
|
datetime: "YYYY-MM-DD HH:mm"
|
|
1122
1122
|
};
|
|
1123
1123
|
const k = ["ddtp-sun", "ddtp-mon", "ddtp-tue", "ddtp-wed", "ddtp-thu", "ddtp-fri", "ddtp-sat"];
|
|
1124
|
-
var m = /* @__PURE__ */ ((
|
|
1125
|
-
J.forEach((
|
|
1126
|
-
ee = Math.max(
|
|
1124
|
+
var m = /* @__PURE__ */ ((l) => (l.year = "year", l.month = "month", l.date = "date", l.datetime = "datetime", l.time = "time", l))(m || {});
|
|
1125
|
+
J.forEach((l) => {
|
|
1126
|
+
ee = Math.max(l.length, ee);
|
|
1127
1127
|
});
|
|
1128
|
-
const
|
|
1128
|
+
const qe = (l, e) => {
|
|
1129
1129
|
e = e || "YYYY-MM-DD";
|
|
1130
1130
|
const t = e.length;
|
|
1131
1131
|
let i = [];
|
|
1132
|
-
for (let
|
|
1133
|
-
let a = Math.min(ee, t -
|
|
1132
|
+
for (let s = 0; s < t; ) {
|
|
1133
|
+
let a = Math.min(ee, t - s);
|
|
1134
1134
|
for (; a > 0; a--) {
|
|
1135
|
-
const o = e.substring(
|
|
1135
|
+
const o = e.substring(s, s + a);
|
|
1136
1136
|
if (J.includes(o)) {
|
|
1137
1137
|
try {
|
|
1138
|
-
i.push(rt[o](
|
|
1138
|
+
i.push(rt[o](l));
|
|
1139
1139
|
} catch (r) {
|
|
1140
1140
|
console.log(J.includes(o), o, r);
|
|
1141
1141
|
}
|
|
1142
1142
|
break;
|
|
1143
1143
|
}
|
|
1144
1144
|
}
|
|
1145
|
-
a < 1 ? (i.push(e.substring(
|
|
1145
|
+
a < 1 ? (i.push(e.substring(s, s + 1)), s += 1) : s += a;
|
|
1146
1146
|
}
|
|
1147
1147
|
return i.join("");
|
|
1148
1148
|
}, rt = {
|
|
1149
|
-
YY: (
|
|
1150
|
-
YYYY: (
|
|
1151
|
-
M: (
|
|
1152
|
-
MM: (
|
|
1153
|
-
MMM: (
|
|
1154
|
-
MMMM: (
|
|
1155
|
-
D: (
|
|
1156
|
-
DD: (
|
|
1157
|
-
d: (
|
|
1158
|
-
dd: (
|
|
1159
|
-
ddd: (
|
|
1160
|
-
dddd: (
|
|
1161
|
-
H: (
|
|
1162
|
-
HH: (
|
|
1163
|
-
h: (
|
|
1164
|
-
hh: (
|
|
1165
|
-
a: (
|
|
1166
|
-
A: (
|
|
1167
|
-
m: (
|
|
1168
|
-
mm: (
|
|
1169
|
-
s: (
|
|
1170
|
-
ss: (
|
|
1171
|
-
SSS: (
|
|
1149
|
+
YY: (l) => String(l.getFullYear()).slice(-2),
|
|
1150
|
+
YYYY: (l) => String(l.getFullYear()),
|
|
1151
|
+
M: (l) => String(l.getMonth() + 1),
|
|
1152
|
+
MM: (l) => w(l.getMonth() + 1, 2),
|
|
1153
|
+
MMM: (l) => g.getMonthsMessage(l.getMonth()),
|
|
1154
|
+
MMMM: (l) => g.getMonthsMessage(l.getMonth(), "full"),
|
|
1155
|
+
D: (l) => String(l.getDate()),
|
|
1156
|
+
DD: (l) => w(l.getDate(), 2),
|
|
1157
|
+
d: (l) => String(l.getDate()),
|
|
1158
|
+
dd: (l) => w(l.getDate(), 2),
|
|
1159
|
+
ddd: (l) => g.getWeeksMessage(l.getDay()),
|
|
1160
|
+
dddd: (l) => g.getWeeksMessage(l.getDay(), "full"),
|
|
1161
|
+
H: (l) => String(l.getHours()),
|
|
1162
|
+
HH: (l) => w(l.getHours(), 2),
|
|
1163
|
+
h: (l) => we(l),
|
|
1164
|
+
hh: (l) => w(we(l), 2),
|
|
1165
|
+
a: (l) => String(l.getFullYear()).slice(-2),
|
|
1166
|
+
A: (l) => ot(l),
|
|
1167
|
+
m: (l) => String(l.getMinutes()),
|
|
1168
|
+
mm: (l) => w(l.getMinutes(), 2),
|
|
1169
|
+
s: (l) => String(l.getSeconds()),
|
|
1170
|
+
ss: (l) => w(l.getSeconds(), 2),
|
|
1171
|
+
SSS: (l) => w(l.getMilliseconds(), 3)
|
|
1172
1172
|
};
|
|
1173
|
-
function we(
|
|
1174
|
-
let e =
|
|
1173
|
+
function we(l) {
|
|
1174
|
+
let e = l.getHours();
|
|
1175
1175
|
return e > 12 ? e -= 12 : e < 1 && (e = 12), e;
|
|
1176
1176
|
}
|
|
1177
|
-
function ot(
|
|
1178
|
-
let
|
|
1179
|
-
return
|
|
1177
|
+
function ot(l, e, t) {
|
|
1178
|
+
let s = l.getHours() < 12 ? "am" : "pm";
|
|
1179
|
+
return s = g.getMessage(s), s = s.toUpperCase(), s;
|
|
1180
1180
|
}
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1181
|
+
const Y = (l, e) => {
|
|
1182
|
+
if (l.length > 1e3)
|
|
1183
1183
|
return null;
|
|
1184
1184
|
e = e || S.date;
|
|
1185
1185
|
const t = {
|
|
@@ -1194,126 +1194,126 @@ const H = (s, e) => {
|
|
|
1194
1194
|
isH: !1,
|
|
1195
1195
|
charIdx: 0
|
|
1196
1196
|
}, i = e.length;
|
|
1197
|
-
let
|
|
1197
|
+
let s = 0;
|
|
1198
1198
|
for (let a = 0; a < i; ) {
|
|
1199
1199
|
let r = Math.min(ee, i - a);
|
|
1200
1200
|
for (; r > 0; r--) {
|
|
1201
1201
|
const d = e.substring(a, a + r);
|
|
1202
1202
|
if (J.includes(d)) {
|
|
1203
|
-
const h = ht[d], u = dt(
|
|
1204
|
-
h[1](t, u),
|
|
1203
|
+
const h = ht[d], u = dt(l.substring(s), h[0]);
|
|
1204
|
+
h[1](t, u), s += u.length;
|
|
1205
1205
|
break;
|
|
1206
1206
|
}
|
|
1207
1207
|
}
|
|
1208
|
-
r < 1 ? (a += 1,
|
|
1208
|
+
r < 1 ? (a += 1, s += 1) : a += r;
|
|
1209
1209
|
}
|
|
1210
1210
|
t.hour != null && !t.isH && (t.isPm && +t.hour != 12 ? t.hour = +t.hour + 12 : !t.isPm && +t.hour == 12 && (t.hour = 0));
|
|
1211
1211
|
let n;
|
|
1212
1212
|
return n = new Date(t.year, t.month, t.day, t.hour, t.minute, t.second, t.millisecond), n;
|
|
1213
|
-
}, dt = (
|
|
1214
|
-
const t = e.exec(
|
|
1213
|
+
}, dt = (l, e) => {
|
|
1214
|
+
const t = e.exec(l);
|
|
1215
1215
|
return t == null ? "" : t[0];
|
|
1216
1216
|
}, E = {
|
|
1217
1217
|
twoOptional: /\d\d?/,
|
|
1218
1218
|
two: /\d\d/,
|
|
1219
1219
|
three: /\d{3}/,
|
|
1220
1220
|
four: /\d{4}/
|
|
1221
|
-
},
|
|
1221
|
+
}, q = /[^\s]+/, ht = {
|
|
1222
1222
|
YY: [
|
|
1223
1223
|
E.two,
|
|
1224
|
-
(
|
|
1224
|
+
(l, e) => (l.year = +(("" + (/* @__PURE__ */ new Date()).getFullYear()).substring(0, 2) + e), l)
|
|
1225
1225
|
],
|
|
1226
1226
|
YYYY: [
|
|
1227
1227
|
E.four,
|
|
1228
|
-
(
|
|
1228
|
+
(l, e) => (l.year = +e, l)
|
|
1229
1229
|
],
|
|
1230
1230
|
M: [
|
|
1231
1231
|
E.twoOptional,
|
|
1232
|
-
(
|
|
1232
|
+
(l, e) => (l.month = +e - 1, l)
|
|
1233
1233
|
],
|
|
1234
1234
|
MM: [
|
|
1235
1235
|
E.two,
|
|
1236
|
-
(
|
|
1236
|
+
(l, e) => (l.month = +e - 1, l)
|
|
1237
1237
|
],
|
|
1238
1238
|
MMM: [
|
|
1239
|
-
|
|
1240
|
-
(
|
|
1239
|
+
q,
|
|
1240
|
+
(l, e) => (l.month = g.getMonthsIdx(e, "abbr"), l)
|
|
1241
1241
|
],
|
|
1242
1242
|
MMMM: [
|
|
1243
|
-
|
|
1244
|
-
(
|
|
1243
|
+
q,
|
|
1244
|
+
(l, e) => (l.month = g.getMonthsIdx(e, "full"), l)
|
|
1245
1245
|
],
|
|
1246
1246
|
D: [
|
|
1247
1247
|
E.twoOptional,
|
|
1248
|
-
(
|
|
1248
|
+
(l, e) => (l.day = +e, l)
|
|
1249
1249
|
],
|
|
1250
1250
|
DD: [
|
|
1251
1251
|
E.two,
|
|
1252
|
-
(
|
|
1252
|
+
(l, e) => (l.day = +e, l)
|
|
1253
1253
|
],
|
|
1254
1254
|
d: [
|
|
1255
1255
|
E.twoOptional,
|
|
1256
|
-
(
|
|
1256
|
+
(l, e) => (l.day = +e, l)
|
|
1257
1257
|
],
|
|
1258
1258
|
dd: [
|
|
1259
1259
|
E.two,
|
|
1260
|
-
(
|
|
1260
|
+
(l, e) => (l.day = +e, l)
|
|
1261
1261
|
],
|
|
1262
1262
|
ddd: [
|
|
1263
|
-
|
|
1264
|
-
(
|
|
1263
|
+
q,
|
|
1264
|
+
(l, e) => l
|
|
1265
1265
|
],
|
|
1266
1266
|
dddd: [
|
|
1267
|
-
|
|
1268
|
-
(
|
|
1267
|
+
q,
|
|
1268
|
+
(l, e) => l
|
|
1269
1269
|
],
|
|
1270
1270
|
H: [
|
|
1271
1271
|
E.twoOptional,
|
|
1272
|
-
(
|
|
1272
|
+
(l, e) => (l.hour = +e, l.isH = !0, l)
|
|
1273
1273
|
],
|
|
1274
1274
|
HH: [
|
|
1275
1275
|
E.two,
|
|
1276
|
-
(
|
|
1276
|
+
(l, e) => (l.hour = +e, l.isH = !0, l)
|
|
1277
1277
|
],
|
|
1278
1278
|
h: [
|
|
1279
1279
|
E.twoOptional,
|
|
1280
|
-
(
|
|
1280
|
+
(l, e) => (l.hour = +e, l)
|
|
1281
1281
|
],
|
|
1282
1282
|
hh: [
|
|
1283
1283
|
E.two,
|
|
1284
|
-
(
|
|
1284
|
+
(l, e) => (l.hour = +e, l)
|
|
1285
1285
|
],
|
|
1286
1286
|
a: [
|
|
1287
|
-
|
|
1288
|
-
(
|
|
1287
|
+
q,
|
|
1288
|
+
(l, e) => (g.getMessage("am") != e.toLowerCase() && (l.isPm = !0), l)
|
|
1289
1289
|
],
|
|
1290
1290
|
A: [
|
|
1291
|
-
|
|
1292
|
-
(
|
|
1291
|
+
q,
|
|
1292
|
+
(l, e) => (g.getMessage("am") != e.toLowerCase() && (l.isPm = !0), l)
|
|
1293
1293
|
],
|
|
1294
1294
|
m: [
|
|
1295
1295
|
E.twoOptional,
|
|
1296
|
-
(
|
|
1296
|
+
(l, e) => (l.minute = +e, l)
|
|
1297
1297
|
],
|
|
1298
1298
|
mm: [
|
|
1299
1299
|
E.two,
|
|
1300
|
-
(
|
|
1300
|
+
(l, e) => (l.minute = +e, l)
|
|
1301
1301
|
],
|
|
1302
1302
|
s: [
|
|
1303
1303
|
E.twoOptional,
|
|
1304
|
-
(
|
|
1304
|
+
(l, e) => (l.second = +e, l)
|
|
1305
1305
|
],
|
|
1306
1306
|
ss: [
|
|
1307
1307
|
E.two,
|
|
1308
|
-
(
|
|
1308
|
+
(l, e) => (l.second = +e, l)
|
|
1309
1309
|
],
|
|
1310
1310
|
SSS: [
|
|
1311
1311
|
E.three,
|
|
1312
|
-
(
|
|
1312
|
+
(l, e) => (l.millisecond = +e, l)
|
|
1313
1313
|
]
|
|
1314
1314
|
};
|
|
1315
|
-
function ut(
|
|
1316
|
-
let t =
|
|
1315
|
+
function ut(l, e) {
|
|
1316
|
+
let t = l;
|
|
1317
1317
|
for (; t; ) {
|
|
1318
1318
|
if (t == e)
|
|
1319
1319
|
return !0;
|
|
@@ -1321,7 +1321,7 @@ function ut(s, e) {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
return !1;
|
|
1323
1323
|
}
|
|
1324
|
-
class
|
|
1324
|
+
class N {
|
|
1325
1325
|
constructor(e) {
|
|
1326
1326
|
this.date = e;
|
|
1327
1327
|
}
|
|
@@ -1383,10 +1383,10 @@ class O {
|
|
|
1383
1383
|
return this.date.getTime();
|
|
1384
1384
|
}
|
|
1385
1385
|
format(e) {
|
|
1386
|
-
return
|
|
1386
|
+
return qe(this.date, e);
|
|
1387
1387
|
}
|
|
1388
1388
|
clone() {
|
|
1389
|
-
return new
|
|
1389
|
+
return new N(new Date(this.date.valueOf()));
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
let le = {
|
|
@@ -1404,20 +1404,20 @@ let le = {
|
|
|
1404
1404
|
zIndex: 1e3,
|
|
1405
1405
|
minDate: "",
|
|
1406
1406
|
maxDate: "",
|
|
1407
|
-
beforeDrawDate: (
|
|
1407
|
+
beforeDrawDate: (l) => ({
|
|
1408
1408
|
check: !1,
|
|
1409
1409
|
style: "",
|
|
1410
1410
|
tooltip: ""
|
|
1411
1411
|
})
|
|
1412
1412
|
};
|
|
1413
1413
|
function ct() {
|
|
1414
|
-
var
|
|
1415
|
-
return document.getElementById("hiddenDaraDatetimeElement") == null && ((
|
|
1414
|
+
var l;
|
|
1415
|
+
return document.getElementById("hiddenDaraDatetimeElement") == null && ((l = document.querySelector("body")) == null || l.insertAdjacentHTML("beforeend", '<div id="hiddenDaraDatetimeElement" class="daracl-datetime-hidden"></div>')), document.getElementById("hiddenDaraDatetimeElement");
|
|
1416
1416
|
}
|
|
1417
1417
|
let ne = 0;
|
|
1418
|
-
const ie = class
|
|
1418
|
+
const ie = class Ne {
|
|
1419
1419
|
constructor(e, t, i) {
|
|
1420
|
-
var
|
|
1420
|
+
var s;
|
|
1421
1421
|
this.isInput = !1, this.isVisible = !1, this.minYear = -1, this.maxYear = -1, this.minMonth = -1, this.maxMonth = -1, this.dayOrder = [0, 1, 2, 3, 4, 5, 6], this._documentClickEvent = (o) => {
|
|
1422
1422
|
this.isVisible && o.target != this.targetElement && !ut(o.target, this.datetimeElement) && this.hide();
|
|
1423
1423
|
}, this.options = Object.assign({}, le, t), ne += 1;
|
|
@@ -1426,12 +1426,12 @@ const ie = class Oe {
|
|
|
1426
1426
|
throw new Error(`${e} datetimepicker element not found`);
|
|
1427
1427
|
this._viewMode = Object.keys(m).includes(this.options.mode) ? this.options.mode : m.date, this.initMode = this._viewMode, g.set(i), this.initMode == m.year ? this.dateFormat = this.options.format || S.year : this.initMode == m.month ? this.dateFormat = this.options.format || S.month : this.initMode == m.time ? this.dateFormat = this.options.format || S.time : this.initMode == m.datetime ? this.dateFormat = this.options.format || S.datetime : this.dateFormat = this.options.format || S.date;
|
|
1428
1428
|
let a;
|
|
1429
|
-
if (this.options.initialDate ? typeof this.options.initialDate == "string" ? a = new
|
|
1429
|
+
if (this.options.initialDate ? typeof this.options.initialDate == "string" ? a = new N(Y(this.options.initialDate, this.dateFormat) || /* @__PURE__ */ new Date()) : a = new N(this.options.initialDate) : (a = new N(/* @__PURE__ */ new Date()), this.options.initialDate = a.format(this.dateFormat)), this.setWeekDays(), this.todayDate = a.format(S.date), this.currentDate = a, this.targetElement = n, this.minDate = this._minDate(), this.maxDate = this._maxDate(), this.options.inline)
|
|
1430
1430
|
this.datetimeElement = n, this.datetimeElement.className = `daracl-datetime-wrapper ddtp-${ne} embed`;
|
|
1431
1431
|
else {
|
|
1432
1432
|
this.isInput = !0, this.targetElement.setAttribute("value", a.format(this.dateFormat));
|
|
1433
1433
|
const o = document.createElement("div");
|
|
1434
|
-
o.className = `daracl-datetime-wrapper ddtp-${ne} layer`, o.setAttribute("style", `z-index:${this.options.zIndex};`), (
|
|
1434
|
+
o.className = `daracl-datetime-wrapper ddtp-${ne} layer`, o.setAttribute("style", `z-index:${this.options.zIndex};`), (s = ct()) == null || s.appendChild(o), this.datetimeElement = o, this.initTargetEvent();
|
|
1435
1435
|
}
|
|
1436
1436
|
this.createDatetimeTemplate(), this.isTimeMode() ? (this.hourInputEle = this.datetimeElement.querySelector(".ddtp-hour"), this.minuteInputEle = this.datetimeElement.querySelector(".ddtp-minute")) : (this.hourInputEle = {}, this.minuteInputEle = {}), this.changeViewMode(this._viewMode), this.initHeaderEvent(), this.initDateEvent(), this.initTimeEvent();
|
|
1437
1437
|
}
|
|
@@ -1446,7 +1446,7 @@ const ie = class Oe {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
1448
1448
|
static create(e, t, i) {
|
|
1449
|
-
return new
|
|
1449
|
+
return new Ne(e, t, i);
|
|
1450
1450
|
}
|
|
1451
1451
|
/**
|
|
1452
1452
|
* default date format setting
|
|
@@ -1471,7 +1471,7 @@ const ie = class Oe {
|
|
|
1471
1471
|
let e = this.options.minDate;
|
|
1472
1472
|
if (e != "") {
|
|
1473
1473
|
if (typeof e == "string") {
|
|
1474
|
-
const t =
|
|
1474
|
+
const t = Y(e, this.dateFormat);
|
|
1475
1475
|
if (!t)
|
|
1476
1476
|
return -1;
|
|
1477
1477
|
e = t;
|
|
@@ -1484,7 +1484,7 @@ const ie = class Oe {
|
|
|
1484
1484
|
let e = this.options.maxDate;
|
|
1485
1485
|
if (e != "") {
|
|
1486
1486
|
if (typeof e == "string") {
|
|
1487
|
-
const t =
|
|
1487
|
+
const t = Y(e, this.dateFormat);
|
|
1488
1488
|
if (!t)
|
|
1489
1489
|
return -1;
|
|
1490
1490
|
e = t;
|
|
@@ -1513,7 +1513,7 @@ const ie = class Oe {
|
|
|
1513
1513
|
* @public
|
|
1514
1514
|
*/
|
|
1515
1515
|
initHeaderEvent() {
|
|
1516
|
-
var e, t, i,
|
|
1516
|
+
var e, t, i, s;
|
|
1517
1517
|
const n = this.options.isRTL;
|
|
1518
1518
|
(e = this.datetimeElement.querySelector(".ddtp-move-btn.prev")) == null || e.addEventListener("click", (a) => {
|
|
1519
1519
|
this.moveDate(n ? "next" : "prev", a);
|
|
@@ -1521,7 +1521,7 @@ const ie = class Oe {
|
|
|
1521
1521
|
this.moveDate(n ? "prev" : "next", a);
|
|
1522
1522
|
}), (i = this.datetimeElement.querySelector(".ddtp-header-year")) == null || i.addEventListener("click", (a) => {
|
|
1523
1523
|
this.viewMode = m.year;
|
|
1524
|
-
}), (
|
|
1524
|
+
}), (s = this.datetimeElement.querySelector(".ddtp-header-month")) == null || s.addEventListener("click", (a) => {
|
|
1525
1525
|
this.viewMode = m.month;
|
|
1526
1526
|
});
|
|
1527
1527
|
}
|
|
@@ -1531,17 +1531,17 @@ const ie = class Oe {
|
|
|
1531
1531
|
initDateEvent() {
|
|
1532
1532
|
var e, t;
|
|
1533
1533
|
(e = this.datetimeElement.querySelector(".ddtp-day-body")) == null || e.addEventListener("click", (i) => {
|
|
1534
|
-
var
|
|
1534
|
+
var s;
|
|
1535
1535
|
const n = i.target;
|
|
1536
1536
|
if (n.classList.contains("ddtp-day") || n.closest(".ddtp-day")) {
|
|
1537
1537
|
const o = (n.getAttribute("data-day") || "1").split(",");
|
|
1538
1538
|
if (this.currentDate.setMonth(+o[0] - 1), this.currentDate.setDate(+o[1]), this.isDayDisabled(this.currentDate))
|
|
1539
1539
|
return;
|
|
1540
|
-
(
|
|
1540
|
+
(s = this.datetimeElement.querySelector(".select")) == null || s.classList.remove("select"), n.classList.add("select"), this.isTimeMode() && (this.currentDate.setHour(+this.hourInputEle.value), this.currentDate.setMinutes(+this.minuteInputEle.value)), this.dateChangeEvent(i);
|
|
1541
1541
|
}
|
|
1542
1542
|
}), (t = this.datetimeElement.querySelector(".ddtp-today")) == null || t.addEventListener("click", (i) => {
|
|
1543
|
-
const
|
|
1544
|
-
this.currentDate.setYear(
|
|
1543
|
+
const s = new N(Y(this.todayDate, S.date) || /* @__PURE__ */ new Date());
|
|
1544
|
+
this.currentDate.setYear(s.getYear()), this.currentDate.setMonth(s.getMonth() - 1), this.currentDate.setDate(s.getDate()), this.changeViewMode(this.initMode);
|
|
1545
1545
|
});
|
|
1546
1546
|
}
|
|
1547
1547
|
isTimeMode() {
|
|
@@ -1559,14 +1559,14 @@ const ie = class Oe {
|
|
|
1559
1559
|
var e;
|
|
1560
1560
|
if (!this.isTimeMode()) return;
|
|
1561
1561
|
let t = this.currentDate.format("HH");
|
|
1562
|
-
const i = this.datetimeElement,
|
|
1563
|
-
|
|
1562
|
+
const i = this.datetimeElement, s = i.querySelector(".ddtp-hour"), n = i.querySelector(".ddtp-hour-range");
|
|
1563
|
+
s.value = t, n.value = t, s.addEventListener("input", (d) => {
|
|
1564
1564
|
const h = d.target;
|
|
1565
1565
|
let u = this.getTimeNumberValue(h.value), c = P(u, 2, "0");
|
|
1566
|
-
parseInt(c, 10) > 23 && (c = "23"),
|
|
1566
|
+
parseInt(c, 10) > 23 && (c = "23"), s.value = c, n.value = c;
|
|
1567
1567
|
}), n.addEventListener("input", (d) => {
|
|
1568
1568
|
const h = d.target;
|
|
1569
|
-
|
|
1569
|
+
s.value = P(h.value, 2, "0");
|
|
1570
1570
|
});
|
|
1571
1571
|
let a = this.currentDate.format("mm");
|
|
1572
1572
|
const o = i.querySelector(".ddtp-minute"), r = i.querySelector(".ddtp-minute-range");
|
|
@@ -1578,7 +1578,7 @@ const ie = class Oe {
|
|
|
1578
1578
|
const h = d.target;
|
|
1579
1579
|
o.value = P(h.value, 2, "0");
|
|
1580
1580
|
}), (e = i.querySelector(".time-select")) == null || e.addEventListener("click", (d) => {
|
|
1581
|
-
this.currentDate.setHour(+
|
|
1581
|
+
this.currentDate.setHour(+s.value), this.currentDate.setMinutes(+o.value), this.dateChangeEvent(d);
|
|
1582
1582
|
});
|
|
1583
1583
|
}
|
|
1584
1584
|
/**
|
|
@@ -1624,8 +1624,8 @@ const ie = class Oe {
|
|
|
1624
1624
|
this.isVisible = !0;
|
|
1625
1625
|
const e = mt();
|
|
1626
1626
|
this.datetimeElement.classList.remove("hide"), this.datetimeElement.classList.add("show");
|
|
1627
|
-
const t = this.targetElement.getBoundingClientRect(), i = window.scrollY || document.documentElement.scrollTop,
|
|
1628
|
-
let o = t.left +
|
|
1627
|
+
const t = this.targetElement.getBoundingClientRect(), i = window.scrollY || document.documentElement.scrollTop, s = window.scrollX || document.documentElement.scrollLeft, n = this.datetimeElement.offsetHeight, a = this.targetElement.offsetHeight + 2;
|
|
1628
|
+
let o = t.left + s, r = 0;
|
|
1629
1629
|
this.options.isPositionFixed ? (r = t.top + a, o = t.left) : t.top + a + n > e.clientHeight && t.top >= n ? r = i + t.top - n - 2 : r = i + t.top + a, this.datetimeElement.setAttribute("style", `${this.options.isPositionFixed ? "position:fixed;" : ""}top:${r}px;left:${o}px;z-index:${this.options.zIndex}`), document.addEventListener("click", this._documentClickEvent);
|
|
1630
1630
|
}
|
|
1631
1631
|
/**
|
|
@@ -1647,7 +1647,7 @@ const ie = class Oe {
|
|
|
1647
1647
|
*/
|
|
1648
1648
|
afterChangeDatepicker() {
|
|
1649
1649
|
const e = this.currentDate.format(this.dateFormat);
|
|
1650
|
-
this.options.afterChangeDatepicker &&
|
|
1650
|
+
this.options.afterChangeDatepicker && H(this.options.afterChangeDatepicker) && this.options.afterChangeDatepicker(e, this.viewMode);
|
|
1651
1651
|
}
|
|
1652
1652
|
/**
|
|
1653
1653
|
* 날짜 변경 전 이벤트.
|
|
@@ -1655,7 +1655,7 @@ const ie = class Oe {
|
|
|
1655
1655
|
*/
|
|
1656
1656
|
beforeChangeDatepicker() {
|
|
1657
1657
|
const e = this.currentDate.format(this.dateFormat);
|
|
1658
|
-
if (this.options.beforeChangeDatepicker &&
|
|
1658
|
+
if (this.options.beforeChangeDatepicker && H(this.options.beforeChangeDatepicker)) {
|
|
1659
1659
|
if (this.options.beforeChangeDatepicker(e, (i) => {
|
|
1660
1660
|
i !== !1 && this.refresh(!1);
|
|
1661
1661
|
}) === !1)
|
|
@@ -1758,11 +1758,11 @@ const ie = class Oe {
|
|
|
1758
1758
|
this.beforeChangeDatepicker();
|
|
1759
1759
|
return;
|
|
1760
1760
|
}
|
|
1761
|
-
const
|
|
1762
|
-
this.datetimeElement.querySelector(".ddtp-header-year").textContent = `${
|
|
1763
|
-
const n =
|
|
1761
|
+
const s = +i - 8;
|
|
1762
|
+
this.datetimeElement.querySelector(".ddtp-header-year").textContent = `${s} ~ ${s + 15}`;
|
|
1763
|
+
const n = H(this.options.beforeDrawDate), a = n ? this.options.beforeDrawDate : !1, o = [];
|
|
1764
1764
|
for (let r = 0; r < 16; r++) {
|
|
1765
|
-
const d =
|
|
1765
|
+
const d = s + r;
|
|
1766
1766
|
let u = this.isYearDisabled(d) ? " disabled" : "", c = "";
|
|
1767
1767
|
if (n && a) {
|
|
1768
1768
|
const p = a({ mode: this._viewMode, date: d });
|
|
@@ -1802,21 +1802,21 @@ const ie = class Oe {
|
|
|
1802
1802
|
}
|
|
1803
1803
|
const i = this.currentDate.format("YYYY");
|
|
1804
1804
|
this.datetimeElement.querySelector(".ddtp-header-year").textContent = `${i}`;
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1805
|
+
const s = this.datetimeElement.querySelectorAll(".ddtp-months > .ddtp-month");
|
|
1806
|
+
if (s.length > 0) {
|
|
1807
1807
|
if (this.isYearDisabled(+i)) {
|
|
1808
|
-
|
|
1808
|
+
s.forEach((r) => {
|
|
1809
1809
|
r.classList.contains("disabled") || r.classList.add("disabled");
|
|
1810
1810
|
});
|
|
1811
1811
|
return;
|
|
1812
1812
|
}
|
|
1813
|
-
|
|
1813
|
+
s.forEach((r, d) => {
|
|
1814
1814
|
this.isMonthDisabled(+i, d) ? r.classList.contains("disabled") || r.classList.add("disabled") : r.classList.remove("disabled");
|
|
1815
1815
|
}), this.initMode == m.month && this.afterChangeDatepicker();
|
|
1816
1816
|
return;
|
|
1817
1817
|
}
|
|
1818
1818
|
this.datetimeElement.querySelector(".ddtp-header-month").textContent = this.currentDate.format("MMMM");
|
|
1819
|
-
const n =
|
|
1819
|
+
const n = H(this.options.beforeDrawDate), a = n ? this.options.beforeDrawDate : !1, o = [];
|
|
1820
1820
|
for (let r = 0; r < 12; r++) {
|
|
1821
1821
|
let h = this.isMonthDisabled(+i, r) ? " disabled" : "", u = "";
|
|
1822
1822
|
if (n && a) {
|
|
@@ -1854,9 +1854,9 @@ const ie = class Oe {
|
|
|
1854
1854
|
let t = this.currentDate.clone();
|
|
1855
1855
|
const i = t.getMonth();
|
|
1856
1856
|
t.setDate(1), this.datetimeElement.querySelector(".ddtp-header-year").textContent = t.format("YYYY"), this.datetimeElement.querySelector(".ddtp-header-month").textContent = t.format("MMMM");
|
|
1857
|
-
let
|
|
1858
|
-
|
|
1859
|
-
const n =
|
|
1857
|
+
let s = t.getDay();
|
|
1858
|
+
s = s - this.dayOrder[0], s >= 0 ? t.addDate(-s) : t.addDate(-(7 + s));
|
|
1859
|
+
const n = H(this.options.beforeDrawDate), a = n ? this.options.beforeDrawDate : !1, o = [];
|
|
1860
1860
|
for (let r = 0; r < 42; r++) {
|
|
1861
1861
|
let d;
|
|
1862
1862
|
r == 0 ? d = t : d = t.clone().addDate(r);
|
|
@@ -1891,8 +1891,8 @@ const ie = class Oe {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
};
|
|
1893
1893
|
ie.VERSION = "0.0.13";
|
|
1894
|
-
ie.format =
|
|
1895
|
-
ie.parser =
|
|
1894
|
+
ie.format = qe;
|
|
1895
|
+
ie.parser = Y;
|
|
1896
1896
|
let ft = ie;
|
|
1897
1897
|
function mt() {
|
|
1898
1898
|
return {
|
|
@@ -1962,11 +1962,11 @@ class pt extends f {
|
|
|
1962
1962
|
this.setActive(e.getAttribute("data-tab-id") ?? "");
|
|
1963
1963
|
}
|
|
1964
1964
|
setActive(e) {
|
|
1965
|
-
var
|
|
1965
|
+
var s, n;
|
|
1966
1966
|
const t = this.tabContainerElement.querySelector(`[data-tab-id="${e}"]`);
|
|
1967
1967
|
if (!t) return;
|
|
1968
1968
|
if (!t.classList.contains("active")) {
|
|
1969
|
-
for (let a of ((
|
|
1969
|
+
for (let a of ((s = t == null ? void 0 : t.parentElement) == null ? void 0 : s.children) ?? [])
|
|
1970
1970
|
a.classList.remove("active");
|
|
1971
1971
|
t.classList.add("active");
|
|
1972
1972
|
}
|
|
@@ -1993,9 +1993,9 @@ class pt extends f {
|
|
|
1993
1993
|
*/
|
|
1994
1994
|
createField() {
|
|
1995
1995
|
var a, o;
|
|
1996
|
-
const e = this.field, t = this.daraForm.formTemplate, i = this.daraForm.getOptions(),
|
|
1996
|
+
const e = this.field, t = this.daraForm.formTemplate, i = this.daraForm.getOptions(), s = this.rowElement.querySelector(".df-field-container");
|
|
1997
1997
|
let n = A(i, e);
|
|
1998
|
-
if (
|
|
1998
|
+
if (s.innerHTML = `
|
|
1999
1999
|
<div class="df-field ">
|
|
2000
2000
|
<div class="df-tab-header ${n.tabAlignClass}"></div>
|
|
2001
2001
|
</div>
|
|
@@ -2010,7 +2010,7 @@ class pt extends f {
|
|
|
2010
2010
|
<div class="df-tab-group"></div>
|
|
2011
2011
|
</div>`;
|
|
2012
2012
|
const V = z(p), T = z(x);
|
|
2013
|
-
if (r = !1, V && ((a =
|
|
2013
|
+
if (r = !1, V && ((a = s.querySelector(".df-tab-header")) == null || a.appendChild(V)), T && ((o = s.querySelector(".df-tab-body")) == null || o.appendChild(T), u.children)) {
|
|
2014
2014
|
let W = {
|
|
2015
2015
|
style: {
|
|
2016
2016
|
width: d.style.width ?? "100%",
|
|
@@ -2026,7 +2026,7 @@ class pt extends f {
|
|
|
2026
2026
|
u.$tabForm = new te(document.createElement("div"), W), u.$instance = new u.$renderType(u, T == null ? void 0 : T.querySelector(".df-tab-group"), u.$tabForm), u.$tabForm.formTemplate.childTemplate(u, h);
|
|
2027
2027
|
}
|
|
2028
2028
|
}
|
|
2029
|
-
this.tabContainerElement =
|
|
2029
|
+
this.tabContainerElement = s;
|
|
2030
2030
|
}
|
|
2031
2031
|
}
|
|
2032
2032
|
getValue() {
|
|
@@ -2034,10 +2034,10 @@ class pt extends f {
|
|
|
2034
2034
|
if (this.customFunction.getValue)
|
|
2035
2035
|
return this.customFunction.getValue.call(this, this.field, this.rowElement);
|
|
2036
2036
|
let e = {}, t = this.getForm().getOptions().useTypeValue;
|
|
2037
|
-
for (const
|
|
2038
|
-
const n = (i =
|
|
2037
|
+
for (const s of this.field.children) {
|
|
2038
|
+
const n = (i = s.$tabForm) == null ? void 0 : i.getValue(!1);
|
|
2039
2039
|
if (t)
|
|
2040
|
-
e[
|
|
2040
|
+
e[s.$validName] = n;
|
|
2041
2041
|
else
|
|
2042
2042
|
for (let [a, o] of Object.entries(n))
|
|
2043
2043
|
e[a] = o;
|
|
@@ -2047,8 +2047,8 @@ class pt extends f {
|
|
|
2047
2047
|
setValue(e) {
|
|
2048
2048
|
var t;
|
|
2049
2049
|
for (const i of this.field.children) {
|
|
2050
|
-
let
|
|
2051
|
-
|
|
2050
|
+
let s = e[i.$validName];
|
|
2051
|
+
s && ((t = i.$tabForm) == null || t.setValue(s));
|
|
2052
2052
|
}
|
|
2053
2053
|
}
|
|
2054
2054
|
reset() {
|
|
@@ -2065,9 +2065,9 @@ class pt extends f {
|
|
|
2065
2065
|
}
|
|
2066
2066
|
const e = this.field;
|
|
2067
2067
|
for (const i of e.children) {
|
|
2068
|
-
const
|
|
2069
|
-
if (
|
|
2070
|
-
const n =
|
|
2068
|
+
const s = (t = i.$tabForm) == null ? void 0 : t.validForm();
|
|
2069
|
+
if (s && s.length > 0) {
|
|
2070
|
+
const n = s[0];
|
|
2071
2071
|
if (n.message)
|
|
2072
2072
|
return n.message = "[" + this.field.label + "] " + n.message, n;
|
|
2073
2073
|
}
|
|
@@ -2081,7 +2081,7 @@ let U = 0;
|
|
|
2081
2081
|
class gt extends f {
|
|
2082
2082
|
constructor(e, t, i) {
|
|
2083
2083
|
super(i, e, t), this.allAddRowInfo = {}, e.renderer ? this.customFunction = e.renderer : this.customFunction = {};
|
|
2084
|
-
const
|
|
2084
|
+
const s = {
|
|
2085
2085
|
style: {
|
|
2086
2086
|
width: "100%",
|
|
2087
2087
|
labelWidth: 3,
|
|
@@ -2092,7 +2092,7 @@ class gt extends f {
|
|
|
2092
2092
|
notValidMessage: "This form is not valid.",
|
|
2093
2093
|
fields: []
|
|
2094
2094
|
};
|
|
2095
|
-
this.gridForm = new te(document.createElement("div"),
|
|
2095
|
+
this.gridForm = new te(document.createElement("div"), s), this.mounted(), this.setDefaultOption(), this.setDefaultInfo();
|
|
2096
2096
|
}
|
|
2097
2097
|
mounted() {
|
|
2098
2098
|
var e;
|
|
@@ -2109,18 +2109,18 @@ class gt extends f {
|
|
|
2109
2109
|
createField() {
|
|
2110
2110
|
var a, o, r, d;
|
|
2111
2111
|
const e = this.field, t = this.rowElement.querySelector(".df-field-container");
|
|
2112
|
-
let i = [],
|
|
2112
|
+
let i = [], s = [], n = [];
|
|
2113
2113
|
if (n.push(""), e.children) {
|
|
2114
|
-
|
|
2114
|
+
s.push("<colgroup>"), i.push("<tr>"), s.push('<col style="width:38px">'), i.push("<th>"), ((a = e.rendererOptions) == null ? void 0 : a.disableAddButton) !== !0 && i.push('<button type="button" class="df-btn df-grid-add-row-btn" title="Add"><i class="df-icon df-add-icon"></i></button>'), i.push("</th>");
|
|
2115
2115
|
for (const h of e.children)
|
|
2116
|
-
|
|
2117
|
-
|
|
2116
|
+
s.push(`<col style="width:${((o = h.style) == null ? void 0 : o.width) ?? "*"}">`), i.push(`<th class="df-grid-header">${h.label}</th>`);
|
|
2117
|
+
s.push("</colgroup>"), i.push("</tr>");
|
|
2118
2118
|
}
|
|
2119
2119
|
t.innerHTML = `
|
|
2120
2120
|
<div class="df-grid-field">
|
|
2121
2121
|
${n.join("")}
|
|
2122
2122
|
<div class="df-grid-container ${((r = e.style) == null ? void 0 : r.position) ?? ""}" style="height:${((d = e.rendererOptions) == null ? void 0 : d.height) ?? "auto"};">
|
|
2123
|
-
<table class="df-grid">${
|
|
2123
|
+
<table class="df-grid">${s.join("")}<thead>${i.join("")}</thead><tbody></tbody></table>
|
|
2124
2124
|
</div>
|
|
2125
2125
|
</div>
|
|
2126
2126
|
`;
|
|
@@ -2131,13 +2131,13 @@ class gt extends f {
|
|
|
2131
2131
|
addRow(e) {
|
|
2132
2132
|
var r, d, h;
|
|
2133
2133
|
let t = [];
|
|
2134
|
-
const i = this.daraForm.getOptions(),
|
|
2134
|
+
const i = this.daraForm.getOptions(), s = this.gridForm.formTemplate, n = this.field.$xssName;
|
|
2135
2135
|
++U;
|
|
2136
2136
|
let a = [];
|
|
2137
2137
|
t.push('<tr class="df-grid-row">'), t.push("<td>"), ((r = this.field.rendererOptions) == null ? void 0 : r.disableRemoveButton) !== !0 && t.push(`<button type="button" data-row-idx="${U}" class="df-btn df-grid-row-remove"><i class="df-icon df-remove-icon"></i></button>`), t.push("</td>");
|
|
2138
2138
|
for (const u of this.field.children) {
|
|
2139
2139
|
let c = A(i, u, null, !0), p = he({}, u);
|
|
2140
|
-
a.push(p), p.$orgin = u, p.name = p.name + "_" + U, p.$xssName = n + "_" + Te(p),
|
|
2140
|
+
a.push(p), p.$orgin = u, p.name = p.name + "_" + U, p.$xssName = n + "_" + Te(p), s.addRowFieldInfo(p), t.push(`<td id="${p.$xssName}"><div class="df-field-container ${p.required ? "required" : ""} " style="${c.valueStyle}"></div></td>`);
|
|
2141
2141
|
}
|
|
2142
2142
|
t.push("</tr>"), this.allAddRowInfo[U] = a;
|
|
2143
2143
|
const o = z(t.join(""));
|
|
@@ -2153,12 +2153,11 @@ class gt extends f {
|
|
|
2153
2153
|
* @param evt event
|
|
2154
2154
|
*/
|
|
2155
2155
|
removeRow(e) {
|
|
2156
|
-
var
|
|
2156
|
+
var s;
|
|
2157
2157
|
const i = e.target.closest("tr");
|
|
2158
2158
|
if (i) {
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
this.removeFieldInfo(a), i.remove();
|
|
2159
|
+
let n = ((s = e.currentTarget) == null ? void 0 : s.getAttribute("data-row-idx")) || "-1";
|
|
2160
|
+
this.removeFieldInfo(n), i.remove();
|
|
2162
2161
|
}
|
|
2163
2162
|
}
|
|
2164
2163
|
/**
|
|
@@ -2167,7 +2166,7 @@ class gt extends f {
|
|
|
2167
2166
|
*/
|
|
2168
2167
|
removeFieldInfo(e) {
|
|
2169
2168
|
let t = [];
|
|
2170
|
-
if (C(e)) {
|
|
2169
|
+
if (console.log("rowIdx : ", e), C(e)) {
|
|
2171
2170
|
for (let i in this.allAddRowInfo)
|
|
2172
2171
|
t = t.concat(this.allAddRowInfo[i]);
|
|
2173
2172
|
this.allAddRowInfo = {};
|
|
@@ -2187,8 +2186,8 @@ class gt extends f {
|
|
|
2187
2186
|
return this.customFunction.getValue.call(this, this.field, this.rowElement);
|
|
2188
2187
|
let e = [];
|
|
2189
2188
|
const t = this.field.children, i = t.length;
|
|
2190
|
-
for (let
|
|
2191
|
-
const n = this.allAddRowInfo[
|
|
2189
|
+
for (let s in this.allAddRowInfo) {
|
|
2190
|
+
const n = this.allAddRowInfo[s];
|
|
2192
2191
|
let a = {};
|
|
2193
2192
|
for (let o = 0; o < i; o++) {
|
|
2194
2193
|
let r = t[o];
|
|
@@ -2347,22 +2346,22 @@ class yt {
|
|
|
2347
2346
|
* @returns {string[]}
|
|
2348
2347
|
*/
|
|
2349
2348
|
validMessage(e, t) {
|
|
2350
|
-
let i = "",
|
|
2351
|
-
t.regexp && (i = this.lang.regexp[t.regexp],
|
|
2352
|
-
o === v.REQUIRED && (i = Fe(this.lang.required, e),
|
|
2349
|
+
let i = "", s = [];
|
|
2350
|
+
t.regexp && (i = this.lang.regexp[t.regexp], s.push(i)), (t.constraint ?? []).forEach((o) => {
|
|
2351
|
+
o === v.REQUIRED && (i = Fe(this.lang.required, e), s.push(i)), e.renderType == "number" || e.renderType == "range" ? (i = this.lang.number[o], s.push(i)) : (i = this.lang.string[o], s.push(i));
|
|
2353
2352
|
});
|
|
2354
2353
|
const n = [], a = Object.assign({}, { name: e.name, label: e.label }, e.rule);
|
|
2355
|
-
return
|
|
2354
|
+
return s.forEach((o) => {
|
|
2356
2355
|
o && n.push(Fe(o, a));
|
|
2357
2356
|
}), t.validator && n.push(t.validator.message), n;
|
|
2358
2357
|
}
|
|
2359
2358
|
}
|
|
2360
|
-
function Fe(
|
|
2361
|
-
return
|
|
2359
|
+
function Fe(l, e) {
|
|
2360
|
+
return l.replace(/\{{1,1}([A-Za-z0-9_.]*)\}{1,1}/g, (t, i) => typeof e[i] < "u" ? e[i] : t);
|
|
2362
2361
|
}
|
|
2363
|
-
const I = new yt(), Et = (
|
|
2362
|
+
const I = new yt(), Et = (l) => {
|
|
2364
2363
|
let e;
|
|
2365
|
-
return
|
|
2364
|
+
return l.renderType && (e = K[l.renderType]), e && (e.isDataRender() === !1 || !y(l.name)) ? e : y(l.name) ? l.children ? K.group : K.hidden : K.text;
|
|
2366
2365
|
};
|
|
2367
2366
|
class $t {
|
|
2368
2367
|
constructor(e, t) {
|
|
@@ -2375,7 +2374,7 @@ class $t {
|
|
|
2375
2374
|
* @param {FormField} field 폼필드 정보
|
|
2376
2375
|
*/
|
|
2377
2376
|
addField(e) {
|
|
2378
|
-
|
|
2377
|
+
Ye(e), this.fieldIdx += 1, e.$key = `${this.fieldPrefix}_${this.fieldIdx}`, e.$validName = e.name ?? e.label, this.keyNameMap[e.$validName] = e.$key, this.allFieldInfo[e.$key] = e, e.$renderType = Et(e), e.conditional && this.conditionFields.push(e.$key);
|
|
2379
2378
|
}
|
|
2380
2379
|
/**
|
|
2381
2380
|
* 필드명으로 필드 정부 구하기
|
|
@@ -2446,11 +2445,11 @@ class $t {
|
|
|
2446
2445
|
getAllFieldValue(e, t) {
|
|
2447
2446
|
const i = this.form.getOptions().useTypeValue;
|
|
2448
2447
|
if (t !== !0) {
|
|
2449
|
-
for (let [
|
|
2448
|
+
for (let [s, n] of Object.entries(this.allFieldInfo))
|
|
2450
2449
|
e = De(e, n, i);
|
|
2451
2450
|
return e;
|
|
2452
2451
|
}
|
|
2453
|
-
return new Promise((
|
|
2452
|
+
return new Promise((s, n) => {
|
|
2454
2453
|
for (let [a, o] of Object.entries(this.allFieldInfo)) {
|
|
2455
2454
|
if (!o.$instance.isEnableView())
|
|
2456
2455
|
continue;
|
|
@@ -2461,19 +2460,19 @@ class $t {
|
|
|
2461
2460
|
}
|
|
2462
2461
|
e = De(e, o, i);
|
|
2463
2462
|
}
|
|
2464
|
-
|
|
2463
|
+
s(e);
|
|
2465
2464
|
});
|
|
2466
2465
|
}
|
|
2467
2466
|
getFormDataValue(e, t) {
|
|
2468
2467
|
if (t !== !0) {
|
|
2469
2468
|
let i = new FormData();
|
|
2470
|
-
for (let [
|
|
2471
|
-
i.set(
|
|
2472
|
-
for (let [
|
|
2469
|
+
for (let [s, n] of Object.entries(e))
|
|
2470
|
+
i.set(s, n);
|
|
2471
|
+
for (let [s, n] of Object.entries(this.allFieldInfo))
|
|
2473
2472
|
xe(i, n, n.$instance.getValue());
|
|
2474
2473
|
return i;
|
|
2475
2474
|
}
|
|
2476
|
-
return new Promise((i,
|
|
2475
|
+
return new Promise((i, s) => {
|
|
2477
2476
|
let n = new FormData();
|
|
2478
2477
|
for (let [a, o] of Object.entries(e))
|
|
2479
2478
|
n.set(a, o);
|
|
@@ -2482,7 +2481,7 @@ class $t {
|
|
|
2482
2481
|
continue;
|
|
2483
2482
|
let r = this.getFieldValidation(o, !0);
|
|
2484
2483
|
if (r !== !0) {
|
|
2485
|
-
|
|
2484
|
+
s(new Error(r.message, { cause: r }));
|
|
2486
2485
|
return;
|
|
2487
2486
|
}
|
|
2488
2487
|
xe(n, o, o.$instance.getValue());
|
|
@@ -2544,46 +2543,46 @@ class $t {
|
|
|
2544
2543
|
if (!this.isConditionFieldCheck(e))
|
|
2545
2544
|
return !0;
|
|
2546
2545
|
const i = e.$instance;
|
|
2547
|
-
let
|
|
2548
|
-
return
|
|
2546
|
+
let s = i.valid();
|
|
2547
|
+
return s === !0 ? !0 : (t && i.focus(), s = s, y(s.message) && (s.message = I.validMessage(e, s)[0]), s);
|
|
2549
2548
|
}
|
|
2550
2549
|
}
|
|
2551
|
-
function De(
|
|
2550
|
+
function De(l, e, t) {
|
|
2552
2551
|
if (Ce(e))
|
|
2553
|
-
return
|
|
2552
|
+
return l;
|
|
2554
2553
|
const i = e.$instance.getValue();
|
|
2555
2554
|
if (e.renderType === "file") {
|
|
2556
|
-
const
|
|
2557
|
-
|
|
2555
|
+
const s = i.uploadFile;
|
|
2556
|
+
l[e.$validName] = s, l[e.$validName + "RemoveIds"] = i.removeIds;
|
|
2558
2557
|
} else if (t !== !0)
|
|
2559
2558
|
if (j(e))
|
|
2560
|
-
for (let [
|
|
2561
|
-
s
|
|
2559
|
+
for (let [s, n] of Object.entries(i))
|
|
2560
|
+
l[s] = n;
|
|
2562
2561
|
else
|
|
2563
|
-
C(e.name) || (
|
|
2562
|
+
C(e.name) || (l[e.name] = i);
|
|
2564
2563
|
else
|
|
2565
|
-
|
|
2566
|
-
return
|
|
2564
|
+
l[e.$validName] = i;
|
|
2565
|
+
return l;
|
|
2567
2566
|
}
|
|
2568
|
-
function xe(
|
|
2567
|
+
function xe(l, e, t) {
|
|
2569
2568
|
if (Ce(e))
|
|
2570
|
-
return
|
|
2569
|
+
return l;
|
|
2571
2570
|
const i = e.$instance.getValue();
|
|
2572
2571
|
if (e.renderType === "file") {
|
|
2573
|
-
const
|
|
2574
|
-
|
|
2575
|
-
for (let n of
|
|
2576
|
-
|
|
2577
|
-
|
|
2572
|
+
const s = i.uploadFile;
|
|
2573
|
+
l.delete(e.$validName);
|
|
2574
|
+
for (let n of s)
|
|
2575
|
+
l.append(e.$validName, n);
|
|
2576
|
+
l.set(e.$validName + "RemoveIds", i.removeIds);
|
|
2578
2577
|
} else if (t !== !0)
|
|
2579
2578
|
if (j(e))
|
|
2580
|
-
for (let [
|
|
2581
|
-
|
|
2579
|
+
for (let [s, n] of Object.entries(i))
|
|
2580
|
+
l.set(s, n);
|
|
2582
2581
|
else
|
|
2583
|
-
C(e.name) ||
|
|
2582
|
+
C(e.name) || l.set(e.$validName, i);
|
|
2584
2583
|
else
|
|
2585
|
-
|
|
2586
|
-
return
|
|
2584
|
+
l.set(e.$validName, i);
|
|
2585
|
+
return l;
|
|
2587
2586
|
}
|
|
2588
2587
|
class bt {
|
|
2589
2588
|
constructor(e, t, i) {
|
|
@@ -2606,14 +2605,14 @@ class bt {
|
|
|
2606
2605
|
addRowTemplate(e) {
|
|
2607
2606
|
let t = this.isLabelHide(e), i = A(this.options, e, null, t);
|
|
2608
2607
|
this.addRowFieldInfo(e);
|
|
2609
|
-
const
|
|
2608
|
+
const s = z(`
|
|
2610
2609
|
<div class="df-row df-form-group ${i.fieldClass}" id="${e.$key}">
|
|
2611
2610
|
${t ? "" : `<div class="df-label ${i.labelClass} ${i.labelAlignClass}" title="${e.label ?? ""}" style="${i.labelStyle}">${this.getLabelTemplate(e)}</div>`}
|
|
2612
2611
|
|
|
2613
2612
|
<div class="df-field-container ${i.valueClass} ${e.required ? "required" : ""}" style="${i.valueStyle}"></div>
|
|
2614
2613
|
</div>
|
|
2615
2614
|
`);
|
|
2616
|
-
|
|
2615
|
+
s && (this.createField(e, s), this.formElement.append(s), e.children && this.childTemplate(e, i));
|
|
2617
2616
|
}
|
|
2618
2617
|
createField(e, t) {
|
|
2619
2618
|
e.$instance = new e.$renderType(e, t, this.daraform);
|
|
@@ -2626,7 +2625,7 @@ class bt {
|
|
|
2626
2625
|
* @returns {*}
|
|
2627
2626
|
*/
|
|
2628
2627
|
childTemplate(e, t) {
|
|
2629
|
-
let i = null,
|
|
2628
|
+
let i = null, s = !0, n = !1;
|
|
2630
2629
|
if (!e.$renderType.isChildrenCreate())
|
|
2631
2630
|
return;
|
|
2632
2631
|
const a = document.createElement("div");
|
|
@@ -2637,14 +2636,14 @@ class bt {
|
|
|
2637
2636
|
throw new Error(`parent field :[${e.$validName}], children index ${o}, empty [${r}]`);
|
|
2638
2637
|
if (r.$parent = e, ++o, this.checkHiddenField(r))
|
|
2639
2638
|
continue;
|
|
2640
|
-
this.addRowFieldInfo(r),
|
|
2639
|
+
this.addRowFieldInfo(r), s && (i = r);
|
|
2641
2640
|
let d = this.isLabelHide(r), h, u = "";
|
|
2642
2641
|
d ? (h = A(this.options, r, i, !n), u = n ? `<span class="df-label df-empty ${h.labelClass}" style="${h.labelStyle}"></span>` : "") : (h = A(this.options, r, i, !1), u = `<span class="df-label ${h.labelClass} ${h.labelAlignClass}" title="${r.label ?? ""}" style="${h.labelStyle}">${this.getLabelTemplate(r)}</span>`);
|
|
2643
2642
|
const c = z(`<div class="df-form-group ${h.fieldClass}" style="${h.fieldStyle}" id="${r.$key}">
|
|
2644
2643
|
${u}
|
|
2645
2644
|
<span class="df-field-container ${h.valueClass} ${r.required ? "required" : ""}" style="${h.valueStyle}"></span>
|
|
2646
2645
|
</div>`);
|
|
2647
|
-
c && (this.createField(r, c), a.append(c), r.children && this.childTemplate(r, r.children ? h : t)), d || (n = !0),
|
|
2646
|
+
c && (this.createField(r, c), a.append(c), r.children && this.childTemplate(r, r.children ? h : t)), d || (n = !0), s = !1;
|
|
2648
2647
|
}
|
|
2649
2648
|
e.$instance.addChildField(a);
|
|
2650
2649
|
}
|
|
@@ -2656,7 +2655,7 @@ class bt {
|
|
|
2656
2655
|
*/
|
|
2657
2656
|
getLabelTemplate(e) {
|
|
2658
2657
|
const t = e.required ? '<span class="required"></span>' : "", i = D(e.tooltip) ? "" : `<span class="df-tooltip">?<span class="df-tooltip-text">${e.tooltip}</span></span>`;
|
|
2659
|
-
return
|
|
2658
|
+
return `<span class="df-label-text">${e.label ?? ""}</span> ${i} ${t}`;
|
|
2660
2659
|
}
|
|
2661
2660
|
/**
|
|
2662
2661
|
* label 숨김 여부
|
|
@@ -2682,11 +2681,11 @@ class bt {
|
|
|
2682
2681
|
this.fieldInfoMap.addField(e), this.addRowFields.push(e.$key);
|
|
2683
2682
|
}
|
|
2684
2683
|
}
|
|
2685
|
-
function wt(
|
|
2686
|
-
return he({}, re,
|
|
2684
|
+
function wt(l) {
|
|
2685
|
+
return he({}, re, l);
|
|
2687
2686
|
}
|
|
2688
|
-
function Mt(
|
|
2689
|
-
re = he({}, re,
|
|
2687
|
+
function Mt(l) {
|
|
2688
|
+
re = he({}, re, l);
|
|
2690
2689
|
}
|
|
2691
2690
|
let re = {
|
|
2692
2691
|
style: {
|
|
@@ -2705,34 +2704,40 @@ const Z = {}, Ve = "data-form-uid";
|
|
|
2705
2704
|
let Ft = 0;
|
|
2706
2705
|
const _ = class _ {
|
|
2707
2706
|
constructor(e, t, i) {
|
|
2708
|
-
if (this.formValue = {}, this.changeListeners = [], this.changeMode = (
|
|
2709
|
-
this.options.mode =
|
|
2707
|
+
if (this.formValue = {}, this.changeListeners = [], this.changeMode = (s) => {
|
|
2708
|
+
this.options.mode = s, this.formElement.setAttribute("data-df-mode", s);
|
|
2709
|
+
const n = this.formElement.querySelectorAll(".df-field input, .df-field textarea, .df-field select");
|
|
2710
|
+
s == "view" ? n.forEach((a) => {
|
|
2711
|
+
a instanceof HTMLInputElement && (a.readOnly = !0), a instanceof HTMLTextAreaElement && (a.readOnly = !0);
|
|
2712
|
+
}) : n.forEach((a) => {
|
|
2713
|
+
a instanceof HTMLInputElement && (a.readOnly = !1), a instanceof HTMLTextAreaElement && (a.readOnly = !1);
|
|
2714
|
+
});
|
|
2710
2715
|
}, this.resetForm = () => {
|
|
2711
|
-
const
|
|
2712
|
-
for (const n in
|
|
2713
|
-
const o =
|
|
2716
|
+
const s = this.fieldInfoMap.getAllFieldInfo();
|
|
2717
|
+
for (const n in s) {
|
|
2718
|
+
const o = s[n].$instance;
|
|
2714
2719
|
o && typeof o.reset == "function" && o.reset();
|
|
2715
2720
|
}
|
|
2716
2721
|
this.formValue = {}, this.conditionCheck();
|
|
2717
|
-
}, this.resetField = (
|
|
2718
|
-
this.fieldInfoMap.getFieldName(
|
|
2719
|
-
}, this.getFieldValue = (
|
|
2720
|
-
const n = this.fieldInfoMap.getFieldName(
|
|
2722
|
+
}, this.resetField = (s) => {
|
|
2723
|
+
this.fieldInfoMap.getFieldName(s).$instance.reset(), this.formValue[s] = "", this.conditionCheck();
|
|
2724
|
+
}, this.getFieldValue = (s) => {
|
|
2725
|
+
const n = this.fieldInfoMap.getFieldName(s);
|
|
2721
2726
|
return n ? n.$instance.getValue() : null;
|
|
2722
|
-
}, this.getValue = (
|
|
2723
|
-
n !== !1 && this.resetForm(), Object.keys(
|
|
2724
|
-
this._setFieldValue(a,
|
|
2727
|
+
}, this.getValue = (s) => this.fieldInfoMap.getAllFieldValue(this.formValue, s), this.getFormDataValue = (s) => this.fieldInfoMap.getFormDataValue(this.formValue, s), this.setValue = (s, n) => {
|
|
2728
|
+
n !== !1 && this.resetForm(), Object.keys(s).forEach((a) => {
|
|
2729
|
+
this._setFieldValue(a, s[a]);
|
|
2725
2730
|
}), this.conditionCheck();
|
|
2726
|
-
}, this.setFieldValue = (
|
|
2727
|
-
this._setFieldValue(
|
|
2728
|
-
}, this.setFieldItems = (
|
|
2729
|
-
const a = this.fieldInfoMap.getFieldName(
|
|
2731
|
+
}, this.setFieldValue = (s, n) => {
|
|
2732
|
+
this._setFieldValue(s, n), this.conditionCheck();
|
|
2733
|
+
}, this.setFieldItems = (s, n) => {
|
|
2734
|
+
const a = this.fieldInfoMap.getFieldName(s);
|
|
2730
2735
|
if (a)
|
|
2731
2736
|
return a.$instance.setValueItems(n);
|
|
2732
|
-
}, this.addField = (
|
|
2733
|
-
this.options.fields.push(
|
|
2734
|
-
}, this.removeField = (
|
|
2735
|
-
const n = this.fieldInfoMap.getFieldName(
|
|
2737
|
+
}, this.addField = (s) => {
|
|
2738
|
+
this.options.fields.push(s), this.formTemplate.addRow(s), this.conditionCheck();
|
|
2739
|
+
}, this.removeField = (s) => {
|
|
2740
|
+
const n = this.fieldInfoMap.getFieldName(s);
|
|
2736
2741
|
if (!n) return;
|
|
2737
2742
|
const a = this.getRemoveFields(n);
|
|
2738
2743
|
a.forEach((o) => {
|
|
@@ -2741,28 +2746,28 @@ const _ = class _ {
|
|
|
2741
2746
|
this.fieldInfoMap.removeFieldInfoByKey(o.$key);
|
|
2742
2747
|
}), this.conditionCheck();
|
|
2743
2748
|
}, this.isValidForm = () => this.validForm().length < 1, this.validForm = () => {
|
|
2744
|
-
let
|
|
2749
|
+
let s = [], n = this.options.autoFocus !== !1, a = !0;
|
|
2745
2750
|
const o = this.fieldInfoMap.getAllFieldInfo();
|
|
2746
2751
|
for (const r in o) {
|
|
2747
2752
|
const d = o[r];
|
|
2748
2753
|
let h = this.fieldInfoMap.getFieldValidation(d, n);
|
|
2749
|
-
h !== !0 && (n = !1, Le(d) ?
|
|
2754
|
+
h !== !0 && (n = !1, Le(d) ? s = s.concat(h) : (a && (this.validTabCheck(d), a = !1), s.push(h)));
|
|
2750
2755
|
}
|
|
2751
|
-
return
|
|
2752
|
-
}, this.isValidField = (
|
|
2753
|
-
const n = this.fieldInfoMap.getFieldName(
|
|
2756
|
+
return s;
|
|
2757
|
+
}, this.isValidField = (s) => {
|
|
2758
|
+
const n = this.fieldInfoMap.getFieldName(s);
|
|
2754
2759
|
if (y(n))
|
|
2755
|
-
throw new Error(`Field name [${
|
|
2760
|
+
throw new Error(`Field name [${s}] not found`);
|
|
2756
2761
|
const a = n.$instance;
|
|
2757
2762
|
return a ? a.valid() === !0 : !0;
|
|
2758
|
-
}, this.getOptions = () => this.options, this.subscribe = (
|
|
2759
|
-
this.changeListeners = this.changeListeners.filter((n) => n !==
|
|
2763
|
+
}, this.getOptions = () => this.options, this.subscribe = (s) => (this.changeListeners.push(s), () => {
|
|
2764
|
+
this.changeListeners = this.changeListeners.filter((n) => n !== s);
|
|
2760
2765
|
}), this.destroy = () => {
|
|
2761
2766
|
this.formElement.className = this.orginFormStyleClass, this.formElement.replaceChildren();
|
|
2762
|
-
for (const
|
|
2763
|
-
|
|
2764
|
-
}, this.getFields = () => this.options.fields, this.setFields = (
|
|
2765
|
-
this.options.fields =
|
|
2767
|
+
for (const s in this)
|
|
2768
|
+
He(this, s) && (delete this[s], delete Z[this.selector]);
|
|
2769
|
+
}, this.getFields = () => this.options.fields, this.setFields = (s) => {
|
|
2770
|
+
this.options.fields = s, this.createForm(s);
|
|
2766
2771
|
}, this.options = wt(t), I.set(i), e)
|
|
2767
2772
|
this.orginFormStyleClass = e.className, e.classList.add("daracl-form"), this.selector = `df_${++Ft}`, e.setAttribute("name", this.selector), e.setAttribute(Ve, this.selector), this.options.style.width && e.setAttribute("style", `width:${this.options.style.width};`), this.formElement = e, this.changeMode(this.options.mode ?? "new"), this.createForm(this.options.fields), this.options.autoCreate !== !1 && (Z[this.selector] = this);
|
|
2768
2773
|
else
|
|
@@ -2810,8 +2815,8 @@ const _ = class _ {
|
|
|
2810
2815
|
*/
|
|
2811
2816
|
getRemoveFields(e, t = []) {
|
|
2812
2817
|
var i;
|
|
2813
|
-
return t.push(e), (i = e.children) == null || i.forEach((
|
|
2814
|
-
|
|
2818
|
+
return t.push(e), (i = e.children) == null || i.forEach((s) => {
|
|
2819
|
+
s && this.fieldInfoMap.get(s.$key) === s && this.getRemoveFields(s, t);
|
|
2815
2820
|
}), t;
|
|
2816
2821
|
}
|
|
2817
2822
|
/**
|
|
@@ -2830,9 +2835,9 @@ const _ = class _ {
|
|
|
2830
2835
|
return;
|
|
2831
2836
|
}
|
|
2832
2837
|
const i = `[id="${e.$key}"]`;
|
|
2833
|
-
let
|
|
2834
|
-
(
|
|
2835
|
-
const n = (
|
|
2838
|
+
let s = (r = e.$instance) == null ? void 0 : r.getElement();
|
|
2839
|
+
(s instanceof NodeList || s instanceof HTMLCollection) && (s = s[0] ?? null);
|
|
2840
|
+
const n = (s instanceof Element ? s.closest(i) : null) ?? this.formElement.querySelector(i), a = n == null ? void 0 : n.parentElement;
|
|
2836
2841
|
n == null || n.remove(), t && (a != null && a.classList.contains("df-row")) && a.childElementCount < 1 && a.remove();
|
|
2837
2842
|
}
|
|
2838
2843
|
/**
|
|
@@ -2885,17 +2890,17 @@ const _ = class _ {
|
|
|
2885
2890
|
oe(e) ? t = document.querySelector(e) : t = e, t = t;
|
|
2886
2891
|
let i = t.getAttribute(Ve);
|
|
2887
2892
|
if (y(i) || D(i)) {
|
|
2888
|
-
const
|
|
2889
|
-
if (
|
|
2893
|
+
const s = Object.keys(Z);
|
|
2894
|
+
if (s.length > 1)
|
|
2890
2895
|
throw new Error(`selector empty : [${i}]`);
|
|
2891
|
-
return i =
|
|
2896
|
+
return i = s[0], Z[i];
|
|
2892
2897
|
}
|
|
2893
2898
|
}
|
|
2894
2899
|
getFieldInfoMap() {
|
|
2895
2900
|
return this.fieldInfoMap;
|
|
2896
2901
|
}
|
|
2897
2902
|
};
|
|
2898
|
-
_.VERSION = "0.0.
|
|
2903
|
+
_.VERSION = "0.0.19", _.validator = {
|
|
2899
2904
|
string: (e, t) => R(e, t),
|
|
2900
2905
|
number: (e, t) => ue(e, t),
|
|
2901
2906
|
regexp: (e, t) => {
|