aq-fe-framework 0.1.152 → 0.1.154
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.
- package/dist/{IAQModule-XZYlbivW.d.mts → IAQModule-Cn6xUy-6.d.mts} +1 -1
- package/dist/components/index.mjs +62 -143
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -11
- package/dist/modules-features/index.d.mts +1 -1
- package/dist/modules-features/index.mjs +79 -4053
- package/dist/stores/index.mjs +1 -7
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/index.mjs +9 -43
- package/package.json +1 -1
- package/dist/chunk-5U2JSHSJ.mjs +0 -22
- package/dist/chunk-7ZCOFATU.mjs +0 -42
- package/dist/chunk-FWCSY2DS.mjs +0 -37
- package/dist/chunk-P67AOBLX.mjs +0 -228
- package/dist/chunk-PAHZ57DT.mjs +0 -7634
- package/dist/chunk-Y3YGC5IH.mjs +0 -21
- package/dist/chunk-Z6OQG54Q.mjs +0 -39
- package/dist/components/index.css +0 -94
- package/dist/modules-features/index.css +0 -100
package/dist/stores/index.mjs
CHANGED
package/dist/utils/index.d.mts
CHANGED
@@ -19,6 +19,7 @@ declare function utils_currency_formatWithSuffix(amount: number, suffix?: string
|
|
19
19
|
declare function U0DateToDDMMYYYString(date: Date): string;
|
20
20
|
declare function utils_date_dateToDDMMYYYString(date: Date): string;
|
21
21
|
declare function utils_date_formatToDateTimeStartEnd(startDate: Date, endDate: Date): string;
|
22
|
+
declare function utils_date_getHHmm(date: Date): string;
|
22
23
|
|
23
24
|
interface I {
|
24
25
|
crudType?: "delete" | "update" | "create" | "error" | "importSucess";
|
@@ -35,4 +36,4 @@ declare const utils_time_getCurrentTimeString: () => string;
|
|
35
36
|
declare function U0MyValidateEmpty(message?: string): (value: unknown) => React.ReactNode;
|
36
37
|
declare function U0MyValidateEmail(value?: string): "Email không đúng định dạng" | null;
|
37
38
|
|
38
|
-
export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, utils_converter_enumToSelectOptions, utils_converter_getKeyByValue, utils_converter_getLabelByValue, utils_currency_formatWithSuffix, utils_date_dateToDDMMYYYString, utils_date_formatToDateTimeStartEnd, utils_notification_show, utils_pdf_download, utils_time_convertTimeStringToSeconds, utils_time_getCurrentTimeString };
|
39
|
+
export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, utils_converter_enumToSelectOptions, utils_converter_getKeyByValue, utils_converter_getLabelByValue, utils_currency_formatWithSuffix, utils_date_dateToDDMMYYYString, utils_date_formatToDateTimeStartEnd, utils_date_getHHmm, utils_notification_show, utils_pdf_download, utils_time_convertTimeStringToSeconds, utils_time_getCurrentTimeString };
|
package/dist/utils/index.mjs
CHANGED
@@ -1,43 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
utils_date_formatToDateTimeStartEnd,
|
11
|
-
utils_excel_download,
|
12
|
-
utils_excel_exportExcel,
|
13
|
-
utils_file_docxtemplaterDownload,
|
14
|
-
utils_file_fileToAQDocumentType,
|
15
|
-
utils_time_convertTimeStringToSeconds,
|
16
|
-
utils_time_getCurrentTimeString
|
17
|
-
} from "../chunk-P67AOBLX.mjs";
|
18
|
-
import {
|
19
|
-
utils_pdf_download
|
20
|
-
} from "../chunk-5U2JSHSJ.mjs";
|
21
|
-
import {
|
22
|
-
utils_notification_show
|
23
|
-
} from "../chunk-7ZCOFATU.mjs";
|
24
|
-
import "../chunk-FWCSY2DS.mjs";
|
25
|
-
export {
|
26
|
-
U0DateToDDMMYYYString,
|
27
|
-
U0MyValidateEmail,
|
28
|
-
U0MyValidateEmpty,
|
29
|
-
utils_converter_enumToSelectOptions,
|
30
|
-
utils_converter_getKeyByValue,
|
31
|
-
utils_converter_getLabelByValue,
|
32
|
-
utils_currency_formatWithSuffix,
|
33
|
-
utils_date_dateToDDMMYYYString,
|
34
|
-
utils_date_formatToDateTimeStartEnd,
|
35
|
-
utils_excel_download,
|
36
|
-
utils_excel_exportExcel,
|
37
|
-
utils_file_docxtemplaterDownload,
|
38
|
-
utils_file_fileToAQDocumentType,
|
39
|
-
utils_notification_show,
|
40
|
-
utils_pdf_download,
|
41
|
-
utils_time_convertTimeStringToSeconds,
|
42
|
-
utils_time_getCurrentTimeString
|
43
|
-
};
|
1
|
+
export * from "./utils_converter";
|
2
|
+
export * from "./utils_currency";
|
3
|
+
export * from "./utils_date";
|
4
|
+
export * from "./utils_excel";
|
5
|
+
export * from "./utils_file";
|
6
|
+
export * from "./utils_notification";
|
7
|
+
export * from "./utils_pdf";
|
8
|
+
export * from "./utils_time";
|
9
|
+
export * from "./utils_validateForm";
|
package/package.json
CHANGED
package/dist/chunk-5U2JSHSJ.mjs
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
// src/utils/utils_pdf.ts
|
2
|
-
import axios from "axios";
|
3
|
-
async function utils_pdf_download(url) {
|
4
|
-
try {
|
5
|
-
const response = await axios.get(url, {
|
6
|
-
responseType: "blob"
|
7
|
-
// Đảm bảo nhận dữ liệu dạng blob để tải file
|
8
|
-
});
|
9
|
-
const blob = new Blob([response.data], { type: "application/pdf" });
|
10
|
-
const link = document.createElement("a");
|
11
|
-
link.href = window.URL.createObjectURL(blob);
|
12
|
-
link.download = "file.pdf";
|
13
|
-
link.click();
|
14
|
-
window.URL.revokeObjectURL(link.href);
|
15
|
-
} catch (error) {
|
16
|
-
console.error("Error downloading PDF:", error);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
export {
|
21
|
-
utils_pdf_download
|
22
|
-
};
|
package/dist/chunk-7ZCOFATU.mjs
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
// src/utils/utils_notification.ts
|
2
|
-
import { notifications } from "@mantine/notifications";
|
3
|
-
function utils_notification_show({ crudType = "create", message, color }) {
|
4
|
-
if (crudType == "create") {
|
5
|
-
notifications.show({
|
6
|
-
message: message ? message : "Th\xEAm th\xE0nh c\xF4ng!",
|
7
|
-
color: color ? color : "green"
|
8
|
-
});
|
9
|
-
return;
|
10
|
-
}
|
11
|
-
if (crudType == "update") {
|
12
|
-
notifications.show({
|
13
|
-
message: message ? message : "C\u1EADp nh\u1EADt th\xE0nh c\xF4ng!",
|
14
|
-
color: color ? color : "green"
|
15
|
-
});
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
if (crudType == "delete") {
|
19
|
-
notifications.show({
|
20
|
-
message: message ? message : "X\xF3a th\xE0nh c\xF4ng!",
|
21
|
-
color: color ? color : "green"
|
22
|
-
});
|
23
|
-
return;
|
24
|
-
}
|
25
|
-
if (crudType == "error") {
|
26
|
-
notifications.show({
|
27
|
-
message: message ? message : "L\u1ED7i!",
|
28
|
-
color: color ? color : "red"
|
29
|
-
});
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
if (crudType == "importSucess") {
|
33
|
-
notifications.show({
|
34
|
-
message: message ? message : "Import th\xE0nh c\xF4ng!"
|
35
|
-
});
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
export {
|
41
|
-
utils_notification_show
|
42
|
-
};
|
package/dist/chunk-FWCSY2DS.mjs
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __defProps = Object.defineProperties;
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
-
var __spreadValues = (a, b) => {
|
9
|
-
for (var prop in b || (b = {}))
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
12
|
-
if (__getOwnPropSymbols)
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
-
if (__propIsEnum.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
}
|
17
|
-
return a;
|
18
|
-
};
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
-
var __objRest = (source, exclude) => {
|
21
|
-
var target = {};
|
22
|
-
for (var prop in source)
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
24
|
-
target[prop] = source[prop];
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
28
|
-
target[prop] = source[prop];
|
29
|
-
}
|
30
|
-
return target;
|
31
|
-
};
|
32
|
-
|
33
|
-
export {
|
34
|
-
__spreadValues,
|
35
|
-
__spreadProps,
|
36
|
-
__objRest
|
37
|
-
};
|
package/dist/chunk-P67AOBLX.mjs
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
// src/utils/utils_converter.ts
|
2
|
-
var utils_converter_getLabelByValue = (data, value) => {
|
3
|
-
const numericValue = Number(value);
|
4
|
-
return data[numericValue] || "Kh\xF4ng x\xE1c \u0111\u1ECBnh";
|
5
|
-
};
|
6
|
-
var utils_converter_getKeyByValue = (obj, value) => {
|
7
|
-
var _a;
|
8
|
-
return (_a = Object.entries(obj).find(([_, v]) => v === value)) == null ? void 0 : _a[0];
|
9
|
-
};
|
10
|
-
function utils_converter_enumToSelectOptions(enumObject) {
|
11
|
-
const result = [];
|
12
|
-
const numericEnumKeys = Object.keys(enumObject).filter((key) => isNaN(Number(key)));
|
13
|
-
for (const key of numericEnumKeys) {
|
14
|
-
const enumValue = enumObject[key];
|
15
|
-
if (typeof enumValue === "number") {
|
16
|
-
result.push({
|
17
|
-
value: String(enumValue),
|
18
|
-
label: key
|
19
|
-
});
|
20
|
-
}
|
21
|
-
}
|
22
|
-
return result;
|
23
|
-
}
|
24
|
-
|
25
|
-
// src/utils/utils_currency.ts
|
26
|
-
function utils_currency_formatWithSuffix(amount, suffix = "") {
|
27
|
-
const formatter = new Intl.NumberFormat("vi-VN");
|
28
|
-
const formattedAmount = formatter.format(amount);
|
29
|
-
return `${formattedAmount}${suffix}`;
|
30
|
-
}
|
31
|
-
|
32
|
-
// src/utils/utils_date.ts
|
33
|
-
function U0DateToDDMMYYYString(date) {
|
34
|
-
if (!(date instanceof Date) || isNaN(date.getTime())) return "";
|
35
|
-
const day = String(date.getDate()).padStart(2, "0");
|
36
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
37
|
-
const year = date.getFullYear();
|
38
|
-
return `${day}/${month}/${year}`;
|
39
|
-
}
|
40
|
-
function utils_date_dateToDDMMYYYString(date) {
|
41
|
-
const day = String(date.getDate()).padStart(2, "0");
|
42
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
43
|
-
const year = date.getFullYear();
|
44
|
-
return `${day}/${month}/${year}`;
|
45
|
-
}
|
46
|
-
function utils_date_formatToDateTimeStartEnd(startDate, endDate) {
|
47
|
-
const startday = String(startDate.getDate()).padStart(2, "0");
|
48
|
-
const startmonth = String(startDate.getMonth() + 1).padStart(2, "0");
|
49
|
-
const startyear = startDate.getFullYear();
|
50
|
-
const starthour = String(startDate.getHours()).padStart(2, "0");
|
51
|
-
const startminute = String(startDate.getMinutes()).padStart(2, "0");
|
52
|
-
const endhour = String(endDate.getHours()).padStart(2, "0");
|
53
|
-
const endminuate = String(endDate.getMinutes()).padStart(2, "0");
|
54
|
-
return `${startday}/${startmonth}/${startyear} [${starthour}:${startminute} - ${endhour}:${endminuate}]`;
|
55
|
-
}
|
56
|
-
|
57
|
-
// src/utils/utils_excel.ts
|
58
|
-
import saveAs from "file-saver";
|
59
|
-
function isObjectPath(path) {
|
60
|
-
return /^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)+$/.test(path);
|
61
|
-
}
|
62
|
-
function getValueByPath(obj, path) {
|
63
|
-
if (isObjectPath(path)) {
|
64
|
-
return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
65
|
-
}
|
66
|
-
return obj == null ? void 0 : obj[path];
|
67
|
-
}
|
68
|
-
async function utils_excel_exportExcel({
|
69
|
-
workbook,
|
70
|
-
sheetName,
|
71
|
-
data,
|
72
|
-
config
|
73
|
-
}) {
|
74
|
-
const sheet = workbook.addWorksheet(sheetName);
|
75
|
-
const fieldKeys = config.map((item) => String(item.fieldKey));
|
76
|
-
const headerMappings = {};
|
77
|
-
const markedColumns = [];
|
78
|
-
config.forEach((item) => {
|
79
|
-
const fieldKeyStr = String(item.fieldKey);
|
80
|
-
headerMappings[fieldKeyStr] = item.fieldName;
|
81
|
-
if (item.isRequired) markedColumns.push(fieldKeyStr);
|
82
|
-
});
|
83
|
-
sheet.columns = fieldKeys.map((fieldKey) => ({
|
84
|
-
key: fieldKey,
|
85
|
-
width: 20
|
86
|
-
}));
|
87
|
-
const displayRow = sheet.addRow(
|
88
|
-
fieldKeys.map(
|
89
|
-
(fieldKey) => markedColumns.includes(fieldKey) ? `${headerMappings[fieldKey]} *` : headerMappings[fieldKey] || fieldKey
|
90
|
-
)
|
91
|
-
);
|
92
|
-
const keyRow = sheet.addRow(fieldKeys);
|
93
|
-
data.forEach((item) => {
|
94
|
-
const rowData = {};
|
95
|
-
fieldKeys.forEach((fieldKey) => {
|
96
|
-
rowData[fieldKey] = getValueByPath(item, fieldKey);
|
97
|
-
});
|
98
|
-
sheet.addRow(rowData);
|
99
|
-
});
|
100
|
-
for (let i = 1; i <= fieldKeys.length; i++) {
|
101
|
-
const cell = displayRow.getCell(i);
|
102
|
-
cell.font = { bold: true };
|
103
|
-
cell.fill = {
|
104
|
-
type: "pattern",
|
105
|
-
pattern: "solid",
|
106
|
-
fgColor: { argb: "FFE0E0E0" }
|
107
|
-
};
|
108
|
-
}
|
109
|
-
for (let i = 1; i <= fieldKeys.length; i++) {
|
110
|
-
const cell = keyRow.getCell(i);
|
111
|
-
cell.font = { italic: true };
|
112
|
-
cell.fill = {
|
113
|
-
type: "pattern",
|
114
|
-
pattern: "solid",
|
115
|
-
fgColor: { argb: "FFF0F0F0" }
|
116
|
-
};
|
117
|
-
}
|
118
|
-
if (markedColumns.length > 0) {
|
119
|
-
for (let i = 1; i <= fieldKeys.length; i++) {
|
120
|
-
const cell = displayRow.getCell(i);
|
121
|
-
const text = cell.value;
|
122
|
-
if (typeof text === "string" && text.endsWith(" *")) {
|
123
|
-
cell.value = {
|
124
|
-
richText: [
|
125
|
-
{
|
126
|
-
text: text.slice(0, -2),
|
127
|
-
font: { bold: true }
|
128
|
-
},
|
129
|
-
{
|
130
|
-
text: " *",
|
131
|
-
font: { bold: true, color: { argb: "FFFF0000" } }
|
132
|
-
}
|
133
|
-
]
|
134
|
-
};
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
return workbook;
|
139
|
-
}
|
140
|
-
async function utils_excel_download({
|
141
|
-
workbook,
|
142
|
-
name
|
143
|
-
}) {
|
144
|
-
const buffer = await workbook.xlsx.writeBuffer();
|
145
|
-
const blob = new Blob([buffer], {
|
146
|
-
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
147
|
-
});
|
148
|
-
saveAs(blob, name);
|
149
|
-
}
|
150
|
-
|
151
|
-
// src/utils/utils_file.ts
|
152
|
-
import Docxtemplater from "docxtemplater";
|
153
|
-
import { saveAs as saveAs2 } from "file-saver";
|
154
|
-
import PizZip from "pizzip";
|
155
|
-
function utils_file_fileToAQDocumentType(file) {
|
156
|
-
return new Promise((resolve, reject) => {
|
157
|
-
const fileReader = new FileReader();
|
158
|
-
fileReader.onloadend = () => {
|
159
|
-
const fileName = file.name;
|
160
|
-
const fileExtension = file.name.split(".").pop();
|
161
|
-
const fileBase64String = fileReader.result;
|
162
|
-
resolve({
|
163
|
-
fileName,
|
164
|
-
fileExtension,
|
165
|
-
fileBase64String: fileBase64String.split(",")[1]
|
166
|
-
// Chỉ lấy phần base64 sau dấu phẩy
|
167
|
-
});
|
168
|
-
};
|
169
|
-
fileReader.onerror = reject;
|
170
|
-
fileReader.readAsDataURL(file);
|
171
|
-
});
|
172
|
-
}
|
173
|
-
async function utils_file_docxtemplaterDownload({
|
174
|
-
data,
|
175
|
-
filePath,
|
176
|
-
fileName
|
177
|
-
}) {
|
178
|
-
const response = await fetch(filePath);
|
179
|
-
const arrayBuffer = await response.arrayBuffer();
|
180
|
-
const zip = new PizZip(arrayBuffer);
|
181
|
-
const doc = new Docxtemplater(zip);
|
182
|
-
doc.render(data);
|
183
|
-
const buffer = doc.getZip().generate({ type: "blob" });
|
184
|
-
saveAs2(buffer, fileName || "output.docx");
|
185
|
-
}
|
186
|
-
|
187
|
-
// src/utils/utils_time.ts
|
188
|
-
var utils_time_convertTimeStringToSeconds = (time) => {
|
189
|
-
const [hours, minutes, seconds] = time.split(":").map(Number);
|
190
|
-
return hours * 3600 + minutes * 60 + seconds;
|
191
|
-
};
|
192
|
-
var utils_time_getCurrentTimeString = () => {
|
193
|
-
const formatTime = (number) => {
|
194
|
-
return number < 10 ? "0" + number : number;
|
195
|
-
};
|
196
|
-
const now = /* @__PURE__ */ new Date();
|
197
|
-
const hours = formatTime(now.getHours());
|
198
|
-
const minutes = formatTime(now.getMinutes());
|
199
|
-
const seconds = formatTime(now.getSeconds());
|
200
|
-
return `${hours}:${minutes}:${seconds}`;
|
201
|
-
};
|
202
|
-
|
203
|
-
// src/utils/utils_validateForm.ts
|
204
|
-
import { isNotEmpty } from "@mantine/form";
|
205
|
-
function U0MyValidateEmpty(message) {
|
206
|
-
return isNotEmpty(message ? message : "Kh\xF4ng \u0111\u01B0\u1EE3c \u0111\u1EC3 tr\u1ED1ng");
|
207
|
-
}
|
208
|
-
function U0MyValidateEmail(value) {
|
209
|
-
return /^\S+@\S+$/.test(value) ? null : "Email kh\xF4ng \u0111\xFAng \u0111\u1ECBnh d\u1EA1ng";
|
210
|
-
}
|
211
|
-
|
212
|
-
export {
|
213
|
-
U0DateToDDMMYYYString,
|
214
|
-
utils_date_dateToDDMMYYYString,
|
215
|
-
utils_date_formatToDateTimeStartEnd,
|
216
|
-
utils_file_fileToAQDocumentType,
|
217
|
-
utils_file_docxtemplaterDownload,
|
218
|
-
utils_converter_getLabelByValue,
|
219
|
-
utils_converter_getKeyByValue,
|
220
|
-
utils_converter_enumToSelectOptions,
|
221
|
-
utils_currency_formatWithSuffix,
|
222
|
-
utils_excel_exportExcel,
|
223
|
-
utils_excel_download,
|
224
|
-
utils_time_convertTimeStringToSeconds,
|
225
|
-
utils_time_getCurrentTimeString,
|
226
|
-
U0MyValidateEmpty,
|
227
|
-
U0MyValidateEmail
|
228
|
-
};
|