aq-fe-framework 0.1.301 → 0.1.303

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.
@@ -0,0 +1,55 @@
1
+ import {
2
+ enum_daysOfWeek
3
+ } from "./chunk-K6S7R6LU.mjs";
4
+ import {
5
+ __objRest,
6
+ __spreadProps,
7
+ __spreadValues
8
+ } from "./chunk-FWCSY2DS.mjs";
9
+
10
+ // src/components/Layouts/FlexColumn/MyFlexColumn.tsx
11
+ import { Flex } from "@mantine/core";
12
+ import { jsx } from "react/jsx-runtime";
13
+ function MyFlexColumn(_a) {
14
+ var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
15
+ return /* @__PURE__ */ jsx(Flex, __spreadProps(__spreadValues({ direction: "column", gap: "md" }, rest), { children }));
16
+ }
17
+
18
+ // src/components/Layouts/FlexRow/MyFlexRow.tsx
19
+ import { Flex as Flex2 } from "@mantine/core";
20
+ import { jsx as jsx2 } from "react/jsx-runtime";
21
+ function MyFlexRow(_a) {
22
+ var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
23
+ return /* @__PURE__ */ jsx2(Flex2, __spreadProps(__spreadValues({ gap: "md", align: "center" }, rest), { children }));
24
+ }
25
+
26
+ // src/core/input/DayOfWeekPicker/CoreDayOfWeekPicker.tsx
27
+ import { Badge, Group } from "@mantine/core";
28
+ import { jsx as jsx3 } from "react/jsx-runtime";
29
+ var days = Object.entries(enum_daysOfWeek).filter(([key]) => isNaN(Number(key))).map(([label, value]) => ({ label, value }));
30
+ function CoreDayOfWeekPicker({ value = [], onChange }) {
31
+ const toggle = (val) => {
32
+ if (!onChange) return;
33
+ const newValue = value.includes(val) ? value.filter((v) => v !== val) : [...value, val].sort((a, b) => a - b);
34
+ onChange(newValue);
35
+ };
36
+ return /* @__PURE__ */ jsx3(MyFlexRow, { align: "center", children: /* @__PURE__ */ jsx3(Group, { gap: "xs", children: days.map((d) => /* @__PURE__ */ jsx3(
37
+ Badge,
38
+ {
39
+ variant: value.includes(d.value) ? "filled" : "outline",
40
+ color: "blue",
41
+ radius: "sm",
42
+ size: "lg",
43
+ onClick: () => toggle(d.value),
44
+ style: { cursor: onChange ? "pointer" : "default", userSelect: "none" },
45
+ children: d.label
46
+ },
47
+ d.value
48
+ )) }) });
49
+ }
50
+
51
+ export {
52
+ MyFlexColumn,
53
+ MyFlexRow,
54
+ CoreDayOfWeekPicker
55
+ };
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React$1, { ReactNode, ComponentProps } from 'react';
3
- import { MantineSize, ActionIconProps, ButtonProps, ModalProps, useModalsStack, CheckboxProps, SelectProps, NumberFormatterProps, FieldsetProps, FileInputProps, NumberInputProps, TextareaProps, InputWrapperProps, TextInputProps, ContainerProps, FlexProps, GroupProps, TypographyStylesProviderProps, TabsProps, SkeletonProps } from '@mantine/core';
3
+ import { t as type_action, T as TYPES_MANTINE_SIZE } from '../types-CxfyEk70.mjs';
4
+ import { ActionIconProps, ButtonProps, useModalsStack, CheckboxProps, SelectProps, NumberFormatterProps, FieldsetProps, FileInputProps, NumberInputProps, TextareaProps, MantineSize, InputWrapperProps, TextInputProps, ContainerProps, FlexProps, GroupProps, TypographyStylesProviderProps, TabsProps, SkeletonProps } from '@mantine/core';
4
5
  import { M as MyApiResponse } from '../createBaseApi-BAYnbGVT.mjs';
5
6
  import { AxiosResponse } from 'axios';
6
7
  import { useDisclosure, useListState } from '@mantine/hooks';
@@ -30,9 +31,6 @@ declare function MyBoxesBackground({ title, desc }: {
30
31
  desc?: string;
31
32
  }): react_jsx_runtime.JSX.Element;
32
33
 
33
- type TYPES_MANTINE_SIZE = number | MantineSize | (string & {}) | undefined;
34
- type type_action = "create" | "update" | "delete" | "save" | "createMultiple" | "check" | "import" | "print" | "cancel" | "export" | "select";
35
-
36
34
  interface IMyActionIcon extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
37
35
  crudType?: type_action;
38
36
  children?: ReactNode;
@@ -93,41 +91,6 @@ declare function MyAppSpotlight({ menu }: {
93
91
  menu: I_BasicAppShell_LinkItem[];
94
92
  }): react_jsx_runtime.JSX.Element;
95
93
 
96
- interface CoreActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
97
- actionType?: type_action;
98
- }
99
- declare function CoreActionIcon({ children, actionType, ...rest }: CoreActionIconProps): react_jsx_runtime.JSX.Element;
100
-
101
- interface CoreButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ButtonProps {
102
- actionType?: type_action;
103
- children?: ReactNode;
104
- }
105
- declare function CoreButton({ children, actionType, ...rest }: CoreButtonProps): react_jsx_runtime.JSX.Element;
106
-
107
- interface CoreButtonCreateUpdateProps<IReq, IRes> {
108
- modalProps?: Omit<ModalProps, "opened" | "onClose">;
109
- actionIconProps?: ActionIconProps;
110
- buttonProps?: ButtonProps;
111
- isUpdate?: boolean;
112
- onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
113
- onSuccess?: () => void;
114
- onError?: () => void;
115
- form: UseFormReturnType<IReq>;
116
- closeModalWhenSubmit?: boolean;
117
- resetFormWhenSubmit?: boolean;
118
- disclosure?: ReturnType<typeof useDisclosure>;
119
- children?: ReactNode;
120
- }
121
- declare function CoreButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, form, onSubmit, onSuccess, onError, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
122
-
123
- interface CoreButtonModalProps {
124
- children?: ReactNode;
125
- disclosure: ReturnType<typeof useDisclosure>;
126
- buttonProps?: ButtonProps;
127
- modalProps?: ModalProps;
128
- }
129
- declare function CoreButtonModal({ disclosure, children, buttonProps, modalProps, }: CoreButtonModalProps): react_jsx_runtime.JSX.Element;
130
-
131
94
  declare function MyAnchorViewPDF({ label, pdfLink }: {
132
95
  label: string;
133
96
  pdfLink: string;
@@ -387,12 +350,6 @@ interface IDateInput extends DateInputProps {
387
350
  }
388
351
  declare function MyDateInput({ label, ...rest }: IDateInput): react_jsx_runtime.JSX.Element;
389
352
 
390
- interface CoreDayOfWeekPickerProps {
391
- value?: number[];
392
- onChange?: (val: number[]) => void;
393
- }
394
- declare function CoreDayOfWeekPicker({ value, onChange }: CoreDayOfWeekPickerProps): react_jsx_runtime.JSX.Element;
395
-
396
353
  interface IFieldset extends FieldsetProps {
397
354
  children?: ReactNode;
398
355
  title: string;
@@ -584,4 +541,4 @@ interface IMySkeletonTable extends SkeletonProps {
584
541
  }
585
542
  declare function MySkeletonTable({ h }: IMySkeletonTable): react_jsx_runtime.JSX.Element;
586
543
 
587
- export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, CoreActionIcon, CoreButton, CoreButtonCreateUpdate, CoreButtonModal, CoreDayOfWeekPicker, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor, type IWeeklySession, 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, MyWeeklySessionSchedulerPicker, SelectFieldModal, SelectFileModal, type SelectFileModalProps, type WeeklySessionSchedulerProps, useHeaderMegaMenuStore, useS_BasicAppShell, useS_ButtonImport };
544
+ export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, FaviconSetter, HeaderMegaMenu, type IAQCardProps, type IMyTextEditor, type IWeeklySession, 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, MyWeeklySessionSchedulerPicker, SelectFieldModal, SelectFileModal, type SelectFileModalProps, type WeeklySessionSchedulerProps, useHeaderMegaMenuStore, useS_BasicAppShell, useS_ButtonImport };
@@ -7,11 +7,6 @@ import {
7
7
  BasicAppShell,
8
8
  BasicAppShell_transformMenuToEnum,
9
9
  Boxes,
10
- CoreActionIcon,
11
- CoreButton,
12
- CoreButtonCreateUpdate,
13
- CoreButtonModal,
14
- CoreDayOfWeekPicker,
15
10
  FaviconSetter,
16
11
  HeaderMegaMenu,
17
12
  MyActionIcon,
@@ -46,9 +41,7 @@ import {
46
41
  MyDateInput,
47
42
  MyFieldset,
48
43
  MyFileInput,
49
- MyFlexColumn,
50
44
  MyFlexEnd,
51
- MyFlexRow,
52
45
  MyHtmlWrapper,
53
46
  MyIconText,
54
47
  MyKeyLabel,
@@ -72,13 +65,17 @@ import {
72
65
  useS_BasicAppShell,
73
66
  useS_ButtonImport,
74
67
  utils_layout_getItemsWithoutLinks
75
- } from "../chunk-HUEZLKHP.mjs";
68
+ } from "../chunk-KOCCXYVV.mjs";
69
+ import "../chunk-5U2JSHSJ.mjs";
76
70
  import "../chunk-NWBLJ3W3.mjs";
71
+ import {
72
+ MyFlexColumn,
73
+ MyFlexRow
74
+ } from "../chunk-RK2XUPT6.mjs";
77
75
  import "../chunk-K6S7R6LU.mjs";
78
76
  import "../chunk-KKJ3OEEW.mjs";
79
- import "../chunk-Y3YGC5IH.mjs";
80
- import "../chunk-5U2JSHSJ.mjs";
81
77
  import "../chunk-7ZCOFATU.mjs";
78
+ import "../chunk-Y3YGC5IH.mjs";
82
79
  import "../chunk-FWCSY2DS.mjs";
83
80
  export {
84
81
  AQButtonCreateByImportFile,
@@ -89,11 +86,6 @@ export {
89
86
  BasicAppShell,
90
87
  BasicAppShell_transformMenuToEnum,
91
88
  Boxes,
92
- CoreActionIcon,
93
- CoreButton,
94
- CoreButtonCreateUpdate,
95
- CoreButtonModal,
96
- CoreDayOfWeekPicker,
97
89
  FaviconSetter,
98
90
  HeaderMegaMenu,
99
91
  MyActionIcon,
@@ -0,0 +1,52 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { t as type_action } from '../types-CxfyEk70.mjs';
3
+ import { ActionIconProps, ButtonProps, ModalProps } from '@mantine/core';
4
+ import { ReactNode } from 'react';
5
+ import { M as MyApiResponse } from '../createBaseApi-BAYnbGVT.mjs';
6
+ import { AxiosResponse } from 'axios';
7
+ import { UseFormReturnType } from '@mantine/form';
8
+ import { useDisclosure } from '@mantine/hooks';
9
+ import '../base-BprRafT5.mjs';
10
+
11
+ interface CoreActionIconProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ActionIconProps {
12
+ actionType?: type_action;
13
+ }
14
+ declare function CoreActionIcon({ children, actionType, ...rest }: CoreActionIconProps): react_jsx_runtime.JSX.Element;
15
+
16
+ interface CoreButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "color" | "style">, ButtonProps {
17
+ actionType?: type_action;
18
+ children?: ReactNode;
19
+ }
20
+ declare function CoreButton({ children, actionType, ...rest }: CoreButtonProps): react_jsx_runtime.JSX.Element;
21
+
22
+ interface CoreButtonCreateUpdateProps<IReq, IRes> {
23
+ modalProps?: Omit<ModalProps, "opened" | "onClose">;
24
+ actionIconProps?: ActionIconProps;
25
+ buttonProps?: ButtonProps;
26
+ isUpdate?: boolean;
27
+ onSubmit: (values: IReq) => Promise<AxiosResponse<MyApiResponse<IRes>>>;
28
+ onSuccess?: () => void;
29
+ onError?: () => void;
30
+ form: UseFormReturnType<IReq>;
31
+ closeModalWhenSubmit?: boolean;
32
+ resetFormWhenSubmit?: boolean;
33
+ disclosure?: ReturnType<typeof useDisclosure>;
34
+ children?: ReactNode;
35
+ }
36
+ declare function CoreButtonCreateUpdate<IReq, IRes>({ modalProps, actionIconProps, buttonProps, form, onSubmit, onSuccess, onError, closeModalWhenSubmit, resetFormWhenSubmit, children, disclosure: externalDisclosure, isUpdate, }: CoreButtonCreateUpdateProps<IReq, IRes>): react_jsx_runtime.JSX.Element;
37
+
38
+ interface CoreButtonModalProps {
39
+ children?: ReactNode;
40
+ disclosure: ReturnType<typeof useDisclosure>;
41
+ buttonProps?: ButtonProps;
42
+ modalProps?: ModalProps;
43
+ }
44
+ declare function CoreButtonModal({ disclosure, children, buttonProps, modalProps, }: CoreButtonModalProps): react_jsx_runtime.JSX.Element;
45
+
46
+ interface CoreDayOfWeekPickerProps {
47
+ value?: number[];
48
+ onChange?: (val: number[]) => void;
49
+ }
50
+ declare function CoreDayOfWeekPicker({ value, onChange }: CoreDayOfWeekPickerProps): react_jsx_runtime.JSX.Element;
51
+
52
+ export { CoreActionIcon, CoreButton, CoreButtonCreateUpdate, CoreButtonModal, CoreDayOfWeekPicker };
@@ -0,0 +1,287 @@
1
+ import {
2
+ CoreDayOfWeekPicker,
3
+ MyFlexColumn
4
+ } from "../chunk-RK2XUPT6.mjs";
5
+ import "../chunk-K6S7R6LU.mjs";
6
+ import {
7
+ useMyReactMutation
8
+ } from "../chunk-KKJ3OEEW.mjs";
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
+ create: {
33
+ color: "indigo",
34
+ type: "submit",
35
+ icon: /* @__PURE__ */ jsx(IconPlus, {})
36
+ },
37
+ createMultiple: {
38
+ color: "green",
39
+ type: "submit",
40
+ icon: /* @__PURE__ */ jsx(IconPlus, {})
41
+ },
42
+ delete: {
43
+ color: "red",
44
+ icon: /* @__PURE__ */ jsx(IconTrash, {})
45
+ },
46
+ update: {
47
+ color: "yellow",
48
+ type: "submit",
49
+ icon: /* @__PURE__ */ jsx(IconEdit, {})
50
+ },
51
+ save: {
52
+ color: "blue",
53
+ type: "submit",
54
+ icon: /* @__PURE__ */ jsx(IconDeviceFloppy, {})
55
+ },
56
+ import: {
57
+ color: "green.8",
58
+ icon: /* @__PURE__ */ jsx(IconFileImport, {})
59
+ },
60
+ print: {
61
+ color: "orange.7",
62
+ icon: /* @__PURE__ */ jsx(IconPrinter, {})
63
+ },
64
+ export: {
65
+ color: "green.8",
66
+ icon: /* @__PURE__ */ jsx(IconFileExport, {})
67
+ },
68
+ cancel: {
69
+ color: "gray",
70
+ icon: /* @__PURE__ */ jsx(IconX, {})
71
+ },
72
+ select: {},
73
+ check: {}
74
+ };
75
+ function CoreActionIcon(_a) {
76
+ var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
77
+ if (!actionType) {
78
+ return /* @__PURE__ */ jsx(ActionIcon, __spreadProps(__spreadValues({}, rest), { children }));
79
+ }
80
+ const config = actionConfig[actionType];
81
+ return /* @__PURE__ */ jsx(
82
+ ActionIcon,
83
+ __spreadProps(__spreadValues({
84
+ color: config.color,
85
+ type: config.type
86
+ }, rest), {
87
+ children: config.icon
88
+ })
89
+ );
90
+ }
91
+
92
+ // src/core/button/CoreButton.tsx
93
+ import { Button as Button2 } from "@mantine/core";
94
+ import {
95
+ IconDeviceFloppy as IconDeviceFloppy2,
96
+ IconEdit as IconEdit2,
97
+ IconFileExport as IconFileExport2,
98
+ IconFileImport as IconFileImport2,
99
+ IconPlus as IconPlus2,
100
+ IconPrinter as IconPrinter2,
101
+ IconTrash as IconTrash2,
102
+ IconX as IconX2
103
+ } from "@tabler/icons-react";
104
+ import { jsx as jsx2 } from "react/jsx-runtime";
105
+ var actionConfig2 = {
106
+ create: {
107
+ color: "blue",
108
+ type: "submit",
109
+ icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
110
+ defaultText: "L\u01B0u"
111
+ },
112
+ createMultiple: {
113
+ color: "green",
114
+ type: "submit",
115
+ icon: /* @__PURE__ */ jsx2(IconPlus2, {}),
116
+ defaultText: "Th\xEAm danh s\xE1ch"
117
+ },
118
+ delete: {
119
+ color: "red",
120
+ icon: /* @__PURE__ */ jsx2(IconTrash2, {}),
121
+ defaultText: "X\xF3a"
122
+ },
123
+ update: {
124
+ color: "yellow",
125
+ type: "submit",
126
+ icon: /* @__PURE__ */ jsx2(IconEdit2, {}),
127
+ defaultText: "Ch\u1EC9nh s\u1EEDa"
128
+ },
129
+ save: {
130
+ color: "blue",
131
+ type: "submit",
132
+ icon: /* @__PURE__ */ jsx2(IconDeviceFloppy2, {}),
133
+ defaultText: "L\u01B0u"
134
+ },
135
+ import: {
136
+ color: "green.8",
137
+ icon: /* @__PURE__ */ jsx2(IconFileImport2, {}),
138
+ defaultText: "Import"
139
+ },
140
+ print: {
141
+ color: "orange.7",
142
+ icon: /* @__PURE__ */ jsx2(IconPrinter2, {}),
143
+ defaultText: "In"
144
+ },
145
+ export: {
146
+ color: "green.8",
147
+ icon: /* @__PURE__ */ jsx2(IconFileExport2, {}),
148
+ defaultText: "Export"
149
+ },
150
+ cancel: {
151
+ color: "gray",
152
+ icon: /* @__PURE__ */ jsx2(IconX2, {}),
153
+ defaultText: "H\u1EE7y thao t\xE1c"
154
+ },
155
+ select: {
156
+ defaultText: "Ch\u1ECDn"
157
+ },
158
+ check: {
159
+ defaultText: "Ch\u1ECDn"
160
+ }
161
+ };
162
+ function CoreButton(_a) {
163
+ var _b = _a, { children, actionType } = _b, rest = __objRest(_b, ["children", "actionType"]);
164
+ if (!actionType) {
165
+ return /* @__PURE__ */ jsx2(Button2, __spreadProps(__spreadValues({}, rest), { children }));
166
+ }
167
+ const config = actionConfig2[actionType];
168
+ return /* @__PURE__ */ jsx2(
169
+ Button2,
170
+ __spreadProps(__spreadValues({
171
+ color: config.color,
172
+ type: config.type,
173
+ leftSection: config.icon
174
+ }, rest), {
175
+ children: children != null ? children : config.defaultText
176
+ })
177
+ );
178
+ }
179
+
180
+ // src/core/button/CoreButtonCreateUpdate.tsx
181
+ import { useDisclosure } from "@mantine/hooks";
182
+ import { useQueryClient } from "@tanstack/react-query";
183
+ import { ActionIcon as ActionIcon2, Button as Button3, Modal } from "@mantine/core";
184
+ import { IconEdit as IconEdit3, IconPlus as IconPlus3 } from "@tabler/icons-react";
185
+ import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
186
+ function CoreButtonCreateUpdate({
187
+ modalProps,
188
+ actionIconProps,
189
+ buttonProps,
190
+ form,
191
+ onSubmit,
192
+ onSuccess,
193
+ onError,
194
+ closeModalWhenSubmit = true,
195
+ resetFormWhenSubmit = true,
196
+ children,
197
+ disclosure: externalDisclosure,
198
+ isUpdate = false
199
+ }) {
200
+ const defaultDisclosure = useDisclosure();
201
+ const disclosure = externalDisclosure != null ? externalDisclosure : defaultDisclosure;
202
+ const queryClient = useQueryClient();
203
+ const mutation = useMyReactMutation({
204
+ axiosFn: (values) => onSubmit(values),
205
+ options: __spreadValues(__spreadValues({
206
+ onSuccess: () => {
207
+ queryClient.invalidateQueries();
208
+ utils_notification_show({ crudType: isUpdate ? "update" : "create" });
209
+ disclosure[1].close();
210
+ if (closeModalWhenSubmit) disclosure[1].close();
211
+ if (resetFormWhenSubmit) form.reset();
212
+ }
213
+ }, onSuccess && {
214
+ onSuccess: () => {
215
+ onSuccess();
216
+ }
217
+ }), onError && {
218
+ onError: () => {
219
+ onError();
220
+ }
221
+ })
222
+ });
223
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
224
+ isUpdate == true ? /* @__PURE__ */ jsx3(
225
+ ActionIcon2,
226
+ __spreadProps(__spreadValues({
227
+ color: "yellow",
228
+ onClick: disclosure[1].open
229
+ }, actionIconProps), {
230
+ children: /* @__PURE__ */ jsx3(IconEdit3, {})
231
+ })
232
+ ) : /* @__PURE__ */ jsx3(
233
+ Button3,
234
+ __spreadProps(__spreadValues({
235
+ onClick: disclosure[1].open,
236
+ leftSection: /* @__PURE__ */ jsx3(IconPlus3, {})
237
+ }, buttonProps), {
238
+ children: "Th\xEAm"
239
+ })
240
+ ),
241
+ /* @__PURE__ */ jsx3(
242
+ Modal,
243
+ __spreadProps(__spreadValues({
244
+ title: isUpdate ? "S\u1EEDa d\u1EEF li\u1EC7u" : "Th\xEAm d\u1EEF li\u1EC7u",
245
+ opened: disclosure[0],
246
+ onClose: disclosure[1].close
247
+ }, modalProps), {
248
+ children: /* @__PURE__ */ jsx3("form", { onSubmit: form.onSubmit((values) => {
249
+ mutation.mutate(values);
250
+ }), children: /* @__PURE__ */ jsxs(MyFlexColumn, { children: [
251
+ children,
252
+ /* @__PURE__ */ jsx3(CoreButton, { actionType: "create" })
253
+ ] }) })
254
+ })
255
+ )
256
+ ] });
257
+ }
258
+
259
+ // src/core/button/CoreButtonModal.tsx
260
+ import { Button as Button4, Modal as Modal2 } from "@mantine/core";
261
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
262
+ function CoreButtonModal({
263
+ disclosure,
264
+ children,
265
+ buttonProps,
266
+ modalProps
267
+ }) {
268
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
269
+ /* @__PURE__ */ jsx4(Button4, __spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, buttonProps)),
270
+ /* @__PURE__ */ jsx4(
271
+ Modal2,
272
+ __spreadProps(__spreadValues({
273
+ opened: disclosure == null ? void 0 : disclosure[0],
274
+ onClose: disclosure[1].close
275
+ }, modalProps), {
276
+ children: /* @__PURE__ */ jsx4(MyFlexColumn, { children })
277
+ })
278
+ )
279
+ ] });
280
+ }
281
+ export {
282
+ CoreActionIcon,
283
+ CoreButton,
284
+ CoreButtonCreateUpdate,
285
+ CoreButtonModal,
286
+ CoreDayOfWeekPicker
287
+ };
@@ -1,3 +1,11 @@
1
+ import {
2
+ U0DateToDDMMYYYString,
3
+ U0MyValidateEmail,
4
+ updateEnableList,
5
+ utils_config_getBaseUrl,
6
+ utils_converter_enumToSelectOptions,
7
+ utils_file_fileToAQDocumentType
8
+ } from "../chunk-NRFQDAYS.mjs";
1
9
  import {
2
10
  F_authenticate_Logout,
3
11
  MyActionIconDelete,
@@ -12,9 +20,7 @@ import {
12
20
  MyDateInput,
13
21
  MyFieldset,
14
22
  MyFileInput,
15
- MyFlexColumn,
16
23
  MyFlexEnd,
17
- MyFlexRow,
18
24
  MyNumberInput,
19
25
  MyPageContent,
20
26
  MySelect,
@@ -24,13 +30,18 @@ import {
24
30
  useS_BasicAppShell,
25
31
  useS_authenticate,
26
32
  utils_layout_getItemsWithoutLinks
27
- } from "../chunk-HUEZLKHP.mjs";
33
+ } from "../chunk-KOCCXYVV.mjs";
34
+ import "../chunk-5U2JSHSJ.mjs";
28
35
  import {
29
36
  const_object_documentTypes
30
37
  } from "../chunk-GFEMKKFH.mjs";
31
38
  import {
32
39
  const_object_colors
33
40
  } from "../chunk-NWBLJ3W3.mjs";
41
+ import {
42
+ MyFlexColumn,
43
+ MyFlexRow
44
+ } from "../chunk-RK2XUPT6.mjs";
34
45
  import {
35
46
  enum_emailConfigModule
36
47
  } from "../chunk-VH4ZAD6M.mjs";
@@ -40,21 +51,12 @@ import {
40
51
  useQ_AQ_GetAQModule,
41
52
  useQ_SkillCenter_GetAll
42
53
  } from "../chunk-KKJ3OEEW.mjs";
43
- import {
44
- createGenericStore
45
- } from "../chunk-Y3YGC5IH.mjs";
46
- import {
47
- U0DateToDDMMYYYString,
48
- U0MyValidateEmail,
49
- updateEnableList,
50
- utils_config_getBaseUrl,
51
- utils_converter_enumToSelectOptions,
52
- utils_file_fileToAQDocumentType
53
- } from "../chunk-NRFQDAYS.mjs";
54
- import "../chunk-5U2JSHSJ.mjs";
55
54
  import {
56
55
  utils_notification_show
57
56
  } from "../chunk-7ZCOFATU.mjs";
57
+ import {
58
+ createGenericStore
59
+ } from "../chunk-Y3YGC5IH.mjs";
58
60
  import {
59
61
  __objRest,
60
62
  __spreadProps,
@@ -0,0 +1,6 @@
1
+ import { MantineSize } from '@mantine/core';
2
+
3
+ type TYPES_MANTINE_SIZE = number | MantineSize | (string & {}) | undefined;
4
+ type type_action = "create" | "update" | "delete" | "save" | "createMultiple" | "check" | "import" | "print" | "cancel" | "export" | "select";
5
+
6
+ export type { TYPES_MANTINE_SIZE as T, type_action as t };
package/package.json CHANGED
@@ -32,9 +32,13 @@
32
32
  "./enum": {
33
33
  "import": "./dist/enum/index.mjs",
34
34
  "types": "./dist/enum/index.d.mts"
35
+ },
36
+ "./core": {
37
+ "import": "./dist/core/index.mjs",
38
+ "types": "./dist/core/index.d.mts"
35
39
  }
36
40
  },
37
- "version": "0.1.301",
41
+ "version": "0.1.303",
38
42
  "private": false,
39
43
  "files": [
40
44
  "dist"