@fctc/sme-widget-ui 2.2.9 → 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/index.js +56 -89
- package/dist/index.mjs +160 -193
- package/dist/widgets.js +381 -416
- package/dist/widgets.mjs +601 -636
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -10120,346 +10120,65 @@ var TableBody = (props) => {
|
|
|
10120
10120
|
};
|
|
10121
10121
|
|
|
10122
10122
|
// src/widgets/advanced/table/table-filter.tsx
|
|
10123
|
-
var
|
|
10124
|
-
var import_react_dom = require("react-dom");
|
|
10125
|
-
|
|
10126
|
-
// src/hooks/use-click-outside.ts
|
|
10127
|
-
var import_react13 = require("react");
|
|
10128
|
-
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
10129
|
-
var useClickOutside = ({
|
|
10130
|
-
handler,
|
|
10131
|
-
events = DEFAULT_EVENTS,
|
|
10132
|
-
nodes = [],
|
|
10133
|
-
// Default to empty array to avoid undefined errors
|
|
10134
|
-
refs
|
|
10135
|
-
}) => {
|
|
10136
|
-
const ref = (0, import_react13.useRef)(null);
|
|
10137
|
-
(0, import_react13.useEffect)(() => {
|
|
10138
|
-
const listener = (event) => {
|
|
10139
|
-
const { target } = event;
|
|
10140
|
-
if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
|
|
10141
|
-
return;
|
|
10142
|
-
}
|
|
10143
|
-
if (!(target instanceof HTMLElement)) return;
|
|
10144
|
-
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
10145
|
-
const shouldTrigger = nodes.length > 0 ? nodes.every((node2) => node2 && !event.composedPath().includes(node2)) : ref.current && !ref.current.contains(target);
|
|
10146
|
-
if (shouldTrigger && !shouldIgnore) {
|
|
10147
|
-
handler(event);
|
|
10148
|
-
}
|
|
10149
|
-
};
|
|
10150
|
-
events.forEach((event) => document.addEventListener(event, listener));
|
|
10151
|
-
return () => {
|
|
10152
|
-
events.forEach((event) => document.removeEventListener(event, listener));
|
|
10153
|
-
};
|
|
10154
|
-
}, [handler, nodes, events]);
|
|
10155
|
-
return ref;
|
|
10156
|
-
};
|
|
10157
|
-
|
|
10158
|
-
// src/hooks/use-get-file-infor.ts
|
|
10159
|
-
var import_react14 = require("react");
|
|
10160
|
-
function getFileName(source, mime) {
|
|
10161
|
-
if (source instanceof File) return source.name;
|
|
10162
|
-
if (typeof source === "string") {
|
|
10163
|
-
if (source.startsWith("data:")) {
|
|
10164
|
-
const ext2 = mime?.split("/")[1] || "bin";
|
|
10165
|
-
return `file.${ext2}`;
|
|
10166
|
-
}
|
|
10167
|
-
try {
|
|
10168
|
-
const pathname = new URL(source).pathname;
|
|
10169
|
-
const filename = decodeURIComponent(pathname.split("/").pop() || "");
|
|
10170
|
-
if (filename) return filename;
|
|
10171
|
-
} catch {
|
|
10172
|
-
}
|
|
10173
|
-
return "file.bin";
|
|
10174
|
-
}
|
|
10175
|
-
const ext = mime?.split("/")[1] || "bin";
|
|
10176
|
-
return `file.${ext}`;
|
|
10177
|
-
}
|
|
10178
|
-
function useFileInfo(source, options2) {
|
|
10179
|
-
const { readAs = "all" } = options2 ?? {};
|
|
10180
|
-
const [info, setInfo] = (0, import_react14.useState)(null);
|
|
10181
|
-
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
10182
|
-
const [error2, setError] = (0, import_react14.useState)(null);
|
|
10183
|
-
const abortRef = (0, import_react14.useRef)({ aborted: false });
|
|
10184
|
-
(0, import_react14.useEffect)(() => {
|
|
10185
|
-
abortRef.current.aborted = false;
|
|
10186
|
-
if (!source) {
|
|
10187
|
-
setInfo(null);
|
|
10188
|
-
setLoading(false);
|
|
10189
|
-
setError(null);
|
|
10190
|
-
return;
|
|
10191
|
-
}
|
|
10192
|
-
let localUrl = null;
|
|
10193
|
-
let fr = null;
|
|
10194
|
-
let mediaEl = null;
|
|
10195
|
-
const makeExtension = (name2, type) => {
|
|
10196
|
-
if (name2) {
|
|
10197
|
-
const idx = name2.lastIndexOf(".");
|
|
10198
|
-
if (idx > -1) return name2.slice(idx + 1).toLowerCase();
|
|
10199
|
-
}
|
|
10200
|
-
if (type) {
|
|
10201
|
-
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
10202
|
-
return match3 ? match3[1] : null;
|
|
10203
|
-
}
|
|
10204
|
-
return null;
|
|
10205
|
-
};
|
|
10206
|
-
const toBlobFromSource = async (src) => {
|
|
10207
|
-
if (src instanceof Blob) return src;
|
|
10208
|
-
if (typeof src === "string") {
|
|
10209
|
-
const s4 = src.trim();
|
|
10210
|
-
if (s4.startsWith("data:")) {
|
|
10211
|
-
const parts = s4.split(",");
|
|
10212
|
-
const meta = parts[0];
|
|
10213
|
-
const isBase64 = meta.includes(";base64");
|
|
10214
|
-
const mimeMatch = meta.match(/data:([^;]+)/);
|
|
10215
|
-
const mime = mimeMatch ? mimeMatch[1] : "application/octet-stream";
|
|
10216
|
-
const dataPart = parts.slice(1).join(",");
|
|
10217
|
-
if (isBase64) {
|
|
10218
|
-
const binary = atob(dataPart);
|
|
10219
|
-
const len = binary.length;
|
|
10220
|
-
const arr = new Uint8Array(len);
|
|
10221
|
-
for (let i3 = 0; i3 < len; i3++) arr[i3] = binary.charCodeAt(i3);
|
|
10222
|
-
return new Blob([arr], { type: mime });
|
|
10223
|
-
} else {
|
|
10224
|
-
const decoded = decodeURIComponent(dataPart);
|
|
10225
|
-
return new Blob([decoded], { type: mime });
|
|
10226
|
-
}
|
|
10227
|
-
}
|
|
10228
|
-
const resp = await fetch(s4);
|
|
10229
|
-
if (!resp.ok) throw new Error(`Fetch failed with status ${resp.status}`);
|
|
10230
|
-
const blob = await resp.blob();
|
|
10231
|
-
return blob;
|
|
10232
|
-
}
|
|
10233
|
-
throw new Error("Unsupported source type");
|
|
10234
|
-
};
|
|
10235
|
-
const run = async () => {
|
|
10236
|
-
setLoading(true);
|
|
10237
|
-
setError(null);
|
|
10238
|
-
setInfo(null);
|
|
10239
|
-
try {
|
|
10240
|
-
const blob = await toBlobFromSource(source);
|
|
10241
|
-
if (abortRef.current.aborted) return;
|
|
10242
|
-
const fileInfo = {
|
|
10243
|
-
rawBlob: blob,
|
|
10244
|
-
size: blob.size,
|
|
10245
|
-
type: blob.type || "application/octet-stream",
|
|
10246
|
-
dataUrl: null,
|
|
10247
|
-
text: null,
|
|
10248
|
-
arrayBuffer: null,
|
|
10249
|
-
image: null,
|
|
10250
|
-
video: null,
|
|
10251
|
-
audio: null
|
|
10252
|
-
};
|
|
10253
|
-
if (source instanceof File || source instanceof Blob || typeof source === "string" && !source.startsWith("data:")) {
|
|
10254
|
-
fileInfo.name = getFileName(source, fileInfo.type);
|
|
10255
|
-
}
|
|
10256
|
-
fileInfo.extension = makeExtension(fileInfo.name, fileInfo.type);
|
|
10257
|
-
localUrl = URL.createObjectURL(blob);
|
|
10258
|
-
const readPromises = [];
|
|
10259
|
-
if (readAs === "dataUrl" || readAs === "all") {
|
|
10260
|
-
fr = new FileReader();
|
|
10261
|
-
const p = new Promise((resolve, reject) => {
|
|
10262
|
-
fr.onload = () => {
|
|
10263
|
-
if (abortRef.current.aborted) return resolve();
|
|
10264
|
-
fileInfo.dataUrl = fr.result;
|
|
10265
|
-
resolve();
|
|
10266
|
-
};
|
|
10267
|
-
fr.onerror = () => reject(fr.error);
|
|
10268
|
-
fr.readAsDataURL(blob);
|
|
10269
|
-
});
|
|
10270
|
-
readPromises.push(p);
|
|
10271
|
-
}
|
|
10272
|
-
if (readAs === "text" || readAs === "all") {
|
|
10273
|
-
const frText = new FileReader();
|
|
10274
|
-
const p = new Promise((resolve, reject) => {
|
|
10275
|
-
frText.onload = () => {
|
|
10276
|
-
if (abortRef.current.aborted) return resolve();
|
|
10277
|
-
fileInfo.text = frText.result;
|
|
10278
|
-
resolve();
|
|
10279
|
-
};
|
|
10280
|
-
frText.onerror = () => reject(frText.error);
|
|
10281
|
-
frText.readAsText(blob);
|
|
10282
|
-
});
|
|
10283
|
-
readPromises.push(p);
|
|
10284
|
-
}
|
|
10285
|
-
if (readAs === "arrayBuffer" || readAs === "all") {
|
|
10286
|
-
const frBuf = new FileReader();
|
|
10287
|
-
const p = new Promise((resolve, reject) => {
|
|
10288
|
-
frBuf.onload = () => {
|
|
10289
|
-
if (abortRef.current.aborted) return resolve();
|
|
10290
|
-
fileInfo.arrayBuffer = frBuf.result;
|
|
10291
|
-
resolve();
|
|
10292
|
-
};
|
|
10293
|
-
frBuf.onerror = () => reject(frBuf.error);
|
|
10294
|
-
frBuf.readAsArrayBuffer(blob);
|
|
10295
|
-
});
|
|
10296
|
-
readPromises.push(p);
|
|
10297
|
-
}
|
|
10298
|
-
if (fileInfo?.type?.startsWith("image/")) {
|
|
10299
|
-
const p = new Promise((resolve, reject) => {
|
|
10300
|
-
const img = new Image();
|
|
10301
|
-
img.onload = () => {
|
|
10302
|
-
if (abortRef.current.aborted) return resolve();
|
|
10303
|
-
fileInfo.image = {
|
|
10304
|
-
width: img.naturalWidth,
|
|
10305
|
-
height: img.naturalHeight
|
|
10306
|
-
};
|
|
10307
|
-
resolve();
|
|
10308
|
-
};
|
|
10309
|
-
img.onerror = () => resolve();
|
|
10310
|
-
img.src = localUrl;
|
|
10311
|
-
});
|
|
10312
|
-
readPromises.push(p);
|
|
10313
|
-
}
|
|
10314
|
-
if (fileInfo && fileInfo?.type?.startsWith("video/") || fileInfo?.type?.startsWith("audio/")) {
|
|
10315
|
-
const p = new Promise((resolve) => {
|
|
10316
|
-
const el = document.createElement(
|
|
10317
|
-
fileInfo?.type?.startsWith("video/") ? "video" : "audio"
|
|
10318
|
-
);
|
|
10319
|
-
mediaEl = el;
|
|
10320
|
-
mediaEl.preload = "metadata";
|
|
10321
|
-
mediaEl.onloadedmetadata = () => {
|
|
10322
|
-
if (abortRef.current.aborted) return resolve();
|
|
10323
|
-
const duration = isFinite(mediaEl.duration) ? mediaEl.duration : void 0;
|
|
10324
|
-
if (fileInfo?.type?.startsWith("video/")) {
|
|
10325
|
-
fileInfo.video = {
|
|
10326
|
-
width: mediaEl.videoWidth || void 0,
|
|
10327
|
-
height: mediaEl.videoHeight || void 0,
|
|
10328
|
-
duration
|
|
10329
|
-
};
|
|
10330
|
-
} else {
|
|
10331
|
-
fileInfo.audio = { duration };
|
|
10332
|
-
}
|
|
10333
|
-
resolve();
|
|
10334
|
-
};
|
|
10335
|
-
mediaEl.onerror = () => resolve();
|
|
10336
|
-
mediaEl.src = localUrl;
|
|
10337
|
-
});
|
|
10338
|
-
readPromises.push(p);
|
|
10339
|
-
}
|
|
10340
|
-
await Promise.all(readPromises);
|
|
10341
|
-
if (abortRef.current.aborted) return;
|
|
10342
|
-
setInfo(fileInfo);
|
|
10343
|
-
} catch (err) {
|
|
10344
|
-
if (!abortRef.current.aborted) setError(err?.message ?? String(err));
|
|
10345
|
-
} finally {
|
|
10346
|
-
if (!abortRef.current.aborted) setLoading(false);
|
|
10347
|
-
}
|
|
10348
|
-
};
|
|
10349
|
-
run();
|
|
10350
|
-
return () => {
|
|
10351
|
-
abortRef.current.aborted = true;
|
|
10352
|
-
if (fr && fr.readyState === 1) {
|
|
10353
|
-
try {
|
|
10354
|
-
fr.abort();
|
|
10355
|
-
} catch {
|
|
10356
|
-
}
|
|
10357
|
-
}
|
|
10358
|
-
if (mediaEl) {
|
|
10359
|
-
try {
|
|
10360
|
-
mediaEl.src = "";
|
|
10361
|
-
mediaEl.load();
|
|
10362
|
-
} catch {
|
|
10363
|
-
}
|
|
10364
|
-
}
|
|
10365
|
-
if (localUrl) URL.revokeObjectURL(localUrl);
|
|
10366
|
-
};
|
|
10367
|
-
}, [source, readAs]);
|
|
10368
|
-
return { info, loading, error: error2, reload: () => {
|
|
10369
|
-
} };
|
|
10370
|
-
}
|
|
10371
|
-
|
|
10372
|
-
// src/widgets/advanced/table/table-filter.tsx
|
|
10123
|
+
var import_react13 = require("@headlessui/react");
|
|
10373
10124
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
10374
10125
|
var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
10375
|
-
|
|
10376
|
-
const [filterPosition, setFilterPosition] = (0, import_react15.useState)(null);
|
|
10377
|
-
const filterPopupRef = (0, import_react15.useRef)(null);
|
|
10378
|
-
const filterRef = useClickOutside({
|
|
10379
|
-
handler: () => {
|
|
10380
|
-
if (openTableFilter) {
|
|
10381
|
-
setOpenTableFilter(false);
|
|
10382
|
-
}
|
|
10383
|
-
},
|
|
10384
|
-
refs: [filterPopupRef]
|
|
10385
|
-
});
|
|
10386
|
-
(0, import_react15.useEffect)(() => {
|
|
10387
|
-
const updatePosition = () => {
|
|
10388
|
-
if (filterRef.current && openTableFilter) {
|
|
10389
|
-
const rect = filterRef.current.getBoundingClientRect();
|
|
10390
|
-
setFilterPosition({
|
|
10391
|
-
top: rect.bottom + window.scrollY,
|
|
10392
|
-
left: rect.left + window.scrollX,
|
|
10393
|
-
right: window.innerWidth - rect.right
|
|
10394
|
-
});
|
|
10395
|
-
}
|
|
10396
|
-
};
|
|
10397
|
-
updatePosition();
|
|
10398
|
-
window.addEventListener("scroll", updatePosition);
|
|
10399
|
-
window.addEventListener("resize", updatePosition);
|
|
10400
|
-
return () => {
|
|
10401
|
-
window.removeEventListener("scroll", updatePosition);
|
|
10402
|
-
window.removeEventListener("resize", updatePosition);
|
|
10403
|
-
};
|
|
10404
|
-
}, [filterRef, openTableFilter]);
|
|
10405
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
10126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10406
10127
|
"div",
|
|
10407
10128
|
{
|
|
10408
|
-
ref: filterRef,
|
|
10409
10129
|
style: {
|
|
10410
10130
|
transform: "translateY(-50%)"
|
|
10411
10131
|
},
|
|
10412
|
-
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[
|
|
10413
|
-
children: [
|
|
10414
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10132
|
+
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
10133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react13.Popover, { children: [
|
|
10134
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react13.PopoverButton, { className: "p-2 rounded-lg cursor-pointer outline-none", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10415
10135
|
"button",
|
|
10416
10136
|
{
|
|
10417
10137
|
type: "button",
|
|
10418
10138
|
className: "bg-white size-8 p-1 rounded-lg cursor-pointer flex items-center justify-center",
|
|
10419
|
-
onClick: () => {
|
|
10420
|
-
setOpenTableFilter(!openTableFilter);
|
|
10421
|
-
},
|
|
10422
10139
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FilterColumnIcon, {})
|
|
10423
10140
|
}
|
|
10424
|
-
),
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
|
|
10448
|
-
|
|
10449
|
-
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10141
|
+
) }),
|
|
10142
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10143
|
+
import_react13.PopoverPanel,
|
|
10144
|
+
{
|
|
10145
|
+
transition: true,
|
|
10146
|
+
anchor: "bottom end",
|
|
10147
|
+
className: "shadow-lg z-[99] gap-2 bg-white rounded-lg transition duration-200 ease-in-out border border-stroke-disabled",
|
|
10148
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10149
|
+
"div",
|
|
10150
|
+
{
|
|
10151
|
+
style: {
|
|
10152
|
+
zIndex: 9999
|
|
10153
|
+
},
|
|
10154
|
+
className: "flex w-[250px] h-auto overflow-auto flex-col gap-[16px] rounded-[8px] bg-[#fff] px-[24px] py-[16px] shadow-md",
|
|
10155
|
+
children: columns?.filter((val) => val?.optional !== void 0)?.map((item) => {
|
|
10156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10157
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10158
|
+
"input",
|
|
10159
|
+
{
|
|
10160
|
+
type: "checkbox",
|
|
10161
|
+
id: `${item.name}`,
|
|
10162
|
+
onChange: () => onToggleColumnOptional(item),
|
|
10163
|
+
checked: item.optional !== "hide",
|
|
10164
|
+
className: "cursor-pointer"
|
|
10165
|
+
}
|
|
10166
|
+
),
|
|
10167
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10168
|
+
"label",
|
|
10169
|
+
{
|
|
10170
|
+
htmlFor: `${item.name}`,
|
|
10171
|
+
className: "flex items-center gap-[8px]",
|
|
10172
|
+
children: item.field.string
|
|
10173
|
+
}
|
|
10174
|
+
)
|
|
10175
|
+
] }, item.name);
|
|
10176
|
+
})
|
|
10177
|
+
}
|
|
10178
|
+
)
|
|
10179
|
+
}
|
|
10461
10180
|
)
|
|
10462
|
-
]
|
|
10181
|
+
] })
|
|
10463
10182
|
}
|
|
10464
10183
|
);
|
|
10465
10184
|
};
|
|
@@ -10521,7 +10240,7 @@ var TableFooter = ({ onAddRow, rows }) => {
|
|
|
10521
10240
|
};
|
|
10522
10241
|
|
|
10523
10242
|
// node_modules/react-tooltip/dist/react-tooltip.min.mjs
|
|
10524
|
-
var
|
|
10243
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
10525
10244
|
|
|
10526
10245
|
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
10527
10246
|
var min = Math.min;
|
|
@@ -11984,7 +11703,7 @@ var L = (e3) => {
|
|
|
11984
11703
|
}
|
|
11985
11704
|
return document.scrollingElement || document.documentElement;
|
|
11986
11705
|
};
|
|
11987
|
-
var C = "undefined" != typeof window ?
|
|
11706
|
+
var C = "undefined" != typeof window ? import_react14.useLayoutEffect : import_react14.useEffect;
|
|
11988
11707
|
var R = (e3) => {
|
|
11989
11708
|
e3.current && (clearTimeout(e3.current), e3.current = null);
|
|
11990
11709
|
};
|
|
@@ -11993,15 +11712,15 @@ var N = { anchorRefs: /* @__PURE__ */ new Set(), activeAnchor: { current: null }
|
|
|
11993
11712
|
}, detach: () => {
|
|
11994
11713
|
}, setActiveAnchor: () => {
|
|
11995
11714
|
} };
|
|
11996
|
-
var $ = (0,
|
|
11715
|
+
var $ = (0, import_react14.createContext)({ getTooltipData: () => N });
|
|
11997
11716
|
function z(e3 = x) {
|
|
11998
|
-
return (0,
|
|
11717
|
+
return (0, import_react14.useContext)($).getTooltipData(e3);
|
|
11999
11718
|
}
|
|
12000
11719
|
var B = { tooltip: "core-styles-module_tooltip__3vRRp", fixed: "core-styles-module_fixed__pcSol", arrow: "core-styles-module_arrow__cvMwQ", noArrow: "core-styles-module_noArrow__xock6", clickable: "core-styles-module_clickable__ZuTTB", show: "core-styles-module_show__Nt9eE", closing: "core-styles-module_closing__sGnxF" };
|
|
12001
11720
|
var D = { tooltip: "styles-module_tooltip__mnnfp", arrow: "styles-module_arrow__K0L3T", dark: "styles-module_dark__xNqje", light: "styles-module_light__Z6W-X", success: "styles-module_success__A2AKt", warning: "styles-module_warning__SCK0X", error: "styles-module_error__JvumD", info: "styles-module_info__BWdHW" };
|
|
12002
11721
|
var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u = "dark", anchorId: d, anchorSelect: p, place: v = "top", offset: m = 10, events: h2 = ["hover"], openOnClick: w3 = false, positionStrategy: b2 = "absolute", middlewares: S2, wrapper: g, delayShow: A2 = 0, delayHide: O3 = 0, float: T2 = false, hidden: x2 = false, noArrow: N3 = false, clickable: $3 = false, closeOnEsc: I2 = false, closeOnScroll: j = false, closeOnResize: q3 = false, openEvents: H2, closeEvents: M2, globalCloseEvents: W, imperativeModeOnly: P2, style: V2, position: F2, afterShow: K2, afterHide: U2, disableTooltip: X2, content: Y, contentWrapperRef: G, isOpen: Z2, defaultIsOpen: J = false, setIsOpen: Q2, activeAnchor: ee, setActiveAnchor: te, border: oe, opacity: le, arrowColor: re, arrowSize: ne = 8, role: ie = "tooltip" }) => {
|
|
12003
11722
|
var ce;
|
|
12004
|
-
const se = (0,
|
|
11723
|
+
const se = (0, import_react14.useRef)(null), ae = (0, import_react14.useRef)(null), ue = (0, import_react14.useRef)(null), de = (0, import_react14.useRef)(null), pe = (0, import_react14.useRef)(null), [ve, me] = (0, import_react14.useState)({ tooltipStyles: {}, tooltipArrowStyles: {}, place: v }), [fe, ye] = (0, import_react14.useState)(false), [he, we] = (0, import_react14.useState)(false), [be, Se] = (0, import_react14.useState)(null), ge = (0, import_react14.useRef)(false), Ee = (0, import_react14.useRef)(null), { anchorRefs: Ae, setActiveAnchor: _e } = z(l2), Oe = (0, import_react14.useRef)(false), [ke, Te] = (0, import_react14.useState)([]), Le = (0, import_react14.useRef)(false), Ce = w3 || h2.includes("click"), Re = Ce || (null == H2 ? void 0 : H2.click) || (null == H2 ? void 0 : H2.dblclick) || (null == H2 ? void 0 : H2.mousedown), xe = H2 ? { ...H2 } : { mouseover: true, focus: true, mouseenter: false, click: false, dblclick: false, mousedown: false };
|
|
12005
11724
|
!H2 && Ce && Object.assign(xe, { mouseenter: false, focus: false, mouseover: false, click: true });
|
|
12006
11725
|
const Ne = M2 ? { ...M2 } : { mouseout: true, blur: true, mouseleave: false, click: false, dblclick: false, mouseup: false };
|
|
12007
11726
|
!M2 && Ce && Object.assign(Ne, { mouseleave: false, blur: false, mouseout: false });
|
|
@@ -12014,7 +11733,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12014
11733
|
Le.current && (null == Q2 || Q2(e3), void 0 === Z2 && ye(e3));
|
|
12015
11734
|
}, 10));
|
|
12016
11735
|
};
|
|
12017
|
-
(0,
|
|
11736
|
+
(0, import_react14.useEffect)(() => {
|
|
12018
11737
|
if (void 0 === Z2) return () => null;
|
|
12019
11738
|
Z2 && we(true);
|
|
12020
11739
|
const e3 = setTimeout(() => {
|
|
@@ -12023,7 +11742,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12023
11742
|
return () => {
|
|
12024
11743
|
clearTimeout(e3);
|
|
12025
11744
|
};
|
|
12026
|
-
}, [Z2]), (0,
|
|
11745
|
+
}, [Z2]), (0, import_react14.useEffect)(() => {
|
|
12027
11746
|
if (fe !== ge.current) if (R(pe), ge.current = fe, fe) null == K2 || K2();
|
|
12028
11747
|
else {
|
|
12029
11748
|
const e3 = ((e4) => {
|
|
@@ -12076,14 +11795,14 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12076
11795
|
Ve.cancel(), Pe(e3);
|
|
12077
11796
|
}, Ke = () => {
|
|
12078
11797
|
Pe.cancel(), Ve();
|
|
12079
|
-
}, Ue = (0,
|
|
11798
|
+
}, Ue = (0, import_react14.useCallback)(() => {
|
|
12080
11799
|
var e3, t4;
|
|
12081
11800
|
const o3 = null !== (e3 = null == be ? void 0 : be.position) && void 0 !== e3 ? e3 : F2;
|
|
12082
11801
|
o3 ? He(o3) : T2 ? Ee.current && He(Ee.current) : (null == ee ? void 0 : ee.isConnected) && E({ place: null !== (t4 = null == be ? void 0 : be.place) && void 0 !== t4 ? t4 : v, offset: m, elementReference: ee, tooltipReference: se.current, tooltipArrowReference: ae.current, strategy: b2, middlewares: S2, border: oe, arrowSize: ne }).then((e4) => {
|
|
12083
11802
|
Le.current && ze(e4);
|
|
12084
11803
|
});
|
|
12085
11804
|
}, [fe, ee, Y, V2, v, null == be ? void 0 : be.place, m, b2, F2, null == be ? void 0 : be.position, T2, ne]);
|
|
12086
|
-
(0,
|
|
11805
|
+
(0, import_react14.useEffect)(() => {
|
|
12087
11806
|
var e3, t4;
|
|
12088
11807
|
const o3 = new Set(Ae);
|
|
12089
11808
|
ke.forEach((e4) => {
|
|
@@ -12130,7 +11849,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12130
11849
|
});
|
|
12131
11850
|
});
|
|
12132
11851
|
};
|
|
12133
|
-
}, [ee, Ue, he, Ae, ke, H2, M2, W, Ce, A2, O3]), (0,
|
|
11852
|
+
}, [ee, Ue, he, Ae, ke, H2, M2, W, Ce, A2, O3]), (0, import_react14.useEffect)(() => {
|
|
12134
11853
|
var e3, t4;
|
|
12135
11854
|
let o3 = null !== (t4 = null !== (e3 = null == be ? void 0 : be.anchorSelect) && void 0 !== e3 ? e3 : p) && void 0 !== t4 ? t4 : "";
|
|
12136
11855
|
!o3 && l2 && (o3 = `[data-tooltip-id='${l2.replace(/'/g, "\\'")}']`);
|
|
@@ -12163,9 +11882,9 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12163
11882
|
return r4.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-tooltip-id"], attributeOldValue: true }), () => {
|
|
12164
11883
|
r4.disconnect();
|
|
12165
11884
|
};
|
|
12166
|
-
}, [l2, p, null == be ? void 0 : be.anchorSelect, ee]), (0,
|
|
11885
|
+
}, [l2, p, null == be ? void 0 : be.anchorSelect, ee]), (0, import_react14.useEffect)(() => {
|
|
12167
11886
|
Ue();
|
|
12168
|
-
}, [Ue]), (0,
|
|
11887
|
+
}, [Ue]), (0, import_react14.useEffect)(() => {
|
|
12169
11888
|
if (!(null == G ? void 0 : G.current)) return () => null;
|
|
12170
11889
|
const e3 = new ResizeObserver(() => {
|
|
12171
11890
|
setTimeout(() => Ue());
|
|
@@ -12173,13 +11892,13 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12173
11892
|
return e3.observe(G.current), () => {
|
|
12174
11893
|
e3.disconnect();
|
|
12175
11894
|
};
|
|
12176
|
-
}, [Y, null == G ? void 0 : G.current]), (0,
|
|
11895
|
+
}, [Y, null == G ? void 0 : G.current]), (0, import_react14.useEffect)(() => {
|
|
12177
11896
|
var e3;
|
|
12178
11897
|
const t4 = document.querySelector(`[id='${d}']`), o3 = [...ke, t4];
|
|
12179
11898
|
ee && o3.includes(ee) || te(null !== (e3 = ke[0]) && void 0 !== e3 ? e3 : t4);
|
|
12180
|
-
}, [d, ke, ee]), (0,
|
|
11899
|
+
}, [d, ke, ee]), (0, import_react14.useEffect)(() => (J && Ie(true), () => {
|
|
12181
11900
|
R(ue), R(de);
|
|
12182
|
-
}), []), (0,
|
|
11901
|
+
}), []), (0, import_react14.useEffect)(() => {
|
|
12183
11902
|
var e3;
|
|
12184
11903
|
let t4 = null !== (e3 = null == be ? void 0 : be.anchorSelect) && void 0 !== e3 ? e3 : p;
|
|
12185
11904
|
if (!t4 && l2 && (t4 = `[data-tooltip-id='${l2.replace(/'/g, "\\'")}']`), t4) try {
|
|
@@ -12188,11 +11907,11 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12188
11907
|
} catch (e4) {
|
|
12189
11908
|
Te([]);
|
|
12190
11909
|
}
|
|
12191
|
-
}, [l2, p, null == be ? void 0 : be.anchorSelect]), (0,
|
|
11910
|
+
}, [l2, p, null == be ? void 0 : be.anchorSelect]), (0, import_react14.useEffect)(() => {
|
|
12192
11911
|
ue.current && (R(ue), je(A2));
|
|
12193
11912
|
}, [A2]);
|
|
12194
11913
|
const Xe = null !== (ce = null == be ? void 0 : be.content) && void 0 !== ce ? ce : Y, Ye = fe && Object.keys(ve.tooltipStyles).length > 0;
|
|
12195
|
-
return (0,
|
|
11914
|
+
return (0, import_react14.useImperativeHandle)(t3, () => ({ open: (e3) => {
|
|
12196
11915
|
if (null == e3 ? void 0 : e3.anchorSelect) try {
|
|
12197
11916
|
document.querySelector(e3.anchorSelect);
|
|
12198
11917
|
} catch (t4) {
|
|
@@ -12201,13 +11920,13 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12201
11920
|
Se(null != e3 ? e3 : null), (null == e3 ? void 0 : e3.delay) ? je(e3.delay) : Ie(true);
|
|
12202
11921
|
}, close: (e3) => {
|
|
12203
11922
|
(null == e3 ? void 0 : e3.delay) ? Be(e3.delay) : Ie(false);
|
|
12204
|
-
}, activeAnchor: ee, place: ve.place, isOpen: Boolean(he && !x2 && Xe && Ye) })), he && !x2 && Xe ?
|
|
11923
|
+
}, activeAnchor: ee, place: ve.place, isOpen: Boolean(he && !x2 && Xe && Ye) })), he && !x2 && Xe ? import_react14.default.createElement(g, { id: l2, role: ie, className: (0, import_classnames.default)("react-tooltip", B.tooltip, D.tooltip, D[u], i3, `react-tooltip__place-${ve.place}`, B[Ye ? "show" : "closing"], Ye ? "react-tooltip__show" : "react-tooltip__closing", "fixed" === b2 && B.fixed, $3 && B.clickable), onTransitionEnd: (e3) => {
|
|
12205
11924
|
R(pe), fe || "opacity" !== e3.propertyName || (we(false), Se(null), null == U2 || U2());
|
|
12206
|
-
}, style: { ...V2, ...ve.tooltipStyles, opacity: void 0 !== le && Ye ? le : void 0 }, ref: se }, Xe,
|
|
11925
|
+
}, style: { ...V2, ...ve.tooltipStyles, opacity: void 0 !== le && Ye ? le : void 0 }, ref: se }, Xe, import_react14.default.createElement(g, { className: (0, import_classnames.default)("react-tooltip-arrow", B.arrow, D.arrow, c2, N3 && B.noArrow), style: { ...ve.tooltipArrowStyles, background: re ? `linear-gradient(to right bottom, transparent 50%, ${re} 50%)` : void 0, "--rt-arrow-size": `${ne}px` }, ref: ae })) : null;
|
|
12207
11926
|
};
|
|
12208
|
-
var H = ({ content: t3 }) =>
|
|
12209
|
-
var M =
|
|
12210
|
-
const [ee, te] = (0,
|
|
11927
|
+
var H = ({ content: t3 }) => import_react14.default.createElement("span", { dangerouslySetInnerHTML: { __html: t3 } });
|
|
11928
|
+
var M = import_react14.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect: n4, content: i3, html: c2, render: a2, className: u, classNameArrow: d, variant: p = "dark", place: v = "top", offset: m = 10, wrapper: f = "div", children: h2 = null, events: w3 = ["hover"], openOnClick: b2 = false, positionStrategy: S2 = "absolute", middlewares: g, delayShow: E2 = 0, delayHide: _2 = 0, float: O3 = false, hidden: k2 = false, noArrow: T2 = false, clickable: L3 = false, closeOnEsc: C2 = false, closeOnScroll: R2 = false, closeOnResize: x2 = false, openEvents: N3, closeEvents: $3, globalCloseEvents: I2, imperativeModeOnly: j = false, style: B2, position: D2, isOpen: M2, defaultIsOpen: W = false, disableStyleInjection: P2 = false, border: V2, opacity: F2, arrowColor: K2, arrowSize: U2, setIsOpen: X2, afterShow: Y, afterHide: G, disableTooltip: Z2, role: J = "tooltip" }, Q2) => {
|
|
11929
|
+
const [ee, te] = (0, import_react14.useState)(i3), [oe, le] = (0, import_react14.useState)(c2), [re, ne] = (0, import_react14.useState)(v), [ie, ce] = (0, import_react14.useState)(p), [se, ae] = (0, import_react14.useState)(m), [ue, de] = (0, import_react14.useState)(E2), [pe, ve] = (0, import_react14.useState)(_2), [me, fe] = (0, import_react14.useState)(O3), [ye, he] = (0, import_react14.useState)(k2), [we, be] = (0, import_react14.useState)(f), [Se, ge] = (0, import_react14.useState)(w3), [Ee, Ae] = (0, import_react14.useState)(S2), [_e, Oe] = (0, import_react14.useState)(null), [ke, Te] = (0, import_react14.useState)(null), Le = (0, import_react14.useRef)(P2), { anchorRefs: Ce, activeAnchor: Re } = z(t3), xe = (e3) => null == e3 ? void 0 : e3.getAttributeNames().reduce((t4, o3) => {
|
|
12211
11930
|
var l3;
|
|
12212
11931
|
if (o3.startsWith("data-tooltip-")) {
|
|
12213
11932
|
t4[o3.replace(/^data-tooltip-/, "")] = null !== (l3 = null == e3 ? void 0 : e3.getAttribute(o3)) && void 0 !== l3 ? l3 : null;
|
|
@@ -12251,31 +11970,31 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12251
11970
|
null === (l3 = t4[e4]) || void 0 === l3 || l3.call(t4, o3);
|
|
12252
11971
|
});
|
|
12253
11972
|
};
|
|
12254
|
-
(0,
|
|
11973
|
+
(0, import_react14.useEffect)(() => {
|
|
12255
11974
|
te(i3);
|
|
12256
|
-
}, [i3]), (0,
|
|
11975
|
+
}, [i3]), (0, import_react14.useEffect)(() => {
|
|
12257
11976
|
le(c2);
|
|
12258
|
-
}, [c2]), (0,
|
|
11977
|
+
}, [c2]), (0, import_react14.useEffect)(() => {
|
|
12259
11978
|
ne(v);
|
|
12260
|
-
}, [v]), (0,
|
|
11979
|
+
}, [v]), (0, import_react14.useEffect)(() => {
|
|
12261
11980
|
ce(p);
|
|
12262
|
-
}, [p]), (0,
|
|
11981
|
+
}, [p]), (0, import_react14.useEffect)(() => {
|
|
12263
11982
|
ae(m);
|
|
12264
|
-
}, [m]), (0,
|
|
11983
|
+
}, [m]), (0, import_react14.useEffect)(() => {
|
|
12265
11984
|
de(E2);
|
|
12266
|
-
}, [E2]), (0,
|
|
11985
|
+
}, [E2]), (0, import_react14.useEffect)(() => {
|
|
12267
11986
|
ve(_2);
|
|
12268
|
-
}, [_2]), (0,
|
|
11987
|
+
}, [_2]), (0, import_react14.useEffect)(() => {
|
|
12269
11988
|
fe(O3);
|
|
12270
|
-
}, [O3]), (0,
|
|
11989
|
+
}, [O3]), (0, import_react14.useEffect)(() => {
|
|
12271
11990
|
he(k2);
|
|
12272
|
-
}, [k2]), (0,
|
|
11991
|
+
}, [k2]), (0, import_react14.useEffect)(() => {
|
|
12273
11992
|
Ae(S2);
|
|
12274
|
-
}, [S2]), (0,
|
|
11993
|
+
}, [S2]), (0, import_react14.useEffect)(() => {
|
|
12275
11994
|
Le.current !== P2 && console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.");
|
|
12276
|
-
}, [P2]), (0,
|
|
11995
|
+
}, [P2]), (0, import_react14.useEffect)(() => {
|
|
12277
11996
|
"undefined" != typeof window && window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles", { detail: { disableCore: "core" === P2, disableBase: P2 } }));
|
|
12278
|
-
}, []), (0,
|
|
11997
|
+
}, []), (0, import_react14.useEffect)(() => {
|
|
12279
11998
|
var e3;
|
|
12280
11999
|
const o3 = new Set(Ce);
|
|
12281
12000
|
let r4 = n4;
|
|
@@ -12303,18 +12022,18 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12303
12022
|
return () => {
|
|
12304
12023
|
s4.disconnect();
|
|
12305
12024
|
};
|
|
12306
|
-
}, [Ce, Re, ke, l2, n4]), (0,
|
|
12025
|
+
}, [Ce, Re, ke, l2, n4]), (0, import_react14.useEffect)(() => {
|
|
12307
12026
|
(null == B2 ? void 0 : B2.border) && console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."), V2 && !A("border", `${V2}`) && console.warn(`[react-tooltip] "${V2}" is not a valid \`border\`.`), (null == B2 ? void 0 : B2.opacity) && console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."), F2 && !A("opacity", `${F2}`) && console.warn(`[react-tooltip] "${F2}" is not a valid \`opacity\`.`);
|
|
12308
12027
|
}, []);
|
|
12309
12028
|
let $e = h2;
|
|
12310
|
-
const Ie = (0,
|
|
12029
|
+
const Ie = (0, import_react14.useRef)(null);
|
|
12311
12030
|
if (a2) {
|
|
12312
12031
|
const t4 = a2({ content: (null == ke ? void 0 : ke.getAttribute("data-tooltip-content")) || ee || null, activeAnchor: ke });
|
|
12313
|
-
$e = t4 ?
|
|
12032
|
+
$e = t4 ? import_react14.default.createElement("div", { ref: Ie, className: "react-tooltip-content-wrapper" }, t4) : null;
|
|
12314
12033
|
} else ee && ($e = ee);
|
|
12315
|
-
oe && ($e =
|
|
12034
|
+
oe && ($e = import_react14.default.createElement(H, { content: oe }));
|
|
12316
12035
|
const ze = { forwardRef: Q2, id: t3, anchorId: l2, anchorSelect: n4, className: (0, import_classnames.default)(u, _e), classNameArrow: d, content: $e, contentWrapperRef: Ie, place: re, variant: ie, offset: se, wrapper: we, events: Se, openOnClick: b2, positionStrategy: Ee, middlewares: g, delayShow: ue, delayHide: pe, float: me, hidden: ye, noArrow: T2, clickable: L3, closeOnEsc: C2, closeOnScroll: R2, closeOnResize: x2, openEvents: N3, closeEvents: $3, globalCloseEvents: I2, imperativeModeOnly: j, style: B2, position: D2, isOpen: M2, defaultIsOpen: W, border: V2, opacity: F2, arrowColor: K2, arrowSize: U2, setIsOpen: X2, afterShow: Y, afterHide: G, disableTooltip: Z2, activeAnchor: ke, setActiveAnchor: (e3) => Te(e3), role: J };
|
|
12317
|
-
return
|
|
12036
|
+
return import_react14.default.createElement(q, { ...ze });
|
|
12318
12037
|
});
|
|
12319
12038
|
"undefined" != typeof window && window.addEventListener("react-tooltip-inject-styles", (e3) => {
|
|
12320
12039
|
e3.detail.disableCore || S({ css: `:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s;--rt-arrow-size:8px}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit;z-index:-1}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}`, type: "core" }), e3.detail.disableBase || S({ css: `
|
|
@@ -12322,7 +12041,7 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12322
12041
|
});
|
|
12323
12042
|
|
|
12324
12043
|
// src/widgets/advanced/table/table-head.tsx
|
|
12325
|
-
var
|
|
12044
|
+
var import_react_dom = require("react-dom");
|
|
12326
12045
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12327
12046
|
var TableHead = (props) => {
|
|
12328
12047
|
const {
|
|
@@ -12370,7 +12089,7 @@ var TableHead = (props) => {
|
|
|
12370
12089
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "cursor-pointer flex items-center gap-[4px] w-full group relative", children: [
|
|
12371
12090
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "truncate line-clamp-1 w-fit", children: col.title }),
|
|
12372
12091
|
col?.field?.help && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
12373
|
-
(0,
|
|
12092
|
+
(0, import_react_dom.createPortal)(
|
|
12374
12093
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12375
12094
|
M,
|
|
12376
12095
|
{
|
|
@@ -12798,7 +12517,7 @@ var EmptyTable = () => {
|
|
|
12798
12517
|
};
|
|
12799
12518
|
|
|
12800
12519
|
// node_modules/react-hook-form/dist/index.esm.mjs
|
|
12801
|
-
var
|
|
12520
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
12802
12521
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
12803
12522
|
var isDateObject = (value) => value instanceof Date;
|
|
12804
12523
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -12886,9 +12605,9 @@ var INPUT_VALIDATION_RULES = {
|
|
|
12886
12605
|
required: "required",
|
|
12887
12606
|
validate: "validate"
|
|
12888
12607
|
};
|
|
12889
|
-
var HookFormContext =
|
|
12608
|
+
var HookFormContext = import_react15.default.createContext(null);
|
|
12890
12609
|
HookFormContext.displayName = "HookFormContext";
|
|
12891
|
-
var useFormContext = () =>
|
|
12610
|
+
var useFormContext = () => import_react15.default.useContext(HookFormContext);
|
|
12892
12611
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
12893
12612
|
const result = {
|
|
12894
12613
|
defaultValues: control._defaultValues
|
|
@@ -12907,12 +12626,12 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12907
12626
|
}
|
|
12908
12627
|
return result;
|
|
12909
12628
|
};
|
|
12910
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
12629
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react15.default.useLayoutEffect : import_react15.default.useEffect;
|
|
12911
12630
|
function useFormState(props) {
|
|
12912
12631
|
const methods = useFormContext();
|
|
12913
12632
|
const { control = methods.control, disabled, name: name2, exact } = props || {};
|
|
12914
|
-
const [formState, updateFormState] =
|
|
12915
|
-
const _localProxyFormState =
|
|
12633
|
+
const [formState, updateFormState] = import_react15.default.useState(control._formState);
|
|
12634
|
+
const _localProxyFormState = import_react15.default.useRef({
|
|
12916
12635
|
isDirty: false,
|
|
12917
12636
|
isLoading: false,
|
|
12918
12637
|
dirtyFields: false,
|
|
@@ -12933,10 +12652,10 @@ function useFormState(props) {
|
|
|
12933
12652
|
});
|
|
12934
12653
|
}
|
|
12935
12654
|
}), [name2, disabled, exact]);
|
|
12936
|
-
|
|
12655
|
+
import_react15.default.useEffect(() => {
|
|
12937
12656
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12938
12657
|
}, [control]);
|
|
12939
|
-
return
|
|
12658
|
+
return import_react15.default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
|
|
12940
12659
|
}
|
|
12941
12660
|
var isString3 = (value) => typeof value === "string";
|
|
12942
12661
|
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
@@ -12985,12 +12704,12 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12985
12704
|
function useWatch(props) {
|
|
12986
12705
|
const methods = useFormContext();
|
|
12987
12706
|
const { control = methods.control, name: name2, defaultValue, disabled, exact, compute } = props || {};
|
|
12988
|
-
const _defaultValue =
|
|
12989
|
-
const _compute =
|
|
12990
|
-
const _computeFormValues =
|
|
12707
|
+
const _defaultValue = import_react15.default.useRef(defaultValue);
|
|
12708
|
+
const _compute = import_react15.default.useRef(compute);
|
|
12709
|
+
const _computeFormValues = import_react15.default.useRef(void 0);
|
|
12991
12710
|
_compute.current = compute;
|
|
12992
|
-
const defaultValueMemo =
|
|
12993
|
-
const [value, updateValue] =
|
|
12711
|
+
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(name2, _defaultValue.current), [control, name2]);
|
|
12712
|
+
const [value, updateValue] = import_react15.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12994
12713
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12995
12714
|
name: name2,
|
|
12996
12715
|
formState: {
|
|
@@ -13012,14 +12731,14 @@ function useWatch(props) {
|
|
|
13012
12731
|
}
|
|
13013
12732
|
}
|
|
13014
12733
|
}), [control, disabled, name2, exact]);
|
|
13015
|
-
|
|
12734
|
+
import_react15.default.useEffect(() => control._removeUnmounted());
|
|
13016
12735
|
return value;
|
|
13017
12736
|
}
|
|
13018
12737
|
function useController(props) {
|
|
13019
12738
|
const methods = useFormContext();
|
|
13020
12739
|
const { name: name2, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
13021
12740
|
const isArrayField = isNameInFieldArray(control._names.array, name2);
|
|
13022
|
-
const defaultValueMemo =
|
|
12741
|
+
const defaultValueMemo = import_react15.default.useMemo(() => get2(control._formValues, name2, get2(control._defaultValues, name2, defaultValue)), [control, name2, defaultValue]);
|
|
13023
12742
|
const value = useWatch({
|
|
13024
12743
|
control,
|
|
13025
12744
|
name: name2,
|
|
@@ -13031,14 +12750,14 @@ function useController(props) {
|
|
|
13031
12750
|
name: name2,
|
|
13032
12751
|
exact: true
|
|
13033
12752
|
});
|
|
13034
|
-
const _props =
|
|
13035
|
-
const _registerProps =
|
|
12753
|
+
const _props = import_react15.default.useRef(props);
|
|
12754
|
+
const _registerProps = import_react15.default.useRef(control.register(name2, {
|
|
13036
12755
|
...props.rules,
|
|
13037
12756
|
value,
|
|
13038
12757
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
13039
12758
|
}));
|
|
13040
12759
|
_props.current = props;
|
|
13041
|
-
const fieldState =
|
|
12760
|
+
const fieldState = import_react15.default.useMemo(() => Object.defineProperties({}, {
|
|
13042
12761
|
invalid: {
|
|
13043
12762
|
enumerable: true,
|
|
13044
12763
|
get: () => !!get2(formState.errors, name2)
|
|
@@ -13060,21 +12779,21 @@ function useController(props) {
|
|
|
13060
12779
|
get: () => get2(formState.errors, name2)
|
|
13061
12780
|
}
|
|
13062
12781
|
}), [formState, name2]);
|
|
13063
|
-
const onChange2 =
|
|
12782
|
+
const onChange2 = import_react15.default.useCallback((event) => _registerProps.current.onChange({
|
|
13064
12783
|
target: {
|
|
13065
12784
|
value: getEventValue(event),
|
|
13066
12785
|
name: name2
|
|
13067
12786
|
},
|
|
13068
12787
|
type: EVENTS.CHANGE
|
|
13069
12788
|
}), [name2]);
|
|
13070
|
-
const onBlur =
|
|
12789
|
+
const onBlur = import_react15.default.useCallback(() => _registerProps.current.onBlur({
|
|
13071
12790
|
target: {
|
|
13072
12791
|
value: get2(control._formValues, name2),
|
|
13073
12792
|
name: name2
|
|
13074
12793
|
},
|
|
13075
12794
|
type: EVENTS.BLUR
|
|
13076
12795
|
}), [name2, control._formValues]);
|
|
13077
|
-
const ref =
|
|
12796
|
+
const ref = import_react15.default.useCallback((elm) => {
|
|
13078
12797
|
const field2 = get2(control._fields, name2);
|
|
13079
12798
|
if (field2 && elm) {
|
|
13080
12799
|
field2._f.ref = {
|
|
@@ -13085,7 +12804,7 @@ function useController(props) {
|
|
|
13085
12804
|
};
|
|
13086
12805
|
}
|
|
13087
12806
|
}, [control._fields, name2]);
|
|
13088
|
-
const field =
|
|
12807
|
+
const field = import_react15.default.useMemo(() => ({
|
|
13089
12808
|
name: name2,
|
|
13090
12809
|
value,
|
|
13091
12810
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
@@ -13093,7 +12812,7 @@ function useController(props) {
|
|
|
13093
12812
|
onBlur,
|
|
13094
12813
|
ref
|
|
13095
12814
|
}), [name2, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13096
|
-
|
|
12815
|
+
import_react15.default.useEffect(() => {
|
|
13097
12816
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13098
12817
|
control.register(name2, {
|
|
13099
12818
|
..._props.current.rules,
|
|
@@ -13118,13 +12837,13 @@ function useController(props) {
|
|
|
13118
12837
|
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name2) : updateMounted(name2, false);
|
|
13119
12838
|
};
|
|
13120
12839
|
}, [name2, control, isArrayField, shouldUnregister]);
|
|
13121
|
-
|
|
12840
|
+
import_react15.default.useEffect(() => {
|
|
13122
12841
|
control._setDisabledField({
|
|
13123
12842
|
disabled,
|
|
13124
12843
|
name: name2
|
|
13125
12844
|
});
|
|
13126
12845
|
}, [disabled, name2, control]);
|
|
13127
|
-
return
|
|
12846
|
+
return import_react15.default.useMemo(() => ({
|
|
13128
12847
|
field,
|
|
13129
12848
|
formState,
|
|
13130
12849
|
fieldState
|
|
@@ -14424,9 +14143,9 @@ function createFormControl(props = {}) {
|
|
|
14424
14143
|
};
|
|
14425
14144
|
}
|
|
14426
14145
|
function useForm(props = {}) {
|
|
14427
|
-
const _formControl =
|
|
14428
|
-
const _values =
|
|
14429
|
-
const [formState, updateFormState] =
|
|
14146
|
+
const _formControl = import_react15.default.useRef(void 0);
|
|
14147
|
+
const _values = import_react15.default.useRef(void 0);
|
|
14148
|
+
const [formState, updateFormState] = import_react15.default.useState({
|
|
14430
14149
|
isDirty: false,
|
|
14431
14150
|
isValidating: false,
|
|
14432
14151
|
isLoading: isFunction(props.defaultValues),
|
|
@@ -14475,8 +14194,8 @@ function useForm(props = {}) {
|
|
|
14475
14194
|
control._formState.isReady = true;
|
|
14476
14195
|
return sub;
|
|
14477
14196
|
}, [control]);
|
|
14478
|
-
|
|
14479
|
-
|
|
14197
|
+
import_react15.default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
14198
|
+
import_react15.default.useEffect(() => {
|
|
14480
14199
|
if (props.mode) {
|
|
14481
14200
|
control._options.mode = props.mode;
|
|
14482
14201
|
}
|
|
@@ -14484,18 +14203,18 @@ function useForm(props = {}) {
|
|
|
14484
14203
|
control._options.reValidateMode = props.reValidateMode;
|
|
14485
14204
|
}
|
|
14486
14205
|
}, [control, props.mode, props.reValidateMode]);
|
|
14487
|
-
|
|
14206
|
+
import_react15.default.useEffect(() => {
|
|
14488
14207
|
if (props.errors) {
|
|
14489
14208
|
control._setErrors(props.errors);
|
|
14490
14209
|
control._focusError();
|
|
14491
14210
|
}
|
|
14492
14211
|
}, [control, props.errors]);
|
|
14493
|
-
|
|
14212
|
+
import_react15.default.useEffect(() => {
|
|
14494
14213
|
props.shouldUnregister && control._subjects.state.next({
|
|
14495
14214
|
values: control._getWatch()
|
|
14496
14215
|
});
|
|
14497
14216
|
}, [control, props.shouldUnregister]);
|
|
14498
|
-
|
|
14217
|
+
import_react15.default.useEffect(() => {
|
|
14499
14218
|
if (control._proxyFormState.isDirty) {
|
|
14500
14219
|
const isDirty = control._getDirty();
|
|
14501
14220
|
if (isDirty !== formState.isDirty) {
|
|
@@ -14505,7 +14224,7 @@ function useForm(props = {}) {
|
|
|
14505
14224
|
}
|
|
14506
14225
|
}
|
|
14507
14226
|
}, [control, formState.isDirty]);
|
|
14508
|
-
|
|
14227
|
+
import_react15.default.useEffect(() => {
|
|
14509
14228
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
14510
14229
|
control._reset(props.values, {
|
|
14511
14230
|
keepFieldsRef: true,
|
|
@@ -14517,7 +14236,7 @@ function useForm(props = {}) {
|
|
|
14517
14236
|
control._resetDefaultValues();
|
|
14518
14237
|
}
|
|
14519
14238
|
}, [control, props.values]);
|
|
14520
|
-
|
|
14239
|
+
import_react15.default.useEffect(() => {
|
|
14521
14240
|
if (!control._state.mount) {
|
|
14522
14241
|
control._setValid();
|
|
14523
14242
|
control._state.mount = true;
|
|
@@ -14632,7 +14351,7 @@ var Button = React2.forwardRef(
|
|
|
14632
14351
|
Button.displayName = "Button";
|
|
14633
14352
|
|
|
14634
14353
|
// src/widgets/advanced/login/shared/text-input.tsx
|
|
14635
|
-
var
|
|
14354
|
+
var import_react16 = require("react");
|
|
14636
14355
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14637
14356
|
function TextInput(props) {
|
|
14638
14357
|
const {
|
|
@@ -14646,7 +14365,7 @@ function TextInput(props) {
|
|
|
14646
14365
|
errors,
|
|
14647
14366
|
required
|
|
14648
14367
|
} = props;
|
|
14649
|
-
const [showPassword, setShowPassword] = (0,
|
|
14368
|
+
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
14650
14369
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `flex justify-center gap-2 flex-col ${className}`, children: [
|
|
14651
14370
|
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("label", { className: "text-[#262626] text-sm leading-5 font-semibold", children: [
|
|
14652
14371
|
label,
|
|
@@ -14688,7 +14407,7 @@ function TextInput(props) {
|
|
|
14688
14407
|
}
|
|
14689
14408
|
|
|
14690
14409
|
// src/widgets/advanced/login/provider/credential/form-options/index.tsx
|
|
14691
|
-
var
|
|
14410
|
+
var import_react17 = require("react");
|
|
14692
14411
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
14693
14412
|
var STAY_LOGIN_IN = "stayLoginIn";
|
|
14694
14413
|
function FormOptions({
|
|
@@ -14712,7 +14431,7 @@ function FormOptions({
|
|
|
14712
14431
|
}
|
|
14713
14432
|
}
|
|
14714
14433
|
}
|
|
14715
|
-
(0,
|
|
14434
|
+
(0, import_react17.useEffect)(() => {
|
|
14716
14435
|
localStorage.setItem(STAY_LOGIN_IN, "false");
|
|
14717
14436
|
}, []);
|
|
14718
14437
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex justify-between items-center text-[#005aa9] text-sm leading-5 font-medium select-none", children: [
|
|
@@ -15019,6 +14738,252 @@ var PopupFilter = ({
|
|
|
15019
14738
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
15020
14739
|
var import_react21 = require("react");
|
|
15021
14740
|
|
|
14741
|
+
// src/hooks/use-click-outside.ts
|
|
14742
|
+
var import_react18 = require("react");
|
|
14743
|
+
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
14744
|
+
var useClickOutside = ({
|
|
14745
|
+
handler,
|
|
14746
|
+
events = DEFAULT_EVENTS,
|
|
14747
|
+
nodes = [],
|
|
14748
|
+
// Default to empty array to avoid undefined errors
|
|
14749
|
+
refs
|
|
14750
|
+
}) => {
|
|
14751
|
+
const ref = (0, import_react18.useRef)(null);
|
|
14752
|
+
(0, import_react18.useEffect)(() => {
|
|
14753
|
+
const listener = (event) => {
|
|
14754
|
+
const { target } = event;
|
|
14755
|
+
if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
|
|
14756
|
+
return;
|
|
14757
|
+
}
|
|
14758
|
+
if (!(target instanceof HTMLElement)) return;
|
|
14759
|
+
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
14760
|
+
const shouldTrigger = nodes.length > 0 ? nodes.every((node2) => node2 && !event.composedPath().includes(node2)) : ref.current && !ref.current.contains(target);
|
|
14761
|
+
if (shouldTrigger && !shouldIgnore) {
|
|
14762
|
+
handler(event);
|
|
14763
|
+
}
|
|
14764
|
+
};
|
|
14765
|
+
events.forEach((event) => document.addEventListener(event, listener));
|
|
14766
|
+
return () => {
|
|
14767
|
+
events.forEach((event) => document.removeEventListener(event, listener));
|
|
14768
|
+
};
|
|
14769
|
+
}, [handler, nodes, events]);
|
|
14770
|
+
return ref;
|
|
14771
|
+
};
|
|
14772
|
+
|
|
14773
|
+
// src/hooks/use-get-file-infor.ts
|
|
14774
|
+
var import_react19 = require("react");
|
|
14775
|
+
function getFileName(source, mime) {
|
|
14776
|
+
if (source instanceof File) return source.name;
|
|
14777
|
+
if (typeof source === "string") {
|
|
14778
|
+
if (source.startsWith("data:")) {
|
|
14779
|
+
const ext2 = mime?.split("/")[1] || "bin";
|
|
14780
|
+
return `file.${ext2}`;
|
|
14781
|
+
}
|
|
14782
|
+
try {
|
|
14783
|
+
const pathname = new URL(source).pathname;
|
|
14784
|
+
const filename = decodeURIComponent(pathname.split("/").pop() || "");
|
|
14785
|
+
if (filename) return filename;
|
|
14786
|
+
} catch {
|
|
14787
|
+
}
|
|
14788
|
+
return "file.bin";
|
|
14789
|
+
}
|
|
14790
|
+
const ext = mime?.split("/")[1] || "bin";
|
|
14791
|
+
return `file.${ext}`;
|
|
14792
|
+
}
|
|
14793
|
+
function useFileInfo(source, options2) {
|
|
14794
|
+
const { readAs = "all" } = options2 ?? {};
|
|
14795
|
+
const [info, setInfo] = (0, import_react19.useState)(null);
|
|
14796
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
14797
|
+
const [error2, setError] = (0, import_react19.useState)(null);
|
|
14798
|
+
const abortRef = (0, import_react19.useRef)({ aborted: false });
|
|
14799
|
+
(0, import_react19.useEffect)(() => {
|
|
14800
|
+
abortRef.current.aborted = false;
|
|
14801
|
+
if (!source) {
|
|
14802
|
+
setInfo(null);
|
|
14803
|
+
setLoading(false);
|
|
14804
|
+
setError(null);
|
|
14805
|
+
return;
|
|
14806
|
+
}
|
|
14807
|
+
let localUrl = null;
|
|
14808
|
+
let fr = null;
|
|
14809
|
+
let mediaEl = null;
|
|
14810
|
+
const makeExtension = (name2, type) => {
|
|
14811
|
+
if (name2) {
|
|
14812
|
+
const idx = name2.lastIndexOf(".");
|
|
14813
|
+
if (idx > -1) return name2.slice(idx + 1).toLowerCase();
|
|
14814
|
+
}
|
|
14815
|
+
if (type) {
|
|
14816
|
+
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
14817
|
+
return match3 ? match3[1] : null;
|
|
14818
|
+
}
|
|
14819
|
+
return null;
|
|
14820
|
+
};
|
|
14821
|
+
const toBlobFromSource = async (src) => {
|
|
14822
|
+
if (src instanceof Blob) return src;
|
|
14823
|
+
if (typeof src === "string") {
|
|
14824
|
+
const s4 = src.trim();
|
|
14825
|
+
if (s4.startsWith("data:")) {
|
|
14826
|
+
const parts = s4.split(",");
|
|
14827
|
+
const meta = parts[0];
|
|
14828
|
+
const isBase64 = meta.includes(";base64");
|
|
14829
|
+
const mimeMatch = meta.match(/data:([^;]+)/);
|
|
14830
|
+
const mime = mimeMatch ? mimeMatch[1] : "application/octet-stream";
|
|
14831
|
+
const dataPart = parts.slice(1).join(",");
|
|
14832
|
+
if (isBase64) {
|
|
14833
|
+
const binary = atob(dataPart);
|
|
14834
|
+
const len = binary.length;
|
|
14835
|
+
const arr = new Uint8Array(len);
|
|
14836
|
+
for (let i3 = 0; i3 < len; i3++) arr[i3] = binary.charCodeAt(i3);
|
|
14837
|
+
return new Blob([arr], { type: mime });
|
|
14838
|
+
} else {
|
|
14839
|
+
const decoded = decodeURIComponent(dataPart);
|
|
14840
|
+
return new Blob([decoded], { type: mime });
|
|
14841
|
+
}
|
|
14842
|
+
}
|
|
14843
|
+
const resp = await fetch(s4);
|
|
14844
|
+
if (!resp.ok) throw new Error(`Fetch failed with status ${resp.status}`);
|
|
14845
|
+
const blob = await resp.blob();
|
|
14846
|
+
return blob;
|
|
14847
|
+
}
|
|
14848
|
+
throw new Error("Unsupported source type");
|
|
14849
|
+
};
|
|
14850
|
+
const run = async () => {
|
|
14851
|
+
setLoading(true);
|
|
14852
|
+
setError(null);
|
|
14853
|
+
setInfo(null);
|
|
14854
|
+
try {
|
|
14855
|
+
const blob = await toBlobFromSource(source);
|
|
14856
|
+
if (abortRef.current.aborted) return;
|
|
14857
|
+
const fileInfo = {
|
|
14858
|
+
rawBlob: blob,
|
|
14859
|
+
size: blob.size,
|
|
14860
|
+
type: blob.type || "application/octet-stream",
|
|
14861
|
+
dataUrl: null,
|
|
14862
|
+
text: null,
|
|
14863
|
+
arrayBuffer: null,
|
|
14864
|
+
image: null,
|
|
14865
|
+
video: null,
|
|
14866
|
+
audio: null
|
|
14867
|
+
};
|
|
14868
|
+
if (source instanceof File || source instanceof Blob || typeof source === "string" && !source.startsWith("data:")) {
|
|
14869
|
+
fileInfo.name = getFileName(source, fileInfo.type);
|
|
14870
|
+
}
|
|
14871
|
+
fileInfo.extension = makeExtension(fileInfo.name, fileInfo.type);
|
|
14872
|
+
localUrl = URL.createObjectURL(blob);
|
|
14873
|
+
const readPromises = [];
|
|
14874
|
+
if (readAs === "dataUrl" || readAs === "all") {
|
|
14875
|
+
fr = new FileReader();
|
|
14876
|
+
const p = new Promise((resolve, reject) => {
|
|
14877
|
+
fr.onload = () => {
|
|
14878
|
+
if (abortRef.current.aborted) return resolve();
|
|
14879
|
+
fileInfo.dataUrl = fr.result;
|
|
14880
|
+
resolve();
|
|
14881
|
+
};
|
|
14882
|
+
fr.onerror = () => reject(fr.error);
|
|
14883
|
+
fr.readAsDataURL(blob);
|
|
14884
|
+
});
|
|
14885
|
+
readPromises.push(p);
|
|
14886
|
+
}
|
|
14887
|
+
if (readAs === "text" || readAs === "all") {
|
|
14888
|
+
const frText = new FileReader();
|
|
14889
|
+
const p = new Promise((resolve, reject) => {
|
|
14890
|
+
frText.onload = () => {
|
|
14891
|
+
if (abortRef.current.aborted) return resolve();
|
|
14892
|
+
fileInfo.text = frText.result;
|
|
14893
|
+
resolve();
|
|
14894
|
+
};
|
|
14895
|
+
frText.onerror = () => reject(frText.error);
|
|
14896
|
+
frText.readAsText(blob);
|
|
14897
|
+
});
|
|
14898
|
+
readPromises.push(p);
|
|
14899
|
+
}
|
|
14900
|
+
if (readAs === "arrayBuffer" || readAs === "all") {
|
|
14901
|
+
const frBuf = new FileReader();
|
|
14902
|
+
const p = new Promise((resolve, reject) => {
|
|
14903
|
+
frBuf.onload = () => {
|
|
14904
|
+
if (abortRef.current.aborted) return resolve();
|
|
14905
|
+
fileInfo.arrayBuffer = frBuf.result;
|
|
14906
|
+
resolve();
|
|
14907
|
+
};
|
|
14908
|
+
frBuf.onerror = () => reject(frBuf.error);
|
|
14909
|
+
frBuf.readAsArrayBuffer(blob);
|
|
14910
|
+
});
|
|
14911
|
+
readPromises.push(p);
|
|
14912
|
+
}
|
|
14913
|
+
if (fileInfo?.type?.startsWith("image/")) {
|
|
14914
|
+
const p = new Promise((resolve, reject) => {
|
|
14915
|
+
const img = new Image();
|
|
14916
|
+
img.onload = () => {
|
|
14917
|
+
if (abortRef.current.aborted) return resolve();
|
|
14918
|
+
fileInfo.image = {
|
|
14919
|
+
width: img.naturalWidth,
|
|
14920
|
+
height: img.naturalHeight
|
|
14921
|
+
};
|
|
14922
|
+
resolve();
|
|
14923
|
+
};
|
|
14924
|
+
img.onerror = () => resolve();
|
|
14925
|
+
img.src = localUrl;
|
|
14926
|
+
});
|
|
14927
|
+
readPromises.push(p);
|
|
14928
|
+
}
|
|
14929
|
+
if (fileInfo && fileInfo?.type?.startsWith("video/") || fileInfo?.type?.startsWith("audio/")) {
|
|
14930
|
+
const p = new Promise((resolve) => {
|
|
14931
|
+
const el = document.createElement(
|
|
14932
|
+
fileInfo?.type?.startsWith("video/") ? "video" : "audio"
|
|
14933
|
+
);
|
|
14934
|
+
mediaEl = el;
|
|
14935
|
+
mediaEl.preload = "metadata";
|
|
14936
|
+
mediaEl.onloadedmetadata = () => {
|
|
14937
|
+
if (abortRef.current.aborted) return resolve();
|
|
14938
|
+
const duration = isFinite(mediaEl.duration) ? mediaEl.duration : void 0;
|
|
14939
|
+
if (fileInfo?.type?.startsWith("video/")) {
|
|
14940
|
+
fileInfo.video = {
|
|
14941
|
+
width: mediaEl.videoWidth || void 0,
|
|
14942
|
+
height: mediaEl.videoHeight || void 0,
|
|
14943
|
+
duration
|
|
14944
|
+
};
|
|
14945
|
+
} else {
|
|
14946
|
+
fileInfo.audio = { duration };
|
|
14947
|
+
}
|
|
14948
|
+
resolve();
|
|
14949
|
+
};
|
|
14950
|
+
mediaEl.onerror = () => resolve();
|
|
14951
|
+
mediaEl.src = localUrl;
|
|
14952
|
+
});
|
|
14953
|
+
readPromises.push(p);
|
|
14954
|
+
}
|
|
14955
|
+
await Promise.all(readPromises);
|
|
14956
|
+
if (abortRef.current.aborted) return;
|
|
14957
|
+
setInfo(fileInfo);
|
|
14958
|
+
} catch (err) {
|
|
14959
|
+
if (!abortRef.current.aborted) setError(err?.message ?? String(err));
|
|
14960
|
+
} finally {
|
|
14961
|
+
if (!abortRef.current.aborted) setLoading(false);
|
|
14962
|
+
}
|
|
14963
|
+
};
|
|
14964
|
+
run();
|
|
14965
|
+
return () => {
|
|
14966
|
+
abortRef.current.aborted = true;
|
|
14967
|
+
if (fr && fr.readyState === 1) {
|
|
14968
|
+
try {
|
|
14969
|
+
fr.abort();
|
|
14970
|
+
} catch {
|
|
14971
|
+
}
|
|
14972
|
+
}
|
|
14973
|
+
if (mediaEl) {
|
|
14974
|
+
try {
|
|
14975
|
+
mediaEl.src = "";
|
|
14976
|
+
mediaEl.load();
|
|
14977
|
+
} catch {
|
|
14978
|
+
}
|
|
14979
|
+
}
|
|
14980
|
+
if (localUrl) URL.revokeObjectURL(localUrl);
|
|
14981
|
+
};
|
|
14982
|
+
}, [source, readAs]);
|
|
14983
|
+
return { info, loading, error: error2, reload: () => {
|
|
14984
|
+
} };
|
|
14985
|
+
}
|
|
14986
|
+
|
|
15022
14987
|
// src/widgets/advanced/search/tag-search/index.tsx
|
|
15023
14988
|
var import_react20 = require("react");
|
|
15024
14989
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -15547,7 +15512,7 @@ var ModalConfirm = ({
|
|
|
15547
15512
|
|
|
15548
15513
|
// src/widgets/common/modal-detail.tsx
|
|
15549
15514
|
var import_react24 = require("react");
|
|
15550
|
-
var
|
|
15515
|
+
var import_react_dom2 = require("react-dom");
|
|
15551
15516
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
15552
15517
|
var ModalDetail = ({
|
|
15553
15518
|
idToolTip,
|
|
@@ -15570,7 +15535,7 @@ var ModalDetail = ({
|
|
|
15570
15535
|
sessionStorage.setItem("actionData", JSON.stringify(actionData));
|
|
15571
15536
|
window.location.href = `/form/menu?model=${model}&id=${idForm}`;
|
|
15572
15537
|
};
|
|
15573
|
-
return (0,
|
|
15538
|
+
return (0, import_react_dom2.createPortal)(
|
|
15574
15539
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_jsx_runtime69.Fragment, { children: showModalDetail && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[100]", children: [
|
|
15575
15540
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
|
|
15576
15541
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute inset-0 overflow-auto flex flex-col justify-center items-center px-5", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("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: [
|
|
@@ -21465,7 +21430,7 @@ function useFloating2(options2) {
|
|
|
21465
21430
|
}
|
|
21466
21431
|
|
|
21467
21432
|
// node_modules/react-datepicker/dist/index.es.js
|
|
21468
|
-
var
|
|
21433
|
+
var import_react_dom5 = __toESM(require("react-dom"));
|
|
21469
21434
|
var _extendStatics = function extendStatics(d, b2) {
|
|
21470
21435
|
_extendStatics = Object.setPrototypeOf || {
|
|
21471
21436
|
__proto__: []
|
|
@@ -24708,7 +24673,7 @@ var Portal = (
|
|
|
24708
24673
|
}
|
|
24709
24674
|
};
|
|
24710
24675
|
Portal2.prototype.render = function() {
|
|
24711
|
-
return
|
|
24676
|
+
return import_react_dom5.default.createPortal(this.props.children, this.el);
|
|
24712
24677
|
};
|
|
24713
24678
|
return Portal2;
|
|
24714
24679
|
}(import_react45.Component)
|
|
@@ -27276,7 +27241,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
27276
27241
|
|
|
27277
27242
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
27278
27243
|
var import_react51 = require("react");
|
|
27279
|
-
var
|
|
27244
|
+
var import_react_dom6 = require("react-dom");
|
|
27280
27245
|
|
|
27281
27246
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
27282
27247
|
var import_react49 = require("react");
|
|
@@ -27779,7 +27744,7 @@ var MenuPortal = function MenuPortal2(props) {
|
|
|
27779
27744
|
}), innerProps), children);
|
|
27780
27745
|
return jsx84(PortalPlacementContext.Provider, {
|
|
27781
27746
|
value: portalPlacementContext
|
|
27782
|
-
}, appendTo ? /* @__PURE__ */ (0,
|
|
27747
|
+
}, appendTo ? /* @__PURE__ */ (0, import_react_dom6.createPortal)(menuWrapper, appendTo) : menuWrapper);
|
|
27783
27748
|
};
|
|
27784
27749
|
var containerCSS = function containerCSS2(_ref3) {
|
|
27785
27750
|
var isDisabled = _ref3.isDisabled, isRtl = _ref3.isRtl;
|
|
@@ -30672,7 +30637,7 @@ var import_toConsumableArray2 = __toESM(require_toConsumableArray());
|
|
|
30672
30637
|
var import_typeof5 = __toESM(require_typeof());
|
|
30673
30638
|
var import_taggedTemplateLiteral2 = __toESM(require_taggedTemplateLiteral());
|
|
30674
30639
|
var import_defineProperty3 = __toESM(require_defineProperty());
|
|
30675
|
-
var
|
|
30640
|
+
var import_react_dom7 = require("react-dom");
|
|
30676
30641
|
var StateManagedSelect = /* @__PURE__ */ (0, import_react54.forwardRef)(function(props, ref) {
|
|
30677
30642
|
var baseSelectProps = useStateManager(props);
|
|
30678
30643
|
return /* @__PURE__ */ React14.createElement(Select, _extends({
|
|
@@ -32625,7 +32590,7 @@ var StatusDropdownField = (props) => {
|
|
|
32625
32590
|
};
|
|
32626
32591
|
|
|
32627
32592
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
32628
|
-
var
|
|
32593
|
+
var import_react_dom8 = require("react-dom");
|
|
32629
32594
|
var import_react66 = require("react");
|
|
32630
32595
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32631
32596
|
var Many2ManyField = (props) => {
|
|
@@ -32700,7 +32665,7 @@ var Many2ManyField = (props) => {
|
|
|
32700
32665
|
typeof setGroupByList === "function" && setGroupByList(null);
|
|
32701
32666
|
};
|
|
32702
32667
|
}, [selectedTags]);
|
|
32703
|
-
return (0,
|
|
32668
|
+
return (0, import_react_dom8.createPortal)(
|
|
32704
32669
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
32705
32670
|
"div",
|
|
32706
32671
|
{
|