@fctc/widget-logic 5.3.7-beta.9 → 5.3.8

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.mjs CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  useGetFileExcel,
45
45
  useGetFormView,
46
46
  useGetGroups,
47
+ useGetImage,
47
48
  useGetListCompany,
48
49
  useGetListData,
49
50
  useGetListMyBankAccount,
@@ -171,14 +172,14 @@ var useCallAction = () => {
171
172
  var utils_exports = {};
172
173
  __export(utils_exports, {
173
174
  STORAGES: () => STORAGES,
175
+ combineContexts: () => combineContexts,
176
+ convertFieldsToArray: () => convertFieldsToArray,
174
177
  countSum: () => countSum,
175
- guessTypeFromUrl: () => guessTypeFromUrl,
176
- isObjectEmpty: () => isObjectEmpty,
178
+ getDateRange: () => getDateRange,
177
179
  languages: () => languages,
178
180
  mergeButtons: () => mergeButtons,
179
181
  setStorageItemAsync: () => setStorageItemAsync,
180
- useStorageState: () => useStorageState,
181
- validateAndParseDate: () => validateAndParseDate
182
+ useStorageState: () => useStorageState
182
183
  });
183
184
 
184
185
  // src/utils/constants.ts
@@ -196,9 +197,6 @@ var countSum = (data, field) => {
196
197
  0
197
198
  );
198
199
  };
199
- var isObjectEmpty = (obj) => {
200
- return Object.keys(obj).length === 0;
201
- };
202
200
  function mergeButtons(fields) {
203
201
  const buttons = fields?.filter((f) => f.type_co === "button");
204
202
  const others = fields?.filter((f) => f.type_co !== "button");
@@ -210,6 +208,103 @@ function mergeButtons(fields) {
210
208
  }
211
209
  return others;
212
210
  }
211
+ var getDateRange = (currentDate, unit) => {
212
+ const date = new Date(currentDate);
213
+ let dateStart, dateEnd;
214
+ function formatDate(d) {
215
+ 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");
216
+ }
217
+ switch (unit) {
218
+ case "month":
219
+ dateStart = new Date(
220
+ date.getFullYear(),
221
+ date.getMonth() + 1,
222
+ date.getDate(),
223
+ 23,
224
+ 59,
225
+ 59
226
+ );
227
+ dateStart.setHours(dateStart.getHours() - 7);
228
+ dateEnd = new Date(date.getFullYear(), date.getMonth(), 0, 0, 0, 0);
229
+ dateEnd.setHours(dateEnd.getHours() - 7);
230
+ break;
231
+ case "day":
232
+ dateStart = new Date(
233
+ date.getFullYear(),
234
+ date.getMonth(),
235
+ date.getDate(),
236
+ 23,
237
+ 59,
238
+ 59
239
+ );
240
+ dateStart.setHours(dateStart.getHours() - 7);
241
+ dateEnd = new Date(
242
+ date.getFullYear(),
243
+ date.getMonth(),
244
+ date.getDate(),
245
+ 0,
246
+ 0,
247
+ 0
248
+ );
249
+ dateEnd.setHours(dateEnd.getHours() - 7);
250
+ break;
251
+ case "week":
252
+ const dayOfWeek = date.getDay();
253
+ const daysToMonday = dayOfWeek === 0 ? -6 : 1 - dayOfWeek;
254
+ const daysToSunday = dayOfWeek === 0 ? 0 : 7 - dayOfWeek;
255
+ dateStart = new Date(
256
+ date.getFullYear(),
257
+ date.getMonth(),
258
+ date.getDate() + daysToSunday,
259
+ 23,
260
+ 59,
261
+ 59
262
+ );
263
+ dateStart.setHours(dateStart.getHours() - 7);
264
+ dateEnd = new Date(
265
+ date.getFullYear(),
266
+ date.getMonth(),
267
+ date.getDate() + daysToMonday,
268
+ 0,
269
+ 0,
270
+ 0
271
+ );
272
+ dateEnd.setHours(dateEnd.getHours() - 7);
273
+ break;
274
+ case "year":
275
+ dateStart = new Date(date.getFullYear(), 11, 31, 23, 59, 59);
276
+ dateStart.setHours(dateStart.getHours() - 7);
277
+ dateEnd = new Date(date.getFullYear() - 1, 11, 31, 0, 0, 0);
278
+ dateEnd.setHours(dateEnd.getHours() - 7);
279
+ break;
280
+ default:
281
+ throw new Error(
282
+ "\u0110\u01A1n v\u1ECB kh\xF4ng h\u1EE3p l\u1EC7. Ch\u1EC9 ch\u1EA5p nh\u1EADn: week, day, month, year"
283
+ );
284
+ }
285
+ return [
286
+ ["date_start", "<=", formatDate(dateStart)],
287
+ ["date_end", ">=", formatDate(dateEnd)]
288
+ ];
289
+ };
290
+ var convertFieldsToArray = (fields) => {
291
+ const defaultFields = ["display_name", "date_start", "date_end"];
292
+ if (!fields || !Array.isArray(fields)) {
293
+ return defaultFields;
294
+ }
295
+ const inputFields = fields.filter((field) => field && field.type_co === "field").map((field) => field.name);
296
+ return [...defaultFields, ...inputFields];
297
+ };
298
+ function combineContexts(contexts) {
299
+ if (contexts.some((context) => !context)) {
300
+ return void 0;
301
+ } else {
302
+ const res = contexts.reduce((acc, context) => {
303
+ return { ...acc, ...context };
304
+ }, {});
305
+ return res;
306
+ }
307
+ }
213
308
  var STORAGES = {
214
309
  TOKEN: "accessToken",
215
310
  USER_INFO: "USER_INFO"
@@ -250,312 +345,6 @@ function useStorageState(key) {
250
345
  );
251
346
  return [state, setValue];
252
347
  }
253
- var guessTypeFromUrl = (url) => {
254
- const ext = url.split(".").pop()?.toLowerCase();
255
- if (!ext) return null;
256
- const map = {
257
- jpg: "image/jpeg",
258
- jpeg: "image/jpeg",
259
- png: "image/png",
260
- webp: "image/webp",
261
- gif: "image/gif",
262
- svg: "image/svg+xml",
263
- bmp: "image/bmp",
264
- tiff: "image/tiff",
265
- pdf: "application/pdf",
266
- zip: "application/zip",
267
- rar: "application/x-rar-compressed",
268
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
269
- xls: "application/vnd.ms-excel",
270
- mp4: "video/mp4",
271
- mov: "video/quicktime"
272
- };
273
- return map[ext] || null;
274
- };
275
-
276
- // src/utils/format-date.ts
277
- import moment from "moment";
278
- var validateAndParseDate = (input, isDateTime = false) => {
279
- if (!input || typeof input !== "string") return null;
280
- const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
281
- const dateFormat = "YYYY-MM-DD";
282
- const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
283
- const currentDay = moment().format("DD");
284
- const currentMonth = moment().format("MM");
285
- const currentYear = moment().format("YYYY");
286
- const defaultTime = "00:00:00";
287
- const maxYear = parseInt(currentYear) + 10;
288
- const isValidDate = (day, month, year) => {
289
- const date = moment(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
290
- return date.isValid();
291
- };
292
- const isValidTime = (hour, minute = "00", second = "00") => {
293
- const h = parseInt(hour, 10);
294
- const m = parseInt(minute, 10);
295
- const s = parseInt(second, 10);
296
- return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
297
- };
298
- const formatOutput = (day, month, year, time = defaultTime) => {
299
- let result = moment(
300
- `${day}-${month}-${year} ${time}`,
301
- "DD-MM-YYYY HH:mm:ss"
302
- );
303
- if (!result.isValid()) return null;
304
- if (isDateTime) {
305
- result = result.subtract(7, "hours");
306
- return result.format(dateTimeFormat);
307
- }
308
- return result.format(dateFormat);
309
- };
310
- if (isDateTime && input.match(
311
- /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
312
- )) {
313
- const [datePart, timePart] = input.split(/\s+/);
314
- const dateParts = datePart.split(/[\/-]/);
315
- const timeParts = timePart.split(":");
316
- const day = dateParts[0].padStart(2, "0");
317
- const month = dateParts[1].padStart(2, "0");
318
- const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
319
- const hour = timeParts[0].padStart(2, "0");
320
- const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
321
- const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
322
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
323
- let result = moment(
324
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
325
- "DD-MM-YYYY HH:mm:ss"
326
- );
327
- if (!result.isValid()) return null;
328
- result = result.subtract(7, "hours");
329
- return result.format(dateTimeFormat);
330
- }
331
- return null;
332
- }
333
- if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
334
- const [year, month, day] = cleanInput.split("-");
335
- if (isValidDate(day, month, year)) {
336
- return formatOutput(day, month, year);
337
- }
338
- return null;
339
- }
340
- if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
341
- const [day, month, year] = cleanInput.split("/");
342
- const paddedDay = day.padStart(2, "0");
343
- const paddedMonth = month.padStart(2, "0");
344
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
345
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
346
- return formatOutput(paddedDay, paddedMonth, fullYear);
347
- }
348
- return null;
349
- }
350
- if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
351
- const [day, month, year] = cleanInput.split("-");
352
- const paddedDay = day.padStart(2, "0");
353
- const paddedMonth = month.padStart(2, "0");
354
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
355
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
356
- return formatOutput(paddedDay, paddedMonth, fullYear);
357
- }
358
- return null;
359
- }
360
- if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
361
- const [day, month] = cleanInput.split(/[\/-]/);
362
- const paddedDay = day.padStart(2, "0");
363
- const paddedMonth = month.padStart(2, "0");
364
- if (isValidDate(paddedDay, paddedMonth, currentYear)) {
365
- return formatOutput(paddedDay, paddedMonth, currentYear);
366
- }
367
- return null;
368
- }
369
- if (cleanInput.match(/^\d{4}$/)) {
370
- const num = parseInt(cleanInput, 10);
371
- if (num >= 2e3 && num <= maxYear) {
372
- if (isValidDate(currentDay, currentMonth, num.toString())) {
373
- return formatOutput(currentDay, currentMonth, num.toString());
374
- }
375
- return null;
376
- }
377
- const day = cleanInput.slice(0, 2);
378
- const month = cleanInput.slice(2, 4);
379
- if (isValidDate(day, month, currentYear)) {
380
- return formatOutput(day, month, currentYear);
381
- }
382
- return null;
383
- }
384
- if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
385
- const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
386
- let result = moment().subtract(daysToSubtract, "days");
387
- if (isDateTime) {
388
- result = result.subtract(7, "hours");
389
- }
390
- if (result.isValid()) {
391
- return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
392
- }
393
- return null;
394
- }
395
- if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
396
- const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
397
- const day = parts[0].padStart(2, "0");
398
- const month = parts[1].padStart(2, "0");
399
- let year = parts[2];
400
- year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
401
- if (isValidDate(day, month, year)) {
402
- return formatOutput(day, month, year);
403
- }
404
- return null;
405
- }
406
- if (isDateTime) {
407
- if (cleanInput.length === 9) {
408
- const day = cleanInput.slice(0, 2);
409
- const month = cleanInput.slice(2, 4);
410
- const year = cleanInput.slice(4, 8);
411
- const hour = cleanInput.slice(8, 9).padStart(2, "0");
412
- if (isValidDate(day, month, year) && isValidTime(hour)) {
413
- let result = moment(
414
- `${day}-${month}-${year} ${hour}:00:00`,
415
- "DD-MM-YYYY HH:mm:ss"
416
- );
417
- if (!result.isValid()) return null;
418
- result = result.subtract(7, "hours");
419
- return result.format(dateTimeFormat);
420
- }
421
- return null;
422
- }
423
- if (cleanInput.length === 10) {
424
- const day = cleanInput.slice(0, 2);
425
- const month = cleanInput.slice(2, 4);
426
- const year = cleanInput.slice(4, 8);
427
- const hour = cleanInput.slice(8, 10);
428
- if (isValidDate(day, month, year) && isValidTime(hour)) {
429
- let result = moment(
430
- `${day}-${month}-${year} ${hour}:00:00`,
431
- "DD-MM-YYYY HH:mm:ss"
432
- );
433
- if (!result.isValid()) return null;
434
- result = result.subtract(7, "hours");
435
- return result.format(dateTimeFormat);
436
- }
437
- return null;
438
- }
439
- if (cleanInput.length === 11) {
440
- const day = cleanInput.slice(0, 2);
441
- const month = cleanInput.slice(2, 4);
442
- const year = cleanInput.slice(4, 8);
443
- const hour = cleanInput.slice(8, 10);
444
- const minute = cleanInput.slice(10, 11).padStart(2, "0");
445
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
446
- let result = moment(
447
- `${day}-${month}-${year} ${hour}:${minute}:00`,
448
- "DD-MM-YYYY HH:mm:ss"
449
- );
450
- if (!result.isValid()) return null;
451
- result = result.subtract(7, "hours");
452
- return result.format(dateTimeFormat);
453
- }
454
- return null;
455
- }
456
- if (cleanInput.length === 12) {
457
- const day = cleanInput.slice(0, 2);
458
- const month = cleanInput.slice(2, 4);
459
- const year = cleanInput.slice(4, 8);
460
- const hour = cleanInput.slice(8, 10);
461
- const minute = cleanInput.slice(10, 12);
462
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
463
- let result = moment(
464
- `${day}-${month}-${year} ${hour}:${minute}:00`,
465
- "DD-MM-YYYY HH:mm:ss"
466
- );
467
- if (!result.isValid()) return null;
468
- result = result.subtract(7, "hours");
469
- return result.format(dateTimeFormat);
470
- }
471
- return null;
472
- }
473
- if (cleanInput.length === 13) {
474
- const day = cleanInput.slice(0, 2);
475
- const month = cleanInput.slice(2, 4);
476
- const year = cleanInput.slice(4, 8);
477
- const hour = cleanInput.slice(8, 10);
478
- const minute = cleanInput.slice(10, 12);
479
- const second = cleanInput.slice(12, 13).padStart(2, "0");
480
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
481
- let result = moment(
482
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
483
- "DD-MM-YYYY HH:mm:ss"
484
- );
485
- if (!result.isValid()) return null;
486
- result = result.subtract(7, "hours");
487
- return result.format(dateTimeFormat);
488
- }
489
- return null;
490
- }
491
- if (cleanInput.length === 14) {
492
- const day = cleanInput.slice(0, 2);
493
- const month = cleanInput.slice(2, 4);
494
- const year = cleanInput.slice(4, 8);
495
- const hour = cleanInput.slice(8, 10);
496
- const minute = cleanInput.slice(10, 12);
497
- const second = cleanInput.slice(12, 14);
498
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
499
- let result = moment(
500
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
501
- "DD-MM-YYYY HH:mm:ss"
502
- );
503
- if (!result.isValid()) return null;
504
- result = result.subtract(7, "hours");
505
- return result.format(dateTimeFormat);
506
- }
507
- return null;
508
- }
509
- }
510
- const len = cleanInput.length;
511
- if (len === 1 || len === 2) {
512
- const paddedDay = cleanInput.padStart(2, "0");
513
- if (isValidDate(paddedDay, currentMonth, currentYear)) {
514
- return formatOutput(paddedDay, currentMonth, currentYear);
515
- }
516
- return null;
517
- }
518
- if (len === 3) {
519
- const day = cleanInput.slice(0, 2);
520
- const month = cleanInput.slice(2, 3).padStart(2, "0");
521
- if (isValidDate(day, month, currentYear)) {
522
- return formatOutput(day, month, currentYear);
523
- }
524
- return null;
525
- }
526
- if (len === 6) {
527
- const day = cleanInput.slice(0, 2);
528
- const month = cleanInput.slice(2, 4);
529
- let year = cleanInput.slice(4, 6);
530
- year = `20${year}`;
531
- if (parseInt(month) > 12) {
532
- if (isValidDate(day, currentMonth, currentYear)) {
533
- return formatOutput(day, currentMonth, currentYear);
534
- }
535
- return null;
536
- }
537
- if (isValidDate(day, month, year)) {
538
- return formatOutput(day, month, year);
539
- }
540
- return null;
541
- }
542
- if (len === 7) {
543
- return null;
544
- }
545
- if (len === 8) {
546
- const day = cleanInput.slice(0, 2);
547
- const month = cleanInput.slice(2, 4);
548
- const year = cleanInput.slice(4, 8);
549
- if (isValidDate(day, month, year)) {
550
- return formatOutput(day, month, year);
551
- }
552
- return null;
553
- }
554
- if (len > 8 && !isDateTime) {
555
- return null;
556
- }
557
- return null;
558
- };
559
348
 
560
349
  // src/utils.ts
561
350
  __reExport(utils_exports, utils_star);
@@ -575,7 +364,7 @@ var useMenu = ({
575
364
  const menuData = useGetMenu2(
576
365
  context,
577
366
  specification,
578
- !!context && !isObjectEmpty(context) && !!context?.uid && !!context?.lang,
367
+ !!context && !(0, utils_exports.isObjectEmpty)(context) && !!context?.uid && !!context?.lang,
579
368
  domain,
580
369
  defaultService
581
370
  );
@@ -648,17 +437,16 @@ var useDetail = (sub) => {
648
437
  // src/hooks/core/use-profile.ts
649
438
  import { useQuery as useQuery2 } from "@tanstack/react-query";
650
439
  import { useEffect as useEffect3, useMemo } from "react";
651
- var useProfile = ({
652
- service,
653
- i18n
654
- }) => {
440
+ import { useTranslation } from "react-i18next";
441
+ var useProfile = ({ service }) => {
655
442
  const { setUid, setLang, setUserInfo, env } = (0, provider_exports.useEnv)();
656
443
  const { useGetProfile: useGetProfile2 } = (0, provider_exports.useService)();
657
444
  const getProfile = useGetProfile2(service);
445
+ const { i18n } = useTranslation();
658
446
  const userInfoQuery = useQuery2({
659
447
  queryKey: ["userInfo"],
660
448
  queryFn: () => getProfile.mutateAsync(),
661
- enabled: isObjectEmpty(env?.user)
449
+ enabled: (0, utils_exports.isObjectEmpty)(env?.user)
662
450
  });
663
451
  useEffect3(() => {
664
452
  if (userInfoQuery.data) {
@@ -691,8 +479,8 @@ var useProfile = ({
691
479
  };
692
480
 
693
481
  // src/hooks/core/use-user.ts
694
- var useUser = ({ service, i18n }) => {
695
- const userProfile = useProfile({ service, i18n });
482
+ var useUser = ({ service }) => {
483
+ const userProfile = useProfile({ service });
696
484
  const userDetail = useDetail(userProfile?.data?.sub);
697
485
  return { userProfile, userDetail, context: userProfile?.context };
698
486
  };
@@ -744,7 +532,7 @@ var useViewV2 = ({
744
532
  import { useQuery as useQuery3 } from "@tanstack/react-query";
745
533
  import { useEffect as useEffect4, useMemo as useMemo3 } from "react";
746
534
  var useCompany = ({ service }) => {
747
- const { setCompanies, setDefaultCompany, env } = (0, provider_exports.useEnv)();
535
+ const { setAllowCompanies, setCompanies, setDefaultCompany, env } = (0, provider_exports.useEnv)();
748
536
  const { useGetCurrentCompany: useGetCurrentCompany2, useGetCompanyInfo: useGetCompanyInfo2 } = (0, provider_exports.useService)();
749
537
  const getCurrentCompany = useGetCurrentCompany2();
750
538
  const fetchCurrentCompany = async () => {
@@ -803,17 +591,16 @@ var ReactContext = createContext(AppProviderInitialValue);
803
591
  var AppProvider = ({
804
592
  children,
805
593
  menuParams,
806
- aid,
807
- i18n
594
+ aid
808
595
  }) => {
809
596
  const { env } = (0, provider_exports.useEnv)();
810
- const user = useUser({ service: env.default_service, i18n });
597
+ const user = useUser({ service: env.default_service });
811
598
  const company = useCompany({ service: env.default_service });
812
599
  const menuContext = useMemo4(() => {
813
- return (0, utils_exports.combineContexts)([
600
+ return combineContexts([
814
601
  {
815
602
  ...user?.context,
816
- ...!isObjectEmpty(env?.user) ? { lang: env?.context?.lang } : {},
603
+ ...!(0, utils_exports.isObjectEmpty)(env?.user) ? { lang: env?.context?.lang } : {},
817
604
  ...menuParams?.context ?? {}
818
605
  }
819
606
  ]);
@@ -830,7 +617,7 @@ var AppProvider = ({
830
617
  return menu?.state?.action;
831
618
  }, [menu?.state?.action, env?.context?.lang]);
832
619
  const viewContext = useMemo4(() => {
833
- return (0, utils_exports.combineContexts)([
620
+ return combineContexts([
834
621
  menuContext,
835
622
  { ...(0, utils_exports.evalJSONContext)(action?.context) }
836
623
  ]);
@@ -967,14 +754,46 @@ var useGetSpecification = ({
967
754
  import { useMemo as useMemo6, useState as useState5 } from "react";
968
755
  import {
969
756
  evalJSONDomain,
970
- formatSortingString
757
+ formatSortingString,
758
+ isObjectEmpty as isObjectEmpty4
971
759
  } from "@fctc/interface-logic/utils";
972
760
 
761
+ // src/hooks/utils/use-click-outside.ts
762
+ import { useEffect as useEffect6, useRef } from "react";
763
+ var DEFAULT_EVENTS = ["mousedown", "touchstart"];
764
+ var useClickOutside = ({
765
+ handler,
766
+ events = DEFAULT_EVENTS,
767
+ nodes = [],
768
+ refs
769
+ }) => {
770
+ const ref = useRef(null);
771
+ useEffect6(() => {
772
+ const listener = (event) => {
773
+ const { target } = event;
774
+ if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
775
+ return;
776
+ }
777
+ if (!(target instanceof HTMLElement)) return;
778
+ const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
779
+ const shouldTrigger = nodes.length > 0 ? nodes.every((node) => node && !event.composedPath().includes(node)) : ref.current && !ref.current.contains(target);
780
+ if (shouldTrigger && !shouldIgnore) {
781
+ handler(event);
782
+ }
783
+ };
784
+ events.forEach((event) => document.addEventListener(event, listener));
785
+ return () => {
786
+ events.forEach((event) => document.removeEventListener(event, listener));
787
+ };
788
+ }, [handler, nodes, events]);
789
+ return ref;
790
+ };
791
+
973
792
  // src/hooks/utils/use-debounce.ts
974
- import { useEffect as useEffect6, useState as useState3 } from "react";
793
+ import { useEffect as useEffect7, useState as useState3 } from "react";
975
794
  function useDebounce(value, delay) {
976
795
  const [debouncedValue, setDebouncedValue] = useState3(value);
977
- useEffect6(() => {
796
+ useEffect7(() => {
978
797
  const handler = setTimeout(() => {
979
798
  setDebouncedValue(value);
980
799
  }, delay);
@@ -986,7 +805,7 @@ function useDebounce(value, delay) {
986
805
  }
987
806
 
988
807
  // src/hooks/utils/use-get-rowids.ts
989
- import { useCallback as useCallback3, useEffect as useEffect7, useRef, useState as useState4 } from "react";
808
+ import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef2, useState as useState4 } from "react";
990
809
  var useGetRowIds = (tableRef) => {
991
810
  function isElementVisible(el) {
992
811
  const style = window.getComputedStyle(el);
@@ -1004,7 +823,7 @@ var useGetRowIds = (tableRef) => {
1004
823
  return true;
1005
824
  }
1006
825
  const [rowIds, setRowIds] = useState4([]);
1007
- const lastRowIdsRef = useRef([]);
826
+ const lastRowIdsRef = useRef2([]);
1008
827
  const updateVisibleRowIds = useCallback3(() => {
1009
828
  const table = tableRef.current;
1010
829
  if (!table) return;
@@ -1023,7 +842,7 @@ var useGetRowIds = (tableRef) => {
1023
842
  setRowIds(uniqueIds);
1024
843
  }
1025
844
  }, [tableRef]);
1026
- useEffect7(() => {
845
+ useEffect8(() => {
1027
846
  const table = tableRef.current;
1028
847
  if (!table) return;
1029
848
  const mutationObserver = new MutationObserver(() => {
@@ -1122,7 +941,7 @@ var useListData = ({
1122
941
  listDataProps?.specification,
1123
942
  listDataProps?.mode
1124
943
  ],
1125
- !!listDataProps && !!specification && !isObjectEmpty(specification) && !!domain,
944
+ !!listDataProps && !!specification && !isObjectEmpty4(specification) && !!domain,
1126
945
  service,
1127
946
  xNode
1128
947
  );
@@ -1154,6 +973,7 @@ export {
1154
973
  useChangeOrderPreparationState,
1155
974
  useChangeStatus,
1156
975
  useCheckPayment,
976
+ useClickOutside,
1157
977
  useCompany,
1158
978
  useConfig,
1159
979
  useCreateEntity,
@@ -1190,6 +1010,7 @@ export {
1190
1010
  useGetFileExcel,
1191
1011
  useGetFormView,
1192
1012
  useGetGroups,
1013
+ useGetImage,
1193
1014
  useGetList,
1194
1015
  useGetListCompany,
1195
1016
  useGetListData,
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>>;
4
+
5
+ declare const LoadingIcon: ({ width, height, ...props }: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
6
+
7
+ declare const CloseIcon: ({ className }: {
8
+ className?: string;
9
+ }) => react_jsx_runtime.JSX.Element;
10
+
11
+ declare const FilterIcon: ({ className }: {
12
+ className?: string;
13
+ }) => react_jsx_runtime.JSX.Element;
14
+
15
+ declare const CheckIcon: () => react_jsx_runtime.JSX.Element;
16
+
17
+ declare const GroupByIcon: ({ className }: {
18
+ className?: string;
19
+ }) => react_jsx_runtime.JSX.Element;
20
+
21
+ declare const SearchIcon: () => react_jsx_runtime.JSX.Element;
22
+
23
+ declare const ChevronBottomIcon: ({ className, }: {
24
+ className?: string;
25
+ }) => react_jsx_runtime.JSX.Element;
26
+
27
+ export { CheckIcon, ChevronBottomIcon, CloseIcon, EyeIcon, FilterIcon, GroupByIcon, LoadingIcon, SearchIcon };
@@ -0,0 +1,27 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ declare const EyeIcon: React.FC<React.SVGProps<SVGSVGElement>>;
4
+
5
+ declare const LoadingIcon: ({ width, height, ...props }: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
6
+
7
+ declare const CloseIcon: ({ className }: {
8
+ className?: string;
9
+ }) => react_jsx_runtime.JSX.Element;
10
+
11
+ declare const FilterIcon: ({ className }: {
12
+ className?: string;
13
+ }) => react_jsx_runtime.JSX.Element;
14
+
15
+ declare const CheckIcon: () => react_jsx_runtime.JSX.Element;
16
+
17
+ declare const GroupByIcon: ({ className }: {
18
+ className?: string;
19
+ }) => react_jsx_runtime.JSX.Element;
20
+
21
+ declare const SearchIcon: () => react_jsx_runtime.JSX.Element;
22
+
23
+ declare const ChevronBottomIcon: ({ className, }: {
24
+ className?: string;
25
+ }) => react_jsx_runtime.JSX.Element;
26
+
27
+ export { CheckIcon, ChevronBottomIcon, CloseIcon, EyeIcon, FilterIcon, GroupByIcon, LoadingIcon, SearchIcon };