aq-fe-framework 0.1.343 → 0.1.345

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.
@@ -278,7 +278,15 @@ function MyButtonCreateUpdate({
278
278
  mutation.mutate(values);
279
279
  }),
280
280
  children: [
281
- /* @__PURE__ */ jsx3(ScrollArea.Autosize, { offsetScrollbars: true, style: { flex: 1 }, mah: (modalProps == null ? void 0 : modalProps.fullScreen) ? "85vh" : "75vh", children: /* @__PURE__ */ jsx3(MyFlexColumn, { children }) }),
281
+ /* @__PURE__ */ jsx3(
282
+ ScrollArea.Autosize,
283
+ {
284
+ offsetScrollbars: true,
285
+ style: { flex: 1 },
286
+ mah: (modalProps == null ? void 0 : modalProps.fullScreen) ? "calc(100vh - 140px)" : "75vh",
287
+ children: /* @__PURE__ */ jsx3(MyFlexColumn, { children })
288
+ }
289
+ ),
282
290
  /* @__PURE__ */ jsx3(Space, {}),
283
291
  /* @__PURE__ */ jsx3(MyButton, { fullWidth: true, actionType: "create" })
284
292
  ]
@@ -48,14 +48,14 @@ function utils_currency_formatWithSuffix(amount, suffix = "") {
48
48
 
49
49
  // src/utils/utils_excel.ts
50
50
  import saveAs from "file-saver";
51
- function isObjectPath(path) {
52
- return /^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)+$/.test(path);
51
+ function isObjectPath(path2) {
52
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*(\.[a-zA-Z_$][a-zA-Z0-9_$]*)+$/.test(path2);
53
53
  }
54
- function getValueByPath(obj, path) {
55
- if (isObjectPath(path)) {
56
- return path.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
54
+ function getValueByPath(obj, path2) {
55
+ if (isObjectPath(path2)) {
56
+ return path2.split(".").reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
57
57
  }
58
- return obj == null ? void 0 : obj[path];
58
+ return obj == null ? void 0 : obj[path2];
59
59
  }
60
60
  async function utils_excel_exportExcel({
61
61
  workbook,
@@ -145,13 +145,13 @@ import Docxtemplater from "docxtemplater";
145
145
  import { saveAs as saveAs2 } from "file-saver";
146
146
  import PizZip from "pizzip";
147
147
  function utils_file_fileToAQDocumentType(file) {
148
- return new Promise((resolve, reject) => {
148
+ return new Promise((resolve2, reject) => {
149
149
  const fileReader = new FileReader();
150
150
  fileReader.onloadend = () => {
151
151
  const fileName = file.name;
152
152
  const fileExtension = file.name.split(".").pop();
153
153
  const fileBase64String = fileReader.result;
154
- resolve({
154
+ resolve2({
155
155
  fileName,
156
156
  fileExtension,
157
157
  fileBase64String: fileBase64String.split(",")[1]
@@ -173,12 +173,12 @@ async function utils_file_AQDocumentTypeToFile({
173
173
  const doc = new Docxtemplater(zip);
174
174
  doc.render(data);
175
175
  const blob = doc.getZip().generate({ type: "blob" });
176
- return new Promise((resolve, reject) => {
176
+ return new Promise((resolve2, reject) => {
177
177
  const reader = new FileReader();
178
178
  reader.onloadend = () => {
179
179
  var _a;
180
180
  const base64String = (_a = reader.result) == null ? void 0 : _a.split(",")[1];
181
- resolve({
181
+ resolve2({
182
182
  fileName,
183
183
  fileExtension: "docx",
184
184
  fileBase64String: base64String
@@ -202,6 +202,39 @@ async function utils_file_docxtemplaterDownload({
202
202
  saveAs2(buffer, fileName || "output.docx");
203
203
  }
204
204
 
205
+ // src/utils/utils_framework.ts
206
+ import * as fs from "fs";
207
+ import * as path from "path";
208
+ function utils_framework_checkPackageVersionMismatch(packageName = "aq-fe-framework") {
209
+ var _a, _b;
210
+ const rootPkgPath = path.resolve("package.json");
211
+ if (!fs.existsSync(rootPkgPath)) {
212
+ throw new Error("Kh\xF4ng t\xECm th\u1EA5y file package.json \u1EDF th\u01B0 m\u1EE5c g\u1ED1c.");
213
+ }
214
+ const rootPkg = JSON.parse(fs.readFileSync(rootPkgPath, "utf-8"));
215
+ const expectedVersion = ((_a = rootPkg.dependencies) == null ? void 0 : _a[packageName]) || ((_b = rootPkg.devDependencies) == null ? void 0 : _b[packageName]);
216
+ if (!expectedVersion) {
217
+ console.warn(`[WARN] Kh\xF4ng t\xECm th\u1EA5y package ${packageName} trong dependencies/devDependencies.`);
218
+ return;
219
+ }
220
+ const actualPkgPath = path.resolve("node_modules", packageName, "package.json");
221
+ if (!fs.existsSync(actualPkgPath)) {
222
+ console.error(`[ERROR] Package "${packageName}" ch\u01B0a \u0111\u01B0\u1EE3c c\xE0i. Vui l\xF2ng ch\u1EA1y: npm install`);
223
+ process.exit(1);
224
+ }
225
+ const actualPkg = JSON.parse(fs.readFileSync(actualPkgPath, "utf-8"));
226
+ const actualVersion = actualPkg.version;
227
+ const expectedVersionNum = expectedVersion.replace(/^[^\d]*/, "");
228
+ if (!actualVersion.startsWith(expectedVersionNum)) {
229
+ console.error(`[ERROR] Phi\xEAn b\u1EA3n kh\xF4ng kh\u1EDBp cho "${packageName}"`);
230
+ console.error(` - \u0110ang d\xF9ng (node_modules): ${actualVersion}`);
231
+ console.error(` - Mong \u0111\u1EE3i (package.json): ${expectedVersion}`);
232
+ console.error(`=> Vui l\xF2ng ch\u1EA1y l\u1EA1i: npm install`);
233
+ process.exit(1);
234
+ }
235
+ console.log(`[OK] Phi\xEAn b\u1EA3n "${packageName}" h\u1EE3p l\u1EC7: ${actualVersion}`);
236
+ }
237
+
205
238
  // src/utils/utils_input_updateEnableList.ts
206
239
  function updateEnableList(oldList, selectedIds, getId, createNew) {
207
240
  const result = [];
@@ -293,6 +326,7 @@ export {
293
326
  utils_currency_formatWithSuffix,
294
327
  utils_excel_exportExcel,
295
328
  utils_excel_download,
329
+ utils_framework_checkPackageVersionMismatch,
296
330
  utils_reactQuery_updateListItemInQuery,
297
331
  utils_time_convertTimeStringToSeconds,
298
332
  utils_time_getCurrentTimeString,
@@ -12,7 +12,7 @@ import {
12
12
  MyStatsCard,
13
13
  MyTextInput,
14
14
  MyWeeklySessionSchedulerPicker
15
- } from "../chunk-2SFFOWXA.mjs";
15
+ } from "../chunk-A7SOCM54.mjs";
16
16
  import "../chunk-GEYCGM75.mjs";
17
17
  import "../chunk-NWBLJ3W3.mjs";
18
18
  import "../chunk-K6S7R6LU.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  utils_config_getBaseUrl,
5
5
  utils_converter_enumToSelectOptions,
6
6
  utils_file_fileToAQDocumentType
7
- } from "../chunk-FBGCXKGK.mjs";
7
+ } from "../chunk-MKOPTV6N.mjs";
8
8
  import {
9
9
  baseColumns
10
10
  } from "../chunk-2SBUKAGS.mjs";
@@ -45,7 +45,7 @@ import {
45
45
  MyButton as MyButton2,
46
46
  MyDataTableSelectOne,
47
47
  MyTextInput as MyTextInput2
48
- } from "../chunk-2SFFOWXA.mjs";
48
+ } from "../chunk-A7SOCM54.mjs";
49
49
  import {
50
50
  MyDataTable,
51
51
  MyFlexColumn,
@@ -22,6 +22,8 @@ declare function utils_date_dateToDDMMYYYString(date: Date): string;
22
22
  declare function utils_date_formatToDateTimeStartEnd(startDate: Date, endDate: Date): string;
23
23
  declare function utils_date_getHHmm(date: Date): string;
24
24
 
25
+ declare function utils_framework_checkPackageVersionMismatch(packageName?: string): void;
26
+
25
27
  /**
26
28
  * Cập nhật danh sách dạng many-to-many có cờ enable.
27
29
  * @param oldList - danh sách gốc đang lưu trong state
@@ -57,4 +59,4 @@ declare function U0MyValidateEmpty(message?: string): (value: unknown) => React.
57
59
  declare function U0MyValidateEmail(value?: string): "Email không đúng định dạng" | null;
58
60
  declare const utils_validator_validateCode: (value?: string) => "Không được để trống" | "Chỉ được nhập chữ, số và dấu '-' (không bắt đầu bằng '-')" | null;
59
61
 
60
- export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, updateEnableList, 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_reactQuery_updateListItemInQuery, utils_time_convertTimeStringToSeconds, utils_time_extractHourMinute, utils_time_getCurrentTimeString, utils_validator_validateCode };
62
+ export { U0DateToDDMMYYYString, U0MyValidateEmail, U0MyValidateEmpty, updateEnableList, utils_converter_enumToSelectOptions, utils_converter_getKeyByValue, utils_converter_getLabelByValue, utils_currency_formatWithSuffix, utils_date_dateToDDMMYYYString, utils_date_formatToDateTimeStartEnd, utils_date_getHHmm, utils_framework_checkPackageVersionMismatch, utils_notification_show, utils_pdf_download, utils_reactQuery_updateListItemInQuery, utils_time_convertTimeStringToSeconds, utils_time_extractHourMinute, utils_time_getCurrentTimeString, utils_validator_validateCode };
@@ -11,12 +11,13 @@ import {
11
11
  utils_file_AQDocumentTypeToFile,
12
12
  utils_file_docxtemplaterDownload,
13
13
  utils_file_fileToAQDocumentType,
14
+ utils_framework_checkPackageVersionMismatch,
14
15
  utils_reactQuery_updateListItemInQuery,
15
16
  utils_time_convertTimeStringToSeconds,
16
17
  utils_time_extractHourMinute,
17
18
  utils_time_getCurrentTimeString,
18
19
  utils_validator_validateCode
19
- } from "../chunk-FBGCXKGK.mjs";
20
+ } from "../chunk-MKOPTV6N.mjs";
20
21
  import {
21
22
  U0DateToDDMMYYYString,
22
23
  utils_date_dateToDDMMYYYString,
@@ -47,6 +48,7 @@ export {
47
48
  utils_file_AQDocumentTypeToFile,
48
49
  utils_file_docxtemplaterDownload,
49
50
  utils_file_fileToAQDocumentType,
51
+ utils_framework_checkPackageVersionMismatch,
50
52
  utils_notification_show,
51
53
  utils_pdf_download,
52
54
  utils_reactQuery_updateListItemInQuery,
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "types": "./dist/columns/index.d.mts"
43
43
  }
44
44
  },
45
- "version": "0.1.343",
45
+ "version": "0.1.345",
46
46
  "private": false,
47
47
  "files": [
48
48
  "dist"