@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.
- package/CHANGELOG.md +322 -0
- package/LICENSE +21 -0
- package/README.md +587 -453
- package/dist/Common-DFahMuQE.cjs +11 -0
- package/dist/Common-_PK8HLKN.js +267 -0
- package/dist/Env-DoS-iQjs.cjs +1 -0
- package/dist/Env-SHztUA3s.js +16 -0
- package/dist/HeaderUpdate-Dirxjmxs.cjs +1 -0
- package/dist/{chunks/HeaderUpdate-DuS-gHNR.js → HeaderUpdate-drlnuHI8.js} +28 -25
- package/dist/SortableItem-C3KzO8Xh.cjs +1 -0
- package/dist/SpinnerLoader-BujLjvC3.cjs +1 -0
- package/dist/{chunks/SpinnerLoader-h8RDIarB.js → SpinnerLoader-CyhOQC6d.js} +2 -2
- package/dist/UDragFile-D8wOZ1Ut.js +96 -0
- package/dist/UDragFile-Db0sK4M7.cjs +1 -0
- package/dist/{chunks/Validator-CXYkI7vJ.js → Validator-D2zwZeov.js} +83 -52
- package/dist/Validator-DBxl8wtE.cjs +1 -0
- package/dist/assets/css/form.css +1 -1
- package/dist/assets/css/index.css +1 -1
- package/dist/ckeditor/ckeditor.d.ts +3 -0
- package/dist/ckeditor/plugins/elfinder.d.ts +11 -0
- package/dist/ckeditor/plugins/fullscreen.d.ts +15 -0
- package/dist/ckeditor/plugins/pdffinder.d.ts +18 -0
- package/dist/ckeditor/types.d.ts +37 -0
- package/dist/common-CEZp8xpQ.js +30 -0
- package/dist/common-ivDX6gGq.cjs +1 -0
- package/dist/components/echarts/index.cjs +1 -0
- package/dist/components/echarts/index.js +1 -1
- package/dist/components/form/AdvancedMultiSelect.d.ts +6 -3
- package/dist/components/form/AsxhUImages.d.ts +2 -1
- package/dist/components/form/BoxAddRow.d.ts +13 -2
- package/dist/components/form/CheckTreeBox.d.ts +12 -3
- package/dist/components/form/CusForm.d.ts +19 -6
- package/dist/components/form/DateInput.d.ts +2 -1
- package/dist/components/form/Editor.d.ts +2 -1
- package/dist/components/form/EfFile.d.ts +2 -1
- package/dist/components/form/EfImage.d.ts +2 -1
- package/dist/components/form/EfImages.d.ts +2 -1
- package/dist/components/form/PImage.d.ts +2 -1
- package/dist/components/form/SelectAddRowBox.d.ts +9 -5
- package/dist/components/form/SelectAddRowBoxAdvanced.d.ts +13 -4
- package/dist/components/form/SelectBox.d.ts +20 -7
- package/dist/components/form/UDragFile.d.ts +2 -1
- package/dist/components/form/UFile.d.ts +2 -1
- package/dist/components/form/UFiles.d.ts +9 -2
- package/dist/components/form/UImages.d.ts +2 -1
- package/dist/components/form/index.cjs +1 -0
- package/dist/components/form/index.js +2 -2
- package/dist/components/loader/SpinnerLoader.d.ts +5 -1
- package/dist/components/loader/index.cjs +1 -0
- package/dist/components/loader/index.js +1 -2
- package/dist/components/meta/CardTable.d.ts +11 -5
- package/dist/components/meta/CardTable.types.d.ts +57 -0
- package/dist/components/meta/CusTooltip.d.ts +8 -2
- package/dist/components/meta/Head.d.ts +10 -1
- package/dist/components/meta/HeaderDetail.d.ts +2 -1
- package/dist/components/meta/HeaderUpdate.d.ts +5 -1
- package/dist/components/meta/ModalForm.d.ts +41 -11
- package/dist/components/meta/Navtabs.d.ts +1 -1
- package/dist/components/meta/ScrollTable.d.ts +7 -3
- package/dist/components/meta/SearchBox.d.ts +8 -5
- package/dist/components/meta/SortableItem.d.ts +11 -1
- package/dist/components/meta/index.cjs +1 -0
- package/dist/components/meta/index.d.ts +1 -0
- package/dist/components/meta/index.js +3 -3
- package/dist/components/sidebar/Sidebar.types.d.ts +9 -7
- package/dist/components/sidebar/index.cjs +1 -0
- package/dist/components/sidebar/index.js +1 -1
- package/dist/components/single/Detail.d.ts +8 -3
- package/dist/components/single/Fields.d.ts +10 -4
- package/dist/components/single/Import.d.ts +8 -3
- package/dist/components/single/List.d.ts +33 -7
- package/dist/components/single/Update.d.ts +10 -4
- package/dist/components/single/UpdateDetail.d.ts +3 -2
- package/dist/components/single/UpdateTableDetail.d.ts +4 -3
- package/dist/components/single/index.cjs +1 -0
- package/dist/components/single/index.js +1 -1
- package/dist/components/top-navbar/index.cjs +1 -0
- package/dist/components/top-navbar/index.js +78 -2
- package/dist/echarts-Bi3uwLbg.cjs +1 -0
- package/dist/{chunks/echarts-CRmndsxC.js → echarts-CTzMqeR5.js} +4 -4
- package/dist/form-heyswTRq.js +3897 -0
- package/dist/form-sgtop6li.cjs +49 -0
- package/dist/hook/common.d.ts +87 -0
- package/dist/hook/detail.cjs +1 -0
- package/dist/hook/detail.d.ts +9 -15
- package/dist/hook/detail.js +1 -11
- package/dist/hook/fields.cjs +1 -0
- package/dist/hook/fields.d.ts +6 -14
- package/dist/hook/fields.js +1 -11
- package/dist/hook/import.d.ts +6 -11
- package/dist/hook/index.cjs +1 -0
- package/dist/hook/index.d.ts +29 -20
- package/dist/hook/index.js +14 -11
- package/dist/hook/update.cjs +1 -0
- package/dist/hook/update.d.ts +11 -19
- package/dist/hook/update.js +12 -9
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +14 -11
- package/dist/meta-BANk9kHW.cjs +1 -0
- package/dist/meta-CheDAmMh.js +745 -0
- package/dist/rolldown-runtime-BocRIvOZ.cjs +1 -0
- package/dist/sidebar-CfQAYWi-.cjs +1 -0
- package/dist/{chunks/sidebar-Dj4Xr9du.js → sidebar-CzRmfvhi.js} +10 -13
- package/dist/{chunks/single-CRF61o_U.js → single-BsJ7TYJi.js} +364 -282
- package/dist/single-C2WPEjhk.cjs +1 -0
- package/dist/style.cjs +0 -0
- package/dist/style.d.ts +0 -0
- package/dist/style.js +0 -0
- package/dist/types/Menu.d.ts +25 -0
- package/dist/utils/Common.d.ts +224 -43
- package/dist/utils/CusRoute.d.ts +21 -1
- package/dist/utils/Env.d.ts +23 -2
- package/dist/utils/Group.d.ts +12 -1
- package/dist/utils/Validator.d.ts +34 -12
- package/dist/utils/index.cjs +11 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +212 -171
- package/package.json +190 -163
- package/dist/chunks/Common-BURf0rBN.js +0 -222
- package/dist/chunks/Env-DRXhvUcb.js +0 -16
- package/dist/chunks/UDragFile-BnUR3riq.js +0 -92
- package/dist/chunks/form-CPkpL5eA.js +0 -45889
- package/dist/chunks/loader-BUiOnhOH.js +0 -1
- package/dist/chunks/meta-4qPWijBT.js +0 -758
- package/dist/chunks/top-navbar-Bob0gMUh.js +0 -78
- package/scripts/postinstall.cjs +0 -80
- /package/dist/{chunks/SortableItem-B4-Zsso3.js → SortableItem-B4-Zsso3.js} +0 -0
- /package/dist/{components/meta/Pdfviewer.d.ts → hook/import.cjs} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **BỎ bundle `ckeditor.js`, dùng source TypeScript trực tiếp (BREAKING).**
|
|
13
|
+
`src/ckeditor/ckeditor.js` — file webpack build sẵn (~1.37 MB) — đã bị xoá và
|
|
14
|
+
thay bằng source TS nằm ngay trong repo: `ckeditor.ts` + `plugins/{elfinder,
|
|
15
|
+
pdffinder,fullscreen}.ts` + `types.ts`. `Editor.tsx` import trực tiếp module
|
|
16
|
+
mới nên sửa plugin/toolbar giờ được typecheck và lint như phần còn lại của
|
|
17
|
+
`src/`, thay vì phải build lại rồi copy file.
|
|
18
|
+
|
|
19
|
+
Hệ quả mong muốn:
|
|
20
|
+
- CKEditor **không còn** bị đóng cứng ở version 47.3.0 — nay dùng version
|
|
21
|
+
của consumer (`ckeditor5` ^48.4.0), nên không còn trường hợp lệch version
|
|
22
|
+
giữa code JS và CSS.
|
|
23
|
+
- `ckeditor5` là optional peer dependency và `vite.config.ts` đánh dấu
|
|
24
|
+
external, nên CKEditor **không** bị đóng gói vào `dist/` (đã kiểm tra:
|
|
25
|
+
output chỉ còn `import ... from "ckeditor5"`, 0 dòng code CKEditor).
|
|
26
|
+
App của consumer chỉ có **một** bản CKEditor duy nhất.
|
|
27
|
+
- `import "ckeditor5/ckeditor5.css"` được giữ nguyên — CSS giờ lấy từ
|
|
28
|
+
package thay vì bị webpack nhúng vào bundle.
|
|
29
|
+
|
|
30
|
+
Không đổi hành vi runtime: toolbar, `defaultConfig`, và logic 3 plugin được
|
|
31
|
+
giữ nguyên so với bản build cũ. `src/types/ckeditor.d.ts` (ambient
|
|
32
|
+
`declare module` vì `.js` không có type) cũng bị xoá vì không còn cần.
|
|
33
|
+
|
|
34
|
+
Thay đổi phụ trong `Editor.tsx`: `config` không còn ép `as any` mà được
|
|
35
|
+
kiểu `M4DEditorConfig`, và `editor.plugins.get("WordCount")` chuyển sang
|
|
36
|
+
`editor.plugins.get(WordCount)` để `wordCountContainer` có đúng kiểu.
|
|
37
|
+
|
|
38
|
+
## [2.4.0] - 2026-09-27
|
|
39
|
+
|
|
40
|
+
Ba lỗi chặn publish, tìm ra bằng cách **pack thật rồi cài vào một project sạch**
|
|
41
|
+
và typecheck với `skipLibCheck: false`. `npm run typecheck` bên trong repo không
|
|
42
|
+
bắt được loại lỗi này — nó chỉ chứng minh `.d.ts` nhất quán với source.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- **Kiểu dùng chung không lấy được từ bất kỳ entry point nào.** `MenuPermissionItem`
|
|
47
|
+
(`types/Menu`) và `TableService` (`CardTable.types`) tồn tại nhưng không được
|
|
48
|
+
re-export: consumer muốn type object `service` mà `CardTable` yêu cầu thì buộc
|
|
49
|
+
phải tự viết lại cấu trúc. Đã export từ `src/index.ts` và `meta/index.ts`;
|
|
50
|
+
đồng thời thêm `hook` + kiểu của `utils` vào entry chính.
|
|
51
|
+
- **`Validator.d.ts` làm vỡ typecheck của consumer.** File này để lộ
|
|
52
|
+
`JQuery<HTMLInputElement>` và `JQuery.Promise<...>` — `@types/jquery` v4 đã bỏ
|
|
53
|
+
cả hai. Thay bằng alias nội bộ `Jq`/`JqPromise`. Lưu ý: phải ép kiểu ngay tại
|
|
54
|
+
`$.Deferred()`, nếu để suy ra thì `dts` vẫn ghi ra `JQuery.Promise`.
|
|
55
|
+
- **`ModalForm.d.ts` rò rỉ kiểu của `bootstrap`**, mà `@types/bootstrap` không
|
|
56
|
+
được khai ở đâu. Consumer phải tự cài thêm chỉ để typecheck. Thay bằng
|
|
57
|
+
interface tối thiểu `ModalInstance { hide(); show() }`.
|
|
58
|
+
- Thêm `*.tgz` vào `.gitignore` (artifact `npm pack` dễ bị commit nhầm).
|
|
59
|
+
- Thêm override `scripts/**` cho ESLint — đó là code Node, không phải browser.
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- **`npm run test:consumer`** — consumer smoke test: `npm pack`, cài tarball vào
|
|
64
|
+
thư mục tạm, cài peer deps, rồi `tsc --noEmit` với `skipLibCheck: false` trên
|
|
65
|
+
một file import **mọi** subpath trong `exports` cùng các kiểu dùng chung.
|
|
66
|
+
Chạy trong CI ngay sau `Build`.
|
|
67
|
+
|
|
68
|
+
Đây là gate chống lại đúng loại bug đã xảy ra ở bản này. Ba lỗi trên đều
|
|
69
|
+
lọt qua mọi gate sẵn có và chỉ lộ ra khi dùng thật; giờ nó thành check tự động
|
|
70
|
+
thay vì kiến thức miễng phí trong đầu.
|
|
71
|
+
|
|
72
|
+
## [2.3.0] - 2026-09-27
|
|
73
|
+
|
|
74
|
+
Test coverage cho nhóm component form, rồi mới xoá `any` — làm đúng thứ tự để
|
|
75
|
+
mọi thay đổi hành vi đều có test bảo vệ.
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- **`BoxAddRow` rơi vào vòng lặp render vô hạn khi không truyền `data`.**
|
|
80
|
+
Giá trị mặc định `data = []` tạo một mảng **mới ở mỗi lần render**, nên
|
|
81
|
+
`useEffect([data])` luôn thấy tham chiếu khác → gọi `setRows` → render lại →
|
|
82
|
+
lặp lại. Component này sẽ **ăn 100% CPU** ngay khi dùng mà không truyền
|
|
83
|
+
`data`. Sửa bằng hằng `EMPTY_ROWS` ở module scope.
|
|
84
|
+
_(Phát hiện khi test chạy: process Node quay 330s CPU không dừng.)_
|
|
85
|
+
- **`BoxAddRow.addRow` đọc `rows` từ closure** — hai lần bấm trong cùng một batch
|
|
86
|
+
sẽ cùng thấy `rows` cũ và dòng thứ hai ghi đè dòng thứ nhất. Dùng `rowsRef`
|
|
87
|
+
để luôn đọc bản mới nhất, thay vì `setRows(prev => ...)` (bên trong updater
|
|
88
|
+
không được gọi `onChange` vì updater là hàm thuần, React có thể gọi lại).
|
|
89
|
+
- `SelectAddRowBox`: `detailRow` là `null`/`undefined` thì `setDetails` nhận
|
|
90
|
+
`null` vào state mà khai báo là mảng.
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- Xoá `any` trong các component form đã có test: `CheckTreeBox` (thêm export
|
|
95
|
+
`TreeNode`), `AdvancedMultiSelect` (thêm `SelectValue`), `SelectAddRowBox`
|
|
96
|
+
(thêm export `DetailRow`, `rendeRowData` có chữ ký đầy đủ), `EfFile`, `DateInput`,
|
|
97
|
+
`BoxAddRow` (thêm export `Row` + helper `langValue`).
|
|
98
|
+
- `hook/common.ts` thêm `FormChangeHandler` — 8 component form dùng chung kiểu
|
|
99
|
+
này thay cho `(e: any) => void`.
|
|
100
|
+
|
|
101
|
+
### Tests
|
|
102
|
+
|
|
103
|
+
Thêm 4 file test cho `BoxAddRow`, `AdvancedMultiSelect`, `CheckTreeBox`,
|
|
104
|
+
`SelectAddRowBox`, `DateInput`, `DateTimeInput`, `EfFile`.
|
|
105
|
+
MUI X DatePicker và elFinder (jQuery) được mock — chỉ test logic của component ta.
|
|
106
|
+
|
|
107
|
+
### Metrics
|
|
108
|
+
|
|
109
|
+
| | Trước | Sau |
|
|
110
|
+
| ------------------- | -----: | ---------: |
|
|
111
|
+
| Coverage statements | 60.65% | **69.16%** |
|
|
112
|
+
| Coverage lines | 63.06% | **71.49%** |
|
|
113
|
+
| Coverage branch | 54.39% | **63.04%** |
|
|
114
|
+
| Test files | 29 | **32** |
|
|
115
|
+
| `any` trong `src` | 230 | **200** |
|
|
116
|
+
| ESLint warnings | 348 | **312** |
|
|
117
|
+
|
|
118
|
+
Còn 2 file runtime chưa có test: `Editor.tsx` (CKEditor + elFinder) và
|
|
119
|
+
`SelectAddRowBoxAdvanced.tsx`.
|
|
120
|
+
|
|
121
|
+
## [2.2.0] - 2026-09-27
|
|
122
|
+
|
|
123
|
+
Type-safety pass focused on the **public API**. Runtime behaviour is unchanged.
|
|
124
|
+
|
|
125
|
+
### Added
|
|
126
|
+
|
|
127
|
+
- **`src/hook/common.ts`** — nơi khai báo các kiểu và hàm dùng chung cho mọi
|
|
128
|
+
trang CRUD: `BasePropsType`, `FormValue`, `FormScalar`, `CrudItem`, `ItemState`,
|
|
129
|
+
`getItemId()`, `handleHookChange()`. Bốn file hook (`detail`, `fields`,
|
|
130
|
+
`import`, `update`) trước đây khai báo **bốn bản `PropsType` giống hệt** với
|
|
131
|
+
`menuData: any[]` / `user: any`, và ba bản `handleHookChange` copy-paste.
|
|
132
|
+
- `getItemId()` — đọc `id` an toàn khi `item` là sentinel `false` (nhánh 404).
|
|
133
|
+
`item?.id` không dùng được vì optional chaining không xử lý `false`.
|
|
134
|
+
- `ApiResponse<T>` + **function overloads** cho `callFetchApiToken`. Khi `isTry`
|
|
135
|
+
là `true` (mặc định) hàm luôn ném lỗi và **không bao giờ** trả `false`, nên
|
|
136
|
+
kiểu trả về là `ApiResponse<T>`; chỉ khi truyền `isTry: false` mới phải hẹp
|
|
137
|
+
kiểu trước khi đọc `.data`. Trước đây `any` che mất đúng yêu cầu này.
|
|
138
|
+
- `DateInput`, `StatusOption`, `getStatus()` — định nghĩa cho các helper định
|
|
139
|
+
dạng ngày và bảng trạng thái.
|
|
140
|
+
- `ModalFormProps` / `ModalFormBody` được export (trước: `ModalProps` nội bộ,
|
|
141
|
+
không ai dùng được).
|
|
142
|
+
|
|
143
|
+
### Changed
|
|
144
|
+
|
|
145
|
+
- **BREAKING (types only):** `ModalForm` đổi từ 9 prop `any` sang kiểu cụ thể
|
|
146
|
+
(`RefObject<HTMLDivElement | null>`, `FormValue`, `React.CSSProperties`...).
|
|
147
|
+
`HeaderUpdate.itemId` thành tuỳ chọn — trang "thêm mới" không có bản ghi.
|
|
148
|
+
- `CusRoute.addGS` nhận `RouteElement = ReactNode | false` thay vì `any = false`.
|
|
149
|
+
- `UpdateDetail.render` / `UpdateTableDetail.render`: bỏ vòng bảo vệ
|
|
150
|
+
`((id && item) || !id) && (...)` trả về `false` — nhánh đó đã bị `Error404`
|
|
151
|
+
ở trên bắt hết, và làm kiểu `render()` không còn hợp lệ.
|
|
152
|
+
|
|
153
|
+
### Fixed
|
|
154
|
+
|
|
155
|
+
- Gộp 3 bản trùng lặp: `handleHookChange` (3 file → 1), các hàm trạng thái
|
|
156
|
+
`getActiveStatus` / `getPublishStatus` / `getTrueFlaseStatus` (3 bản gần như
|
|
157
|
+
giống hệt → `getStatus`), và 4 hàm `formatDate*` (gom phần tách ngày vào
|
|
158
|
+
`dateParts`). `TableFormBody` nay re-export từ `ModalForm` thay vì định nghĩa
|
|
159
|
+
lại — trước đó chữ ký có thể lệch nhau.
|
|
160
|
+
|
|
161
|
+
### Metrics
|
|
162
|
+
|
|
163
|
+
`any` trong `src`: **289 → 230** (−20%). ESLint warnings: **420 → 348**.
|
|
164
|
+
Không đổi hành vi runtime; 29/29 test file vẫn pass.
|
|
165
|
+
|
|
166
|
+
Phần còn lại tập trung ở `Validator.ts` (port jQuery, bản chất động) và các
|
|
167
|
+
component form (`SelectBox`, `CusForm`, `AdvancedMultiSelect`, `Editor`...).
|
|
168
|
+
|
|
169
|
+
## [2.1.1] - 2026-09-27
|
|
170
|
+
|
|
171
|
+
### Fixed
|
|
172
|
+
|
|
173
|
+
- **`dist/assets/css/index.css` phình từ 1.25 MB lên 27.7 MB.** Bản 2.1.0 bật
|
|
174
|
+
`@import` của `fontawesome-642-pro/css/all.min.css`; file đó khai báo 9 font
|
|
175
|
+
family × (ttf + woff2) và Vite 8 (Rolldown) gom tất cả thành data URI
|
|
176
|
+
base64 — **26.46 MB nhúng trong CSS**. Mọi consumer
|
|
177
|
+
`import "@materialui-reactjs/admin/style.css"` đều phải tải toàn bộ 26 MB đó.
|
|
178
|
+
|
|
179
|
+
Plugin `copy-fontawesome` giờ gỡ các data URI đó sau khi build, thay bằng
|
|
180
|
+
`url("../../fontawesome/webfonts/<file>")` trỏ tới bản font đã được copy sẵn.
|
|
181
|
+
Ánh xạ dựa trên **nội dung** file (khớp base64) nên không phụ thuộc thứ tự hay
|
|
182
|
+
tên file; data URI nào không khớp sẽ được giữ nguyên và build in cảnh báo.
|
|
183
|
+
|
|
184
|
+
Kết quả: `index.css` **27.70 MB → 1.65 MB**, tổng `dist` **42.76 MB → 16.71 MB**.
|
|
185
|
+
Phần còn lại (63 data URI) là sprite PNG/GIF nhỏ của elFinder và
|
|
186
|
+
`material-icons.woff2` — inline là hành vi mong muốn.
|
|
187
|
+
|
|
188
|
+
Ghi chú: `build.assetsInlineLimit` **không dùng được** ở đây; option này không
|
|
189
|
+
được gọi khi Vite 8/Rolldown xử lý `url()` trong CSS (đã thử cả dạng số lẫn
|
|
190
|
+
dạng hàm). Nếu bản Vite sau này hỗ trợ, có thể bỏ bước hậu kỳ này.
|
|
191
|
+
|
|
192
|
+
## [2.1.0] - 2026-09-27
|
|
193
|
+
|
|
194
|
+
Type-safety pass plus a test-suite expansion. No new features; the public API
|
|
195
|
+
surface is the same, but several public **types** are now stricter, which can
|
|
196
|
+
surface compile errors in consumer code that was relying on `any`.
|
|
197
|
+
|
|
198
|
+
### Added
|
|
199
|
+
|
|
200
|
+
- **Formatting is now enforced.** `npm run verify` runs
|
|
201
|
+
`format:check → lint → typecheck → test`, and CI gained a dedicated `Format`
|
|
202
|
+
step. Prettier was previously configured but never gated — 78 source files
|
|
203
|
+
failed `prettier --check`, and 36 of 94 mixed tabs and spaces. Everything is
|
|
204
|
+
now formatted, so `format:check` is a real gate rather than decoration.
|
|
205
|
+
- **New shared type modules.** `src/types/Menu.ts` (`MenuPermissionItem`) and
|
|
206
|
+
`src/components/meta/CardTable.types.ts` (`TableService`, `TableOptions`,
|
|
207
|
+
`TableColumnConfig`, `TableFilterConfig`, `TableFormBody`) replace inline
|
|
208
|
+
`any`-typed shapes.
|
|
209
|
+
- Test coverage for `src/components` and the hook/util helpers that previously
|
|
210
|
+
had none: `SingleIndex`, `SingleDetail` / `SingleUpdateDetail` /
|
|
211
|
+
`SingleUpdateTableDetail`, `SingleFields` / `SingleImport`, `CusForm`,
|
|
212
|
+
`SelectBox` / `SelectMBox`, `PImage` / `EfImage` / `EfImages` / `UDragFile`,
|
|
213
|
+
`Sidebar` / `SidebarItem`, all five ECharts wrappers, `ModalForm`, `NavTabs`,
|
|
214
|
+
`TopNavbar`, `BtnGroup`, `HeaderDetail`, `Head`, `PDFEmbed`, `SortableItem`,
|
|
215
|
+
`CusRoute`, and the `detail` / `fields` / `update` hooks. Overall statement
|
|
216
|
+
coverage goes from **32% to 61%** (190 → 386 tests).
|
|
217
|
+
|
|
218
|
+
### Fixed
|
|
219
|
+
|
|
220
|
+
- **`handleDeleteOne` and `CardTable.handleDelete` used `GET` to delete.**
|
|
221
|
+
`GET` is defined as a safe, idempotent method, so a crawler, browser
|
|
222
|
+
prefetch, or proxy cache could trigger a destructive request. Both now send
|
|
223
|
+
`DELETE`.
|
|
224
|
+
- **`CardTable.handleChange` stored a `Promise` as the table filter.**
|
|
225
|
+
`handleParamChange` is `async` but its result was not awaited, so
|
|
226
|
+
`dataTb.filter` became a `Promise` object and every subsequent request
|
|
227
|
+
(pagination, search) sent the wrong query.
|
|
228
|
+
- **`SearchBox` read a literal `filter?.field` instead of `filter?.[field]`.**
|
|
229
|
+
Because the property name was a string literal, search inputs never showed
|
|
230
|
+
the value they were filtering by.
|
|
231
|
+
- **`RatioKeyVal` generated radio `id`s with `Math.random() % 10`.** With only
|
|
232
|
+
ten possible values, two radios in a group could collide, so `<label
|
|
233
|
+
htmlFor>` pointed at the wrong input and clicking a label selected the wrong
|
|
234
|
+
option; the id also changed on every re-render. Now uses `useId()`.
|
|
235
|
+
- **Empty `FileList` produced `undefined` instead of `null`.**
|
|
236
|
+
`files ? files[0] : null` kept `undefined` for an empty (but truthy)
|
|
237
|
+
`FileList`, and `JSON.stringify` then dropped the key entirely from the
|
|
238
|
+
request payload. Now `files?.[0] ?? null` in the `detail`, `fields` and
|
|
239
|
+
`update` hooks.
|
|
240
|
+
- **`SingleFields` could emit an unhandled promise rejection.** The API call
|
|
241
|
+
lives in a `setState` callback, which React does not await, so the error
|
|
242
|
+
bypassed the `try/catch` in `initDidMount` entirely. It is now caught at the
|
|
243
|
+
call site and surfaced through `showSweetAlertError`.
|
|
244
|
+
|
|
245
|
+
### Changed
|
|
246
|
+
|
|
247
|
+
- **BREAKING (types only):** public prop/state types no longer carry an
|
|
248
|
+
`[key: string]: any` index signature. `PropsType`, `StateType` and
|
|
249
|
+
`StateTable` in `hook/index`, `CardTableProps`, and `SearchBoxProps` are
|
|
250
|
+
declared field by field, and `SpinnerLoader`'s `loading` prop is now
|
|
251
|
+
optional. Consumer code that passed extra, undeclared props will no longer
|
|
252
|
+
compile.
|
|
253
|
+
- **BREAKING (types only):** `CardTable`'s `frmBody` is now typed as a render
|
|
254
|
+
_function_ — `TableFormBody = (formData, onChange) => ReactNode` — which is
|
|
255
|
+
how `ModalForm` has always invoked it (`frmBody(formData, handleChange)`).
|
|
256
|
+
Passing a plain element crashed with "frmBody is not a function"; existing
|
|
257
|
+
tests missed it because they stubbed `ModalForm` out.
|
|
258
|
+
- `checkPermission` and `menuData` are typed with `MenuPermissionItem`, which
|
|
259
|
+
`MenuItem` now extends. `MenuItem.code` accepts `number | string` because the
|
|
260
|
+
function compares with `Number()` to tolerate string codes from the API.
|
|
261
|
+
|
|
262
|
+
### Removed
|
|
263
|
+
|
|
264
|
+
- `src/components/meta/Pdfviewer.tsx` — 330 lines that were **entirely
|
|
265
|
+
commented out** and not referenced by any export. It was still typechecked
|
|
266
|
+
and lint-checked on every run for no benefit.
|
|
267
|
+
|
|
268
|
+
## [2.0.0] - 2026-09-27
|
|
269
|
+
|
|
270
|
+
### Added
|
|
271
|
+
|
|
272
|
+
- **CommonJS build.** `build.lib.formats` now emits both `es` and `cjs`.
|
|
273
|
+
Every subpath export gains a `require` condition, so the package works in
|
|
274
|
+
CommonJS toolchains (Jest default resolver, webpack 4, legacy Node).
|
|
275
|
+
`main` now points to `./dist/index.cjs`.
|
|
276
|
+
- `exports["./package.json"]` — lets tools such as `jest-resolver` read package
|
|
277
|
+
metadata through the exports map.
|
|
278
|
+
- `LICENSE` (MIT) and this changelog are now published in the tarball.
|
|
279
|
+
- ESLint (flat config) + Prettier, wired into `npm run verify`.
|
|
280
|
+
- GitHub Actions CI running lint → typecheck → test → build.
|
|
281
|
+
- Regression tests for `CardTable` pagination and `SingleUpdate` 403/404
|
|
282
|
+
branches (previously untested).
|
|
283
|
+
|
|
284
|
+
### Fixed
|
|
285
|
+
|
|
286
|
+
- **DECLARED `ckeditor5` as a dependency.** `Editor.tsx` imports
|
|
287
|
+
`ckeditor5/ckeditor5.css`, but `ckeditor5` was never declared in
|
|
288
|
+
`package.json` — it only resolved because it was hoisted from
|
|
289
|
+
`@ckeditor/ckeditor5-react` → `@ckeditor/ckeditor5-integrations-common`.
|
|
290
|
+
A transitive bump or removal upstream would have broken `Editor` builds for
|
|
291
|
+
every consumer. Now declared as an **optional** peer dependency plus a dev
|
|
292
|
+
dependency for building/testing.
|
|
293
|
+
- **`CardTable` pagination no longer stalls.** `handleClickPage` set the new
|
|
294
|
+
page filter but never re-fetched, and the mount effect is guarded by
|
|
295
|
+
`didFetch.current` — so changing page left the previous rows on screen.
|
|
296
|
+
`fetchData` now accepts an explicit filter to avoid the stale-closure read of
|
|
297
|
+
`dataTb.filter`.
|
|
298
|
+
- `package-lock.json` is no longer git-ignored, so builds are reproducible.
|
|
299
|
+
- `src/service.ts` removed from `.gitignore` (it is source code, not a secret).
|
|
300
|
+
|
|
301
|
+
### Changed
|
|
302
|
+
|
|
303
|
+
- **BREAKING: CSS is no longer auto-injected into the main entry.** The main
|
|
304
|
+
entry previously imported a ~1.4 MB stylesheet (material-dashboard,
|
|
305
|
+
jquery-ui, elFinder, icon fonts), which every consumer downloaded regardless
|
|
306
|
+
of which components they used.
|
|
307
|
+
|
|
308
|
+
```diff
|
|
309
|
+
- import "@materialui-reactjs/admin";
|
|
310
|
+
+ import "@materialui-reactjs/admin";
|
|
311
|
+
+ import "@materialui-reactjs/admin/style.css";
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
The emitted file path (`dist/assets/css/index.css`) is unchanged, so the
|
|
315
|
+
documented `@materialui-reactjs/admin/style.css` subpath keeps working.
|
|
316
|
+
|
|
317
|
+
- `engines.node` relaxed from `>=24` to `>=20.19.0` (Vite 8's actual floor), so
|
|
318
|
+
the package no longer excludes Node 20/22 LTS.
|
|
319
|
+
|
|
320
|
+
## [1.0.6]
|
|
321
|
+
|
|
322
|
+
- Initial public release.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 @materialui-reactjs/admin contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|