@materialui-reactjs/admin 1.0.4 → 1.0.6
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/chunks/{Common-C_ZhT4L6.js → Common-BURf0rBN.js} +34 -29
- package/dist/chunks/{HeaderUpdate-lrSYWsKp.js → HeaderUpdate-DuS-gHNR.js} +2 -2
- package/dist/chunks/{UDragFile-CAiSfTsp.js → UDragFile-BnUR3riq.js} +1 -1
- package/dist/chunks/{Validator-DjZz2bJs.js → Validator-CXYkI7vJ.js} +62 -59
- package/dist/chunks/{form-C8gzkYMW.js → form-CPkpL5eA.js} +177 -131
- package/dist/chunks/{meta-k8MmuQjS.js → meta-4qPWijBT.js} +13 -13
- package/dist/chunks/{single-DyPwG6ZR.js → single-CRF61o_U.js} +210 -210
- package/dist/chunks/{top-navbar-FBw88y_o.js → top-navbar-Bob0gMUh.js} +1 -1
- package/dist/components/form/DateTimeInput.d.ts +2 -1
- package/dist/components/form/UFile.d.ts +1 -1
- package/dist/components/form/UFiles.d.ts +1 -0
- package/dist/components/form/index.js +3 -3
- package/dist/components/meta/index.js +2 -2
- package/dist/components/single/Detail.d.ts +1 -0
- package/dist/components/single/Fields.d.ts +1 -0
- package/dist/components/single/Update.d.ts +2 -1
- package/dist/components/single/index.js +1 -1
- package/dist/components/top-navbar/index.js +1 -1
- package/dist/hook/detail.d.ts +5 -1
- package/dist/hook/detail.js +7 -7
- package/dist/hook/fields.d.ts +5 -1
- package/dist/hook/fields.js +7 -7
- package/dist/hook/index.d.ts +1 -1
- package/dist/hook/index.js +2 -2
- package/dist/hook/update.d.ts +12 -3
- package/dist/hook/update.js +25 -22
- package/dist/index.js +11 -11
- package/dist/utils/Common.d.ts +4 -0
- package/dist/utils/index.js +28 -23
- package/package.json +1 -1
|
@@ -45,7 +45,12 @@ var { SECRET_KEY: i, STATIC_URL: a, API_URL: o, UPLOADS_URL: s } = await e(), c
|
|
|
45
45
|
t.append(e, n);
|
|
46
46
|
}
|
|
47
47
|
}), t;
|
|
48
|
-
}, u =
|
|
48
|
+
}, u = class extends Error {
|
|
49
|
+
errorCode;
|
|
50
|
+
constructor(e, t) {
|
|
51
|
+
super(e), this.name = "ApiError", this.errorCode = t;
|
|
52
|
+
}
|
|
53
|
+
}, d = async (e, t = {}, n = "POST", r = "application/json", a = !0) => {
|
|
49
54
|
let o = { "Secret-Key": i };
|
|
50
55
|
r !== "multipart/form-data" && (o["Content-Type"] = r);
|
|
51
56
|
let s = {
|
|
@@ -61,17 +66,17 @@ var { SECRET_KEY: i, STATIC_URL: a, API_URL: o, UPLOADS_URL: s } = await e(), c
|
|
|
61
66
|
let r = n.toString();
|
|
62
67
|
e += (e.includes("?") ? "&" : "?") + r;
|
|
63
68
|
}
|
|
64
|
-
let c = await (await fetch(e, s)).text(),
|
|
69
|
+
let c = await (await fetch(e, s)).text(), d = null;
|
|
65
70
|
if (c) try {
|
|
66
|
-
|
|
71
|
+
d = JSON.parse(c);
|
|
67
72
|
} catch {
|
|
68
|
-
|
|
73
|
+
d = c;
|
|
69
74
|
}
|
|
70
|
-
if (
|
|
71
|
-
if (
|
|
75
|
+
if (d?.status == 200) return d;
|
|
76
|
+
if (d?.msg && a) throw new u(d.msg, d.errorCode);
|
|
72
77
|
if (a) throw Error("invalid_response");
|
|
73
78
|
return !1;
|
|
74
|
-
},
|
|
79
|
+
}, f = (e = "Bạn có chắc muốn thực hiện thao tác này ?", r = "Đồng ý") => n(t).fire({
|
|
75
80
|
title: "Xác nhận",
|
|
76
81
|
text: e,
|
|
77
82
|
icon: "warning",
|
|
@@ -81,7 +86,7 @@ var { SECRET_KEY: i, STATIC_URL: a, API_URL: o, UPLOADS_URL: s } = await e(), c
|
|
|
81
86
|
confirmButtonText: r,
|
|
82
87
|
cancelButtonText: "Hủy",
|
|
83
88
|
position: "top"
|
|
84
|
-
}),
|
|
89
|
+
}), p = (e, r = "top", i = !1) => {
|
|
85
90
|
n(t).fire({
|
|
86
91
|
toast: i,
|
|
87
92
|
icon: "success",
|
|
@@ -90,29 +95,29 @@ var { SECRET_KEY: i, STATIC_URL: a, API_URL: o, UPLOADS_URL: s } = await e(), c
|
|
|
90
95
|
showConfirmButton: !1,
|
|
91
96
|
timer: 1500
|
|
92
97
|
});
|
|
93
|
-
},
|
|
98
|
+
}, m = (e) => {
|
|
94
99
|
n(t).fire({
|
|
95
100
|
icon: "error",
|
|
96
101
|
position: "top",
|
|
97
102
|
title: e,
|
|
98
103
|
showConfirmButton: !1
|
|
99
104
|
});
|
|
100
|
-
},
|
|
105
|
+
}, h = (e) => {
|
|
101
106
|
if (!e) return "";
|
|
102
107
|
let t = new Date(e);
|
|
103
108
|
return isNaN(t.getTime()) ? "Invalid Date" : `${String(t.getDate()).padStart(2, "0")}/${String(t.getMonth() + 1).padStart(2, "0")}/${t.getFullYear()}`;
|
|
104
|
-
},
|
|
109
|
+
}, g = (e) => {
|
|
105
110
|
let t = new URLSearchParams();
|
|
106
111
|
return Object.entries(e).forEach(([e, n]) => {
|
|
107
112
|
Array.isArray(n) ? n.forEach((n) => {
|
|
108
113
|
n != null && t.append(e, String(n));
|
|
109
114
|
}) : n != null && t.set(e, String(n));
|
|
110
115
|
}), t.toString();
|
|
111
|
-
},
|
|
116
|
+
}, _ = () => {
|
|
112
117
|
let e = window.location.pathname.match(/\/(\d+)(\/)?$/);
|
|
113
118
|
return e ? Number(e[1]) : null;
|
|
114
|
-
},
|
|
115
|
-
function
|
|
119
|
+
}, v = (e, t = "/styles/default.jpg") => e ? a + ("/" + e).replaceAll("//", "/") : t, y = (e) => e ? a + ("/" + e).replaceAll("//", "/") : "", b = (e, t = "/styles/default.jpg") => e ? o + ("/" + e).replaceAll("//", "/") : t, x = (e, t = "/styles/default.jpg") => e ? s + "/" + e : t;
|
|
120
|
+
function S(e) {
|
|
116
121
|
let t = "";
|
|
117
122
|
for (let n = 0; n < e; n++) {
|
|
118
123
|
let e = Math.floor(Math.random() * 62);
|
|
@@ -120,19 +125,19 @@ function x(e) {
|
|
|
120
125
|
}
|
|
121
126
|
return t;
|
|
122
127
|
}
|
|
123
|
-
var
|
|
128
|
+
var C = (e, t = 20, n = !1) => new Promise((r) => {
|
|
124
129
|
for (let r = 0; r < e.length; r++) if (e[r] !== void 0) {
|
|
125
130
|
if (n.test(e[r].name)) {
|
|
126
|
-
if (e[r].size >= t * 1024 * 1024) return
|
|
127
|
-
} else return
|
|
128
|
-
} else return
|
|
131
|
+
if (e[r].size >= t * 1024 * 1024) return m(`Tập tin tải lên không quá ${t}M`), !1;
|
|
132
|
+
} else return m("Tập tin không hợp lệ"), !1;
|
|
133
|
+
} else return m("Tập tin không tồn tại"), !1;
|
|
129
134
|
r(void 0);
|
|
130
|
-
}),
|
|
135
|
+
}), w = (e = "", t = "danger") => {
|
|
131
136
|
let n = "";
|
|
132
137
|
if (typeof e == "string") return e.trim() === "" ? "" : `<div class="alert alert-${t}">${e}</div>`;
|
|
133
138
|
for (let r in e) n += `<div class="alert alert-${t}">${e[r]}</div>`;
|
|
134
139
|
return n;
|
|
135
|
-
},
|
|
140
|
+
}, T = (e, t = {}) => new Promise((n, r) => {
|
|
136
141
|
try {
|
|
137
142
|
let r = window.jQuery, i = r(e);
|
|
138
143
|
if (!i.length) throw Error("invalid_elfinder");
|
|
@@ -154,7 +159,7 @@ var S = (e, t = 20, n = !1) => new Promise((r) => {
|
|
|
154
159
|
} catch (e) {
|
|
155
160
|
r(e);
|
|
156
161
|
}
|
|
157
|
-
}),
|
|
162
|
+
}), E = (e) => new Promise((t, n) => {
|
|
158
163
|
try {
|
|
159
164
|
let n = typeof e == "string" ? document.querySelector(e) : e;
|
|
160
165
|
if (!n) throw Error("invalid_modalEl_btnEl");
|
|
@@ -174,12 +179,12 @@ var S = (e, t = 20, n = !1) => new Promise((r) => {
|
|
|
174
179
|
} catch (e) {
|
|
175
180
|
console.log(e), n(e);
|
|
176
181
|
}
|
|
177
|
-
}),
|
|
182
|
+
}), D = (e, t, n = !1, r = !1) => {
|
|
178
183
|
if (!e) throw Error("invalid_btnEl");
|
|
179
184
|
e.addEventListener("click", (i) => {
|
|
180
|
-
i.preventDefault(),
|
|
185
|
+
i.preventDefault(), E(t).then((t) => {
|
|
181
186
|
let { modalEl: i, md: a } = t;
|
|
182
|
-
|
|
187
|
+
T("#elfinderStatic").then((t) => {
|
|
183
188
|
n && n({
|
|
184
189
|
data: t,
|
|
185
190
|
btnEl: e,
|
|
@@ -190,12 +195,12 @@ var S = (e, t = 20, n = !1) => new Promise((r) => {
|
|
|
190
195
|
}), a.show();
|
|
191
196
|
});
|
|
192
197
|
});
|
|
193
|
-
},
|
|
198
|
+
}, O = (e, t, n = !1, r = !1) => {
|
|
194
199
|
if (!e) throw Error("invalid_btnEl");
|
|
195
200
|
e.addEventListener("click", (i) => {
|
|
196
|
-
i.preventDefault(),
|
|
201
|
+
i.preventDefault(), E(t).then((t) => {
|
|
197
202
|
let { modalEl: i, md: a } = t;
|
|
198
|
-
|
|
203
|
+
T("#elfinderStatic", { url: o + "/elfinder/connectorFiles" }).then((t) => {
|
|
199
204
|
n && n({
|
|
200
205
|
data: t,
|
|
201
206
|
btnEl: e,
|
|
@@ -206,7 +211,7 @@ var S = (e, t = 20, n = !1) => new Promise((r) => {
|
|
|
206
211
|
}), a.show();
|
|
207
212
|
});
|
|
208
213
|
});
|
|
209
|
-
},
|
|
214
|
+
}, k = (e = !1) => {
|
|
210
215
|
let t = [{
|
|
211
216
|
id: 1,
|
|
212
217
|
name: "Tiếng Việt"
|
|
@@ -214,4 +219,4 @@ var S = (e, t = 20, n = !1) => new Promise((r) => {
|
|
|
214
219
|
return e === !1 ? t : t.find((t) => t.id === e)?.name || "";
|
|
215
220
|
};
|
|
216
221
|
//#endregion
|
|
217
|
-
export {
|
|
222
|
+
export { f as _, T as a, c as b, _ as c, b as d, x as f, w as g, D as h, g as i, v as l, O as m, C as n, h as o, S as p, E as r, y as s, d as t, k as u, m as v, p as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, t } from "./Common-
|
|
1
|
+
import { i as e, t } from "./Common-BURf0rBN.js";
|
|
2
2
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
3
|
import { Link as a, NavLink as o } from "react-router-dom";
|
|
4
4
|
import { Tooltip as s } from "@mui/material";
|
|
@@ -471,4 +471,4 @@ var u = ({ data: e, onChange: t, onClickPage: a }) => {
|
|
|
471
471
|
})]
|
|
472
472
|
});
|
|
473
473
|
//#endregion
|
|
474
|
-
export { h as a,
|
|
474
|
+
export { h as a, p as c, l as d, g as i, m as l, v as n, d as o, _ as r, f as s, y as t, u };
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
//#region src/hook/update.ts
|
|
2
|
-
var e =
|
|
2
|
+
var e = (e) => {
|
|
3
3
|
e.preventDefault();
|
|
4
|
-
let { name:
|
|
5
|
-
if (
|
|
4
|
+
let { name: n, type: r, value: i } = t(e);
|
|
5
|
+
if (r === "file") {
|
|
6
6
|
let t = e.target.files;
|
|
7
|
-
n
|
|
8
|
-
} else n[r] = a;
|
|
9
|
-
return n;
|
|
10
|
-
}, t = (e, t) => {
|
|
11
|
-
let { name: n, type: r, value: i } = e.target, a = n.split(/[\{\}]+/).filter(Boolean), o = a.shift();
|
|
12
|
-
if (!o || a.length === 0) return {
|
|
13
|
-
name: n,
|
|
14
|
-
type: r,
|
|
15
|
-
value: i
|
|
16
|
-
};
|
|
17
|
-
let s = JSON.parse(JSON.stringify(t?.[o] || {})), c = s;
|
|
18
|
-
for (let e = 0; e < a.length - 1; e++) {
|
|
19
|
-
let t = a[e];
|
|
20
|
-
c[t] = { ...c[t] || {} }, c = c[t];
|
|
7
|
+
return { [n]: t ? t[0] : null };
|
|
21
8
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
return { [n]: i };
|
|
10
|
+
}, t = (e) => {
|
|
11
|
+
let { name: t, type: n, value: r } = e.target, i = t.split(/[\{\}]+/).filter(Boolean), a = i.shift();
|
|
12
|
+
if (!a || i.length === 0) return {
|
|
13
|
+
name: t,
|
|
14
|
+
type: n,
|
|
15
|
+
value: r
|
|
16
|
+
};
|
|
17
|
+
let o = {}, s = o;
|
|
18
|
+
for (let e = 0; e < i.length - 1; e++) s[i[e]] = {}, s = s[i[e]];
|
|
19
|
+
return s[i[i.length - 1]] = r, {
|
|
20
|
+
name: a,
|
|
21
|
+
type: n,
|
|
22
|
+
value: o
|
|
23
|
+
};
|
|
24
|
+
}, n = (e, t) => {
|
|
25
|
+
let r = { ...e };
|
|
26
|
+
return Object.keys(t).forEach((e) => {
|
|
27
|
+
let i = t[e], a = r[e];
|
|
28
|
+
i && typeof i == "object" && !Array.isArray(i) && a && typeof a == "object" && !Array.isArray(a) ? r[e] = n(a, i) : r[e] = i;
|
|
29
|
+
}), r;
|
|
30
|
+
}, r = window.jQuery, i = class e {
|
|
28
31
|
options;
|
|
29
32
|
validators;
|
|
30
33
|
$element;
|
|
@@ -55,8 +58,8 @@ var e = async (e, n) => {
|
|
|
55
58
|
if (t.checkValidity) return !t.checkValidity() && !t.validity.valid && (t.validationMessage || "error!");
|
|
56
59
|
},
|
|
57
60
|
match: function(t) {
|
|
58
|
-
let
|
|
59
|
-
return
|
|
61
|
+
let n = t.attr("data-match");
|
|
62
|
+
return n && t.val() !== r(n).val() && e.DEFAULTS.errors.match;
|
|
60
63
|
},
|
|
61
64
|
minlength: function(t) {
|
|
62
65
|
let n = Number(t.attr("data-minlength"));
|
|
@@ -83,44 +86,44 @@ var e = async (e, n) => {
|
|
|
83
86
|
return t ? !new RegExp(t).test(String(e.val() ?? "")) : !1;
|
|
84
87
|
}
|
|
85
88
|
};
|
|
86
|
-
constructor(t,
|
|
87
|
-
this.options =
|
|
88
|
-
this.clearErrors(
|
|
89
|
+
constructor(t, n = !1) {
|
|
90
|
+
this.options = n || e.DEFAULTS, this.validators = r.extend({}, e.VALIDATORS), this.$element = r(t), this.$btn = this.$element.find("button[type=\"submit\"], input[type=\"submit\"], .submitAjax"), this.$inputs = this.$element.find(e.INPUT_SELECTOR).add(this.$element.find("[data-validate=\"true\"]")).not(this.$element.find("[data-validate=\"false\"]").each((e, t) => {
|
|
91
|
+
this.clearErrors(r(t));
|
|
89
92
|
}));
|
|
90
93
|
}
|
|
91
94
|
static getValue(e) {
|
|
92
|
-
return e.is("[type=\"checkbox\"]") ? !!e.prop("checked") : e.is("[type=\"radio\"]") ?
|
|
95
|
+
return e.is("[type=\"checkbox\"]") ? !!e.prop("checked") : e.is("[type=\"radio\"]") ? r(`[name="${e.attr("name")}"]:checked`).length > 0 : e.is("select[multiple]") ? (e.val() ?? []).length : e.val() ?? "";
|
|
93
96
|
}
|
|
94
97
|
update = () => {
|
|
95
98
|
let t = this;
|
|
96
|
-
return this.$inputs = this.$element.find(e.INPUT_SELECTOR).add(this.$element.find("[data-validate=\"true\"]")).not(this.$element.find("[data-validate=\"false\"]").each((e,
|
|
97
|
-
t.clearErrors(n
|
|
99
|
+
return this.$inputs = this.$element.find(e.INPUT_SELECTOR).add(this.$element.find("[data-validate=\"true\"]")).not(this.$element.find("[data-validate=\"false\"]").each((e, n) => {
|
|
100
|
+
t.clearErrors(r(n));
|
|
98
101
|
})), this.toggleSubmit(), this;
|
|
99
102
|
};
|
|
100
103
|
onInput = (e) => {
|
|
101
|
-
let t = this,
|
|
102
|
-
this.$inputs.is(
|
|
104
|
+
let t = this, n = r(e.target), i = e.type !== "focusout";
|
|
105
|
+
this.$inputs.is(n) && this.validateInput(n, i)?.done(function() {
|
|
103
106
|
t.toggleSubmit();
|
|
104
107
|
});
|
|
105
108
|
};
|
|
106
109
|
validateInput = (e, t) => {
|
|
107
|
-
let
|
|
110
|
+
let n = e.data("bs.validator.errors");
|
|
108
111
|
e.is("[type=\"radio\"]") && (e = this.$element.find("input[name=\"" + e.attr("name") + "\"]"));
|
|
109
|
-
let i =
|
|
112
|
+
let i = r.Event("validate.bs.validator", { relatedTarget: e[0] });
|
|
110
113
|
if (this.$element.trigger(i), i.isDefaultPrevented()) return;
|
|
111
114
|
let a = this;
|
|
112
115
|
return this.runValidators(e).done(function(o) {
|
|
113
|
-
e.data("bs.validator.errors", o), o.length ? t ? a.defer(e, a.showErrors) : a.showErrors(e) : a.clearErrors(e), (!
|
|
116
|
+
e.data("bs.validator.errors", o), o.length ? t ? a.defer(e, a.showErrors) : a.showErrors(e) : a.clearErrors(e), (!n || o.toString() !== n.toString()) && (i = o.length ? r.Event("invalid.bs.validator", {
|
|
114
117
|
relatedTarget: e[0],
|
|
115
118
|
detail: o
|
|
116
|
-
}) :
|
|
119
|
+
}) : r.Event("valid.bs.validator", {
|
|
117
120
|
relatedTarget: e[0],
|
|
118
|
-
detail:
|
|
119
|
-
}), a.$element.trigger(i)), a.toggleSubmit(), a.$element.trigger(
|
|
121
|
+
detail: n
|
|
122
|
+
}), a.$element.trigger(i)), a.toggleSubmit(), a.$element.trigger(r.Event("validated.bs.validator", { relatedTarget: e[0] }));
|
|
120
123
|
});
|
|
121
124
|
};
|
|
122
125
|
runValidators = (t) => {
|
|
123
|
-
let
|
|
126
|
+
let n = [], i = r.Deferred();
|
|
124
127
|
t.data("bs.validator.deferred") && t.data("bs.validator.deferred").reject(), t.data("bs.validator.deferred", i);
|
|
125
128
|
function a(e) {
|
|
126
129
|
return t.attr("data-" + e + "-error");
|
|
@@ -137,39 +140,39 @@ var e = async (e, n) => {
|
|
|
137
140
|
function c(e) {
|
|
138
141
|
return a(e) || o() || s();
|
|
139
142
|
}
|
|
140
|
-
return
|
|
143
|
+
return r.each(this.validators, r.proxy(function(r, i) {
|
|
141
144
|
let a = null;
|
|
142
|
-
(e.getValue(t) || t.attr("required")) && (t.attr("data-" +
|
|
143
|
-
}, this)), i.resolve(
|
|
145
|
+
(e.getValue(t) || t.attr("required")) && (t.attr("data-" + r) !== void 0 || r == "native") && (a = i.call(this, t)) && (a = c(r) || a, !~n.indexOf(a) && n.push(a));
|
|
146
|
+
}, this)), i.resolve(n), i.promise();
|
|
144
147
|
};
|
|
145
148
|
validate = () => {
|
|
146
149
|
let e = this;
|
|
147
|
-
return
|
|
150
|
+
return r.when(this.$inputs.map((t, n) => e.validateInput(r(n), !1))).then(function() {
|
|
148
151
|
e.toggleSubmit(), e.focusError();
|
|
149
152
|
}), this;
|
|
150
153
|
};
|
|
151
154
|
focusError = () => {
|
|
152
155
|
if (!this.options.focus) return;
|
|
153
156
|
let t = this.$element.find(".has-error:first :input");
|
|
154
|
-
t.length !== 0 && (
|
|
157
|
+
t.length !== 0 && (r("html, body").animate({ scrollTop: t.offset().top - e.FOCUS_OFFSET }, 250), t.focus());
|
|
155
158
|
};
|
|
156
159
|
showErrors = (e) => {
|
|
157
160
|
this.options.html;
|
|
158
|
-
let t = e.data("bs.validator.errors"),
|
|
159
|
-
t.length && (t =
|
|
160
|
-
let t =
|
|
161
|
+
let t = e.data("bs.validator.errors"), n = e.closest(".form-group"), i = n.find(".form-control-feedback");
|
|
162
|
+
t.length && (t = r("<ul/>").addClass("list-unstyled").append(r.map(t, (e) => {
|
|
163
|
+
let t = r("<li/>");
|
|
161
164
|
return this.options.html ? t.html(e) : t.text(e);
|
|
162
|
-
})),
|
|
165
|
+
})), n.addClass("has-error has-danger"), n.find(".invalid-tooltip, .invalid-feedback").remove(), n.find(".select2,.form-control").removeClass("is-valid").addClass("is-invalid"), n.append(`<div class="invalid-feedback"><ul class="list-unstyled">${t.html()}<ul/></div>`), n.removeClass("has-success"), n.hasClass("has-feedback"), i.removeClass(this.options.feedback?.success), i.addClass(this.options.feedback?.error));
|
|
163
166
|
};
|
|
164
167
|
clearErrors = (e) => {
|
|
165
|
-
let t = e.closest(".form-group
|
|
168
|
+
let t = e.closest(".form-group"), n = t.find(".form-control-feedback");
|
|
166
169
|
t.removeClass("has-error has-danger has-success"), t.find(".invalid-tooltip, .invalid-feedback").remove(), t.find(".select2,.form-control").addClass("is-valid").removeClass("is-invalid"), t.addClass("has-success"), t.hasClass("has-feedback"), n.removeClass(this.options.feedback?.error), n.removeClass(this.options.feedback?.success), n.addClass(this.options.feedback?.success);
|
|
167
170
|
};
|
|
168
171
|
hasErrors = () => !!this.$inputs.filter(function() {
|
|
169
|
-
return !!(
|
|
172
|
+
return !!(r(this).data("bs.validator.errors") || []).length;
|
|
170
173
|
}).length;
|
|
171
|
-
isIncomplete = () => !!this.$inputs.filter("[required]").filter((t,
|
|
172
|
-
let i = e.getValue(n
|
|
174
|
+
isIncomplete = () => !!this.$inputs.filter("[required]").filter((t, n) => {
|
|
175
|
+
let i = e.getValue(r(n));
|
|
173
176
|
return !(typeof i == "string" ? i.trim() : i);
|
|
174
177
|
}).length;
|
|
175
178
|
onSubmit = (e) => {
|
|
@@ -183,21 +186,21 @@ var e = async (e, n) => {
|
|
|
183
186
|
window.clearTimeout(e.data("bs.validator.timeout")), e.data("bs.validator.timeout", window.setTimeout(t, this.options.delay));
|
|
184
187
|
};
|
|
185
188
|
reset = () => (this.$element.find(".form-control-feedback").removeClass(this.options?.feedback.error).removeClass(this.options.feedback.success), this.$inputs.removeData(["bs.validator.errors", "bs.validator.deferred"]).each(() => {
|
|
186
|
-
let e =
|
|
189
|
+
let e = r(this), t = e.data("bs.validator.timeout");
|
|
187
190
|
window.clearTimeout(t), e.removeData("bs.validator.timeout");
|
|
188
191
|
}), this.$element.find(".invalid-tooltip, .invalid-feedback").each(() => {
|
|
189
|
-
let e =
|
|
192
|
+
let e = r(this), t = e.data("bs.validator.originalContent");
|
|
190
193
|
e.removeData("bs.validator.originalContent").html(t);
|
|
191
194
|
}), this.$btn.removeClass("disabled"), this.$element.find(".has-error, .has-danger, .has-success, .is-invalid, .is-valid").removeClass("has-error has-danger has-success is-invalid is-valid"), this);
|
|
192
195
|
destroy = () => (this.reset(), this.$element.removeAttr("novalidate").removeData("bs.validator").off(".bs.validator"), this.$inputs.off(".bs.validator"), this.options = null, this.validators = null, this.$element = null, this.$btn = null, this.$inputs = null, this);
|
|
193
196
|
run = () => {
|
|
194
197
|
this.update(), this.$element.on("input.bs.validator change.bs.validator focusout.bs.validator", this.onInput.bind(this)), this.$element.on("submit.bs.validator", this.onSubmit.bind(this)), this.$element.on("reset.bs.validator", this.reset.bind(this)), this.$element.find("[data-match]").each(function() {
|
|
195
|
-
let t =
|
|
196
|
-
|
|
198
|
+
let t = r(this), n = t.attr("data-match");
|
|
199
|
+
n && r(n).on("input.bs.validator", function() {
|
|
197
200
|
e.getValue(t) && t.trigger("input.bs.validator");
|
|
198
201
|
});
|
|
199
|
-
}), this.$inputs.filter((t,
|
|
202
|
+
}), this.$inputs.filter((t, n) => e.getValue(r(n)) && !r(this).closest(".has-error").length).trigger("focusout"), this.$element.attr("novalidate", !0);
|
|
200
203
|
};
|
|
201
204
|
};
|
|
202
205
|
//#endregion
|
|
203
|
-
export {
|
|
206
|
+
export { t as i, n, e as r, i as t };
|