aq-fe-framework 0.1.309 → 0.1.311
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/dist/chunk-HHJFKKE7.mjs +26 -0
- package/dist/chunk-JIPPFPV6.mjs +518 -0
- package/dist/{chunk-NRFQDAYS.mjs → chunk-M6B6SXA3.mjs} +5 -5
- package/dist/{chunk-XUB2YHGX.mjs → chunk-N2VHHQPH.mjs} +164 -308
- package/dist/{chunk-KKJ3OEEW.mjs → chunk-QPNYGFTI.mjs} +50 -7
- package/dist/components/index.d.mts +7 -15
- package/dist/components/index.mjs +4 -7
- package/dist/core/index.d.mts +20 -8
- package/dist/core/index.mjs +20 -336
- package/dist/{createBaseApi-BAYnbGVT.d.mts → createBaseApi-2GYRG_xt.d.mts} +13 -4
- package/dist/hooks/index.d.mts +20 -3
- package/dist/hooks/index.mjs +5 -1
- package/dist/interfaces/index.d.mts +6 -2
- package/dist/modules-features/index.d.mts +102 -35
- package/dist/modules-features/index.mjs +1457 -874
- package/dist/utils/index.mjs +1 -1
- package/package.json +1 -2
- package/dist/chunk-DRLKXVYU.mjs +0 -55
@@ -3,14 +3,53 @@ import {
|
|
3
3
|
__spreadValues
|
4
4
|
} from "./chunk-FWCSY2DS.mjs";
|
5
5
|
|
6
|
+
// src/hooks/useMyDevice.ts
|
7
|
+
import { useMediaQuery } from "@mantine/hooks";
|
8
|
+
function useMyDevice() {
|
9
|
+
const isMobile = useMediaQuery("(max-width: 768px)");
|
10
|
+
const isTablet = useMediaQuery("(max-width: 1024px)");
|
11
|
+
const isPc = !isTablet;
|
12
|
+
return {
|
13
|
+
isMobile,
|
14
|
+
isTablet: isTablet && !isMobile,
|
15
|
+
// từ 769px đến 1024px
|
16
|
+
isPc
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
// src/hooks/useMyRouter.tsx
|
21
|
+
import { usePathname, useRouter } from "next/navigation";
|
22
|
+
function useMyRouter() {
|
23
|
+
const pathName = usePathname();
|
24
|
+
const router = useRouter();
|
25
|
+
function pushUrl(url) {
|
26
|
+
router.push(pathName + url);
|
27
|
+
}
|
28
|
+
return __spreadProps(__spreadValues({}, router), {
|
29
|
+
pushUrl
|
30
|
+
});
|
31
|
+
}
|
32
|
+
|
6
33
|
// src/hooks/custom-hooks/createBaseApi.ts
|
7
34
|
function createBaseApi(baseUrl, axiosInstance) {
|
8
35
|
return {
|
9
|
-
get: ({
|
10
|
-
|
36
|
+
get: ({
|
37
|
+
params = "",
|
38
|
+
id,
|
39
|
+
paging
|
40
|
+
} = {}) => {
|
41
|
+
return axiosInstance.get(`${baseUrl}/get` + params, { params: __spreadProps(__spreadValues({}, paging), { id }) });
|
11
42
|
},
|
12
|
-
getAll: ({
|
13
|
-
|
43
|
+
getAll: ({
|
44
|
+
params = "",
|
45
|
+
cols,
|
46
|
+
paging
|
47
|
+
} = {}) => {
|
48
|
+
return axiosInstance.get(`${baseUrl}/GetAll` + params, {
|
49
|
+
params: __spreadValues({
|
50
|
+
cols: cols == null ? void 0 : cols.join(",")
|
51
|
+
}, paging)
|
52
|
+
});
|
14
53
|
},
|
15
54
|
create: (data) => {
|
16
55
|
return axiosInstance.post(`${baseUrl}/create`, __spreadProps(__spreadValues({}, data), {
|
@@ -22,8 +61,11 @@ function createBaseApi(baseUrl, axiosInstance) {
|
|
22
61
|
update: (data) => {
|
23
62
|
return axiosInstance.post(`${baseUrl}/update`, data);
|
24
63
|
},
|
25
|
-
|
26
|
-
return axiosInstance.post(`${baseUrl}/
|
64
|
+
updateList: (data) => {
|
65
|
+
return axiosInstance.post(`${baseUrl}/updateList`, data);
|
66
|
+
},
|
67
|
+
createOrUpdateList: (data) => {
|
68
|
+
return axiosInstance.post(`${baseUrl}/createOrUpdateList`, data);
|
27
69
|
},
|
28
70
|
delete: (id) => {
|
29
71
|
return axiosInstance.post(`${baseUrl}/delete`, { id });
|
@@ -99,7 +141,6 @@ function useMyReactMutation({
|
|
99
141
|
return res.data.data;
|
100
142
|
},
|
101
143
|
onError: (e) => {
|
102
|
-
console.log();
|
103
144
|
if (e.message === null || e.message === "null") {
|
104
145
|
notifications.show({
|
105
146
|
message: "Kh\xF4ng th\u1EC3 thao t\xE1c, l\u1ED7i ch\u01B0a x\xE1c \u0111\u1ECBnh!",
|
@@ -160,6 +201,8 @@ function useQ_SkillCenter_GetAll() {
|
|
160
201
|
}
|
161
202
|
|
162
203
|
export {
|
204
|
+
useMyDevice,
|
205
|
+
useMyRouter,
|
163
206
|
createBaseApi,
|
164
207
|
baseAxios_default,
|
165
208
|
useLoadAxiosConfig,
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { ReactNode, ComponentProps } from 'react';
|
3
3
|
import { t as type_action, T as TYPES_MANTINE_SIZE } from '../types-B5rmBuXz.mjs';
|
4
4
|
import { ActionIconProps, ButtonProps, useModalsStack, CheckboxProps, SelectProps, NumberFormatterProps, FieldsetProps, FileInputProps, NumberInputProps, TextareaProps, MantineSize, InputWrapperProps, TextInputProps, ContainerProps, FlexProps, GroupProps, TypographyStylesProviderProps, TabsProps, SkeletonProps } from '@mantine/core';
|
5
|
-
import { M as MyApiResponse } from '../createBaseApi-
|
5
|
+
import { M as MyApiResponse } from '../createBaseApi-2GYRG_xt.mjs';
|
6
6
|
import { AxiosResponse } from 'axios';
|
7
7
|
import { useDisclosure, useListState } from '@mantine/hooks';
|
8
8
|
import { UseFormReturnType, useForm } from '@mantine/form';
|
@@ -315,8 +315,12 @@ interface MyDataTableProps<TData extends MRT_RowData> extends MRT_TableOptions<T
|
|
315
315
|
setSelectedRow?: (data: any) => void;
|
316
316
|
isError?: boolean;
|
317
317
|
isLoading?: boolean;
|
318
|
+
pagination?: {
|
319
|
+
pageIndex: number;
|
320
|
+
pageSize: number;
|
321
|
+
};
|
318
322
|
}
|
319
|
-
declare function MyDataTable<TData extends MRT_RowData>({ formats, exportAble, csvConfigProps, rowActionSize, columns, data, renderTopToolbarCustomActions, setSelectedRow, isError, isLoading, ...rest }: MyDataTableProps<TData>): react_jsx_runtime.JSX.Element | undefined;
|
323
|
+
declare function MyDataTable<TData extends MRT_RowData>({ formats, exportAble, csvConfigProps, rowActionSize, columns, data, renderTopToolbarCustomActions, setSelectedRow, isError, isLoading, pagination, ...rest }: MyDataTableProps<TData>): react_jsx_runtime.JSX.Element | undefined;
|
320
324
|
|
321
325
|
interface MyIconTextProps {
|
322
326
|
icon?: React.ElementType;
|
@@ -395,18 +399,6 @@ interface IMyTextInput extends TextInputProps {
|
|
395
399
|
}
|
396
400
|
declare function MyTextInput({ label, defaultValue, isPhoneNumber, ...rest }: IMyTextInput): react_jsx_runtime.JSX.Element;
|
397
401
|
|
398
|
-
interface IWeeklySession {
|
399
|
-
dayOfWeek: number;
|
400
|
-
startPeriod: number;
|
401
|
-
numberOfPeriods: number;
|
402
|
-
durationMinutes: number;
|
403
|
-
}
|
404
|
-
interface WeeklySessionSchedulerProps {
|
405
|
-
value?: IWeeklySession[];
|
406
|
-
onChange?: (val: IWeeklySession[]) => void;
|
407
|
-
}
|
408
|
-
declare function MyWeeklySessionSchedulerPicker({ value, onChange, }: WeeklySessionSchedulerProps): react_jsx_runtime.JSX.Element;
|
409
|
-
|
410
402
|
interface I$2 {
|
411
403
|
moduleCode?: string;
|
412
404
|
moduleName?: string;
|
@@ -541,4 +533,4 @@ interface IMySkeletonTable extends SkeletonProps {
|
|
541
533
|
}
|
542
534
|
declare function MySkeletonTable({ h }: IMySkeletonTable): react_jsx_runtime.JSX.Element;
|
543
535
|
|
544
|
-
export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor,
|
536
|
+
export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor, I_BasicAppShell_LinkItem, MyActionIcon, MyActionIconCheck, MyActionIconDelete, MyActionIconDownloadPDF, MyActionIconModal, MyActionIconUpdate, MyActionIconUpload, MyActionIconViewPDF, MyAnchorViewPDF, MyAppSpotlight, MyBoxesBackground, MyBoxesCore, MyButton, MyButtonCreate, MyButtonDeleteList, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonPrintTablePDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardInformation, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, type MyDataTableInternalProps, type MyDataTableProps, MyDataTableSelect, MyDateInput, MyFieldset, MyFileInput, MyFlexColumn, MyFlexEnd, MyFlexRow, MyHtmlWrapper, MyIconText, MyKeyLabel, MyNumberFormatter, MyNumberInput, MyPageContent, MyScheduleX, MySelect, MySelectAPIGet, MySkeletonTable, MySwitchTheme, MyTab, MyTextArea, MyTextEditor, MyTextInput, SelectFieldModal, SelectFileModal, type SelectFileModalProps, useHeaderMegaMenuStore, useS_BasicAppShell, useS_ButtonImport };
|
@@ -57,7 +57,6 @@ import {
|
|
57
57
|
MyTextArea,
|
58
58
|
MyTextEditor,
|
59
59
|
MyTextInput,
|
60
|
-
MyWeeklySessionSchedulerPicker,
|
61
60
|
SelectFieldModal,
|
62
61
|
SelectFileModal,
|
63
62
|
groupToTwoLevels,
|
@@ -65,15 +64,14 @@ import {
|
|
65
64
|
useS_BasicAppShell,
|
66
65
|
useS_ButtonImport,
|
67
66
|
utils_layout_getItemsWithoutLinks
|
68
|
-
} from "../chunk-
|
67
|
+
} from "../chunk-N2VHHQPH.mjs";
|
69
68
|
import "../chunk-5U2JSHSJ.mjs";
|
70
|
-
import "../chunk-NWBLJ3W3.mjs";
|
71
69
|
import {
|
72
70
|
MyFlexColumn,
|
73
71
|
MyFlexRow
|
74
|
-
} from "../chunk-
|
75
|
-
import "../chunk-
|
76
|
-
import "../chunk-
|
72
|
+
} from "../chunk-HHJFKKE7.mjs";
|
73
|
+
import "../chunk-NWBLJ3W3.mjs";
|
74
|
+
import "../chunk-QPNYGFTI.mjs";
|
77
75
|
import "../chunk-7ZCOFATU.mjs";
|
78
76
|
import "../chunk-Y3YGC5IH.mjs";
|
79
77
|
import "../chunk-FWCSY2DS.mjs";
|
@@ -138,7 +136,6 @@ export {
|
|
138
136
|
MyTextArea,
|
139
137
|
MyTextEditor,
|
140
138
|
MyTextInput,
|
141
|
-
MyWeeklySessionSchedulerPicker,
|
142
139
|
SelectFieldModal,
|
143
140
|
SelectFileModal,
|
144
141
|
groupToTwoLevels,
|
package/dist/core/index.d.mts
CHANGED
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { t as type_action } from '../types-B5rmBuXz.mjs';
|
3
3
|
import { ActionIconProps, ButtonProps, ModalProps, TextInputProps } from '@mantine/core';
|
4
4
|
import { ReactNode } from 'react';
|
5
|
-
import { M as MyApiResponse } from '../createBaseApi-
|
5
|
+
import { M as MyApiResponse } from '../createBaseApi-2GYRG_xt.mjs';
|
6
6
|
import { AxiosResponse } from 'axios';
|
7
7
|
import { UseFormReturnType } from '@mantine/form';
|
8
8
|
import { useDisclosure } from '@mantine/hooks';
|
@@ -11,13 +11,13 @@ import '../base-BprRafT5.mjs';
|
|
11
11
|
interface CoreActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
|
12
12
|
actionType?: type_action;
|
13
13
|
}
|
14
|
-
declare function
|
14
|
+
declare function MyActionIcon({ children, actionType, ...rest }: CoreActionIconProps): react_jsx_runtime.JSX.Element;
|
15
15
|
|
16
16
|
interface CoreButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ButtonProps {
|
17
17
|
actionType?: type_action;
|
18
18
|
children?: ReactNode;
|
19
19
|
}
|
20
|
-
declare function
|
20
|
+
declare function MyButton({ children, actionType, ...rest }: CoreButtonProps): react_jsx_runtime.JSX.Element;
|
21
21
|
|
22
22
|
interface CoreButtonCreateUpdateProps<IReq, IRes> {
|
23
23
|
modalProps?: Omit<ModalProps, "opened" | "onClose">;
|
@@ -33,7 +33,7 @@ interface CoreButtonCreateUpdateProps<IReq, IRes> {
|
|
33
33
|
disclosure?: ReturnType<typeof useDisclosure>;
|
34
34
|
children?: ReactNode;
|
35
35
|
}
|
36
|
-
declare function
|
36
|
+
declare function MyButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, form, onSubmit, onSuccess, onError, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
|
37
37
|
|
38
38
|
interface CoreButtonModalProps {
|
39
39
|
children?: ReactNode;
|
@@ -41,19 +41,31 @@ interface CoreButtonModalProps {
|
|
41
41
|
buttonProps?: ButtonProps;
|
42
42
|
modalProps?: ModalProps;
|
43
43
|
}
|
44
|
-
declare function
|
44
|
+
declare function MyButtonModal({ disclosure, children, buttonProps, modalProps, }: CoreButtonModalProps): react_jsx_runtime.JSX.Element;
|
45
45
|
|
46
46
|
interface CoreDayOfWeekPickerProps {
|
47
47
|
value?: number[];
|
48
48
|
onChange?: (val: number[]) => void;
|
49
49
|
}
|
50
|
-
declare function
|
50
|
+
declare function MyDayOfWeekPicker({ value, onChange }: CoreDayOfWeekPickerProps): react_jsx_runtime.JSX.Element;
|
51
51
|
|
52
52
|
interface CoreTextInputProps extends TextInputProps {
|
53
53
|
label?: string;
|
54
54
|
defaultValue?: string;
|
55
55
|
isPhoneNumber?: boolean;
|
56
56
|
}
|
57
|
-
declare function
|
57
|
+
declare function MyTextInput({ label, isPhoneNumber, ...rest }: CoreTextInputProps): react_jsx_runtime.JSX.Element;
|
58
58
|
|
59
|
-
|
59
|
+
interface IWeeklySession {
|
60
|
+
dayOfWeek: number;
|
61
|
+
startPeriod: number;
|
62
|
+
numberOfPeriods: number;
|
63
|
+
durationMinutes: number;
|
64
|
+
}
|
65
|
+
interface WeeklySessionSchedulerProps {
|
66
|
+
value?: IWeeklySession[];
|
67
|
+
onChange?: (val: IWeeklySession[]) => void;
|
68
|
+
}
|
69
|
+
declare function MyWeeklySessionSchedulerPicker({ value, onChange, }: WeeklySessionSchedulerProps): react_jsx_runtime.JSX.Element;
|
70
|
+
|
71
|
+
export { type IWeeklySession, MyActionIcon, MyButton, MyButtonCreateUpdate, MyButtonModal, MyDayOfWeekPicker, MyTextInput, MyWeeklySessionSchedulerPicker, type WeeklySessionSchedulerProps };
|
package/dist/core/index.mjs
CHANGED
@@ -1,340 +1,24 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
MyActionIcon,
|
3
|
+
MyButton,
|
4
|
+
MyButtonCreateUpdate,
|
5
|
+
MyButtonModal,
|
6
|
+
MyDayOfWeekPicker,
|
7
|
+
MyTextInput,
|
8
|
+
MyWeeklySessionSchedulerPicker
|
9
|
+
} from "../chunk-JIPPFPV6.mjs";
|
10
|
+
import "../chunk-HHJFKKE7.mjs";
|
11
|
+
import "../chunk-NWBLJ3W3.mjs";
|
5
12
|
import "../chunk-K6S7R6LU.mjs";
|
6
|
-
import
|
7
|
-
|
8
|
-
|
9
|
-
import {
|
10
|
-
utils_notification_show
|
11
|
-
} from "../chunk-7ZCOFATU.mjs";
|
12
|
-
import {
|
13
|
-
__objRest,
|
14
|
-
__spreadProps,
|
15
|
-
__spreadValues
|
16
|
-
} from "../chunk-FWCSY2DS.mjs";
|
17
|
-
|
18
|
-
// src/core/button/CoreActionIcon.tsx
|
19
|
-
import { ActionIcon } from "@mantine/core";
|
20
|
-
import {
|
21
|
-
IconDeviceFloppy,
|
22
|
-
IconEdit,
|
23
|
-
IconFileExport,
|
24
|
-
IconFileImport,
|
25
|
-
IconPlus,
|
26
|
-
IconPrinter,
|
27
|
-
IconTrash,
|
28
|
-
IconX
|
29
|
-
} from "@tabler/icons-react";
|
30
|
-
import { jsx } from "react/jsx-runtime";
|
31
|
-
var actionConfig = {
|
32
|
-
default: {},
|
33
|
-
create: {
|
34
|
-
color: "indigo",
|
35
|
-
type: "submit",
|
36
|
-
icon: /* @__PURE__ */ jsx(IconPlus, {})
|
37
|
-
},
|
38
|
-
createMultiple: {
|
39
|
-
color: "green",
|
40
|
-
type: "submit",
|
41
|
-
icon: /* @__PURE__ */ jsx(IconPlus, {})
|
42
|
-
},
|
43
|
-
delete: {
|
44
|
-
color: "red",
|
45
|
-
icon: /* @__PURE__ */ jsx(IconTrash, {})
|
46
|
-
},
|
47
|
-
update: {
|
48
|
-
color: "yellow",
|
49
|
-
type: "submit",
|
50
|
-
icon: /* @__PURE__ */ jsx(IconEdit, {})
|
51
|
-
},
|
52
|
-
save: {
|
53
|
-
color: "blue",
|
54
|
-
type: "submit",
|
55
|
-
icon: /* @__PURE__ */ jsx(IconDeviceFloppy, {})
|
56
|
-
},
|
57
|
-
import: {
|
58
|
-
color: "green.8",
|
59
|
-
icon: /* @__PURE__ */ jsx(IconFileImport, {})
|
60
|
-
},
|
61
|
-
print: {
|
62
|
-
color: "orange.7",
|
63
|
-
icon: /* @__PURE__ */ jsx(IconPrinter, {})
|
64
|
-
},
|
65
|
-
export: {
|
66
|
-
color: "green.8",
|
67
|
-
icon: /* @__PURE__ */ jsx(IconFileExport, {})
|
68
|
-
},
|
69
|
-
cancel: {
|
70
|
-
color: "gray",
|
71
|
-
icon: /* @__PURE__ */ jsx(IconX, {})
|
72
|
-
},
|
73
|
-
select: {},
|
74
|
-
check: {}
|
75
|
-
};
|
76
|
-
function CoreActionIcon(_a) {
|
77
|
-
var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
|
78
|
-
if (!actionType) {
|
79
|
-
return /* @__PURE__ */ jsx(ActionIcon, __spreadProps(__spreadValues({}, rest), { children }));
|
80
|
-
}
|
81
|
-
const config = actionConfig[actionType];
|
82
|
-
return /* @__PURE__ */ jsx(
|
83
|
-
ActionIcon,
|
84
|
-
__spreadProps(__spreadValues({
|
85
|
-
color: config.color,
|
86
|
-
type: config.type
|
87
|
-
}, rest), {
|
88
|
-
children: config.icon
|
89
|
-
})
|
90
|
-
);
|
91
|
-
}
|
92
|
-
|
93
|
-
// src/core/button/CoreButton.tsx
|
94
|
-
import { Button as Button2 } from "@mantine/core";
|
95
|
-
import {
|
96
|
-
IconDeviceFloppy as IconDeviceFloppy2,
|
97
|
-
IconEdit as IconEdit2,
|
98
|
-
IconFileExport as IconFileExport2,
|
99
|
-
IconFileImport as IconFileImport2,
|
100
|
-
IconPlus as IconPlus2,
|
101
|
-
IconPrinter as IconPrinter2,
|
102
|
-
IconTrash as IconTrash2,
|
103
|
-
IconX as IconX2
|
104
|
-
} from "@tabler/icons-react";
|
105
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
106
|
-
var actionConfig2 = {
|
107
|
-
default: {
|
108
|
-
defaultText: ""
|
109
|
-
},
|
110
|
-
create: {
|
111
|
-
color: "blue",
|
112
|
-
type: "submit",
|
113
|
-
icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
|
114
|
-
defaultText: "L\u01B0u"
|
115
|
-
},
|
116
|
-
createMultiple: {
|
117
|
-
color: "green",
|
118
|
-
type: "submit",
|
119
|
-
icon: /* @__PURE__ */ jsx2(IconPlus2, {}),
|
120
|
-
defaultText: "Th\xEAm danh s\xE1ch"
|
121
|
-
},
|
122
|
-
delete: {
|
123
|
-
color: "red",
|
124
|
-
icon: /* @__PURE__ */ jsx2(IconTrash2, {}),
|
125
|
-
defaultText: "X\xF3a"
|
126
|
-
},
|
127
|
-
update: {
|
128
|
-
color: "yellow",
|
129
|
-
type: "submit",
|
130
|
-
icon: /* @__PURE__ */ jsx2(IconEdit2, {}),
|
131
|
-
defaultText: "Ch\u1EC9nh s\u1EEDa"
|
132
|
-
},
|
133
|
-
save: {
|
134
|
-
color: "blue",
|
135
|
-
type: "submit",
|
136
|
-
icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
|
137
|
-
defaultText: "L\u01B0u"
|
138
|
-
},
|
139
|
-
import: {
|
140
|
-
color: "green.8",
|
141
|
-
icon: /* @__PURE__ */ jsx2(IconFileImport2, {}),
|
142
|
-
defaultText: "Import"
|
143
|
-
},
|
144
|
-
print: {
|
145
|
-
color: "orange.7",
|
146
|
-
icon: /* @__PURE__ */ jsx2(IconPrinter2, {}),
|
147
|
-
defaultText: "In"
|
148
|
-
},
|
149
|
-
export: {
|
150
|
-
color: "green.8",
|
151
|
-
icon: /* @__PURE__ */ jsx2(IconFileExport2, {}),
|
152
|
-
defaultText: "Export"
|
153
|
-
},
|
154
|
-
cancel: {
|
155
|
-
color: "gray",
|
156
|
-
icon: /* @__PURE__ */ jsx2(IconX2, {}),
|
157
|
-
defaultText: "H\u1EE7y thao t\xE1c"
|
158
|
-
},
|
159
|
-
select: {
|
160
|
-
defaultText: "Ch\u1ECDn"
|
161
|
-
},
|
162
|
-
check: {
|
163
|
-
defaultText: "Ch\u1ECDn"
|
164
|
-
}
|
165
|
-
};
|
166
|
-
function CoreButton(_a) {
|
167
|
-
var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
|
168
|
-
if (!actionType) {
|
169
|
-
return /* @__PURE__ */ jsx2(Button2, __spreadProps(__spreadValues({}, rest), { children }));
|
170
|
-
}
|
171
|
-
const config = actionConfig2[actionType];
|
172
|
-
return /* @__PURE__ */ jsx2(
|
173
|
-
Button2,
|
174
|
-
__spreadProps(__spreadValues({
|
175
|
-
color: config.color,
|
176
|
-
type: config.type,
|
177
|
-
leftSection: config.icon
|
178
|
-
}, rest), {
|
179
|
-
children: children != null ? children : config.defaultText
|
180
|
-
})
|
181
|
-
);
|
182
|
-
}
|
183
|
-
|
184
|
-
// src/core/button/CoreButtonCreateUpdate.tsx
|
185
|
-
import { useDisclosure } from "@mantine/hooks";
|
186
|
-
import { useQueryClient } from "@tanstack/react-query";
|
187
|
-
import { ActionIcon as ActionIcon2, Button as Button3, Modal } from "@mantine/core";
|
188
|
-
import { IconEdit as IconEdit3, IconPlus as IconPlus3 } from "@tabler/icons-react";
|
189
|
-
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
190
|
-
function CoreButtonCreateUpdate({
|
191
|
-
modalProps,
|
192
|
-
actionIconProps,
|
193
|
-
buttonProps,
|
194
|
-
form,
|
195
|
-
onSubmit,
|
196
|
-
onSuccess,
|
197
|
-
onError,
|
198
|
-
closeModalWhenSubmit = true,
|
199
|
-
resetFormWhenSubmit = true,
|
200
|
-
children,
|
201
|
-
disclosure: externalDisclosure,
|
202
|
-
isUpdate = false
|
203
|
-
}) {
|
204
|
-
const defaultDisclosure = useDisclosure();
|
205
|
-
const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
|
206
|
-
const queryClient = useQueryClient();
|
207
|
-
const mutation = useMyReactMutation({
|
208
|
-
axiosFn: (values) => {
|
209
|
-
const result = onSubmit(values);
|
210
|
-
if (result === void 0) {
|
211
|
-
return Promise.resolve({
|
212
|
-
data: {
|
213
|
-
message: "T\u1EA1o th\xE0nh c\xF4ng (gi\u1EA3 l\u1EADp)",
|
214
|
-
data: {},
|
215
|
-
isSuccess: 1
|
216
|
-
},
|
217
|
-
status: 200,
|
218
|
-
statusText: "OK",
|
219
|
-
headers: {},
|
220
|
-
config: {}
|
221
|
-
});
|
222
|
-
}
|
223
|
-
return result;
|
224
|
-
},
|
225
|
-
options: __spreadValues(__spreadValues({
|
226
|
-
onSuccess: () => {
|
227
|
-
queryClient.invalidateQueries();
|
228
|
-
utils_notification_show({ crudType: isUpdate ? "update" : "create" });
|
229
|
-
disclosure[1].close();
|
230
|
-
if (closeModalWhenSubmit) disclosure[1].close();
|
231
|
-
if (resetFormWhenSubmit) form.reset();
|
232
|
-
}
|
233
|
-
}, onSuccess && {
|
234
|
-
onSuccess: () => {
|
235
|
-
onSuccess();
|
236
|
-
}
|
237
|
-
}), onError && {
|
238
|
-
onError: () => {
|
239
|
-
onError();
|
240
|
-
}
|
241
|
-
})
|
242
|
-
});
|
243
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
244
|
-
isUpdate == true ? /* @__PURE__ */ jsx3(
|
245
|
-
ActionIcon2,
|
246
|
-
__spreadProps(__spreadValues({
|
247
|
-
color: "yellow",
|
248
|
-
onClick: disclosure[1].open
|
249
|
-
}, actionIconProps), {
|
250
|
-
children: /* @__PURE__ */ jsx3(IconEdit3, {})
|
251
|
-
})
|
252
|
-
) : /* @__PURE__ */ jsx3(
|
253
|
-
Button3,
|
254
|
-
__spreadProps(__spreadValues({
|
255
|
-
onClick: disclosure[1].open,
|
256
|
-
leftSection: /* @__PURE__ */ jsx3(IconPlus3, {})
|
257
|
-
}, buttonProps), {
|
258
|
-
children: "Th\xEAm"
|
259
|
-
})
|
260
|
-
),
|
261
|
-
/* @__PURE__ */ jsx3(
|
262
|
-
Modal,
|
263
|
-
__spreadProps(__spreadValues({
|
264
|
-
title: isUpdate ? "S\u1EEDa d\u1EEF li\u1EC7u" : "Th\xEAm d\u1EEF li\u1EC7u",
|
265
|
-
opened: disclosure[0],
|
266
|
-
onClose: disclosure[1].close
|
267
|
-
}, modalProps), {
|
268
|
-
children: /* @__PURE__ */ jsx3("form", { onSubmit: form.onSubmit((values) => {
|
269
|
-
mutation.mutate(values);
|
270
|
-
}), children: /* @__PURE__ */ jsxs(MyFlexColumn, { children: [
|
271
|
-
children,
|
272
|
-
/* @__PURE__ */ jsx3(CoreButton, { actionType: "create" })
|
273
|
-
] }) })
|
274
|
-
})
|
275
|
-
)
|
276
|
-
] });
|
277
|
-
}
|
278
|
-
|
279
|
-
// src/core/button/CoreButtonModal.tsx
|
280
|
-
import { Button as Button4, Modal as Modal2 } from "@mantine/core";
|
281
|
-
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
282
|
-
function CoreButtonModal({
|
283
|
-
disclosure,
|
284
|
-
children,
|
285
|
-
buttonProps,
|
286
|
-
modalProps
|
287
|
-
}) {
|
288
|
-
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
289
|
-
/* @__PURE__ */ jsx4(Button4, __spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, buttonProps)),
|
290
|
-
/* @__PURE__ */ jsx4(
|
291
|
-
Modal2,
|
292
|
-
__spreadProps(__spreadValues({
|
293
|
-
opened: disclosure == null ? void 0 : disclosure[0],
|
294
|
-
onClose: disclosure[1].close
|
295
|
-
}, modalProps), {
|
296
|
-
children: /* @__PURE__ */ jsx4(MyFlexColumn, { children })
|
297
|
-
})
|
298
|
-
)
|
299
|
-
] });
|
300
|
-
}
|
301
|
-
|
302
|
-
// src/core/input/CoreTextInput.tsx
|
303
|
-
import { TextInput } from "@mantine/core";
|
304
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
305
|
-
function CoreTextInput(_a) {
|
306
|
-
var _b = _a, { label, isPhoneNumber } = _b, rest = __objRest(_b, ["label", "isPhoneNumber"]);
|
307
|
-
return /* @__PURE__ */ jsx5(
|
308
|
-
TextInput,
|
309
|
-
__spreadValues({
|
310
|
-
onKeyDown: (e) => {
|
311
|
-
if (!isPhoneNumber) return;
|
312
|
-
const allowedKeys = [
|
313
|
-
"Backspace",
|
314
|
-
"Tab",
|
315
|
-
"ArrowLeft",
|
316
|
-
"ArrowRight",
|
317
|
-
"Delete",
|
318
|
-
"+",
|
319
|
-
"-",
|
320
|
-
"(",
|
321
|
-
")",
|
322
|
-
" "
|
323
|
-
// các ký tự đặc biệt cho số điện thoại
|
324
|
-
];
|
325
|
-
if (!/[0-9]/.test(e.key) && !allowedKeys.includes(e.key)) {
|
326
|
-
e.preventDefault();
|
327
|
-
}
|
328
|
-
},
|
329
|
-
placeholder: label ? `Nh\u1EADp ${label == null ? void 0 : label.toLowerCase()}` : ""
|
330
|
-
}, rest)
|
331
|
-
);
|
332
|
-
}
|
13
|
+
import "../chunk-QPNYGFTI.mjs";
|
14
|
+
import "../chunk-7ZCOFATU.mjs";
|
15
|
+
import "../chunk-FWCSY2DS.mjs";
|
333
16
|
export {
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
17
|
+
MyActionIcon,
|
18
|
+
MyButton,
|
19
|
+
MyButtonCreateUpdate,
|
20
|
+
MyButtonModal,
|
21
|
+
MyDayOfWeekPicker,
|
22
|
+
MyTextInput,
|
23
|
+
MyWeeklySessionSchedulerPicker
|
340
24
|
};
|
@@ -2,23 +2,32 @@ import * as axios from 'axios';
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
3
3
|
import { I as IBaseEntity } from './base-BprRafT5.mjs';
|
4
4
|
|
5
|
+
interface IPagingParams {
|
6
|
+
pageNumber?: number;
|
7
|
+
pageSize?: number;
|
8
|
+
}
|
5
9
|
interface MyApiResponse<IRes> {
|
6
10
|
isSuccess: 1 | 0;
|
7
11
|
message: string;
|
8
12
|
data: IRes;
|
9
13
|
}
|
10
14
|
declare function createBaseApi<T>(baseUrl: string, axiosInstance: AxiosInstance): {
|
11
|
-
get: ({ params }?: {
|
15
|
+
get: ({ params, id, paging }?: {
|
12
16
|
params?: string;
|
17
|
+
id?: number;
|
18
|
+
paging?: IPagingParams;
|
13
19
|
}) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
|
14
|
-
getAll: ({ params }?: {
|
20
|
+
getAll: ({ params, cols, paging }?: {
|
15
21
|
params?: string;
|
22
|
+
paging?: IPagingParams;
|
23
|
+
cols?: string[];
|
16
24
|
}) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
|
17
25
|
create: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
|
18
26
|
update: (data: Partial<T>) => Promise<axios.AxiosResponse<MyApiResponse<T>, any>>;
|
19
|
-
|
27
|
+
updateList: (data: Partial<T[]>) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
|
28
|
+
createOrUpdateList: (data: Partial<T[]>) => Promise<axios.AxiosResponse<MyApiResponse<T[]>, any>>;
|
20
29
|
delete: (id: number) => Promise<axios.AxiosResponse<any, any>>;
|
21
30
|
deleteList: (values: IBaseEntity[]) => Promise<axios.AxiosResponse<any, any>>;
|
22
31
|
};
|
23
32
|
|
24
|
-
export { type MyApiResponse as M, createBaseApi as c };
|
33
|
+
export { type IPagingParams as I, type MyApiResponse as M, createBaseApi as c };
|
package/dist/hooks/index.d.mts
CHANGED
@@ -1,11 +1,28 @@
|
|
1
|
-
import
|
2
|
-
|
1
|
+
import * as next_dist_shared_lib_app_router_context_shared_runtime from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
2
|
+
import { M as MyApiResponse } from '../createBaseApi-2GYRG_xt.mjs';
|
3
|
+
export { I as IPagingParams, c as createBaseApi } from '../createBaseApi-2GYRG_xt.mjs';
|
3
4
|
import { AxiosInstance, AxiosResponse } from 'axios';
|
4
5
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
5
6
|
import { UseMutationOptions, QueryKey, UseQueryOptions } from '@tanstack/react-query';
|
6
7
|
import { I as IAQModule } from '../IAQModule-CCtwv-e0.mjs';
|
7
8
|
import '../base-BprRafT5.mjs';
|
8
9
|
|
10
|
+
declare function useMyDevice(): {
|
11
|
+
isMobile: boolean | undefined;
|
12
|
+
isTablet: boolean | undefined;
|
13
|
+
isPc: boolean;
|
14
|
+
};
|
15
|
+
|
16
|
+
declare function useMyRouter(): {
|
17
|
+
pushUrl: (url: string) => void;
|
18
|
+
back(): void;
|
19
|
+
forward(): void;
|
20
|
+
refresh(): void;
|
21
|
+
push(href: string, options?: next_dist_shared_lib_app_router_context_shared_runtime.NavigateOptions): void;
|
22
|
+
replace(href: string, options?: next_dist_shared_lib_app_router_context_shared_runtime.NavigateOptions): void;
|
23
|
+
prefetch(href: string, options?: next_dist_shared_lib_app_router_context_shared_runtime.PrefetchOptions): void;
|
24
|
+
};
|
25
|
+
|
9
26
|
declare const useLoadAxiosConfig: ({ axiosInstance }: {
|
10
27
|
axiosInstance: AxiosInstance;
|
11
28
|
}) => void;
|
@@ -25,4 +42,4 @@ declare function useMyReactQuery<IRes, IBody>({ queryKey, axiosFn, options }: My
|
|
25
42
|
|
26
43
|
declare function useQ_AQ_GetAQModule(): _tanstack_react_query.UseQueryResult<IAQModule, Error>;
|
27
44
|
|
28
|
-
export { MyApiResponse, useLoadAxiosConfig, useMyReactMutation, useMyReactQuery, useQ_AQ_GetAQModule };
|
45
|
+
export { MyApiResponse, useLoadAxiosConfig, useMyDevice, useMyReactMutation, useMyReactQuery, useMyRouter, useQ_AQ_GetAQModule };
|