@materialui-reactjs/admin 1.0.6 → 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-DuS-gHNR.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-CPkpL5eA.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-4qPWijBT.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-CRF61o_U.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 +124 -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 +181 -149
  107. package/package.json +190 -163
  108. package/dist/chunks/Common-BURf0rBN.js +0 -222
  109. package/dist/chunks/Env-DRXhvUcb.js +0 -16
  110. package/dist/chunks/UDragFile-BnUR3riq.js +0 -92
  111. package/dist/chunks/loader-BUiOnhOH.js +0 -1
  112. package/dist/chunks/top-navbar-Bob0gMUh.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,11 +1,12 @@
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;
@@ -13,8 +14,8 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
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
16
  }), ee = async (e) => {
16
- for (let t of e) await p(t);
17
- }, m = (e, t = !0) => {
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,33 +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 = class extends Error {
58
+ }, p = class extends Error {
58
59
  errorCode;
59
60
  constructor(e, t) {
60
61
  super(e), this.name = "ApiError", this.errorCode = t;
61
62
  }
62
- }, _ = async (e, t = {}, n = "POST", r = "application/json") => {
63
+ }, m = async (e, t = {}, n = "POST", r = "application/json") => {
63
64
  let i = {
64
65
  method: n,
65
66
  headers: {
66
67
  "Content-Type": r,
67
- "Secret-Key": l
68
+ "Secret-Key": u("SECRET_KEY")
68
69
  },
69
70
  credentials: "include"
70
71
  };
71
72
  n == "POST" && (i.body = JSON.stringify(t));
72
73
  let a = await (await fetch(e, i)).json();
73
74
  if (a.status == 200) return a;
74
- throw a.msg ? new g(a.msg, a.errorCode) : Error("invalid_response");
75
- }, v = async (e, t = {}, n = "POST", r = "application/json", i = !0) => {
76
- 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") };
77
79
  r !== "multipart/form-data" && (a["Content-Type"] = r);
78
80
  let o = {
79
81
  method: n,
80
82
  headers: a,
81
83
  credentials: "include"
82
84
  };
83
- 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) {
84
86
  let n = new URLSearchParams();
85
87
  Object.entries(t).forEach(([e, t]) => {
86
88
  Array.isArray(t) ? t.forEach((t) => n.append(e, String(t))) : n.append(e, String(t));
@@ -94,11 +96,12 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
94
96
  } catch {
95
97
  c = s;
96
98
  }
97
- if (c?.status == 200) return c;
98
- if (c?.msg && i) throw new g(c.msg, c.errorCode);
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");
99
101
  if (i) throw Error("invalid_response");
100
102
  return !1;
101
- }, te = (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({
102
105
  title: "Xác nhận",
103
106
  text: e,
104
107
  icon: "warning",
@@ -108,9 +111,9 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
108
111
  confirmButtonText: t,
109
112
  cancelButtonText: "Hủy",
110
113
  position: "top"
111
- }), ne = (e, t = "top", i = !1) => {
112
- r(n).fire({
113
- toast: i,
114
+ }), ne = (e, t = "top", n = !1) => {
115
+ i(r).fire({
116
+ toast: n,
114
117
  icon: "success",
115
118
  position: t,
116
119
  title: e,
@@ -118,14 +121,14 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
118
121
  timer: 1500
119
122
  });
120
123
  }, re = (e) => {
121
- r(n).fire({
124
+ i(r).fire({
122
125
  icon: "warning",
123
126
  title: e,
124
127
  showConfirmButton: !1,
125
128
  timer: 1500
126
129
  });
127
- }, y = (e) => {
128
- r(n).fire({
130
+ }, _ = (e) => {
131
+ i(r).fire({
129
132
  icon: "error",
130
133
  position: "top",
131
134
  title: e,
@@ -133,56 +136,45 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
133
136
  });
134
137
  }, ie = (e, t, n = "name") => {
135
138
  let r = t?.find((t) => t.id === e);
136
- return r ? r[n] : null;
137
- }, b = (e, t, n = "name") => e.map((e) => {
139
+ return r ? r[n] ?? null : null;
140
+ }, ae = (e, t, n = "name") => e.map((e) => {
138
141
  let r = t.find((t) => t.id === e);
139
142
  return r ? r[n] : null;
140
- }).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) => {
141
- let n = [{
142
- id: 1,
143
- name: "Kích hoạt",
144
- color: "success"
145
- }, {
146
- id: 0,
147
- name: "Khóa",
148
- color: "danger"
149
- }];
150
- if (e === !1) return n;
151
- let r = n.find((t) => t.id === e);
152
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
153
- }, C = (e, t = !1) => {
154
- let n = [{
155
- id: 1,
156
- name: "Xuất bản",
157
- color: "success"
158
- }, {
159
- id: 0,
160
- name: "Nháp",
161
- color: "danger"
162
- }];
163
- if (e === !1) return n;
164
- let r = n.find((t) => t.id === e);
165
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
166
- }, w = (e, t = !1) => {
167
- let n = [{
168
- id: 1,
169
- name: "Có",
170
- color: "success"
171
- }, {
172
- id: 0,
173
- name: "Không",
174
- color: "secondary"
175
- }];
176
- if (e === !1) return n;
177
- let r = n.find((t) => t.id === e);
178
- return r ? t ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
179
- };
180
- 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) {
181
173
  let t = e instanceof Date ? e : new Date(e);
182
174
  if (isNaN(t.getTime())) throw Error("Ngày không hợp lệ: " + e);
183
175
  return t;
184
176
  }
185
- function E(e) {
177
+ function w(e) {
186
178
  if (!e) return /* @__PURE__ */ new Date();
187
179
  if (e instanceof Date) return new Date(e);
188
180
  let t = e.trim().toLowerCase();
@@ -228,44 +220,52 @@ function E(e) {
228
220
  if (!isNaN(i.getTime())) return i;
229
221
  throw Error(`Invalid date expression: ${e}`);
230
222
  }
231
- var D = (e) => {
232
- if (!e) return "";
223
+ var T = (e) => {
224
+ if (!e) return null;
233
225
  let t = new Date(e);
234
- 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" : "";
235
240
  }, O = (e) => {
236
- if (!e) return "";
237
- let t = new Date(e);
238
- 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" : "";
239
243
  }, k = (e) => {
240
- if (!e) return "";
241
- let t = new Date(e);
242
- 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" : "";
243
246
  }, A = (e) => {
244
- if (!e) return "";
245
- let t = new Date(e);
246
- if (isNaN(t.getTime())) return "Invalid Date";
247
- let n = String(t.getDate()).padStart(2, "0"), r = String(t.getMonth() + 1).padStart(2, "0");
248
- return `${t.getFullYear()}-${r}-${n}`;
249
- }, j = (e = null) => {
250
247
  let t = new URLSearchParams(window.location.search);
251
248
  return e ? Array.isArray(e) ? e.reduce((e, n) => (e[n] = t.get(n), e), {}) : t.get(e) : Object.fromEntries(t.entries());
252
- }, M = (e) => {
249
+ }, j = (e) => {
253
250
  let t = new URLSearchParams(window.location.search);
254
251
  return Object.entries(e).forEach(([e, n]) => {
255
252
  n === null ? t.delete(e) : t.set(e, n);
256
253
  }), t.toString();
257
- }, N = (e) => {
254
+ }, M = (e) => {
258
255
  let t = new URLSearchParams();
259
256
  return Object.entries(e).forEach(([e, n]) => {
260
257
  Array.isArray(n) ? n.forEach((n) => {
261
258
  n != null && t.append(e, String(n));
262
259
  }) : n != null && t.set(e, String(n));
263
260
  }), t.toString();
264
- }, P = () => {
265
- let e = window.location.pathname.match(/\/(\d+)(\/)?$/);
266
- return e ? Number(e[1]) : null;
267
- }, 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;
268
- function ae(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) {
269
269
  let t = "";
270
270
  for (let n = 0; n < e; n++) {
271
271
  let e = Math.floor(Math.random() * 62);
@@ -276,19 +276,42 @@ function ae(e) {
276
276
  function B(e) {
277
277
  return new DOMParser().parseFromString(e, "text/html").body.textContent || "";
278
278
  }
279
- var V = (e, t = 20, n = !1) => new Promise((r) => {
280
- for (let r = 0; r < e.length; r++) if (e[r] !== void 0) {
281
- if (n.test(e[r].name)) {
282
- if (e[r].size >= t * 1024 * 1024) return y(`Tập tin tải lên không quá ${t}M`), !1;
283
- } else return y("Tập tin không hợp lệ"), !1;
284
- } else return y("Tập tin không tồn tại"), !1;
285
- r(void 0);
286
- }), H = (e = "", t = "danger") => {
287
- let n = "";
288
- if (typeof e == "string") return e.trim() === "" ? "" : `<div class="alert alert-${t}">${e}</div>`;
289
- for (let r in e) n += `<div class="alert alert-${t}">${e[r]}</div>`;
290
- return n;
291
- }, 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) => {
292
315
  e.value = "", e.dispatchEvent(new Event("change", { bubbles: !0 }));
293
316
  }), e.querySelectorAll("select:not(.noReset)").forEach((e) => {
294
317
  let t = e.querySelector("option[value=\"\"]");
@@ -297,23 +320,23 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
297
320
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
298
321
  }), e.querySelectorAll("input[type=\"radio\"]:not(.noReset)").forEach((e) => {
299
322
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
300
- }), e), W = async (e, t, n = !1) => {
323
+ }), e), pe = async (e, t, n = !1) => {
301
324
  try {
302
325
  for (let r in t) {
303
- let i = `[name="${r}"]:not([type="file"])`, c = e.querySelector(i);
304
- if (!c) continue;
305
- 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;
306
329
  if (t[r] && !["checkbox", "radio"].includes(l)) {
307
- let e = s(t[r], "yyyy-MM-dd", /* @__PURE__ */ new Date()), n = s(t[r], "yyyy-MM-dd HH:mm:ss", /* @__PURE__ */ new Date());
308
- 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 }));
309
- } 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 }));
310
333
  else if (l === "radio") {
311
334
  let n = e.querySelectorAll(`input[type="radio"][name="${r}"]`);
312
335
  n.forEach((e) => {
313
336
  e.checked = e.value === String(parseInt(t[r]));
314
337
  }), n.forEach((e) => e.dispatchEvent(new Event("change", { bubbles: !0 })));
315
338
  } else if (n) {
316
- let e = c.closest(".form-group");
339
+ let e = a.closest(".form-group");
317
340
  e && e.classList.add("hidden");
318
341
  }
319
342
  }
@@ -326,7 +349,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
326
349
  let r = window.jQuery, i = r(e);
327
350
  if (!i.length) throw Error("invalid_elfinder");
328
351
  let a = {
329
- url: d + "/elfinder/connector",
352
+ url: u("API_URL") + "/elfinder/connector",
330
353
  height: 500,
331
354
  resizable: !0,
332
355
  baseUrl: "/assets/plugins/elFinder/",
@@ -352,7 +375,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
352
375
  r.hide();
353
376
  });
354
377
  });
355
- let r = i.getOrCreateInstance(n, {
378
+ let r = a.getOrCreateInstance(n, {
356
379
  backdrop: "static",
357
380
  keyboard: !1
358
381
  });
@@ -363,7 +386,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
363
386
  } catch (e) {
364
387
  console.log(e), n(e);
365
388
  }
366
- }), q = (e, t, n = !1, r = !1) => {
389
+ }), me = (e, t, n = !1, r = !1) => {
367
390
  if (!e) throw Error("invalid_btnEl");
368
391
  e.addEventListener("click", (i) => {
369
392
  i.preventDefault(), K(t).then((t) => {
@@ -379,12 +402,12 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
379
402
  }), a.show();
380
403
  });
381
404
  });
382
- }, J = (e, t, n = !1, r = !1) => {
405
+ }, he = (e, t, n = !1, r = !1) => {
383
406
  if (!e) throw Error("invalid_btnEl");
384
407
  e.addEventListener("click", (i) => {
385
408
  i.preventDefault(), K(t).then((t) => {
386
409
  let { modalEl: i, md: a } = t;
387
- G("#elfinderStatic", { url: d + "/elfinder/connectorFiles" }).then((t) => {
410
+ G("#elfinderStatic", { url: u("API_URL") + "/elfinder/connectorFiles" }).then((t) => {
388
411
  n && n({
389
412
  data: t,
390
413
  btnEl: e,
@@ -395,12 +418,12 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
395
418
  }), a.show();
396
419
  });
397
420
  });
398
- }, Y = (e) => {
399
- 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 [];
400
423
  let t = e.map((e) => Number(e));
401
424
  return t = t.filter((e) => !Number.isNaN(e)), [...new Set(t)];
402
425
  };
403
- function X(e, t = {}, n = "ids") {
426
+ function J(e, t = {}, n = "ids") {
404
427
  let r = t;
405
428
  if (Array.isArray(e) && (r = e), typeof e == "object" && e && (r = e), typeof e == "number") return t;
406
429
  if (typeof e == "string") try {
@@ -409,13 +432,13 @@ function X(e, t = {}, n = "ids") {
409
432
  } catch {
410
433
  return t;
411
434
  }
412
- return n === "ids" && (r = Y(r)), r;
435
+ return n === "ids" && (r = q(r)), r;
413
436
  }
414
- var oe = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, se = (e) => {
415
- 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);
416
439
  let t = String(e).replace(/[^\d.]/g, "");
417
- return t ? new c(t) : new c(0);
418
- }, ce = (e, t) => [...new Set(e.map((e) => e[t]))], le = (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) => {
419
442
  let a = e.length, o = [];
420
443
  for (let s = 0; s < a; s++) {
421
444
  let a = t.find((t) => t[r] === e[s]);
@@ -425,34 +448,34 @@ var oe = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, se = (e) =
425
448
  });
426
449
  }
427
450
  return o;
428
- }, ue = (e, t) => e.map((e) => {
451
+ }, be = (e, t) => e.map((e) => {
429
452
  let n = {};
430
453
  for (let r in t) {
431
454
  let i = t[r];
432
455
  typeof i == "string" ? n[r] = e[i] : typeof i == "function" && (n[r] = i(e));
433
456
  }
434
457
  return n;
435
- }), de = (e, t, n = !1) => {
458
+ }), xe = (e, t, n = !1) => {
436
459
  if (t.split("-").map(Number).includes(e)) return !0;
437
460
  if (n) throw Error("invalid_status");
438
461
  return !1;
439
462
  };
440
- function Z(e, t) {
463
+ function Se(e, t) {
441
464
  return e?.reduce((e, n) => e + (n[t] ?? 0), 0) || 0;
442
465
  }
443
- var fe = (e) => {
466
+ var Ce = (e) => {
444
467
  switch (e) {
445
468
  case 3: return "tháng " + ((/* @__PURE__ */ new Date()).getMonth() + 1);
446
469
  case 4: return "năm " + (/* @__PURE__ */ new Date()).getFullYear();
447
470
  }
448
471
  return "";
449
- }, pe = (e = !1) => {
472
+ }, we = (e = !1) => {
450
473
  let t = [{
451
474
  id: 1,
452
475
  name: "Tiếng Việt"
453
476
  }];
454
477
  return e === !1 ? t : t.find((t) => t.id === e)?.name || "";
455
- }, me = class {
478
+ }, Y = class {
456
479
  routes = [];
457
480
  async addGS(e, t, n, r = !1, i = !1, a = !1, o = !1) {
458
481
  let s = {
@@ -489,15 +512,24 @@ var fe = (e) => {
489
512
  getRouter() {
490
513
  return this.routes;
491
514
  }
492
- }, Q = (e, t, n, r, i, a) => {
515
+ }, X = (e, t, n, r, i, a) => {
493
516
  if (!a) return !1;
494
- if (a == 1) return !0;
495
- for (let o of e) {
496
- if (o.module == t && o.controller == n && o.action == r && o.code == i && o.status !== 1) return o.isPer;
497
- 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;
498
522
  }
499
- return !0;
500
- }, $ = window.jQuery, he = 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 {
501
533
  options;
502
534
  validators;
503
535
  $element;
@@ -593,26 +625,26 @@ var fe = (e) => {
593
625
  });
594
626
  };
595
627
  runValidators = (t) => {
596
- let n = [], r = $.Deferred();
597
- t.data("bs.validator.deferred") && t.data("bs.validator.deferred").reject(), t.data("bs.validator.deferred", r);
598
- 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) {
599
631
  return t.attr("data-" + e + "-error");
600
632
  }
601
- function a() {
633
+ function o() {
602
634
  let e = t[0];
603
635
  if (!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement)) return null;
604
636
  let n = e.validity;
605
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;
606
638
  }
607
- function o() {
639
+ function s() {
608
640
  return t.attr("data-error");
609
641
  }
610
- function s(e) {
611
- return i(e) || a() || o();
642
+ function c(e) {
643
+ return a(e) || o() || s();
612
644
  }
613
645
  return $.each(this.validators, $.proxy(function(r, i) {
614
- let a = null;
615
- (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));
616
648
  }, this)), r.resolve(n), r.promise();
617
649
  };
618
650
  validate = () => {
@@ -673,4 +705,4 @@ var fe = (e) => {
673
705
  };
674
706
  };
675
707
  //#endregion
676
- export { g as ApiError, me as CusRoute, he as Validator, h as buildFormData, _ as callFetchApi, v as callFetchApiToken, Q as checkPermission, V as checkUploadFile, K as createModal, N as createQueryString, se as decimalNumber, G as elFinderPopup, Y as filterIds, O as formatDate, A as formatDateSql, D as formatDateTime, oe as formatNumber, k as formatYear, S as getActiveStatus, t as getEnv, I as getFile, fe as getFilterType, P as getIdParams, F as getImage, pe as getLangs, x as getLinkFiles, ie 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, de as isStsNum, e as loadEnv, p as loadScript, ee as loadScripts, ue as mapArrData, ce as mapArrFields, W as mapDataForm, le as mergeArrObject, T as parseDate, ae as randomString, U as resetForm, M as setParams, J as showFinderFileModal, q as showFinderModal, H as showMessage, te as showSweetAlert, y as showSweetAlertError, ne as showSweetAlertOk, re as showSweetAlertWarning, m as spinnerLoader, E as strToDate, X as stringToJson, Z 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 };