@materialui-reactjs/admin 1.0.6 → 2.0.1

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 (129) hide show
  1. package/CHANGELOG.md +322 -0
  2. package/LICENSE +21 -0
  3. package/README.md +587 -453
  4. package/dist/Common-DFahMuQE.cjs +11 -0
  5. package/dist/Common-_PK8HLKN.js +267 -0
  6. package/dist/Env-DoS-iQjs.cjs +1 -0
  7. package/dist/Env-SHztUA3s.js +16 -0
  8. package/dist/HeaderUpdate-Dirxjmxs.cjs +1 -0
  9. package/dist/{chunks/HeaderUpdate-DuS-gHNR.js → HeaderUpdate-drlnuHI8.js} +28 -25
  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-D8wOZ1Ut.js +96 -0
  14. package/dist/UDragFile-Db0sK4M7.cjs +1 -0
  15. package/dist/{chunks/Validator-CXYkI7vJ.js → Validator-D2zwZeov.js} +83 -52
  16. package/dist/Validator-DBxl8wtE.cjs +1 -0
  17. package/dist/assets/css/form.css +1 -1
  18. package/dist/assets/css/index.css +1 -1
  19. package/dist/ckeditor/ckeditor.d.ts +3 -0
  20. package/dist/ckeditor/plugins/elfinder.d.ts +11 -0
  21. package/dist/ckeditor/plugins/fullscreen.d.ts +15 -0
  22. package/dist/ckeditor/plugins/pdffinder.d.ts +18 -0
  23. package/dist/ckeditor/types.d.ts +37 -0
  24. package/dist/common-CEZp8xpQ.js +30 -0
  25. package/dist/common-ivDX6gGq.cjs +1 -0
  26. package/dist/components/echarts/index.cjs +1 -0
  27. package/dist/components/echarts/index.js +1 -1
  28. package/dist/components/form/AdvancedMultiSelect.d.ts +6 -3
  29. package/dist/components/form/AsxhUImages.d.ts +2 -1
  30. package/dist/components/form/BoxAddRow.d.ts +13 -2
  31. package/dist/components/form/CheckTreeBox.d.ts +12 -3
  32. package/dist/components/form/CusForm.d.ts +19 -6
  33. package/dist/components/form/DateInput.d.ts +2 -1
  34. package/dist/components/form/Editor.d.ts +2 -1
  35. package/dist/components/form/EfFile.d.ts +2 -1
  36. package/dist/components/form/EfImage.d.ts +2 -1
  37. package/dist/components/form/EfImages.d.ts +2 -1
  38. package/dist/components/form/PImage.d.ts +2 -1
  39. package/dist/components/form/SelectAddRowBox.d.ts +9 -5
  40. package/dist/components/form/SelectAddRowBoxAdvanced.d.ts +13 -4
  41. package/dist/components/form/SelectBox.d.ts +20 -7
  42. package/dist/components/form/UDragFile.d.ts +2 -1
  43. package/dist/components/form/UFile.d.ts +2 -1
  44. package/dist/components/form/UFiles.d.ts +9 -2
  45. package/dist/components/form/UImages.d.ts +2 -1
  46. package/dist/components/form/index.cjs +1 -0
  47. package/dist/components/form/index.js +2 -2
  48. package/dist/components/loader/SpinnerLoader.d.ts +5 -1
  49. package/dist/components/loader/index.cjs +1 -0
  50. package/dist/components/loader/index.js +1 -2
  51. package/dist/components/meta/CardTable.d.ts +11 -5
  52. package/dist/components/meta/CardTable.types.d.ts +57 -0
  53. package/dist/components/meta/CusTooltip.d.ts +8 -2
  54. package/dist/components/meta/Head.d.ts +10 -1
  55. package/dist/components/meta/HeaderDetail.d.ts +2 -1
  56. package/dist/components/meta/HeaderUpdate.d.ts +5 -1
  57. package/dist/components/meta/ModalForm.d.ts +41 -11
  58. package/dist/components/meta/Navtabs.d.ts +1 -1
  59. package/dist/components/meta/ScrollTable.d.ts +7 -3
  60. package/dist/components/meta/SearchBox.d.ts +8 -5
  61. package/dist/components/meta/SortableItem.d.ts +11 -1
  62. package/dist/components/meta/index.cjs +1 -0
  63. package/dist/components/meta/index.d.ts +1 -0
  64. package/dist/components/meta/index.js +3 -3
  65. package/dist/components/sidebar/Sidebar.types.d.ts +9 -7
  66. package/dist/components/sidebar/index.cjs +1 -0
  67. package/dist/components/sidebar/index.js +1 -1
  68. package/dist/components/single/Detail.d.ts +8 -3
  69. package/dist/components/single/Fields.d.ts +10 -4
  70. package/dist/components/single/Import.d.ts +8 -3
  71. package/dist/components/single/List.d.ts +33 -7
  72. package/dist/components/single/Update.d.ts +10 -4
  73. package/dist/components/single/UpdateDetail.d.ts +3 -2
  74. package/dist/components/single/UpdateTableDetail.d.ts +4 -3
  75. package/dist/components/single/index.cjs +1 -0
  76. package/dist/components/single/index.js +1 -1
  77. package/dist/components/top-navbar/index.cjs +1 -0
  78. package/dist/components/top-navbar/index.js +78 -2
  79. package/dist/echarts-Bi3uwLbg.cjs +1 -0
  80. package/dist/{chunks/echarts-CRmndsxC.js → echarts-CTzMqeR5.js} +4 -4
  81. package/dist/form-heyswTRq.js +3897 -0
  82. package/dist/form-sgtop6li.cjs +49 -0
  83. package/dist/hook/common.d.ts +87 -0
  84. package/dist/hook/detail.cjs +1 -0
  85. package/dist/hook/detail.d.ts +9 -15
  86. package/dist/hook/detail.js +1 -11
  87. package/dist/hook/fields.cjs +1 -0
  88. package/dist/hook/fields.d.ts +6 -14
  89. package/dist/hook/fields.js +1 -11
  90. package/dist/hook/import.d.ts +6 -11
  91. package/dist/hook/index.cjs +1 -0
  92. package/dist/hook/index.d.ts +29 -20
  93. package/dist/hook/index.js +14 -11
  94. package/dist/hook/update.cjs +1 -0
  95. package/dist/hook/update.d.ts +11 -19
  96. package/dist/hook/update.js +12 -9
  97. package/dist/index.cjs +1 -0
  98. package/dist/index.d.ts +16 -0
  99. package/dist/index.js +14 -11
  100. package/dist/meta-BANk9kHW.cjs +1 -0
  101. package/dist/meta-CheDAmMh.js +745 -0
  102. package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
  103. package/dist/sidebar-CfQAYWi-.cjs +1 -0
  104. package/dist/{chunks/sidebar-Dj4Xr9du.js → sidebar-CzRmfvhi.js} +10 -13
  105. package/dist/{chunks/single-CRF61o_U.js → single-BsJ7TYJi.js} +364 -282
  106. package/dist/single-C2WPEjhk.cjs +1 -0
  107. package/dist/style.cjs +0 -0
  108. package/dist/style.d.ts +0 -0
  109. package/dist/style.js +0 -0
  110. package/dist/types/Menu.d.ts +25 -0
  111. package/dist/utils/Common.d.ts +224 -43
  112. package/dist/utils/CusRoute.d.ts +21 -1
  113. package/dist/utils/Env.d.ts +23 -2
  114. package/dist/utils/Group.d.ts +12 -1
  115. package/dist/utils/Validator.d.ts +34 -12
  116. package/dist/utils/index.cjs +11 -0
  117. package/dist/utils/index.d.ts +2 -1
  118. package/dist/utils/index.js +212 -171
  119. package/package.json +190 -163
  120. package/dist/chunks/Common-BURf0rBN.js +0 -222
  121. package/dist/chunks/Env-DRXhvUcb.js +0 -16
  122. package/dist/chunks/UDragFile-BnUR3riq.js +0 -92
  123. package/dist/chunks/form-CPkpL5eA.js +0 -45889
  124. package/dist/chunks/loader-BUiOnhOH.js +0 -1
  125. package/dist/chunks/meta-4qPWijBT.js +0 -758
  126. package/dist/chunks/top-navbar-Bob0gMUh.js +0 -78
  127. package/scripts/postinstall.cjs +0 -80
  128. /package/dist/{chunks/SortableItem-B4-Zsso3.js → SortableItem-B4-Zsso3.js} +0 -0
  129. /package/dist/{components/meta/Pdfviewer.d.ts → hook/import.cjs} +0 -0
@@ -1,5 +1,6 @@
1
1
  export * from './Common';
2
2
  export * from './CusRoute';
3
- export { loadEnv, getEnv } from './Env';
3
+ export { loadEnv, getEnv, reloadEnv } from './Env';
4
+ export type { EnvType } from './Env';
4
5
  export * from './Group';
5
6
  export * from './Validator';
@@ -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) {
@@ -51,36 +52,37 @@ var { SECRET_KEY: l, STATIC_URL: u, API_URL: d, UPLOADS_URL: f } = await e(), p
51
52
  t.append(e, JSON.stringify(n));
52
53
  return;
53
54
  }
54
- t.append(e, n);
55
+ n != null && typeof n != "function" && typeof n != "object" && t.append(e, String(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,48 @@ 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) => {
138
- let r = t.find((t) => t.id === e);
139
- 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) {
139
+ return r ? r[n] ?? null : null;
140
+ }, ae = (e, t, n = "name") => {
141
+ let r = Array.isArray(e) ? e : [], i = Array.isArray(t) ? t : [];
142
+ return r.map((e) => {
143
+ let t = i.find((t) => t.id === e);
144
+ return t ? t[n] : null;
145
+ }).filter(Boolean).join(", ");
146
+ }, 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) => {
147
+ if (e === !1) return t;
148
+ let r = t.find((t) => t.id === Number(e));
149
+ return r ? n ? `<span class="badge badge-sm bg-gradient-${r.color}">${r.name}</span>` : r.name : "";
150
+ }, se = [{
151
+ id: 1,
152
+ name: "Kích hoạt",
153
+ color: "success"
154
+ }, {
155
+ id: 0,
156
+ name: "Khóa",
157
+ color: "danger"
158
+ }], ce = [{
159
+ id: 1,
160
+ name: "Xuất bản",
161
+ color: "success"
162
+ }, {
163
+ id: 0,
164
+ name: "Nháp",
165
+ color: "danger"
166
+ }], y = [{
167
+ id: 1,
168
+ name: "Có",
169
+ color: "success"
170
+ }, {
171
+ id: 0,
172
+ name: "Không",
173
+ color: "secondary"
174
+ }], b = (e, t = !1) => v(e, se, t), x = (e, t = !1) => v(e, ce, t), S = (e, t = !1) => v(e, y, t);
175
+ function C(e) {
181
176
  let t = e instanceof Date ? e : new Date(e);
182
177
  if (isNaN(t.getTime())) throw Error("Ngày không hợp lệ: " + e);
183
178
  return t;
184
179
  }
185
- function E(e) {
180
+ function w(e) {
186
181
  if (!e) return /* @__PURE__ */ new Date();
187
182
  if (e instanceof Date) return new Date(e);
188
183
  let t = e.trim().toLowerCase();
@@ -228,44 +223,52 @@ function E(e) {
228
223
  if (!isNaN(i.getTime())) return i;
229
224
  throw Error(`Invalid date expression: ${e}`);
230
225
  }
231
- var D = (e) => {
232
- if (!e) return "";
226
+ var T = (e) => {
227
+ if (!e) return null;
233
228
  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")}`;
229
+ return isNaN(t.getTime()) ? null : {
230
+ dd: String(t.getDate()).padStart(2, "0"),
231
+ MM: String(t.getMonth() + 1).padStart(2, "0"),
232
+ yyyy: t.getFullYear(),
233
+ hh: String(t.getHours()).padStart(2, "0"),
234
+ mm: String(t.getMinutes()).padStart(2, "0"),
235
+ ss: String(t.getSeconds()).padStart(2, "0")
236
+ };
237
+ }, E = (e) => {
238
+ let t = T(e);
239
+ return t ? `${t.dd}/${t.MM}/${t.yyyy} ${t.hh}:${t.mm}:${t.ss}` : e ? "Invalid Date" : "";
240
+ }, D = (e) => {
241
+ let t = T(e);
242
+ return t ? `${t.dd}/${t.MM}/${t.yyyy}` : e ? "Invalid Date" : "";
235
243
  }, 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()}`;
244
+ let t = T(e);
245
+ return t ? `${t.yyyy}` : e ? "Invalid Date" : "";
239
246
  }, k = (e) => {
240
- if (!e) return "";
241
- let t = new Date(e);
242
- return isNaN(t.getTime()) ? "Invalid Date" : `${t.getFullYear()}`;
247
+ let t = T(e);
248
+ return t ? `${t.yyyy}-${t.MM}-${t.dd}` : e ? "Invalid Date" : "";
243
249
  }, 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
250
  let t = new URLSearchParams(window.location.search);
251
251
  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) => {
252
+ }, j = (e) => {
253
253
  let t = new URLSearchParams(window.location.search);
254
254
  return Object.entries(e).forEach(([e, n]) => {
255
255
  n === null ? t.delete(e) : t.set(e, n);
256
256
  }), t.toString();
257
- }, N = (e) => {
257
+ }, M = (e) => {
258
258
  let t = new URLSearchParams();
259
259
  return Object.entries(e).forEach(([e, n]) => {
260
260
  Array.isArray(n) ? n.forEach((n) => {
261
261
  n != null && t.append(e, String(n));
262
262
  }) : n != null && t.set(e, String(n));
263
263
  }), 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) {
264
+ }, N = (e = typeof window < "u" ? window.location.pathname : "", t = /\/(?:edit|detail|update)\/(\d+)(?=\/|$)/i) => {
265
+ let n = new RegExp(t.source, t.flags.includes("g") ? t.flags : t.flags + "g"), r = null, i;
266
+ for (; (i = n.exec(e)) !== null;) r = i;
267
+ if (!r) return null;
268
+ let a = Number(r[1]);
269
+ return Number.isFinite(a) ? a : null;
270
+ }, 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;
271
+ function z(e) {
269
272
  let t = "";
270
273
  for (let n = 0; n < e; n++) {
271
274
  let e = Math.floor(Math.random() * 62);
@@ -276,19 +279,42 @@ function ae(e) {
276
279
  function B(e) {
277
280
  return new DOMParser().parseFromString(e, "text/html").body.textContent || "";
278
281
  }
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) => {
282
+ var V = /\.(jpg|jpeg|png|jfif|doc|docx|xls|xlsx|pdf)$/i, H = (e, t) => {
283
+ if (!e) return t;
284
+ let n = e.split(",").map((e) => {
285
+ let t = e.trim();
286
+ return (t.includes("/") ? t.slice(t.indexOf("/") + 1) : t).replace(/^\./, "");
287
+ }).filter(Boolean);
288
+ if (n.length === 0) return t;
289
+ let r = n.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
290
+ return RegExp(`\\.(${r.join("|")})$`, "i");
291
+ }, le = (e, t = 20, n = V) => new Promise((r, i) => {
292
+ let a = Array.from(e ?? []);
293
+ if (a.length === 0) return i(/* @__PURE__ */ Error("Tập tin không tồn tại"));
294
+ for (let e of a) {
295
+ 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ệ"));
296
+ 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`));
297
+ }
298
+ r();
299
+ }), U = {
300
+ "&": "&amp;",
301
+ "<": "&lt;",
302
+ ">": "&gt;",
303
+ "\"": "&quot;",
304
+ "'": "&#39;"
305
+ }, W = (e) => String(e ?? "").replace(/[&<>"']/g, (e) => U[e]), ue = /* @__PURE__ */ new Set([
306
+ "danger",
307
+ "success",
308
+ "warning",
309
+ "info",
310
+ "primary",
311
+ "secondary",
312
+ "light",
313
+ "dark"
314
+ ]), de = (e = "", t = "danger", n = {}) => {
315
+ let r = ue.has(t) ? t : "danger", i = (e) => n.raw ? e : W(e);
316
+ 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("");
317
+ }, fe = (e) => (e.querySelectorAll("input:not([type=\"hidden\"]):not([type=\"checkbox\"]):not([type=\"radio\"]):not(.noReset), textarea").forEach((e) => {
292
318
  e.value = "", e.dispatchEvent(new Event("change", { bubbles: !0 }));
293
319
  }), e.querySelectorAll("select:not(.noReset)").forEach((e) => {
294
320
  let t = e.querySelector("option[value=\"\"]");
@@ -297,23 +323,23 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
297
323
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
298
324
  }), e.querySelectorAll("input[type=\"radio\"]:not(.noReset)").forEach((e) => {
299
325
  e.checked = !1, e.dispatchEvent(new Event("change", { bubbles: !0 }));
300
- }), e), W = async (e, t, n = !1) => {
326
+ }), e), pe = async (e, t, n = !1) => {
301
327
  try {
302
328
  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;
306
- 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 }));
329
+ let i = `[name="${r}"]:not([type="file"])`, a = e.querySelector(i);
330
+ if (!a) continue;
331
+ let l = a.type, u = t[r];
332
+ if (u && !["checkbox", "radio"].includes(l)) {
333
+ let e = String(u), t = c(e, "yyyy-MM-dd", /* @__PURE__ */ new Date()), n = c(e, "yyyy-MM-dd HH:mm:ss", /* @__PURE__ */ new Date());
334
+ a.value = s(t) && e.length === 10 ? o(t, "dd/MM/yyyy") : s(n) && e.length === 19 ? o(n, "dd/MM/yyyy HH:mm") : e, a.dispatchEvent(new Event("change", { bubbles: !0 }));
335
+ } else if (l === "checkbox") a.checked = !!parseInt(String(u)), a.dispatchEvent(new Event("change", { bubbles: !0 }));
310
336
  else if (l === "radio") {
311
- let n = e.querySelectorAll(`input[type="radio"][name="${r}"]`);
312
- n.forEach((e) => {
313
- e.checked = e.value === String(parseInt(t[r]));
314
- }), n.forEach((e) => e.dispatchEvent(new Event("change", { bubbles: !0 })));
337
+ let t = e.querySelectorAll(`input[type="radio"][name="${r}"]`);
338
+ t.forEach((e) => {
339
+ e.checked = e.value === String(parseInt(String(u)));
340
+ }), t.forEach((e) => e.dispatchEvent(new Event("change", { bubbles: !0 })));
315
341
  } else if (n) {
316
- let e = c.closest(".form-group");
342
+ let e = a.closest(".form-group");
317
343
  e && e.classList.add("hidden");
318
344
  }
319
345
  }
@@ -326,7 +352,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
326
352
  let r = window.jQuery, i = r(e);
327
353
  if (!i.length) throw Error("invalid_elfinder");
328
354
  let a = {
329
- url: d + "/elfinder/connector",
355
+ url: u("API_URL") + "/elfinder/connector",
330
356
  height: 500,
331
357
  resizable: !0,
332
358
  baseUrl: "/assets/plugins/elFinder/",
@@ -343,7 +369,15 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
343
369
  } catch (e) {
344
370
  r(e);
345
371
  }
346
- }), K = (e) => new Promise((t, n) => {
372
+ }), me = (e) => {
373
+ if (e instanceof Error) return e.message;
374
+ if (typeof e == "string") return e;
375
+ try {
376
+ return JSON.stringify(e) ?? String(e);
377
+ } catch {
378
+ return String(e);
379
+ }
380
+ }, K = (e) => new Promise((t, n) => {
347
381
  try {
348
382
  let n = typeof e == "string" ? document.querySelector(e) : e;
349
383
  if (!n) throw Error("invalid_modalEl_btnEl");
@@ -352,7 +386,7 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
352
386
  r.hide();
353
387
  });
354
388
  });
355
- let r = i.getOrCreateInstance(n, {
389
+ let r = a.getOrCreateInstance(n, {
356
390
  backdrop: "static",
357
391
  keyboard: !1
358
392
  });
@@ -363,44 +397,42 @@ var V = (e, t = 20, n = !1) => new Promise((r) => {
363
397
  } catch (e) {
364
398
  console.log(e), n(e);
365
399
  }
366
- }), q = (e, t, n = !1, r = !1) => {
400
+ }), he = (e, t, n = !1, r = !1) => {
367
401
  if (!e) throw Error("invalid_btnEl");
368
402
  e.addEventListener("click", (i) => {
369
- i.preventDefault(), K(t).then((t) => {
370
- let { modalEl: i, md: a } = t;
403
+ i.preventDefault(), K(t).then(({ modalEl: t, md: i }) => {
371
404
  G("#elfinderStatic").then((t) => {
372
405
  n && n({
373
406
  data: t,
374
407
  btnEl: e,
375
- md: a
408
+ md: i
376
409
  });
377
- }), i.addEventListener("hidden.bs.modal", () => {
410
+ }), t.addEventListener("hidden.bs.modal", () => {
378
411
  r && r();
379
- }), a.show();
412
+ }), i.show();
380
413
  });
381
414
  });
382
- }, J = (e, t, n = !1, r = !1) => {
415
+ }, ge = (e, t, n = !1, r = !1) => {
383
416
  if (!e) throw Error("invalid_btnEl");
384
417
  e.addEventListener("click", (i) => {
385
- i.preventDefault(), K(t).then((t) => {
386
- let { modalEl: i, md: a } = t;
387
- G("#elfinderStatic", { url: d + "/elfinder/connectorFiles" }).then((t) => {
418
+ i.preventDefault(), K(t).then(({ modalEl: t, md: i }) => {
419
+ G("#elfinderStatic", { url: u("API_URL") + "/elfinder/connectorFiles" }).then((t) => {
388
420
  n && n({
389
421
  data: t,
390
422
  btnEl: e,
391
- md: a
423
+ md: i
392
424
  });
393
- }), i.addEventListener("hidden.bs.modal", () => {
425
+ }), t.addEventListener("hidden.bs.modal", () => {
394
426
  r && r();
395
- }), a.show();
427
+ }), i.show();
396
428
  });
397
429
  });
398
- }, Y = (e) => {
399
- if (typeof e == "string" && (e = X(e, [])), !Array.isArray(e)) return [];
400
- let t = e.map((e) => Number(e));
401
- return t = t.filter((e) => !Number.isNaN(e)), [...new Set(t)];
430
+ }, q = (e) => {
431
+ if (typeof e == "string" && (e = J(e, [])), !Array.isArray(e)) return [];
432
+ let t = e.map((e) => Number(e)).filter((e) => !Number.isNaN(e));
433
+ return [...new Set(t)];
402
434
  };
403
- function X(e, t = {}, n = "ids") {
435
+ function J(e, t = {}, n = "ids") {
404
436
  let r = t;
405
437
  if (Array.isArray(e) && (r = e), typeof e == "object" && e && (r = e), typeof e == "number") return t;
406
438
  if (typeof e == "string") try {
@@ -409,13 +441,13 @@ function X(e, t = {}, n = "ids") {
409
441
  } catch {
410
442
  return t;
411
443
  }
412
- return n === "ids" && (r = Y(r)), r;
444
+ return n === "ids" && (r = q(r)), r;
413
445
  }
414
- var oe = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, se = (e) => {
415
- if (!e) return new c(0);
446
+ var _e = (e, t = {}, n = "vi-VN") => e == null || Number.isNaN(e) ? "0" : e.toLocaleString(n, t), ve = (e) => {
447
+ if (!e) return new l(0);
416
448
  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) => {
449
+ return t ? new l(t) : new l(0);
450
+ }, ye = (e, t) => [...new Set((Array.isArray(e) ? e : []).map((e) => e[t]))], be = (e, t, n, r, i) => {
419
451
  let a = e.length, o = [];
420
452
  for (let s = 0; s < a; s++) {
421
453
  let a = t.find((t) => t[r] === e[s]);
@@ -425,34 +457,34 @@ var oe = (e, t = {}, n = "vi-VN") => e ? e?.toLocaleString(n, t) : 0, se = (e) =
425
457
  });
426
458
  }
427
459
  return o;
428
- }, ue = (e, t) => e.map((e) => {
460
+ }, xe = (e, t) => (Array.isArray(e) ? e : []).map((e) => {
429
461
  let n = {};
430
462
  for (let r in t) {
431
463
  let i = t[r];
432
464
  typeof i == "string" ? n[r] = e[i] : typeof i == "function" && (n[r] = i(e));
433
465
  }
434
466
  return n;
435
- }), de = (e, t, n = !1) => {
436
- if (t.split("-").map(Number).includes(e)) return !0;
467
+ }), Se = (e, t, n = !1) => {
468
+ if ((t ?? "").split("-").map(Number).includes(e)) return !0;
437
469
  if (n) throw Error("invalid_status");
438
470
  return !1;
439
471
  };
440
- function Z(e, t) {
472
+ function Ce(e, t) {
441
473
  return e?.reduce((e, n) => e + (n[t] ?? 0), 0) || 0;
442
474
  }
443
- var fe = (e) => {
475
+ var we = (e) => {
444
476
  switch (e) {
445
477
  case 3: return "tháng " + ((/* @__PURE__ */ new Date()).getMonth() + 1);
446
478
  case 4: return "năm " + (/* @__PURE__ */ new Date()).getFullYear();
447
479
  }
448
480
  return "";
449
- }, pe = (e = !1) => {
481
+ }, Y = (e = !1) => {
450
482
  let t = [{
451
483
  id: 1,
452
484
  name: "Tiếng Việt"
453
485
  }];
454
486
  return e === !1 ? t : t.find((t) => t.id === e)?.name || "";
455
- }, me = class {
487
+ }, Te = class {
456
488
  routes = [];
457
489
  async addGS(e, t, n, r = !1, i = !1, a = !1, o = !1) {
458
490
  let s = {
@@ -489,15 +521,24 @@ var fe = (e) => {
489
521
  getRouter() {
490
522
  return this.routes;
491
523
  }
492
- }, Q = (e, t, n, r, i, a) => {
524
+ }, X = (e, t, n, r, i, a) => {
493
525
  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;
526
+ if (a === 1) return !0;
527
+ if (!Array.isArray(e)) return !1;
528
+ for (let o of e) if (o) {
529
+ if (o.module === t && o.controller === n && o.action === r && Number(o.code) === Number(i)) return o.status !== 0 && !!o.isPer;
530
+ if (Array.isArray(o.subs) && o.subs.length > 0 && X(o.subs, t, n, r, i, a)) return !0;
498
531
  }
499
- return !0;
500
- }, $ = window.jQuery, he = class e {
532
+ return !1;
533
+ }, Z = null, Q = () => {
534
+ if (Z) return Z;
535
+ let e = typeof window < "u" ? window.jQuery ?? window.$ : void 0;
536
+ 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.");
537
+ return Z = e, Z;
538
+ }, $ = new Proxy((() => {}), {
539
+ apply: (e, t, n) => Q()(...n),
540
+ get: (e, t) => Q()[t]
541
+ }), Ee = class e {
501
542
  options;
502
543
  validators;
503
544
  $element;
@@ -593,26 +634,26 @@ var fe = (e) => {
593
634
  });
594
635
  };
595
636
  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) {
637
+ let n = [], r = $.Deferred(), i = t.data("bs.validator.deferred");
638
+ i && i.reject(), t.data("bs.validator.deferred", r);
639
+ function a(e) {
599
640
  return t.attr("data-" + e + "-error");
600
641
  }
601
- function a() {
642
+ function o() {
602
643
  let e = t[0];
603
644
  if (!(e instanceof HTMLInputElement) && !(e instanceof HTMLSelectElement) && !(e instanceof HTMLTextAreaElement)) return null;
604
645
  let n = e.validity;
605
646
  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
647
  }
607
- function o() {
648
+ function s() {
608
649
  return t.attr("data-error");
609
650
  }
610
- function s(e) {
611
- return i(e) || a() || o();
651
+ function c(e) {
652
+ return a(e) || o() || s();
612
653
  }
613
654
  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));
655
+ let a;
656
+ (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
657
  }, this)), r.resolve(n), r.promise();
617
658
  };
618
659
  validate = () => {
@@ -673,4 +714,4 @@ var fe = (e) => {
673
714
  };
674
715
  };
675
716
  //#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 };
717
+ export { p as ApiError, Te as CusRoute, Ee 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, ve as decimalNumber, G as elFinderPopup, me as errorMessage, W as escapeHtml, q as filterIds, D as formatDate, k as formatDateSql, E as formatDateTime, _e as formatNumber, O as formatYear, b as getActiveStatus, n as getEnv, F as getFile, we as getFilterType, N as getIdParams, P as getImage, Y 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, Se as isStsNum, e as loadEnv, d as loadScript, ee as loadScripts, xe as mapArrData, ye as mapArrFields, pe as mapDataForm, be as mergeArrObject, C as parseDate, z as randomString, t as reloadEnv, fe as resetForm, j as setParams, ge as showFinderFileModal, he 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, Ce as sumArrCol };