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