@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/dist/hook/update.d.ts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
user: any;
|
|
6
|
-
}
|
|
1
|
+
import { FormError } from './import';
|
|
2
|
+
import { CrudItem, FormChangeEvent, FormValue } from './common';
|
|
3
|
+
export type { BasePropsType as PropsType } from './common';
|
|
4
|
+
export type { FormError } from './import';
|
|
7
5
|
export interface StateType {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
/** Bản ghi đang sửa, hoặc `false` khi API trả rỗng (đi vào nhánh 404). */
|
|
7
|
+
item?: CrudItem | false;
|
|
8
|
+
formValue: FormValue;
|
|
10
9
|
loading?: boolean;
|
|
11
|
-
error?:
|
|
12
|
-
[key: string]: string;
|
|
13
|
-
} | string;
|
|
10
|
+
error?: FormError;
|
|
14
11
|
isCre?: boolean;
|
|
15
12
|
isEdit?: boolean;
|
|
16
13
|
isDetail?: boolean;
|
|
17
|
-
[key: string]: any;
|
|
18
14
|
}
|
|
19
|
-
export declare const handleHookChange: (e:
|
|
20
|
-
[name]: File | null;
|
|
21
|
-
} | {
|
|
22
|
-
[name]: string | Record<string, any>;
|
|
23
|
-
};
|
|
15
|
+
export declare const handleHookChange: (e: FormChangeEvent) => FormValue;
|
|
24
16
|
export declare const handleObjChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => {
|
|
25
17
|
name: string;
|
|
26
18
|
type: string;
|
|
@@ -28,6 +20,6 @@ export declare const handleObjChange: (e: React.ChangeEvent<HTMLInputElement | H
|
|
|
28
20
|
} | {
|
|
29
21
|
name: string;
|
|
30
22
|
type: string;
|
|
31
|
-
value:
|
|
23
|
+
value: CrudItem;
|
|
32
24
|
};
|
|
33
|
-
export declare const deepMerge: (target:
|
|
25
|
+
export declare const deepMerge: (target: FormValue, source: FormValue) => FormValue;
|
package/dist/hook/update.js
CHANGED
|
@@ -4,29 +4,32 @@ var e = (e) => {
|
|
|
4
4
|
let { name: n, type: r, value: i } = t(e);
|
|
5
5
|
if (r === "file") {
|
|
6
6
|
let t = e.target.files;
|
|
7
|
-
return { [n]: t
|
|
7
|
+
return { [n]: t?.[0] ?? null };
|
|
8
8
|
}
|
|
9
9
|
return { [n]: i };
|
|
10
10
|
}, t = (e) => {
|
|
11
|
-
let { name: t, type: n, value: r } = e.target, i = t.split(/[
|
|
11
|
+
let { name: t, type: n, value: r } = e.target, i = t.split(/[{}]+/).filter(Boolean), a = i.shift();
|
|
12
12
|
if (!a || i.length === 0) return {
|
|
13
13
|
name: t,
|
|
14
14
|
type: n,
|
|
15
15
|
value: r
|
|
16
16
|
};
|
|
17
17
|
let o = {}, s = o;
|
|
18
|
-
for (let e = 0; e < i.length - 1; e++)
|
|
18
|
+
for (let e = 0; e < i.length - 1; e++) {
|
|
19
|
+
let t = {};
|
|
20
|
+
s[i[e]] = t, s = t;
|
|
21
|
+
}
|
|
19
22
|
return s[i[i.length - 1]] = r, {
|
|
20
23
|
name: a,
|
|
21
24
|
type: n,
|
|
22
25
|
value: o
|
|
23
26
|
};
|
|
24
|
-
}, n = (e, t) => {
|
|
25
|
-
let
|
|
27
|
+
}, n = (e) => typeof e == "object" && !!e && !Array.isArray(e) && !(e instanceof File) && !(e instanceof Blob), r = (e, t) => {
|
|
28
|
+
let i = { ...e };
|
|
26
29
|
return Object.keys(t).forEach((e) => {
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
+
let a = t[e], o = i[e];
|
|
31
|
+
n(a) && n(o) ? i[e] = r(o, a) : i[e] = a;
|
|
32
|
+
}), i;
|
|
30
33
|
};
|
|
31
34
|
//#endregion
|
|
32
|
-
export {
|
|
35
|
+
export { r as deepMerge, e as handleHookChange, t as handleObjChange };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./form-sgtop6li.cjs"),t=require("./SortableItem-C3KzO8Xh.cjs"),n=require("./UDragFile-Db0sK4M7.cjs"),r=require("./echarts-Bi3uwLbg.cjs"),i=require("./SpinnerLoader-BujLjvC3.cjs");require("./components/loader/index.cjs");const a=require("./meta-BANk9kHW.cjs"),o=require("./HeaderUpdate-Dirxjmxs.cjs"),s=require("./common-ivDX6gGq.cjs"),c=require("./sidebar-CfQAYWi-.cjs"),l=require("./single-C2WPEjhk.cjs"),u=require("./components/top-navbar/index.cjs"),d=require("./hook/index.cjs");exports.AdvancedMultiSelect=e.D,exports.AsxhUImages=e.E,exports.BarChart=r.a,exports.BoxAddRow=e.p,exports.BtnGroup=a.l,exports.CardTable=a.a,exports.CheckBox=e.v,exports.CheckTreeBox=e.f,exports.CusTooltip=o.d,exports.DateInput=e.d,exports.DateTimeInput=e.u,exports.Editor=e.m,exports.EfFile=e.l,exports.EfImage=e.h,exports.EfImages=e.c,exports.ElfinderModal=a.i,exports.Email=e.y,exports.Error403=o.a,exports.Error404=o.i,exports.Head=a.r,exports.HeaderDetail=o.r,exports.HeaderIndex=o.n,exports.HeaderUpdate=o.t,exports.LineChart=r.i,exports.ModalForm=a.c,exports.MultiBarChart=r.r,exports.MultiLineChart=r.n,exports.NavTabs=a.n,exports.NumberText=e.b,exports.PDFEmbed=a.t,exports.PImage=e.s,exports.Pagination=o.u,exports.Password=e.x,exports.PhoneVn=e.S,exports.PieChart=r.t,exports.RatioKeyVal=e.C,exports.ScrollTable=a.s,exports.SearchBox=a.o,exports.SelectAddRowBox=e.o,exports.SelectAddRowBoxAdvanced=e.a,exports.SelectBox=e.g,exports.SelectMBox=e._,exports.Sidebar=c.t,exports.SingleDetail=l.s,exports.SingleFields=l.o,exports.SingleImport=l.a,exports.SingleIndex=l.i,exports.SingleUpdate=l.r,exports.SingleUpdateDetail=l.n,exports.SingleUpdateTableDetail=l.t,exports.SortableItem=t.t,exports.SpinnerLoader=i.t,exports.Text=e.w,exports.Textarea=e.T,exports.TopNavbar=u.TopNavbar,exports.UDragFile=n.t,exports.UFile=e.i,exports.UFiles=e.n,exports.UImages=e.t,exports.convertQueryToSort=d.convertQueryToSort,exports.convertSortToQuery=d.convertSortToQuery,exports.createFormEvent=s.t,exports.fetchHookData=d.fetchHookData,exports.getItemId=s.n,exports.handleHookChange=s.r,exports.handleHookClickPage=d.handleHookClickPage,exports.handleHookSeachForm=d.handleHookSeachForm,exports.handleParamChange=d.handleParamChange,exports.validateRequiredFiles=e.r;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,3 +5,19 @@ export * from './components/meta';
|
|
|
5
5
|
export * from './components/sidebar';
|
|
6
6
|
export * from './components/single';
|
|
7
7
|
export * from './components/top-navbar';
|
|
8
|
+
/**
|
|
9
|
+
* Kiểu dùng chung cho các props bắt buộc người dùng phải cung cấp.
|
|
10
|
+
*
|
|
11
|
+
* Không export từ đây thì consumer không có cách nào lấy được kiểu — ví dụ
|
|
12
|
+
* `CardTable` yêu cầu `service: TableService`, nhưng nếu không re-export thì
|
|
13
|
+
* họ buộc phải tự viết lại cấu trúc, và mọi thay đổi sau này của package
|
|
14
|
+
* không ai biết.
|
|
15
|
+
*/
|
|
16
|
+
export * from './types/Menu';
|
|
17
|
+
export * from './components/meta/CardTable.types';
|
|
18
|
+
/**
|
|
19
|
+
* Kiểu của lớp tiện ích và hook — consumer dùng chúng để tự định nghĩa
|
|
20
|
+
* service/bundle, nên phải lấy được từ entry point chính.
|
|
21
|
+
*/
|
|
22
|
+
export * from './hook';
|
|
23
|
+
export type { ApiResponse, DateInput, StatusOption, RouteElement } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C, w, x as T, y as E } from "./
|
|
2
|
-
import { t as D } from "./
|
|
3
|
-
import { t as O } from "./
|
|
4
|
-
import { a as k, i as A, n as j, r as M, t as N } from "./
|
|
5
|
-
import { t as P } from "./
|
|
6
|
-
import
|
|
7
|
-
import { a as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, d as l, f as u, g as d, h as f, i as p, l as m, m as h, n as g, o as _, p as v, r as y, s as b, t as x, u as S, v as C, w, x as T, y as E } from "./form-heyswTRq.js";
|
|
2
|
+
import { t as D } from "./SortableItem-B4-Zsso3.js";
|
|
3
|
+
import { t as O } from "./UDragFile-D8wOZ1Ut.js";
|
|
4
|
+
import { a as k, i as A, n as j, r as M, t as N } from "./echarts-CTzMqeR5.js";
|
|
5
|
+
import { t as P } from "./SpinnerLoader-CyhOQC6d.js";
|
|
6
|
+
import "./components/loader/index.js";
|
|
7
|
+
import { a as F, c as I, i as L, l as R, n as z, o as B, r as V, s as H, t as U } from "./meta-CheDAmMh.js";
|
|
8
|
+
import { a as W, d as G, i as K, n as q, r as J, t as Y, u as X } from "./HeaderUpdate-drlnuHI8.js";
|
|
9
|
+
import { n as Z, r as Q, t as $ } from "./common-CEZp8xpQ.js";
|
|
10
|
+
import { t as ee } from "./sidebar-CzRmfvhi.js";
|
|
11
|
+
import { a as te, i as ne, n as re, o as ie, r as ae, s as oe, t as se } from "./single-BsJ7TYJi.js";
|
|
12
|
+
import { TopNavbar as ce } from "./components/top-navbar/index.js";
|
|
13
|
+
import { convertQueryToSort as le, convertSortToQuery as ue, fetchHookData as de, handleHookClickPage as fe, handleHookSeachForm as pe, handleParamChange as me } from "./hook/index.js";
|
|
14
|
+
export { t as AdvancedMultiSelect, n as AsxhUImages, k as BarChart, v as BoxAddRow, R as BtnGroup, F as CardTable, C as CheckBox, u as CheckTreeBox, G as CusTooltip, l as DateInput, S as DateTimeInput, h as Editor, m as EfFile, f as EfImage, c as EfImages, L as ElfinderModal, E as Email, W as Error403, K as Error404, V as Head, J as HeaderDetail, q as HeaderIndex, Y as HeaderUpdate, A as LineChart, I as ModalForm, M as MultiBarChart, j as MultiLineChart, z as NavTabs, s as NumberText, U as PDFEmbed, b as PImage, X as Pagination, T as Password, r as PhoneVn, N as PieChart, e as RatioKeyVal, H as ScrollTable, B as SearchBox, _ as SelectAddRowBox, o as SelectAddRowBoxAdvanced, d as SelectBox, a as SelectMBox, ee as Sidebar, oe as SingleDetail, ie as SingleFields, te as SingleImport, ne as SingleIndex, ae as SingleUpdate, re as SingleUpdateDetail, se as SingleUpdateTableDetail, D as SortableItem, P as SpinnerLoader, w as Text, i as Textarea, ce as TopNavbar, O as UDragFile, p as UFile, g as UFiles, x as UImages, le as convertQueryToSort, ue as convertSortToQuery, $ as createFormEvent, de as fetchHookData, Z as getItemId, Q as handleHookChange, fe as handleHookClickPage, pe as handleHookSeachForm, me as handleParamChange, y as validateRequiredFiles };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-BocRIvOZ.cjs"),t=require("./Common-DFahMuQE.cjs"),n=require("./Validator-DBxl8wtE.cjs"),r=require("./HeaderUpdate-Dirxjmxs.cjs");let i=require("react");i=e.t(i,1);let a=require("react-select");a=e.t(a,1);let o=require("react/jsx-runtime"),s=require("bootstrap"),c=require("react-router-dom"),l=require("react-helmet-async");var u=({cUri:e,itemId:t,isEdit:n=!1,isDel:i=!1,onDelete:a})=>(0,o.jsxs)(`div`,{className:`btn-group`,children:[n&&(0,o.jsx)(r.d,{title:`Chỉnh sửa`,children:(0,o.jsx)(c.Link,{to:e+`/edit/`+t,className:`btn btn-sm btn-icon btn-info`,children:(0,o.jsx)(`i`,{className:`material-icons text-white position-relative text-lg`,children:`drive_file_rename_outline`})})}),i&&(0,o.jsx)(r.d,{title:`Xóa`,children:(0,o.jsx)(`button`,{type:`button`,onClick:()=>a?.(t),className:`btn btn-sm btn-icon btn-danger`,children:(0,o.jsx)(`i`,{className:`material-icons text-white position-relative text-lg`,children:`delete`})})})]}),d=({modalRef:e,title:r,apiGetDetail:a,frmBody:l,onSubmit:u,onHide:d,itemId:f,setItemId:p,data:m,clsWidth:h=`xl`,btnTxt:g=`Lưu lại`,style:_={},clsBody:v=``})=>{let y=(0,i.useRef)(null),[b,x]=(0,i.useState)(),[S,C]=(0,i.useState)({});(0,i.useEffect)(()=>{if(!e.current)return;x(s.Modal.getOrCreateInstance(e.current,{backdrop:`static`,keyboard:!1}));let t=()=>{y?.current&&new n.t(y?.current).run()},r=()=>{p&&p(0),C({}),y?.current&&new n.t(y?.current).destroy()};return e.current.addEventListener(`shown.bs.modal`,t),e.current.addEventListener(`hidden.bs.modal`,r),()=>{e.current?.removeEventListener(`shown.bs.modal`,t),e.current?.removeEventListener(`hidden.bs.modal`,r)}},[]),(0,i.useEffect)(()=>{f&&(async()=>{try{if(!a)return;y.current&&t.C(y.current,!0);let e=await t.n(a+`/`+f,{},`GET`,`application/json`,!1),n=e?e.data:void 0;y.current&&t.C(y.current,!1),C(n??{})}catch(e){console.log(e)}})()},[f]),(0,i.useEffect)(()=>{m&&C(m)},[m]);let w=e=>{e.preventDefault(),document.activeElement?.blur(),b?.hide(),d&&d()};return(0,o.jsx)(`div`,{ref:e,className:`modal fade p-0 mx-auto`,tabIndex:-1,"data-bs-backdrop":`static`,"data-bs-keyboard":`false`,children:(0,o.jsx)(`div`,{className:`modal-dialog modal-${h}`,style:_,children:(0,o.jsx)(`div`,{className:`modal-content`,children:(0,o.jsxs)(c.Form,{ref:y,className:`position-relative`,encType:`multipart/form-data`,"data-toggle":`validator`,role:`form`,method:`POST`,onSubmit:async e=>{if(e.preventDefault(),!y?.current)return;let t=new n.t(y?.current);!t.hasErrors()&&!t.isIncomplete()&&b&&u(S,b,C)},children:[(0,o.jsxs)(`div`,{className:`modal-header py-3`,children:[(0,o.jsx)(`h5`,{className:`modal-title`,children:r}),(0,o.jsx)(`button`,{type:`button`,className:`btn-close btn-md-close`,onClick:w,children:(0,o.jsx)(`span`,{"aria-hidden":`true`,children:(0,o.jsx)(`i`,{className:`fal fa-times`,style:{fontSize:`1rem`}})})})]}),(0,o.jsx)(`div`,{className:`modal-body rounded-bottom pb-0 ${v}`,style:{overflowY:`auto`},children:l(S,async e=>{let{name:t,value:r}=n.i(e);C(e=>({...e,[t]:r}))})}),(0,o.jsxs)(`div`,{className:`modal-footer d-flex justify-content-center`,children:[(0,o.jsx)(`button`,{type:`button`,className:`btn btn-secondary btn-md-close`,"data-bs-original-title":`reply`,onClick:w,children:`Hủy`}),(0,o.jsx)(`button`,{type:`submit`,className:`btn btn-success`,"data-bs-original-title":`save`,children:g})]})]})})})})},f=({header:e,data:t,numOfFirst:n=0,numOfLast:r=0,columnWidth:a=200,...s})=>{let c=Array.isArray(e)?e:[],l=Array.isArray(t)?t:[],u=(0,i.useRef)(null),[d,f]=(0,i.useState)(0),[p,m]=(0,i.useState)(0),[h,g]=(0,i.useState)(!1),[_,v]=(0,i.useState)(!1),y=(e,t,n,r)=>e<n?{position:`left`}:e>=t-r?{position:`right`}:{position:`none`};(0,i.useEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{f(e.scrollLeft),m(e.scrollWidth-e.offsetWidth)};return t(),e.addEventListener(`scroll`,t),window.addEventListener(`resize`,t),()=>{e.removeEventListener(`scroll`,t),window.removeEventListener(`resize`,t)}},[]),(0,i.useEffect)(()=>{let e=d>5,t=d<p-5;g(e),v(t)},[d,p]);let b=e=>{u.current&&(u.current.scrollLeft+=e.deltaY)},x=e=>{u.current&&u.current.scrollBy({left:e?150:-150,behavior:`smooth`})},S=e=>c[e]?.width??a,C=c.slice(0,n).reduce((e,t,n)=>e+S(n),0)||0,w=c.slice(c.length-r).reduce((e,t,n)=>e+S(c.length-r+n),0)||0;return(0,o.jsxs)(`div`,{className:`scroll-table-group`,children:[(0,o.jsx)(`div`,{className:`fade-overlay fade-left ${h?`fade-visible`:`fade-hidden`}`,style:{left:`${C}px`}}),(0,o.jsx)(`div`,{className:`fade-overlay fade-right ${_?`fade-visible`:`fade-hidden`}`,style:{right:`${w}px`}}),h&&(0,o.jsx)(`button`,{title:`Phải`,className:`scroll-btn left-btn`,onClick:()=>x(!1),style:{left:`${C}px`},children:(0,o.jsx)(`i`,{className:`fa-solid fa-chevron-left`})}),_&&(0,o.jsx)(`button`,{title:`Trái`,className:`scroll-btn right-btn`,onClick:()=>x(!0),style:{right:`${w}px`},children:(0,o.jsx)(`i`,{className:`fa-solid fa-chevron-right`})}),(0,o.jsx)(`div`,{ref:u,onWheel:b,className:`table-container`,children:(0,o.jsxs)(`table`,{className:`custom-table`,...s,children:[(0,o.jsx)(`thead`,{children:(0,o.jsx)(`tr`,{className:`text-center`,children:c.map((e,t)=>{let{position:i}=y(t,c.length,n,r),s=e.width??a,l={left:i===`left`?`${c.slice(0,t).reduce((e,t,n)=>e+S(n),0)}px`:void 0,right:i===`right`?`${c.slice(t+1).reduce((e,n,r)=>e+S(t+1+r),0)}px`:void 0,minWidth:`${s}px`};return(0,o.jsx)(`th`,{style:l,className:`custom-th ${i===`none`?``:`sticky-col`} ${e.thClassName??``}`,children:e.label},t)})})}),(0,o.jsxs)(`tbody`,{children:[l.map((e,t)=>(0,o.jsx)(`tr`,{className:`custom-tr`,children:c.map((t,i)=>{let s=Object.values(e)[i],{position:l}=y(i,c.length,n,r),u=t.width??a,d={left:l===`left`?`${c.slice(0,i).reduce((e,t,n)=>e+S(n),0)}px`:void 0,right:l===`right`?`${c.slice(i+1).reduce((e,t,n)=>e+S(i+1+n),0)}px`:void 0,minWidth:`${u}px`};return(0,o.jsx)(`td`,{style:d,className:`custom-td ${l===`none`?``:`sticky-col`} ${t.tdClassName??``}`,children:s},i)})},t)),l.length?``:(0,o.jsx)(`tr`,{className:`text-center`,children:(0,o.jsx)(`td`,{className:`px-3 pt-2`,colSpan:20,children:(0,o.jsx)(`p`,{children:`Không có dữ liệu`})})})]})]})})]})},p=(e,t)=>{t?.(e);let n=e.currentTarget.closest(`.input-group-outline`);e.currentTarget.value.trim()===``?n?.classList.remove(`is-filled`):n?.classList.add(`is-filled`)},m=e=>{e.preventDefault(),e.currentTarget.closest(`.input-group-outline`)?.classList.add(`is-focused`)},h=e=>{e.preventDefault(),e.currentTarget.closest(`.input-group-outline`)?.classList.remove(`is-focused`)},g=({label:e,name:t,value:r=``,required:a=!1,disabled:s=!1,readonly:c=!1,cpnClass:l=``,minLength:u=0,maxLength:d=255,onChange:f,style:g={}})=>{let _=(0,i.useRef)(null);return(0,i.useEffect)(()=>{document.activeElement!==_.current&&f&&f(n.a(t,r))},[r]),(0,o.jsx)(`div`,{className:`form-group `+(l??``),children:(0,o.jsxs)(`div`,{className:`input-group input-group-outline ${r?`is-filled`:``}`,children:[(0,o.jsx)(`div`,{className:`form-label`,children:e+(a?` *`:``)}),(0,o.jsx)(`input`,{style:g,name:t,placeholder:``,readOnly:c,disabled:s,required:a,minLength:u,maxLength:d,"data-required-error":`Vui lòng nhập dữ liệu`,"data-error":`Dữ liệu không hợp lệ`,className:`form-control`,value:r,onChange:e=>p(e,f),onFocus:m,onBlur:h})]})})},_=(e,t)=>e.find(e=>e.value===t)||null,v=(e,t,n,r,i)=>{let a=[];r&&a.push({value:-1,label:`Tất cả`}),i&&a.push({value:0,label:`Không có`});let o=Array.isArray(e)?e.map(e=>({value:e[t],label:e[n]})):[];return[...a,...o]},y=({label:e,name:t,lists:r=[],keyValue:s=`id`,keyName:c=`name`,value:l=``,cpnClass:u=``,required:d=!1,disabled:f=!1,all:p=!1,zero:m=!1,onChange:h,style:g={}})=>{let[y,b]=(0,i.useState)([]);(0,i.useEffect)(()=>{b(v(r,s,c,p,m))},[r]);let x=(0,i.useRef)(!1);(0,i.useEffect)(()=>{x.current||y.length&&(x.current=!0,h?.(n.a(t,l)))},[y]);let S=e=>{h&&h(n.a(t,e))},C=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=C.current?.querySelector(`input[name="${t}"][required]`);e&&e.setCustomValidity(l?``:`Vui lòng nhập dữ liệu`)},[l,t,d]),(0,o.jsx)(`div`,{ref:C,className:`form-group box-select `+(u??``),style:g,children:(0,o.jsxs)(`div`,{className:`input-group input-group-outline is-filled`,children:[(0,o.jsx)(`span`,{className:`form-label`,children:e+(d?` *`:``)}),(0,o.jsx)(a.default,{menuPortalTarget:document.body,styles:{menuPortal:e=>({...e,zIndex:99999})},classNamePrefix:`react-select`,placeholder:`Chọn`,name:t,options:y,value:_(y,l),onChange:e=>S(e?.value??null),noOptionsMessage:()=>`Không có dữ liệu`,isDisabled:f,required:d,"data-required-error":`Vui lòng nhập dữ liệu`,"data-error":`Dữ liệu không hợp lệ`,className:`form-control`})]})})},b=({ftfield:e,service:t,options:n,filter:r,handleChange:i,handleSearchForm:a})=>{let s=Array.isArray(e)?e:[];return(0,o.jsxs)(c.Form,{className:`d-flex align-items-center`,onSubmit:a,children:[(0,o.jsx)(`div`,{className:`mb-3 me-3`,children:`Tìm kiếm`}),(0,o.jsx)(`div`,{className:`row grid-space-16 row-cols-${s.length} flex-1`,children:s.map((e,a)=>{let s=t.ftFields(e);switch(s.type){case`text`:return(0,o.jsx)(g,{style:{minWidth:100},label:t.fieldName(e),name:e,cpnClass:`mb-3 col`,value:String(r?.[e]??``),onChange:i},a);case`select`:{let c=typeof s.option==`string`?n?.[s.option]??[]:s.option??[],l=s.keyName||`name`;return(0,o.jsx)(y,{style:{minWidth:100},label:t.fieldName(e),name:e,lists:c,keyName:l,cpnClass:`mb-3 col`,all:!0,value:r?.[e]??-1,onChange:i},a)}default:return``}})}),(0,o.jsx)(`div`,{className:`mb-3 ms-3`,children:(0,o.jsx)(`button`,{title:`Tìm kiếm`,type:`submit`,className:`btn btn-primary`,children:`Tìm`})})]})},x=({frmBody:e,service:n,apiOption:a,options:l,tbOption:u,roleOption:p,clsWidth:m=`xl`,btnTxt:h=`Lưu lại`})=>{let g=(0,i.useRef)(null),_=(0,c.useNavigate)(),[v,y]=(0,i.useState)(0),[x,S]=(0,i.useState)({items:[],page:1,filter:{},length:10,pageTotal:0,recordTotal:0}),C=(0,i.useRef)(!1);(0,i.useEffect)(()=>{C.current||(C.current=!0,w())},[]);let w=async e=>{try{let n=a.filter||{},r=e??x.filter??{},i=(await t.n(a.apiGetData,{...r,...n},`GET`))?.data??{};S({...x,...i,items:Array.isArray(i.items)?i.items:[],filter:i.filter??{...r,...n}})}catch(e){console.log(e)}},T=e=>{if(!g.current)return;let t=s.Modal.getOrCreateInstance(g?.current,{backdrop:`static`,keyboard:!1});y(e),t.show()},E=async e=>{try{e.preventDefault();let t=await r.s(e,x?.filter||{},a?.cUri,_);S({...x,filter:t}),await w(t)}catch(e){console.log(e)}},D=async e=>{e.preventDefault();let t=await r.l(e,x?.filter||{});S({...x,filter:t})},O=async e=>{e.preventDefault(),await w()},k=async(e,n)=>{try{g?.current&&t.C(g?.current,!0),e={...e,...a.formData};let r=e.id,i=r?a.apiEdit+`/`+r:a.apiCreate,o=await t.n(i,e,`POST`);r?t.S(`Cập nhật thành công`,`top-end`,!0):t.S(`Thêm mới thành công`,`top-end`,!0),o?.data?.id&&(await w(),document.activeElement?.blur(),n.hide())}catch(e){t.x(t.s(e))}finally{g?.current&&t.C(g?.current,!1)}},A=async e=>{try{if(!(await t.b()).isConfirmed)return;await t.n(`${a.apiDelete}/${e}`,{},`DELETE`),t.S(`Xoá thành công!`,`top-end`,!0),await w()}catch(e){t.x(t.s(e))}},j=[],M=u.numOfLast-1;j.push({label:`STT`,width:50,tdClassName:`text-center px-0`});for(let e of u?.tbfield??[]){let t=n.tbFields(e);j.push({label:n.fieldName(e),width:t?.width||150,tdClassName:t?.tdClassName||`text-start`})}(p?.isDelOne||p?.isEdit)&&(M+=1,j.push({label:`Thao tác`,width:100,align:`center`,thClassName:`p-0`,tdClassName:`text-center`}));let N=x?.items?.length?x?.items.map((e,r)=>{let i={};i.stt=r+1;for(let r of u?.tbfield??[]){let a=n.tbFields(r);switch(a.type){case`number`:i[r]=e[r]?.toLocaleString(`vi-VN`);break;case`selecthtml`:{let t=a?.func;i[r]=t?(0,o.jsx)(`span`,{dangerouslySetInnerHTML:{__html:String(t(e[r],!0))}}):(0,o.jsx)(`span`,{children:e[r]??``});break}case`select`:{let t=a?.func;i[r]=t?t(e[r],!0):e[r];break}case`date`:i[r]=t.l(e[r]);break;default:i[r]=e[r]}}return(p?.isDelOne||p?.isEdit)&&(i.action=(0,o.jsxs)(`div`,{className:`btn-group`,children:[(0,o.jsx)(`button`,{title:`Chỉnh sửa`,type:`button`,onClick:()=>T(e.id),className:`btn btn-sm btn-icon btn-info`,children:(0,o.jsx)(`i`,{className:`material-icons text-white position-relative text-lg`,children:`drive_file_rename_outline`})}),(0,o.jsx)(`button`,{title:`Xóa`,type:`button`,onClick:()=>A(e.id),className:`btn btn-sm btn-icon btn-danger`,children:(0,o.jsx)(`i`,{className:`material-icons text-white position-relative text-lg`,children:`delete`})})]})),i}):[];return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`div`,{className:`card mb-20`,children:[(0,o.jsxs)(`div`,{className:`card-header flex-auto col-auto d-flex align-items-center`,children:[(0,o.jsx)(`h3`,{className:`card-title`,children:u.title}),p?.isCre&&(0,o.jsx)(`button`,{type:`button`,title:`Thêm mới`,className:`btn btn-success btn-sm btn-icon ms-auto`,onClick:()=>T(0),children:(0,o.jsx)(`i`,{className:`material-icons text-white position-relative text-lg`,children:`add`})})]}),(0,o.jsx)(`hr`,{className:`m-0`}),(0,o.jsxs)(`div`,{className:`card-body`,children:[(0,o.jsx)(b,{ftfield:u.ftfield,service:n,options:l,filter:x?.filter||{},handleChange:D,handleSearchForm:O}),(0,o.jsx)(f,{header:j,data:N,numOfFirst:u.numOfFirst,numOfLast:M,columnWidth:u.columnWidth}),x?.items?.length?(0,o.jsx)(r.u,{data:x,onChange:D,onClickPage:E}):``]})]}),(0,o.jsx)(d,{title:`Thêm mới`,modalRef:g,frmBody:e,clsWidth:m,onSubmit:k,btnTxt:h,itemId:v,setItemId:y,apiGetDetail:a.apiGetDetail})]})},S=({id:e,title:t=`Hình ảnh`,clsWidth:n=`xl`,elId:r})=>(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(`div`,{id:e,className:`modal fade p-0 mx-auto`,"data-bs-backdrop":`static`,"data-bs-keyboard":`false`,children:(0,o.jsx)(`div`,{className:`modal-dialog modal-dialog-scrollable modal-${n}`,children:(0,o.jsxs)(`div`,{className:`modal-content`,children:[(0,o.jsxs)(`div`,{className:`modal-header py-3`,children:[(0,o.jsx)(`h5`,{className:`modal-title`,children:t}),(0,o.jsx)(`button`,{type:`button`,className:`btn-close btn-md-close`,children:(0,o.jsx)(`span`,{"aria-hidden":`true`,children:(0,o.jsx)(`i`,{className:`fal fa-times`,style:{fontSize:`1rem`}})})})]}),(0,o.jsx)(`div`,{className:`modal-body rounded-bottom pb-0`,children:(0,o.jsx)(`div`,{id:r,style:{height:`500px`}})})]})})})}),C=({config:e})=>(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)(l.Helmet,{children:[(0,o.jsx)(`title`,{children:e?.name}),(0,o.jsx)(`link`,{rel:`shortcut icon`,href:t.m(e?.favicon||`/styles/favicon.ico`),type:`image/x-icon`}),(0,o.jsx)(`link`,{rel:`canonical`,href:`/`}),(0,o.jsx)(`link`,{rel:`apple-touch-icon`,href:t.m(e?.logotext||`/styles/logotext.png`)}),(0,o.jsx)(`link`,{rel:`stylesheet`,type:`text/css`,href:`https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900|Roboto+Slab:400,700`})]})});function w({tabs:e,onChange:t}){let n=Array.isArray(e)?e:[],r=(0,i.useRef)(null),a=(0,i.useRef)(null),s=(0,i.useRef)([]),[c,l]=(0,i.useState)(n[0]?.key),u=e=>{let t=a.current,n=s.current[e],i=r.current;if(!t||!n||!i)return;let o=i.getBoundingClientRect(),c=n.getBoundingClientRect(),l=c.left-o.left;t.style.width=`${c.width}px`,t.style.transform=`translate3d(${l}px, 0, 0)`};(0,i.useLayoutEffect)(()=>{if(!n.length)return;let e=n.findIndex(e=>e.key===c),t=e===-1?0:e;l(n[t].key),u(t)},[e]),(0,i.useLayoutEffect)(()=>{let e=n.findIndex(e=>e.key===c);e!==-1&&u(e)},[c]),(0,i.useEffect)(()=>{if(!r.current)return;let e=()=>{let e=n.findIndex(e=>e.key===c);e!==-1&&u(e)};window.addEventListener(`resize`,e);let t=new ResizeObserver(e);return t.observe(r.current),()=>{window.removeEventListener(`resize`,e),t.disconnect()}},[c,e]);let d=e=>{l(e),t?.(e)};return(0,o.jsx)(`div`,{className:`nav-wrapper position-relative`,children:(0,o.jsxs)(`ul`,{ref:r,className:`nav nav-pills nav-fill p-1 position-relative`,children:[(0,o.jsx)(`div`,{ref:a,className:`moving-tab position-absolute nav-link`,style:{padding:0,top:`0.25rem`,left:0,pointerEvents:`none`,transition:`transform 0.5s ease, width 0.5s ease`,willChange:`transform, width`,zIndex:1},children:(0,o.jsx)(`div`,{className:`nav-link mb-0 px-0 py-2 cursor-pointer active`,children:n.find(e=>e.key===c)?.label})}),n.map((e,t)=>(0,o.jsx)(`li`,{ref:e=>{e&&(s.current[t]=e)},className:`nav-item`,children:(0,o.jsx)(`div`,{className:`nav-link cursor-pointer align-middle ${c===e.key?`active`:``}`,onClick:()=>d(e.key),style:{position:`relative`,zIndex:2},children:(0,o.jsxs)(`div`,{className:`d-flex align-items-center justify-content-center`,children:[e.icon&&(0,o.jsx)(`i`,{className:`material-icons text-md position-relative line-height-1 me-1`,style:{top:0},children:e.icon}),e.label]})})},e.key))]})})}function T({src:e,title:t=`PDF Viewer`,fullWidth:n=!0,fullHeight:r=!0,className:i=``,style:a={}}){let s={width:n?`100%`:`auto`,height:r?`100vh`:`600px`,border:`none`,...a};return(0,o.jsx)(`div`,{className:`w-full h-full ${i}`,style:{position:`relative`},children:(0,o.jsx)(`iframe`,{src:e,title:t,style:s,allow:`fullscreen`})})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}});
|