@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,92 +0,0 @@
1
- import { n as e } from "./Common-BURf0rBN.js";
2
- import { useRef as t, useState as n } from "react";
3
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
- //#region src/components/form/UDragFile.tsx
5
- var a = ({ label: a, name: o, cpnClass: s = "", required: c = !1, onChange: l, ext: u = ".xlsx, .xls, .docx, .doc, .pdf" }) => {
6
- let d = t(null), [f, p] = n(null), [m, h] = n(!1), g = async (t) => {
7
- t.preventDefault();
8
- let n = d.current?.querySelector(".default-file-input"), r = n?.files;
9
- if (!r) return;
10
- let i = /\.(pdf|docx|doc|xlsx|xls)$/i, a = n.getAttribute("accept"), o = a ? RegExp(".(" + a.replace(/[., ]/g, (e) => e === "," ? "|" : "") + ")$", "i") : i;
11
- e(r, 10, o).then(() => {
12
- p(r[0]), l(t);
13
- });
14
- }, _ = async (e) => {
15
- e.preventDefault(), e.stopPropagation(), e.type === "dragenter" || e.type === "dragover" ? h(!0) : e.type === "dragleave" && h(!1);
16
- };
17
- return /* @__PURE__ */ r("div", {
18
- className: s,
19
- children: /* @__PURE__ */ i("div", {
20
- ref: d,
21
- className: "upload-files-container mb-3",
22
- children: [/* @__PURE__ */ i("label", {
23
- className: "drag-file-area mb-2",
24
- onDragEnter: _,
25
- onDragOver: _,
26
- onDragLeave: _,
27
- onDrop: async (t) => {
28
- t.preventDefault(), t.stopPropagation();
29
- let n = t.dataTransfer.files;
30
- if (!n) return;
31
- let r = d.current?.querySelector(".default-file-input"), i = /\.(pdf|docx|doc|xlsx|xls)$/i, a = r?.getAttribute("accept"), s = a ? RegExp(".(" + a.replace(/[., ]/g, (e) => e === "," ? "|" : "") + ")$", "i") : i;
32
- e(n, 10, s).then(() => {
33
- p(n[0]), l({
34
- target: {
35
- type: "file",
36
- name: o,
37
- files: n,
38
- value: ""
39
- },
40
- preventDefault: () => {}
41
- }), h(!1);
42
- });
43
- },
44
- "aria-label": a,
45
- htmlFor: "importFile1",
46
- children: [
47
- /* @__PURE__ */ r("span", {
48
- className: "upload-icon",
49
- children: /* @__PURE__ */ r("i", { className: "fas fa-upload" })
50
- }),
51
- /* @__PURE__ */ i("h3", {
52
- className: "dynamic-message",
53
- children: [m ? "Thả tập tin vào đây" : "Chọn tập tin (" + u + ")", " "]
54
- }),
55
- /* @__PURE__ */ r("span", {
56
- className: "label",
57
- children: m ? "" : "hoặc kéo thả"
58
- }),
59
- /* @__PURE__ */ r("span", {
60
- className: "browse-files d-none",
61
- children: /* @__PURE__ */ r("input", {
62
- id: "importFile1",
63
- onChange: g,
64
- type: "file",
65
- required: c,
66
- name: o,
67
- className: "default-file-input",
68
- accept: u
69
- })
70
- })
71
- ]
72
- }), /* @__PURE__ */ r("div", {
73
- className: "file-block",
74
- children: f && /* @__PURE__ */ r("div", {
75
- className: "inputClone",
76
- children: /* @__PURE__ */ i("div", {
77
- className: "file-info",
78
- children: [/* @__PURE__ */ r("span", {
79
- className: "file-name me-2",
80
- children: f.name
81
- }), /* @__PURE__ */ i("div", { children: ["|", /* @__PURE__ */ r("span", {
82
- className: "ms-2 file-size",
83
- children: (f.size / 1024).toFixed(1) + " KB"
84
- })] })]
85
- })
86
- })
87
- })]
88
- })
89
- });
90
- };
91
- //#endregion
92
- export { a as t };
@@ -1 +0,0 @@
1
- import "./SpinnerLoader-h8RDIarB.js";
@@ -1,78 +0,0 @@
1
- import { v as e, y as t } from "./Common-BURf0rBN.js";
2
- import "react";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { Link as i, useNavigate as a } from "react-router-dom";
5
- //#region src/components/top-navbar/TopNavbar.tsx
6
- var o = ({ userName: o, role: s }) => {
7
- let c = a(), l = async () => {
8
- c("/", { replace: !0 }), localStorage.removeItem("isLogin"), window.dispatchEvent(new Event("storage"));
9
- };
10
- return /* @__PURE__ */ n("nav", {
11
- className: "navbar navbar-main navbar-expand-lg position-sticky z-index-sticky shadow-none bg-gradient-dark py-3 px-0",
12
- "data-scroll": "true",
13
- children: /* @__PURE__ */ n("div", {
14
- className: "container-fluid",
15
- children: /* @__PURE__ */ n("div", {
16
- className: "collapse navbar-collapse mt-sm-0 mt-2 me-md-0 me-sm-4",
17
- children: /* @__PURE__ */ n("ul", {
18
- className: "navbar-nav justify-content-end ms-auto",
19
- children: /* @__PURE__ */ r("li", {
20
- className: "nav-item dropdown py-0",
21
- children: [/* @__PURE__ */ r("button", {
22
- className: "btn btn-sm btn-outline-light dropdown-toggle",
23
- "data-bs-toggle": "dropdown",
24
- "aria-expanded": "false",
25
- children: [
26
- /* @__PURE__ */ n("i", { className: "fa-regular fa-user-circle me-1" }),
27
- o,
28
- s && /* @__PURE__ */ n("span", {
29
- className: "badge bg-warning text-white ms-2",
30
- children: s
31
- })
32
- ]
33
- }), /* @__PURE__ */ r("ul", {
34
- className: "dropdown-menu dropdown-menu-end dropdown-menu-animation dropdown-md p-2 border border-radius-xl mt-0 mt-lg-3",
35
- role: "menu",
36
- children: [
37
- o && /* @__PURE__ */ n("li", {
38
- className: "dropdown-item border-radius-md",
39
- children: /* @__PURE__ */ n(i, {
40
- className: "d-block w-100 nav-link py-1",
41
- to: "/profile",
42
- children: "Thông tin tài khoản"
43
- })
44
- }),
45
- o && /* @__PURE__ */ n("li", {
46
- className: "dropdown-item border-radius-md",
47
- children: /* @__PURE__ */ n(i, {
48
- className: "d-block w-100 nav-link py-1",
49
- to: "/userlogs",
50
- children: "Nhật ký hoạt động"
51
- })
52
- }),
53
- /* @__PURE__ */ n("li", {
54
- className: "dropdown-item border-radius-md",
55
- children: /* @__PURE__ */ n(i, {
56
- className: "d-block w-100 nav-link py-1",
57
- to: "#",
58
- onClick: async (n) => {
59
- n.preventDefault();
60
- try {
61
- await l(), t("Đăng xuất thành công", "top-end", !0);
62
- } catch (t) {
63
- e(t.message);
64
- }
65
- },
66
- children: "Đăng xuất"
67
- })
68
- })
69
- ]
70
- })]
71
- })
72
- })
73
- })
74
- })
75
- });
76
- };
77
- //#endregion
78
- export { o as t };
@@ -1,80 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { spawn } = require('child_process');
4
-
5
- try {
6
- // 1. Xác định thư mục gốc dự án
7
- const projectRoot = process.env.INIT_CWD || (() => {
8
- let currentDir = __dirname;
9
- while (currentDir !== path.parse(currentDir).root) {
10
- if (path.basename(currentDir) === 'node_modules') {
11
- return path.dirname(currentDir);
12
- }
13
- currentDir = path.dirname(currentDir);
14
- }
15
- return null;
16
- })();
17
-
18
- if (projectRoot) {
19
- const projectPackageJsonPath = path.join(projectRoot, 'package.json');
20
-
21
- // 🌟 THAY ĐỔI Ở ĐÂY: Nếu file package.json KHÔNG tồn tại, tự động tạo mới một file rỗng hợp lệ
22
- if (!fs.existsSync(projectPackageJsonPath)) {
23
- const defaultPkg = {
24
- name: path.basename(projectRoot) || "my-admin-project",
25
- version: "1.0.0",
26
- private: true,
27
- dependencies: {}
28
- };
29
- fs.writeFileSync(projectPackageJsonPath, JSON.stringify(defaultPkg, null, 2), 'utf-8');
30
- }
31
-
32
- // 2. Đọc peerDependencies của thư viện
33
- const myPackageJsonPath = path.resolve(__dirname, '../package.json');
34
- const myPackageJson = JSON.parse(fs.readFileSync(myPackageJsonPath, 'utf-8'));
35
- const peerDeps = myPackageJson.peerDependencies || {};
36
- const peerDepsStr = JSON.stringify(peerDeps);
37
-
38
- // 3. Tách một tiến trình độc lập chạy bằng Node.js ngầm
39
- const child = spawn('node', ['-e', `
40
- setTimeout(() => {
41
- const fs = require('fs');
42
- try {
43
- const targetPath = '${projectPackageJsonPath.replace(/\\/g, '\\\\')}';
44
-
45
- // Đọc file (lúc này chắc chắn đã tồn tại vì ta đã tạo ở tiến trình cha)
46
- let projectPkg = {};
47
- if (fs.existsSync(targetPath)) {
48
- projectPkg = JSON.parse(fs.readFileSync(targetPath, 'utf-8'));
49
- }
50
-
51
- if (!projectPkg.dependencies) projectPkg.dependencies = {};
52
-
53
- const peerDeps = ${peerDepsStr};
54
- let hasChanged = false;
55
-
56
- Object.keys(peerDeps).forEach((dep) => {
57
- const inDeps = projectPkg.dependencies && projectPkg.dependencies[dep];
58
- const inDevDeps = projectPkg.devDependencies && projectPkg.devDependencies[dep];
59
- if (!inDeps && !inDevDeps) {
60
- projectPkg.dependencies[dep] = peerDeps[dep];
61
- hasChanged = true;
62
- }
63
- });
64
-
65
- if (hasChanged) {
66
- fs.writeFileSync(targetPath, JSON.stringify(projectPkg, null, 2), 'utf-8');
67
- console.log('\\n\\x1b[32m%s\\x1b[0m', '✅ [MaterialUI Admin] Đã tự động tạo và chèn các dependencies thành công!');
68
- }
69
- } catch(e) {}
70
- }, 1500);
71
- `], {
72
- detached: true,
73
- stdio: 'ignore'
74
- });
75
-
76
- child.unref();
77
- }
78
- } catch (error) {
79
- // Bỏ qua lỗi dev
80
- }