aq-fe-framework 0.1.292 → 0.1.294

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.
@@ -254,6 +254,25 @@ function updateEnableList(oldList, selectedIds, getId, createNew) {
254
254
  return result;
255
255
  }
256
256
 
257
+ // src/utils/utils_reactQuery.ts
258
+ function utils_reactQuery_updateListItemInQuery({
259
+ queryClient,
260
+ queryKey,
261
+ listKey,
262
+ itemId,
263
+ updatedFields,
264
+ matchBy = "id"
265
+ }) {
266
+ const oldData = queryClient.getQueryData(queryKey);
267
+ if (!oldData) return;
268
+ const updatedList = oldData[listKey].map(
269
+ (item) => item[matchBy] === itemId ? __spreadValues(__spreadValues({}, item), updatedFields) : item
270
+ );
271
+ queryClient.setQueryData(queryKey, __spreadProps(__spreadValues({}, oldData), {
272
+ [listKey]: updatedList
273
+ }));
274
+ }
275
+
257
276
  // src/utils/utils_time.ts
258
277
  var utils_time_convertTimeStringToSeconds = (time) => {
259
278
  const [hours, minutes, seconds] = time.split(":").map(Number);
@@ -300,6 +319,7 @@ export {
300
319
  utils_excel_exportExcel,
301
320
  utils_excel_download,
302
321
  updateEnableList,
322
+ utils_reactQuery_updateListItemInQuery,
303
323
  utils_time_convertTimeStringToSeconds,
304
324
  utils_time_getCurrentTimeString,
305
325
  U0MyValidateEmpty,
@@ -921,13 +921,36 @@ function CoreButton(_a) {
921
921
  );
922
922
  }
923
923
 
924
- // src/components/Buttons/CoreButtonCreateUpdate.tsx
924
+ // src/components/Buttons/CoreButtonModal.tsx
925
+ import { Button as Button5, Modal as Modal4 } from "@mantine/core";
926
+ import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
927
+ function CoreButtonModal({
928
+ disclosure,
929
+ children,
930
+ buttonProps,
931
+ modalProps
932
+ }) {
933
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
934
+ /* @__PURE__ */ jsx19(Button5, __spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, buttonProps)),
935
+ /* @__PURE__ */ jsx19(
936
+ Modal4,
937
+ __spreadProps(__spreadValues({
938
+ opened: disclosure == null ? void 0 : disclosure[0],
939
+ onClose: disclosure[1].close
940
+ }, modalProps), {
941
+ children: /* @__PURE__ */ jsx19(MyFlexColumn, { children })
942
+ })
943
+ )
944
+ ] });
945
+ }
946
+
947
+ // src/components/Buttons/MyButtonCreateUpdate.tsx
925
948
  import { useDisclosure as useDisclosure5 } from "@mantine/hooks";
926
949
  import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
927
- import { ActionIcon as ActionIcon9, Button as Button5, Modal as Modal4 } from "@mantine/core";
950
+ import { ActionIcon as ActionIcon9, Button as Button6, Modal as Modal5 } from "@mantine/core";
928
951
  import { IconEdit as IconEdit6, IconPlus as IconPlus6 } from "@tabler/icons-react";
929
- import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
930
- function CoreButtonCreateUpdate({
952
+ import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
953
+ function MyButtonCreateUpdate({
931
954
  modalProps,
932
955
  actionIconProps,
933
956
  buttonProps,
@@ -964,65 +987,42 @@ function CoreButtonCreateUpdate({
964
987
  }
965
988
  })
966
989
  });
967
- return /* @__PURE__ */ jsxs8(Fragment5, { children: [
968
- isUpdate ? /* @__PURE__ */ jsx19(
990
+ return /* @__PURE__ */ jsxs9(Fragment6, { children: [
991
+ isUpdate ? /* @__PURE__ */ jsx20(
969
992
  ActionIcon9,
970
993
  __spreadProps(__spreadValues({
971
994
  color: "yellow",
972
995
  onClick: disclosure[1].open
973
996
  }, actionIconProps), {
974
- children: /* @__PURE__ */ jsx19(IconEdit6, {})
997
+ children: /* @__PURE__ */ jsx20(IconEdit6, {})
975
998
  })
976
- ) : /* @__PURE__ */ jsx19(
977
- Button5,
999
+ ) : /* @__PURE__ */ jsx20(
1000
+ Button6,
978
1001
  __spreadProps(__spreadValues({
979
1002
  onClick: disclosure[1].open,
980
- leftSection: /* @__PURE__ */ jsx19(IconPlus6, {})
1003
+ leftSection: /* @__PURE__ */ jsx20(IconPlus6, {})
981
1004
  }, buttonProps), {
982
1005
  children: "Th\xEAm"
983
1006
  })
984
1007
  ),
985
- /* @__PURE__ */ jsx19(
986
- Modal4,
1008
+ /* @__PURE__ */ jsx20(
1009
+ Modal5,
987
1010
  __spreadProps(__spreadValues({
988
1011
  title: isUpdate ? "S\u1EEDa d\u1EEF li\u1EC7u" : "Th\xEAm d\u1EEF li\u1EC7u",
989
1012
  opened: disclosure[0],
990
1013
  onClose: disclosure[1].close
991
1014
  }, modalProps), {
992
- children: /* @__PURE__ */ jsx19("form", { onSubmit: form.onSubmit((values) => {
1015
+ children: /* @__PURE__ */ jsx20("form", { onSubmit: form.onSubmit((values) => {
993
1016
  mutation.mutate(values);
994
- }), children: /* @__PURE__ */ jsxs8(MyFlexColumn, { children: [
1017
+ }), children: /* @__PURE__ */ jsxs9(MyFlexColumn, { children: [
995
1018
  children,
996
- /* @__PURE__ */ jsx19(CoreButton, { actionType: "create" })
1019
+ /* @__PURE__ */ jsx20(CoreButton, { actionType: "create" })
997
1020
  ] }) })
998
1021
  })
999
1022
  )
1000
1023
  ] });
1001
1024
  }
1002
1025
 
1003
- // src/components/Buttons/CoreButtonModal.tsx
1004
- import { Button as Button6, Modal as Modal5 } from "@mantine/core";
1005
- import { Fragment as Fragment6, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1006
- function CoreButtonModal({
1007
- disclosure,
1008
- children,
1009
- buttonProps,
1010
- modalProps
1011
- }) {
1012
- return /* @__PURE__ */ jsxs9(Fragment6, { children: [
1013
- /* @__PURE__ */ jsx20(Button6, __spreadValues({ onClick: disclosure == null ? void 0 : disclosure[1].open, color: "indigo" }, buttonProps)),
1014
- /* @__PURE__ */ jsx20(
1015
- Modal5,
1016
- __spreadProps(__spreadValues({
1017
- opened: disclosure == null ? void 0 : disclosure[0],
1018
- onClose: disclosure[1].close
1019
- }, modalProps), {
1020
- children: /* @__PURE__ */ jsx20(MyFlexColumn, { children })
1021
- })
1022
- )
1023
- ] });
1024
- }
1025
-
1026
1026
  // src/components/Buttons/Anchor/MyAnchorViewPDF.tsx
1027
1027
  import { ActionIcon as ActionIcon10, Anchor, Group as Group4, Modal as Modal6, Paper as Paper2, Text as Text5 } from "@mantine/core";
1028
1028
  import { useDisclosure as useDisclosure6 } from "@mantine/hooks";
@@ -8317,8 +8317,8 @@ export {
8317
8317
  MyAppSpotlight,
8318
8318
  CoreActionIcon,
8319
8319
  CoreButton,
8320
- CoreButtonCreateUpdate,
8321
8320
  CoreButtonModal,
8321
+ MyButtonCreateUpdate,
8322
8322
  MyAnchorViewPDF,
8323
8323
  MyButtonModal,
8324
8324
  AQButtonCreateByImportFile,
@@ -104,6 +104,14 @@ interface CoreButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElem
104
104
  }
105
105
  declare function CoreButton({ children, actionType, ...rest }: CoreButtonProps): react_jsx_runtime.JSX.Element;
106
106
 
107
+ interface CoreButtonModalProps {
108
+ children?: ReactNode;
109
+ disclosure: ReturnType<typeof useDisclosure>;
110
+ buttonProps?: ButtonProps;
111
+ modalProps?: ModalProps;
112
+ }
113
+ declare function CoreButtonModal({ disclosure, children, buttonProps, modalProps, }: CoreButtonModalProps): react_jsx_runtime.JSX.Element;
114
+
107
115
  interface CoreButtonCreateUpdateProps<IReq, IRes> {
108
116
  modalProps?: ModalProps;
109
117
  actionIconProps?: ActionIconProps;
@@ -118,15 +126,7 @@ interface CoreButtonCreateUpdateProps<IReq, IRes> {
118
126
  disclosure?: ReturnType<typeof useDisclosure>;
119
127
  children?: ReactNode;
120
128
  }
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;
129
+ 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;
130
130
 
131
131
  declare function MyAnchorViewPDF({ label, pdfLink }: {
132
132
  label: string;
@@ -584,4 +584,4 @@ interface IMySkeletonTable extends SkeletonProps {
584
584
  }
585
585
  declare function MySkeletonTable({ h }: IMySkeletonTable): react_jsx_runtime.JSX.Element;
586
586
 
587
- export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, CoreActionIcon, CoreButton, CoreButtonCreateUpdate, CoreButtonModal, 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, MyDayOfWeekPicker, 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 };
587
+ export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, Boxes, CoreActionIcon, CoreButton, CoreButtonModal, 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, MyButtonCreateUpdate, MyButtonDeleteList, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonPrintTablePDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardInformation, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, type MyDataTableInternalProps, type MyDataTableProps, MyDataTableSelect, MyDateInput, MyDayOfWeekPicker, 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 };
@@ -9,7 +9,6 @@ import {
9
9
  Boxes,
10
10
  CoreActionIcon,
11
11
  CoreButton,
12
- CoreButtonCreateUpdate,
13
12
  CoreButtonModal,
14
13
  FaviconSetter,
15
14
  HeaderMegaMenu,
@@ -27,6 +26,7 @@ import {
27
26
  MyBoxesCore,
28
27
  MyButton,
29
28
  MyButtonCreate,
29
+ MyButtonCreateUpdate,
30
30
  MyButtonDeleteList,
31
31
  MyButtonImport,
32
32
  MyButtonModal,
@@ -72,7 +72,7 @@ import {
72
72
  useS_BasicAppShell,
73
73
  useS_ButtonImport,
74
74
  utils_layout_getItemsWithoutLinks
75
- } from "../chunk-D6DUS35O.mjs";
75
+ } from "../chunk-W3M7WO2A.mjs";
76
76
  import "../chunk-NWBLJ3W3.mjs";
77
77
  import "../chunk-K6S7R6LU.mjs";
78
78
  import "../chunk-KKJ3OEEW.mjs";
@@ -91,7 +91,6 @@ export {
91
91
  Boxes,
92
92
  CoreActionIcon,
93
93
  CoreButton,
94
- CoreButtonCreateUpdate,
95
94
  CoreButtonModal,
96
95
  FaviconSetter,
97
96
  HeaderMegaMenu,
@@ -109,6 +108,7 @@ export {
109
108
  MyBoxesCore,
110
109
  MyButton,
111
110
  MyButtonCreate,
111
+ MyButtonCreateUpdate,
112
112
  MyButtonDeleteList,
113
113
  MyButtonImport,
114
114
  MyButtonModal,
@@ -1,3 +1,9 @@
1
+ import {
2
+ const_object_documentTypes
3
+ } from "../chunk-GFEMKKFH.mjs";
4
+ import {
5
+ enum_emailConfigModule
6
+ } from "../chunk-VH4ZAD6M.mjs";
1
7
  import {
2
8
  F_authenticate_Logout,
3
9
  MyActionIconDelete,
@@ -24,16 +30,10 @@ import {
24
30
  useS_BasicAppShell,
25
31
  useS_authenticate,
26
32
  utils_layout_getItemsWithoutLinks
27
- } from "../chunk-D6DUS35O.mjs";
28
- import {
29
- const_object_documentTypes
30
- } from "../chunk-GFEMKKFH.mjs";
33
+ } from "../chunk-W3M7WO2A.mjs";
31
34
  import {
32
35
  const_object_colors
33
36
  } from "../chunk-NWBLJ3W3.mjs";
34
- import {
35
- enum_emailConfigModule
36
- } from "../chunk-VH4ZAD6M.mjs";
37
37
  import "../chunk-K6S7R6LU.mjs";
38
38
  import {
39
39
  baseAxios_default,
@@ -50,7 +50,7 @@ import {
50
50
  utils_config_getBaseUrl,
51
51
  utils_converter_enumToSelectOptions,
52
52
  utils_file_fileToAQDocumentType
53
- } from "../chunk-4H6NEAG4.mjs";
53
+ } from "../chunk-NRFQDAYS.mjs";
54
54
  import "../chunk-5U2JSHSJ.mjs";
55
55
  import {
56
56
  utils_notification_show
@@ -1,5 +1,6 @@
1
1
  export { a as IAQFileDetail, I as IUtils_Excel_ColumnConfig, b as utils_excel_download, u as utils_excel_exportExcel, d as utils_file_AQDocumentTypeToFile, e as utils_file_docxtemplaterDownload, c as utils_file_fileToAQDocumentType } from '../utils_file-G8NTHCO-.mjs';
2
2
  import { DefaultMantineColor } from '@mantine/core';
3
+ import { useQueryClient } from '@tanstack/react-query';
3
4
  import 'exceljs';
4
5
 
5
6
  declare const utils_converter_getLabelByValue: (data: Record<number, string>, value?: number | string) => string;
@@ -39,6 +40,15 @@ declare function utils_notification_show({ crudType, message, color }: I): void;
39
40
 
40
41
  declare function utils_pdf_download(url: string): Promise<void>;
41
42
 
43
+ declare function utils_reactQuery_updateListItemInQuery<T>({ queryClient, queryKey, listKey, itemId, updatedFields, matchBy, }: {
44
+ queryClient: ReturnType<typeof useQueryClient>;
45
+ queryKey: unknown[];
46
+ listKey: keyof T;
47
+ itemId: any;
48
+ updatedFields: Partial<any>;
49
+ matchBy?: string;
50
+ }): void;
51
+
42
52
  declare const utils_time_convertTimeStringToSeconds: (time: string) => number;
43
53
  declare const utils_time_getCurrentTimeString: () => string;
44
54
 
@@ -46,4 +56,4 @@ declare function U0MyValidateEmpty(message?: string): (value: unknown) => React.
46
56
  declare function U0MyValidateEmail(value?: string): "Email không đúng định dạng" | null;
47
57
  declare const utils_validator_validateCode: (value?: string) => "Không được để trống" | "Chỉ được nhập chữ, số và dấu '-' (không bắt đầu bằng '-')" | null;
48
58
 
49
- export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, updateEnableList, utils_converter_enumToSelectOptions, utils_converter_getKeyByValue, utils_converter_getLabelByValue, utils_currency_formatWithSuffix, utils_date_dateToDDMMYYYString, utils_date_formatToDateTimeStartEnd, utils_date_getHHmm, utils_notification_show, utils_pdf_download, utils_time_convertTimeStringToSeconds, utils_time_getCurrentTimeString, utils_validator_validateCode };
59
+ export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, updateEnableList, utils_converter_enumToSelectOptions, utils_converter_getKeyByValue, utils_converter_getLabelByValue, utils_currency_formatWithSuffix, utils_date_dateToDDMMYYYString, utils_date_formatToDateTimeStartEnd, utils_date_getHHmm, utils_notification_show, utils_pdf_download, utils_reactQuery_updateListItemInQuery, utils_time_convertTimeStringToSeconds, utils_time_getCurrentTimeString, utils_validator_validateCode };
@@ -15,10 +15,11 @@ import {
15
15
  utils_file_AQDocumentTypeToFile,
16
16
  utils_file_docxtemplaterDownload,
17
17
  utils_file_fileToAQDocumentType,
18
+ utils_reactQuery_updateListItemInQuery,
18
19
  utils_time_convertTimeStringToSeconds,
19
20
  utils_time_getCurrentTimeString,
20
21
  utils_validator_validateCode
21
- } from "../chunk-4H6NEAG4.mjs";
22
+ } from "../chunk-NRFQDAYS.mjs";
22
23
  import {
23
24
  utils_pdf_download
24
25
  } from "../chunk-5U2JSHSJ.mjs";
@@ -45,6 +46,7 @@ export {
45
46
  utils_file_fileToAQDocumentType,
46
47
  utils_notification_show,
47
48
  utils_pdf_download,
49
+ utils_reactQuery_updateListItemInQuery,
48
50
  utils_time_convertTimeStringToSeconds,
49
51
  utils_time_getCurrentTimeString,
50
52
  utils_validator_validateCode
package/package.json CHANGED
@@ -34,7 +34,7 @@
34
34
  "types": "./dist/enum/index.d.mts"
35
35
  }
36
36
  },
37
- "version": "0.1.292",
37
+ "version": "0.1.294",
38
38
  "private": false,
39
39
  "files": [
40
40
  "dist"