aq-fe-framework 0.1.80 → 0.1.82

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.
@@ -9,7 +9,7 @@ import {
9
9
  utils_file_fileToAQDocumentType,
10
10
  utils_notification_show,
11
11
  utils_pdf_download
12
- } from "./chunk-42OQXQR5.mjs";
12
+ } from "./chunk-WNGACHRD.mjs";
13
13
  import {
14
14
  __objRest,
15
15
  __spreadProps,
@@ -53,13 +53,28 @@ baseAxios.interceptors.request.use(
53
53
  var baseAxios_default = baseAxios;
54
54
 
55
55
  // src/components/Buttons/ButtonViewPDF/MyButtonViewPDF.tsx
56
- import { ActionIcon, Button, Group, LoadingOverlay, Modal, Paper, Text, Tooltip } from "@mantine/core";
56
+ import {
57
+ ActionIcon,
58
+ Button,
59
+ Group,
60
+ LoadingOverlay,
61
+ Modal,
62
+ Paper,
63
+ Text,
64
+ Tooltip
65
+ } from "@mantine/core";
57
66
  import { useDisclosure } from "@mantine/hooks";
58
67
  import { IconLivePhoto, IconMaximize, IconMinimize } from "@tabler/icons-react";
59
68
  import { useQuery } from "@tanstack/react-query";
60
69
  import { useState } from "react";
61
70
  import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
62
- function MyButtonViewPDF({ id, modalSize = "80%", label = "Xem file", src = "https://datafiles.chinhphu.vn/cpp/files/vbpq/2016/07/85.signed.pdf" }) {
71
+ function MyButtonViewPDF({
72
+ id,
73
+ modalSize = "80%",
74
+ label = "Xem file",
75
+ src = "https://datafiles.chinhphu.vn/cpp/files/vbpq/2016/07/85.signed.pdf",
76
+ isActionIcon = false
77
+ }) {
63
78
  var _a, _b;
64
79
  const disc = useDisclosure(false);
65
80
  const fullScreen = useState(false);
@@ -72,9 +87,25 @@ function MyButtonViewPDF({ id, modalSize = "80%", label = "Xem file", src = "htt
72
87
  enabled: id != void 0 && disc[0] == true
73
88
  });
74
89
  return /* @__PURE__ */ jsxs(Fragment, { children: [
75
- /* @__PURE__ */ jsx2(Tooltip, { label: "Xem t\xE0i li\u1EC7u tr\u1EF1c ti\u1EBFp", children: /* @__PURE__ */ jsx2(Button, { color: "cyan", onClick: () => {
76
- disc[1].open();
77
- }, leftSection: /* @__PURE__ */ jsx2(IconLivePhoto, {}), children: label }) }),
90
+ /* @__PURE__ */ jsx2(Tooltip, { label: "Xem t\xE0i li\u1EC7u tr\u1EF1c ti\u1EBFp", children: isActionIcon ? /* @__PURE__ */ jsx2(
91
+ ActionIcon,
92
+ {
93
+ onClick: () => {
94
+ disc[1].open();
95
+ },
96
+ children: /* @__PURE__ */ jsx2(IconLivePhoto, {})
97
+ }
98
+ ) : /* @__PURE__ */ jsx2(
99
+ Button,
100
+ {
101
+ color: "cyan",
102
+ onClick: () => {
103
+ disc[1].open();
104
+ },
105
+ leftSection: /* @__PURE__ */ jsx2(IconLivePhoto, {}),
106
+ children: label
107
+ }
108
+ ) }),
78
109
  /* @__PURE__ */ jsx2(
79
110
  Modal,
80
111
  {
@@ -105,22 +136,22 @@ function MyButtonViewPDF({ id, modalSize = "80%", label = "Xem file", src = "htt
105
136
  )
106
137
  ] }),
107
138
  children: /* @__PURE__ */ jsxs(Paper, { h: hSize[0], p: "lg", pos: "relative", children: [
108
- /* @__PURE__ */ jsx2(LoadingOverlay, { visible: query.isLoading, zIndex: 1e3, overlayProps: { radius: "sm", blur: 2 } }),
109
- query.data ? /* @__PURE__ */ jsx2(
110
- "iframe",
139
+ /* @__PURE__ */ jsx2(
140
+ LoadingOverlay,
111
141
  {
112
- src: `data:application/pdf;base64, ${(_b = (_a = query.data) == null ? void 0 : _a.fileDetail) == null ? void 0 : _b.fileBase64String}`,
113
- width: "100%",
114
- height: "100%"
142
+ visible: query.isLoading,
143
+ zIndex: 1e3,
144
+ overlayProps: { radius: "sm", blur: 2 }
115
145
  }
116
- ) : /* @__PURE__ */ jsx2(
146
+ ),
147
+ query.data ? /* @__PURE__ */ jsx2(
117
148
  "iframe",
118
149
  {
119
- src,
150
+ src: `data:application/pdf;base64, ${(_b = (_a = query.data) == null ? void 0 : _a.fileDetail) == null ? void 0 : _b.fileBase64String}`,
120
151
  width: "100%",
121
152
  height: "100%"
122
153
  }
123
- )
154
+ ) : /* @__PURE__ */ jsx2("iframe", { src, width: "100%", height: "100%" })
124
155
  ] })
125
156
  }
126
157
  )
@@ -807,7 +838,13 @@ import { IconLivePhoto as IconLivePhoto2, IconMaximize as IconMaximize2, IconMin
807
838
  import { useState as useState4 } from "react";
808
839
  import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
809
840
  function MyActionIconViewPDF(_a) {
810
- var _b = _a, { modalSize = "80%", pdfLink = "https://datafiles.chinhphu.vn/cpp/files/vbpq/2021/07/17-bgd.signed.pdf" } = _b, rest = __objRest(_b, ["modalSize", "pdfLink"]);
841
+ var _b = _a, {
842
+ modalSize = "80%",
843
+ pdfLink = "https://datafiles.chinhphu.vn/cpp/files/vbpq/2021/07/17-bgd.signed.pdf"
844
+ } = _b, rest = __objRest(_b, [
845
+ "modalSize",
846
+ "pdfLink"
847
+ ]);
811
848
  const disc = useDisclosure5(false);
812
849
  const fullScreen = useState4(false);
813
850
  const hSize = useState4("80vh");
@@ -49,6 +49,9 @@ function utils_date_formatToDateTimeStartEnd(startDate, endDate) {
49
49
 
50
50
  // src/utils/excel.ts
51
51
  import saveAs from "file-saver";
52
+ function getValueByPath(obj, path) {
53
+ return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
54
+ }
52
55
  async function utils_excel_exportExcel({
53
56
  workbook,
54
57
  sheetName,
@@ -56,72 +59,63 @@ async function utils_excel_exportExcel({
56
59
  config
57
60
  }) {
58
61
  const sheet = workbook.addWorksheet(sheetName);
59
- const fieldNames = config.map((item) => String(item.fieldKey));
62
+ const fieldKeys = config.map((item) => String(item.fieldKey));
60
63
  const headerMappings = {};
61
64
  const markedColumns = [];
62
65
  config.forEach((item) => {
63
66
  const fieldKeyStr = String(item.fieldKey);
64
67
  headerMappings[fieldKeyStr] = item.fieldName;
65
- if (item.isRequired) {
66
- markedColumns.push(fieldKeyStr);
67
- }
68
+ if (item.isRequired) markedColumns.push(fieldKeyStr);
68
69
  });
69
- const columns = fieldNames.map((fieldName) => {
70
- return {
71
- key: fieldName,
72
- width: 20
73
- };
74
- });
75
- sheet.columns = columns;
70
+ sheet.columns = fieldKeys.map((fieldKey) => ({
71
+ key: fieldKey,
72
+ width: 20
73
+ }));
76
74
  const displayRow = sheet.addRow(
77
- fieldNames.map((fieldName) => {
78
- const displayName = headerMappings[fieldName] || fieldName;
79
- return markedColumns.includes(fieldName) ? `${displayName} *` : displayName;
80
- })
75
+ fieldKeys.map(
76
+ (fieldKey) => markedColumns.includes(fieldKey) ? `${headerMappings[fieldKey]} *` : headerMappings[fieldKey] || fieldKey
77
+ )
81
78
  );
82
- const keyRow = sheet.addRow(fieldNames);
79
+ const keyRow = sheet.addRow(fieldKeys);
83
80
  data.forEach((item) => {
84
81
  const rowData = {};
85
- fieldNames.forEach((field) => {
86
- rowData[field] = item[field];
82
+ fieldKeys.forEach((fieldKey) => {
83
+ rowData[fieldKey] = getValueByPath(item, fieldKey);
87
84
  });
88
85
  sheet.addRow(rowData);
89
86
  });
90
- for (let i = 1; i <= fieldNames.length; i++) {
87
+ for (let i = 1; i <= fieldKeys.length; i++) {
91
88
  const cell = displayRow.getCell(i);
92
89
  cell.font = { bold: true };
93
90
  cell.fill = {
94
91
  type: "pattern",
95
92
  pattern: "solid",
96
93
  fgColor: { argb: "FFE0E0E0" }
97
- // Light gray background
98
94
  };
99
95
  }
100
- for (let i = 1; i <= fieldNames.length; i++) {
96
+ for (let i = 1; i <= fieldKeys.length; i++) {
101
97
  const cell = keyRow.getCell(i);
102
98
  cell.font = { italic: true };
103
99
  cell.fill = {
104
100
  type: "pattern",
105
101
  pattern: "solid",
106
102
  fgColor: { argb: "FFF0F0F0" }
107
- // Lighter gray background
108
103
  };
109
104
  }
110
105
  if (markedColumns.length > 0) {
111
- for (let i = 1; i <= fieldNames.length; i++) {
106
+ for (let i = 1; i <= fieldKeys.length; i++) {
112
107
  const cell = displayRow.getCell(i);
113
108
  const text = cell.value;
114
109
  if (typeof text === "string" && text.endsWith(" *")) {
115
110
  cell.value = {
116
111
  richText: [
117
112
  {
118
- text: text.substring(0, text.length - 2),
113
+ text: text.slice(0, -2),
119
114
  font: { bold: true }
120
115
  },
121
116
  {
122
117
  text: " *",
123
118
  font: { bold: true, color: { argb: "FFFF0000" } }
124
- // Red color
125
119
  }
126
120
  ]
127
121
  };
@@ -135,7 +129,9 @@ async function utils_excel_download({
135
129
  name
136
130
  }) {
137
131
  const buffer = await workbook.xlsx.writeBuffer();
138
- const blob = new Blob([buffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
132
+ const blob = new Blob([buffer], {
133
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
134
+ });
139
135
  saveAs(blob, name);
140
136
  }
141
137
 
@@ -3,7 +3,7 @@ import react__default, { ReactNode, ComponentProps } from 'react';
3
3
  import { MantineSize, ActionIconProps, ButtonProps, useModalsStack, CheckboxProps, SelectProps, NumberFormatterProps, FieldsetProps, FileInputProps, NumberInputProps, TextareaProps, TextInputProps, ContainerProps, FlexProps, GroupProps, TypographyStylesProviderProps, TabsProps, SkeletonProps } from '@mantine/core';
4
4
  import { useDisclosure, useListState } from '@mantine/hooks';
5
5
  import { UseFormReturnType, useForm } from '@mantine/form';
6
- import { I as IUtils_Excel_ColumnConfig } from '../excel---d-HDs7.mjs';
6
+ import { I as IUtils_Excel_ColumnConfig } from '../excel-CP9z_HOI.mjs';
7
7
  import { MRT_ColumnDef, MRT_RowData, MRT_TableOptions, MRT_TableInstance } from 'mantine-react-table';
8
8
  import { ConfigOptions } from 'export-to-csv';
9
9
  import { DateInputProps } from '@mantine/dates';
@@ -253,8 +253,9 @@ interface IMyButtonViewPDF {
253
253
  label?: string;
254
254
  id?: number;
255
255
  src?: string;
256
+ isActionIcon?: boolean;
256
257
  }
257
- declare function MyButtonViewPDF({ id, modalSize, label, src }: IMyButtonViewPDF): react_jsx_runtime.JSX.Element;
258
+ declare function MyButtonViewPDF({ id, modalSize, label, src, isActionIcon, }: IMyButtonViewPDF): react_jsx_runtime.JSX.Element;
258
259
 
259
260
  declare function MyCalendar(): react_jsx_runtime.JSX.Element;
260
261
 
@@ -62,9 +62,9 @@ import {
62
62
  useHeaderMegaMenuStore,
63
63
  useS_ButtonImport,
64
64
  utils_layout_getItemsWithoutLinks
65
- } from "../chunk-DKHALPJQ.mjs";
65
+ } from "../chunk-QJYFL44D.mjs";
66
66
  import "../chunk-AL73DX37.mjs";
67
- import "../chunk-42OQXQR5.mjs";
67
+ import "../chunk-WNGACHRD.mjs";
68
68
  import "../chunk-FWCSY2DS.mjs";
69
69
  export {
70
70
  AQButtonCreateByImportFile,
@@ -1,7 +1,7 @@
1
1
  import ExcelJS from 'exceljs';
2
2
 
3
3
  interface IUtils_Excel_ColumnConfig<T> {
4
- fieldKey: keyof T;
4
+ fieldKey: keyof T | string;
5
5
  fieldName: string;
6
6
  isRequired?: boolean;
7
7
  }
@@ -57,9 +57,9 @@ import {
57
57
  useS_authenticate,
58
58
  useS_core83092,
59
59
  utils_core83092_mergePage
60
- } from "../chunk-DKHALPJQ.mjs";
60
+ } from "../chunk-QJYFL44D.mjs";
61
61
  import "../chunk-AL73DX37.mjs";
62
- import "../chunk-42OQXQR5.mjs";
62
+ import "../chunk-WNGACHRD.mjs";
63
63
  import "../chunk-FWCSY2DS.mjs";
64
64
  export {
65
65
  F_authenticate_Login,
@@ -1,4 +1,4 @@
1
- export { I as IUtils_Excel_ColumnConfig, a as utils_excel_download, u as utils_excel_exportExcel } from '../excel---d-HDs7.mjs';
1
+ export { I as IUtils_Excel_ColumnConfig, a as utils_excel_download, u as utils_excel_exportExcel } from '../excel-CP9z_HOI.mjs';
2
2
  import { DefaultMantineColor } from '@mantine/core';
3
3
  import * as react from 'react';
4
4
  import 'exceljs';
@@ -15,7 +15,7 @@ import {
15
15
  utils_pdf_download,
16
16
  utils_time_convertTimeStringToSeconds,
17
17
  utils_time_getCurrentTimeString
18
- } from "../chunk-42OQXQR5.mjs";
18
+ } from "../chunk-WNGACHRD.mjs";
19
19
  import "../chunk-FWCSY2DS.mjs";
20
20
  export {
21
21
  U0DateToDDMMYYYString,
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "types": "./dist/modules-features/index.d.mts"
19
19
  }
20
20
  },
21
- "version": "0.1.80",
21
+ "version": "0.1.82",
22
22
  "private": false,
23
23
  "files": [
24
24
  "dist"