@materialui-reactjs/admin 1.0.5 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +292 -0
  2. package/LICENSE +21 -0
  3. package/README.md +584 -453
  4. package/dist/Common-1GAoFU4L.js +261 -0
  5. package/dist/Common-BBYXssMH.cjs +11 -0
  6. package/dist/Env-DoS-iQjs.cjs +1 -0
  7. package/dist/Env-SHztUA3s.js +16 -0
  8. package/dist/HeaderUpdate-DIwc8EAA.cjs +1 -0
  9. package/dist/{chunks/HeaderUpdate-CYN7fndV.js → HeaderUpdate-UXncZcAD.js} +8 -4
  10. package/dist/SortableItem-C3KzO8Xh.cjs +1 -0
  11. package/dist/SpinnerLoader-BujLjvC3.cjs +1 -0
  12. package/dist/{chunks/SpinnerLoader-h8RDIarB.js → SpinnerLoader-CyhOQC6d.js} +2 -2
  13. package/dist/UDragFile-BqGt1-gK.js +96 -0
  14. package/dist/UDragFile-oJ05zNLR.cjs +1 -0
  15. package/dist/Validator-BcydBvOg.cjs +1 -0
  16. package/dist/{chunks/Validator-CXYkI7vJ.js → Validator-aKlMgoxl.js} +50 -42
  17. package/dist/assets/css/form.css +1 -1
  18. package/dist/assets/css/index.css +1 -1
  19. package/dist/common-CHDJQ2Ca.cjs +1 -0
  20. package/dist/common-DVWX6AUQ.js +19 -0
  21. package/dist/components/echarts/index.cjs +1 -0
  22. package/dist/components/echarts/index.js +1 -1
  23. package/dist/components/form/AdvancedMultiSelect.d.ts +6 -3
  24. package/dist/components/form/AsxhUImages.d.ts +1 -1
  25. package/dist/components/form/BoxAddRow.d.ts +11 -1
  26. package/dist/components/form/CheckTreeBox.d.ts +12 -3
  27. package/dist/components/form/DateInput.d.ts +2 -1
  28. package/dist/components/form/EfFile.d.ts +2 -1
  29. package/dist/components/form/EfImage.d.ts +1 -1
  30. package/dist/components/form/EfImages.d.ts +1 -1
  31. package/dist/components/form/PImage.d.ts +1 -1
  32. package/dist/components/form/SelectAddRowBox.d.ts +9 -5
  33. package/dist/components/form/UDragFile.d.ts +1 -1
  34. package/dist/components/form/UFile.d.ts +1 -1
  35. package/dist/components/form/UFiles.d.ts +1 -1
  36. package/dist/components/form/UImages.d.ts +1 -1
  37. package/dist/components/form/index.cjs +1 -0
  38. package/dist/components/form/index.js +2 -2
  39. package/dist/components/loader/SpinnerLoader.d.ts +5 -1
  40. package/dist/components/loader/index.cjs +1 -0
  41. package/dist/components/loader/index.js +1 -2
  42. package/dist/components/meta/CardTable.d.ts +7 -3
  43. package/dist/components/meta/CardTable.types.d.ts +51 -0
  44. package/dist/components/meta/CusTooltip.d.ts +1 -1
  45. package/dist/components/meta/Head.d.ts +1 -1
  46. package/dist/components/meta/HeaderUpdate.d.ts +5 -1
  47. package/dist/components/meta/ModalForm.d.ts +41 -11
  48. package/dist/components/meta/Navtabs.d.ts +1 -1
  49. package/dist/components/meta/SearchBox.d.ts +6 -4
  50. package/dist/components/meta/SortableItem.d.ts +1 -1
  51. package/dist/components/meta/index.cjs +1 -0
  52. package/dist/components/meta/index.d.ts +1 -0
  53. package/dist/components/meta/index.js +3 -3
  54. package/dist/components/sidebar/Sidebar.types.d.ts +9 -7
  55. package/dist/components/sidebar/index.cjs +1 -0
  56. package/dist/components/sidebar/index.js +1 -1
  57. package/dist/components/single/Detail.d.ts +8 -3
  58. package/dist/components/single/Fields.d.ts +10 -4
  59. package/dist/components/single/Import.d.ts +8 -3
  60. package/dist/components/single/List.d.ts +18 -3
  61. package/dist/components/single/Update.d.ts +8 -3
  62. package/dist/components/single/UpdateDetail.d.ts +3 -2
  63. package/dist/components/single/UpdateTableDetail.d.ts +3 -3
  64. package/dist/components/single/index.cjs +1 -0
  65. package/dist/components/single/index.js +1 -1
  66. package/dist/components/top-navbar/index.cjs +1 -0
  67. package/dist/components/top-navbar/index.js +78 -2
  68. package/dist/echarts-Dla22xas.cjs +1 -0
  69. package/dist/{chunks/form-DirVyglJ.js → form-BNAbGCXe.js} +6860 -6794
  70. package/dist/form-DUL_O4IY.cjs +65 -0
  71. package/dist/hook/common.d.ts +65 -0
  72. package/dist/hook/detail.cjs +1 -0
  73. package/dist/hook/detail.d.ts +9 -15
  74. package/dist/hook/detail.js +1 -11
  75. package/dist/hook/fields.cjs +1 -0
  76. package/dist/hook/fields.d.ts +6 -14
  77. package/dist/hook/fields.js +1 -11
  78. package/dist/hook/import.d.ts +6 -11
  79. package/dist/hook/index.cjs +1 -0
  80. package/dist/hook/index.d.ts +28 -20
  81. package/dist/hook/index.js +13 -10
  82. package/dist/hook/update.cjs +1 -0
  83. package/dist/hook/update.d.ts +9 -17
  84. package/dist/hook/update.js +2 -2
  85. package/dist/index.cjs +1 -0
  86. package/dist/index.d.ts +16 -0
  87. package/dist/index.js +14 -11
  88. package/dist/meta-CXHXSPbq.cjs +1 -0
  89. package/dist/{chunks/meta-BkJxF49g.js → meta-Dhll5zt9.js} +45 -39
  90. package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
  91. package/dist/{chunks/sidebar-Dj4Xr9du.js → sidebar-CVORMKBY.js} +9 -12
  92. package/dist/sidebar-G5Ody16K.cjs +1 -0
  93. package/dist/{chunks/single-DfnwtW2f.js → single-CqD5cgNi.js} +353 -259
  94. package/dist/single-CsUaxEjQ.cjs +1 -0
  95. package/dist/style.cjs +0 -0
  96. package/dist/style.d.ts +0 -0
  97. package/dist/style.js +0 -0
  98. package/dist/types/Menu.d.ts +25 -0
  99. package/dist/utils/Common.d.ts +128 -16
  100. package/dist/utils/CusRoute.d.ts +21 -1
  101. package/dist/utils/Env.d.ts +23 -2
  102. package/dist/utils/Group.d.ts +12 -1
  103. package/dist/utils/Validator.d.ts +34 -12
  104. package/dist/utils/index.cjs +11 -0
  105. package/dist/utils/index.d.ts +2 -1
  106. package/dist/utils/index.js +188 -151
  107. package/package.json +190 -163
  108. package/dist/chunks/Common-C_ZhT4L6.js +0 -217
  109. package/dist/chunks/Env-DRXhvUcb.js +0 -16
  110. package/dist/chunks/UDragFile-CAiSfTsp.js +0 -92
  111. package/dist/chunks/loader-BUiOnhOH.js +0 -1
  112. package/dist/chunks/top-navbar-FBw88y_o.js +0 -78
  113. package/scripts/postinstall.cjs +0 -80
  114. /package/dist/{chunks/SortableItem-B4-Zsso3.js → SortableItem-B4-Zsso3.js} +0 -0
  115. /package/dist/{chunks/echarts-CRmndsxC.js → echarts-CRmndsxC.js} +0 -0
  116. /package/dist/{components/meta/Pdfviewer.d.ts → hook/import.cjs} +0 -0
@@ -1,20 +1,21 @@
1
- import { n as e, t } from "../chunks/Env-DRXhvUcb.js";
2
- import n from "sweetalert2";
3
- import r from "sweetalert2-react-content";
4
- import { Modal as i } from "bootstrap";
5
- import { format as a, isValid as o, parse as s } from "date-fns";
6
- import c from "decimal.js";
1
+ import { n as e, r as t, t as n } from "../Env-SHztUA3s.js";
2
+ import r from "sweetalert2";
3
+ import i from "sweetalert2-react-content";
4
+ import { Modal as a } from "bootstrap";
5
+ import { format as o, isValid as s, parse as c } from "date-fns";
6
+ import l from "decimal.js";
7
7
  //#region src/utils/Common.ts
8
- var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p = (e) => new Promise((t, n) => {
8
+ e();
9
+ var u = (e) => n()[e] ?? "", d = (e) => new Promise((t, n) => {
9
10
  if (document.querySelector(`script[src="${e}"]`)) {
10
11
  t();
11
12
  return;
12
13
  }
13
14
  let r = document.createElement("script");
14
15
  r.src = e, r.onload = () => t(), r.onerror = () => n(/* @__PURE__ */ Error(`Failed to load script ${e}`)), document.body.appendChild(r);
15
- }), m = async (e) => {
16
- for (let t of e) await p(t);
17
- }, ee = (e, t = !0) => {
16
+ }), ee = async (e) => {
17
+ for (let t of e) await d(t);
18
+ }, te = (e, t = !0) => {
18
19
  let n = typeof e == "string" ? document.querySelector(e) : e;
19
20
  if (n) {
20
21
  if (t) n.querySelector(".boxSpinner") || n.insertAdjacentHTML("afterbegin", "<div class=\"boxSpinner rounded\">\n <div class=\"spinner\">\n <div class=\"rect1\"></div>\n <div class=\"rect2\"></div>\n <div class=\"rect3\"></div>\n <div class=\"rect4\"></div>\n <div class=\"rect5\"></div>\n <div class=\"rect6\"></div>\n <div class=\"rect7\"></div>\n </div>\n </div>");
@@ -23,7 +24,7 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
23
24
  e && e.remove();
24
25
  }
25
26
  }
26
- }, h = (e) => {
27
+ }, f = (e) => {
27
28
  let t = new FormData();
28
29
  return Object.entries(e).forEach(([e, n]) => {
29
30
  if (n != null) {
@@ -54,28 +55,34 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
54
55
  t.append(e, n);
55
56
  }
56
57
  }), t;
57
- }, g = async (e, t = {}, n = "POST", r = "application/json") => {
58
+ }, p = class extends Error {
59
+ errorCode;
60
+ constructor(e, t) {
61
+ super(e), this.name = "ApiError", this.errorCode = t;
62
+ }
63
+ }, m = async (e, t = {}, n = "POST", r = "application/json") => {
58
64
  let i = {
59
65
  method: n,
60
66
  headers: {
61
67
  "Content-Type": r,
62
- "Secret-Key": l
68
+ "Secret-Key": u("SECRET_KEY")
63
69
  },
64
70
  credentials: "include"
65
71
  };
66
72
  n == "POST" && (i.body = JSON.stringify(t));
67
73
  let a = await (await fetch(e, i)).json();
68
74
  if (a.status == 200) return a;
69
- throw a.msg ? Error(a.msg) : Error("invalid_response");
70
- }, _ = async (e, t = {}, n = "POST", r = "application/json", i = !0) => {
71
- let a = { "Secret-Key": l };
75
+ throw a.msg ? new p(a.msg, a.errorCode ?? "unknown") : Error("invalid_response");
76
+ };
77
+ async function h(e, t = {}, n = "POST", r = "application/json", i = !0) {
78
+ let a = { "Secret-Key": u("SECRET_KEY") };
72
79
  r !== "multipart/form-data" && (a["Content-Type"] = r);
73
80
  let o = {
74
81
  method: n,
75
82
  headers: a,
76
83
  credentials: "include"
77
84
  };
78
- if (n == "POST" && (o.body = r === "multipart/form-data" ? h(t) : JSON.stringify(t)), n === "GET" && Object.keys(t).length > 0) {
85
+ if (n == "POST" && (o.body = r === "multipart/form-data" ? f(t) : JSON.stringify(t)), n === "GET" && Object.keys(t).length > 0) {
79
86
  let n = new URLSearchParams();
80
87
  Object.entries(t).forEach(([e, t]) => {
81
88
  Array.isArray(t) ? t.forEach((t) => n.append(e, String(t))) : n.append(e, String(t));
@@ -89,11 +96,12 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
89
96
  } catch {
90
97
  c = s;
91
98
  }
92
- if (c?.status == 200) return c;
93
- if (c?.msg && i) throw Error(c.msg);
99
+ if (c && typeof c != "string" && c.status == 200) return c;
100
+ if (c && typeof c != "string" && c.msg && i) throw new p(c.msg, c.errorCode ?? "unknown");
94
101
  if (i) throw Error("invalid_response");
95
102
  return !1;
96
- }, v = (e = "Bạn có chắc muốn thực hiện thao tác này ?", t = "Đồng ý") => r(n).fire({
103
+ }
104
+ var g = (e = "Bạn có chắc muốn thực hiện thao tác này ?", t = "Đồng ý") => i(r).fire({
97
105
  title: "Xác nhận",
98
106
  text: e,
99
107
  icon: "warning",
@@ -103,81 +111,70 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
103
111
  confirmButtonText: t,
104
112
  cancelButtonText: "Hủy",
105
113
  position: "top"
106
- }), te = (e, t = "top", i = !1) => {
107
- r(n).fire({
108
- toast: i,
114
+ }), ne = (e, t = "top", n = !1) => {
115
+ i(r).fire({
116
+ toast: n,
109
117
  icon: "success",
110
118
  position: t,
111
119
  title: e,
112
120
  showConfirmButton: !1,
113
121
  timer: 1500
114
122
  });
115
- }, ne = (e) => {
116
- r(n).fire({
123
+ }, re = (e) => {
124
+ i(r).fire({
117
125
  icon: "warning",
118
126
  title: e,
119
127
  showConfirmButton: !1,
120
128
  timer: 1500
121
129
  });
122
- }, y = (e) => {
123
- r(n).fire({
130
+ }, _ = (e) => {
131
+ i(r).fire({
124
132
  icon: "error",
125
133
  position: "top",
126
134
  title: e,
127
135
  showConfirmButton: !1
128
136
  });
129
- }, re = (e, t, n = "name") => {
137
+ }, ie = (e, t, n = "name") => {
130
138
  let r = t?.find((t) => t.id === e);
131
- return r ? r[n] : null;
132
- }, b = (e, t, n = "name") => e.map((e) => {
139
+ return r ? r[n] ?? null : null;
140
+ }, ae = (e, t, n = "name") => e.map((e) => {
133
141
  let r = t.find((t) => t.id === e);
134
142
  return r ? r[n] : null;
135
- }).filter(Boolean).join(", "), x = (e) => Array.isArray(e) ? e.map((e, t) => `<p class="mb-0"><a class="text-info" target="_blank" href="${z(e, "#")}" target="_blank">Tập tin ${t + 1}</a></p>`).filter(Boolean).join("") : "", S = (e, t = !1) => {
136
- let n = [{
137
- id: 1,
138
- name: "Kích hoạt",
139
- color: "success"
140
- }, {
141
- id: 0,
142
- name: "Khóa",
143
- color: "danger"
144
- }];
145
- if (e === !1) return n;
146
- let r = n.find((t) => t.id === e);
147
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
148
- }, C = (e, t = !1) => {
149
- let n = [{
150
- id: 1,
151
- name: "Xuất bản",
152
- color: "success"
153
- }, {
154
- id: 0,
155
- name: "Nháp",
156
- color: "danger"
157
- }];
158
- if (e === !1) return n;
159
- let r = n.find((t) => t.id === e);
160
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
161
- }, w = (e, t = !1) => {
162
- let n = [{
163
- id: 1,
164
- name: "Có",
165
- color: "success"
166
- }, {
167
- id: 0,
168
- name: "Không",
169
- color: "secondary"
170
- }];
171
- if (e === !1) return n;
172
- let r = n.find((t) => t.id === e);
173
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
174
- };
175
- function T(e) {
143
+ }).filter(Boolean).join(", "), oe = (e) => Array.isArray(e) ? e.map((e, t) => `<p class="mb-0"><a class="text-info" target="_blank" rel="noopener noreferrer" href="${W(R(e, "#"))}">Tập tin ${t + 1}</a></p>`).filter(Boolean).join("") : "", v = (e, t, n = !1) => {
144
+ if (e === !1) return t;
145
+ let r = t.find((t) => t.id === Number(e));
146
+ return r ? n ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
147
+ }, se = [{
148
+ id: 1,
149
+ name: "Kích hoạt",
150
+ color: "success"
151
+ }, {
152
+ id: 0,
153
+ name: "Khóa",
154
+ color: "danger"
155
+ }], ce = [{
156
+ id: 1,
157
+ name: "Xuất bản",
158
+ color: "success"
159
+ }, {
160
+ id: 0,
161
+ name: "Nháp",
162
+ color: "danger"
163
+ }], y = [{
164
+ id: 1,
165
+ name: "Có",
166
+ color: "success"
167
+ }, {
168
+ id: 0,
169
+ name: "Không",
170
+ color: "secondary"
171
+ }], b = (e, t = !1) => v(e, se, t), x = (e, t = !1) => v(e, ce, t), S = (e, t = !1) => v(e, y, t);
172
+ function C(e) {
176
173
  let t = e instanceof Date ? e : new Date(e);
177
174
  if (isNaN(t.getTime())) throw Error("Ngày không hợp lệ: " + e);
178
175
  return t;
179
176
  }
180
- function E(e) {
177
+ function w(e) {
181
178
  if (!e) return /* @__PURE__ */ new Date();
182
179
  if (e instanceof Date) return new Date(e);
183
180
  let t = e.trim().toLowerCase();
@@ -223,44 +220,52 @@ function E(e) {
223
220
  if (!isNaN(i.getTime())) return i;
224
221
  throw Error(`Invalid date expression: ${e}`);
225
222
  }
226
- var D = (e) => {
227
- if (!e) return "";
223
+ var T = (e) => {
224
+ if (!e) return null;
228
225
  let t = new Date(e);
229
- return isNaN(t.getTime()) ? "Invalid Date" : `${String(t.getDate()).padStart(2, "0")}/${String(t.getMonth() + 1).padStart(2, "0")}/${t.getFullYear()} ${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}`;
226
+ return isNaN(t.getTime()) ? null : {
227
+ dd: String(t.getDate()).padStart(2, "0"),
228
+ MM: String(t.getMonth() + 1).padStart(2, "0"),
229
+ yyyy: t.getFullYear(),
230
+ hh: String(t.getHours()).padStart(2, "0"),
231
+ mm: String(t.getMinutes()).padStart(2, "0"),
232
+ ss: String(t.getSeconds()).padStart(2, "0")
233
+ };
234
+ }, E = (e) => {
235
+ let t = T(e);
236
+ return t ? `${t.dd}/${t.MM}/${t.yyyy} ${t.hh}:${t.mm}:${t.ss}` : e ? "Invalid Date" : "";
237
+ }, D = (e) => {
238
+ let t = T(e);
239
+ return t ? `${t.dd}/${t.MM}/${t.yyyy}` : e ? "Invalid Date" : "";
230
240
  }, O = (e) => {
231
- if (!e) return "";
232
- let t = new Date(e);
233
- return isNaN(t.getTime()) ? "Invalid Date" : `${String(t.getDate()).padStart(2, "0")}/${String(t.getMonth() + 1).padStart(2, "0")}/${t.getFullYear()}`;
241
+ let t = T(e);
242
+ return t ? `${t.yyyy}` : e ? "Invalid Date" : "";
234
243
  }, k = (e) => {
235
- if (!e) return "";
236
- let t = new Date(e);
237
- return isNaN(t.getTime()) ? "Invalid Date" : `${t.getFullYear()}`;
244
+ let t = T(e);
245
+ return t ? `${t.yyyy}-${t.MM}-${t.dd}` : e ? "Invalid Date" : "";
238
246
  }, A = (e) => {
239
- if (!e) return "";
240
- let t = new Date(e);
241
- if (isNaN(t.getTime())) return "Invalid Date";
242
- let n = String(t.getDate()).padStart(2, "0"), r = String(t.getMonth() + 1).padStart(2, "0");
243
- return `${t.getFullYear()}-${r}-${n}`;
244
- }, j = (e = null) => {
245
247
  let t = new URLSearchParams(window.location.search);
246
248
  return e ? Array.isArray(e) ? e.reduce((e, n) => (e[n] = t.get(n), e), {}) : t.get(e) : Object.fromEntries(t.entries());
247
- }, M = (e) => {
249
+ }, j = (e) => {
248
250
  let t = new URLSearchParams(window.location.search);
249
251
  return Object.entries(e).forEach(([e, n]) => {
250
252
  n === null ? t.delete(e) : t.set(e, n);
251
253
  }), t.toString();
252
- }, N = (e) => {
254
+ }, M = (e) => {
253
255
  let t = new URLSearchParams();
254
256
  return Object.entries(e).forEach(([e, n]) => {
255
257
  Array.isArray(n) ? n.forEach((n) => {
256
258
  n != null && t.append(e, String(n));
257
259
  }) : n != null && t.set(e, String(n));
258
260
  }), t.toString();
259
- }, P = () => {
260
- let e = window.location.pathname.match(/\/(\d+)(\/)?$/);
261
- return e ? Number(e[1]) : null;
262
- }, F = (e, t = "/styles/default.jpg") => e ? u + ("/" + e).replaceAll("//", "/") : t, I = (e) => e ? u + ("/" + e).replaceAll("//", "/") : "", L = (e, t = "/styles/default.jpg") => e ? d + ("/" + e).replaceAll("//", "/") : t, R = (e, t = "/styles/default.jpg") => e ? f + "/" + e : t, z = (e, t = "/styles/default.jpg") => e ? f + "/" + e : t;
263
- function ie(e) {
261
+ }, N = (e = typeof window < "u" ? window.location.pathname : "", t = /\/(?:edit|detail|update)\/(\d+)(?=\/|$)/i) => {
262
+ let n = new RegExp(t.source, t.flags.includes("g") ? t.flags : t.flags + "g"), r = null, i;
263
+ for (; (i = n.exec(e)) !== null;) r = i;
264
+ if (!r) return null;
265
+ let a = Number(r[1]);
266
+ return Number.isFinite(a) ? a : null;
267
+ }, P = (e, t = "/styles/default.jpg") => e ? u("STATIC_URL") + ("/" + e).replaceAll("//", "/") : t, F = (e) => e ? u("STATIC_URL") + ("/" + e).replaceAll("//", "/") : "", I = (e, t = "/styles/default.jpg") => e ? u("API_URL") + ("/" + e).replaceAll("//", "/") : t, L = (e, t = "/styles/default.jpg") => e ? u("UPLOADS_URL") + "/" + e : t, R = (e, t = "/styles/default.jpg") => e ? u("UPLOADS_URL") + "/" + e : t;
268
+ function z(e) {
264
269
  let t = "";
265
270
  for (let n = 0; n < e; n++) {
266
271
  let e = Math.floor(Math.random() * 62);
@@ -271,19 +276,42 @@ function ie(e) {
271
276
  function B(e) {
272
277
  return new DOMParser().parseFromString(e, "text/html").body.textContent || "";
273
278
  }
274
- var V = (e, t = 20, n = !1) => new Promise((r) => {
275
- for (let r = 0; r < e.length; r++) if (e[r] !== void 0) {
276
- if (n.test(e[r].name)) {
277
- if (e[r].size >= t * 1024 * 1024) return y(`Tập tin tải lên không quá ${t}M`), !1;
278
- } else return y("Tập tin không hợp lệ"), !1;
279
- } else return y("Tập tin không tồn tại"), !1;
280
- r(void 0);
281
- }), H = (e = "", t = "danger") => {
282
- let n = "";
283
- if (typeof e == "string") return e.trim() === "" ? "" : `<div class="alert alert-${t}">${e}</div>`;
284
- for (let r in e) n += `<div class="alert alert-${t}">${e[r]}</div>`;
285
- return n;
286
- }, U = (e) => (e.querySelectorAll("input:not([type=\"hidden\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not(.noReset), textarea").forEach((e) => {
279
+ var V = /\.(jpg|jpeg|png|jfif|doc|docx|xls|xlsx|pdf)$/i, H = (e, t) => {
280
+ if (!e) return t;
281
+ let n = e.split(",").map((e) => {
282
+ let t = e.trim();
283
+ return (t.includes("/") ? t.slice(t.indexOf("/") + 1) : t).replace(/^\./, "");
284
+ }).filter(Boolean);
285
+ if (n.length === 0) return t;
286
+ let r = n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
287
+ return RegExp(`\\.(${r.join("|")})$`, "i");
288
+ }, le = (e, t = 20, n = V) => new Promise((r, i) => {
289
+ let a = Array.from(e ?? []);
290
+ if (a.length === 0) return i(/* @__PURE__ */ Error("Tập tin không tồn tại"));
291
+ for (let e of a) {
292
+ if (!n.test(e.name)) return _("Tập tin không hợp lệ"), i(/* @__PURE__ */ Error("Tập tin không hợp lệ"));
293
+ if (e.size > t * 1024 * 1024) return _(`Tập tin tải lên không quá ${t}M`), i(/* @__PURE__ */ Error(`Tập tin tải lên không quá ${t}M`));
294
+ }
295
+ r();
296
+ }), U = {
297
+ "&": "&amp;",
298
+ "<": "&lt;",
299
+ ">": "&gt;",
300
+ "\"": "&quot;",
301
+ "'": "&#39;"
302
+ }, W = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => U[e]), ue = /* @__PURE__ */ new Set([
303
+ "danger",
304
+ "success",
305
+ "warning",
306
+ "info",
307
+ "primary",
308
+ "secondary",
309
+ "light",
310
+ "dark"
311
+ ]), de = (e = "", t = "danger", n = {}) => {
312
+ let r = ue.has(t) ? t : "danger", i = (e) => n.raw ? e : W(e);
313
+ return typeof e == "string" ? e.trim() === "" ? "" : `<div class="alert alert-${r}">${i(e)}</div>` : !e || typeof e != "object" ? "" : Object.values(e).filter((e) => e != null && String(e).trim() !== "").map((e) => `<div class="alert alert-${r}">${i(String(e))}</div>`).join("");
314
+ }, fe = (e) => (e.querySelectorAll("input:not([type=\"hidden\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not(.noReset), textarea").forEach((e) => {
287
315
  e.value = "", e.dispatchEvent(new Event("change", { bubbles: !0 }));
288
316
  }), e.querySelectorAll("select:not(.noReset)").forEach((e) => {
289
317
  let t = e.querySelector("option[value=\"\"]");
@@ -292,23 +320,23 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
292
320
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
293
321
  }), e.querySelectorAll("input[type=\"radio\"]:not(.noReset)").forEach((e) => {
294
322
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
295
- }), e), W = async (e, t, n = !1) => {
323
+ }), e), pe = async (e, t, n = !1) => {
296
324
  try {
297
325
  for (let r in t) {
298
- let i = `[name="${r}"]:not([type="file"])`, c = e.querySelector(i);
299
- if (!c) continue;
300
- let l = c.type;
326
+ let i = `[name="${r}"]:not([type="file"])`, a = e.querySelector(i);
327
+ if (!a) continue;
328
+ let l = a.type;
301
329
  if (t[r] && !["checkbox", "radio"].includes(l)) {
302
- let e = s(t[r], "yyyy-MM-dd", /* @__PURE__ */ new Date()), n = s(t[r], "yyyy-MM-dd HH:mm:ss", /* @__PURE__ */ new Date());
303
- c.value = o(e) && t[r].length === 10 ? a(e, "dd/MM/yyyy") : o(n) && t[r].length === 19 ? a(n, "dd/MM/yyyy HH:mm") : t[r], c.dispatchEvent(new Event("change", { bubbles: !0 }));
304
- } else if (l === "checkbox") c.checked = !!parseInt(t[r]), c.dispatchEvent(new Event("change", { bubbles: !0 }));
330
+ let e = c(t[r], "yyyy-MM-dd", /* @__PURE__ */ new Date()), n = c(t[r], "yyyy-MM-dd HH:mm:ss", /* @__PURE__ */ new Date());
331
+ a.value = s(e) && t[r].length === 10 ? o(e, "dd/MM/yyyy") : s(n) && t[r].length === 19 ? o(n, "dd/MM/yyyy HH:mm") : t[r], a.dispatchEvent(new Event("change", { bubbles: !0 }));
332
+ } else if (l === "checkbox") a.checked = !!parseInt(t[r]), a.dispatchEvent(new Event("change", { bubbles: !0 }));
305
333
  else if (l === "radio") {
306
334
  let n = e.querySelectorAll(`input[type="radio"][name="${r}"]`);
307
335
  n.forEach((e) => {
308
336
  e.checked = e.value === String(parseInt(t[r]));
309
337
  }), n.forEach((e) => e.dispatchEvent(new Event("change", { bubbles: !0 })));
310
338
  } else if (n) {
311
- let e = c.closest(".form-group");
339
+ let e = a.closest(".form-group");
312
340
  e && e.classList.add("hidden");
313
341
  }
314
342
  }
@@ -321,7 +349,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
321
349
  let r = window.jQuery, i = r(e);
322
350
  if (!i.length) throw Error("invalid_elfinder");
323
351
  let a = {
324
- url: d + "/elfinder/connector",
352
+ url: u("API_URL") + "/elfinder/connector",
325
353
  height: 500,
326
354
  resizable: !0,
327
355
  baseUrl: "/assets/plugins/elFinder/",
@@ -347,7 +375,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
347
375
  r.hide();
348
376
  });
349
377
  });
350
- let r = i.getOrCreateInstance(n, {
378
+ let r = a.getOrCreateInstance(n, {
351
379
  backdrop: "static",
352
380
  keyboard: !1
353
381
  });
@@ -358,7 +386,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
358
386
  } catch (e) {
359
387
  console.log(e), n(e);
360
388
  }
361
- }), q = (e, t, n = !1, r = !1) => {
389
+ }), me = (e, t, n = !1, r = !1) => {
362
390
  if (!e) throw Error("invalid_btnEl");
363
391
  e.addEventListener("click", (i) => {
364
392
  i.preventDefault(), K(t).then((t) => {
@@ -374,12 +402,12 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
374
402
  }), a.show();
375
403
  });
376
404
  });
377
- }, J = (e, t, n = !1, r = !1) => {
405
+ }, he = (e, t, n = !1, r = !1) => {
378
406
  if (!e) throw Error("invalid_btnEl");
379
407
  e.addEventListener("click", (i) => {
380
408
  i.preventDefault(), K(t).then((t) => {
381
409
  let { modalEl: i, md: a } = t;
382
- G("#elfinderStatic", { url: d + "/elfinder/connectorFiles" }).then((t) => {
410
+ G("#elfinderStatic", { url: u("API_URL") + "/elfinder/connectorFiles" }).then((t) => {
383
411
  n && n({
384
412
  data: t,
385
413
  btnEl: e,
@@ -390,12 +418,12 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
390
418
  }), a.show();
391
419
  });
392
420
  });
393
- }, Y = (e) => {
394
- if (typeof e == "string" && (e = X(e, [])), !Array.isArray(e)) return [];
421
+ }, q = (e) => {
422
+ if (typeof e == "string" && (e = J(e, [])), !Array.isArray(e)) return [];
395
423
  let t = e.map((e) => Number(e));
396
424
  return t = t.filter((e) => !Number.isNaN(e)), [...new Set(t)];
397
425
  };
398
- function X(e, t = {}, n = "ids") {
426
+ function J(e, t = {}, n = "ids") {
399
427
  let r = t;
400
428
  if (Array.isArray(e) && (r = e), typeof e == "object" && e && (r = e), typeof e == "number") return t;
401
429
  if (typeof e == "string") try {
@@ -404,13 +432,13 @@ function X(e, t = {}, n = "ids") {
404
432
  } catch {
405
433
  return t;
406
434
  }
407
- return n === "ids" && (r = Y(r)), r;
435
+ return n === "ids" && (r = q(r)), r;
408
436
  }
409
- var ae = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, oe = (e) => {
410
- if (!e) return new c(0);
437
+ var ge = (e, t = {}, n = "vi-VN") => e == null || Number.isNaN(e) ? "0" : e.toLocaleString(n, t), _e = (e) => {
438
+ if (!e) return new l(0);
411
439
  let t = String(e).replace(/[^\d.]/g, "");
412
- return t ? new c(t) : new c(0);
413
- }, se = (e, t) => [...new Set(e.map((e) => e[t]))], ce = (e, t, n, r, i) => {
440
+ return t ? new l(t) : new l(0);
441
+ }, ve = (e, t) => [...new Set(e.map((e) => e[t]))], ye = (e, t, n, r, i) => {
414
442
  let a = e.length, o = [];
415
443
  for (let s = 0; s < a; s++) {
416
444
  let a = t.find((t) => t[r] === e[s]);
@@ -420,34 +448,34 @@ var ae = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, oe = (e) =
420
448
  });
421
449
  }
422
450
  return o;
423
- }, Z = (e, t) => e.map((e) => {
451
+ }, be = (e, t) => e.map((e) => {
424
452
  let n = {};
425
453
  for (let r in t) {
426
454
  let i = t[r];
427
455
  typeof i == "string" ? n[r] = e[i] : typeof i == "function" && (n[r] = i(e));
428
456
  }
429
457
  return n;
430
- }), le = (e, t, n = !1) => {
458
+ }), xe = (e, t, n = !1) => {
431
459
  if (t.split("-").map(Number).includes(e)) return !0;
432
460
  if (n) throw Error("invalid_status");
433
461
  return !1;
434
462
  };
435
- function ue(e, t) {
463
+ function Se(e, t) {
436
464
  return e?.reduce((e, n) => e + (n[t] ?? 0), 0) || 0;
437
465
  }
438
- var de = (e) => {
466
+ var Ce = (e) => {
439
467
  switch (e) {
440
468
  case 3: return "tháng " + ((/* @__PURE__ */ new Date()).getMonth() + 1);
441
469
  case 4: return "năm " + (/* @__PURE__ */ new Date()).getFullYear();
442
470
  }
443
471
  return "";
444
- }, fe = (e = !1) => {
472
+ }, we = (e = !1) => {
445
473
  let t = [{
446
474
  id: 1,
447
475
  name: "Tiếng Việt"
448
476
  }];
449
477
  return e === !1 ? t : t.find((t) => t.id === e)?.name || "";
450
- }, pe = class {
478
+ }, Y = class {
451
479
  routes = [];
452
480
  async addGS(e, t, n, r = !1, i = !1, a = !1, o = !1) {
453
481
  let s = {
@@ -484,15 +512,24 @@ var de = (e) => {
484
512
  getRouter() {
485
513
  return this.routes;
486
514
  }
487
- }, Q = (e, t, n, r, i, a) => {
515
+ }, X = (e, t, n, r, i, a) => {
488
516
  if (!a) return !1;
489
- if (a == 1) return !0;
490
- for (let o of e) {
491
- if (o.module == t && o.controller == n && o.action == r && o.code == i && o.status !== 1) return o.isPer;
492
- if (o.subs && o.subs.length > 0 && !Q(o.subs, t, n, r, i, a)) return !1;
517
+ if (a === 1) return !0;
518
+ if (!Array.isArray(e)) return !1;
519
+ for (let o of e) if (o) {
520
+ if (o.module === t && o.controller === n && o.action === r && Number(o.code) === Number(i)) return o.status !== 0 && !!o.isPer;
521
+ if (Array.isArray(o.subs) && o.subs.length > 0 && X(o.subs, t, n, r, i, a)) return !0;
493
522
  }
494
- return !0;
495
- }, $ = window.jQuery, me = class e {
523
+ return !1;
524
+ }, Z = null, Q = () => {
525
+ if (Z) return Z;
526
+ let e = typeof window < "u" ? window.jQuery ?? window.$ : void 0;
527
+ if (typeof e != "function") throw Error("[@materialui-reactjs/admin] Validator cần jQuery. Hãy thêm \"jquery\" vào dependencies và nạp nó TRƯỚC khi dùng Validator.");
528
+ return Z = e, Z;
529
+ }, $ = new Proxy((() => {}), {
530
+ apply: (e, t, n) => Q()(...n),
531
+ get: (e, t) => Q()[t]
532
+ }), Te = class e {
496
533
  options;
497
534
  validators;
498
535
  $element;
@@ -588,26 +625,26 @@ var de = (e) => {
588
625
  });
589
626
  };
590
627
  runValidators = (t) => {
591
- let n = [], r = $.Deferred();
592
- t.data("bs.validator.deferred") && t.data("bs.validator.deferred").reject(), t.data("bs.validator.deferred", r);
593
- function i(e) {
628
+ let n = [], r = $.Deferred(), i = t.data("bs.validator.deferred");
629
+ i && i.reject(), t.data("bs.validator.deferred", r);
630
+ function a(e) {
594
631
  return t.attr("data-" + e + "-error");
595
632
  }
596
- function a() {
633
+ function o() {
597
634
  let e = t[0];
598
635
  if (!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement)) return null;
599
636
  let n = e.validity;
600
637
  return n.typeMismatch ? t.attr("data-type-error") ?? null : n.patternMismatch ? t.attr("data-pattern-error") ?? null : n.stepMismatch ? t.attr("data-step-error") ?? null : n.rangeOverflow ? t.attr("data-max-error") ?? null : n.rangeUnderflow ? t.attr("data-min-error") ?? null : n.valueMissing ? t.attr("data-required-error") ?? null : null;
601
638
  }
602
- function o() {
639
+ function s() {
603
640
  return t.attr("data-error");
604
641
  }
605
- function s(e) {
606
- return i(e) || a() || o();
642
+ function c(e) {
643
+ return a(e) || o() || s();
607
644
  }
608
645
  return $.each(this.validators, $.proxy(function(r, i) {
609
- let a = null;
610
- (e.getValue(t) || t.attr("required")) && (t.attr("data-" + r) !== void 0 || r == "native") && (a = i.call(this, t)) && (a = s(r) || a, !~n.indexOf(a) && n.push(a));
646
+ let a;
647
+ (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) === -1 && n.push(a));
611
648
  }, this)), r.resolve(n), r.promise();
612
649
  };
613
650
  validate = () => {
@@ -668,4 +705,4 @@ var de = (e) => {
668
705
  };
669
706
  };
670
707
  //#endregion
671
- export { pe as CusRoute, me as Validator, h as buildFormData, g as callFetchApi, _ as callFetchApiToken, Q as checkPermission, V as checkUploadFile, K as createModal, N as createQueryString, oe as decimalNumber, G as elFinderPopup, Y as filterIds, O as formatDate, A as formatDateSql, D as formatDateTime, ae as formatNumber, k as formatYear, S as getActiveStatus, t as getEnv, I as getFile, de as getFilterType, P as getIdParams, F as getImage, fe as getLangs, x as getLinkFiles, re as getName, b as getNames, j as getParams, L as getPubImage, C as getPublishStatus, w as getTrueFlaseStatus, z as getUploadFile, R as getUploadImage, B as htmlToText, le as isStsNum, e as loadEnv, p as loadScript, m as loadScripts, Z as mapArrData, se as mapArrFields, W as mapDataForm, ce as mergeArrObject, T as parseDate, ie as randomString, U as resetForm, M as setParams, J as showFinderFileModal, q as showFinderModal, H as showMessage, v as showSweetAlert, y as showSweetAlertError, te as showSweetAlertOk, ne as showSweetAlertWarning, ee as spinnerLoader, E as strToDate, X as stringToJson, ue as sumArrCol };
708
+ export { p as ApiError, Y as CusRoute, Te as Validator, H as buildAcceptRegExp, f as buildFormData, m as callFetchApi, h as callFetchApiToken, X as checkPermission, le as checkUploadFile, K as createModal, M as createQueryString, _e as decimalNumber, G as elFinderPopup, W as escapeHtml, q as filterIds, D as formatDate, k as formatDateSql, E as formatDateTime, ge as formatNumber, O as formatYear, b as getActiveStatus, n as getEnv, F as getFile, Ce as getFilterType, N as getIdParams, P as getImage, we as getLangs, oe as getLinkFiles, ie as getName, ae as getNames, A as getParams, I as getPubImage, x as getPublishStatus, v as getStatus, S as getTrueFlaseStatus, R as getUploadFile, L as getUploadImage, B as htmlToText, xe as isStsNum, e as loadEnv, d as loadScript, ee as loadScripts, be as mapArrData, ve as mapArrFields, pe as mapDataForm, ye as mergeArrObject, C as parseDate, z as randomString, t as reloadEnv, fe as resetForm, j as setParams, he as showFinderFileModal, me as showFinderModal, de as showMessage, g as showSweetAlert, _ as showSweetAlertError, ne as showSweetAlertOk, re as showSweetAlertWarning, te as spinnerLoader, w as strToDate, J as stringToJson, Se as sumArrCol };