@fctc/widget-logic 5.3.0 → 5.3.1

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/hooks.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  return to;
17
19
  };
18
20
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/hooks.ts
@@ -29,7 +39,6 @@ __export(hooks_exports, {
29
39
  useChangeOrderPreparationState: () => import_hooks2.useChangeOrderPreparationState,
30
40
  useChangeStatus: () => import_hooks2.useChangeStatus,
31
41
  useCheckPayment: () => import_hooks2.useCheckPayment,
32
- useClickOutside: () => useClickOutside,
33
42
  useCompany: () => useCompany,
34
43
  useConfig: () => useConfig,
35
44
  useCreateEntity: () => import_hooks2.useCreateEntity,
@@ -66,7 +75,6 @@ __export(hooks_exports, {
66
75
  useGetFileExcel: () => import_hooks2.useGetFileExcel,
67
76
  useGetFormView: () => import_hooks2.useGetFormView,
68
77
  useGetGroups: () => import_hooks2.useGetGroups,
69
- useGetImage: () => import_hooks2.useGetImage,
70
78
  useGetList: () => import_hooks2.useGetList,
71
79
  useGetListCompany: () => import_hooks2.useGetListCompany,
72
80
  useGetListData: () => import_hooks2.useGetListData,
@@ -192,14 +200,14 @@ var useCallAction = () => {
192
200
  var utils_exports = {};
193
201
  __export(utils_exports, {
194
202
  STORAGES: () => STORAGES,
195
- combineContexts: () => combineContexts,
196
- convertFieldsToArray: () => convertFieldsToArray,
197
203
  countSum: () => countSum,
198
- getDateRange: () => getDateRange,
204
+ guessTypeFromUrl: () => guessTypeFromUrl,
205
+ isObjectEmpty: () => isObjectEmpty,
199
206
  languages: () => languages,
200
207
  mergeButtons: () => mergeButtons,
201
208
  setStorageItemAsync: () => setStorageItemAsync,
202
- useStorageState: () => useStorageState
209
+ useStorageState: () => useStorageState,
210
+ validateAndParseDate: () => validateAndParseDate
203
211
  });
204
212
 
205
213
  // src/utils/constants.ts
@@ -217,6 +225,9 @@ var countSum = (data, field) => {
217
225
  0
218
226
  );
219
227
  };
228
+ var isObjectEmpty = (obj) => {
229
+ return Object.keys(obj).length === 0;
230
+ };
220
231
  function mergeButtons(fields) {
221
232
  const buttons = fields?.filter((f) => f.type_co === "button");
222
233
  const others = fields?.filter((f) => f.type_co !== "button");
@@ -228,103 +239,6 @@ function mergeButtons(fields) {
228
239
  }
229
240
  return others;
230
241
  }
231
- var getDateRange = (currentDate, unit) => {
232
- const date = new Date(currentDate);
233
- let dateStart, dateEnd;
234
- function formatDate(d) {
235
- return d.getFullYear() + "-" + String(d.getMonth() + 1).padStart(2, "0") + "-" + String(d.getDate()).padStart(2, "0") + " " + String(d.getHours()).padStart(2, "0") + ":" + String(d.getMinutes()).padStart(2, "0") + ":" + String(d.getSeconds()).padStart(2, "0");
236
- }
237
- switch (unit) {
238
- case "month":
239
- dateStart = new Date(
240
- date.getFullYear(),
241
- date.getMonth() + 1,
242
- date.getDate(),
243
- 23,
244
- 59,
245
- 59
246
- );
247
- dateStart.setHours(dateStart.getHours() - 7);
248
- dateEnd = new Date(date.getFullYear(), date.getMonth(), 0, 0, 0, 0);
249
- dateEnd.setHours(dateEnd.getHours() - 7);
250
- break;
251
- case "day":
252
- dateStart = new Date(
253
- date.getFullYear(),
254
- date.getMonth(),
255
- date.getDate(),
256
- 23,
257
- 59,
258
- 59
259
- );
260
- dateStart.setHours(dateStart.getHours() - 7);
261
- dateEnd = new Date(
262
- date.getFullYear(),
263
- date.getMonth(),
264
- date.getDate(),
265
- 0,
266
- 0,
267
- 0
268
- );
269
- dateEnd.setHours(dateEnd.getHours() - 7);
270
- break;
271
- case "week":
272
- const dayOfWeek = date.getDay();
273
- const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
274
- const daysToSunday = dayOfWeek === 0 ? 0 : 7 - dayOfWeek;
275
- dateStart = new Date(
276
- date.getFullYear(),
277
- date.getMonth(),
278
- date.getDate() + daysToSunday,
279
- 23,
280
- 59,
281
- 59
282
- );
283
- dateStart.setHours(dateStart.getHours() - 7);
284
- dateEnd = new Date(
285
- date.getFullYear(),
286
- date.getMonth(),
287
- date.getDate() + daysToMonday,
288
- 0,
289
- 0,
290
- 0
291
- );
292
- dateEnd.setHours(dateEnd.getHours() - 7);
293
- break;
294
- case "year":
295
- dateStart = new Date(date.getFullYear(), 11, 31, 23, 59, 59);
296
- dateStart.setHours(dateStart.getHours() - 7);
297
- dateEnd = new Date(date.getFullYear() - 1, 11, 31, 0, 0, 0);
298
- dateEnd.setHours(dateEnd.getHours() - 7);
299
- break;
300
- default:
301
- throw new Error(
302
- "\u0110\u01A1n v\u1ECB kh\xF4ng h\u1EE3p l\u1EC7. Ch\u1EC9 ch\u1EA5p nh\u1EADn: week, day, month, year"
303
- );
304
- }
305
- return [
306
- ["date_start", "<=", formatDate(dateStart)],
307
- ["date_end", ">=", formatDate(dateEnd)]
308
- ];
309
- };
310
- var convertFieldsToArray = (fields) => {
311
- const defaultFields = ["display_name", "date_start", "date_end"];
312
- if (!fields || !Array.isArray(fields)) {
313
- return defaultFields;
314
- }
315
- const inputFields = fields.filter((field) => field && field.type_co === "field").map((field) => field.name);
316
- return [...defaultFields, ...inputFields];
317
- };
318
- function combineContexts(contexts) {
319
- if (contexts.some((context) => !context)) {
320
- return void 0;
321
- } else {
322
- const res = contexts.reduce((acc, context) => {
323
- return { ...acc, ...context };
324
- }, {});
325
- return res;
326
- }
327
- }
328
242
  var STORAGES = {
329
243
  TOKEN: "accessToken",
330
244
  USER_INFO: "USER_INFO"
@@ -365,6 +279,312 @@ function useStorageState(key) {
365
279
  );
366
280
  return [state, setValue];
367
281
  }
282
+ var guessTypeFromUrl = (url) => {
283
+ const ext = url.split(".").pop()?.toLowerCase();
284
+ if (!ext) return null;
285
+ const map = {
286
+ jpg: "image/jpeg",
287
+ jpeg: "image/jpeg",
288
+ png: "image/png",
289
+ webp: "image/webp",
290
+ gif: "image/gif",
291
+ svg: "image/svg+xml",
292
+ bmp: "image/bmp",
293
+ tiff: "image/tiff",
294
+ pdf: "application/pdf",
295
+ zip: "application/zip",
296
+ rar: "application/x-rar-compressed",
297
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
298
+ xls: "application/vnd.ms-excel",
299
+ mp4: "video/mp4",
300
+ mov: "video/quicktime"
301
+ };
302
+ return map[ext] || null;
303
+ };
304
+
305
+ // src/utils/format-date.ts
306
+ var import_moment = __toESM(require("moment"));
307
+ var validateAndParseDate = (input, isDateTime = false) => {
308
+ if (!input || typeof input !== "string") return null;
309
+ const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
310
+ const dateFormat = "YYYY-MM-DD";
311
+ const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
312
+ const currentDay = (0, import_moment.default)().format("DD");
313
+ const currentMonth = (0, import_moment.default)().format("MM");
314
+ const currentYear = (0, import_moment.default)().format("YYYY");
315
+ const defaultTime = "00:00:00";
316
+ const maxYear = parseInt(currentYear) + 10;
317
+ const isValidDate = (day, month, year) => {
318
+ const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
319
+ return date.isValid();
320
+ };
321
+ const isValidTime = (hour, minute = "00", second = "00") => {
322
+ const h = parseInt(hour, 10);
323
+ const m = parseInt(minute, 10);
324
+ const s = parseInt(second, 10);
325
+ return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
326
+ };
327
+ const formatOutput = (day, month, year, time = defaultTime) => {
328
+ let result = (0, import_moment.default)(
329
+ `${day}-${month}-${year} ${time}`,
330
+ "DD-MM-YYYY HH:mm:ss"
331
+ );
332
+ if (!result.isValid()) return null;
333
+ if (isDateTime) {
334
+ result = result.subtract(7, "hours");
335
+ return result.format(dateTimeFormat);
336
+ }
337
+ return result.format(dateFormat);
338
+ };
339
+ if (isDateTime && input.match(
340
+ /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
341
+ )) {
342
+ const [datePart, timePart] = input.split(/\s+/);
343
+ const dateParts = datePart.split(/[\/-]/);
344
+ const timeParts = timePart.split(":");
345
+ const day = dateParts[0].padStart(2, "0");
346
+ const month = dateParts[1].padStart(2, "0");
347
+ const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
348
+ const hour = timeParts[0].padStart(2, "0");
349
+ const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
350
+ const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
351
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
352
+ let result = (0, import_moment.default)(
353
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
354
+ "DD-MM-YYYY HH:mm:ss"
355
+ );
356
+ if (!result.isValid()) return null;
357
+ result = result.subtract(7, "hours");
358
+ return result.format(dateTimeFormat);
359
+ }
360
+ return null;
361
+ }
362
+ if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
363
+ const [year, month, day] = cleanInput.split("-");
364
+ if (isValidDate(day, month, year)) {
365
+ return formatOutput(day, month, year);
366
+ }
367
+ return null;
368
+ }
369
+ if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
370
+ const [day, month, year] = cleanInput.split("/");
371
+ const paddedDay = day.padStart(2, "0");
372
+ const paddedMonth = month.padStart(2, "0");
373
+ const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
374
+ if (isValidDate(paddedDay, paddedMonth, fullYear)) {
375
+ return formatOutput(paddedDay, paddedMonth, fullYear);
376
+ }
377
+ return null;
378
+ }
379
+ if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
380
+ const [day, month, year] = cleanInput.split("-");
381
+ const paddedDay = day.padStart(2, "0");
382
+ const paddedMonth = month.padStart(2, "0");
383
+ const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
384
+ if (isValidDate(paddedDay, paddedMonth, fullYear)) {
385
+ return formatOutput(paddedDay, paddedMonth, fullYear);
386
+ }
387
+ return null;
388
+ }
389
+ if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
390
+ const [day, month] = cleanInput.split(/[\/-]/);
391
+ const paddedDay = day.padStart(2, "0");
392
+ const paddedMonth = month.padStart(2, "0");
393
+ if (isValidDate(paddedDay, paddedMonth, currentYear)) {
394
+ return formatOutput(paddedDay, paddedMonth, currentYear);
395
+ }
396
+ return null;
397
+ }
398
+ if (cleanInput.match(/^\d{4}$/)) {
399
+ const num = parseInt(cleanInput, 10);
400
+ if (num >= 2e3 && num <= maxYear) {
401
+ if (isValidDate(currentDay, currentMonth, num.toString())) {
402
+ return formatOutput(currentDay, currentMonth, num.toString());
403
+ }
404
+ return null;
405
+ }
406
+ const day = cleanInput.slice(0, 2);
407
+ const month = cleanInput.slice(2, 4);
408
+ if (isValidDate(day, month, currentYear)) {
409
+ return formatOutput(day, month, currentYear);
410
+ }
411
+ return null;
412
+ }
413
+ if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
414
+ const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
415
+ let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
416
+ if (isDateTime) {
417
+ result = result.subtract(7, "hours");
418
+ }
419
+ if (result.isValid()) {
420
+ return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
421
+ }
422
+ return null;
423
+ }
424
+ if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
425
+ const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
426
+ const day = parts[0].padStart(2, "0");
427
+ const month = parts[1].padStart(2, "0");
428
+ let year = parts[2];
429
+ year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
430
+ if (isValidDate(day, month, year)) {
431
+ return formatOutput(day, month, year);
432
+ }
433
+ return null;
434
+ }
435
+ if (isDateTime) {
436
+ if (cleanInput.length === 9) {
437
+ const day = cleanInput.slice(0, 2);
438
+ const month = cleanInput.slice(2, 4);
439
+ const year = cleanInput.slice(4, 8);
440
+ const hour = cleanInput.slice(8, 9).padStart(2, "0");
441
+ if (isValidDate(day, month, year) && isValidTime(hour)) {
442
+ let result = (0, import_moment.default)(
443
+ `${day}-${month}-${year} ${hour}:00:00`,
444
+ "DD-MM-YYYY HH:mm:ss"
445
+ );
446
+ if (!result.isValid()) return null;
447
+ result = result.subtract(7, "hours");
448
+ return result.format(dateTimeFormat);
449
+ }
450
+ return null;
451
+ }
452
+ if (cleanInput.length === 10) {
453
+ const day = cleanInput.slice(0, 2);
454
+ const month = cleanInput.slice(2, 4);
455
+ const year = cleanInput.slice(4, 8);
456
+ const hour = cleanInput.slice(8, 10);
457
+ if (isValidDate(day, month, year) && isValidTime(hour)) {
458
+ let result = (0, import_moment.default)(
459
+ `${day}-${month}-${year} ${hour}:00:00`,
460
+ "DD-MM-YYYY HH:mm:ss"
461
+ );
462
+ if (!result.isValid()) return null;
463
+ result = result.subtract(7, "hours");
464
+ return result.format(dateTimeFormat);
465
+ }
466
+ return null;
467
+ }
468
+ if (cleanInput.length === 11) {
469
+ const day = cleanInput.slice(0, 2);
470
+ const month = cleanInput.slice(2, 4);
471
+ const year = cleanInput.slice(4, 8);
472
+ const hour = cleanInput.slice(8, 10);
473
+ const minute = cleanInput.slice(10, 11).padStart(2, "0");
474
+ if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
475
+ let result = (0, import_moment.default)(
476
+ `${day}-${month}-${year} ${hour}:${minute}:00`,
477
+ "DD-MM-YYYY HH:mm:ss"
478
+ );
479
+ if (!result.isValid()) return null;
480
+ result = result.subtract(7, "hours");
481
+ return result.format(dateTimeFormat);
482
+ }
483
+ return null;
484
+ }
485
+ if (cleanInput.length === 12) {
486
+ const day = cleanInput.slice(0, 2);
487
+ const month = cleanInput.slice(2, 4);
488
+ const year = cleanInput.slice(4, 8);
489
+ const hour = cleanInput.slice(8, 10);
490
+ const minute = cleanInput.slice(10, 12);
491
+ if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
492
+ let result = (0, import_moment.default)(
493
+ `${day}-${month}-${year} ${hour}:${minute}:00`,
494
+ "DD-MM-YYYY HH:mm:ss"
495
+ );
496
+ if (!result.isValid()) return null;
497
+ result = result.subtract(7, "hours");
498
+ return result.format(dateTimeFormat);
499
+ }
500
+ return null;
501
+ }
502
+ if (cleanInput.length === 13) {
503
+ const day = cleanInput.slice(0, 2);
504
+ const month = cleanInput.slice(2, 4);
505
+ const year = cleanInput.slice(4, 8);
506
+ const hour = cleanInput.slice(8, 10);
507
+ const minute = cleanInput.slice(10, 12);
508
+ const second = cleanInput.slice(12, 13).padStart(2, "0");
509
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
510
+ let result = (0, import_moment.default)(
511
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
512
+ "DD-MM-YYYY HH:mm:ss"
513
+ );
514
+ if (!result.isValid()) return null;
515
+ result = result.subtract(7, "hours");
516
+ return result.format(dateTimeFormat);
517
+ }
518
+ return null;
519
+ }
520
+ if (cleanInput.length === 14) {
521
+ const day = cleanInput.slice(0, 2);
522
+ const month = cleanInput.slice(2, 4);
523
+ const year = cleanInput.slice(4, 8);
524
+ const hour = cleanInput.slice(8, 10);
525
+ const minute = cleanInput.slice(10, 12);
526
+ const second = cleanInput.slice(12, 14);
527
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
528
+ let result = (0, import_moment.default)(
529
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
530
+ "DD-MM-YYYY HH:mm:ss"
531
+ );
532
+ if (!result.isValid()) return null;
533
+ result = result.subtract(7, "hours");
534
+ return result.format(dateTimeFormat);
535
+ }
536
+ return null;
537
+ }
538
+ }
539
+ const len = cleanInput.length;
540
+ if (len === 1 || len === 2) {
541
+ const paddedDay = cleanInput.padStart(2, "0");
542
+ if (isValidDate(paddedDay, currentMonth, currentYear)) {
543
+ return formatOutput(paddedDay, currentMonth, currentYear);
544
+ }
545
+ return null;
546
+ }
547
+ if (len === 3) {
548
+ const day = cleanInput.slice(0, 2);
549
+ const month = cleanInput.slice(2, 3).padStart(2, "0");
550
+ if (isValidDate(day, month, currentYear)) {
551
+ return formatOutput(day, month, currentYear);
552
+ }
553
+ return null;
554
+ }
555
+ if (len === 6) {
556
+ const day = cleanInput.slice(0, 2);
557
+ const month = cleanInput.slice(2, 4);
558
+ let year = cleanInput.slice(4, 6);
559
+ year = `20${year}`;
560
+ if (parseInt(month) > 12) {
561
+ if (isValidDate(day, currentMonth, currentYear)) {
562
+ return formatOutput(day, currentMonth, currentYear);
563
+ }
564
+ return null;
565
+ }
566
+ if (isValidDate(day, month, year)) {
567
+ return formatOutput(day, month, year);
568
+ }
569
+ return null;
570
+ }
571
+ if (len === 7) {
572
+ return null;
573
+ }
574
+ if (len === 8) {
575
+ const day = cleanInput.slice(0, 2);
576
+ const month = cleanInput.slice(2, 4);
577
+ const year = cleanInput.slice(4, 8);
578
+ if (isValidDate(day, month, year)) {
579
+ return formatOutput(day, month, year);
580
+ }
581
+ return null;
582
+ }
583
+ if (len > 8 && !isDateTime) {
584
+ return null;
585
+ }
586
+ return null;
587
+ };
368
588
 
369
589
  // src/utils.ts
370
590
  __reExport(utils_exports, require("@fctc/interface-logic/utils"));
@@ -383,7 +603,7 @@ var useMenu = ({
383
603
  const menuData = useGetMenu2(
384
604
  context,
385
605
  specification,
386
- !!context && !(0, utils_exports.isObjectEmpty)(context) && !!context?.uid && !!context?.lang,
606
+ !!context && !isObjectEmpty(context) && !!context?.uid && !!context?.lang,
387
607
  domain,
388
608
  defaultService
389
609
  );
@@ -465,7 +685,7 @@ var useProfile = ({ service }) => {
465
685
  const userInfoQuery = (0, import_react_query2.useQuery)({
466
686
  queryKey: ["userInfo"],
467
687
  queryFn: () => getProfile.mutateAsync(),
468
- enabled: (0, utils_exports.isObjectEmpty)(env?.user)
688
+ enabled: isObjectEmpty(env?.user)
469
689
  });
470
690
  (0, import_react5.useEffect)(() => {
471
691
  if (userInfoQuery.data) {
@@ -616,10 +836,10 @@ var AppProvider = ({
616
836
  const user = useUser({ service: env.default_service });
617
837
  const company = useCompany({ service: env.default_service });
618
838
  const menuContext = (0, import_react8.useMemo)(() => {
619
- return combineContexts([
839
+ return (0, utils_exports.combineContexts)([
620
840
  {
621
841
  ...user?.context,
622
- ...!(0, utils_exports.isObjectEmpty)(env?.user) ? { lang: env?.context?.lang } : {},
842
+ ...!isObjectEmpty(env?.user) ? { lang: env?.context?.lang } : {},
623
843
  ...menuParams?.context ?? {}
624
844
  }
625
845
  ]);
@@ -636,7 +856,7 @@ var AppProvider = ({
636
856
  return menu?.state?.action;
637
857
  }, [menu?.state?.action, env?.context?.lang]);
638
858
  const viewContext = (0, import_react8.useMemo)(() => {
639
- return combineContexts([
859
+ return (0, utils_exports.combineContexts)([
640
860
  menuContext,
641
861
  { ...(0, utils_exports.evalJSONContext)(action?.context) }
642
862
  ]);
@@ -770,45 +990,14 @@ var useGetSpecification = ({
770
990
  };
771
991
 
772
992
  // src/hooks/core/use-list-data.ts
773
- var import_react14 = require("react");
993
+ var import_react13 = require("react");
774
994
  var import_utils5 = require("@fctc/interface-logic/utils");
775
995
 
776
- // src/hooks/utils/use-click-outside.ts
777
- var import_react11 = require("react");
778
- var DEFAULT_EVENTS = ["mousedown", "touchstart"];
779
- var useClickOutside = ({
780
- handler,
781
- events = DEFAULT_EVENTS,
782
- nodes = [],
783
- refs
784
- }) => {
785
- const ref = (0, import_react11.useRef)(null);
786
- (0, import_react11.useEffect)(() => {
787
- const listener = (event) => {
788
- const { target } = event;
789
- if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
790
- return;
791
- }
792
- if (!(target instanceof HTMLElement)) return;
793
- const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
794
- const shouldTrigger = nodes.length > 0 ? nodes.every((node) => node && !event.composedPath().includes(node)) : ref.current && !ref.current.contains(target);
795
- if (shouldTrigger && !shouldIgnore) {
796
- handler(event);
797
- }
798
- };
799
- events.forEach((event) => document.addEventListener(event, listener));
800
- return () => {
801
- events.forEach((event) => document.removeEventListener(event, listener));
802
- };
803
- }, [handler, nodes, events]);
804
- return ref;
805
- };
806
-
807
996
  // src/hooks/utils/use-debounce.ts
808
- var import_react12 = require("react");
997
+ var import_react11 = require("react");
809
998
  function useDebounce(value, delay) {
810
- const [debouncedValue, setDebouncedValue] = (0, import_react12.useState)(value);
811
- (0, import_react12.useEffect)(() => {
999
+ const [debouncedValue, setDebouncedValue] = (0, import_react11.useState)(value);
1000
+ (0, import_react11.useEffect)(() => {
812
1001
  const handler = setTimeout(() => {
813
1002
  setDebouncedValue(value);
814
1003
  }, delay);
@@ -820,7 +1009,7 @@ function useDebounce(value, delay) {
820
1009
  }
821
1010
 
822
1011
  // src/hooks/utils/use-get-rowids.ts
823
- var import_react13 = require("react");
1012
+ var import_react12 = require("react");
824
1013
  var useGetRowIds = (tableRef) => {
825
1014
  function isElementVisible(el) {
826
1015
  const style = window.getComputedStyle(el);
@@ -837,9 +1026,9 @@ var useGetRowIds = (tableRef) => {
837
1026
  }
838
1027
  return true;
839
1028
  }
840
- const [rowIds, setRowIds] = (0, import_react13.useState)([]);
841
- const lastRowIdsRef = (0, import_react13.useRef)([]);
842
- const updateVisibleRowIds = (0, import_react13.useCallback)(() => {
1029
+ const [rowIds, setRowIds] = (0, import_react12.useState)([]);
1030
+ const lastRowIdsRef = (0, import_react12.useRef)([]);
1031
+ const updateVisibleRowIds = (0, import_react12.useCallback)(() => {
843
1032
  const table = tableRef.current;
844
1033
  if (!table) return;
845
1034
  const rows = table.querySelectorAll("tr[data-row-id]");
@@ -857,7 +1046,7 @@ var useGetRowIds = (tableRef) => {
857
1046
  setRowIds(uniqueIds);
858
1047
  }
859
1048
  }, [tableRef]);
860
- (0, import_react13.useEffect)(() => {
1049
+ (0, import_react12.useEffect)(() => {
861
1050
  const table = tableRef.current;
862
1051
  if (!table) return;
863
1052
  const mutationObserver = new MutationObserver(() => {
@@ -897,12 +1086,12 @@ var useListData = ({
897
1086
  limit = 10
898
1087
  }) => {
899
1088
  const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
900
- const [page, setPage] = (0, import_react14.useState)(0);
901
- const [pageLimit, setPageLimit] = (0, import_react14.useState)(limit);
902
- const [groupByList, setGroupByList] = (0, import_react14.useState)(null);
903
- const [domain, setDomain] = (0, import_react14.useState)(null);
904
- const [order, setOrder] = (0, import_react14.useState)("");
905
- const [selectedRowKeys, setSelectedRowKeys] = (0, import_react14.useState)([]);
1089
+ const [page, setPage] = (0, import_react13.useState)(0);
1090
+ const [pageLimit, setPageLimit] = (0, import_react13.useState)(limit);
1091
+ const [groupByList, setGroupByList] = (0, import_react13.useState)(null);
1092
+ const [domain, setDomain] = (0, import_react13.useState)(null);
1093
+ const [order, setOrder] = (0, import_react13.useState)("");
1094
+ const [selectedRowKeys, setSelectedRowKeys] = (0, import_react13.useState)([]);
906
1095
  const [debouncedPage] = useDebounce(page, 500);
907
1096
  const [debouncedDomain] = useDebounce(domain, 500);
908
1097
  const { specification } = useGetSpecification({
@@ -910,7 +1099,7 @@ var useListData = ({
910
1099
  viewData,
911
1100
  fields: mode === "kanban" ? viewData?.views?.kanban?.fields : viewData?.views?.list?.fields
912
1101
  });
913
- const listDataProps = (0, import_react14.useMemo)(() => {
1102
+ const listDataProps = (0, import_react13.useMemo)(() => {
914
1103
  if (!viewData || !action || !context) {
915
1104
  return null;
916
1105
  }
@@ -956,7 +1145,7 @@ var useListData = ({
956
1145
  listDataProps?.specification,
957
1146
  listDataProps?.mode
958
1147
  ],
959
- !!listDataProps && !!specification && !(0, import_utils5.isObjectEmpty)(specification) && !!domain,
1148
+ !!listDataProps && !!specification && !isObjectEmpty(specification) && !!domain,
960
1149
  service,
961
1150
  xNode
962
1151
  );
@@ -989,7 +1178,6 @@ var useListData = ({
989
1178
  useChangeOrderPreparationState,
990
1179
  useChangeStatus,
991
1180
  useCheckPayment,
992
- useClickOutside,
993
1181
  useCompany,
994
1182
  useConfig,
995
1183
  useCreateEntity,
@@ -1026,7 +1214,6 @@ var useListData = ({
1026
1214
  useGetFileExcel,
1027
1215
  useGetFormView,
1028
1216
  useGetGroups,
1029
- useGetImage,
1030
1217
  useGetList,
1031
1218
  useGetListCompany,
1032
1219
  useGetListData,