@fctc/sme-widget-ui 2.2.8 → 2.3.0

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/widgets.mjs CHANGED
@@ -9946,7 +9946,7 @@ var Row = (props) => {
9946
9946
  children: /* @__PURE__ */ jsx47(DeleteIcon, {})
9947
9947
  }
9948
9948
  ) }) }),
9949
- columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ jsx47(
9949
+ (!onAddRow || typeof onAddRow !== "function") && columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ jsx47(
9950
9950
  "td",
9951
9951
  {
9952
9952
  style: {
@@ -10058,346 +10058,65 @@ var TableBody = (props) => {
10058
10058
  };
10059
10059
 
10060
10060
  // src/widgets/advanced/table/table-filter.tsx
10061
- import { useEffect as useEffect6, useRef as useRef5, useState as useState4 } from "react";
10062
- import { createPortal } from "react-dom";
10063
-
10064
- // src/hooks/use-click-outside.ts
10065
- import { useEffect as useEffect4, useRef as useRef3 } from "react";
10066
- var DEFAULT_EVENTS = ["mousedown", "touchstart"];
10067
- var useClickOutside = ({
10068
- handler,
10069
- events = DEFAULT_EVENTS,
10070
- nodes = [],
10071
- // Default to empty array to avoid undefined errors
10072
- refs
10073
- }) => {
10074
- const ref = useRef3(null);
10075
- useEffect4(() => {
10076
- const listener = (event) => {
10077
- const { target } = event;
10078
- if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
10079
- return;
10080
- }
10081
- if (!(target instanceof HTMLElement)) return;
10082
- const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
10083
- const shouldTrigger = nodes.length > 0 ? nodes.every((node2) => node2 && !event.composedPath().includes(node2)) : ref.current && !ref.current.contains(target);
10084
- if (shouldTrigger && !shouldIgnore) {
10085
- handler(event);
10086
- }
10087
- };
10088
- events.forEach((event) => document.addEventListener(event, listener));
10089
- return () => {
10090
- events.forEach((event) => document.removeEventListener(event, listener));
10091
- };
10092
- }, [handler, nodes, events]);
10093
- return ref;
10094
- };
10095
-
10096
- // src/hooks/use-get-file-infor.ts
10097
- import { useEffect as useEffect5, useRef as useRef4, useState as useState3 } from "react";
10098
- function getFileName(source, mime) {
10099
- if (source instanceof File) return source.name;
10100
- if (typeof source === "string") {
10101
- if (source.startsWith("data:")) {
10102
- const ext2 = mime?.split("/")[1] || "bin";
10103
- return `file.${ext2}`;
10104
- }
10105
- try {
10106
- const pathname = new URL(source).pathname;
10107
- const filename = decodeURIComponent(pathname.split("/").pop() || "");
10108
- if (filename) return filename;
10109
- } catch {
10110
- }
10111
- return "file.bin";
10112
- }
10113
- const ext = mime?.split("/")[1] || "bin";
10114
- return `file.${ext}`;
10115
- }
10116
- function useFileInfo(source, options2) {
10117
- const { readAs = "all" } = options2 ?? {};
10118
- const [info, setInfo] = useState3(null);
10119
- const [loading, setLoading] = useState3(false);
10120
- const [error2, setError] = useState3(null);
10121
- const abortRef = useRef4({ aborted: false });
10122
- useEffect5(() => {
10123
- abortRef.current.aborted = false;
10124
- if (!source) {
10125
- setInfo(null);
10126
- setLoading(false);
10127
- setError(null);
10128
- return;
10129
- }
10130
- let localUrl = null;
10131
- let fr = null;
10132
- let mediaEl = null;
10133
- const makeExtension = (name2, type) => {
10134
- if (name2) {
10135
- const idx = name2.lastIndexOf(".");
10136
- if (idx > -1) return name2.slice(idx + 1).toLowerCase();
10137
- }
10138
- if (type) {
10139
- const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
10140
- return match3 ? match3[1] : null;
10141
- }
10142
- return null;
10143
- };
10144
- const toBlobFromSource = async (src) => {
10145
- if (src instanceof Blob) return src;
10146
- if (typeof src === "string") {
10147
- const s4 = src.trim();
10148
- if (s4.startsWith("data:")) {
10149
- const parts = s4.split(",");
10150
- const meta = parts[0];
10151
- const isBase64 = meta.includes(";base64");
10152
- const mimeMatch = meta.match(/data:([^;]+)/);
10153
- const mime = mimeMatch ? mimeMatch[1] : "application/octet-stream";
10154
- const dataPart = parts.slice(1).join(",");
10155
- if (isBase64) {
10156
- const binary = atob(dataPart);
10157
- const len = binary.length;
10158
- const arr = new Uint8Array(len);
10159
- for (let i3 = 0; i3 < len; i3++) arr[i3] = binary.charCodeAt(i3);
10160
- return new Blob([arr], { type: mime });
10161
- } else {
10162
- const decoded = decodeURIComponent(dataPart);
10163
- return new Blob([decoded], { type: mime });
10164
- }
10165
- }
10166
- const resp = await fetch(s4);
10167
- if (!resp.ok) throw new Error(`Fetch failed with status ${resp.status}`);
10168
- const blob = await resp.blob();
10169
- return blob;
10170
- }
10171
- throw new Error("Unsupported source type");
10172
- };
10173
- const run = async () => {
10174
- setLoading(true);
10175
- setError(null);
10176
- setInfo(null);
10177
- try {
10178
- const blob = await toBlobFromSource(source);
10179
- if (abortRef.current.aborted) return;
10180
- const fileInfo = {
10181
- rawBlob: blob,
10182
- size: blob.size,
10183
- type: blob.type || "application/octet-stream",
10184
- dataUrl: null,
10185
- text: null,
10186
- arrayBuffer: null,
10187
- image: null,
10188
- video: null,
10189
- audio: null
10190
- };
10191
- if (source instanceof File || source instanceof Blob || typeof source === "string" && !source.startsWith("data:")) {
10192
- fileInfo.name = getFileName(source, fileInfo.type);
10193
- }
10194
- fileInfo.extension = makeExtension(fileInfo.name, fileInfo.type);
10195
- localUrl = URL.createObjectURL(blob);
10196
- const readPromises = [];
10197
- if (readAs === "dataUrl" || readAs === "all") {
10198
- fr = new FileReader();
10199
- const p = new Promise((resolve, reject) => {
10200
- fr.onload = () => {
10201
- if (abortRef.current.aborted) return resolve();
10202
- fileInfo.dataUrl = fr.result;
10203
- resolve();
10204
- };
10205
- fr.onerror = () => reject(fr.error);
10206
- fr.readAsDataURL(blob);
10207
- });
10208
- readPromises.push(p);
10209
- }
10210
- if (readAs === "text" || readAs === "all") {
10211
- const frText = new FileReader();
10212
- const p = new Promise((resolve, reject) => {
10213
- frText.onload = () => {
10214
- if (abortRef.current.aborted) return resolve();
10215
- fileInfo.text = frText.result;
10216
- resolve();
10217
- };
10218
- frText.onerror = () => reject(frText.error);
10219
- frText.readAsText(blob);
10220
- });
10221
- readPromises.push(p);
10222
- }
10223
- if (readAs === "arrayBuffer" || readAs === "all") {
10224
- const frBuf = new FileReader();
10225
- const p = new Promise((resolve, reject) => {
10226
- frBuf.onload = () => {
10227
- if (abortRef.current.aborted) return resolve();
10228
- fileInfo.arrayBuffer = frBuf.result;
10229
- resolve();
10230
- };
10231
- frBuf.onerror = () => reject(frBuf.error);
10232
- frBuf.readAsArrayBuffer(blob);
10233
- });
10234
- readPromises.push(p);
10235
- }
10236
- if (fileInfo?.type?.startsWith("image/")) {
10237
- const p = new Promise((resolve, reject) => {
10238
- const img = new Image();
10239
- img.onload = () => {
10240
- if (abortRef.current.aborted) return resolve();
10241
- fileInfo.image = {
10242
- width: img.naturalWidth,
10243
- height: img.naturalHeight
10244
- };
10245
- resolve();
10246
- };
10247
- img.onerror = () => resolve();
10248
- img.src = localUrl;
10249
- });
10250
- readPromises.push(p);
10251
- }
10252
- if (fileInfo && fileInfo?.type?.startsWith("video/") || fileInfo?.type?.startsWith("audio/")) {
10253
- const p = new Promise((resolve) => {
10254
- const el = document.createElement(
10255
- fileInfo?.type?.startsWith("video/") ? "video" : "audio"
10256
- );
10257
- mediaEl = el;
10258
- mediaEl.preload = "metadata";
10259
- mediaEl.onloadedmetadata = () => {
10260
- if (abortRef.current.aborted) return resolve();
10261
- const duration = isFinite(mediaEl.duration) ? mediaEl.duration : void 0;
10262
- if (fileInfo?.type?.startsWith("video/")) {
10263
- fileInfo.video = {
10264
- width: mediaEl.videoWidth || void 0,
10265
- height: mediaEl.videoHeight || void 0,
10266
- duration
10267
- };
10268
- } else {
10269
- fileInfo.audio = { duration };
10270
- }
10271
- resolve();
10272
- };
10273
- mediaEl.onerror = () => resolve();
10274
- mediaEl.src = localUrl;
10275
- });
10276
- readPromises.push(p);
10277
- }
10278
- await Promise.all(readPromises);
10279
- if (abortRef.current.aborted) return;
10280
- setInfo(fileInfo);
10281
- } catch (err) {
10282
- if (!abortRef.current.aborted) setError(err?.message ?? String(err));
10283
- } finally {
10284
- if (!abortRef.current.aborted) setLoading(false);
10285
- }
10286
- };
10287
- run();
10288
- return () => {
10289
- abortRef.current.aborted = true;
10290
- if (fr && fr.readyState === 1) {
10291
- try {
10292
- fr.abort();
10293
- } catch {
10294
- }
10295
- }
10296
- if (mediaEl) {
10297
- try {
10298
- mediaEl.src = "";
10299
- mediaEl.load();
10300
- } catch {
10301
- }
10302
- }
10303
- if (localUrl) URL.revokeObjectURL(localUrl);
10304
- };
10305
- }, [source, readAs]);
10306
- return { info, loading, error: error2, reload: () => {
10307
- } };
10308
- }
10309
-
10310
- // src/widgets/advanced/table/table-filter.tsx
10061
+ import { Popover, PopoverButton, PopoverPanel } from "@headlessui/react";
10311
10062
  import { jsx as jsx49, jsxs as jsxs27 } from "react/jsx-runtime";
10312
10063
  var TableFilter = ({ columns, onToggleColumnOptional }) => {
10313
- const [openTableFilter, setOpenTableFilter] = useState4();
10314
- const [filterPosition, setFilterPosition] = useState4(null);
10315
- const filterPopupRef = useRef5(null);
10316
- const filterRef = useClickOutside({
10317
- handler: () => {
10318
- if (openTableFilter) {
10319
- setOpenTableFilter(false);
10320
- }
10321
- },
10322
- refs: [filterPopupRef]
10323
- });
10324
- useEffect6(() => {
10325
- const updatePosition = () => {
10326
- if (filterRef.current && openTableFilter) {
10327
- const rect = filterRef.current.getBoundingClientRect();
10328
- setFilterPosition({
10329
- top: rect.bottom + window.scrollY,
10330
- left: rect.left + window.scrollX,
10331
- right: window.innerWidth - rect.right
10332
- });
10333
- }
10334
- };
10335
- updatePosition();
10336
- window.addEventListener("scroll", updatePosition);
10337
- window.addEventListener("resize", updatePosition);
10338
- return () => {
10339
- window.removeEventListener("scroll", updatePosition);
10340
- window.removeEventListener("resize", updatePosition);
10341
- };
10342
- }, [filterRef, openTableFilter]);
10343
- return /* @__PURE__ */ jsxs27(
10064
+ return /* @__PURE__ */ jsx49(
10344
10065
  "div",
10345
10066
  {
10346
- ref: filterRef,
10347
10067
  style: {
10348
10068
  transform: "translateY(-50%)"
10349
10069
  },
10350
- className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-white",
10351
- children: [
10352
- /* @__PURE__ */ jsx49(
10070
+ className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
10071
+ children: /* @__PURE__ */ jsxs27(Popover, { children: [
10072
+ /* @__PURE__ */ jsx49(PopoverButton, { className: "p-2 rounded-lg cursor-pointer outline-none", children: /* @__PURE__ */ jsx49(
10353
10073
  "button",
10354
10074
  {
10355
10075
  type: "button",
10356
10076
  className: "bg-white size-8 p-1 rounded-lg cursor-pointer flex items-center justify-center",
10357
- onClick: () => {
10358
- setOpenTableFilter(!openTableFilter);
10359
- },
10360
10077
  children: /* @__PURE__ */ jsx49(FilterColumnIcon, {})
10361
10078
  }
10362
- ),
10363
- filterPosition && openTableFilter && createPortal(
10364
- /* @__PURE__ */ jsx49(
10365
- "div",
10366
- {
10367
- ref: filterPopupRef,
10368
- style: {
10369
- top: filterPosition?.top,
10370
- right: filterPosition?.right,
10371
- zIndex: 9999
10372
- },
10373
- className: "absolute z-[9999] flex w-[250px] h-auto max-h-[800%] overflow-auto flex-col gap-[16px] rounded-[8px] bg-[#fff] px-[24px] py-[16px] shadow-md",
10374
- children: columns?.filter((val) => val?.optional !== void 0)?.map((item) => {
10375
- return /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
10376
- /* @__PURE__ */ jsx49(
10377
- "input",
10378
- {
10379
- type: "checkbox",
10380
- id: `${item.name}`,
10381
- onChange: () => onToggleColumnOptional(item),
10382
- checked: item.optional !== "hide",
10383
- className: "cursor-pointer"
10384
- }
10385
- ),
10386
- /* @__PURE__ */ jsx49(
10387
- "label",
10388
- {
10389
- htmlFor: `${item.name}`,
10390
- className: "flex items-center gap-[8px]",
10391
- children: item.field.string
10392
- }
10393
- )
10394
- ] }, item.name);
10395
- })
10396
- }
10397
- ),
10398
- document.body
10079
+ ) }),
10080
+ /* @__PURE__ */ jsx49(
10081
+ PopoverPanel,
10082
+ {
10083
+ transition: true,
10084
+ anchor: "bottom end",
10085
+ className: "shadow-lg z-[99] gap-2 bg-white rounded-lg transition duration-200 ease-in-out border border-stroke-disabled",
10086
+ children: /* @__PURE__ */ jsx49(
10087
+ "div",
10088
+ {
10089
+ style: {
10090
+ zIndex: 9999
10091
+ },
10092
+ className: "flex w-[250px] h-auto overflow-auto flex-col gap-[16px] rounded-[8px] bg-[#fff] px-[24px] py-[16px] shadow-md",
10093
+ children: columns?.filter((val) => val?.optional !== void 0)?.map((item) => {
10094
+ return /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
10095
+ /* @__PURE__ */ jsx49(
10096
+ "input",
10097
+ {
10098
+ type: "checkbox",
10099
+ id: `${item.name}`,
10100
+ onChange: () => onToggleColumnOptional(item),
10101
+ checked: item.optional !== "hide",
10102
+ className: "cursor-pointer"
10103
+ }
10104
+ ),
10105
+ /* @__PURE__ */ jsx49(
10106
+ "label",
10107
+ {
10108
+ htmlFor: `${item.name}`,
10109
+ className: "flex items-center gap-[8px]",
10110
+ children: item.field.string
10111
+ }
10112
+ )
10113
+ ] }, item.name);
10114
+ })
10115
+ }
10116
+ )
10117
+ }
10399
10118
  )
10400
- ]
10119
+ ] })
10401
10120
  }
10402
10121
  );
10403
10122
  };
@@ -12260,7 +11979,7 @@ var M = e2.forwardRef(({ id: t3, anchorId: l2, anchorSelect: n4, content: i3, ht
12260
11979
  });
12261
11980
 
12262
11981
  // src/widgets/advanced/table/table-head.tsx
12263
- import { createPortal as createPortal2 } from "react-dom";
11982
+ import { createPortal } from "react-dom";
12264
11983
  import { Fragment as Fragment4, jsx as jsx51, jsxs as jsxs29 } from "react/jsx-runtime";
12265
11984
  var TableHead = (props) => {
12266
11985
  const {
@@ -12308,7 +12027,7 @@ var TableHead = (props) => {
12308
12027
  children: /* @__PURE__ */ jsxs29("div", { className: "cursor-pointer flex items-center gap-[4px] w-full group relative", children: [
12309
12028
  /* @__PURE__ */ jsx51("span", { className: "truncate line-clamp-1 w-fit", children: col.title }),
12310
12029
  col?.field?.help && /* @__PURE__ */ jsxs29(Fragment4, { children: [
12311
- createPortal2(
12030
+ createPortal(
12312
12031
  /* @__PURE__ */ jsx51(
12313
12032
  M,
12314
12033
  {
@@ -14570,7 +14289,7 @@ var Button = React2.forwardRef(
14570
14289
  Button.displayName = "Button";
14571
14290
 
14572
14291
  // src/widgets/advanced/login/shared/text-input.tsx
14573
- import { useState as useState5 } from "react";
14292
+ import { useState as useState3 } from "react";
14574
14293
  import { jsx as jsx55, jsxs as jsxs32 } from "react/jsx-runtime";
14575
14294
  function TextInput(props) {
14576
14295
  const {
@@ -14584,7 +14303,7 @@ function TextInput(props) {
14584
14303
  errors,
14585
14304
  required
14586
14305
  } = props;
14587
- const [showPassword, setShowPassword] = useState5(false);
14306
+ const [showPassword, setShowPassword] = useState3(false);
14588
14307
  return /* @__PURE__ */ jsxs32("div", { className: `flex justify-center gap-2 flex-col ${className}`, children: [
14589
14308
  label && /* @__PURE__ */ jsxs32("label", { className: "text-[#262626] text-sm leading-5 font-semibold", children: [
14590
14309
  label,
@@ -14626,7 +14345,7 @@ function TextInput(props) {
14626
14345
  }
14627
14346
 
14628
14347
  // src/widgets/advanced/login/provider/credential/form-options/index.tsx
14629
- import { useEffect as useEffect7 } from "react";
14348
+ import { useEffect as useEffect4 } from "react";
14630
14349
  import { jsx as jsx56, jsxs as jsxs33 } from "react/jsx-runtime";
14631
14350
  var STAY_LOGIN_IN = "stayLoginIn";
14632
14351
  function FormOptions({
@@ -14650,7 +14369,7 @@ function FormOptions({
14650
14369
  }
14651
14370
  }
14652
14371
  }
14653
- useEffect7(() => {
14372
+ useEffect4(() => {
14654
14373
  localStorage.setItem(STAY_LOGIN_IN, "false");
14655
14374
  }, []);
14656
14375
  return /* @__PURE__ */ jsxs33("div", { className: "flex justify-between items-center text-[#005aa9] text-sm leading-5 font-medium select-none", children: [
@@ -14758,204 +14477,450 @@ var CredentialLogin = (props) => {
14758
14477
  ) })
14759
14478
  ]
14760
14479
  }
14761
- ),
14762
- shouldRenderDivider && /* @__PURE__ */ jsxs34("div", { className: "flex justify-center relative", children: [
14763
- /* @__PURE__ */ jsx57("div", { className: "absolute inset-x-0 top-[calc(50%-0.5px)] h-[0.8px] bg-gray-300" }),
14764
- /* @__PURE__ */ jsx57("span", { className: "relative font-medium text-sm inline-block bg-white px-2.5 text-[#6e6e6e]", children: "ho\u1EB7c" })
14765
- ] })
14766
- ] });
14767
- };
14768
-
14769
- // src/widgets/advanced/login/provider/google/google-btn/index.tsx
14770
- import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
14771
- function GoogleButton(props) {
14772
- const { onLoginGoogle, db } = props;
14773
- return /* @__PURE__ */ jsxs35(
14774
- "button",
14775
- {
14776
- className: "google-wrapper w-full active:scale-[0.97] cursor-pointer hover:bg-gray-100 scale-100 transition-all gap-2 p-4 border border-[#e5e7eb] rounded-[10px] flex items-center justify-center bg-white",
14777
- onClick: () => onLoginGoogle?.(db),
14778
- children: [
14779
- /* @__PURE__ */ jsx58(GoogleIcon, { className: "google-icon" }),
14780
- /* @__PURE__ */ jsx58("span", { className: "google-title font-bold text-base", children: "\u0110\u0103ng nh\u1EADp v\u1EDBi google" })
14781
- ]
14782
- }
14783
- );
14784
- }
14785
-
14786
- // src/widgets/advanced/login/provider/google/redirect/index.tsx
14787
- import { Fragment as Fragment6, jsx as jsx59 } from "react/jsx-runtime";
14788
- function SocialRedirect(props) {
14789
- const { db, onLoginSocial } = props;
14790
- onLoginSocial && onLoginSocial(String(db));
14791
- return /* @__PURE__ */ jsx59(Fragment6, {});
14792
- }
14793
-
14794
- // src/widgets/advanced/login/provider/google/index.tsx
14795
- import { Fragment as Fragment7, jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
14796
- var GoogleLogin = ({ db, onLoginSocial, onLoginGoogle }) => {
14797
- return /* @__PURE__ */ jsxs36(Fragment7, { children: [
14798
- /* @__PURE__ */ jsx60(GoogleButton, { db, onLoginGoogle }),
14799
- /* @__PURE__ */ jsx60(SocialRedirect, { db, onLoginSocial })
14800
- ] });
14801
- };
14802
-
14803
- // src/widgets/advanced/login/index.tsx
14804
- import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
14805
- var LoginProviderMapping = {
14806
- google: GoogleLogin
14807
- };
14808
- var Login = (props) => {
14809
- const { providers = [], forgotPasswordUrl = "/", db, onLoginSocial, onLoginGoogle } = props;
14810
- return /* @__PURE__ */ jsxs37("div", { className: "w-full space-y-8", children: [
14811
- /* @__PURE__ */ jsx61(
14812
- CredentialLogin,
14813
- {
14814
- ...props,
14815
- forgotPasswordUrl,
14816
- shouldRenderDivider: providers.length > 0
14480
+ ),
14481
+ shouldRenderDivider && /* @__PURE__ */ jsxs34("div", { className: "flex justify-center relative", children: [
14482
+ /* @__PURE__ */ jsx57("div", { className: "absolute inset-x-0 top-[calc(50%-0.5px)] h-[0.8px] bg-gray-300" }),
14483
+ /* @__PURE__ */ jsx57("span", { className: "relative font-medium text-sm inline-block bg-white px-2.5 text-[#6e6e6e]", children: "ho\u1EB7c" })
14484
+ ] })
14485
+ ] });
14486
+ };
14487
+
14488
+ // src/widgets/advanced/login/provider/google/google-btn/index.tsx
14489
+ import { jsx as jsx58, jsxs as jsxs35 } from "react/jsx-runtime";
14490
+ function GoogleButton(props) {
14491
+ const { onLoginGoogle, db } = props;
14492
+ return /* @__PURE__ */ jsxs35(
14493
+ "button",
14494
+ {
14495
+ className: "google-wrapper w-full active:scale-[0.97] cursor-pointer hover:bg-gray-100 scale-100 transition-all gap-2 p-4 border border-[#e5e7eb] rounded-[10px] flex items-center justify-center bg-white",
14496
+ onClick: () => onLoginGoogle?.(db),
14497
+ children: [
14498
+ /* @__PURE__ */ jsx58(GoogleIcon, { className: "google-icon" }),
14499
+ /* @__PURE__ */ jsx58("span", { className: "google-title font-bold text-base", children: "\u0110\u0103ng nh\u1EADp v\u1EDBi google" })
14500
+ ]
14501
+ }
14502
+ );
14503
+ }
14504
+
14505
+ // src/widgets/advanced/login/provider/google/redirect/index.tsx
14506
+ import { Fragment as Fragment6, jsx as jsx59 } from "react/jsx-runtime";
14507
+ function SocialRedirect(props) {
14508
+ const { db, onLoginSocial } = props;
14509
+ onLoginSocial && onLoginSocial(String(db));
14510
+ return /* @__PURE__ */ jsx59(Fragment6, {});
14511
+ }
14512
+
14513
+ // src/widgets/advanced/login/provider/google/index.tsx
14514
+ import { Fragment as Fragment7, jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
14515
+ var GoogleLogin = ({ db, onLoginSocial, onLoginGoogle }) => {
14516
+ return /* @__PURE__ */ jsxs36(Fragment7, { children: [
14517
+ /* @__PURE__ */ jsx60(GoogleButton, { db, onLoginGoogle }),
14518
+ /* @__PURE__ */ jsx60(SocialRedirect, { db, onLoginSocial })
14519
+ ] });
14520
+ };
14521
+
14522
+ // src/widgets/advanced/login/index.tsx
14523
+ import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
14524
+ var LoginProviderMapping = {
14525
+ google: GoogleLogin
14526
+ };
14527
+ var Login = (props) => {
14528
+ const { providers = [], forgotPasswordUrl = "/", db, onLoginSocial, onLoginGoogle } = props;
14529
+ return /* @__PURE__ */ jsxs37("div", { className: "w-full space-y-8", children: [
14530
+ /* @__PURE__ */ jsx61(
14531
+ CredentialLogin,
14532
+ {
14533
+ ...props,
14534
+ forgotPasswordUrl,
14535
+ shouldRenderDivider: providers.length > 0
14536
+ }
14537
+ ),
14538
+ providers.map((provider, index4) => {
14539
+ const ProviderComp = LoginProviderMapping[provider];
14540
+ return /* @__PURE__ */ jsx61(
14541
+ ProviderComp,
14542
+ {
14543
+ db,
14544
+ onLoginSocial: () => onLoginSocial?.(db),
14545
+ onLoginGoogle: () => onLoginGoogle?.(db)
14546
+ },
14547
+ index4
14548
+ );
14549
+ })
14550
+ ] });
14551
+ };
14552
+
14553
+ // src/widgets/advanced/search/popup-filter/index.tsx
14554
+ import { jsx as jsx62, jsxs as jsxs38 } from "react/jsx-runtime";
14555
+ var PopupFilter = ({
14556
+ handleAddTagSearch,
14557
+ removeSearchItems,
14558
+ groupBy,
14559
+ filterBy,
14560
+ setFilterBy,
14561
+ setGroupBy,
14562
+ fields
14563
+ }) => {
14564
+ const { t: t3 } = useI18n();
14565
+ return /* @__PURE__ */ jsx62(
14566
+ "div",
14567
+ {
14568
+ style: {
14569
+ position: "absolute",
14570
+ top: "calc(100% + 3px)",
14571
+ right: 0,
14572
+ zIndex: 33
14573
+ },
14574
+ className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
14575
+ children: /* @__PURE__ */ jsxs38(
14576
+ "div",
14577
+ {
14578
+ className: `flex py-3 ${(filterBy?.length === 0 || groupBy?.length === 0) && "!grid-cols-1"}`,
14579
+ children: [
14580
+ filterBy?.length > 0 && /* @__PURE__ */ jsxs38("div", { className: "filter-by w-full px-3", children: [
14581
+ /* @__PURE__ */ jsxs38("div", { className: "flex w-fit items-center justify-start gap-2 px-3 py-1", children: [
14582
+ /* @__PURE__ */ jsx62(FilterIcon, { className: "filter-by-icon text-primary" }),
14583
+ /* @__PURE__ */ jsx62("span", { className: "font-bold text-sm text-[#212529]", children: t3("filter_by") })
14584
+ ] }),
14585
+ filterBy?.reduce((acc, item, index4, array) => {
14586
+ const prevItem = array[index4 - 1];
14587
+ const isDifferentGroup = prevItem && prevItem?.group_index !== item?.group_index;
14588
+ const isExist = item?.active;
14589
+ if (isDifferentGroup) {
14590
+ acc.push(/* @__PURE__ */ jsx62("hr", { className: "my-2" }, "separator-" + index4));
14591
+ }
14592
+ acc.push(
14593
+ /* @__PURE__ */ jsxs38(
14594
+ "button",
14595
+ {
14596
+ className: `filter-by-item w-full flex items-center gap-2 bg-white px-3 py-1 text-left cursor-pointer ${isExist ? "filter-by-checked font-semibold " : "hover:!bg-[rgba(0,0,0,0.08)]"}`,
14597
+ onClick: () => {
14598
+ const newFilterBy = filterBy?.map(
14599
+ (tag) => tag?.name === item?.name ? { ...tag, active: !tag?.active } : tag
14600
+ );
14601
+ setFilterBy(newFilterBy);
14602
+ if (isExist) {
14603
+ typeof removeSearchItems === "function" && removeSearchItems(
14604
+ `${SearchType.FILTER}_${item.group_index}`,
14605
+ item
14606
+ );
14607
+ return;
14608
+ }
14609
+ typeof handleAddTagSearch === "function" && handleAddTagSearch({
14610
+ name: item?.name,
14611
+ value: item?.string ?? item?.help,
14612
+ domain: item?.domain,
14613
+ groupIndex: item?.group_index,
14614
+ type: SearchType.FILTER
14615
+ });
14616
+ },
14617
+ children: [
14618
+ isExist && /* @__PURE__ */ jsx62(CheckIcon, {}),
14619
+ /* @__PURE__ */ jsx62("span", { className: "text-sm", children: item?.string ?? item?.help })
14620
+ ]
14621
+ },
14622
+ "filter-" + index4
14623
+ )
14624
+ );
14625
+ return acc;
14626
+ }, [])
14627
+ ] }),
14628
+ filterBy?.length > 0 && groupBy?.length > 0 && /* @__PURE__ */ jsx62("div", { className: "h-['initial'] w-[1px] bg-[#dee2e6]" }),
14629
+ groupBy?.length > 0 && /* @__PURE__ */ jsxs38("div", { className: "group-by w-full px-3", children: [
14630
+ /* @__PURE__ */ jsxs38("div", { className: "flex w-fit items-center justify-start gap-2 px-3 py-1", children: [
14631
+ /* @__PURE__ */ jsx62(GroupByIcon, { className: "group-by-icon text-primary" }),
14632
+ /* @__PURE__ */ jsx62("span", { className: "font-bold text-sm text-[#212529]", children: t3("group_by") })
14633
+ ] }),
14634
+ groupBy?.map((item, index4) => {
14635
+ const isExist = item?.active;
14636
+ if (!item.string) return;
14637
+ return /* @__PURE__ */ jsxs38(
14638
+ "button",
14639
+ {
14640
+ onClick: () => {
14641
+ const formatArray = groupBy.map(
14642
+ (tag) => tag?.name === item?.name ? { ...tag, active: !tag?.active } : tag
14643
+ );
14644
+ setGroupBy(formatArray);
14645
+ if (isExist) {
14646
+ typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`, item);
14647
+ return;
14648
+ }
14649
+ typeof handleAddTagSearch === "function" && handleAddTagSearch({
14650
+ name: item?.name,
14651
+ value: item?.string,
14652
+ type: SearchType.GROUP,
14653
+ context: JSON.parse(item?.context.replace(/'/g, '"')),
14654
+ active: !isExist,
14655
+ dataIndex: index4,
14656
+ fieldsGroup: fields
14657
+ });
14658
+ },
14659
+ className: `group-by-item w-full flex items-center gap-2 bg-white px-3 py-1 text-left cursor-pointer ${isExist ? "group-by-checked font-semibold" : "hover:!bg-[rgba(0,0,0,0.08)]"}`,
14660
+ children: [
14661
+ isExist && /* @__PURE__ */ jsx62(CheckIcon, {}),
14662
+ /* @__PURE__ */ jsx62("span", { className: "text-sm", children: item?.string })
14663
+ ]
14664
+ },
14665
+ "groupby-" + index4 + 1
14666
+ );
14667
+ })
14668
+ ] })
14669
+ ]
14670
+ }
14671
+ )
14672
+ }
14673
+ );
14674
+ };
14675
+
14676
+ // src/widgets/advanced/search/search-item/index.tsx
14677
+ import { useEffect as useEffect7, useState as useState5 } from "react";
14678
+
14679
+ // src/hooks/use-click-outside.ts
14680
+ import { useEffect as useEffect5, useRef as useRef3 } from "react";
14681
+ var DEFAULT_EVENTS = ["mousedown", "touchstart"];
14682
+ var useClickOutside = ({
14683
+ handler,
14684
+ events = DEFAULT_EVENTS,
14685
+ nodes = [],
14686
+ // Default to empty array to avoid undefined errors
14687
+ refs
14688
+ }) => {
14689
+ const ref = useRef3(null);
14690
+ useEffect5(() => {
14691
+ const listener = (event) => {
14692
+ const { target } = event;
14693
+ if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
14694
+ return;
14695
+ }
14696
+ if (!(target instanceof HTMLElement)) return;
14697
+ const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
14698
+ const shouldTrigger = nodes.length > 0 ? nodes.every((node2) => node2 && !event.composedPath().includes(node2)) : ref.current && !ref.current.contains(target);
14699
+ if (shouldTrigger && !shouldIgnore) {
14700
+ handler(event);
14701
+ }
14702
+ };
14703
+ events.forEach((event) => document.addEventListener(event, listener));
14704
+ return () => {
14705
+ events.forEach((event) => document.removeEventListener(event, listener));
14706
+ };
14707
+ }, [handler, nodes, events]);
14708
+ return ref;
14709
+ };
14710
+
14711
+ // src/hooks/use-get-file-infor.ts
14712
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState4 } from "react";
14713
+ function getFileName(source, mime) {
14714
+ if (source instanceof File) return source.name;
14715
+ if (typeof source === "string") {
14716
+ if (source.startsWith("data:")) {
14717
+ const ext2 = mime?.split("/")[1] || "bin";
14718
+ return `file.${ext2}`;
14719
+ }
14720
+ try {
14721
+ const pathname = new URL(source).pathname;
14722
+ const filename = decodeURIComponent(pathname.split("/").pop() || "");
14723
+ if (filename) return filename;
14724
+ } catch {
14725
+ }
14726
+ return "file.bin";
14727
+ }
14728
+ const ext = mime?.split("/")[1] || "bin";
14729
+ return `file.${ext}`;
14730
+ }
14731
+ function useFileInfo(source, options2) {
14732
+ const { readAs = "all" } = options2 ?? {};
14733
+ const [info, setInfo] = useState4(null);
14734
+ const [loading, setLoading] = useState4(false);
14735
+ const [error2, setError] = useState4(null);
14736
+ const abortRef = useRef4({ aborted: false });
14737
+ useEffect6(() => {
14738
+ abortRef.current.aborted = false;
14739
+ if (!source) {
14740
+ setInfo(null);
14741
+ setLoading(false);
14742
+ setError(null);
14743
+ return;
14744
+ }
14745
+ let localUrl = null;
14746
+ let fr = null;
14747
+ let mediaEl = null;
14748
+ const makeExtension = (name2, type) => {
14749
+ if (name2) {
14750
+ const idx = name2.lastIndexOf(".");
14751
+ if (idx > -1) return name2.slice(idx + 1).toLowerCase();
14752
+ }
14753
+ if (type) {
14754
+ const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
14755
+ return match3 ? match3[1] : null;
14756
+ }
14757
+ return null;
14758
+ };
14759
+ const toBlobFromSource = async (src) => {
14760
+ if (src instanceof Blob) return src;
14761
+ if (typeof src === "string") {
14762
+ const s4 = src.trim();
14763
+ if (s4.startsWith("data:")) {
14764
+ const parts = s4.split(",");
14765
+ const meta = parts[0];
14766
+ const isBase64 = meta.includes(";base64");
14767
+ const mimeMatch = meta.match(/data:([^;]+)/);
14768
+ const mime = mimeMatch ? mimeMatch[1] : "application/octet-stream";
14769
+ const dataPart = parts.slice(1).join(",");
14770
+ if (isBase64) {
14771
+ const binary = atob(dataPart);
14772
+ const len = binary.length;
14773
+ const arr = new Uint8Array(len);
14774
+ for (let i3 = 0; i3 < len; i3++) arr[i3] = binary.charCodeAt(i3);
14775
+ return new Blob([arr], { type: mime });
14776
+ } else {
14777
+ const decoded = decodeURIComponent(dataPart);
14778
+ return new Blob([decoded], { type: mime });
14779
+ }
14780
+ }
14781
+ const resp = await fetch(s4);
14782
+ if (!resp.ok) throw new Error(`Fetch failed with status ${resp.status}`);
14783
+ const blob = await resp.blob();
14784
+ return blob;
14785
+ }
14786
+ throw new Error("Unsupported source type");
14787
+ };
14788
+ const run = async () => {
14789
+ setLoading(true);
14790
+ setError(null);
14791
+ setInfo(null);
14792
+ try {
14793
+ const blob = await toBlobFromSource(source);
14794
+ if (abortRef.current.aborted) return;
14795
+ const fileInfo = {
14796
+ rawBlob: blob,
14797
+ size: blob.size,
14798
+ type: blob.type || "application/octet-stream",
14799
+ dataUrl: null,
14800
+ text: null,
14801
+ arrayBuffer: null,
14802
+ image: null,
14803
+ video: null,
14804
+ audio: null
14805
+ };
14806
+ if (source instanceof File || source instanceof Blob || typeof source === "string" && !source.startsWith("data:")) {
14807
+ fileInfo.name = getFileName(source, fileInfo.type);
14808
+ }
14809
+ fileInfo.extension = makeExtension(fileInfo.name, fileInfo.type);
14810
+ localUrl = URL.createObjectURL(blob);
14811
+ const readPromises = [];
14812
+ if (readAs === "dataUrl" || readAs === "all") {
14813
+ fr = new FileReader();
14814
+ const p = new Promise((resolve, reject) => {
14815
+ fr.onload = () => {
14816
+ if (abortRef.current.aborted) return resolve();
14817
+ fileInfo.dataUrl = fr.result;
14818
+ resolve();
14819
+ };
14820
+ fr.onerror = () => reject(fr.error);
14821
+ fr.readAsDataURL(blob);
14822
+ });
14823
+ readPromises.push(p);
14824
+ }
14825
+ if (readAs === "text" || readAs === "all") {
14826
+ const frText = new FileReader();
14827
+ const p = new Promise((resolve, reject) => {
14828
+ frText.onload = () => {
14829
+ if (abortRef.current.aborted) return resolve();
14830
+ fileInfo.text = frText.result;
14831
+ resolve();
14832
+ };
14833
+ frText.onerror = () => reject(frText.error);
14834
+ frText.readAsText(blob);
14835
+ });
14836
+ readPromises.push(p);
14837
+ }
14838
+ if (readAs === "arrayBuffer" || readAs === "all") {
14839
+ const frBuf = new FileReader();
14840
+ const p = new Promise((resolve, reject) => {
14841
+ frBuf.onload = () => {
14842
+ if (abortRef.current.aborted) return resolve();
14843
+ fileInfo.arrayBuffer = frBuf.result;
14844
+ resolve();
14845
+ };
14846
+ frBuf.onerror = () => reject(frBuf.error);
14847
+ frBuf.readAsArrayBuffer(blob);
14848
+ });
14849
+ readPromises.push(p);
14850
+ }
14851
+ if (fileInfo?.type?.startsWith("image/")) {
14852
+ const p = new Promise((resolve, reject) => {
14853
+ const img = new Image();
14854
+ img.onload = () => {
14855
+ if (abortRef.current.aborted) return resolve();
14856
+ fileInfo.image = {
14857
+ width: img.naturalWidth,
14858
+ height: img.naturalHeight
14859
+ };
14860
+ resolve();
14861
+ };
14862
+ img.onerror = () => resolve();
14863
+ img.src = localUrl;
14864
+ });
14865
+ readPromises.push(p);
14866
+ }
14867
+ if (fileInfo && fileInfo?.type?.startsWith("video/") || fileInfo?.type?.startsWith("audio/")) {
14868
+ const p = new Promise((resolve) => {
14869
+ const el = document.createElement(
14870
+ fileInfo?.type?.startsWith("video/") ? "video" : "audio"
14871
+ );
14872
+ mediaEl = el;
14873
+ mediaEl.preload = "metadata";
14874
+ mediaEl.onloadedmetadata = () => {
14875
+ if (abortRef.current.aborted) return resolve();
14876
+ const duration = isFinite(mediaEl.duration) ? mediaEl.duration : void 0;
14877
+ if (fileInfo?.type?.startsWith("video/")) {
14878
+ fileInfo.video = {
14879
+ width: mediaEl.videoWidth || void 0,
14880
+ height: mediaEl.videoHeight || void 0,
14881
+ duration
14882
+ };
14883
+ } else {
14884
+ fileInfo.audio = { duration };
14885
+ }
14886
+ resolve();
14887
+ };
14888
+ mediaEl.onerror = () => resolve();
14889
+ mediaEl.src = localUrl;
14890
+ });
14891
+ readPromises.push(p);
14892
+ }
14893
+ await Promise.all(readPromises);
14894
+ if (abortRef.current.aborted) return;
14895
+ setInfo(fileInfo);
14896
+ } catch (err) {
14897
+ if (!abortRef.current.aborted) setError(err?.message ?? String(err));
14898
+ } finally {
14899
+ if (!abortRef.current.aborted) setLoading(false);
14900
+ }
14901
+ };
14902
+ run();
14903
+ return () => {
14904
+ abortRef.current.aborted = true;
14905
+ if (fr && fr.readyState === 1) {
14906
+ try {
14907
+ fr.abort();
14908
+ } catch {
14909
+ }
14817
14910
  }
14818
- ),
14819
- providers.map((provider, index4) => {
14820
- const ProviderComp = LoginProviderMapping[provider];
14821
- return /* @__PURE__ */ jsx61(
14822
- ProviderComp,
14823
- {
14824
- db,
14825
- onLoginSocial: () => onLoginSocial?.(db),
14826
- onLoginGoogle: () => onLoginGoogle?.(db)
14827
- },
14828
- index4
14829
- );
14830
- })
14831
- ] });
14832
- };
14833
-
14834
- // src/widgets/advanced/search/popup-filter/index.tsx
14835
- import { jsx as jsx62, jsxs as jsxs38 } from "react/jsx-runtime";
14836
- var PopupFilter = ({
14837
- handleAddTagSearch,
14838
- removeSearchItems,
14839
- groupBy,
14840
- filterBy,
14841
- setFilterBy,
14842
- setGroupBy,
14843
- fields
14844
- }) => {
14845
- const { t: t3 } = useI18n();
14846
- return /* @__PURE__ */ jsx62(
14847
- "div",
14848
- {
14849
- style: {
14850
- position: "absolute",
14851
- top: "calc(100% + 3px)",
14852
- right: 0,
14853
- zIndex: 33
14854
- },
14855
- className: "popup-filter w-full overflow-x-auto rounded-lg border border-[var(--stroke-default)] bg-white shadow-xl",
14856
- children: /* @__PURE__ */ jsxs38(
14857
- "div",
14858
- {
14859
- className: `flex py-3 ${(filterBy?.length === 0 || groupBy?.length === 0) && "!grid-cols-1"}`,
14860
- children: [
14861
- filterBy?.length > 0 && /* @__PURE__ */ jsxs38("div", { className: "filter-by w-full px-3", children: [
14862
- /* @__PURE__ */ jsxs38("div", { className: "flex w-fit items-center justify-start gap-2 px-3 py-1", children: [
14863
- /* @__PURE__ */ jsx62(FilterIcon, { className: "filter-by-icon text-primary" }),
14864
- /* @__PURE__ */ jsx62("span", { className: "font-bold text-sm text-[#212529]", children: t3("filter_by") })
14865
- ] }),
14866
- filterBy?.reduce((acc, item, index4, array) => {
14867
- const prevItem = array[index4 - 1];
14868
- const isDifferentGroup = prevItem && prevItem?.group_index !== item?.group_index;
14869
- const isExist = item?.active;
14870
- if (isDifferentGroup) {
14871
- acc.push(/* @__PURE__ */ jsx62("hr", { className: "my-2" }, "separator-" + index4));
14872
- }
14873
- acc.push(
14874
- /* @__PURE__ */ jsxs38(
14875
- "button",
14876
- {
14877
- className: `filter-by-item w-full flex items-center gap-2 bg-white px-3 py-1 text-left cursor-pointer ${isExist ? "filter-by-checked font-semibold " : "hover:!bg-[rgba(0,0,0,0.08)]"}`,
14878
- onClick: () => {
14879
- const newFilterBy = filterBy?.map(
14880
- (tag) => tag?.name === item?.name ? { ...tag, active: !tag?.active } : tag
14881
- );
14882
- setFilterBy(newFilterBy);
14883
- if (isExist) {
14884
- typeof removeSearchItems === "function" && removeSearchItems(
14885
- `${SearchType.FILTER}_${item.group_index}`,
14886
- item
14887
- );
14888
- return;
14889
- }
14890
- typeof handleAddTagSearch === "function" && handleAddTagSearch({
14891
- name: item?.name,
14892
- value: item?.string ?? item?.help,
14893
- domain: item?.domain,
14894
- groupIndex: item?.group_index,
14895
- type: SearchType.FILTER
14896
- });
14897
- },
14898
- children: [
14899
- isExist && /* @__PURE__ */ jsx62(CheckIcon, {}),
14900
- /* @__PURE__ */ jsx62("span", { className: "text-sm", children: item?.string ?? item?.help })
14901
- ]
14902
- },
14903
- "filter-" + index4
14904
- )
14905
- );
14906
- return acc;
14907
- }, [])
14908
- ] }),
14909
- filterBy?.length > 0 && groupBy?.length > 0 && /* @__PURE__ */ jsx62("div", { className: "h-['initial'] w-[1px] bg-[#dee2e6]" }),
14910
- groupBy?.length > 0 && /* @__PURE__ */ jsxs38("div", { className: "group-by w-full px-3", children: [
14911
- /* @__PURE__ */ jsxs38("div", { className: "flex w-fit items-center justify-start gap-2 px-3 py-1", children: [
14912
- /* @__PURE__ */ jsx62(GroupByIcon, { className: "group-by-icon text-primary" }),
14913
- /* @__PURE__ */ jsx62("span", { className: "font-bold text-sm text-[#212529]", children: t3("group_by") })
14914
- ] }),
14915
- groupBy?.map((item, index4) => {
14916
- const isExist = item?.active;
14917
- if (!item.string) return;
14918
- return /* @__PURE__ */ jsxs38(
14919
- "button",
14920
- {
14921
- onClick: () => {
14922
- const formatArray = groupBy.map(
14923
- (tag) => tag?.name === item?.name ? { ...tag, active: !tag?.active } : tag
14924
- );
14925
- setGroupBy(formatArray);
14926
- if (isExist) {
14927
- typeof removeSearchItems === "function" && removeSearchItems(`${SearchType.GROUP}`, item);
14928
- return;
14929
- }
14930
- typeof handleAddTagSearch === "function" && handleAddTagSearch({
14931
- name: item?.name,
14932
- value: item?.string,
14933
- type: SearchType.GROUP,
14934
- context: JSON.parse(item?.context.replace(/'/g, '"')),
14935
- active: !isExist,
14936
- dataIndex: index4,
14937
- fieldsGroup: fields
14938
- });
14939
- },
14940
- className: `group-by-item w-full flex items-center gap-2 bg-white px-3 py-1 text-left cursor-pointer ${isExist ? "group-by-checked font-semibold" : "hover:!bg-[rgba(0,0,0,0.08)]"}`,
14941
- children: [
14942
- isExist && /* @__PURE__ */ jsx62(CheckIcon, {}),
14943
- /* @__PURE__ */ jsx62("span", { className: "text-sm", children: item?.string })
14944
- ]
14945
- },
14946
- "groupby-" + index4 + 1
14947
- );
14948
- })
14949
- ] })
14950
- ]
14911
+ if (mediaEl) {
14912
+ try {
14913
+ mediaEl.src = "";
14914
+ mediaEl.load();
14915
+ } catch {
14951
14916
  }
14952
- )
14953
- }
14954
- );
14955
- };
14956
-
14957
- // src/widgets/advanced/search/search-item/index.tsx
14958
- import { useEffect as useEffect8, useState as useState6 } from "react";
14917
+ }
14918
+ if (localUrl) URL.revokeObjectURL(localUrl);
14919
+ };
14920
+ }, [source, readAs]);
14921
+ return { info, loading, error: error2, reload: () => {
14922
+ } };
14923
+ }
14959
14924
 
14960
14925
  // src/widgets/advanced/search/tag-search/index.tsx
14961
14926
  import { Fragment as Fragment8 } from "react";
@@ -15157,13 +15122,13 @@ var Search = ({
15157
15122
  clearSearch
15158
15123
  }) => {
15159
15124
  const { t: t3 } = useI18n();
15160
- const [showPopupFilter, setShowPopupFilter] = useState6(false);
15125
+ const [showPopupFilter, setShowPopupFilter] = useState5(false);
15161
15126
  const popupFilterRef = useClickOutside({
15162
15127
  handler: () => setShowPopupFilter(false)
15163
15128
  });
15164
- const [isReadyFormatDomain, setIsReadyFormatDomain] = useState6(false);
15165
- const [didInit, setDidInit] = useState6(false);
15166
- useEffect8(() => {
15129
+ const [isReadyFormatDomain, setIsReadyFormatDomain] = useState5(false);
15130
+ const [didInit, setDidInit] = useState5(false);
15131
+ useEffect7(() => {
15167
15132
  if (isReadyFormatDomain) {
15168
15133
  setPage(0);
15169
15134
  setSelectedRowKeys([]);
@@ -15176,7 +15141,7 @@ var Search = ({
15176
15141
  }
15177
15142
  }
15178
15143
  }, [selectedTags, isReadyFormatDomain]);
15179
- useEffect8(() => {
15144
+ useEffect7(() => {
15180
15145
  setDidInit(false);
15181
15146
  setIsReadyFormatDomain(false);
15182
15147
  return () => {
@@ -15185,7 +15150,7 @@ var Search = ({
15185
15150
  setIsReadyFormatDomain(false);
15186
15151
  };
15187
15152
  }, [aid]);
15188
- useEffect8(() => {
15153
+ useEffect7(() => {
15189
15154
  if (!filterBy || !fieldsList || fieldsList?.length === 0) return;
15190
15155
  if (didInit) return;
15191
15156
  const searchDefaults = Object.entries(context || {}).filter(
@@ -15484,8 +15449,8 @@ var ModalConfirm = ({
15484
15449
  };
15485
15450
 
15486
15451
  // src/widgets/common/modal-detail.tsx
15487
- import { useState as useState7 } from "react";
15488
- import { createPortal as createPortal3 } from "react-dom";
15452
+ import { useState as useState6 } from "react";
15453
+ import { createPortal as createPortal2 } from "react-dom";
15489
15454
  import { Fragment as Fragment13, jsx as jsx69, jsxs as jsxs44 } from "react/jsx-runtime";
15490
15455
  var ModalDetail = ({
15491
15456
  idToolTip,
@@ -15498,8 +15463,8 @@ var ModalDetail = ({
15498
15463
  context
15499
15464
  }) => {
15500
15465
  const { t: t3 } = useI18n();
15501
- const [showModalDetail, setShowModalDetail] = useState7(false);
15502
- const [actionData, setActionData] = useState7();
15466
+ const [showModalDetail, setShowModalDetail] = useState6(false);
15467
+ const [actionData, setActionData] = useState6();
15503
15468
  const handleToggleModal = (e3) => {
15504
15469
  e3.stopPropagation();
15505
15470
  setShowModalDetail(!showModalDetail);
@@ -15508,7 +15473,7 @@ var ModalDetail = ({
15508
15473
  sessionStorage.setItem("actionData", JSON.stringify(actionData));
15509
15474
  window.location.href = `/form/menu?model=${model}&id=${idForm}`;
15510
15475
  };
15511
- return createPortal3(
15476
+ return createPortal2(
15512
15477
  /* @__PURE__ */ jsx69(Fragment13, { children: showModalDetail && /* @__PURE__ */ jsxs44("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[100]", children: [
15513
15478
  /* @__PURE__ */ jsx69("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
15514
15479
  /* @__PURE__ */ jsx69("div", { className: "absolute inset-0 overflow-auto flex flex-col justify-center items-center px-5", children: /* @__PURE__ */ jsxs44("div", { className: "relative z-[1] max-w-full p-4 flex flex-col gap-4 w-[1000px] transform rounded-3xl bg-[#FFF] h-[90%]", children: [
@@ -15547,12 +15512,12 @@ var ModalDetail = ({
15547
15512
  };
15548
15513
 
15549
15514
  // src/widgets/common/loading-normal.tsx
15550
- import { useEffect as useEffect9, useState as useState8 } from "react";
15515
+ import { useEffect as useEffect8, useState as useState7 } from "react";
15551
15516
  import { jsx as jsx70, jsxs as jsxs45 } from "react/jsx-runtime";
15552
15517
  var LayerLoading = () => {
15553
15518
  const { t: t3 } = useI18n();
15554
- const [activeIndex, setActiveIndex] = useState8(0);
15555
- useEffect9(() => {
15519
+ const [activeIndex, setActiveIndex] = useState7(0);
15520
+ useEffect8(() => {
15556
15521
  const interval = setInterval(() => {
15557
15522
  setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
15558
15523
  }, 200);
@@ -15571,11 +15536,11 @@ var LayerLoading = () => {
15571
15536
  };
15572
15537
 
15573
15538
  // src/widgets/common/loading-small.tsx
15574
- import { useEffect as useEffect10, useState as useState9 } from "react";
15539
+ import { useEffect as useEffect9, useState as useState8 } from "react";
15575
15540
  import { jsx as jsx71 } from "react/jsx-runtime";
15576
15541
  var LoadingSmall = () => {
15577
- const [activeIndex, setActiveIndex] = useState9(0);
15578
- useEffect10(() => {
15542
+ const [activeIndex, setActiveIndex] = useState8(0);
15543
+ useEffect9(() => {
15579
15544
  const interval = setInterval(() => {
15580
15545
  setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
15581
15546
  }, 200);
@@ -15910,11 +15875,11 @@ var ButtonSelectFiles = ({
15910
15875
  };
15911
15876
 
15912
15877
  // src/widgets/common/video-player.tsx
15913
- import { useRef as useRef6, useState as useState10 } from "react";
15878
+ import { useRef as useRef5, useState as useState9 } from "react";
15914
15879
  import { jsx as jsx73, jsxs as jsxs47 } from "react/jsx-runtime";
15915
15880
  var VideoPlayer = ({ src }) => {
15916
- const [isPlaying, setIsPlaying] = useState10(false);
15917
- const videoRef = useRef6(null);
15881
+ const [isPlaying, setIsPlaying] = useState9(false);
15882
+ const videoRef = useRef5(null);
15918
15883
  const handlePlayPause = () => {
15919
15884
  if (videoRef.current) {
15920
15885
  if (isPlaying) {
@@ -16023,7 +15988,7 @@ var AvatarField = (props) => {
16023
15988
  };
16024
15989
 
16025
15990
  // src/widgets/basic/binary-field/binary.tsx
16026
- import { useEffect as useEffect11, useState as useState11 } from "react";
15991
+ import { useEffect as useEffect10, useState as useState10 } from "react";
16027
15992
  import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
16028
15993
  var BinaryField = (props) => {
16029
15994
  const {
@@ -16051,12 +16016,12 @@ var BinaryField = (props) => {
16051
16016
  setInitialFile
16052
16017
  } = props;
16053
16018
  const { t: t3 } = useI18n();
16054
- const [fileInfo, setFileInfo] = useState11(null);
16019
+ const [fileInfo, setFileInfo] = useState10(null);
16055
16020
  const onlyImage = widget === "image" || widget === "image_url";
16056
- useEffect11(() => {
16021
+ useEffect10(() => {
16057
16022
  setInitialFile(value);
16058
16023
  }, [value]);
16059
- useEffect11(() => {
16024
+ useEffect10(() => {
16060
16025
  const loadFromLink = async () => {
16061
16026
  if (!initialFile || !initialFile.startsWith("http")) return;
16062
16027
  if (typeof initialFile !== "string") {
@@ -16429,7 +16394,7 @@ var ButtonField = (props) => {
16429
16394
  };
16430
16395
 
16431
16396
  // src/widgets/basic/char-field/char.tsx
16432
- import { useEffect as useEffect12, useMemo as useMemo4 } from "react";
16397
+ import { useEffect as useEffect11, useMemo as useMemo4 } from "react";
16433
16398
  import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-runtime";
16434
16399
  var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
16435
16400
  var CharField = (props) => {
@@ -16489,12 +16454,12 @@ var CharField = (props) => {
16489
16454
  fieldState: { error: error2, isDirty }
16490
16455
  }) => {
16491
16456
  const { setError, clearErrors } = methods;
16492
- useEffect12(() => {
16457
+ useEffect11(() => {
16493
16458
  if (value2) {
16494
16459
  clearErrors(name2);
16495
16460
  }
16496
16461
  }, [value2, clearErrors, name2]);
16497
- useEffect12(() => {
16462
+ useEffect11(() => {
16498
16463
  if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
16499
16464
  const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
16500
16465
  const currentValue = methods?.getValues(name2);
@@ -16658,21 +16623,21 @@ var CheckboxField = (props) => {
16658
16623
  };
16659
16624
 
16660
16625
  // src/widgets/basic/color-field/color-wrapper.tsx
16661
- import { useEffect as useEffect13, useRef as useRef7, useState as useState12 } from "react";
16626
+ import { useEffect as useEffect12, useRef as useRef6, useState as useState11 } from "react";
16662
16627
  import { Fragment as Fragment19, jsx as jsx80, jsxs as jsxs52 } from "react/jsx-runtime";
16663
16628
  var ColorWrapper = (props) => {
16664
16629
  const { colors: colors2, defaultColor, savePickColor } = props;
16665
16630
  const { t: t3 } = useI18n();
16666
- const [selectedColor, setSelectedColor] = useState12(colors2[defaultColor]);
16667
- const [showFullColors, setIsShowFullColor] = useState12(false);
16668
- const pickColorsRef = useRef7(null);
16669
- useEffect13(() => {
16631
+ const [selectedColor, setSelectedColor] = useState11(colors2[defaultColor]);
16632
+ const [showFullColors, setIsShowFullColor] = useState11(false);
16633
+ const pickColorsRef = useRef6(null);
16634
+ useEffect12(() => {
16670
16635
  setSelectedColor(colors2[defaultColor]);
16671
16636
  }, [defaultColor]);
16672
16637
  const handleShowFullColors = () => {
16673
16638
  setIsShowFullColor(!showFullColors);
16674
16639
  };
16675
- useEffect13(() => {
16640
+ useEffect12(() => {
16676
16641
  const handleClickOutside = (event) => {
16677
16642
  if (pickColorsRef.current && !pickColorsRef.current.contains(event.target)) {
16678
16643
  setIsShowFullColor(false);
@@ -16763,7 +16728,7 @@ var ColorField = (props) => {
16763
16728
  };
16764
16729
 
16765
16730
  // src/widgets/basic/copy-link-buttton/copy-link.tsx
16766
- import { useEffect as useEffect14 } from "react";
16731
+ import { useEffect as useEffect13 } from "react";
16767
16732
  import { jsx as jsx82, jsxs as jsxs53 } from "react/jsx-runtime";
16768
16733
  var CopyLinkButtonField = (props) => {
16769
16734
  const {
@@ -16798,7 +16763,7 @@ var CopyLinkButtonField = (props) => {
16798
16763
  fieldState: { error: error2 }
16799
16764
  }) => {
16800
16765
  const { setError, clearErrors } = methods;
16801
- useEffect14(() => {
16766
+ useEffect13(() => {
16802
16767
  if (value) {
16803
16768
  clearErrors(name2);
16804
16769
  }
@@ -16874,10 +16839,10 @@ var CopyLinkButtonField = (props) => {
16874
16839
  };
16875
16840
 
16876
16841
  // src/widgets/basic/date-field/date.tsx
16877
- import { forwardRef as forwardRef6, useEffect as useEffect18 } from "react";
16842
+ import { forwardRef as forwardRef6, useEffect as useEffect17 } from "react";
16878
16843
 
16879
16844
  // node_modules/react-datepicker/dist/index.es.js
16880
- import React9, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect16, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
16845
+ import React9, { useRef as useRef10, useCallback as useCallback5, useEffect as useEffect15, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
16881
16846
 
16882
16847
  // node_modules/date-fns/constants.js
16883
16848
  var daysInYear = 365.2425;
@@ -21447,8 +21412,8 @@ var CalendarContainer = function(_a2) {
21447
21412
  return React9.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
21448
21413
  };
21449
21414
  var useDetectClickOutside = function(onClickOutside, ignoreClass) {
21450
- var ref = useRef11(null);
21451
- var onClickOutsideRef = useRef11(onClickOutside);
21415
+ var ref = useRef10(null);
21416
+ var onClickOutsideRef = useRef10(onClickOutside);
21452
21417
  onClickOutsideRef.current = onClickOutside;
21453
21418
  var handleClickOutside = useCallback5(function(event) {
21454
21419
  var _a2;
@@ -21461,7 +21426,7 @@ var useDetectClickOutside = function(onClickOutside, ignoreClass) {
21461
21426
  }
21462
21427
  }
21463
21428
  }, [ignoreClass]);
21464
- useEffect16(function() {
21429
+ useEffect15(function() {
21465
21430
  document.addEventListener("mousedown", handleClickOutside);
21466
21431
  return function() {
21467
21432
  document.removeEventListener("mousedown", handleClickOutside);
@@ -24702,7 +24667,7 @@ function withFloating(Component3) {
24702
24667
  var WithFloating = function(props) {
24703
24668
  var _a2;
24704
24669
  var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
24705
- var arrowRef = useRef11(null);
24670
+ var arrowRef = useRef10(null);
24706
24671
  var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
24707
24672
  flip3({ padding: 15 }),
24708
24673
  offset3(10),
@@ -25714,13 +25679,13 @@ function _objectWithoutProperties(e3, t3) {
25714
25679
  }
25715
25680
 
25716
25681
  // node_modules/react-select/dist/useStateManager-7e1e8489.esm.js
25717
- import { useState as useState15, useCallback as useCallback6 } from "react";
25682
+ import { useState as useState14, useCallback as useCallback6 } from "react";
25718
25683
  var _excluded = ["defaultInputValue", "defaultMenuIsOpen", "defaultValue", "inputValue", "menuIsOpen", "onChange", "onInputChange", "onMenuClose", "onMenuOpen", "value"];
25719
25684
  function useStateManager(_ref3) {
25720
25685
  var _ref$defaultInputValu = _ref3.defaultInputValue, defaultInputValue = _ref$defaultInputValu === void 0 ? "" : _ref$defaultInputValu, _ref$defaultMenuIsOpe = _ref3.defaultMenuIsOpen, defaultMenuIsOpen = _ref$defaultMenuIsOpe === void 0 ? false : _ref$defaultMenuIsOpe, _ref$defaultValue = _ref3.defaultValue, defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue, propsInputValue = _ref3.inputValue, propsMenuIsOpen = _ref3.menuIsOpen, propsOnChange = _ref3.onChange, propsOnInputChange = _ref3.onInputChange, propsOnMenuClose = _ref3.onMenuClose, propsOnMenuOpen = _ref3.onMenuOpen, propsValue = _ref3.value, restSelectProps = _objectWithoutProperties(_ref3, _excluded);
25721
- var _useState = useState15(propsInputValue !== void 0 ? propsInputValue : defaultInputValue), _useState2 = _slicedToArray(_useState, 2), stateInputValue = _useState2[0], setStateInputValue = _useState2[1];
25722
- var _useState3 = useState15(propsMenuIsOpen !== void 0 ? propsMenuIsOpen : defaultMenuIsOpen), _useState4 = _slicedToArray(_useState3, 2), stateMenuIsOpen = _useState4[0], setStateMenuIsOpen = _useState4[1];
25723
- var _useState5 = useState15(propsValue !== void 0 ? propsValue : defaultValue), _useState6 = _slicedToArray(_useState5, 2), stateValue = _useState6[0], setStateValue = _useState6[1];
25686
+ var _useState = useState14(propsInputValue !== void 0 ? propsInputValue : defaultInputValue), _useState2 = _slicedToArray(_useState, 2), stateInputValue = _useState2[0], setStateInputValue = _useState2[1];
25687
+ var _useState3 = useState14(propsMenuIsOpen !== void 0 ? propsMenuIsOpen : defaultMenuIsOpen), _useState4 = _slicedToArray(_useState3, 2), stateMenuIsOpen = _useState4[0], setStateMenuIsOpen = _useState4[1];
25688
+ var _useState5 = useState14(propsValue !== void 0 ? propsValue : defaultValue), _useState6 = _slicedToArray(_useState5, 2), stateValue = _useState6[0], setStateValue = _useState6[1];
25724
25689
  var onChange2 = useCallback6(function(value2, actionMeta) {
25725
25690
  if (typeof propsOnChange === "function") {
25726
25691
  propsOnChange(value2, actionMeta);
@@ -25881,7 +25846,7 @@ function _toConsumableArray(r4) {
25881
25846
 
25882
25847
  // node_modules/react-select/dist/Select-ef7c0426.esm.js
25883
25848
  import * as React13 from "react";
25884
- import { useMemo as useMemo8, Fragment as Fragment23, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect17, Component as Component2 } from "react";
25849
+ import { useMemo as useMemo8, Fragment as Fragment23, useRef as useRef13, useCallback as useCallback8, useEffect as useEffect16, Component as Component2 } from "react";
25885
25850
 
25886
25851
  // node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
25887
25852
  import * as React11 from "react";
@@ -27213,8 +27178,8 @@ function _taggedTemplateLiteral(e3, t3) {
27213
27178
  }
27214
27179
 
27215
27180
  // node_modules/react-select/dist/index-641ee5b8.esm.js
27216
- import { useContext as useContext9, useRef as useRef13, useState as useState16, useMemo as useMemo7, useCallback as useCallback7, createContext as createContext5 } from "react";
27217
- import { createPortal as createPortal5 } from "react-dom";
27181
+ import { useContext as useContext9, useRef as useRef12, useState as useState15, useMemo as useMemo7, useCallback as useCallback7, createContext as createContext5 } from "react";
27182
+ import { createPortal as createPortal4 } from "react-dom";
27218
27183
 
27219
27184
  // node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
27220
27185
  import { useLayoutEffect as useLayoutEffect4 } from "react";
@@ -27559,9 +27524,9 @@ var PortalPlacementContext = /* @__PURE__ */ createContext5(null);
27559
27524
  var MenuPlacer = function MenuPlacer2(props) {
27560
27525
  var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
27561
27526
  var _ref3 = useContext9(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
27562
- var ref = useRef13(null);
27563
- var _useState = useState16(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
27564
- var _useState3 = useState16(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
27527
+ var ref = useRef12(null);
27528
+ var _useState = useState15(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
27529
+ var _useState3 = useState15(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
27565
27530
  var controlHeight2 = theme.spacing.controlHeight;
27566
27531
  index3(function() {
27567
27532
  var menuEl = ref.current;
@@ -27663,15 +27628,15 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
27663
27628
  };
27664
27629
  var MenuPortal = function MenuPortal2(props) {
27665
27630
  var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
27666
- var menuPortalRef = useRef13(null);
27667
- var cleanupRef = useRef13(null);
27668
- var _useState5 = useState16(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
27631
+ var menuPortalRef = useRef12(null);
27632
+ var cleanupRef = useRef12(null);
27633
+ var _useState5 = useState15(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
27669
27634
  var portalPlacementContext = useMemo7(function() {
27670
27635
  return {
27671
27636
  setPortalPlacement
27672
27637
  };
27673
27638
  }, []);
27674
- var _useState7 = useState16(null), _useState8 = _slicedToArray(_useState7, 2), computedPosition = _useState8[0], setComputedPosition = _useState8[1];
27639
+ var _useState7 = useState15(null), _useState8 = _slicedToArray(_useState7, 2), computedPosition = _useState8[0], setComputedPosition = _useState8[1];
27675
27640
  var updateComputedPosition = useCallback7(function() {
27676
27641
  if (!controlElement) return;
27677
27642
  var rect = getBoundingClientObj(controlElement);
@@ -27717,7 +27682,7 @@ var MenuPortal = function MenuPortal2(props) {
27717
27682
  }), innerProps), children);
27718
27683
  return jsx84(PortalPlacementContext.Provider, {
27719
27684
  value: portalPlacementContext
27720
- }, appendTo ? /* @__PURE__ */ createPortal5(menuWrapper, appendTo) : menuWrapper);
27685
+ }, appendTo ? /* @__PURE__ */ createPortal4(menuWrapper, appendTo) : menuWrapper);
27721
27686
  };
27722
27687
  var containerCSS = function containerCSS2(_ref3) {
27723
27688
  var isDisabled = _ref3.isDisabled, isRtl = _ref3.isRtl;
@@ -28802,10 +28767,10 @@ var cancelScroll = function cancelScroll2(event) {
28802
28767
  };
28803
28768
  function useScrollCapture(_ref3) {
28804
28769
  var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
28805
- var isBottom = useRef14(false);
28806
- var isTop = useRef14(false);
28807
- var touchStart = useRef14(0);
28808
- var scrollTarget = useRef14(null);
28770
+ var isBottom = useRef13(false);
28771
+ var isTop = useRef13(false);
28772
+ var touchStart = useRef13(0);
28773
+ var scrollTarget = useRef13(null);
28809
28774
  var handleEventDelta = useCallback8(function(event, delta) {
28810
28775
  if (scrollTarget.current === null) return;
28811
28776
  var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
@@ -28865,7 +28830,7 @@ function useScrollCapture(_ref3) {
28865
28830
  el.removeEventListener("touchstart", onTouchStart, false);
28866
28831
  el.removeEventListener("touchmove", onTouchMove, false);
28867
28832
  }, [onTouchMove, onTouchStart, onWheel]);
28868
- useEffect17(function() {
28833
+ useEffect16(function() {
28869
28834
  if (!isEnabled) return;
28870
28835
  var element = scrollTarget.current;
28871
28836
  startListening(element);
@@ -28912,8 +28877,8 @@ var listenerOptions = {
28912
28877
  };
28913
28878
  function useScrollLock(_ref3) {
28914
28879
  var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
28915
- var originalStyles = useRef14({});
28916
- var scrollTarget = useRef14(null);
28880
+ var originalStyles = useRef13({});
28881
+ var scrollTarget = useRef13(null);
28917
28882
  var addScrollLock = useCallback8(function(touchScrollTarget) {
28918
28883
  if (!canUseDOM) return;
28919
28884
  var target = document.body;
@@ -28968,7 +28933,7 @@ function useScrollLock(_ref3) {
28968
28933
  }
28969
28934
  }
28970
28935
  }, [accountForScrollbars]);
28971
- useEffect17(function() {
28936
+ useEffect16(function() {
28972
28937
  if (!isEnabled) return;
28973
28938
  var element = scrollTarget.current;
28974
28939
  addScrollLock(element);
@@ -30686,7 +30651,7 @@ var DateField = (props) => {
30686
30651
  },
30687
30652
  render: ({ field, fieldState: { error: error2 } }) => {
30688
30653
  const { setError, clearErrors } = methods;
30689
- useEffect18(() => {
30654
+ useEffect17(() => {
30690
30655
  if (value) {
30691
30656
  clearErrors(name2);
30692
30657
  }
@@ -30918,7 +30883,7 @@ var DownloadFileField = (props) => {
30918
30883
  };
30919
30884
 
30920
30885
  // src/widgets/basic/dropdown-field/dropdown.tsx
30921
- import { useState as useState17 } from "react";
30886
+ import { useState as useState16 } from "react";
30922
30887
  import { jsx as jsx89, jsxs as jsxs58 } from "react/jsx-runtime";
30923
30888
  var DropdownField = (props) => {
30924
30889
  const {
@@ -30931,7 +30896,7 @@ var DropdownField = (props) => {
30931
30896
  dropdownClassName = "",
30932
30897
  useClickOutside: useClickOutside2
30933
30898
  } = props;
30934
- const [open, setOpen] = useState17(false);
30899
+ const [open, setOpen] = useState16(false);
30935
30900
  const dropdownRef = useClickOutside2({ handler: () => setOpen(false) });
30936
30901
  return /* @__PURE__ */ jsxs58(
30937
30902
  "div",
@@ -31040,7 +31005,7 @@ var FeeField = (props) => {
31040
31005
  };
31041
31006
 
31042
31007
  // src/widgets/basic/file-upload-field/file-upload.tsx
31043
- import { useEffect as useEffect19, useRef as useRef15, useState as useState18 } from "react";
31008
+ import { useEffect as useEffect18, useRef as useRef14, useState as useState17 } from "react";
31044
31009
  import { jsx as jsx91, jsxs as jsxs60 } from "react/jsx-runtime";
31045
31010
  var RenderFile = ({
31046
31011
  file,
@@ -31105,10 +31070,10 @@ var FileUploadField = (props) => {
31105
31070
  downloadFunction
31106
31071
  } = props;
31107
31072
  const { t: t3 } = useI18n();
31108
- const fileInputRef = useRef15(null);
31109
- const [selectedFiles, setSelectedFiles] = useState18([]);
31110
- const [uploadError, setUploadError] = useState18();
31111
- useEffect19(() => {
31073
+ const fileInputRef = useRef14(null);
31074
+ const [selectedFiles, setSelectedFiles] = useState17([]);
31075
+ const [uploadError, setUploadError] = useState17();
31076
+ useEffect18(() => {
31112
31077
  if (selectedFiles?.length === 0 && value) {
31113
31078
  setSelectedFiles([
31114
31079
  {
@@ -31126,7 +31091,7 @@ var FileUploadField = (props) => {
31126
31091
  required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
31127
31092
  },
31128
31093
  render: ({ field: { onChange: onChange2 }, fieldState: { error: error2 } }) => {
31129
- useEffect19(() => {
31094
+ useEffect18(() => {
31130
31095
  let data = widget === "many2many_binary" ? selectedFiles : selectedFiles?.[0]?.data;
31131
31096
  if (widget !== "many2many_binary" && data && isBase64File(data)) {
31132
31097
  data = data.split(",")[1];
@@ -31182,7 +31147,7 @@ var FileUploadField = (props) => {
31182
31147
  };
31183
31148
 
31184
31149
  // src/widgets/basic/float-field/float.tsx
31185
- import { useEffect as useEffect20, useRef as useRef16, useState as useState19 } from "react";
31150
+ import { useEffect as useEffect19, useRef as useRef15, useState as useState18 } from "react";
31186
31151
  import { Fragment as Fragment26, jsx as jsx92, jsxs as jsxs61 } from "react/jsx-runtime";
31187
31152
  var FloatField = (props) => {
31188
31153
  const {
@@ -31214,10 +31179,10 @@ var FloatField = (props) => {
31214
31179
  },
31215
31180
  render: ({ field: { onChange: onChange2, value }, fieldState: { error: error2 } }) => {
31216
31181
  const { setError, clearErrors } = methods;
31217
- const [inputValue, setInputValue] = useState19(
31182
+ const [inputValue, setInputValue] = useState18(
31218
31183
  value !== void 0 && value !== null ? formatFloatNumber(value) : ""
31219
31184
  );
31220
- useEffect20(() => {
31185
+ useEffect19(() => {
31221
31186
  if (isDirtyRef.current) return;
31222
31187
  const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
31223
31188
  if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
@@ -31230,9 +31195,9 @@ var FloatField = (props) => {
31230
31195
  setInputValue("");
31231
31196
  }
31232
31197
  }, [value, name2, clearErrors, propValue]);
31233
- const isDirtyRef = useRef16(false);
31234
- const inputRef = useRef16(null);
31235
- const lastCommittedValueRef = useRef16(null);
31198
+ const isDirtyRef = useRef15(false);
31199
+ const inputRef = useRef15(null);
31200
+ const lastCommittedValueRef = useRef15(null);
31236
31201
  const handleInputChange = (e3) => {
31237
31202
  const newValue = e3.target.value;
31238
31203
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -31339,7 +31304,7 @@ var FloatField = (props) => {
31339
31304
  };
31340
31305
 
31341
31306
  // src/widgets/basic/float-time-field/float-time.tsx
31342
- import { useState as useState20 } from "react";
31307
+ import { useState as useState19 } from "react";
31343
31308
  import { Fragment as Fragment27, jsx as jsx93, jsxs as jsxs62 } from "react/jsx-runtime";
31344
31309
  var FloatTimeField = (props) => {
31345
31310
  const {
@@ -31371,11 +31336,11 @@ var FloatTimeField = (props) => {
31371
31336
  field: { onChange: fieldOnChange, onBlur, value: value2 },
31372
31337
  fieldState: { error: error2, isDirty }
31373
31338
  }) => {
31374
- const [input, setInput] = useState20(
31339
+ const [input, setInput] = useState19(
31375
31340
  convertFloatToTime(value2 ?? defaultValue)
31376
31341
  );
31377
- const [formattedTime, setFormattedTime] = useState20("");
31378
- const [errors, setErrors] = useState20("");
31342
+ const [formattedTime, setFormattedTime] = useState19("");
31343
+ const [errors, setErrors] = useState19("");
31379
31344
  const handleInputChange = (e3) => {
31380
31345
  const raw = e3.target.value.replace(/[^\d:]/g, "");
31381
31346
  setInput(raw);
@@ -31461,7 +31426,7 @@ var FloatTimeField = (props) => {
31461
31426
  };
31462
31427
 
31463
31428
  // src/widgets/basic/html-field/html.tsx
31464
- import { useEffect as useEffect21, useRef as useRef17 } from "react";
31429
+ import { useEffect as useEffect20, useRef as useRef16 } from "react";
31465
31430
  import { jsx as jsx94 } from "react/jsx-runtime";
31466
31431
  var HtmlField = (props) => {
31467
31432
  const {
@@ -31474,7 +31439,7 @@ var HtmlField = (props) => {
31474
31439
  value,
31475
31440
  isEditTable
31476
31441
  } = props;
31477
- const divRef = useRef17(null);
31442
+ const divRef = useRef16(null);
31478
31443
  if (!isForm && !isEditTable) {
31479
31444
  return /* @__PURE__ */ jsx94("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
31480
31445
  }
@@ -31485,7 +31450,7 @@ var HtmlField = (props) => {
31485
31450
  control: methods?.control,
31486
31451
  defaultValue,
31487
31452
  render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
31488
- useEffect21(() => {
31453
+ useEffect20(() => {
31489
31454
  if (divRef.current && divRef.current.innerHTML !== value2) {
31490
31455
  divRef.current.innerHTML = value2 || "";
31491
31456
  }
@@ -31527,7 +31492,7 @@ var ImageField = (props) => {
31527
31492
  };
31528
31493
 
31529
31494
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
31530
- import React16, { useEffect as useEffect22, useMemo as useMemo10 } from "react";
31495
+ import React16, { useEffect as useEffect21, useMemo as useMemo10 } from "react";
31531
31496
 
31532
31497
  // src/widgets/basic/information-field/information.tsx
31533
31498
  import { Fragment as Fragment28, jsx as jsx96, jsxs as jsxs63 } from "react/jsx-runtime";
@@ -31669,7 +31634,7 @@ var Many2ManyTagField = (props) => {
31669
31634
  },
31670
31635
  render: ({ field, fieldState: { error: error2 } }) => {
31671
31636
  const { clearErrors } = methods;
31672
- useEffect22(() => {
31637
+ useEffect21(() => {
31673
31638
  if (field.value) {
31674
31639
  clearErrors(name2);
31675
31640
  }
@@ -31809,7 +31774,7 @@ var Many2ManyTagField = (props) => {
31809
31774
  };
31810
31775
 
31811
31776
  // src/widgets/basic/monetary-field/monetary.tsx
31812
- import { useEffect as useEffect23 } from "react";
31777
+ import { useEffect as useEffect22 } from "react";
31813
31778
  import { Fragment as Fragment29, jsx as jsx98, jsxs as jsxs65 } from "react/jsx-runtime";
31814
31779
  var MonetaryField = (props) => {
31815
31780
  const { t: t3 } = useI18n();
@@ -31863,7 +31828,7 @@ var MonetaryField = (props) => {
31863
31828
  fieldState: { error: error2 }
31864
31829
  }) => {
31865
31830
  const { setError, clearErrors } = methods;
31866
- useEffect23(() => {
31831
+ useEffect22(() => {
31867
31832
  if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
31868
31833
  clearErrors(name2);
31869
31834
  }
@@ -31921,7 +31886,7 @@ var PaidBadgedField = () => {
31921
31886
  };
31922
31887
 
31923
31888
  // src/widgets/basic/priority-field/rating-star.tsx
31924
- import React17, { useEffect as useEffect24, useState as useState21 } from "react";
31889
+ import React17, { useEffect as useEffect23, useState as useState20 } from "react";
31925
31890
  import { jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
31926
31891
  var RatingStarField = (props) => {
31927
31892
  const {
@@ -31931,9 +31896,9 @@ var RatingStarField = (props) => {
31931
31896
  onSelectPriority,
31932
31897
  id
31933
31898
  } = props;
31934
- const [rating, setRating] = useState21(defaultValue);
31935
- const [hover, setHover] = useState21(0);
31936
- useEffect24(() => {
31899
+ const [rating, setRating] = useState20(defaultValue);
31900
+ const [hover, setHover] = useState20(0);
31901
+ useEffect23(() => {
31937
31902
  setRating(defaultValue);
31938
31903
  }, [defaultValue]);
31939
31904
  const handleClick = (value) => {
@@ -32046,7 +32011,7 @@ var PriorityField = (props) => {
32046
32011
  };
32047
32012
 
32048
32013
  // src/widgets/basic/radio-group-field/radio-group.tsx
32049
- import { useEffect as useEffect25 } from "react";
32014
+ import { useEffect as useEffect24 } from "react";
32050
32015
  import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
32051
32016
  var RadioGroupField = (props) => {
32052
32017
  const {
@@ -32060,7 +32025,7 @@ var RadioGroupField = (props) => {
32060
32025
  onChange: onChange2,
32061
32026
  setValue
32062
32027
  } = props;
32063
- useEffect25(() => {
32028
+ useEffect24(() => {
32064
32029
  if (selection?.length > 0) {
32065
32030
  if (setValue) setValue(name2, selection?.[0]?.[0]);
32066
32031
  }
@@ -32364,7 +32329,7 @@ var ToggleButtonField = (props) => {
32364
32329
  };
32365
32330
 
32366
32331
  // src/widgets/basic/integer-field/integer.tsx
32367
- import { useEffect as useEffect26, useRef as useRef18, useState as useState22 } from "react";
32332
+ import { useEffect as useEffect25, useRef as useRef17, useState as useState21 } from "react";
32368
32333
  import { Fragment as Fragment31, jsx as jsx107, jsxs as jsxs71 } from "react/jsx-runtime";
32369
32334
  var IntegerField = (props) => {
32370
32335
  const {
@@ -32400,13 +32365,13 @@ var IntegerField = (props) => {
32400
32365
  fieldState: { error: error2 }
32401
32366
  }) => {
32402
32367
  const { setError, clearErrors } = methods;
32403
- const isDirtyRef = useRef18(false);
32404
- const inputRef = useRef18(null);
32405
- const lastCommittedValueRef = useRef18(null);
32406
- const [inputValue, setInputValue] = useState22(
32368
+ const isDirtyRef = useRef17(false);
32369
+ const inputRef = useRef17(null);
32370
+ const lastCommittedValueRef = useRef17(null);
32371
+ const [inputValue, setInputValue] = useState21(
32407
32372
  value2 !== void 0 && value2 !== null ? String(value2) : ""
32408
32373
  );
32409
- useEffect26(() => {
32374
+ useEffect25(() => {
32410
32375
  if (value2 !== void 0 && value2 !== null) {
32411
32376
  setInputValue(String(value2));
32412
32377
  clearErrors(name2);
@@ -32563,8 +32528,8 @@ var StatusDropdownField = (props) => {
32563
32528
  };
32564
32529
 
32565
32530
  // src/widgets/basic/many2many-field/many2many.tsx
32566
- import { createPortal as createPortal6 } from "react-dom";
32567
- import { useEffect as useEffect27 } from "react";
32531
+ import { createPortal as createPortal5 } from "react-dom";
32532
+ import { useEffect as useEffect26 } from "react";
32568
32533
  import { jsx as jsx109, jsxs as jsxs73 } from "react/jsx-runtime";
32569
32534
  var Many2ManyField = (props) => {
32570
32535
  const { t: t3 } = useI18n();
@@ -32624,7 +32589,7 @@ var Many2ManyField = (props) => {
32624
32589
  clearSearch
32625
32590
  } = searchController;
32626
32591
  const { handleCheckBoxAll, checkedAll, selectedRowKeysRef } = tableHeadController;
32627
- useEffect27(() => {
32592
+ useEffect26(() => {
32628
32593
  const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
32629
32594
  if (groupItems?.length > 0) {
32630
32595
  typeof setPageLimit === "function" && setPageLimit(80);
@@ -32638,7 +32603,7 @@ var Many2ManyField = (props) => {
32638
32603
  typeof setGroupByList === "function" && setGroupByList(null);
32639
32604
  };
32640
32605
  }, [selectedTags]);
32641
- return createPortal6(
32606
+ return createPortal5(
32642
32607
  /* @__PURE__ */ jsxs73(
32643
32608
  "div",
32644
32609
  {
@@ -32844,7 +32809,7 @@ var Many2ManyField = (props) => {
32844
32809
  };
32845
32810
 
32846
32811
  // src/widgets/basic/many2one-field/many2one.tsx
32847
- import React18, { useEffect as useEffect28 } from "react";
32812
+ import React18, { useEffect as useEffect27 } from "react";
32848
32813
  import { Fragment as Fragment32, jsx as jsx110, jsxs as jsxs74 } from "react/jsx-runtime";
32849
32814
  var CustomMenuList2 = (props) => {
32850
32815
  const { t: t3 } = useI18n();
@@ -32947,7 +32912,7 @@ var Many2OneField = (props) => {
32947
32912
  const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length > 0 ? options2.find(
32948
32913
  (option) => option.value === tempSelectedOption?.value
32949
32914
  ) : currentValue ? currentValue : null;
32950
- useEffect28(() => {
32915
+ useEffect27(() => {
32951
32916
  if (error2 && selectedOption) {
32952
32917
  methods?.clearErrors(name2);
32953
32918
  }