aq-fe-framework 0.1.23 → 0.1.26

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.
@@ -2,6 +2,22 @@ import ExcelJS from 'exceljs';
2
2
  import { DefaultMantineColor } from '@mantine/core';
3
3
  import * as react from 'react';
4
4
 
5
+ interface IUtils_Excel_ColumnConfig<T> {
6
+ fieldKey: keyof T;
7
+ fieldName: string;
8
+ isRequired?: boolean;
9
+ }
10
+ declare function utils_excel_exportExcel<T extends Record<string, any>>({ workbook, sheetName, data, config, }: {
11
+ workbook: ExcelJS.Workbook;
12
+ sheetName: string;
13
+ data: T[];
14
+ config: IUtils_Excel_ColumnConfig<T>[];
15
+ }): Promise<ExcelJS.Workbook>;
16
+ declare function utils_excel_download({ workbook, name }: {
17
+ workbook: ExcelJS.Workbook;
18
+ name: string;
19
+ }): Promise<void>;
20
+
5
21
  declare const utils_converter_enumToOptions: (enumObj: object) => {
6
22
  value: string;
7
23
  label: string;
@@ -21,22 +37,6 @@ declare function utils_converter_enumToSelectOptions<T extends Record<string, st
21
37
  declare function U0DateToDDMMYYYString(date: Date): string;
22
38
  declare function utils_date_dateToDDMMYYYString(date: Date): string;
23
39
 
24
- interface IUtils_Excel_ColumnConfig<T> {
25
- fieldKey: keyof T;
26
- fieldName: string;
27
- isRequired?: boolean;
28
- }
29
- declare function utils_excel_exportExcel<T extends Record<string, any>>({ workbook, sheetName, data, config, }: {
30
- workbook: ExcelJS.Workbook;
31
- sheetName: string;
32
- data: T[];
33
- config: IUtils_Excel_ColumnConfig<T>[];
34
- }): Promise<ExcelJS.Workbook>;
35
- declare function utils_excel_download({ workbook, name }: {
36
- workbook: ExcelJS.Workbook;
37
- name: string;
38
- }): Promise<void>;
39
-
40
40
  declare function utils_file_fileToAQDocumentType(file: File): Promise<any>;
41
41
  declare function utils_file_docxtemplaterDownload({ data, filePath, fileName }: {
42
42
  data: any;
@@ -1,3 +1,8 @@
1
+ import {
2
+ utils_notification_show,
3
+ utils_pdf_download
4
+ } from "../chunk-ZEQATKHS.mjs";
5
+
1
6
  // src/utils/converter.ts
2
7
  var utils_converter_enumToOptions = (enumObj) => {
3
8
  return Object.entries(enumObj).filter(([key]) => isNaN(Number(key))).map(([label, value]) => ({ value: String(value), label }));
@@ -167,64 +172,6 @@ async function utils_file_docxtemplaterDownload({
167
172
  saveAs2(buffer, fileName || "output.docx");
168
173
  }
169
174
 
170
- // src/utils/notification.ts
171
- import { notifications } from "@mantine/notifications";
172
- function utils_notification_show({ crudType = "create", message, color }) {
173
- if (crudType == "create") {
174
- notifications.show({
175
- message: message ? message : "Th\xEAm th\xE0nh c\xF4ng!",
176
- color: color ? color : "green"
177
- });
178
- return;
179
- }
180
- if (crudType == "update") {
181
- notifications.show({
182
- message: message ? message : "C\u1EADp nh\u1EADt th\xE0nh c\xF4ng!",
183
- color: color ? color : "green"
184
- });
185
- return;
186
- }
187
- if (crudType == "delete") {
188
- notifications.show({
189
- message: message ? message : "X\xF3a th\xE0nh c\xF4ng!",
190
- color: color ? color : "green"
191
- });
192
- return;
193
- }
194
- if (crudType == "error") {
195
- notifications.show({
196
- message: message ? message : "L\u1ED7i!",
197
- color: color ? color : "red"
198
- });
199
- return;
200
- }
201
- if (crudType == "importSucess") {
202
- notifications.show({
203
- message: message ? message : "Import th\xE0nh c\xF4ng!"
204
- });
205
- return;
206
- }
207
- }
208
-
209
- // src/utils/pdf.ts
210
- import axios from "axios";
211
- async function utils_pdf_download(url) {
212
- try {
213
- const response = await axios.get(url, {
214
- responseType: "blob"
215
- // Đảm bảo nhận dữ liệu dạng blob để tải file
216
- });
217
- const blob = new Blob([response.data], { type: "application/pdf" });
218
- const link = document.createElement("a");
219
- link.href = window.URL.createObjectURL(blob);
220
- link.download = "file.pdf";
221
- link.click();
222
- window.URL.revokeObjectURL(link.href);
223
- } catch (error) {
224
- console.error("Error downloading PDF:", error);
225
- }
226
- }
227
-
228
175
  // src/utils/time.ts
229
176
  var utils_time_convertTimeStringToSeconds = (time) => {
230
177
  const [hours, minutes, seconds] = time.split(":").map(Number);
package/package.json CHANGED
@@ -4,20 +4,23 @@
4
4
  "./utils": {
5
5
  "import": "./dist/utils/index.mjs",
6
6
  "types": "./dist/utils/index.d.mts"
7
+ },
8
+ "./components": {
9
+ "import": "./dist/components/index.mjs",
10
+ "types": "./dist/components/index.d.mts"
7
11
  }
8
12
  },
9
- "version": "0.1.23",
13
+ "version": "0.1.26",
10
14
  "private": false,
11
15
  "files": [
12
16
  "dist"
13
17
  ],
14
18
  "scripts": {
15
- "plus": "npm version patch",
19
+ "generate-barrels": "barrelsby --config barrelsby.json",
16
20
  "build": "tsup",
17
21
  "start": "next start",
18
22
  "lint": "next lint",
19
- "debug": "next dev -p 3003",
20
- "interfacegen": "npx ts-node generate-db-json.ts && npx ts-node generate-interfaces.ts"
23
+ "debug": "next dev -p 3003"
21
24
  },
22
25
  "dependencies": {
23
26
  "@fullcalendar/core": "^6.1.15",