aq-fe-framework 0.1.552 → 0.1.554

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.
@@ -416,7 +416,7 @@ function MyButtonModalForm(_a) {
416
416
  // src/core/button/MyButtonPrintPDF.tsx
417
417
  import { Button as Button5 } from "@mantine/core";
418
418
  import { IconPrinter as IconPrinter3 } from "@tabler/icons-react";
419
- import { useRef } from "react";
419
+ import { useEffect, useRef, useState } from "react";
420
420
  import { useReactToPrint } from "react-to-print";
421
421
  import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
422
422
  function MyButtonPrintPDF(_a) {
@@ -425,7 +425,7 @@ function MyButtonPrintPDF(_a) {
425
425
  autoPadding = true,
426
426
  buttonProps,
427
427
  useReactToPrintProps,
428
- isReady,
428
+ isReady = true,
429
429
  pageSize = "portrait"
430
430
  } = _b, rest = __objRest(_b, [
431
431
  "children",
@@ -435,6 +435,7 @@ function MyButtonPrintPDF(_a) {
435
435
  "isReady",
436
436
  "pageSize"
437
437
  ]);
438
+ const isPrintState = useState(false);
438
439
  const printRef = useRef(null);
439
440
  const handlePrint = useReactToPrint(__spreadValues({
440
441
  documentTitle: "In n\u1ED9i dung",
@@ -451,6 +452,11 @@ function MyButtonPrintPDF(_a) {
451
452
  return ``;
452
453
  }
453
454
  };
455
+ useEffect(() => {
456
+ if (isReady == false) return;
457
+ if (isPrintState[0] == false) return;
458
+ handlePrint();
459
+ }, [isReady, isPrintState[0]]);
454
460
  return /* @__PURE__ */ jsxs5(Fragment3, { children: [
455
461
  /* @__PURE__ */ jsx9("style", { children: getPageSizeCSS() }),
456
462
  /* @__PURE__ */ jsx9("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx9(
@@ -471,9 +477,7 @@ function MyButtonPrintPDF(_a) {
471
477
  onClick: (e) => {
472
478
  var _a2;
473
479
  (_a2 = buttonProps == null ? void 0 : buttonProps.onClick) == null ? void 0 : _a2.call(buttonProps, e);
474
- if (isReady) {
475
- handlePrint();
476
- }
480
+ isPrintState[1](true);
477
481
  },
478
482
  leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {})
479
483
  }, buttonProps), {
@@ -484,7 +488,7 @@ function MyButtonPrintPDF(_a) {
484
488
  }
485
489
 
486
490
  // src/core/dataDisplay/MyDataTableSelectOne.tsx
487
- import { useEffect, useMemo as useMemo2 } from "react";
491
+ import { useEffect as useEffect2, useMemo as useMemo2 } from "react";
488
492
  import { jsx as jsx10 } from "react/jsx-runtime";
489
493
  function MyDataTableSelectOne({
490
494
  columns,
@@ -493,7 +497,7 @@ function MyDataTableSelectOne({
493
497
  setIdSelection
494
498
  }) {
495
499
  const columnsState = useMemo2(() => columns, []);
496
- useEffect(() => {
500
+ useEffect2(() => {
497
501
  if (!queryResult.data) return;
498
502
  setIdSelection(queryResult.data[0].id);
499
503
  }, [queryResult.data]);
@@ -624,7 +628,7 @@ import TextAlign from "@tiptap/extension-text-align";
624
628
  import Underline from "@tiptap/extension-underline";
625
629
  import { useEditor } from "@tiptap/react";
626
630
  import StarterKit from "@tiptap/starter-kit";
627
- import { useEffect as useEffect2 } from "react";
631
+ import { useEffect as useEffect3 } from "react";
628
632
  import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
629
633
  function MyRichTextEditor(props) {
630
634
  const editor = useEditor({
@@ -704,7 +708,7 @@ function MyRichTextEditor(props) {
704
708
  (_a = props.onBlur) == null ? void 0 : _a.call(props, editor2.getHTML());
705
709
  }
706
710
  });
707
- useEffect2(() => {
711
+ useEffect3(() => {
708
712
  if (editor && props.value !== editor.getHTML()) {
709
713
  editor.commands.setContent(props.value || "", false);
710
714
  }
@@ -805,7 +809,7 @@ function MySelect(_a) {
805
809
  }
806
810
 
807
811
  // src/core/input/MySelectFromAPI.tsx
808
- import { useCallback, useEffect as useEffect3, useMemo as useMemo3, useRef as useRef2 } from "react";
812
+ import { useCallback, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef2 } from "react";
809
813
  import { jsx as jsx18 } from "react/jsx-runtime";
810
814
  function MySelectFromAPI(_a) {
811
815
  var _b = _a, {
@@ -859,7 +863,7 @@ function MySelectFromAPI(_a) {
859
863
  setObjectData(selected);
860
864
  }
861
865
  };
862
- useEffect3(() => {
866
+ useEffect4(() => {
863
867
  var _a2, _b2, _c;
864
868
  if (autoSelectFirstItem && !hasAutoSelected.current && ((_a2 = query.data) == null ? void 0 : _a2.length) && (value === void 0 || value === null || value === "")) {
865
869
  const firstItem = query.data[0];
@@ -936,13 +940,13 @@ import {
936
940
  Text as Text5
937
941
  } from "@mantine/core";
938
942
  import { IconPlus as IconPlus4, IconTrash as IconTrash3 } from "@tabler/icons-react";
939
- import { useState } from "react";
943
+ import { useState as useState2 } from "react";
940
944
  import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
941
945
  function MyWeeklySessionSchedulerPicker({
942
946
  value = [],
943
947
  onChange
944
948
  }) {
945
- const [selectedDays, setSelectedDays] = useState([]);
949
+ const [selectedDays, setSelectedDays] = useState2([]);
946
950
  const handleAddSession = (dayOfWeek) => {
947
951
  const newSession = {
948
952
  dayOfWeek,
@@ -18,7 +18,7 @@ import {
18
18
  MyStatsCard,
19
19
  MyTextInput,
20
20
  MyWeeklySessionSchedulerPicker
21
- } from "../chunk-2GVTFI35.mjs";
21
+ } from "../chunk-CQQY77VZ.mjs";
22
22
  import "../chunk-GFEMKKFH.mjs";
23
23
  import {
24
24
  MyModalDelete
@@ -15,7 +15,7 @@ import {
15
15
  MyButton as MyButton2,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput as MyTextInput2
18
- } from "../chunk-2GVTFI35.mjs";
18
+ } from "../chunk-CQQY77VZ.mjs";
19
19
  import {
20
20
  const_object_documentTypes
21
21
  } from "../chunk-GFEMKKFH.mjs";
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "types": "./dist/coreService/index.d.mts"
47
47
  }
48
48
  },
49
- "version": "0.1.552",
49
+ "version": "0.1.554",
50
50
  "private": false,
51
51
  "files": [
52
52
  "dist"