aq-fe-framework 0.1.500 → 0.1.502

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.
@@ -213,7 +213,7 @@ async function utils_file_docxtemplaterDownload({
213
213
 
214
214
  // src/utils/utils_format.ts
215
215
  function utils_format_fixDecimal(number, digits = 2) {
216
- if (typeof number !== "number" || isNaN(number)) return 0;
216
+ if (typeof number !== "number" || isNaN(number)) return void 0;
217
217
  return parseFloat(number.toFixed(digits));
218
218
  }
219
219
 
@@ -377,18 +377,28 @@ function MyButtonPrintPDF({
377
377
  children,
378
378
  autoPadding = true,
379
379
  buttonProps,
380
- useReactToPrintProps
380
+ useReactToPrintProps,
381
+ pageSize = "portrait"
382
+ // ✅ mặc định
381
383
  }) {
382
384
  const printRef = useRef(null);
383
385
  const handlePrint = useReactToPrint(__spreadValues({
384
386
  documentTitle: "In n\u1ED9i dung",
385
387
  contentRef: printRef
386
388
  }, useReactToPrintProps));
387
- function handleClick() {
388
- if (!children) return;
389
- handlePrint();
390
- }
389
+ const getPageSizeCSS = () => {
390
+ switch (pageSize) {
391
+ case "landscape":
392
+ return `@media print {@page { size: landscape; }}`;
393
+ case "A4-landscape":
394
+ return `@media print {@page { size: 29.7cm 21cm; }}`;
395
+ case "portrait":
396
+ default:
397
+ return ``;
398
+ }
399
+ };
391
400
  return /* @__PURE__ */ jsxs4(Fragment3, { children: [
401
+ /* @__PURE__ */ jsx9("style", { children: getPageSizeCSS() }),
392
402
  /* @__PURE__ */ jsx9("div", { style: { display: "none" }, children: /* @__PURE__ */ jsx9(
393
403
  "div",
394
404
  {
@@ -400,7 +410,16 @@ function MyButtonPrintPDF({
400
410
  children
401
411
  }
402
412
  ) }),
403
- /* @__PURE__ */ jsx9(Button5, __spreadProps(__spreadValues({ color: "orange", onClick: handleClick, leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {}) }, buttonProps), { children: (buttonProps == null ? void 0 : buttonProps.children) || "In" }))
413
+ /* @__PURE__ */ jsx9(
414
+ Button5,
415
+ __spreadProps(__spreadValues({
416
+ color: "orange",
417
+ onClick: handlePrint,
418
+ leftSection: /* @__PURE__ */ jsx9(IconPrinter3, {})
419
+ }, buttonProps), {
420
+ children: (buttonProps == null ? void 0 : buttonProps.children) || "In"
421
+ })
422
+ )
404
423
  ] });
405
424
  }
406
425
 
@@ -67,13 +67,15 @@ interface MyButtonModalCreateUpdateProps extends Omit<MyButtonModalProps, "discl
67
67
  }
68
68
  declare function MyButtonModalCreateUpdate(props?: MyButtonModalCreateUpdateProps): react_jsx_runtime.JSX.Element;
69
69
 
70
+ type PageSizeOption = "portrait" | "landscape" | "A4-landscape";
70
71
  interface MyButtonPrintPDFProps {
71
72
  buttonProps?: ButtonProps;
72
73
  children?: ReactNode;
73
74
  autoPadding?: boolean;
74
75
  useReactToPrintProps?: UseReactToPrintOptions;
76
+ pageSize?: PageSizeOption;
75
77
  }
76
- declare function MyButtonPrintPDF({ children, autoPadding, buttonProps, useReactToPrintProps, }: MyButtonPrintPDFProps): react_jsx_runtime.JSX.Element;
78
+ declare function MyButtonPrintPDF({ children, autoPadding, buttonProps, useReactToPrintProps, pageSize, }: MyButtonPrintPDFProps): react_jsx_runtime.JSX.Element;
77
79
 
78
80
  declare function MyDataTableSelectOne<TData extends MRT_RowData>({ columns, queryResult, idSelection, setIdSelection }: {
79
81
  columns: MRT_ColumnDef<TData>[];
@@ -18,7 +18,7 @@ import {
18
18
  MyStatsCard,
19
19
  MyTextInput,
20
20
  MyWeeklySessionSchedulerPicker
21
- } from "../chunk-K2DC3T55.mjs";
21
+ } from "../chunk-SH7FDAU2.mjs";
22
22
  import "../chunk-YAMXCOJ5.mjs";
23
23
  import "../chunk-U62R2QKJ.mjs";
24
24
  import "../chunk-5U2JSHSJ.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  utils_config_getBaseUrl,
5
5
  utils_converter_enumToSelectOptions,
6
6
  utils_file_fileToAQDocumentType
7
- } from "../chunk-CMWDA4NM.mjs";
7
+ } from "../chunk-RBWFK2GG.mjs";
8
8
  import {
9
9
  baseColumns
10
10
  } from "../chunk-BEFEWY44.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  MyButton as MyButton2,
16
16
  MyDataTableSelectOne,
17
17
  MyTextInput as MyTextInput2
18
- } from "../chunk-K2DC3T55.mjs";
18
+ } from "../chunk-SH7FDAU2.mjs";
19
19
  import {
20
20
  F_authenticate_Logout,
21
21
  MyActionIconDelete,
@@ -26,7 +26,7 @@ declare function utils_date_dateToDDMMYYYString(date?: Date | string): string;
26
26
  declare function utils_date_formatToDateTimeStartEnd(startDate: Date, endDate: Date): string;
27
27
  declare function utils_date_getHHmm(date: Date): string;
28
28
 
29
- declare function utils_format_fixDecimal(number: number, digits?: number): number;
29
+ declare function utils_format_fixDecimal(number: number, digits?: number): number | undefined;
30
30
 
31
31
  /**
32
32
  * Cập nhật danh sách dạng many-to-many có cờ enable.
@@ -24,7 +24,7 @@ import {
24
24
  utils_time_getCurrentTimeString,
25
25
  utils_time_getHourMinuteFromString,
26
26
  utils_validator_validateCode
27
- } from "../chunk-CMWDA4NM.mjs";
27
+ } from "../chunk-RBWFK2GG.mjs";
28
28
  import {
29
29
  U0DateToDDMMYYYString,
30
30
  utils_date_dateToDDMMYYYString,
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.500",
45
+ "version": "0.1.502",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"