aq-fe-framework 0.1.557 → 0.1.559

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.
@@ -425,15 +425,16 @@ function MyButtonPrintPDF(_a) {
425
425
  autoPadding = true,
426
426
  buttonProps,
427
427
  useReactToPrintProps,
428
- isReady = true,
429
- pageSize = "portrait"
428
+ pageSize = "portrait",
429
+ onBeforePrint: onBeforePrint
430
430
  } = _b, rest = __objRest(_b, [
431
431
  "children",
432
432
  "autoPadding",
433
433
  "buttonProps",
434
434
  "useReactToPrintProps",
435
- "isReady",
436
- "pageSize"
435
+ "pageSize",
436
+ // ✅ mặc định
437
+ "onBeforePrint"
437
438
  ]);
438
439
  const isPrintState = useState(false);
439
440
  const printRef = useRef(null);
@@ -453,10 +454,18 @@ function MyButtonPrintPDF(_a) {
453
454
  }
454
455
  };
455
456
  useEffect(() => {
456
- if (isReady == false) return;
457
457
  if (isPrintState[0] == false) return;
458
- handlePrint();
459
- }, [isReady, isPrintState[0]]);
458
+ const doPrint = async () => {
459
+ try {
460
+ if (onBeforePrint) await onBeforePrint();
461
+ await new Promise((resolve) => setTimeout(resolve, 100));
462
+ handlePrint == null ? void 0 : handlePrint();
463
+ } finally {
464
+ isPrintState[1](false);
465
+ }
466
+ };
467
+ doPrint();
468
+ }, [isPrintState[0]]);
460
469
  return /* @__PURE__ */ jsxs5(Fragment3, { children: [
461
470
  /* @__PURE__ */ jsx9("style", { children: getPageSizeCSS() }),
462
471
  /* @__PURE__ */ jsx9("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx9(
@@ -474,13 +483,13 @@ function MyButtonPrintPDF(_a) {
474
483
  Button5,
475
484
  __spreadProps(__spreadValues({
476
485
  color: "orange",
486
+ leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {})
487
+ }, buttonProps), {
477
488
  onClick: (e) => {
478
489
  var _a2;
479
490
  (_a2 = buttonProps == null ? void 0 : buttonProps.onClick) == null ? void 0 : _a2.call(buttonProps, e);
480
491
  isPrintState[1](true);
481
492
  },
482
- leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {})
483
- }, buttonProps), {
484
493
  children: (buttonProps == null ? void 0 : buttonProps.children) || "In"
485
494
  })
486
495
  )
@@ -81,10 +81,10 @@ interface MyButtonPrintPDFProps {
81
81
  autoPadding?: boolean;
82
82
  useReactToPrintProps?: UseReactToPrintOptions;
83
83
  pageSize?: PageSizeOption;
84
- isReady?: boolean;
84
+ onBeforePrint?: () => Promise<void>;
85
85
  }
86
- declare function MyButtonPrintPDF({ children, autoPadding, buttonProps, useReactToPrintProps, isReady, pageSize, // ✅ mặc định
87
- ...rest }: MyButtonPrintPDFProps): react_jsx_runtime.JSX.Element;
86
+ declare function MyButtonPrintPDF({ children, autoPadding, buttonProps, useReactToPrintProps, pageSize, // ✅ mặc định
87
+ onBeforePrint, ...rest }: MyButtonPrintPDFProps): react_jsx_runtime.JSX.Element;
88
88
 
89
89
  declare function MyDataTableSelectOne<TData extends MRT_RowData>({ columns, queryResult, idSelection, setIdSelection }: {
90
90
  columns: MRT_ColumnDef<TData>[];
@@ -18,7 +18,7 @@ import {
18
18
  MyStatsCard,
19
19
  MyTextInput,
20
20
  MyWeeklySessionSchedulerPicker
21
- } from "../chunk-CQQY77VZ.mjs";
21
+ } from "../chunk-YJQBV6MS.mjs";
22
22
  import "../chunk-GFEMKKFH.mjs";
23
23
  import {
24
24
  MyModalDelete
@@ -12,10 +12,10 @@ import {
12
12
  U0DateToDDMMYYYString
13
13
  } from "../chunk-EWDS5IOF.mjs";
14
14
  import {
15
- MyButton as MyButton2,
15
+ MyButton,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput as MyTextInput2
18
- } from "../chunk-CQQY77VZ.mjs";
18
+ } from "../chunk-YJQBV6MS.mjs";
19
19
  import {
20
20
  const_object_documentTypes
21
21
  } from "../chunk-GFEMKKFH.mjs";
@@ -25,7 +25,7 @@ import {
25
25
  MyActionIconDelete,
26
26
  MyActionIconUpdate,
27
27
  MyBoxesBackground,
28
- MyButton,
28
+ MyButton as MyButton2,
29
29
  MyButtonCreate,
30
30
  MyButtonModal,
31
31
  MyButtonViewPDF,
@@ -210,7 +210,7 @@ function Permission_SaveMenuPermission({
210
210
  }
211
211
  });
212
212
  return /* @__PURE__ */ jsx3(
213
- MyButton2,
213
+ MyButton,
214
214
  {
215
215
  onClick: () => {
216
216
  mutation.mutate((values == null ? void 0 : values.filter((item) => item.id != "0").map((item) => ({
@@ -831,7 +831,7 @@ function F_accessControl_Save() {
831
831
  }
832
832
  disable[1](false);
833
833
  }, [store.state.rolePermissions]);
834
- return /* @__PURE__ */ jsx9(MyButton, { disabled: disable[0], crudType: "save", onClick: handleSave });
834
+ return /* @__PURE__ */ jsx9(MyButton2, { disabled: disable[0], crudType: "save", onClick: handleSave });
835
835
  }
836
836
 
837
837
  // src/modules-features/admin/core/accessControl/old/F_accessControl.tsx
@@ -1285,7 +1285,7 @@ function F_accessControlLevel_Save() {
1285
1285
  }
1286
1286
  disable[1](false);
1287
1287
  }, [store.state.rolePermissions]);
1288
- return /* @__PURE__ */ jsx16(MyButton, { disabled: disable[0], crudType: "save", onClick: handleSave });
1288
+ return /* @__PURE__ */ jsx16(MyButton2, { disabled: disable[0], crudType: "save", onClick: handleSave });
1289
1289
  }
1290
1290
 
1291
1291
  // src/modules-features/admin/core/accessControlLevel/old/F_accessControlLevel.tsx
@@ -3056,7 +3056,7 @@ function F_core35923() {
3056
3056
  /* @__PURE__ */ jsx49(Grid5.Col, { span: { base: 12, md: 6 }, children: /* @__PURE__ */ jsx49(MyFileInput, { label: "Favicon (16px x 16px)" }) }),
3057
3057
  /* @__PURE__ */ jsx49(Grid5.Col, { span: { base: 12, md: 6 }, children: /* @__PURE__ */ jsx49(MyFileInput, { label: "Logo (330px x 115px)" }) })
3058
3058
  ] }),
3059
- /* @__PURE__ */ jsx49(MyFlexEnd, { children: /* @__PURE__ */ jsx49(MyButton, { crudType: "save" }) })
3059
+ /* @__PURE__ */ jsx49(MyFlexEnd, { children: /* @__PURE__ */ jsx49(MyButton2, { crudType: "save" }) })
3060
3060
  ] });
3061
3061
  }
3062
3062
 
@@ -4443,7 +4443,7 @@ function F_moduleConfig_Save({
4443
4443
  });
4444
4444
  }
4445
4445
  return /* @__PURE__ */ jsx83(
4446
- MyButton,
4446
+ MyButton2,
4447
4447
  {
4448
4448
  disabled: !form.isDirty(),
4449
4449
  crudType: "save",
@@ -4899,13 +4899,13 @@ import { useMemo as useMemo20 } from "react";
4899
4899
  // src/modules-features/admin/core/pageContentConfig/F_pageContentConfig_DeleteDescription.tsx
4900
4900
  import { jsx as jsx91 } from "react/jsx-runtime";
4901
4901
  function F_pageContentConfig_DeleteDescription() {
4902
- return /* @__PURE__ */ jsx91(MyButton2, { actionType: "delete" });
4902
+ return /* @__PURE__ */ jsx91(MyButton, { actionType: "delete" });
4903
4903
  }
4904
4904
 
4905
4905
  // src/modules-features/admin/core/pageContentConfig/F_pageContentConfig_Export.tsx
4906
4906
  import { jsx as jsx92 } from "react/jsx-runtime";
4907
4907
  function F_pageContentConfig_Export() {
4908
- return /* @__PURE__ */ jsx92(MyButton2, { actionType: "export" });
4908
+ return /* @__PURE__ */ jsx92(MyButton, { actionType: "export" });
4909
4909
  }
4910
4910
 
4911
4911
  // src/modules-features/admin/core/pageContentConfig/F_pageContentConfig_Save.tsx
@@ -4917,7 +4917,7 @@ function F_pageContentConfig_Save({ menuValues }) {
4917
4917
  return service_pageContent.updateList([{ id: 1 }]);
4918
4918
  }
4919
4919
  });
4920
- return /* @__PURE__ */ jsx93(MyButton2, { actionType: "save", onClick: () => updatePageConfigMutation.mutate({}) });
4920
+ return /* @__PURE__ */ jsx93(MyButton, { actionType: "save", onClick: () => updatePageConfigMutation.mutate({}) });
4921
4921
  }
4922
4922
 
4923
4923
  // src/modules-features/admin/core/pageContentConfig/F_pageContentConfig_ReadMenu.tsx
package/package.json CHANGED
@@ -46,7 +46,7 @@
46
46
  "types": "./dist/coreService/index.d.mts"
47
47
  }
48
48
  },
49
- "version": "0.1.557",
49
+ "version": "0.1.559",
50
50
  "private": false,
51
51
  "files": [
52
52
  "dist"