aq-fe-framework 0.1.49 → 0.1.50

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.
@@ -1618,6 +1618,120 @@ function MyHtmlWrapper(_a) {
1618
1618
  // src/components/Buttons/ButtonPrintPDFTable/MyButtonPrintTablePDF.tsx
1619
1619
  import { Box, Table as Table2 } from "@mantine/core";
1620
1620
  import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
1621
+ function MyButtonPrintTablePDF({
1622
+ printConfig,
1623
+ data
1624
+ }) {
1625
+ console.log(printConfig);
1626
+ const formatDate = (date) => {
1627
+ const day = String(date.getDate()).padStart(2, "0");
1628
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1629
+ const year = date.getFullYear();
1630
+ return `${day}/${month}/${year}`;
1631
+ };
1632
+ const formatValue = (value) => {
1633
+ if (value === void 0 || value === null) {
1634
+ return "";
1635
+ }
1636
+ if (value instanceof Date) {
1637
+ return formatDate(value);
1638
+ }
1639
+ return String(value);
1640
+ };
1641
+ const rows = data == null ? void 0 : data.map((item, index) => {
1642
+ if (!(printConfig == null ? void 0 : printConfig.fields)) return null;
1643
+ return /* @__PURE__ */ jsxs19(Table2.Tr, { children: [
1644
+ printConfig.showRowNumbers && /* @__PURE__ */ jsx31(Table2.Td, { ta: "center", px: "xs", style: { border: "1px solid lightgray" }, children: index + 1 }),
1645
+ printConfig.fields.map((field) => {
1646
+ let value = item[field.fieldName];
1647
+ if (field.formatFunction) {
1648
+ value = field.formatFunction(value, item);
1649
+ } else {
1650
+ value = formatValue(value);
1651
+ }
1652
+ const alignment = field.isCenter === false ? "left" : "center";
1653
+ if (typeof value === "string" && (value.includes("<") || value.includes("&lt;"))) {
1654
+ return /* @__PURE__ */ jsx31(
1655
+ Table2.Td,
1656
+ {
1657
+ px: "xs",
1658
+ ta: alignment,
1659
+ style: { border: "1px solid lightgray" },
1660
+ children: /* @__PURE__ */ jsx31(MyHtmlWrapper, { html: value })
1661
+ },
1662
+ field.fieldName
1663
+ );
1664
+ }
1665
+ if (value === "true") {
1666
+ return /* @__PURE__ */ jsx31(
1667
+ Table2.Td,
1668
+ {
1669
+ ta: alignment,
1670
+ px: "xs",
1671
+ style: { border: "1px solid lightgray" },
1672
+ children: /* @__PURE__ */ jsx31("input", { type: "checkbox", checked: true, readOnly: true })
1673
+ },
1674
+ field.fieldName
1675
+ );
1676
+ }
1677
+ return /* @__PURE__ */ jsx31(
1678
+ Table2.Td,
1679
+ {
1680
+ ta: alignment,
1681
+ px: "xs",
1682
+ style: { border: "1px solid lightgray" },
1683
+ children: value
1684
+ },
1685
+ field.fieldName
1686
+ );
1687
+ })
1688
+ ] }, index);
1689
+ });
1690
+ const renderContent = () => {
1691
+ if (!data || !(printConfig == null ? void 0 : printConfig.fields)) return null;
1692
+ const today = /* @__PURE__ */ new Date();
1693
+ const formattedDate = today.toLocaleDateString("vi-VN", {
1694
+ year: "numeric",
1695
+ month: "long",
1696
+ day: "numeric",
1697
+ hour: "2-digit",
1698
+ minute: "2-digit"
1699
+ });
1700
+ const tableTitle = (printConfig == null ? void 0 : printConfig.title) || "B\u1EA3ng d\u1EEF li\u1EC7u";
1701
+ return /* @__PURE__ */ jsxs19(Box, { p: "lg", children: [
1702
+ /* @__PURE__ */ jsxs19("div", { style: { textAlign: "center", marginTop: "10px", fontStyle: "italic", color: "#666" }, children: [
1703
+ "Ng\xE0y in: ",
1704
+ formattedDate
1705
+ ] }),
1706
+ /* @__PURE__ */ jsx31("h2", { style: { textAlign: "center", fontSize: "24px", fontWeight: "bold", marginBottom: "20px" }, children: tableTitle }),
1707
+ /* @__PURE__ */ jsxs19(Table2, { withColumnBorders: true, highlightOnHover: true, style: { border: "1px solid lightgray" }, children: [
1708
+ /* @__PURE__ */ jsx31(Table2.Thead, { children: /* @__PURE__ */ jsxs19(Table2.Tr, { children: [
1709
+ printConfig.showRowNumbers && /* @__PURE__ */ jsx31(Table2.Th, { style: { border: "1px solid lightgray" }, w: "10%", ta: "center", px: "xs", children: "STT" }),
1710
+ printConfig.fields.map((field) => {
1711
+ const alignment = field.isCenter === false ? "left" : "center";
1712
+ return /* @__PURE__ */ jsx31(
1713
+ Table2.Th,
1714
+ {
1715
+ style: { border: "1px solid lightgray" },
1716
+ ta: alignment,
1717
+ px: "xs",
1718
+ children: field.header
1719
+ },
1720
+ field.fieldName
1721
+ );
1722
+ })
1723
+ ] }) }),
1724
+ /* @__PURE__ */ jsx31(Table2.Tbody, { children: rows })
1725
+ ] })
1726
+ ] });
1727
+ };
1728
+ return /* @__PURE__ */ jsx31(
1729
+ MyButtonPrintPDF,
1730
+ {
1731
+ contentToPrint: renderContent()
1732
+ }
1733
+ );
1734
+ }
1621
1735
 
1622
1736
  // src/components/Buttons/ButtonRouterBack/MyButtonRouterBack.tsx
1623
1737
  import { Button as Button11 } from "@mantine/core";
@@ -6714,6 +6828,7 @@ export {
6714
6828
  AQSelectTableByOpenModal,
6715
6829
  MyButtonPrintPDF,
6716
6830
  MyHtmlWrapper,
6831
+ MyButtonPrintTablePDF,
6717
6832
  MyButtonRouterBack,
6718
6833
  baseAxios_default,
6719
6834
  MyButtonViewPDF,
@@ -134,13 +134,13 @@ interface IMyButtonCreate$1 extends Omit<ComponentProps<typeof MyButtonModal>, "
134
134
  }
135
135
  declare function AQButtonCreateByImportFile({ form, onSubmit, onSuccess, onError, setImportedData, ...rest }: IMyButtonCreate$1): react_jsx_runtime.JSX.Element;
136
136
 
137
- interface FieldConfig {
137
+ interface FieldConfig$1 {
138
138
  fieldName: string;
139
139
  header: string;
140
140
  formatFunction?: (value: any, row: any) => any;
141
141
  }
142
142
  interface ExportConfig {
143
- fields: FieldConfig[];
143
+ fields: FieldConfig$1[];
144
144
  }
145
145
  interface AQButtonExportDataProps {
146
146
  isAllData: boolean;
@@ -223,6 +223,24 @@ interface I$5 extends ButtonProps {
223
223
  }
224
224
  declare function MyButtonPrintPDF({ contentToPrint, ...rest }: I$5): react_jsx_runtime.JSX.Element;
225
225
 
226
+ interface FieldConfig {
227
+ fieldName: string;
228
+ header: string;
229
+ isCenter?: boolean;
230
+ formatFunction?: (value: any, row: any) => any;
231
+ }
232
+ interface PrintConfig {
233
+ fields: FieldConfig[];
234
+ title?: string;
235
+ showRowNumbers?: boolean;
236
+ }
237
+ interface AQButtonPrintTableProps<TData extends MRT_RowData = any> {
238
+ printConfig?: PrintConfig;
239
+ objectName?: string;
240
+ data?: TData[];
241
+ }
242
+ declare function MyButtonPrintTablePDF<TData extends MRT_RowData = any>({ printConfig, data, }: AQButtonPrintTableProps<TData>): react_jsx_runtime.JSX.Element;
243
+
226
244
  interface IMyButtonRouterBack extends ButtonProps {
227
245
  url?: string;
228
246
  label?: string;
@@ -442,4 +460,4 @@ interface IMySkeletonTable extends SkeletonProps {
442
460
  }
443
461
  declare function MySkeletonTable({ h }: IMySkeletonTable): react_jsx_runtime.JSX.Element;
444
462
 
445
- export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, BasicAppShell, BasicAppShell_transformMenuToEnum, Boxes, HeaderMegaMenu, type I0LinkItem, type IAQCardProps, type IMyTextEditor, MyActionIcon, MyActionIconCheck, MyActionIconDelete, MyActionIconDownloadPDF, MyActionIconModal, MyActionIconUpdate, MyActionIconUpload, MyActionIconViewPDF, MyAnchorViewPDF, MyAppSpotlight, MyBoxesBackground, MyBoxesCore, MyButton, MyButtonCreate, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, MyDataTableSelect, MyDateInput, MyFieldset, MyFileInput, MyFlexColumn, MyFlexEnd, MyFlexRow, MyHtmlWrapper, MyKeyLabel, MyNumberFormatter, MyNumberInput, MyPageContent, MySelect, MySelectAPIGet, MySkeletonTable, MySwitchTheme, MyTab, MyTextArea, MyTextEditor, MyTextInput, SelectFieldModal, SelectFileModal, type SelectFileModalProps, SpotlightTrigger, groupToTwoLevels, useHeaderMegaMenuStore, useS_ButtonImport, utils_layout_getItemsWithoutLinks };
463
+ export { AQButtonCreateByImportFile, AQButtonExportData, AQCard, AQSelectTableByOpenModal, AQStatCard1, BasicAppShell, BasicAppShell_transformMenuToEnum, Boxes, HeaderMegaMenu, type I0LinkItem, type IAQCardProps, type IMyTextEditor, MyActionIcon, MyActionIconCheck, MyActionIconDelete, MyActionIconDownloadPDF, MyActionIconModal, MyActionIconUpdate, MyActionIconUpload, MyActionIconViewPDF, MyAnchorViewPDF, MyAppSpotlight, MyBoxesBackground, MyBoxesCore, MyButton, MyButtonCreate, MyButtonImport, MyButtonModal, MyButtonPrintPDF, MyButtonPrintTablePDF, MyButtonRouterBack, MyButtonViewPDF, MyCalendar, MyCardioLoader, MyCenterFull, MyCheckbox, MyContainer, MyDataTable, MyDataTableSelect, MyDateInput, MyFieldset, MyFileInput, MyFlexColumn, MyFlexEnd, MyFlexRow, MyHtmlWrapper, MyKeyLabel, MyNumberFormatter, MyNumberInput, MyPageContent, MySelect, MySelectAPIGet, MySkeletonTable, MySwitchTheme, MyTab, MyTextArea, MyTextEditor, MyTextInput, SelectFieldModal, SelectFileModal, type SelectFileModalProps, SpotlightTrigger, groupToTwoLevels, useHeaderMegaMenuStore, useS_ButtonImport, utils_layout_getItemsWithoutLinks };
@@ -25,6 +25,7 @@ import {
25
25
  MyButtonImport,
26
26
  MyButtonModal,
27
27
  MyButtonPrintPDF,
28
+ MyButtonPrintTablePDF,
28
29
  MyButtonRouterBack,
29
30
  MyButtonViewPDF,
30
31
  MyCalendar,
@@ -60,7 +61,7 @@ import {
60
61
  useHeaderMegaMenuStore,
61
62
  useS_ButtonImport,
62
63
  utils_layout_getItemsWithoutLinks
63
- } from "../chunk-BSS3LQUY.mjs";
64
+ } from "../chunk-7LDYJOBM.mjs";
64
65
  import "../chunk-GL5OCTFE.mjs";
65
66
  import "../chunk-CDDX46TC.mjs";
66
67
  import "../chunk-FWCSY2DS.mjs";
@@ -91,6 +92,7 @@ export {
91
92
  MyButtonImport,
92
93
  MyButtonModal,
93
94
  MyButtonPrintPDF,
95
+ MyButtonPrintTablePDF,
94
96
  MyButtonRouterBack,
95
97
  MyButtonViewPDF,
96
98
  MyCalendar,
@@ -20,7 +20,7 @@ import {
20
20
  baseAxios_default,
21
21
  groupToTwoLevels,
22
22
  utils_layout_getItemsWithoutLinks
23
- } from "../../../chunk-BSS3LQUY.mjs";
23
+ } from "../../../chunk-7LDYJOBM.mjs";
24
24
  import {
25
25
  createGenericStore
26
26
  } from "../../../chunk-GL5OCTFE.mjs";
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "types": "./dist/modules-features//admin/core/index.d.mts"
19
19
  }
20
20
  },
21
- "version": "0.1.49",
21
+ "version": "0.1.50",
22
22
  "private": false,
23
23
  "files": [
24
24
  "dist"