aq-fe-framework 0.1.573 → 0.1.574

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MyButton
3
- } from "./chunk-DRAMLXGM.mjs";
3
+ } from "./chunk-MBFTZJMN.mjs";
4
4
  import {
5
5
  __objRest,
6
6
  __spreadProps,
@@ -3,7 +3,7 @@ import {
3
3
  MyFieldset,
4
4
  MyFlexColumn,
5
5
  MyFlexRow
6
- } from "./chunk-DRAMLXGM.mjs";
6
+ } from "./chunk-MBFTZJMN.mjs";
7
7
  import {
8
8
  const_object_colors
9
9
  } from "./chunk-OMJJAHOC.mjs";
@@ -1980,7 +1980,7 @@ import {
1980
1980
  import { useDisclosure as useDisclosure10 } from "@mantine/hooks";
1981
1981
  import { IconLivePhoto as IconLivePhoto2, IconMaximize as IconMaximize3, IconMinimize as IconMinimize3 } from "@tabler/icons-react";
1982
1982
  import { useQuery } from "@tanstack/react-query";
1983
- import { useState as useState8 } from "react";
1983
+ import { useEffect as useEffect6, useState as useState8 } from "react";
1984
1984
  import { Fragment as Fragment10, jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
1985
1985
  function MyButtonViewPDF({
1986
1986
  id,
@@ -1990,10 +1990,10 @@ function MyButtonViewPDF({
1990
1990
  isActionIcon = false,
1991
1991
  filePath
1992
1992
  }) {
1993
- var _a, _b, _c;
1994
- const disc = useDisclosure10(false);
1995
- const fullScreen = useState8(false);
1996
- const hSize = useState8("80vh");
1993
+ const [opened, { open, close }] = useDisclosure10(false);
1994
+ const [fullscreen, setFullscreen] = useState8(false);
1995
+ const [height, setHeight] = useState8("80vh");
1996
+ const [blobUrl, setBlobUrl] = useState8(null);
1997
1997
  const query = useQuery({
1998
1998
  queryKey: ["MyButtonViewPDF", id, filePath],
1999
1999
  queryFn: async () => {
@@ -2004,73 +2004,70 @@ function MyButtonViewPDF({
2004
2004
  const res = await baseAxios_default.get("/Document/Get?id=" + id);
2005
2005
  return res.data.data;
2006
2006
  },
2007
- enabled: disc[0] == true
2007
+ enabled: opened
2008
2008
  });
2009
+ useEffect6(() => {
2010
+ var _a, _b, _c;
2011
+ if (!query.data) return;
2012
+ const base64String = filePath ? (_a = query.data) == null ? void 0 : _a.fileBase64String : (_c = (_b = query.data) == null ? void 0 : _b.fileDetail) == null ? void 0 : _c.fileBase64String;
2013
+ if (!base64String) return;
2014
+ const byteCharacters = atob(base64String);
2015
+ const byteNumbers = new Array(byteCharacters.length);
2016
+ for (let i5 = 0; i5 < byteCharacters.length; i5++) {
2017
+ byteNumbers[i5] = byteCharacters.charCodeAt(i5);
2018
+ }
2019
+ const byteArray = new Uint8Array(byteNumbers);
2020
+ const blob = new Blob([byteArray], { type: "application/pdf" });
2021
+ const newBlobUrl = URL.createObjectURL(blob);
2022
+ setBlobUrl(newBlobUrl);
2023
+ return () => {
2024
+ URL.revokeObjectURL(newBlobUrl);
2025
+ };
2026
+ }, [query.data]);
2009
2027
  return /* @__PURE__ */ jsxs20(Fragment10, { children: [
2010
- /* @__PURE__ */ jsx34(Tooltip4, { label: "Xem t\xE0i li\u1EC7u tr\u1EF1c ti\u1EBFp", children: isActionIcon ? /* @__PURE__ */ jsx34(
2011
- ActionIcon10,
2012
- {
2013
- onClick: () => {
2014
- disc[1].open();
2015
- },
2016
- children: /* @__PURE__ */ jsx34(IconLivePhoto2, {})
2017
- }
2018
- ) : /* @__PURE__ */ jsx34(
2019
- Button10,
2020
- {
2021
- color: "cyan",
2022
- onClick: () => {
2023
- disc[1].open();
2024
- },
2025
- leftSection: /* @__PURE__ */ jsx34(IconLivePhoto2, {}),
2026
- children: label
2027
- }
2028
- ) }),
2028
+ /* @__PURE__ */ jsx34(Tooltip4, { label: "Xem t\xE0i li\u1EC7u tr\u1EF1c ti\u1EBFp", children: isActionIcon ? /* @__PURE__ */ jsx34(ActionIcon10, { onClick: open, children: /* @__PURE__ */ jsx34(IconLivePhoto2, {}) }) : /* @__PURE__ */ jsx34(Button10, { color: "cyan", onClick: open, leftSection: /* @__PURE__ */ jsx34(IconLivePhoto2, {}), children: label }) }),
2029
2029
  /* @__PURE__ */ jsx34(
2030
2030
  Modal10,
2031
2031
  {
2032
- fullScreen: fullScreen[0],
2033
- opened: disc[0],
2034
- onClose: disc[1].close,
2032
+ fullScreen: fullscreen,
2033
+ opened,
2034
+ onClose: () => {
2035
+ close();
2036
+ setBlobUrl(null);
2037
+ },
2035
2038
  size: modalSize,
2036
2039
  title: /* @__PURE__ */ jsxs20(Group9, { children: [
2037
2040
  /* @__PURE__ */ jsx34(Text7, { children: "Xem t\xE0i li\u1EC7u tr\u1EF1c ti\u1EBFp" }),
2038
- fullScreen[0] ? /* @__PURE__ */ jsx34(
2039
- ActionIcon10,
2040
- {
2041
- onClick: () => {
2042
- fullScreen[1](false);
2043
- hSize[1]("80vh");
2044
- },
2045
- children: /* @__PURE__ */ jsx34(IconMinimize3, {})
2046
- }
2047
- ) : /* @__PURE__ */ jsx34(
2041
+ /* @__PURE__ */ jsx34(
2048
2042
  ActionIcon10,
2049
2043
  {
2050
2044
  onClick: () => {
2051
- fullScreen[1](true);
2052
- hSize[1]("90vh");
2045
+ setFullscreen(!fullscreen);
2046
+ setHeight(fullscreen ? "80vh" : "90vh");
2053
2047
  },
2054
- children: /* @__PURE__ */ jsx34(IconMaximize3, {})
2048
+ children: fullscreen ? /* @__PURE__ */ jsx34(IconMinimize3, {}) : /* @__PURE__ */ jsx34(IconMaximize3, {})
2055
2049
  }
2056
2050
  )
2057
2051
  ] }),
2058
- children: /* @__PURE__ */ jsxs20(Paper3, { h: hSize[0], p: "lg", pos: "relative", children: [
2052
+ children: /* @__PURE__ */ jsxs20(Paper3, { h: height, p: "lg", pos: "relative", children: [
2059
2053
  /* @__PURE__ */ jsx34(
2060
2054
  LoadingOverlay,
2061
2055
  {
2056
+ visible: query.isLoading || !blobUrl && !!query.data,
2062
2057
  zIndex: 1e3,
2063
2058
  overlayProps: { radius: "sm", blur: 2 }
2064
2059
  }
2065
2060
  ),
2066
- query.data ? /* @__PURE__ */ jsx34(
2061
+ blobUrl || src ? /* @__PURE__ */ jsx34(
2067
2062
  "iframe",
2068
2063
  {
2069
- src: `data:application/pdf;base64, ${filePath ? (_a = query.data) == null ? void 0 : _a.fileBase64String : (_c = (_b = query.data) == null ? void 0 : _b.fileDetail) == null ? void 0 : _c.fileBase64String}`,
2064
+ src: blobUrl != null ? blobUrl : src,
2070
2065
  width: "100%",
2071
- height: "100%"
2066
+ height: "100%",
2067
+ allow: "fullscreen",
2068
+ style: { border: "none" }
2072
2069
  }
2073
- ) : /* @__PURE__ */ jsx34("iframe", { src, width: "100%", height: "100%" })
2070
+ ) : /* @__PURE__ */ jsx34(Text7, {})
2074
2071
  ] })
2075
2072
  }
2076
2073
  )
@@ -6424,7 +6421,7 @@ import { createEventsServicePlugin } from "@schedule-x/events-service";
6424
6421
  import { ScheduleXCalendar, useNextCalendarApp } from "@schedule-x/react";
6425
6422
  import { Paper as Paper4, Text as Text8 } from "@mantine/core";
6426
6423
  import "@schedule-x/theme-default/dist/index.css";
6427
- import { useEffect as useEffect6 } from "react";
6424
+ import { useEffect as useEffect7 } from "react";
6428
6425
  import { jsx as jsx35, jsxs as jsxs21 } from "react/jsx-runtime";
6429
6426
  function MyCalendar() {
6430
6427
  const plugins = [createEventsServicePlugin(), createEventModalPlugin()];
@@ -6496,7 +6493,7 @@ function MyCalendar() {
6496
6493
  }
6497
6494
  ]
6498
6495
  }, plugins);
6499
- useEffect6(() => {
6496
+ useEffect7(() => {
6500
6497
  calendar == null ? void 0 : calendar.events.getAll();
6501
6498
  }, []);
6502
6499
  return /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(ScheduleXCalendar, { calendarApp: calendar, customComponents: {
@@ -6824,7 +6821,7 @@ function AQStatCard2({
6824
6821
  }
6825
6822
 
6826
6823
  // src/components/FaviconSetter/FaviconSetter.tsx
6827
- import { useEffect as useEffect7 } from "react";
6824
+ import { useEffect as useEffect8 } from "react";
6828
6825
 
6829
6826
  // src/components/Layouts/BasicAppShell/useS_BasicAppShell.ts
6830
6827
  var useStore2 = createGenericStore({
@@ -6876,7 +6873,7 @@ function useS_BasicAppShell() {
6876
6873
  function FaviconSetter() {
6877
6874
  var _a;
6878
6875
  const store = useS_BasicAppShell();
6879
- useEffect7(() => {
6876
+ useEffect8(() => {
6880
6877
  var _a2, _b, _c;
6881
6878
  if (!((_a2 = store.state.faviconFileDetail) == null ? void 0 : _a2.fileBase64String)) return;
6882
6879
  try {
@@ -7009,7 +7006,7 @@ import TextAlign from "@tiptap/extension-text-align";
7009
7006
  import Underline from "@tiptap/extension-underline";
7010
7007
  import { useEditor } from "@tiptap/react";
7011
7008
  import StarterKit from "@tiptap/starter-kit";
7012
- import { useEffect as useEffect8, useState as useState9 } from "react";
7009
+ import { useEffect as useEffect9, useState as useState9 } from "react";
7013
7010
  import { jsx as jsx50, jsxs as jsxs28 } from "react/jsx-runtime";
7014
7011
  function MyTextEditor(_a) {
7015
7012
  var _b = _a, {
@@ -7111,7 +7108,7 @@ function MyTextEditor(_a) {
7111
7108
  }
7112
7109
  }
7113
7110
  }, rest));
7114
- useEffect8(() => {
7111
+ useEffect9(() => {
7115
7112
  if (editor && value !== editor.getHTML()) {
7116
7113
  editor.commands.setContent(value);
7117
7114
  }
@@ -7220,7 +7217,7 @@ import {
7220
7217
  } from "@tabler/icons-react";
7221
7218
  import Link3 from "next/link";
7222
7219
  import { usePathname as usePathname2 } from "next/navigation";
7223
- import { useEffect as useEffect9, useMemo as useMemo3, useState as useState10 } from "react";
7220
+ import { useEffect as useEffect10, useMemo as useMemo3, useState as useState10 } from "react";
7224
7221
  import { Fragment as Fragment12, jsx as jsx52, jsxs as jsxs29 } from "react/jsx-runtime";
7225
7222
  function findBreadcrumbPath(items, currentPath, parents = []) {
7226
7223
  for (const item of items) {
@@ -7379,7 +7376,7 @@ function BasicAppShell({ children, menu, extraTopRight, title, logoutRedirect })
7379
7376
  return result;
7380
7377
  }, [menu]);
7381
7378
  useFavicon(faviconUrl);
7382
- useEffect9(() => {
7379
+ useEffect10(() => {
7383
7380
  var _a2;
7384
7381
  const data = GetAQModule_query.data;
7385
7382
  if (!data) return;
@@ -7401,12 +7398,12 @@ function BasicAppShell({ children, menu, extraTopRight, title, logoutRedirect })
7401
7398
  };
7402
7399
  }
7403
7400
  }, [GetAQModule_query.data]);
7404
- useEffect9(() => {
7401
+ useEffect10(() => {
7405
7402
  const data = GetAQModule_query.data;
7406
7403
  if (!data) return;
7407
7404
  document.title = data.name || "";
7408
7405
  }, [GetAQModule_query.data]);
7409
- useEffect9(() => {
7406
+ useEffect10(() => {
7410
7407
  const linkItem = allChildItems.find((item) => pathName.includes(item.link));
7411
7408
  const breadcrumb = findBreadcrumbPath(menu, linkItem == null ? void 0 : linkItem.link);
7412
7409
  basicAppShellStore.setProperty("breadcrumb", breadcrumb);
@@ -259,7 +259,7 @@ interface IMyButtonViewPDF {
259
259
  isActionIcon?: boolean;
260
260
  filePath?: string;
261
261
  }
262
- declare function MyButtonViewPDF({ id, modalSize, label, src, isActionIcon, filePath }: IMyButtonViewPDF): react_jsx_runtime.JSX.Element;
262
+ declare function MyButtonViewPDF({ id, modalSize, label, src, isActionIcon, filePath, }: IMyButtonViewPDF): react_jsx_runtime.JSX.Element;
263
263
 
264
264
  declare function MyCalendar(): react_jsx_runtime.JSX.Element;
265
265
 
@@ -67,7 +67,7 @@ import {
67
67
  useS_BasicAppShell,
68
68
  useS_ButtonImport,
69
69
  utils_layout_getItemsWithoutLinks
70
- } from "../chunk-DRAMLXGM.mjs";
70
+ } from "../chunk-MBFTZJMN.mjs";
71
71
  import "../chunk-U62R2QKJ.mjs";
72
72
  import "../chunk-5U2JSHSJ.mjs";
73
73
  import "../chunk-OMJJAHOC.mjs";
@@ -21,12 +21,12 @@ import {
21
21
  MyStatsCard,
22
22
  MyTextInput,
23
23
  MyWeeklySessionSchedulerPicker
24
- } from "../chunk-6MIF2A3H.mjs";
24
+ } from "../chunk-JK76ZIUG.mjs";
25
25
  import "../chunk-GFEMKKFH.mjs";
26
26
  import {
27
27
  MyModalDelete
28
- } from "../chunk-4TWJT2QW.mjs";
29
- import "../chunk-DRAMLXGM.mjs";
28
+ } from "../chunk-BITKEWBN.mjs";
29
+ import "../chunk-MBFTZJMN.mjs";
30
30
  import "../chunk-U62R2QKJ.mjs";
31
31
  import "../chunk-5U2JSHSJ.mjs";
32
32
  import "../chunk-OMJJAHOC.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MyModalDelete
3
- } from "../chunk-4TWJT2QW.mjs";
4
- import "../chunk-DRAMLXGM.mjs";
3
+ } from "../chunk-BITKEWBN.mjs";
4
+ import "../chunk-MBFTZJMN.mjs";
5
5
  import "../chunk-U62R2QKJ.mjs";
6
6
  import "../chunk-5U2JSHSJ.mjs";
7
7
  import "../chunk-OMJJAHOC.mjs";
@@ -15,11 +15,11 @@ import {
15
15
  MyButton as MyButton2,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput as MyTextInput2
18
- } from "../chunk-6MIF2A3H.mjs";
18
+ } from "../chunk-JK76ZIUG.mjs";
19
19
  import {
20
20
  const_object_documentTypes
21
21
  } from "../chunk-GFEMKKFH.mjs";
22
- import "../chunk-4TWJT2QW.mjs";
22
+ import "../chunk-BITKEWBN.mjs";
23
23
  import {
24
24
  F_authenticate_Logout,
25
25
  MyActionIconDelete,
@@ -45,7 +45,7 @@ import {
45
45
  groupToTwoLevels,
46
46
  useS_authenticate,
47
47
  utils_layout_getItemsWithoutLinks
48
- } from "../chunk-DRAMLXGM.mjs";
48
+ } from "../chunk-MBFTZJMN.mjs";
49
49
  import {
50
50
  createGenericStore
51
51
  } from "../chunk-U62R2QKJ.mjs";
package/package.json CHANGED
@@ -50,7 +50,7 @@
50
50
  "types": "./dist/types/index.d.mts"
51
51
  }
52
52
  },
53
- "version": "0.1.573",
53
+ "version": "0.1.574",
54
54
  "private": false,
55
55
  "files": [
56
56
  "dist"