@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.js
CHANGED
|
@@ -10120,346 +10120,66 @@ 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
|
-
transform: "translateY(-50%)"
|
|
10130
|
+
transform: "translateY(-50%)",
|
|
10131
|
+
right: 0
|
|
10411
10132
|
},
|
|
10412
|
-
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[
|
|
10413
|
-
children: [
|
|
10414
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10133
|
+
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[0px] ms-auto z-[32] ",
|
|
10134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react13.Popover, { children: [
|
|
10135
|
+
/* @__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
10136
|
"button",
|
|
10416
10137
|
{
|
|
10417
10138
|
type: "button",
|
|
10418
10139
|
className: "bg-white size-8 p-1 rounded-lg cursor-pointer flex items-center justify-center",
|
|
10419
|
-
onClick: () => {
|
|
10420
|
-
setOpenTableFilter(!openTableFilter);
|
|
10421
|
-
},
|
|
10422
10140
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FilterColumnIcon, {})
|
|
10423
10141
|
}
|
|
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
|
-
|
|
10142
|
+
) }),
|
|
10143
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10144
|
+
import_react13.PopoverPanel,
|
|
10145
|
+
{
|
|
10146
|
+
transition: true,
|
|
10147
|
+
anchor: "bottom end",
|
|
10148
|
+
className: "shadow-lg z-[99] gap-2 bg-white rounded-lg transition duration-200 ease-in-out border border-stroke-disabled",
|
|
10149
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10150
|
+
"div",
|
|
10151
|
+
{
|
|
10152
|
+
style: {
|
|
10153
|
+
zIndex: 9999
|
|
10154
|
+
},
|
|
10155
|
+
className: "flex w-[250px] h-auto overflow-auto flex-col gap-[16px] rounded-[8px] bg-[#fff] px-[24px] py-[16px] shadow-md",
|
|
10156
|
+
children: columns?.filter((val) => val?.optional !== void 0)?.map((item) => {
|
|
10157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
10158
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10159
|
+
"input",
|
|
10160
|
+
{
|
|
10161
|
+
type: "checkbox",
|
|
10162
|
+
id: `${item.name}`,
|
|
10163
|
+
onChange: () => onToggleColumnOptional(item),
|
|
10164
|
+
checked: item.optional !== "hide",
|
|
10165
|
+
className: "cursor-pointer"
|
|
10166
|
+
}
|
|
10167
|
+
),
|
|
10168
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
10169
|
+
"label",
|
|
10170
|
+
{
|
|
10171
|
+
htmlFor: `${item.name}`,
|
|
10172
|
+
className: "flex items-center gap-[8px]",
|
|
10173
|
+
children: item.field.string
|
|
10174
|
+
}
|
|
10175
|
+
)
|
|
10176
|
+
] }, item.name);
|
|
10177
|
+
})
|
|
10178
|
+
}
|
|
10179
|
+
)
|
|
10180
|
+
}
|
|
10461
10181
|
)
|
|
10462
|
-
]
|
|
10182
|
+
] })
|
|
10463
10183
|
}
|
|
10464
10184
|
);
|
|
10465
10185
|
};
|
|
@@ -10521,7 +10241,7 @@ var TableFooter = ({ onAddRow, rows }) => {
|
|
|
10521
10241
|
};
|
|
10522
10242
|
|
|
10523
10243
|
// node_modules/react-tooltip/dist/react-tooltip.min.mjs
|
|
10524
|
-
var
|
|
10244
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
10525
10245
|
|
|
10526
10246
|
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
10527
10247
|
var min = Math.min;
|
|
@@ -11984,7 +11704,7 @@ var L = (e3) => {
|
|
|
11984
11704
|
}
|
|
11985
11705
|
return document.scrollingElement || document.documentElement;
|
|
11986
11706
|
};
|
|
11987
|
-
var C = "undefined" != typeof window ?
|
|
11707
|
+
var C = "undefined" != typeof window ? import_react14.useLayoutEffect : import_react14.useEffect;
|
|
11988
11708
|
var R = (e3) => {
|
|
11989
11709
|
e3.current && (clearTimeout(e3.current), e3.current = null);
|
|
11990
11710
|
};
|
|
@@ -11993,15 +11713,15 @@ var N = { anchorRefs: /* @__PURE__ */ new Set(), activeAnchor: { current: null }
|
|
|
11993
11713
|
}, detach: () => {
|
|
11994
11714
|
}, setActiveAnchor: () => {
|
|
11995
11715
|
} };
|
|
11996
|
-
var $ = (0,
|
|
11716
|
+
var $ = (0, import_react14.createContext)({ getTooltipData: () => N });
|
|
11997
11717
|
function z(e3 = x) {
|
|
11998
|
-
return (0,
|
|
11718
|
+
return (0, import_react14.useContext)($).getTooltipData(e3);
|
|
11999
11719
|
}
|
|
12000
11720
|
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
11721
|
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
11722
|
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
11723
|
var ce;
|
|
12004
|
-
const se = (0,
|
|
11724
|
+
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
11725
|
!H2 && Ce && Object.assign(xe, { mouseenter: false, focus: false, mouseover: false, click: true });
|
|
12006
11726
|
const Ne = M2 ? { ...M2 } : { mouseout: true, blur: true, mouseleave: false, click: false, dblclick: false, mouseup: false };
|
|
12007
11727
|
!M2 && Ce && Object.assign(Ne, { mouseleave: false, blur: false, mouseout: false });
|
|
@@ -12014,7 +11734,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12014
11734
|
Le.current && (null == Q2 || Q2(e3), void 0 === Z2 && ye(e3));
|
|
12015
11735
|
}, 10));
|
|
12016
11736
|
};
|
|
12017
|
-
(0,
|
|
11737
|
+
(0, import_react14.useEffect)(() => {
|
|
12018
11738
|
if (void 0 === Z2) return () => null;
|
|
12019
11739
|
Z2 && we(true);
|
|
12020
11740
|
const e3 = setTimeout(() => {
|
|
@@ -12023,7 +11743,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12023
11743
|
return () => {
|
|
12024
11744
|
clearTimeout(e3);
|
|
12025
11745
|
};
|
|
12026
|
-
}, [Z2]), (0,
|
|
11746
|
+
}, [Z2]), (0, import_react14.useEffect)(() => {
|
|
12027
11747
|
if (fe !== ge.current) if (R(pe), ge.current = fe, fe) null == K2 || K2();
|
|
12028
11748
|
else {
|
|
12029
11749
|
const e3 = ((e4) => {
|
|
@@ -12076,14 +11796,14 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12076
11796
|
Ve.cancel(), Pe(e3);
|
|
12077
11797
|
}, Ke = () => {
|
|
12078
11798
|
Pe.cancel(), Ve();
|
|
12079
|
-
}, Ue = (0,
|
|
11799
|
+
}, Ue = (0, import_react14.useCallback)(() => {
|
|
12080
11800
|
var e3, t4;
|
|
12081
11801
|
const o3 = null !== (e3 = null == be ? void 0 : be.position) && void 0 !== e3 ? e3 : F2;
|
|
12082
11802
|
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
11803
|
Le.current && ze(e4);
|
|
12084
11804
|
});
|
|
12085
11805
|
}, [fe, ee, Y, V2, v, null == be ? void 0 : be.place, m, b2, F2, null == be ? void 0 : be.position, T2, ne]);
|
|
12086
|
-
(0,
|
|
11806
|
+
(0, import_react14.useEffect)(() => {
|
|
12087
11807
|
var e3, t4;
|
|
12088
11808
|
const o3 = new Set(Ae);
|
|
12089
11809
|
ke.forEach((e4) => {
|
|
@@ -12130,7 +11850,7 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12130
11850
|
});
|
|
12131
11851
|
});
|
|
12132
11852
|
};
|
|
12133
|
-
}, [ee, Ue, he, Ae, ke, H2, M2, W, Ce, A2, O3]), (0,
|
|
11853
|
+
}, [ee, Ue, he, Ae, ke, H2, M2, W, Ce, A2, O3]), (0, import_react14.useEffect)(() => {
|
|
12134
11854
|
var e3, t4;
|
|
12135
11855
|
let o3 = null !== (t4 = null !== (e3 = null == be ? void 0 : be.anchorSelect) && void 0 !== e3 ? e3 : p) && void 0 !== t4 ? t4 : "";
|
|
12136
11856
|
!o3 && l2 && (o3 = `[data-tooltip-id='${l2.replace(/'/g, "\\'")}']`);
|
|
@@ -12163,9 +11883,9 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12163
11883
|
return r4.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["data-tooltip-id"], attributeOldValue: true }), () => {
|
|
12164
11884
|
r4.disconnect();
|
|
12165
11885
|
};
|
|
12166
|
-
}, [l2, p, null == be ? void 0 : be.anchorSelect, ee]), (0,
|
|
11886
|
+
}, [l2, p, null == be ? void 0 : be.anchorSelect, ee]), (0, import_react14.useEffect)(() => {
|
|
12167
11887
|
Ue();
|
|
12168
|
-
}, [Ue]), (0,
|
|
11888
|
+
}, [Ue]), (0, import_react14.useEffect)(() => {
|
|
12169
11889
|
if (!(null == G ? void 0 : G.current)) return () => null;
|
|
12170
11890
|
const e3 = new ResizeObserver(() => {
|
|
12171
11891
|
setTimeout(() => Ue());
|
|
@@ -12173,13 +11893,13 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12173
11893
|
return e3.observe(G.current), () => {
|
|
12174
11894
|
e3.disconnect();
|
|
12175
11895
|
};
|
|
12176
|
-
}, [Y, null == G ? void 0 : G.current]), (0,
|
|
11896
|
+
}, [Y, null == G ? void 0 : G.current]), (0, import_react14.useEffect)(() => {
|
|
12177
11897
|
var e3;
|
|
12178
11898
|
const t4 = document.querySelector(`[id='${d}']`), o3 = [...ke, t4];
|
|
12179
11899
|
ee && o3.includes(ee) || te(null !== (e3 = ke[0]) && void 0 !== e3 ? e3 : t4);
|
|
12180
|
-
}, [d, ke, ee]), (0,
|
|
11900
|
+
}, [d, ke, ee]), (0, import_react14.useEffect)(() => (J && Ie(true), () => {
|
|
12181
11901
|
R(ue), R(de);
|
|
12182
|
-
}), []), (0,
|
|
11902
|
+
}), []), (0, import_react14.useEffect)(() => {
|
|
12183
11903
|
var e3;
|
|
12184
11904
|
let t4 = null !== (e3 = null == be ? void 0 : be.anchorSelect) && void 0 !== e3 ? e3 : p;
|
|
12185
11905
|
if (!t4 && l2 && (t4 = `[data-tooltip-id='${l2.replace(/'/g, "\\'")}']`), t4) try {
|
|
@@ -12188,11 +11908,11 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12188
11908
|
} catch (e4) {
|
|
12189
11909
|
Te([]);
|
|
12190
11910
|
}
|
|
12191
|
-
}, [l2, p, null == be ? void 0 : be.anchorSelect]), (0,
|
|
11911
|
+
}, [l2, p, null == be ? void 0 : be.anchorSelect]), (0, import_react14.useEffect)(() => {
|
|
12192
11912
|
ue.current && (R(ue), je(A2));
|
|
12193
11913
|
}, [A2]);
|
|
12194
11914
|
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,
|
|
11915
|
+
return (0, import_react14.useImperativeHandle)(t3, () => ({ open: (e3) => {
|
|
12196
11916
|
if (null == e3 ? void 0 : e3.anchorSelect) try {
|
|
12197
11917
|
document.querySelector(e3.anchorSelect);
|
|
12198
11918
|
} catch (t4) {
|
|
@@ -12201,13 +11921,13 @@ var q = ({ forwardRef: t3, id: l2, className: i3, classNameArrow: c2, variant: u
|
|
|
12201
11921
|
Se(null != e3 ? e3 : null), (null == e3 ? void 0 : e3.delay) ? je(e3.delay) : Ie(true);
|
|
12202
11922
|
}, close: (e3) => {
|
|
12203
11923
|
(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 ?
|
|
11924
|
+
}, 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
11925
|
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,
|
|
11926
|
+
}, 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
11927
|
};
|
|
12208
|
-
var H = ({ content: t3 }) =>
|
|
12209
|
-
var M =
|
|
12210
|
-
const [ee, te] = (0,
|
|
11928
|
+
var H = ({ content: t3 }) => import_react14.default.createElement("span", { dangerouslySetInnerHTML: { __html: t3 } });
|
|
11929
|
+
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) => {
|
|
11930
|
+
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
11931
|
var l3;
|
|
12212
11932
|
if (o3.startsWith("data-tooltip-")) {
|
|
12213
11933
|
t4[o3.replace(/^data-tooltip-/, "")] = null !== (l3 = null == e3 ? void 0 : e3.getAttribute(o3)) && void 0 !== l3 ? l3 : null;
|
|
@@ -12251,31 +11971,31 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12251
11971
|
null === (l3 = t4[e4]) || void 0 === l3 || l3.call(t4, o3);
|
|
12252
11972
|
});
|
|
12253
11973
|
};
|
|
12254
|
-
(0,
|
|
11974
|
+
(0, import_react14.useEffect)(() => {
|
|
12255
11975
|
te(i3);
|
|
12256
|
-
}, [i3]), (0,
|
|
11976
|
+
}, [i3]), (0, import_react14.useEffect)(() => {
|
|
12257
11977
|
le(c2);
|
|
12258
|
-
}, [c2]), (0,
|
|
11978
|
+
}, [c2]), (0, import_react14.useEffect)(() => {
|
|
12259
11979
|
ne(v);
|
|
12260
|
-
}, [v]), (0,
|
|
11980
|
+
}, [v]), (0, import_react14.useEffect)(() => {
|
|
12261
11981
|
ce(p);
|
|
12262
|
-
}, [p]), (0,
|
|
11982
|
+
}, [p]), (0, import_react14.useEffect)(() => {
|
|
12263
11983
|
ae(m);
|
|
12264
|
-
}, [m]), (0,
|
|
11984
|
+
}, [m]), (0, import_react14.useEffect)(() => {
|
|
12265
11985
|
de(E2);
|
|
12266
|
-
}, [E2]), (0,
|
|
11986
|
+
}, [E2]), (0, import_react14.useEffect)(() => {
|
|
12267
11987
|
ve(_2);
|
|
12268
|
-
}, [_2]), (0,
|
|
11988
|
+
}, [_2]), (0, import_react14.useEffect)(() => {
|
|
12269
11989
|
fe(O3);
|
|
12270
|
-
}, [O3]), (0,
|
|
11990
|
+
}, [O3]), (0, import_react14.useEffect)(() => {
|
|
12271
11991
|
he(k2);
|
|
12272
|
-
}, [k2]), (0,
|
|
11992
|
+
}, [k2]), (0, import_react14.useEffect)(() => {
|
|
12273
11993
|
Ae(S2);
|
|
12274
|
-
}, [S2]), (0,
|
|
11994
|
+
}, [S2]), (0, import_react14.useEffect)(() => {
|
|
12275
11995
|
Le.current !== P2 && console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.");
|
|
12276
|
-
}, [P2]), (0,
|
|
11996
|
+
}, [P2]), (0, import_react14.useEffect)(() => {
|
|
12277
11997
|
"undefined" != typeof window && window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles", { detail: { disableCore: "core" === P2, disableBase: P2 } }));
|
|
12278
|
-
}, []), (0,
|
|
11998
|
+
}, []), (0, import_react14.useEffect)(() => {
|
|
12279
11999
|
var e3;
|
|
12280
12000
|
const o3 = new Set(Ce);
|
|
12281
12001
|
let r4 = n4;
|
|
@@ -12303,18 +12023,18 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12303
12023
|
return () => {
|
|
12304
12024
|
s4.disconnect();
|
|
12305
12025
|
};
|
|
12306
|
-
}, [Ce, Re, ke, l2, n4]), (0,
|
|
12026
|
+
}, [Ce, Re, ke, l2, n4]), (0, import_react14.useEffect)(() => {
|
|
12307
12027
|
(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
12028
|
}, []);
|
|
12309
12029
|
let $e = h2;
|
|
12310
|
-
const Ie = (0,
|
|
12030
|
+
const Ie = (0, import_react14.useRef)(null);
|
|
12311
12031
|
if (a2) {
|
|
12312
12032
|
const t4 = a2({ content: (null == ke ? void 0 : ke.getAttribute("data-tooltip-content")) || ee || null, activeAnchor: ke });
|
|
12313
|
-
$e = t4 ?
|
|
12033
|
+
$e = t4 ? import_react14.default.createElement("div", { ref: Ie, className: "react-tooltip-content-wrapper" }, t4) : null;
|
|
12314
12034
|
} else ee && ($e = ee);
|
|
12315
|
-
oe && ($e =
|
|
12035
|
+
oe && ($e = import_react14.default.createElement(H, { content: oe }));
|
|
12316
12036
|
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
|
|
12037
|
+
return import_react14.default.createElement(q, { ...ze });
|
|
12318
12038
|
});
|
|
12319
12039
|
"undefined" != typeof window && window.addEventListener("react-tooltip-inject-styles", (e3) => {
|
|
12320
12040
|
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 +12042,7 @@ var M = import_react16.default.forwardRef(({ id: t3, anchorId: l2, anchorSelect:
|
|
|
12322
12042
|
});
|
|
12323
12043
|
|
|
12324
12044
|
// src/widgets/advanced/table/table-head.tsx
|
|
12325
|
-
var
|
|
12045
|
+
var import_react_dom = require("react-dom");
|
|
12326
12046
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
12327
12047
|
var TableHead = (props) => {
|
|
12328
12048
|
const {
|
|
@@ -12370,7 +12090,7 @@ var TableHead = (props) => {
|
|
|
12370
12090
|
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "cursor-pointer flex items-center gap-[4px] w-full group relative", children: [
|
|
12371
12091
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "truncate line-clamp-1 w-fit", children: col.title }),
|
|
12372
12092
|
col?.field?.help && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
12373
|
-
(0,
|
|
12093
|
+
(0, import_react_dom.createPortal)(
|
|
12374
12094
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12375
12095
|
M,
|
|
12376
12096
|
{
|
|
@@ -12798,7 +12518,7 @@ var EmptyTable = () => {
|
|
|
12798
12518
|
};
|
|
12799
12519
|
|
|
12800
12520
|
// node_modules/react-hook-form/dist/index.esm.mjs
|
|
12801
|
-
var
|
|
12521
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
12802
12522
|
var isCheckBoxInput = (element) => element.type === "checkbox";
|
|
12803
12523
|
var isDateObject = (value) => value instanceof Date;
|
|
12804
12524
|
var isNullOrUndefined = (value) => value == null;
|
|
@@ -12886,9 +12606,9 @@ var INPUT_VALIDATION_RULES = {
|
|
|
12886
12606
|
required: "required",
|
|
12887
12607
|
validate: "validate"
|
|
12888
12608
|
};
|
|
12889
|
-
var HookFormContext =
|
|
12609
|
+
var HookFormContext = import_react15.default.createContext(null);
|
|
12890
12610
|
HookFormContext.displayName = "HookFormContext";
|
|
12891
|
-
var useFormContext = () =>
|
|
12611
|
+
var useFormContext = () => import_react15.default.useContext(HookFormContext);
|
|
12892
12612
|
var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
|
|
12893
12613
|
const result = {
|
|
12894
12614
|
defaultValues: control._defaultValues
|
|
@@ -12907,12 +12627,12 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
|
|
|
12907
12627
|
}
|
|
12908
12628
|
return result;
|
|
12909
12629
|
};
|
|
12910
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
12630
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react15.default.useLayoutEffect : import_react15.default.useEffect;
|
|
12911
12631
|
function useFormState(props) {
|
|
12912
12632
|
const methods = useFormContext();
|
|
12913
12633
|
const { control = methods.control, disabled, name: name2, exact } = props || {};
|
|
12914
|
-
const [formState, updateFormState] =
|
|
12915
|
-
const _localProxyFormState =
|
|
12634
|
+
const [formState, updateFormState] = import_react15.default.useState(control._formState);
|
|
12635
|
+
const _localProxyFormState = import_react15.default.useRef({
|
|
12916
12636
|
isDirty: false,
|
|
12917
12637
|
isLoading: false,
|
|
12918
12638
|
dirtyFields: false,
|
|
@@ -12933,10 +12653,10 @@ function useFormState(props) {
|
|
|
12933
12653
|
});
|
|
12934
12654
|
}
|
|
12935
12655
|
}), [name2, disabled, exact]);
|
|
12936
|
-
|
|
12656
|
+
import_react15.default.useEffect(() => {
|
|
12937
12657
|
_localProxyFormState.current.isValid && control._setValid(true);
|
|
12938
12658
|
}, [control]);
|
|
12939
|
-
return
|
|
12659
|
+
return import_react15.default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
|
|
12940
12660
|
}
|
|
12941
12661
|
var isString3 = (value) => typeof value === "string";
|
|
12942
12662
|
var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
|
|
@@ -12985,12 +12705,12 @@ function deepEqual(object1, object2, _internal_visited = /* @__PURE__ */ new Wea
|
|
|
12985
12705
|
function useWatch(props) {
|
|
12986
12706
|
const methods = useFormContext();
|
|
12987
12707
|
const { control = methods.control, name: name2, defaultValue, disabled, exact, compute } = props || {};
|
|
12988
|
-
const _defaultValue =
|
|
12989
|
-
const _compute =
|
|
12990
|
-
const _computeFormValues =
|
|
12708
|
+
const _defaultValue = import_react15.default.useRef(defaultValue);
|
|
12709
|
+
const _compute = import_react15.default.useRef(compute);
|
|
12710
|
+
const _computeFormValues = import_react15.default.useRef(void 0);
|
|
12991
12711
|
_compute.current = compute;
|
|
12992
|
-
const defaultValueMemo =
|
|
12993
|
-
const [value, updateValue] =
|
|
12712
|
+
const defaultValueMemo = import_react15.default.useMemo(() => control._getWatch(name2, _defaultValue.current), [control, name2]);
|
|
12713
|
+
const [value, updateValue] = import_react15.default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
|
|
12994
12714
|
useIsomorphicLayoutEffect(() => control._subscribe({
|
|
12995
12715
|
name: name2,
|
|
12996
12716
|
formState: {
|
|
@@ -13012,14 +12732,14 @@ function useWatch(props) {
|
|
|
13012
12732
|
}
|
|
13013
12733
|
}
|
|
13014
12734
|
}), [control, disabled, name2, exact]);
|
|
13015
|
-
|
|
12735
|
+
import_react15.default.useEffect(() => control._removeUnmounted());
|
|
13016
12736
|
return value;
|
|
13017
12737
|
}
|
|
13018
12738
|
function useController(props) {
|
|
13019
12739
|
const methods = useFormContext();
|
|
13020
12740
|
const { name: name2, disabled, control = methods.control, shouldUnregister, defaultValue } = props;
|
|
13021
12741
|
const isArrayField = isNameInFieldArray(control._names.array, name2);
|
|
13022
|
-
const defaultValueMemo =
|
|
12742
|
+
const defaultValueMemo = import_react15.default.useMemo(() => get2(control._formValues, name2, get2(control._defaultValues, name2, defaultValue)), [control, name2, defaultValue]);
|
|
13023
12743
|
const value = useWatch({
|
|
13024
12744
|
control,
|
|
13025
12745
|
name: name2,
|
|
@@ -13031,14 +12751,14 @@ function useController(props) {
|
|
|
13031
12751
|
name: name2,
|
|
13032
12752
|
exact: true
|
|
13033
12753
|
});
|
|
13034
|
-
const _props =
|
|
13035
|
-
const _registerProps =
|
|
12754
|
+
const _props = import_react15.default.useRef(props);
|
|
12755
|
+
const _registerProps = import_react15.default.useRef(control.register(name2, {
|
|
13036
12756
|
...props.rules,
|
|
13037
12757
|
value,
|
|
13038
12758
|
...isBoolean(props.disabled) ? { disabled: props.disabled } : {}
|
|
13039
12759
|
}));
|
|
13040
12760
|
_props.current = props;
|
|
13041
|
-
const fieldState =
|
|
12761
|
+
const fieldState = import_react15.default.useMemo(() => Object.defineProperties({}, {
|
|
13042
12762
|
invalid: {
|
|
13043
12763
|
enumerable: true,
|
|
13044
12764
|
get: () => !!get2(formState.errors, name2)
|
|
@@ -13060,21 +12780,21 @@ function useController(props) {
|
|
|
13060
12780
|
get: () => get2(formState.errors, name2)
|
|
13061
12781
|
}
|
|
13062
12782
|
}), [formState, name2]);
|
|
13063
|
-
const onChange2 =
|
|
12783
|
+
const onChange2 = import_react15.default.useCallback((event) => _registerProps.current.onChange({
|
|
13064
12784
|
target: {
|
|
13065
12785
|
value: getEventValue(event),
|
|
13066
12786
|
name: name2
|
|
13067
12787
|
},
|
|
13068
12788
|
type: EVENTS.CHANGE
|
|
13069
12789
|
}), [name2]);
|
|
13070
|
-
const onBlur =
|
|
12790
|
+
const onBlur = import_react15.default.useCallback(() => _registerProps.current.onBlur({
|
|
13071
12791
|
target: {
|
|
13072
12792
|
value: get2(control._formValues, name2),
|
|
13073
12793
|
name: name2
|
|
13074
12794
|
},
|
|
13075
12795
|
type: EVENTS.BLUR
|
|
13076
12796
|
}), [name2, control._formValues]);
|
|
13077
|
-
const ref =
|
|
12797
|
+
const ref = import_react15.default.useCallback((elm) => {
|
|
13078
12798
|
const field2 = get2(control._fields, name2);
|
|
13079
12799
|
if (field2 && elm) {
|
|
13080
12800
|
field2._f.ref = {
|
|
@@ -13085,7 +12805,7 @@ function useController(props) {
|
|
|
13085
12805
|
};
|
|
13086
12806
|
}
|
|
13087
12807
|
}, [control._fields, name2]);
|
|
13088
|
-
const field =
|
|
12808
|
+
const field = import_react15.default.useMemo(() => ({
|
|
13089
12809
|
name: name2,
|
|
13090
12810
|
value,
|
|
13091
12811
|
...isBoolean(disabled) || formState.disabled ? { disabled: formState.disabled || disabled } : {},
|
|
@@ -13093,7 +12813,7 @@ function useController(props) {
|
|
|
13093
12813
|
onBlur,
|
|
13094
12814
|
ref
|
|
13095
12815
|
}), [name2, disabled, formState.disabled, onChange2, onBlur, ref, value]);
|
|
13096
|
-
|
|
12816
|
+
import_react15.default.useEffect(() => {
|
|
13097
12817
|
const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
13098
12818
|
control.register(name2, {
|
|
13099
12819
|
..._props.current.rules,
|
|
@@ -13118,13 +12838,13 @@ function useController(props) {
|
|
|
13118
12838
|
(isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name2) : updateMounted(name2, false);
|
|
13119
12839
|
};
|
|
13120
12840
|
}, [name2, control, isArrayField, shouldUnregister]);
|
|
13121
|
-
|
|
12841
|
+
import_react15.default.useEffect(() => {
|
|
13122
12842
|
control._setDisabledField({
|
|
13123
12843
|
disabled,
|
|
13124
12844
|
name: name2
|
|
13125
12845
|
});
|
|
13126
12846
|
}, [disabled, name2, control]);
|
|
13127
|
-
return
|
|
12847
|
+
return import_react15.default.useMemo(() => ({
|
|
13128
12848
|
field,
|
|
13129
12849
|
formState,
|
|
13130
12850
|
fieldState
|
|
@@ -14424,9 +14144,9 @@ function createFormControl(props = {}) {
|
|
|
14424
14144
|
};
|
|
14425
14145
|
}
|
|
14426
14146
|
function useForm(props = {}) {
|
|
14427
|
-
const _formControl =
|
|
14428
|
-
const _values =
|
|
14429
|
-
const [formState, updateFormState] =
|
|
14147
|
+
const _formControl = import_react15.default.useRef(void 0);
|
|
14148
|
+
const _values = import_react15.default.useRef(void 0);
|
|
14149
|
+
const [formState, updateFormState] = import_react15.default.useState({
|
|
14430
14150
|
isDirty: false,
|
|
14431
14151
|
isValidating: false,
|
|
14432
14152
|
isLoading: isFunction(props.defaultValues),
|
|
@@ -14475,8 +14195,8 @@ function useForm(props = {}) {
|
|
|
14475
14195
|
control._formState.isReady = true;
|
|
14476
14196
|
return sub;
|
|
14477
14197
|
}, [control]);
|
|
14478
|
-
|
|
14479
|
-
|
|
14198
|
+
import_react15.default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
|
|
14199
|
+
import_react15.default.useEffect(() => {
|
|
14480
14200
|
if (props.mode) {
|
|
14481
14201
|
control._options.mode = props.mode;
|
|
14482
14202
|
}
|
|
@@ -14484,18 +14204,18 @@ function useForm(props = {}) {
|
|
|
14484
14204
|
control._options.reValidateMode = props.reValidateMode;
|
|
14485
14205
|
}
|
|
14486
14206
|
}, [control, props.mode, props.reValidateMode]);
|
|
14487
|
-
|
|
14207
|
+
import_react15.default.useEffect(() => {
|
|
14488
14208
|
if (props.errors) {
|
|
14489
14209
|
control._setErrors(props.errors);
|
|
14490
14210
|
control._focusError();
|
|
14491
14211
|
}
|
|
14492
14212
|
}, [control, props.errors]);
|
|
14493
|
-
|
|
14213
|
+
import_react15.default.useEffect(() => {
|
|
14494
14214
|
props.shouldUnregister && control._subjects.state.next({
|
|
14495
14215
|
values: control._getWatch()
|
|
14496
14216
|
});
|
|
14497
14217
|
}, [control, props.shouldUnregister]);
|
|
14498
|
-
|
|
14218
|
+
import_react15.default.useEffect(() => {
|
|
14499
14219
|
if (control._proxyFormState.isDirty) {
|
|
14500
14220
|
const isDirty = control._getDirty();
|
|
14501
14221
|
if (isDirty !== formState.isDirty) {
|
|
@@ -14505,7 +14225,7 @@ function useForm(props = {}) {
|
|
|
14505
14225
|
}
|
|
14506
14226
|
}
|
|
14507
14227
|
}, [control, formState.isDirty]);
|
|
14508
|
-
|
|
14228
|
+
import_react15.default.useEffect(() => {
|
|
14509
14229
|
if (props.values && !deepEqual(props.values, _values.current)) {
|
|
14510
14230
|
control._reset(props.values, {
|
|
14511
14231
|
keepFieldsRef: true,
|
|
@@ -14517,7 +14237,7 @@ function useForm(props = {}) {
|
|
|
14517
14237
|
control._resetDefaultValues();
|
|
14518
14238
|
}
|
|
14519
14239
|
}, [control, props.values]);
|
|
14520
|
-
|
|
14240
|
+
import_react15.default.useEffect(() => {
|
|
14521
14241
|
if (!control._state.mount) {
|
|
14522
14242
|
control._setValid();
|
|
14523
14243
|
control._state.mount = true;
|
|
@@ -14632,7 +14352,7 @@ var Button = React2.forwardRef(
|
|
|
14632
14352
|
Button.displayName = "Button";
|
|
14633
14353
|
|
|
14634
14354
|
// src/widgets/advanced/login/shared/text-input.tsx
|
|
14635
|
-
var
|
|
14355
|
+
var import_react16 = require("react");
|
|
14636
14356
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
14637
14357
|
function TextInput(props) {
|
|
14638
14358
|
const {
|
|
@@ -14646,7 +14366,7 @@ function TextInput(props) {
|
|
|
14646
14366
|
errors,
|
|
14647
14367
|
required
|
|
14648
14368
|
} = props;
|
|
14649
|
-
const [showPassword, setShowPassword] = (0,
|
|
14369
|
+
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
14650
14370
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: `flex justify-center gap-2 flex-col ${className}`, children: [
|
|
14651
14371
|
label && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("label", { className: "text-[#262626] text-sm leading-5 font-semibold", children: [
|
|
14652
14372
|
label,
|
|
@@ -14688,7 +14408,7 @@ function TextInput(props) {
|
|
|
14688
14408
|
}
|
|
14689
14409
|
|
|
14690
14410
|
// src/widgets/advanced/login/provider/credential/form-options/index.tsx
|
|
14691
|
-
var
|
|
14411
|
+
var import_react17 = require("react");
|
|
14692
14412
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
14693
14413
|
var STAY_LOGIN_IN = "stayLoginIn";
|
|
14694
14414
|
function FormOptions({
|
|
@@ -14712,7 +14432,7 @@ function FormOptions({
|
|
|
14712
14432
|
}
|
|
14713
14433
|
}
|
|
14714
14434
|
}
|
|
14715
|
-
(0,
|
|
14435
|
+
(0, import_react17.useEffect)(() => {
|
|
14716
14436
|
localStorage.setItem(STAY_LOGIN_IN, "false");
|
|
14717
14437
|
}, []);
|
|
14718
14438
|
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 +14739,252 @@ var PopupFilter = ({
|
|
|
15019
14739
|
// src/widgets/advanced/search/search-item/index.tsx
|
|
15020
14740
|
var import_react21 = require("react");
|
|
15021
14741
|
|
|
14742
|
+
// src/hooks/use-click-outside.ts
|
|
14743
|
+
var import_react18 = require("react");
|
|
14744
|
+
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
14745
|
+
var useClickOutside = ({
|
|
14746
|
+
handler,
|
|
14747
|
+
events = DEFAULT_EVENTS,
|
|
14748
|
+
nodes = [],
|
|
14749
|
+
// Default to empty array to avoid undefined errors
|
|
14750
|
+
refs
|
|
14751
|
+
}) => {
|
|
14752
|
+
const ref = (0, import_react18.useRef)(null);
|
|
14753
|
+
(0, import_react18.useEffect)(() => {
|
|
14754
|
+
const listener = (event) => {
|
|
14755
|
+
const { target } = event;
|
|
14756
|
+
if (refs && refs?.length > 0 && refs?.some((r4) => r4.current?.contains(target))) {
|
|
14757
|
+
return;
|
|
14758
|
+
}
|
|
14759
|
+
if (!(target instanceof HTMLElement)) return;
|
|
14760
|
+
const shouldIgnore = target.hasAttribute("data-ignore-outside-clicks") || !document.body.contains(target) && target.tagName !== "HTML";
|
|
14761
|
+
const shouldTrigger = nodes.length > 0 ? nodes.every((node2) => node2 && !event.composedPath().includes(node2)) : ref.current && !ref.current.contains(target);
|
|
14762
|
+
if (shouldTrigger && !shouldIgnore) {
|
|
14763
|
+
handler(event);
|
|
14764
|
+
}
|
|
14765
|
+
};
|
|
14766
|
+
events.forEach((event) => document.addEventListener(event, listener));
|
|
14767
|
+
return () => {
|
|
14768
|
+
events.forEach((event) => document.removeEventListener(event, listener));
|
|
14769
|
+
};
|
|
14770
|
+
}, [handler, nodes, events]);
|
|
14771
|
+
return ref;
|
|
14772
|
+
};
|
|
14773
|
+
|
|
14774
|
+
// src/hooks/use-get-file-infor.ts
|
|
14775
|
+
var import_react19 = require("react");
|
|
14776
|
+
function getFileName(source, mime) {
|
|
14777
|
+
if (source instanceof File) return source.name;
|
|
14778
|
+
if (typeof source === "string") {
|
|
14779
|
+
if (source.startsWith("data:")) {
|
|
14780
|
+
const ext2 = mime?.split("/")[1] || "bin";
|
|
14781
|
+
return `file.${ext2}`;
|
|
14782
|
+
}
|
|
14783
|
+
try {
|
|
14784
|
+
const pathname = new URL(source).pathname;
|
|
14785
|
+
const filename = decodeURIComponent(pathname.split("/").pop() || "");
|
|
14786
|
+
if (filename) return filename;
|
|
14787
|
+
} catch {
|
|
14788
|
+
}
|
|
14789
|
+
return "file.bin";
|
|
14790
|
+
}
|
|
14791
|
+
const ext = mime?.split("/")[1] || "bin";
|
|
14792
|
+
return `file.${ext}`;
|
|
14793
|
+
}
|
|
14794
|
+
function useFileInfo(source, options2) {
|
|
14795
|
+
const { readAs = "all" } = options2 ?? {};
|
|
14796
|
+
const [info, setInfo] = (0, import_react19.useState)(null);
|
|
14797
|
+
const [loading, setLoading] = (0, import_react19.useState)(false);
|
|
14798
|
+
const [error2, setError] = (0, import_react19.useState)(null);
|
|
14799
|
+
const abortRef = (0, import_react19.useRef)({ aborted: false });
|
|
14800
|
+
(0, import_react19.useEffect)(() => {
|
|
14801
|
+
abortRef.current.aborted = false;
|
|
14802
|
+
if (!source) {
|
|
14803
|
+
setInfo(null);
|
|
14804
|
+
setLoading(false);
|
|
14805
|
+
setError(null);
|
|
14806
|
+
return;
|
|
14807
|
+
}
|
|
14808
|
+
let localUrl = null;
|
|
14809
|
+
let fr = null;
|
|
14810
|
+
let mediaEl = null;
|
|
14811
|
+
const makeExtension = (name2, type) => {
|
|
14812
|
+
if (name2) {
|
|
14813
|
+
const idx = name2.lastIndexOf(".");
|
|
14814
|
+
if (idx > -1) return name2.slice(idx + 1).toLowerCase();
|
|
14815
|
+
}
|
|
14816
|
+
if (type) {
|
|
14817
|
+
const match3 = /\/([a-z0-9.+-]+)$/.exec(type);
|
|
14818
|
+
return match3 ? match3[1] : null;
|
|
14819
|
+
}
|
|
14820
|
+
return null;
|
|
14821
|
+
};
|
|
14822
|
+
const toBlobFromSource = async (src) => {
|
|
14823
|
+
if (src instanceof Blob) return src;
|
|
14824
|
+
if (typeof src === "string") {
|
|
14825
|
+
const s4 = src.trim();
|
|
14826
|
+
if (s4.startsWith("data:")) {
|
|
14827
|
+
const parts = s4.split(",");
|
|
14828
|
+
const meta = parts[0];
|
|
14829
|
+
const isBase64 = meta.includes(";base64");
|
|
14830
|
+
const mimeMatch = meta.match(/data:([^;]+)/);
|
|
14831
|
+
const mime = mimeMatch ? mimeMatch[1] : "application/octet-stream";
|
|
14832
|
+
const dataPart = parts.slice(1).join(",");
|
|
14833
|
+
if (isBase64) {
|
|
14834
|
+
const binary = atob(dataPart);
|
|
14835
|
+
const len = binary.length;
|
|
14836
|
+
const arr = new Uint8Array(len);
|
|
14837
|
+
for (let i3 = 0; i3 < len; i3++) arr[i3] = binary.charCodeAt(i3);
|
|
14838
|
+
return new Blob([arr], { type: mime });
|
|
14839
|
+
} else {
|
|
14840
|
+
const decoded = decodeURIComponent(dataPart);
|
|
14841
|
+
return new Blob([decoded], { type: mime });
|
|
14842
|
+
}
|
|
14843
|
+
}
|
|
14844
|
+
const resp = await fetch(s4);
|
|
14845
|
+
if (!resp.ok) throw new Error(`Fetch failed with status ${resp.status}`);
|
|
14846
|
+
const blob = await resp.blob();
|
|
14847
|
+
return blob;
|
|
14848
|
+
}
|
|
14849
|
+
throw new Error("Unsupported source type");
|
|
14850
|
+
};
|
|
14851
|
+
const run = async () => {
|
|
14852
|
+
setLoading(true);
|
|
14853
|
+
setError(null);
|
|
14854
|
+
setInfo(null);
|
|
14855
|
+
try {
|
|
14856
|
+
const blob = await toBlobFromSource(source);
|
|
14857
|
+
if (abortRef.current.aborted) return;
|
|
14858
|
+
const fileInfo = {
|
|
14859
|
+
rawBlob: blob,
|
|
14860
|
+
size: blob.size,
|
|
14861
|
+
type: blob.type || "application/octet-stream",
|
|
14862
|
+
dataUrl: null,
|
|
14863
|
+
text: null,
|
|
14864
|
+
arrayBuffer: null,
|
|
14865
|
+
image: null,
|
|
14866
|
+
video: null,
|
|
14867
|
+
audio: null
|
|
14868
|
+
};
|
|
14869
|
+
if (source instanceof File || source instanceof Blob || typeof source === "string" && !source.startsWith("data:")) {
|
|
14870
|
+
fileInfo.name = getFileName(source, fileInfo.type);
|
|
14871
|
+
}
|
|
14872
|
+
fileInfo.extension = makeExtension(fileInfo.name, fileInfo.type);
|
|
14873
|
+
localUrl = URL.createObjectURL(blob);
|
|
14874
|
+
const readPromises = [];
|
|
14875
|
+
if (readAs === "dataUrl" || readAs === "all") {
|
|
14876
|
+
fr = new FileReader();
|
|
14877
|
+
const p = new Promise((resolve, reject) => {
|
|
14878
|
+
fr.onload = () => {
|
|
14879
|
+
if (abortRef.current.aborted) return resolve();
|
|
14880
|
+
fileInfo.dataUrl = fr.result;
|
|
14881
|
+
resolve();
|
|
14882
|
+
};
|
|
14883
|
+
fr.onerror = () => reject(fr.error);
|
|
14884
|
+
fr.readAsDataURL(blob);
|
|
14885
|
+
});
|
|
14886
|
+
readPromises.push(p);
|
|
14887
|
+
}
|
|
14888
|
+
if (readAs === "text" || readAs === "all") {
|
|
14889
|
+
const frText = new FileReader();
|
|
14890
|
+
const p = new Promise((resolve, reject) => {
|
|
14891
|
+
frText.onload = () => {
|
|
14892
|
+
if (abortRef.current.aborted) return resolve();
|
|
14893
|
+
fileInfo.text = frText.result;
|
|
14894
|
+
resolve();
|
|
14895
|
+
};
|
|
14896
|
+
frText.onerror = () => reject(frText.error);
|
|
14897
|
+
frText.readAsText(blob);
|
|
14898
|
+
});
|
|
14899
|
+
readPromises.push(p);
|
|
14900
|
+
}
|
|
14901
|
+
if (readAs === "arrayBuffer" || readAs === "all") {
|
|
14902
|
+
const frBuf = new FileReader();
|
|
14903
|
+
const p = new Promise((resolve, reject) => {
|
|
14904
|
+
frBuf.onload = () => {
|
|
14905
|
+
if (abortRef.current.aborted) return resolve();
|
|
14906
|
+
fileInfo.arrayBuffer = frBuf.result;
|
|
14907
|
+
resolve();
|
|
14908
|
+
};
|
|
14909
|
+
frBuf.onerror = () => reject(frBuf.error);
|
|
14910
|
+
frBuf.readAsArrayBuffer(blob);
|
|
14911
|
+
});
|
|
14912
|
+
readPromises.push(p);
|
|
14913
|
+
}
|
|
14914
|
+
if (fileInfo?.type?.startsWith("image/")) {
|
|
14915
|
+
const p = new Promise((resolve, reject) => {
|
|
14916
|
+
const img = new Image();
|
|
14917
|
+
img.onload = () => {
|
|
14918
|
+
if (abortRef.current.aborted) return resolve();
|
|
14919
|
+
fileInfo.image = {
|
|
14920
|
+
width: img.naturalWidth,
|
|
14921
|
+
height: img.naturalHeight
|
|
14922
|
+
};
|
|
14923
|
+
resolve();
|
|
14924
|
+
};
|
|
14925
|
+
img.onerror = () => resolve();
|
|
14926
|
+
img.src = localUrl;
|
|
14927
|
+
});
|
|
14928
|
+
readPromises.push(p);
|
|
14929
|
+
}
|
|
14930
|
+
if (fileInfo && fileInfo?.type?.startsWith("video/") || fileInfo?.type?.startsWith("audio/")) {
|
|
14931
|
+
const p = new Promise((resolve) => {
|
|
14932
|
+
const el = document.createElement(
|
|
14933
|
+
fileInfo?.type?.startsWith("video/") ? "video" : "audio"
|
|
14934
|
+
);
|
|
14935
|
+
mediaEl = el;
|
|
14936
|
+
mediaEl.preload = "metadata";
|
|
14937
|
+
mediaEl.onloadedmetadata = () => {
|
|
14938
|
+
if (abortRef.current.aborted) return resolve();
|
|
14939
|
+
const duration = isFinite(mediaEl.duration) ? mediaEl.duration : void 0;
|
|
14940
|
+
if (fileInfo?.type?.startsWith("video/")) {
|
|
14941
|
+
fileInfo.video = {
|
|
14942
|
+
width: mediaEl.videoWidth || void 0,
|
|
14943
|
+
height: mediaEl.videoHeight || void 0,
|
|
14944
|
+
duration
|
|
14945
|
+
};
|
|
14946
|
+
} else {
|
|
14947
|
+
fileInfo.audio = { duration };
|
|
14948
|
+
}
|
|
14949
|
+
resolve();
|
|
14950
|
+
};
|
|
14951
|
+
mediaEl.onerror = () => resolve();
|
|
14952
|
+
mediaEl.src = localUrl;
|
|
14953
|
+
});
|
|
14954
|
+
readPromises.push(p);
|
|
14955
|
+
}
|
|
14956
|
+
await Promise.all(readPromises);
|
|
14957
|
+
if (abortRef.current.aborted) return;
|
|
14958
|
+
setInfo(fileInfo);
|
|
14959
|
+
} catch (err) {
|
|
14960
|
+
if (!abortRef.current.aborted) setError(err?.message ?? String(err));
|
|
14961
|
+
} finally {
|
|
14962
|
+
if (!abortRef.current.aborted) setLoading(false);
|
|
14963
|
+
}
|
|
14964
|
+
};
|
|
14965
|
+
run();
|
|
14966
|
+
return () => {
|
|
14967
|
+
abortRef.current.aborted = true;
|
|
14968
|
+
if (fr && fr.readyState === 1) {
|
|
14969
|
+
try {
|
|
14970
|
+
fr.abort();
|
|
14971
|
+
} catch {
|
|
14972
|
+
}
|
|
14973
|
+
}
|
|
14974
|
+
if (mediaEl) {
|
|
14975
|
+
try {
|
|
14976
|
+
mediaEl.src = "";
|
|
14977
|
+
mediaEl.load();
|
|
14978
|
+
} catch {
|
|
14979
|
+
}
|
|
14980
|
+
}
|
|
14981
|
+
if (localUrl) URL.revokeObjectURL(localUrl);
|
|
14982
|
+
};
|
|
14983
|
+
}, [source, readAs]);
|
|
14984
|
+
return { info, loading, error: error2, reload: () => {
|
|
14985
|
+
} };
|
|
14986
|
+
}
|
|
14987
|
+
|
|
15022
14988
|
// src/widgets/advanced/search/tag-search/index.tsx
|
|
15023
14989
|
var import_react20 = require("react");
|
|
15024
14990
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
@@ -15547,7 +15513,7 @@ var ModalConfirm = ({
|
|
|
15547
15513
|
|
|
15548
15514
|
// src/widgets/common/modal-detail.tsx
|
|
15549
15515
|
var import_react24 = require("react");
|
|
15550
|
-
var
|
|
15516
|
+
var import_react_dom2 = require("react-dom");
|
|
15551
15517
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
15552
15518
|
var ModalDetail = ({
|
|
15553
15519
|
idToolTip,
|
|
@@ -15570,7 +15536,7 @@ var ModalDetail = ({
|
|
|
15570
15536
|
sessionStorage.setItem("actionData", JSON.stringify(actionData));
|
|
15571
15537
|
window.location.href = `/form/menu?model=${model}&id=${idForm}`;
|
|
15572
15538
|
};
|
|
15573
|
-
return (0,
|
|
15539
|
+
return (0, import_react_dom2.createPortal)(
|
|
15574
15540
|
/* @__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
15541
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
|
|
15576
15542
|
/* @__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 +21431,7 @@ function useFloating2(options2) {
|
|
|
21465
21431
|
}
|
|
21466
21432
|
|
|
21467
21433
|
// node_modules/react-datepicker/dist/index.es.js
|
|
21468
|
-
var
|
|
21434
|
+
var import_react_dom5 = __toESM(require("react-dom"));
|
|
21469
21435
|
var _extendStatics = function extendStatics(d, b2) {
|
|
21470
21436
|
_extendStatics = Object.setPrototypeOf || {
|
|
21471
21437
|
__proto__: []
|
|
@@ -24708,7 +24674,7 @@ var Portal = (
|
|
|
24708
24674
|
}
|
|
24709
24675
|
};
|
|
24710
24676
|
Portal2.prototype.render = function() {
|
|
24711
|
-
return
|
|
24677
|
+
return import_react_dom5.default.createPortal(this.props.children, this.el);
|
|
24712
24678
|
};
|
|
24713
24679
|
return Portal2;
|
|
24714
24680
|
}(import_react45.Component)
|
|
@@ -27276,7 +27242,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
27276
27242
|
|
|
27277
27243
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
27278
27244
|
var import_react51 = require("react");
|
|
27279
|
-
var
|
|
27245
|
+
var import_react_dom6 = require("react-dom");
|
|
27280
27246
|
|
|
27281
27247
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
27282
27248
|
var import_react49 = require("react");
|
|
@@ -27779,7 +27745,7 @@ var MenuPortal = function MenuPortal2(props) {
|
|
|
27779
27745
|
}), innerProps), children);
|
|
27780
27746
|
return jsx84(PortalPlacementContext.Provider, {
|
|
27781
27747
|
value: portalPlacementContext
|
|
27782
|
-
}, appendTo ? /* @__PURE__ */ (0,
|
|
27748
|
+
}, appendTo ? /* @__PURE__ */ (0, import_react_dom6.createPortal)(menuWrapper, appendTo) : menuWrapper);
|
|
27783
27749
|
};
|
|
27784
27750
|
var containerCSS = function containerCSS2(_ref3) {
|
|
27785
27751
|
var isDisabled = _ref3.isDisabled, isRtl = _ref3.isRtl;
|
|
@@ -30672,7 +30638,7 @@ var import_toConsumableArray2 = __toESM(require_toConsumableArray());
|
|
|
30672
30638
|
var import_typeof5 = __toESM(require_typeof());
|
|
30673
30639
|
var import_taggedTemplateLiteral2 = __toESM(require_taggedTemplateLiteral());
|
|
30674
30640
|
var import_defineProperty3 = __toESM(require_defineProperty());
|
|
30675
|
-
var
|
|
30641
|
+
var import_react_dom7 = require("react-dom");
|
|
30676
30642
|
var StateManagedSelect = /* @__PURE__ */ (0, import_react54.forwardRef)(function(props, ref) {
|
|
30677
30643
|
var baseSelectProps = useStateManager(props);
|
|
30678
30644
|
return /* @__PURE__ */ React14.createElement(Select, _extends({
|
|
@@ -32625,7 +32591,7 @@ var StatusDropdownField = (props) => {
|
|
|
32625
32591
|
};
|
|
32626
32592
|
|
|
32627
32593
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
32628
|
-
var
|
|
32594
|
+
var import_react_dom8 = require("react-dom");
|
|
32629
32595
|
var import_react66 = require("react");
|
|
32630
32596
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32631
32597
|
var Many2ManyField = (props) => {
|
|
@@ -32700,7 +32666,7 @@ var Many2ManyField = (props) => {
|
|
|
32700
32666
|
typeof setGroupByList === "function" && setGroupByList(null);
|
|
32701
32667
|
};
|
|
32702
32668
|
}, [selectedTags]);
|
|
32703
|
-
return (0,
|
|
32669
|
+
return (0, import_react_dom8.createPortal)(
|
|
32704
32670
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(
|
|
32705
32671
|
"div",
|
|
32706
32672
|
{
|