warqadui 0.0.47 → 0.0.48
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.d.mts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +1808 -388
- package/dist/index.mjs +1736 -317
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ __export(index_exports, {
|
|
|
72
72
|
generatePdf: () => generatePdf,
|
|
73
73
|
storage: () => storage,
|
|
74
74
|
useA4StatementView: () => useA4DataView_default,
|
|
75
|
+
useAntdImageUpload: () => useAntdImageUpload_default,
|
|
75
76
|
useApi: () => useApis_default,
|
|
76
77
|
useModal: () => useModal,
|
|
77
78
|
useSearchApiContext: () => useSearchApiContext,
|
|
@@ -1142,17 +1143,12 @@ var useModal = (initialState = false) => {
|
|
|
1142
1143
|
};
|
|
1143
1144
|
};
|
|
1144
1145
|
|
|
1145
|
-
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
1146
|
-
var import_react8 = require("react");
|
|
1147
|
-
var import_antd = require("antd");
|
|
1148
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1149
|
-
|
|
1150
1146
|
// src/components/Fields/Input.tsx
|
|
1151
|
-
var
|
|
1147
|
+
var import_react8 = require("react");
|
|
1152
1148
|
var import_lucide_react6 = require("lucide-react");
|
|
1153
1149
|
var import_react_hook_form = require("react-hook-form");
|
|
1154
|
-
var
|
|
1155
|
-
var Input = (0,
|
|
1150
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1151
|
+
var Input = (0, import_react8.forwardRef)(
|
|
1156
1152
|
({
|
|
1157
1153
|
label,
|
|
1158
1154
|
icon,
|
|
@@ -1167,11 +1163,11 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1167
1163
|
variant = "default",
|
|
1168
1164
|
...props
|
|
1169
1165
|
}, ref) => {
|
|
1170
|
-
const [isFocused, setIsFocused] = (0,
|
|
1171
|
-
const [showPassword, setShowPassword] = (0,
|
|
1166
|
+
const [isFocused, setIsFocused] = (0, import_react8.useState)(false);
|
|
1167
|
+
const [showPassword, setShowPassword] = (0, import_react8.useState)(false);
|
|
1172
1168
|
const { theme } = useWarqadConfig();
|
|
1173
1169
|
const primaryColor = theme?.primaryColor;
|
|
1174
|
-
(0,
|
|
1170
|
+
(0, import_react8.useEffect)(() => {
|
|
1175
1171
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
1176
1172
|
const currentFormValue = form.getValues(name);
|
|
1177
1173
|
if (currentFormValue === void 0 || currentFormValue === "" || currentFormValue === 0) {
|
|
@@ -1187,17 +1183,17 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1187
1183
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1188
1184
|
message = errorObj?.message;
|
|
1189
1185
|
}
|
|
1190
|
-
(0,
|
|
1186
|
+
(0, import_react8.useEffect)(() => {
|
|
1191
1187
|
if (form && name) {
|
|
1192
1188
|
form.clearErrors("root");
|
|
1193
1189
|
}
|
|
1194
1190
|
}, [form?.watch(name)]);
|
|
1195
|
-
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ (0,
|
|
1191
|
+
const renderInput = (inputProps, localType = type || "text") => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1196
1192
|
"div",
|
|
1197
1193
|
{
|
|
1198
1194
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName} `,
|
|
1199
1195
|
children: [
|
|
1200
|
-
label && /* @__PURE__ */ (0,
|
|
1196
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1201
1197
|
"label",
|
|
1202
1198
|
{
|
|
1203
1199
|
htmlFor: props.id,
|
|
@@ -1205,12 +1201,12 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1205
1201
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1206
1202
|
children: [
|
|
1207
1203
|
label,
|
|
1208
|
-
props.required && /* @__PURE__ */ (0,
|
|
1204
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1209
1205
|
]
|
|
1210
1206
|
}
|
|
1211
1207
|
),
|
|
1212
|
-
/* @__PURE__ */ (0,
|
|
1213
|
-
icon && /* @__PURE__ */ (0,
|
|
1208
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "relative", children: [
|
|
1209
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1214
1210
|
"div",
|
|
1215
1211
|
{
|
|
1216
1212
|
className: `transition-colors duration-200`,
|
|
@@ -1218,7 +1214,7 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1218
1214
|
children: icon
|
|
1219
1215
|
}
|
|
1220
1216
|
) }),
|
|
1221
|
-
/* @__PURE__ */ (0,
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1222
1218
|
"input",
|
|
1223
1219
|
{
|
|
1224
1220
|
ref,
|
|
@@ -1240,23 +1236,23 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1240
1236
|
type: localType === "password" ? showPassword ? "text" : "password" : localType
|
|
1241
1237
|
}
|
|
1242
1238
|
),
|
|
1243
|
-
type === "password" && /* @__PURE__ */ (0,
|
|
1239
|
+
type === "password" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1244
1240
|
"button",
|
|
1245
1241
|
{
|
|
1246
1242
|
type: "button",
|
|
1247
1243
|
onClick: () => setShowPassword(!showPassword),
|
|
1248
1244
|
className: "absolute inset-y-0 right-0 pr-2.5 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors focus:outline-none cursor-pointer",
|
|
1249
1245
|
tabIndex: -1,
|
|
1250
|
-
children: showPassword ? /* @__PURE__ */ (0,
|
|
1246
|
+
children: showPassword ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.EyeOff, { className: "h-5 w-5" }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.Eye, { className: "h-5 w-5" })
|
|
1251
1247
|
}
|
|
1252
1248
|
)
|
|
1253
1249
|
] }),
|
|
1254
|
-
message && /* @__PURE__ */ (0,
|
|
1250
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1255
1251
|
]
|
|
1256
1252
|
}
|
|
1257
1253
|
);
|
|
1258
1254
|
if (form && name && type === "number") {
|
|
1259
|
-
return /* @__PURE__ */ (0,
|
|
1255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1260
1256
|
import_react_hook_form.Controller,
|
|
1261
1257
|
{
|
|
1262
1258
|
control: form.control,
|
|
@@ -1345,12 +1341,12 @@ var Input = (0, import_react9.forwardRef)(
|
|
|
1345
1341
|
);
|
|
1346
1342
|
|
|
1347
1343
|
// src/components/Fields/PhoneInput.tsx
|
|
1348
|
-
var
|
|
1344
|
+
var import_react9 = require("react");
|
|
1349
1345
|
var import_react_phone_number_input = __toESM(require("react-phone-number-input"));
|
|
1350
1346
|
var import_style = require("react-phone-number-input/style.css");
|
|
1351
1347
|
var import_react_hook_form2 = require("react-hook-form");
|
|
1352
|
-
var
|
|
1353
|
-
var PhoneInput = (0,
|
|
1348
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1349
|
+
var PhoneInput = (0, import_react9.forwardRef)(
|
|
1354
1350
|
({
|
|
1355
1351
|
label,
|
|
1356
1352
|
icon,
|
|
@@ -1363,7 +1359,7 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1363
1359
|
className = "",
|
|
1364
1360
|
...props
|
|
1365
1361
|
}, ref) => {
|
|
1366
|
-
const [isFocused, setIsFocused] = (0,
|
|
1362
|
+
const [isFocused, setIsFocused] = (0, import_react9.useState)(false);
|
|
1367
1363
|
const { theme } = useWarqadConfig();
|
|
1368
1364
|
const primaryColor = theme?.primaryColor;
|
|
1369
1365
|
let message = error;
|
|
@@ -1378,8 +1374,8 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1378
1374
|
}
|
|
1379
1375
|
message = currentError?.message || message;
|
|
1380
1376
|
}
|
|
1381
|
-
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0,
|
|
1382
|
-
/* @__PURE__ */ (0,
|
|
1377
|
+
const renderInput = (onChangeHandler, currentValue) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1383
1379
|
"label",
|
|
1384
1380
|
{
|
|
1385
1381
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
@@ -1388,12 +1384,12 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1388
1384
|
},
|
|
1389
1385
|
children: [
|
|
1390
1386
|
label,
|
|
1391
|
-
props.required && /* @__PURE__ */ (0,
|
|
1387
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1392
1388
|
]
|
|
1393
1389
|
}
|
|
1394
1390
|
),
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
icon && /* @__PURE__ */ (0,
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative", children: [
|
|
1392
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "absolute inset-y-0 left-0 pl-2.5 flex items-center pointer-events-none z-10", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1397
1393
|
"div",
|
|
1398
1394
|
{
|
|
1399
1395
|
className: `transition-colors duration-200`,
|
|
@@ -1401,7 +1397,7 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1401
1397
|
children: icon
|
|
1402
1398
|
}
|
|
1403
1399
|
) }),
|
|
1404
|
-
/* @__PURE__ */ (0,
|
|
1400
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1405
1401
|
import_react_phone_number_input.default,
|
|
1406
1402
|
{
|
|
1407
1403
|
ref,
|
|
@@ -1421,10 +1417,10 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1421
1417
|
}
|
|
1422
1418
|
)
|
|
1423
1419
|
] }),
|
|
1424
|
-
message && /* @__PURE__ */ (0,
|
|
1420
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1425
1421
|
] });
|
|
1426
1422
|
if (form && name) {
|
|
1427
|
-
return /* @__PURE__ */ (0,
|
|
1423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1428
1424
|
import_react_hook_form2.Controller,
|
|
1429
1425
|
{
|
|
1430
1426
|
name,
|
|
@@ -1443,21 +1439,21 @@ var PhoneInput = (0, import_react10.forwardRef)(
|
|
|
1443
1439
|
PhoneInput.displayName = "PhoneInput";
|
|
1444
1440
|
|
|
1445
1441
|
// src/components/Fields/select.tsx
|
|
1446
|
-
var
|
|
1442
|
+
var import_react10 = __toESM(require("react"));
|
|
1447
1443
|
var import_react_dom = require("react-dom");
|
|
1448
1444
|
var import_lucide_react7 = require("lucide-react");
|
|
1449
1445
|
var import_react_hook_form3 = require("react-hook-form");
|
|
1450
|
-
var
|
|
1451
|
-
var SelectContext = (0,
|
|
1446
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1447
|
+
var SelectContext = (0, import_react10.createContext)(void 0);
|
|
1452
1448
|
var useSelectContext = () => {
|
|
1453
|
-
const context = (0,
|
|
1449
|
+
const context = (0, import_react10.useContext)(SelectContext);
|
|
1454
1450
|
if (!context)
|
|
1455
1451
|
throw new Error("Select components must be used within a SelectProvider");
|
|
1456
1452
|
return context;
|
|
1457
1453
|
};
|
|
1458
|
-
var Select = (0,
|
|
1454
|
+
var Select = (0, import_react10.forwardRef)((props, ref) => {
|
|
1459
1455
|
const { form, name, onChange, value, children, options = [] } = props;
|
|
1460
|
-
(0,
|
|
1456
|
+
(0, import_react10.useEffect)(() => {
|
|
1461
1457
|
if (form && name && value !== void 0 && value !== null && value !== "") {
|
|
1462
1458
|
const currentFormValue = form.getValues(name);
|
|
1463
1459
|
if (currentFormValue === void 0 || currentFormValue === "" || currentFormValue === 0) {
|
|
@@ -1466,7 +1462,7 @@ var Select = (0, import_react11.forwardRef)((props, ref) => {
|
|
|
1466
1462
|
}
|
|
1467
1463
|
}, [value, name, form]);
|
|
1468
1464
|
if (form && name) {
|
|
1469
|
-
return /* @__PURE__ */ (0,
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1470
1466
|
import_react_hook_form3.Controller,
|
|
1471
1467
|
{
|
|
1472
1468
|
name,
|
|
@@ -1478,7 +1474,7 @@ var Select = (0, import_react11.forwardRef)((props, ref) => {
|
|
|
1478
1474
|
ref: fieldRef,
|
|
1479
1475
|
onBlur
|
|
1480
1476
|
}
|
|
1481
|
-
}) => /* @__PURE__ */ (0,
|
|
1477
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1482
1478
|
SelectRoot,
|
|
1483
1479
|
{
|
|
1484
1480
|
...props,
|
|
@@ -1495,7 +1491,7 @@ var Select = (0, import_react11.forwardRef)((props, ref) => {
|
|
|
1495
1491
|
}
|
|
1496
1492
|
);
|
|
1497
1493
|
}
|
|
1498
|
-
return /* @__PURE__ */ (0,
|
|
1494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1499
1495
|
SelectRoot,
|
|
1500
1496
|
{
|
|
1501
1497
|
...props,
|
|
@@ -1528,15 +1524,15 @@ var SelectRoot = ({
|
|
|
1528
1524
|
className = "",
|
|
1529
1525
|
...props
|
|
1530
1526
|
}) => {
|
|
1531
|
-
const [isOpen, setIsOpen] = (0,
|
|
1532
|
-
const [isFocused, setIsFocused] = (0,
|
|
1533
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
1534
|
-
const [registeredOptions, setRegisteredOptions] = (0,
|
|
1527
|
+
const [isOpen, setIsOpen] = (0, import_react10.useState)(false);
|
|
1528
|
+
const [isFocused, setIsFocused] = (0, import_react10.useState)(false);
|
|
1529
|
+
const [activeIndex, setActiveIndex] = (0, import_react10.useState)(-1);
|
|
1530
|
+
const [registeredOptions, setRegisteredOptions] = (0, import_react10.useState)([]);
|
|
1535
1531
|
const { theme } = useWarqadConfig();
|
|
1536
1532
|
const primaryColor = theme?.primaryColor;
|
|
1537
|
-
const containerRef = (0,
|
|
1538
|
-
const dropdownAnchorRef = (0,
|
|
1539
|
-
const dropdownContentRef = (0,
|
|
1533
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
1534
|
+
const dropdownAnchorRef = (0, import_react10.useRef)(null);
|
|
1535
|
+
const dropdownContentRef = (0, import_react10.useRef)(null);
|
|
1540
1536
|
const registerOption = (opt) => {
|
|
1541
1537
|
setRegisteredOptions((prev) => {
|
|
1542
1538
|
const index = prev.findIndex((p) => p.value === opt.value);
|
|
@@ -1558,7 +1554,7 @@ var SelectRoot = ({
|
|
|
1558
1554
|
form.clearErrors(name);
|
|
1559
1555
|
}
|
|
1560
1556
|
};
|
|
1561
|
-
(0,
|
|
1557
|
+
(0, import_react10.useEffect)(() => {
|
|
1562
1558
|
const handleClickOutside = (event) => {
|
|
1563
1559
|
const target = event.target;
|
|
1564
1560
|
if (containerRef.current && !containerRef.current.contains(target) && !(dropdownContentRef.current && dropdownContentRef.current.contains(target))) {
|
|
@@ -1601,26 +1597,26 @@ var SelectRoot = ({
|
|
|
1601
1597
|
fieldInternalProps,
|
|
1602
1598
|
disabled
|
|
1603
1599
|
};
|
|
1604
|
-
const hasChildren =
|
|
1605
|
-
return /* @__PURE__ */ (0,
|
|
1600
|
+
const hasChildren = import_react10.default.Children.count(children) > 0;
|
|
1601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectContext.Provider, { value: valueCtx, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1606
1602
|
"div",
|
|
1607
1603
|
{
|
|
1608
1604
|
ref: containerRef,
|
|
1609
1605
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
1610
1606
|
children: [
|
|
1611
|
-
label && /* @__PURE__ */ (0,
|
|
1607
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1612
1608
|
"label",
|
|
1613
1609
|
{
|
|
1614
1610
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
1615
1611
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
1616
1612
|
children: [
|
|
1617
1613
|
label,
|
|
1618
|
-
required && /* @__PURE__ */ (0,
|
|
1614
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1619
1615
|
]
|
|
1620
1616
|
}
|
|
1621
1617
|
),
|
|
1622
|
-
hasChildren ? children : /* @__PURE__ */ (0,
|
|
1623
|
-
/* @__PURE__ */ (0,
|
|
1618
|
+
hasChildren ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1619
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1624
1620
|
SelectTrigger,
|
|
1625
1621
|
{
|
|
1626
1622
|
id,
|
|
@@ -1631,7 +1627,7 @@ var SelectRoot = ({
|
|
|
1631
1627
|
...props
|
|
1632
1628
|
}
|
|
1633
1629
|
),
|
|
1634
|
-
allOptions && allOptions.length > 0 && /* @__PURE__ */ (0,
|
|
1630
|
+
allOptions && allOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectContent, { children: allOptions.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1635
1631
|
SelectItem,
|
|
1636
1632
|
{
|
|
1637
1633
|
value: opt.value,
|
|
@@ -1641,12 +1637,12 @@ var SelectRoot = ({
|
|
|
1641
1637
|
String(opt.value) || index
|
|
1642
1638
|
)) })
|
|
1643
1639
|
] }),
|
|
1644
|
-
message && /* @__PURE__ */ (0,
|
|
1640
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1645
1641
|
]
|
|
1646
1642
|
}
|
|
1647
1643
|
) });
|
|
1648
1644
|
};
|
|
1649
|
-
var SelectTrigger = (0,
|
|
1645
|
+
var SelectTrigger = (0, import_react10.forwardRef)(
|
|
1650
1646
|
({
|
|
1651
1647
|
className = "",
|
|
1652
1648
|
variant = "default",
|
|
@@ -1670,10 +1666,10 @@ var SelectTrigger = (0, import_react11.forwardRef)(
|
|
|
1670
1666
|
fieldInternalProps,
|
|
1671
1667
|
disabled
|
|
1672
1668
|
} = useSelectContext();
|
|
1673
|
-
const lastFocusTime = (0,
|
|
1669
|
+
const lastFocusTime = (0, import_react10.useRef)(0);
|
|
1674
1670
|
const displayOption = options.find((o) => o.value === selectedValue);
|
|
1675
1671
|
const displayValue = displayOption ? displayOption.label : selectedValue != null && selectedValue !== "" ? String(selectedValue) : placeholder;
|
|
1676
|
-
return /* @__PURE__ */ (0,
|
|
1672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1677
1673
|
"div",
|
|
1678
1674
|
{
|
|
1679
1675
|
id,
|
|
@@ -1722,8 +1718,8 @@ var SelectTrigger = (0, import_react11.forwardRef)(
|
|
|
1722
1718
|
}
|
|
1723
1719
|
},
|
|
1724
1720
|
...props,
|
|
1725
|
-
children: children ? children : /* @__PURE__ */ (0,
|
|
1726
|
-
icon && /* @__PURE__ */ (0,
|
|
1721
|
+
children: children ? children : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1722
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1727
1723
|
"div",
|
|
1728
1724
|
{
|
|
1729
1725
|
className: `pl-2.5 pr-2 flex items-center transition-colors duration-200`,
|
|
@@ -1733,14 +1729,14 @@ var SelectTrigger = (0, import_react11.forwardRef)(
|
|
|
1733
1729
|
children: icon
|
|
1734
1730
|
}
|
|
1735
1731
|
),
|
|
1736
|
-
/* @__PURE__ */ (0,
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1737
1733
|
"div",
|
|
1738
1734
|
{
|
|
1739
1735
|
className: `flex-1 truncate text-sm ${icon ? "" : "pl-2.5"} ${!selectedValue && selectedValue !== 0 && selectedValue !== false ? "text-gray-400 dark:text-zinc-500" : ""}`,
|
|
1740
1736
|
children: displayValue
|
|
1741
1737
|
}
|
|
1742
1738
|
),
|
|
1743
|
-
/* @__PURE__ */ (0,
|
|
1739
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pr-2.5 flex items-center gap-1 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1744
1740
|
import_lucide_react7.ChevronDown,
|
|
1745
1741
|
{
|
|
1746
1742
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -1752,10 +1748,10 @@ var SelectTrigger = (0, import_react11.forwardRef)(
|
|
|
1752
1748
|
}
|
|
1753
1749
|
);
|
|
1754
1750
|
SelectTrigger.displayName = "SelectTrigger";
|
|
1755
|
-
var SelectContent = (0,
|
|
1751
|
+
var SelectContent = (0, import_react10.forwardRef)(
|
|
1756
1752
|
({ children, className = "", style, ...props }, ref) => {
|
|
1757
1753
|
const { isOpen, setIsOpen, dropdownAnchorRef, dropdownContentRef } = useSelectContext();
|
|
1758
|
-
const [dropdownStyle, setDropdownStyle] = (0,
|
|
1754
|
+
const [dropdownStyle, setDropdownStyle] = (0, import_react10.useState)({});
|
|
1759
1755
|
const updateDropdownPosition = () => {
|
|
1760
1756
|
if (dropdownAnchorRef.current) {
|
|
1761
1757
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -1773,7 +1769,7 @@ var SelectContent = (0, import_react11.forwardRef)(
|
|
|
1773
1769
|
setDropdownStyle(newStyle);
|
|
1774
1770
|
}
|
|
1775
1771
|
};
|
|
1776
|
-
(0,
|
|
1772
|
+
(0, import_react10.useEffect)(() => {
|
|
1777
1773
|
if (isOpen) {
|
|
1778
1774
|
updateDropdownPosition();
|
|
1779
1775
|
window.addEventListener("scroll", updateDropdownPosition, true);
|
|
@@ -1786,7 +1782,7 @@ var SelectContent = (0, import_react11.forwardRef)(
|
|
|
1786
1782
|
}, [isOpen]);
|
|
1787
1783
|
if (!isOpen || typeof document === "undefined") return null;
|
|
1788
1784
|
return (0, import_react_dom.createPortal)(
|
|
1789
|
-
/* @__PURE__ */ (0,
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1790
1786
|
"div",
|
|
1791
1787
|
{
|
|
1792
1788
|
ref: dropdownContentRef,
|
|
@@ -1794,7 +1790,7 @@ var SelectContent = (0, import_react11.forwardRef)(
|
|
|
1794
1790
|
style: { ...dropdownStyle, ...style },
|
|
1795
1791
|
onMouseDown: (e) => e.stopPropagation(),
|
|
1796
1792
|
...props,
|
|
1797
|
-
children: /* @__PURE__ */ (0,
|
|
1793
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex flex-col gap-0.5", children: import_react10.default.Children.count(children) === 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-3 text-center text-sm text-gray-500", children: "No options available" }) : children })
|
|
1798
1794
|
}
|
|
1799
1795
|
),
|
|
1800
1796
|
document.body
|
|
@@ -1802,7 +1798,7 @@ var SelectContent = (0, import_react11.forwardRef)(
|
|
|
1802
1798
|
}
|
|
1803
1799
|
);
|
|
1804
1800
|
SelectContent.displayName = "SelectContent";
|
|
1805
|
-
var SelectItem = (0,
|
|
1801
|
+
var SelectItem = (0, import_react10.forwardRef)(
|
|
1806
1802
|
({ value, label, disabled, children, className = "", ...props }, ref) => {
|
|
1807
1803
|
const {
|
|
1808
1804
|
selectedValue,
|
|
@@ -1814,7 +1810,7 @@ var SelectItem = (0, import_react11.forwardRef)(
|
|
|
1814
1810
|
} = useSelectContext();
|
|
1815
1811
|
const isSelected = selectedValue === value;
|
|
1816
1812
|
const displayLabel = label || children || value;
|
|
1817
|
-
(0,
|
|
1813
|
+
(0, import_react10.useEffect)(() => {
|
|
1818
1814
|
if (value !== void 0) {
|
|
1819
1815
|
registerOption({ value, label: String(displayLabel), disabled });
|
|
1820
1816
|
}
|
|
@@ -1825,7 +1821,7 @@ var SelectItem = (0, import_react11.forwardRef)(
|
|
|
1825
1821
|
setIsOpen(false);
|
|
1826
1822
|
fieldInternalProps?.onBlur?.();
|
|
1827
1823
|
};
|
|
1828
|
-
return /* @__PURE__ */ (0,
|
|
1824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1829
1825
|
"button",
|
|
1830
1826
|
{
|
|
1831
1827
|
ref,
|
|
@@ -1841,8 +1837,8 @@ var SelectItem = (0, import_react11.forwardRef)(
|
|
|
1841
1837
|
},
|
|
1842
1838
|
...props,
|
|
1843
1839
|
children: [
|
|
1844
|
-
/* @__PURE__ */ (0,
|
|
1845
|
-
isSelected && /* @__PURE__ */ (0,
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "whitespace-nowrap truncate flex-1", children: children || label }),
|
|
1841
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1846
1842
|
import_lucide_react7.Check,
|
|
1847
1843
|
{
|
|
1848
1844
|
className: "h-4 w-4 shrink-0 ml-2",
|
|
@@ -1857,10 +1853,10 @@ var SelectItem = (0, import_react11.forwardRef)(
|
|
|
1857
1853
|
SelectItem.displayName = "SelectItem";
|
|
1858
1854
|
|
|
1859
1855
|
// src/components/Fields/textArea.tsx
|
|
1860
|
-
var
|
|
1856
|
+
var import_react11 = require("react");
|
|
1861
1857
|
var import_react_hook_form4 = require("react-hook-form");
|
|
1862
|
-
var
|
|
1863
|
-
var Textarea = (0,
|
|
1858
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1859
|
+
var Textarea = (0, import_react11.forwardRef)(
|
|
1864
1860
|
({
|
|
1865
1861
|
label,
|
|
1866
1862
|
error,
|
|
@@ -1872,7 +1868,7 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1872
1868
|
className = "",
|
|
1873
1869
|
...props
|
|
1874
1870
|
}, ref) => {
|
|
1875
|
-
const [isFocused, setIsFocused] = (0,
|
|
1871
|
+
const [isFocused, setIsFocused] = (0, import_react11.useState)(false);
|
|
1876
1872
|
const { theme } = useWarqadConfig();
|
|
1877
1873
|
const primaryColor = theme?.primaryColor;
|
|
1878
1874
|
let message = error;
|
|
@@ -1883,8 +1879,8 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1883
1879
|
const errorObj = name.split(".").reduce((acc, current) => acc?.[current], errors);
|
|
1884
1880
|
message = errorObj?.message;
|
|
1885
1881
|
}
|
|
1886
|
-
const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0,
|
|
1887
|
-
/* @__PURE__ */ (0,
|
|
1882
|
+
const renderInput = (inputProps, ref2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `space-y-2 group w-full! relative ${containerClassName}`, children: [
|
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1888
1884
|
"label",
|
|
1889
1885
|
{
|
|
1890
1886
|
htmlFor: props.id,
|
|
@@ -1892,11 +1888,11 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1892
1888
|
style: { color: isFocused ? primaryColor : void 0 },
|
|
1893
1889
|
children: [
|
|
1894
1890
|
label,
|
|
1895
|
-
props.required && /* @__PURE__ */ (0,
|
|
1891
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
1896
1892
|
]
|
|
1897
1893
|
}
|
|
1898
1894
|
),
|
|
1899
|
-
/* @__PURE__ */ (0,
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1900
1896
|
"textarea",
|
|
1901
1897
|
{
|
|
1902
1898
|
ref: ref2,
|
|
@@ -1917,9 +1913,9 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1917
1913
|
...inputProps
|
|
1918
1914
|
}
|
|
1919
1915
|
) }),
|
|
1920
|
-
message && /* @__PURE__ */ (0,
|
|
1916
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
1921
1917
|
] });
|
|
1922
|
-
(0,
|
|
1918
|
+
(0, import_react11.useEffect)(() => {
|
|
1923
1919
|
if (form && name && props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
1924
1920
|
const currentFormValue = form.getValues(name);
|
|
1925
1921
|
if (currentFormValue === void 0 || currentFormValue === "" || currentFormValue === 0) {
|
|
@@ -1928,7 +1924,7 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1928
1924
|
}
|
|
1929
1925
|
}, [props.value, name, form]);
|
|
1930
1926
|
if (form && name) {
|
|
1931
|
-
return /* @__PURE__ */ (0,
|
|
1927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1932
1928
|
import_react_hook_form4.Controller,
|
|
1933
1929
|
{
|
|
1934
1930
|
control: form.control,
|
|
@@ -1964,26 +1960,26 @@ var Textarea = (0, import_react12.forwardRef)(
|
|
|
1964
1960
|
);
|
|
1965
1961
|
|
|
1966
1962
|
// src/components/Fields/searchApi.tsx
|
|
1967
|
-
var
|
|
1963
|
+
var import_react13 = require("react");
|
|
1968
1964
|
var import_react_dom2 = require("react-dom");
|
|
1969
1965
|
var import_lucide_react8 = require("lucide-react");
|
|
1970
1966
|
|
|
1971
1967
|
// src/hooks/Fetches/useApis.tsx
|
|
1972
|
-
var
|
|
1968
|
+
var import_react12 = require("react");
|
|
1973
1969
|
var import_axios = __toESM(require("axios"));
|
|
1974
1970
|
var useApi = () => {
|
|
1975
1971
|
const { api: configApi } = useWarqadConfig();
|
|
1976
|
-
const api = (0,
|
|
1972
|
+
const api = (0, import_react12.useMemo)(() => {
|
|
1977
1973
|
const baseURL = configApi || "/api";
|
|
1978
1974
|
return import_axios.default.create({
|
|
1979
1975
|
baseURL,
|
|
1980
1976
|
withCredentials: true
|
|
1981
1977
|
});
|
|
1982
1978
|
}, [configApi]);
|
|
1983
|
-
const [data, setData] = (0,
|
|
1984
|
-
const [isLoading, setIsLoading] = (0,
|
|
1985
|
-
const [pdfLoading, setPdfLoading] = (0,
|
|
1986
|
-
const [error, setError] = (0,
|
|
1979
|
+
const [data, setData] = (0, import_react12.useState)();
|
|
1980
|
+
const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
|
|
1981
|
+
const [pdfLoading, setPdfLoading] = (0, import_react12.useState)(false);
|
|
1982
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
1987
1983
|
const get = async ({ url, v = 1, params, delay }) => {
|
|
1988
1984
|
setIsLoading(true);
|
|
1989
1985
|
try {
|
|
@@ -2135,22 +2131,22 @@ var useApis_default = useApi;
|
|
|
2135
2131
|
|
|
2136
2132
|
// src/components/Fields/searchApi.tsx
|
|
2137
2133
|
var import_react_hook_form5 = require("react-hook-form");
|
|
2138
|
-
var
|
|
2139
|
-
var SearchApiContext = (0,
|
|
2134
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2135
|
+
var SearchApiContext = (0, import_react13.createContext)(
|
|
2140
2136
|
void 0
|
|
2141
2137
|
);
|
|
2142
2138
|
var useSearchApiContext = () => {
|
|
2143
|
-
const context = (0,
|
|
2139
|
+
const context = (0, import_react13.useContext)(SearchApiContext);
|
|
2144
2140
|
if (!context)
|
|
2145
2141
|
throw new Error(
|
|
2146
2142
|
"SearchApi components must be used within a SearchApiProvider"
|
|
2147
2143
|
);
|
|
2148
2144
|
return context;
|
|
2149
2145
|
};
|
|
2150
|
-
var SearchApi = (0,
|
|
2146
|
+
var SearchApi = (0, import_react13.forwardRef)(
|
|
2151
2147
|
(props, _) => {
|
|
2152
2148
|
const { form, name, onChange, onSelect, onClear, value, children, ...restProps } = props;
|
|
2153
|
-
(0,
|
|
2149
|
+
(0, import_react13.useEffect)(() => {
|
|
2154
2150
|
if (form && name && value !== void 0 && value !== null && value !== "") {
|
|
2155
2151
|
const currentFormValue = form.getValues(name);
|
|
2156
2152
|
if (currentFormValue === void 0 || currentFormValue === "" || currentFormValue === 0) {
|
|
@@ -2159,12 +2155,12 @@ var SearchApi = (0, import_react14.forwardRef)(
|
|
|
2159
2155
|
}
|
|
2160
2156
|
}, [value, name, form]);
|
|
2161
2157
|
if (form && name) {
|
|
2162
|
-
return /* @__PURE__ */ (0,
|
|
2158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2163
2159
|
import_react_hook_form5.Controller,
|
|
2164
2160
|
{
|
|
2165
2161
|
name,
|
|
2166
2162
|
control: form.control,
|
|
2167
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
2163
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2168
2164
|
SearchApiRoot,
|
|
2169
2165
|
{
|
|
2170
2166
|
...restProps,
|
|
@@ -2184,7 +2180,7 @@ var SearchApi = (0, import_react14.forwardRef)(
|
|
|
2184
2180
|
}
|
|
2185
2181
|
);
|
|
2186
2182
|
}
|
|
2187
|
-
return /* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2188
2184
|
SearchApiRoot,
|
|
2189
2185
|
{
|
|
2190
2186
|
...restProps,
|
|
@@ -2227,20 +2223,20 @@ var SearchApiRoot = ({
|
|
|
2227
2223
|
className = "",
|
|
2228
2224
|
...props
|
|
2229
2225
|
}) => {
|
|
2230
|
-
const [searchTerm, setSearchTerm] = (0,
|
|
2226
|
+
const [searchTerm, setSearchTerm] = (0, import_react13.useState)("");
|
|
2231
2227
|
const { theme } = useWarqadConfig();
|
|
2232
2228
|
const primaryColor = theme?.primaryColor;
|
|
2233
|
-
const [options, setOptions] = (0,
|
|
2234
|
-
const [isOpen, setIsOpen] = (0,
|
|
2235
|
-
const [isFocused, setIsFocused] = (0,
|
|
2236
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
2237
|
-
const [selectedObject, setSelectedObject] = (0,
|
|
2238
|
-
const [hasAttemptedHydration, setHasAttemptedHydration] = (0,
|
|
2239
|
-
const containerRef = (0,
|
|
2240
|
-
const dropdownAnchorRef = (0,
|
|
2241
|
-
const dropdownContentRef = (0,
|
|
2242
|
-
const inputRef = (0,
|
|
2243
|
-
const prevApiRef = (0,
|
|
2229
|
+
const [options, setOptions] = (0, import_react13.useState)([]);
|
|
2230
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
2231
|
+
const [isFocused, setIsFocused] = (0, import_react13.useState)(false);
|
|
2232
|
+
const [activeIndex, setActiveIndex] = (0, import_react13.useState)(-1);
|
|
2233
|
+
const [selectedObject, setSelectedObject] = (0, import_react13.useState)(void 0);
|
|
2234
|
+
const [hasAttemptedHydration, setHasAttemptedHydration] = (0, import_react13.useState)(false);
|
|
2235
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
2236
|
+
const dropdownAnchorRef = (0, import_react13.useRef)(null);
|
|
2237
|
+
const dropdownContentRef = (0, import_react13.useRef)(null);
|
|
2238
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
2239
|
+
const prevApiRef = (0, import_react13.useRef)(api);
|
|
2244
2240
|
const { get, isLoading, error: errorMessage } = useApis_default();
|
|
2245
2241
|
const fetchOptions = async (query) => {
|
|
2246
2242
|
try {
|
|
@@ -2272,7 +2268,7 @@ var SearchApiRoot = ({
|
|
|
2272
2268
|
setOptions([]);
|
|
2273
2269
|
}
|
|
2274
2270
|
};
|
|
2275
|
-
(0,
|
|
2271
|
+
(0, import_react13.useEffect)(() => {
|
|
2276
2272
|
const timer = setTimeout(() => {
|
|
2277
2273
|
if (isOpen) {
|
|
2278
2274
|
fetchOptions(searchTerm);
|
|
@@ -2280,12 +2276,12 @@ var SearchApiRoot = ({
|
|
|
2280
2276
|
}, 300);
|
|
2281
2277
|
return () => clearTimeout(timer);
|
|
2282
2278
|
}, [searchTerm, api, isOpen]);
|
|
2283
|
-
(0,
|
|
2279
|
+
(0, import_react13.useEffect)(() => {
|
|
2284
2280
|
if (isOpen && options.length === 0) {
|
|
2285
2281
|
fetchOptions("");
|
|
2286
2282
|
}
|
|
2287
2283
|
}, [isOpen]);
|
|
2288
|
-
(0,
|
|
2284
|
+
(0, import_react13.useEffect)(() => {
|
|
2289
2285
|
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject) {
|
|
2290
2286
|
setHasAttemptedHydration(false);
|
|
2291
2287
|
fetchOptions(currentValue).finally(() => {
|
|
@@ -2302,7 +2298,7 @@ var SearchApiRoot = ({
|
|
|
2302
2298
|
}
|
|
2303
2299
|
return option[valueKey];
|
|
2304
2300
|
};
|
|
2305
|
-
(0,
|
|
2301
|
+
(0, import_react13.useEffect)(() => {
|
|
2306
2302
|
if (currentValue !== void 0 && currentValue !== null && currentValue !== "" && !selectedObject && options.length > 0) {
|
|
2307
2303
|
const found = options.find((o) => getOptionValue(o) === currentValue);
|
|
2308
2304
|
if (found) {
|
|
@@ -2316,7 +2312,7 @@ var SearchApiRoot = ({
|
|
|
2316
2312
|
}
|
|
2317
2313
|
}
|
|
2318
2314
|
}, [currentValue, options, obj]);
|
|
2319
|
-
(0,
|
|
2315
|
+
(0, import_react13.useEffect)(() => {
|
|
2320
2316
|
if (prevApiRef.current !== api) {
|
|
2321
2317
|
prevApiRef.current = api;
|
|
2322
2318
|
setSearchTerm("");
|
|
@@ -2341,7 +2337,7 @@ var SearchApiRoot = ({
|
|
|
2341
2337
|
fetchOptions("");
|
|
2342
2338
|
}
|
|
2343
2339
|
}, [api, name, obj]);
|
|
2344
|
-
(0,
|
|
2340
|
+
(0, import_react13.useEffect)(() => {
|
|
2345
2341
|
const handleClickOutside = (event) => {
|
|
2346
2342
|
const target = event.target;
|
|
2347
2343
|
if (containerRef.current && !containerRef.current.contains(target) && !(dropdownContentRef.current && dropdownContentRef.current.contains(target))) {
|
|
@@ -2452,26 +2448,26 @@ var SearchApiRoot = ({
|
|
|
2452
2448
|
onClear
|
|
2453
2449
|
};
|
|
2454
2450
|
const hasChildren = !!children;
|
|
2455
|
-
return /* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchApiContext.Provider, { value: valueCtx, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2456
2452
|
"div",
|
|
2457
2453
|
{
|
|
2458
2454
|
ref: containerRef,
|
|
2459
2455
|
className: `${label ? "space-y-2" : ""} group relative ${containerClassName}`,
|
|
2460
2456
|
children: [
|
|
2461
|
-
label && /* @__PURE__ */ (0,
|
|
2457
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2462
2458
|
"label",
|
|
2463
2459
|
{
|
|
2464
2460
|
className: `block text-xs font-medium transition-colors duration-200`,
|
|
2465
2461
|
style: { color: isFocused || isOpen ? primaryColor : void 0 },
|
|
2466
2462
|
children: [
|
|
2467
2463
|
label,
|
|
2468
|
-
required && /* @__PURE__ */ (0,
|
|
2464
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2469
2465
|
]
|
|
2470
2466
|
}
|
|
2471
2467
|
),
|
|
2472
|
-
hasChildren ? children : /* @__PURE__ */ (0,
|
|
2473
|
-
/* @__PURE__ */ (0,
|
|
2474
|
-
/* @__PURE__ */ (0,
|
|
2468
|
+
hasChildren ? children : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchApiTrigger, { className, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchApiInput, { ...props }) }),
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SearchApiContent, { children: filteredOptions.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2475
2471
|
SearchApiItem,
|
|
2476
2472
|
{
|
|
2477
2473
|
option: opt,
|
|
@@ -2484,7 +2480,7 @@ var SearchApiRoot = ({
|
|
|
2484
2480
|
}
|
|
2485
2481
|
) });
|
|
2486
2482
|
};
|
|
2487
|
-
var SearchApiTrigger = (0,
|
|
2483
|
+
var SearchApiTrigger = (0, import_react13.forwardRef)(
|
|
2488
2484
|
({ className = "", children, ...props }, ref) => {
|
|
2489
2485
|
const {
|
|
2490
2486
|
isOpen,
|
|
@@ -2501,7 +2497,7 @@ var SearchApiTrigger = (0, import_react14.forwardRef)(
|
|
|
2501
2497
|
inputRef,
|
|
2502
2498
|
searchTerm
|
|
2503
2499
|
} = useSearchApiContext();
|
|
2504
|
-
return /* @__PURE__ */ (0,
|
|
2500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "relative", ref: dropdownAnchorRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2505
2501
|
"div",
|
|
2506
2502
|
{
|
|
2507
2503
|
className: `flex items-center w-full px-0 text-gray-900 dark:text-white transition-all duration-200 cursor-text py-1 ${variant === "ghost" ? "bg-transparent border-transparent shadow-none px-0 h-full" : isFocused || isOpen ? "ring-2 bg-white dark:bg-zinc-900 border rounded-xl h-9" : "border-gray-200 dark:border-zinc-800 border rounded-xl bg-white dark:bg-zinc-900/50 h-9"} ${className}`,
|
|
@@ -2518,25 +2514,25 @@ var SearchApiTrigger = (0, import_react14.forwardRef)(
|
|
|
2518
2514
|
},
|
|
2519
2515
|
...props,
|
|
2520
2516
|
children: [
|
|
2521
|
-
/* @__PURE__ */ (0,
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2522
2518
|
"div",
|
|
2523
2519
|
{
|
|
2524
2520
|
className: `${variant === "ghost" ? "pl-0" : "pl-2.5"} text-gray-400`,
|
|
2525
|
-
children: /* @__PURE__ */ (0,
|
|
2521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Search, { className: "h-4 w-4" })
|
|
2526
2522
|
}
|
|
2527
2523
|
),
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2529
|
-
/* @__PURE__ */ (0,
|
|
2530
|
-
selectedValue && !disabled && /* @__PURE__ */ (0,
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex-1 relative ms-2", children }),
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "pr-2.5 w-16! flex items-center gap-1 shrink-0 min-w-10 justify-end", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Loader2, { className: "h-4 w-4 animate-spin text-blue-500 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2526
|
+
selectedValue && !disabled && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2531
2527
|
"button",
|
|
2532
2528
|
{
|
|
2533
2529
|
onClick: clearSelection,
|
|
2534
2530
|
type: "button",
|
|
2535
2531
|
className: "p-0.5 hover:bg-gray-200 dark:hover:bg-zinc-700 rounded-full text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
2536
|
-
children: /* @__PURE__ */ (0,
|
|
2532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.X, { className: "h-3 w-3" })
|
|
2537
2533
|
}
|
|
2538
2534
|
),
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2535
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2540
2536
|
import_lucide_react8.ChevronDown,
|
|
2541
2537
|
{
|
|
2542
2538
|
className: `h-4 w-4 text-gray-400 transition-transform ${isOpen ? "rotate-180" : ""}`
|
|
@@ -2549,7 +2545,7 @@ var SearchApiTrigger = (0, import_react14.forwardRef)(
|
|
|
2549
2545
|
}
|
|
2550
2546
|
);
|
|
2551
2547
|
SearchApiTrigger.displayName = "SearchApiTrigger";
|
|
2552
|
-
var SearchApiInput = (0,
|
|
2548
|
+
var SearchApiInput = (0, import_react13.forwardRef)(
|
|
2553
2549
|
({ className = "", ...props }, ref) => {
|
|
2554
2550
|
const {
|
|
2555
2551
|
isOpen,
|
|
@@ -2616,9 +2612,9 @@ var SearchApiInput = (0, import_react14.forwardRef)(
|
|
|
2616
2612
|
break;
|
|
2617
2613
|
}
|
|
2618
2614
|
};
|
|
2619
|
-
return /* @__PURE__ */ (0,
|
|
2620
|
-
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ (0,
|
|
2621
|
-
/* @__PURE__ */ (0,
|
|
2615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
2616
|
+
!isOpen && (selectedValue !== void 0 && selectedValue !== null && selectedValue !== "") && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "absolute inset-0 flex items-center ms-1 truncate select-none", children: getDisplayValue() }),
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2622
2618
|
"input",
|
|
2623
2619
|
{
|
|
2624
2620
|
ref: setInternalInputRef,
|
|
@@ -2661,7 +2657,7 @@ var SearchApiInput = (0, import_react14.forwardRef)(
|
|
|
2661
2657
|
}
|
|
2662
2658
|
);
|
|
2663
2659
|
SearchApiInput.displayName = "SearchApiInput";
|
|
2664
|
-
var SearchApiContent = (0,
|
|
2660
|
+
var SearchApiContent = (0, import_react13.forwardRef)(
|
|
2665
2661
|
({ children, className = "", style, ...props }, ref) => {
|
|
2666
2662
|
const {
|
|
2667
2663
|
isOpen,
|
|
@@ -2673,7 +2669,7 @@ var SearchApiContent = (0, import_react14.forwardRef)(
|
|
|
2673
2669
|
options,
|
|
2674
2670
|
error
|
|
2675
2671
|
} = useSearchApiContext();
|
|
2676
|
-
const [dropdownStyle, setDropdownStyle] = (0,
|
|
2672
|
+
const [dropdownStyle, setDropdownStyle] = (0, import_react13.useState)({});
|
|
2677
2673
|
const updateDropdownPosition = () => {
|
|
2678
2674
|
if (dropdownAnchorRef.current) {
|
|
2679
2675
|
const rect = dropdownAnchorRef.current.getBoundingClientRect();
|
|
@@ -2691,7 +2687,7 @@ var SearchApiContent = (0, import_react14.forwardRef)(
|
|
|
2691
2687
|
setDropdownStyle(newStyle);
|
|
2692
2688
|
}
|
|
2693
2689
|
};
|
|
2694
|
-
(0,
|
|
2690
|
+
(0, import_react13.useEffect)(() => {
|
|
2695
2691
|
if (isOpen) {
|
|
2696
2692
|
updateDropdownPosition();
|
|
2697
2693
|
window.addEventListener("scroll", updateDropdownPosition, true);
|
|
@@ -2704,7 +2700,7 @@ var SearchApiContent = (0, import_react14.forwardRef)(
|
|
|
2704
2700
|
}, [isOpen]);
|
|
2705
2701
|
if (!isOpen || typeof document === "undefined") return null;
|
|
2706
2702
|
return (0, import_react_dom2.createPortal)(
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2708
2704
|
"div",
|
|
2709
2705
|
{
|
|
2710
2706
|
ref: dropdownContentRef,
|
|
@@ -2713,11 +2709,11 @@ var SearchApiContent = (0, import_react14.forwardRef)(
|
|
|
2713
2709
|
onMouseDown: (e) => e.stopPropagation(),
|
|
2714
2710
|
...props,
|
|
2715
2711
|
children: [
|
|
2716
|
-
error && /* @__PURE__ */ (0,
|
|
2717
|
-
isLoading && options.length === 0 ? /* @__PURE__ */ (0,
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2712
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "px-3 py-2 text-sm text-red-600 dark:text-red-400 border-b border-gray-100 dark:border-zinc-800", children: error }),
|
|
2713
|
+
isLoading && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "p-4 text-center text-sm text-gray-500", children: [
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Loader2, { className: "h-5 w-5 animate-spin mx-auto mb-2" }),
|
|
2719
2715
|
"Loading options..."
|
|
2720
|
-
] }) : children ? /* @__PURE__ */ (0,
|
|
2716
|
+
] }) : children ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "py-1", children }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "p-4 text-center text-sm text-gray-500", children: searchTerm ? `No results for "${searchTerm}"` : "No options available" })
|
|
2721
2717
|
]
|
|
2722
2718
|
}
|
|
2723
2719
|
),
|
|
@@ -2726,7 +2722,7 @@ var SearchApiContent = (0, import_react14.forwardRef)(
|
|
|
2726
2722
|
}
|
|
2727
2723
|
);
|
|
2728
2724
|
SearchApiContent.displayName = "SearchApiContent";
|
|
2729
|
-
var SearchApiItem = (0,
|
|
2725
|
+
var SearchApiItem = (0, import_react13.forwardRef)(
|
|
2730
2726
|
({ option, index, className = "", ...props }, ref) => {
|
|
2731
2727
|
const {
|
|
2732
2728
|
selectedValue,
|
|
@@ -2746,7 +2742,7 @@ var SearchApiItem = (0, import_react14.forwardRef)(
|
|
|
2746
2742
|
const optValue = getOptionValue(option);
|
|
2747
2743
|
const isSelected = selectedValue === optValue;
|
|
2748
2744
|
const isHighlighted = index === activeIndex;
|
|
2749
|
-
return /* @__PURE__ */ (0,
|
|
2745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2750
2746
|
"button",
|
|
2751
2747
|
{
|
|
2752
2748
|
ref,
|
|
@@ -2765,8 +2761,8 @@ var SearchApiItem = (0, import_react14.forwardRef)(
|
|
|
2765
2761
|
onMouseEnter: () => setActiveIndex(index),
|
|
2766
2762
|
...props,
|
|
2767
2763
|
children: [
|
|
2768
|
-
/* @__PURE__ */ (0,
|
|
2769
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate", children: option[labelKey] }),
|
|
2765
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Check, { className: "h-4 w-4", style: { color: primaryColor } })
|
|
2770
2766
|
]
|
|
2771
2767
|
},
|
|
2772
2768
|
optValue || index
|
|
@@ -2776,15 +2772,15 @@ var SearchApiItem = (0, import_react14.forwardRef)(
|
|
|
2776
2772
|
SearchApiItem.displayName = "SearchApiItem";
|
|
2777
2773
|
|
|
2778
2774
|
// src/components/Fields/date.tsx
|
|
2779
|
-
var
|
|
2780
|
-
var
|
|
2775
|
+
var import_react14 = require("react");
|
|
2776
|
+
var import_antd = require("antd");
|
|
2781
2777
|
var import_react_hook_form6 = require("react-hook-form");
|
|
2782
2778
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2783
2779
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
2784
2780
|
var import_lucide_react9 = require("lucide-react");
|
|
2785
|
-
var
|
|
2781
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2786
2782
|
import_dayjs.default.extend(import_customParseFormat.default);
|
|
2787
|
-
var DateInput = (0,
|
|
2783
|
+
var DateInput = (0, import_react14.forwardRef)(
|
|
2788
2784
|
({
|
|
2789
2785
|
label,
|
|
2790
2786
|
error,
|
|
@@ -2801,7 +2797,7 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2801
2797
|
}, ref) => {
|
|
2802
2798
|
const { theme } = useWarqadConfig();
|
|
2803
2799
|
const primaryColor = theme?.primaryColor;
|
|
2804
|
-
const [isFocused, setIsFocused] = (0,
|
|
2800
|
+
const [isFocused, setIsFocused] = (0, import_react14.useState)(false);
|
|
2805
2801
|
let message = error;
|
|
2806
2802
|
if (form && name) {
|
|
2807
2803
|
const {
|
|
@@ -2819,8 +2815,8 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2819
2815
|
${className}`;
|
|
2820
2816
|
const renderDatePicker = (val, changeHandler, blurHandler, refProps) => {
|
|
2821
2817
|
const dateValue = val && typeof val === "string" ? (0, import_dayjs.default)(val, "DD/MM/YYYY", true) : import_dayjs.default.isDayjs(val) ? val : null;
|
|
2822
|
-
return /* @__PURE__ */ (0,
|
|
2823
|
-
|
|
2818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2819
|
+
import_antd.DatePicker,
|
|
2824
2820
|
{
|
|
2825
2821
|
ref: refProps,
|
|
2826
2822
|
format: "DD/MM/YYYY",
|
|
@@ -2846,7 +2842,7 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2846
2842
|
boxShadow: isFocused && !message ? `${primaryColor}33 0px 0px 0px 2px` : void 0
|
|
2847
2843
|
},
|
|
2848
2844
|
classNames: { popup: { root: "z-50" } },
|
|
2849
|
-
suffixIcon: /* @__PURE__ */ (0,
|
|
2845
|
+
suffixIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2850
2846
|
import_lucide_react9.Calendar,
|
|
2851
2847
|
{
|
|
2852
2848
|
className: "h-5 w-5 text-gray-400",
|
|
@@ -2858,8 +2854,8 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2858
2854
|
}
|
|
2859
2855
|
);
|
|
2860
2856
|
};
|
|
2861
|
-
return /* @__PURE__ */ (0,
|
|
2862
|
-
label && /* @__PURE__ */ (0,
|
|
2857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: `space-y-2 group relative ${containerClassName}`, children: [
|
|
2858
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2863
2859
|
"label",
|
|
2864
2860
|
{
|
|
2865
2861
|
className: "block text-xs font-medium transition-colors duration-200",
|
|
@@ -2868,11 +2864,11 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2868
2864
|
},
|
|
2869
2865
|
children: [
|
|
2870
2866
|
label,
|
|
2871
|
-
props.required && /* @__PURE__ */ (0,
|
|
2867
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2872
2868
|
]
|
|
2873
2869
|
}
|
|
2874
2870
|
),
|
|
2875
|
-
form && name ? /* @__PURE__ */ (0,
|
|
2871
|
+
form && name ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2876
2872
|
import_react_hook_form6.Controller,
|
|
2877
2873
|
{
|
|
2878
2874
|
control: form.control,
|
|
@@ -2885,7 +2881,7 @@ var DateInput = (0, import_react15.forwardRef)(
|
|
|
2885
2881
|
)
|
|
2886
2882
|
}
|
|
2887
2883
|
) : renderDatePicker(value, onChange, onBlur, ref),
|
|
2888
|
-
message && /* @__PURE__ */ (0,
|
|
2884
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-red-600 dark:text-red-400", children: message })
|
|
2889
2885
|
] });
|
|
2890
2886
|
}
|
|
2891
2887
|
);
|
|
@@ -2909,10 +2905,10 @@ var Fields = {
|
|
|
2909
2905
|
var Fields_default = Fields;
|
|
2910
2906
|
|
|
2911
2907
|
// src/components/tables/DataTable.tsx
|
|
2912
|
-
var
|
|
2908
|
+
var import_react15 = __toESM(require("react"));
|
|
2913
2909
|
var import_react_table = require("@tanstack/react-table");
|
|
2914
2910
|
var import_lucide_react10 = require("lucide-react");
|
|
2915
|
-
var
|
|
2911
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2916
2912
|
function DataTable({
|
|
2917
2913
|
columns: userColumns,
|
|
2918
2914
|
data,
|
|
@@ -2934,9 +2930,9 @@ function DataTable({
|
|
|
2934
2930
|
}) {
|
|
2935
2931
|
const { theme } = useWarqadConfig();
|
|
2936
2932
|
const primaryColor = theme?.primaryColor;
|
|
2937
|
-
const [sorting, setSorting] = (0,
|
|
2938
|
-
const [columnFilters, setColumnFilters] = (0,
|
|
2939
|
-
const [columnVisibility, setColumnVisibility] = (0,
|
|
2933
|
+
const [sorting, setSorting] = (0, import_react15.useState)([]);
|
|
2934
|
+
const [columnFilters, setColumnFilters] = (0, import_react15.useState)([]);
|
|
2935
|
+
const [columnVisibility, setColumnVisibility] = (0, import_react15.useState)(
|
|
2940
2936
|
() => {
|
|
2941
2937
|
const initialVisibility = {};
|
|
2942
2938
|
userColumns.forEach((col) => {
|
|
@@ -2950,18 +2946,18 @@ function DataTable({
|
|
|
2950
2946
|
return initialVisibility;
|
|
2951
2947
|
}
|
|
2952
2948
|
);
|
|
2953
|
-
const [rowSelection, setRowSelection] = (0,
|
|
2954
|
-
const [globalFilter, setGlobalFilter] = (0,
|
|
2955
|
-
const [pagination, setPagination] = (0,
|
|
2949
|
+
const [rowSelection, setRowSelection] = (0, import_react15.useState)({});
|
|
2950
|
+
const [globalFilter, setGlobalFilter] = (0, import_react15.useState)("");
|
|
2951
|
+
const [pagination, setPagination] = (0, import_react15.useState)({
|
|
2956
2952
|
pageIndex: 0,
|
|
2957
2953
|
pageSize: pageRows || 10
|
|
2958
2954
|
});
|
|
2959
|
-
(0,
|
|
2955
|
+
(0, import_react15.useEffect)(() => {
|
|
2960
2956
|
if (pageRows) {
|
|
2961
2957
|
setPagination((prev) => ({ ...prev, pageSize: pageRows }));
|
|
2962
2958
|
}
|
|
2963
2959
|
}, [pageRows]);
|
|
2964
|
-
const [expanded, setExpanded] = (0,
|
|
2960
|
+
const [expanded, setExpanded] = (0, import_react15.useState)(() => {
|
|
2965
2961
|
const initialState = {};
|
|
2966
2962
|
if (defaultExpanded && renderSubComponent && data) {
|
|
2967
2963
|
data.forEach((row, idx) => {
|
|
@@ -2972,7 +2968,7 @@ function DataTable({
|
|
|
2972
2968
|
}
|
|
2973
2969
|
return initialState;
|
|
2974
2970
|
});
|
|
2975
|
-
const columns = (0,
|
|
2971
|
+
const columns = (0, import_react15.useMemo)(() => {
|
|
2976
2972
|
let mappedColumns = userColumns.map((col) => ({
|
|
2977
2973
|
...col,
|
|
2978
2974
|
accessorKey: col.key || col.accessorKey,
|
|
@@ -2988,7 +2984,7 @@ function DataTable({
|
|
|
2988
2984
|
{
|
|
2989
2985
|
id: "_index",
|
|
2990
2986
|
header: "#",
|
|
2991
|
-
cell: ({ row }) => /* @__PURE__ */ (0,
|
|
2987
|
+
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
2992
2988
|
enableSorting: false
|
|
2993
2989
|
},
|
|
2994
2990
|
...mappedColumns
|
|
@@ -3022,7 +3018,7 @@ function DataTable({
|
|
|
3022
3018
|
},
|
|
3023
3019
|
manualPagination: false
|
|
3024
3020
|
});
|
|
3025
|
-
(0,
|
|
3021
|
+
(0, import_react15.useEffect)(() => {
|
|
3026
3022
|
if (onChange) {
|
|
3027
3023
|
onChange({
|
|
3028
3024
|
pagination: {
|
|
@@ -3047,29 +3043,29 @@ function DataTable({
|
|
|
3047
3043
|
table.getState().pagination.pageIndex,
|
|
3048
3044
|
table.getState().pagination.pageSize
|
|
3049
3045
|
]);
|
|
3050
|
-
return /* @__PURE__ */ (0,
|
|
3051
|
-
filterables && /* @__PURE__ */ (0,
|
|
3052
|
-
/* @__PURE__ */ (0,
|
|
3046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `space-y-4 w-full ${className}`, children: [
|
|
3047
|
+
filterables && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
3048
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3053
3049
|
Fields_default.Input,
|
|
3054
3050
|
{
|
|
3055
3051
|
placeholder: searchPlaceholder,
|
|
3056
3052
|
value: globalFilter,
|
|
3057
3053
|
onChange: (e) => setGlobalFilter(e.target.value),
|
|
3058
|
-
icon: /* @__PURE__ */ (0,
|
|
3054
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Search, { size: 16 }),
|
|
3059
3055
|
className: "h-9!"
|
|
3060
3056
|
}
|
|
3061
3057
|
) }),
|
|
3062
|
-
/* @__PURE__ */ (0,
|
|
3063
|
-
/* @__PURE__ */ (0,
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative group", children: [
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("button", { className: "flex items-center gap-2 px-3 h-9 rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-900 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 transition-colors", children: [
|
|
3064
3060
|
"Columns",
|
|
3065
|
-
/* @__PURE__ */ (0,
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.ChevronDown, { size: 14, className: "text-gray-400" })
|
|
3066
3062
|
] }),
|
|
3067
|
-
/* @__PURE__ */ (0,
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute right-0 top-full mt-2 w-48 py-1 bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 rounded-lg shadow-xl opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all z-50", children: table.getAllColumns().filter((column) => column.getCanHide()).map((column) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3068
3064
|
"label",
|
|
3069
3065
|
{
|
|
3070
3066
|
className: "flex items-center gap-2 px-3 py-2 text-sm text-gray-700 dark:text-gray-200 hover:bg-gray-50 dark:hover:bg-zinc-800 cursor-pointer capitalize",
|
|
3071
3067
|
children: [
|
|
3072
|
-
/* @__PURE__ */ (0,
|
|
3068
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3073
3069
|
"input",
|
|
3074
3070
|
{
|
|
3075
3071
|
type: "checkbox",
|
|
@@ -3086,13 +3082,13 @@ function DataTable({
|
|
|
3086
3082
|
)) })
|
|
3087
3083
|
] }) })
|
|
3088
3084
|
] }),
|
|
3089
|
-
/* @__PURE__ */ (0,
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 overflow-hidden relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3090
3086
|
"table",
|
|
3091
3087
|
{
|
|
3092
3088
|
className: "w-full text-left border-collapse",
|
|
3093
3089
|
style: { accentColor: primaryColor },
|
|
3094
3090
|
children: [
|
|
3095
|
-
/* @__PURE__ */ (0,
|
|
3091
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("thead", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-b border-gray-200 dark:border-zinc-800", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3096
3092
|
"th",
|
|
3097
3093
|
{
|
|
3098
3094
|
className: `${rowPadding} text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${header.id === "_index" || header.id === "select" || header.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3103,22 +3099,22 @@ function DataTable({
|
|
|
3103
3099
|
},
|
|
3104
3100
|
header.id
|
|
3105
3101
|
)) }, headerGroup.id)) }),
|
|
3106
|
-
/* @__PURE__ */ (0,
|
|
3102
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tbody", { className: "", children: isLoading ? Array.from({ length: pageRows || 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3107
3103
|
"tr",
|
|
3108
3104
|
{
|
|
3109
3105
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3110
|
-
children: columns.map((_2, j) => /* @__PURE__ */ (0,
|
|
3106
|
+
children: columns.map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3111
3107
|
"td",
|
|
3112
3108
|
{
|
|
3113
3109
|
className: `${rowPadding} ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800/50" : ""}`,
|
|
3114
|
-
children: /* @__PURE__ */ (0,
|
|
3110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3115
3111
|
},
|
|
3116
3112
|
`skeleton-cell-${j}`
|
|
3117
3113
|
))
|
|
3118
3114
|
},
|
|
3119
3115
|
`skeleton-${i}`
|
|
3120
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0,
|
|
3121
|
-
/* @__PURE__ */ (0,
|
|
3116
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react15.default.Fragment, { children: [
|
|
3117
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3122
3118
|
"tr",
|
|
3123
3119
|
{
|
|
3124
3120
|
className: `border-b border-gray-200 dark:border-zinc-800 hover:bg-gray-50/50 dark:hover:bg-zinc-900/50 transition-colors last:border-b-0 ${renderSubComponent && hasSubComponent(row.original) ? "cursor-pointer" : ""}`,
|
|
@@ -3133,7 +3129,7 @@ function DataTable({
|
|
|
3133
3129
|
}
|
|
3134
3130
|
}
|
|
3135
3131
|
},
|
|
3136
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0,
|
|
3132
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3137
3133
|
"td",
|
|
3138
3134
|
{
|
|
3139
3135
|
className: `${rowPadding} text-sm text-gray-700 dark:text-gray-200 ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${cell.column.id === "_index" || cell.column.id === "select" || cell.column.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3146,14 +3142,14 @@ function DataTable({
|
|
|
3146
3142
|
))
|
|
3147
3143
|
}
|
|
3148
3144
|
),
|
|
3149
|
-
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3145
|
+
renderSubComponent && row.getIsExpanded() && hasSubComponent(row.original) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { className: "border-b border-gray-200 dark:border-zinc-800 bg-gray-50/20 dark:bg-zinc-900/20", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("td", { colSpan: columns.length, className: "px-2 py-0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute left-2 top-0 bottom-2 w-6 border-l-2 border-b-2 rounded-bl-xl border-(--theme-primary) dark:border-(--theme-primary) pointer-events-none" }),
|
|
3151
3147
|
renderSubComponent({
|
|
3152
3148
|
row: row.original,
|
|
3153
3149
|
index: row.index
|
|
3154
3150
|
})
|
|
3155
3151
|
] }) }) })
|
|
3156
|
-
] }, row.id)) : /* @__PURE__ */ (0,
|
|
3152
|
+
] }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3157
3153
|
"td",
|
|
3158
3154
|
{
|
|
3159
3155
|
colSpan: columns.length,
|
|
@@ -3165,7 +3161,7 @@ function DataTable({
|
|
|
3165
3161
|
(group) => group.headers.some(
|
|
3166
3162
|
(header) => header.column.columnDef.footer
|
|
3167
3163
|
)
|
|
3168
|
-
) && /* @__PURE__ */ (0,
|
|
3164
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-t border-gray-200 dark:border-zinc-800", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("tr", { children: footerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3169
3165
|
"td",
|
|
3170
3166
|
{
|
|
3171
3167
|
className: `${rowPadding} text-sm font-semibold text-gray-900 dark:text-zinc-100 text-left ${verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""} ${header.id === "_index" || header.id === "select" || header.id === "_select" ? "w-px whitespace-nowrap" : ""}`,
|
|
@@ -3179,24 +3175,24 @@ function DataTable({
|
|
|
3179
3175
|
]
|
|
3180
3176
|
}
|
|
3181
3177
|
) }) }),
|
|
3182
|
-
/* @__PURE__ */ (0,
|
|
3183
|
-
/* @__PURE__ */ (0,
|
|
3178
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between px-2", children: [
|
|
3179
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 text-xs text-gray-500", children: selectable && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
3184
3180
|
table.getFilteredSelectedRowModel().rows.length,
|
|
3185
3181
|
" of",
|
|
3186
3182
|
" ",
|
|
3187
3183
|
table.getFilteredRowModel().rows.length,
|
|
3188
3184
|
" row(s) selected."
|
|
3189
3185
|
] }) }),
|
|
3190
|
-
pageRows && table.getPageCount() > 1 && /* @__PURE__ */ (0,
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3186
|
+
pageRows && table.getPageCount() > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3187
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-sm text-gray-700 dark:text-gray-300 mr-2 select-none", children: [
|
|
3192
3188
|
"Page",
|
|
3193
3189
|
" ",
|
|
3194
|
-
/* @__PURE__ */ (0,
|
|
3190
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold", children: table.getState().pagination.pageIndex + 1 }),
|
|
3195
3191
|
" ",
|
|
3196
3192
|
"of ",
|
|
3197
|
-
/* @__PURE__ */ (0,
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "font-semibold", children: table.getPageCount() })
|
|
3198
3194
|
] }),
|
|
3199
|
-
/* @__PURE__ */ (0,
|
|
3195
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3200
3196
|
"button",
|
|
3201
3197
|
{
|
|
3202
3198
|
onClick: () => table.previousPage(),
|
|
@@ -3205,7 +3201,7 @@ function DataTable({
|
|
|
3205
3201
|
children: "Previous"
|
|
3206
3202
|
}
|
|
3207
3203
|
),
|
|
3208
|
-
/* @__PURE__ */ (0,
|
|
3204
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3209
3205
|
"button",
|
|
3210
3206
|
{
|
|
3211
3207
|
onClick: () => table.nextPage(),
|
|
@@ -3220,17 +3216,17 @@ function DataTable({
|
|
|
3220
3216
|
}
|
|
3221
3217
|
|
|
3222
3218
|
// src/components/tables/PostTable.tsx
|
|
3223
|
-
var
|
|
3219
|
+
var import_react16 = __toESM(require("react"));
|
|
3224
3220
|
var import_react_table2 = require("@tanstack/react-table");
|
|
3225
3221
|
var import_lucide_react11 = require("lucide-react");
|
|
3226
|
-
var
|
|
3227
|
-
var TableCell =
|
|
3222
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3223
|
+
var TableCell = import_react16.default.memo(
|
|
3228
3224
|
({
|
|
3229
3225
|
cell,
|
|
3230
3226
|
rowPadding,
|
|
3231
3227
|
verticalLines
|
|
3232
3228
|
}) => {
|
|
3233
|
-
return /* @__PURE__ */ (0,
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3234
3230
|
"td",
|
|
3235
3231
|
{
|
|
3236
3232
|
className: cn(
|
|
@@ -3254,7 +3250,7 @@ var TableCell = import_react17.default.memo(
|
|
|
3254
3250
|
return prev.cell.getValue() === next.cell.getValue() && prev.cell.row.original === next.cell.row.original && prev.cell.row.getIsExpanded() === next.cell.row.getIsExpanded() && prev.cell.row.getIsSelected() === next.cell.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines;
|
|
3255
3251
|
}
|
|
3256
3252
|
);
|
|
3257
|
-
var TableRow =
|
|
3253
|
+
var TableRow = import_react16.default.memo(
|
|
3258
3254
|
({
|
|
3259
3255
|
row,
|
|
3260
3256
|
rowPadding,
|
|
@@ -3265,8 +3261,8 @@ var TableRow = import_react17.default.memo(
|
|
|
3265
3261
|
}) => {
|
|
3266
3262
|
const isExpanded = row.getIsExpanded();
|
|
3267
3263
|
const subComponentVisible = renderSubComponent && isExpanded && hasSubComponent(row.original);
|
|
3268
|
-
return /* @__PURE__ */ (0,
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
3264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react16.default.Fragment, { children: [
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3270
3266
|
"tr",
|
|
3271
3267
|
{
|
|
3272
3268
|
className: `border-b border-gray-200 dark:border-zinc-800 hover:bg-gray-50/50 dark:hover:bg-zinc-900/50 transition-colors last:border-b-0 ${renderSubComponent && hasSubComponent(row.original) ? "cursor-pointer" : ""}`,
|
|
@@ -3279,7 +3275,7 @@ var TableRow = import_react17.default.memo(
|
|
|
3279
3275
|
}
|
|
3280
3276
|
}
|
|
3281
3277
|
},
|
|
3282
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0,
|
|
3278
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3283
3279
|
TableCell,
|
|
3284
3280
|
{
|
|
3285
3281
|
cell,
|
|
@@ -3290,8 +3286,8 @@ var TableRow = import_react17.default.memo(
|
|
|
3290
3286
|
))
|
|
3291
3287
|
}
|
|
3292
3288
|
),
|
|
3293
|
-
subComponentVisible && /* @__PURE__ */ (0,
|
|
3294
|
-
/* @__PURE__ */ (0,
|
|
3289
|
+
subComponentVisible && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { className: "border-b border-gray-200 dark:border-zinc-800 bg-gray-50/20 dark:bg-zinc-900/20", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("td", { colSpan: columnsCount, className: "px-2 py-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative pl-6 pb-2 pr-2 pt-2 h-full", children: [
|
|
3290
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute left-2 top-0 bottom-2 w-6 border-l-2 border-b-2 rounded-bl-xl border-(--theme-primary) dark:border-(--theme-primary) pointer-events-none" }),
|
|
3295
3291
|
renderSubComponent({
|
|
3296
3292
|
row: row.original,
|
|
3297
3293
|
index: row.index
|
|
@@ -3324,10 +3320,10 @@ function PostTable({
|
|
|
3324
3320
|
}) {
|
|
3325
3321
|
const { theme } = useWarqadConfig();
|
|
3326
3322
|
const primaryColor = theme?.primaryColor;
|
|
3327
|
-
const [sorting, setSorting] = (0,
|
|
3328
|
-
const [columnFilters, setColumnFilters] = (0,
|
|
3329
|
-
const [columnVisibility, setColumnVisibility] = (0,
|
|
3330
|
-
const [expanded, setExpanded] = (0,
|
|
3323
|
+
const [sorting, setSorting] = (0, import_react16.useState)([]);
|
|
3324
|
+
const [columnFilters, setColumnFilters] = (0, import_react16.useState)([]);
|
|
3325
|
+
const [columnVisibility, setColumnVisibility] = (0, import_react16.useState)({});
|
|
3326
|
+
const [expanded, setExpanded] = (0, import_react16.useState)(() => {
|
|
3331
3327
|
const initialState = {};
|
|
3332
3328
|
if (defaultExpanded && renderSubComponent && controlledData) {
|
|
3333
3329
|
controlledData.forEach((row, idx) => {
|
|
@@ -3338,10 +3334,10 @@ function PostTable({
|
|
|
3338
3334
|
}
|
|
3339
3335
|
return initialState;
|
|
3340
3336
|
});
|
|
3341
|
-
const [internalData, setInternalData] = (0,
|
|
3337
|
+
const [internalData, setInternalData] = (0, import_react16.useState)(controlledData || []);
|
|
3342
3338
|
const isControlled = controlledData !== void 0;
|
|
3343
3339
|
const data = isControlled ? controlledData : internalData;
|
|
3344
|
-
const entryRowRef = (0,
|
|
3340
|
+
const entryRowRef = (0, import_react16.useRef)(null);
|
|
3345
3341
|
const focusAndScrollEntryRow = () => {
|
|
3346
3342
|
setTimeout(() => {
|
|
3347
3343
|
if (entryRowRef.current) {
|
|
@@ -3358,14 +3354,14 @@ function PostTable({
|
|
|
3358
3354
|
}
|
|
3359
3355
|
}, 50);
|
|
3360
3356
|
};
|
|
3361
|
-
(0,
|
|
3357
|
+
(0, import_react16.useEffect)(() => {
|
|
3362
3358
|
focusAndScrollEntryRow();
|
|
3363
3359
|
}, []);
|
|
3364
|
-
const [entryData, setEntryData] = (0,
|
|
3365
|
-
const [editingIndex, setEditingIndex] = (0,
|
|
3366
|
-
const [isSavingAsync, setIsSavingAsync] = (0,
|
|
3367
|
-
const [fieldErrors, setFieldErrors] = (0,
|
|
3368
|
-
const latestStateRef = (0,
|
|
3360
|
+
const [entryData, setEntryData] = (0, import_react16.useState)({});
|
|
3361
|
+
const [editingIndex, setEditingIndex] = (0, import_react16.useState)(null);
|
|
3362
|
+
const [isSavingAsync, setIsSavingAsync] = (0, import_react16.useState)(false);
|
|
3363
|
+
const [fieldErrors, setFieldErrors] = (0, import_react16.useState)({});
|
|
3364
|
+
const latestStateRef = (0, import_react16.useRef)({
|
|
3369
3365
|
data,
|
|
3370
3366
|
entryData,
|
|
3371
3367
|
editingIndex,
|
|
@@ -3377,7 +3373,7 @@ function PostTable({
|
|
|
3377
3373
|
onEdit,
|
|
3378
3374
|
onDelete
|
|
3379
3375
|
});
|
|
3380
|
-
(0,
|
|
3376
|
+
(0, import_react16.useEffect)(() => {
|
|
3381
3377
|
latestStateRef.current = {
|
|
3382
3378
|
data,
|
|
3383
3379
|
entryData,
|
|
@@ -3391,7 +3387,7 @@ function PostTable({
|
|
|
3391
3387
|
onDelete
|
|
3392
3388
|
};
|
|
3393
3389
|
});
|
|
3394
|
-
const handleSaveField = (0,
|
|
3390
|
+
const handleSaveField = (0, import_react16.useCallback)(async () => {
|
|
3395
3391
|
const { data: data2, entryData: entryData2, editingIndex: editingIndex2, onChange: onChange2 } = latestStateRef.current;
|
|
3396
3392
|
if (Object.keys(entryData2).length === 0) return;
|
|
3397
3393
|
const actionType = editingIndex2 !== null ? "edit" : "add";
|
|
@@ -3457,20 +3453,20 @@ function PostTable({
|
|
|
3457
3453
|
setTimeout(() => focusAndScrollEntryRow(), 0);
|
|
3458
3454
|
}
|
|
3459
3455
|
}, []);
|
|
3460
|
-
const handleCancelEdit = (0,
|
|
3456
|
+
const handleCancelEdit = (0, import_react16.useCallback)(() => {
|
|
3461
3457
|
const { onCancel: onCancel2 } = latestStateRef.current;
|
|
3462
3458
|
setEditingIndex(null);
|
|
3463
3459
|
setEntryData({});
|
|
3464
3460
|
setFieldErrors({});
|
|
3465
3461
|
if (onCancel2) onCancel2();
|
|
3466
3462
|
}, []);
|
|
3467
|
-
const handleEdit = (0,
|
|
3463
|
+
const handleEdit = (0, import_react16.useCallback)((index2, rowOriginal) => {
|
|
3468
3464
|
const { onEdit: onEdit2 } = latestStateRef.current;
|
|
3469
3465
|
setEditingIndex(index2);
|
|
3470
3466
|
setEntryData({ ...rowOriginal });
|
|
3471
3467
|
if (onEdit2) onEdit2(rowOriginal);
|
|
3472
3468
|
}, []);
|
|
3473
|
-
const handleDelete = (0,
|
|
3469
|
+
const handleDelete = (0, import_react16.useCallback)(
|
|
3474
3470
|
async (index2) => {
|
|
3475
3471
|
const { data: data2, editingIndex: editingIndex2, onChange: onChange2, onDelete: onDelete2 } = latestStateRef.current;
|
|
3476
3472
|
const rowToDelete = data2[index2];
|
|
@@ -3525,31 +3521,31 @@ function PostTable({
|
|
|
3525
3521
|
},
|
|
3526
3522
|
[handleCancelEdit]
|
|
3527
3523
|
);
|
|
3528
|
-
const actionColumn = (0,
|
|
3524
|
+
const actionColumn = (0, import_react16.useMemo)(
|
|
3529
3525
|
() => ({
|
|
3530
3526
|
id: "actions",
|
|
3531
3527
|
header: "Actions",
|
|
3532
3528
|
cell: ({ row, table: table2 }) => {
|
|
3533
3529
|
const { handleEdit: handleEdit2, handleDelete: handleDelete2, submitLoading: submitLoading2, isSavingAsync: isSavingAsync2 } = table2.options.meta;
|
|
3534
|
-
return /* @__PURE__ */ (0,
|
|
3535
|
-
/* @__PURE__ */ (0,
|
|
3530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3536
3532
|
"button",
|
|
3537
3533
|
{
|
|
3538
3534
|
onClick: () => handleEdit2(row.index, row.original),
|
|
3539
3535
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3540
3536
|
className: "p-1 px-2 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-800 text-gray-500 hover:text-(--theme-primary) dark:hover:text-(--theme-primary) transition-colors disabled:opacity-50",
|
|
3541
3537
|
title: "Edit",
|
|
3542
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ (0,
|
|
3538
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Loader2, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Edit2, { size: 16 })
|
|
3543
3539
|
}
|
|
3544
3540
|
),
|
|
3545
|
-
/* @__PURE__ */ (0,
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3546
3542
|
"button",
|
|
3547
3543
|
{
|
|
3548
3544
|
onClick: () => handleDelete2(row.index),
|
|
3549
3545
|
disabled: submitLoading2 || isSavingAsync2,
|
|
3550
3546
|
className: "p-1 px-2 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-800 text-gray-500 hover:text-red-600 dark:hover:text-red-400 transition-colors disabled:opacity-50",
|
|
3551
3547
|
title: "Delete",
|
|
3552
|
-
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ (0,
|
|
3548
|
+
children: submitLoading2 || isSavingAsync2 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Loader2, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Trash2, { size: 16 })
|
|
3553
3549
|
}
|
|
3554
3550
|
)
|
|
3555
3551
|
] });
|
|
@@ -3557,7 +3553,7 @@ function PostTable({
|
|
|
3557
3553
|
}),
|
|
3558
3554
|
[]
|
|
3559
3555
|
);
|
|
3560
|
-
const columns = (0,
|
|
3556
|
+
const columns = (0, import_react16.useMemo)(() => {
|
|
3561
3557
|
const mappedUserColumns = userColumns.map((col) => ({
|
|
3562
3558
|
...col,
|
|
3563
3559
|
accessorKey: col.key || col.accessorKey,
|
|
@@ -3571,9 +3567,9 @@ function PostTable({
|
|
|
3571
3567
|
size: 40,
|
|
3572
3568
|
minSize: 40,
|
|
3573
3569
|
maxSize: 40,
|
|
3574
|
-
cell: ({ row }) => /* @__PURE__ */ (0,
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3576
|
-
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ (0,
|
|
3570
|
+
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-gray-500 font-medium ml-1", children: row.index + 1 }),
|
|
3572
|
+
renderSubComponent && hasSubComponent(row.original) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3577
3573
|
import_lucide_react11.ChevronDown,
|
|
3578
3574
|
{
|
|
3579
3575
|
size: 16,
|
|
@@ -3583,7 +3579,7 @@ function PostTable({
|
|
|
3583
3579
|
] }),
|
|
3584
3580
|
enableSorting: false,
|
|
3585
3581
|
meta: {
|
|
3586
|
-
field: () => /* @__PURE__ */ (0,
|
|
3582
|
+
field: () => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-gray-400 font-medium px-2 block select-none", children: "#" })
|
|
3587
3583
|
}
|
|
3588
3584
|
});
|
|
3589
3585
|
}
|
|
@@ -3613,13 +3609,13 @@ function PostTable({
|
|
|
3613
3609
|
isSavingAsync
|
|
3614
3610
|
}
|
|
3615
3611
|
});
|
|
3616
|
-
return /* @__PURE__ */ (0,
|
|
3612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3617
3613
|
"div",
|
|
3618
3614
|
{
|
|
3619
3615
|
className: `space-y-4 w-full ${className}`,
|
|
3620
3616
|
style: { "--theme-primary": primaryColor || "#3b82f6" },
|
|
3621
|
-
children: /* @__PURE__ */ (0,
|
|
3622
|
-
/* @__PURE__ */ (0,
|
|
3617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rounded-lg border border-gray-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 relative", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("table", { className: "w-full text-left border-collapse", children: [
|
|
3618
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("thead", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-b border-gray-200 dark:border-zinc-800", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3623
3619
|
"th",
|
|
3624
3620
|
{
|
|
3625
3621
|
className: cn(
|
|
@@ -3641,12 +3637,12 @@ function PostTable({
|
|
|
3641
3637
|
},
|
|
3642
3638
|
header.id
|
|
3643
3639
|
)) }, headerGroup.id)) }),
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3645
|
-
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0,
|
|
3640
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("tbody", { className: "", children: [
|
|
3641
|
+
isLoading ? Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3646
3642
|
"tr",
|
|
3647
3643
|
{
|
|
3648
3644
|
className: "border-b border-gray-100 dark:border-zinc-800/50",
|
|
3649
|
-
children: columns.map((col, j) => /* @__PURE__ */ (0,
|
|
3645
|
+
children: columns.map((col, j) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3650
3646
|
"td",
|
|
3651
3647
|
{
|
|
3652
3648
|
className: cn(
|
|
@@ -3659,13 +3655,13 @@ function PostTable({
|
|
|
3659
3655
|
minWidth: col.meta?.width ?? col.minSize,
|
|
3660
3656
|
maxWidth: col.meta?.width ?? col.maxSize
|
|
3661
3657
|
},
|
|
3662
|
-
children: /* @__PURE__ */ (0,
|
|
3658
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "h-4 bg-gray-100 dark:bg-zinc-800 rounded animate-pulse w-full" })
|
|
3663
3659
|
},
|
|
3664
3660
|
`skeleton-cell-${j}`
|
|
3665
3661
|
))
|
|
3666
3662
|
},
|
|
3667
3663
|
`skeleton-${i}`
|
|
3668
|
-
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0,
|
|
3664
|
+
)) : table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3669
3665
|
TableRow,
|
|
3670
3666
|
{
|
|
3671
3667
|
row,
|
|
@@ -3676,7 +3672,7 @@ function PostTable({
|
|
|
3676
3672
|
columnsCount: columns.length
|
|
3677
3673
|
},
|
|
3678
3674
|
row.id
|
|
3679
|
-
)) : /* @__PURE__ */ (0,
|
|
3675
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3680
3676
|
"td",
|
|
3681
3677
|
{
|
|
3682
3678
|
colSpan: columns.length,
|
|
@@ -3684,7 +3680,7 @@ function PostTable({
|
|
|
3684
3680
|
children: "No results found."
|
|
3685
3681
|
}
|
|
3686
3682
|
) }),
|
|
3687
|
-
/* @__PURE__ */ (0,
|
|
3683
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3688
3684
|
"tr",
|
|
3689
3685
|
{
|
|
3690
3686
|
ref: entryRowRef,
|
|
@@ -3699,7 +3695,7 @@ function PostTable({
|
|
|
3699
3695
|
return visibleColumns.map((column) => {
|
|
3700
3696
|
const currentId = column.id || column.columnDef.accessorKey;
|
|
3701
3697
|
if (column.id === "actions") {
|
|
3702
|
-
return /* @__PURE__ */ (0,
|
|
3698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3703
3699
|
"td",
|
|
3704
3700
|
{
|
|
3705
3701
|
className: cn(
|
|
@@ -3707,38 +3703,38 @@ function PostTable({
|
|
|
3707
3703
|
"py-1! text-sm align-middle transition-colors duration-200",
|
|
3708
3704
|
verticalLines ? "border-x border-gray-200 dark:border-zinc-800" : ""
|
|
3709
3705
|
),
|
|
3710
|
-
children: /* @__PURE__ */ (0,
|
|
3711
|
-
/* @__PURE__ */ (0,
|
|
3706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center gap-2", children: editingIndex !== null ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3712
3708
|
"button",
|
|
3713
3709
|
{
|
|
3714
3710
|
onClick: handleSaveField,
|
|
3715
3711
|
disabled: isSavingAsync || submitLoading,
|
|
3716
3712
|
className: "flex-1 h-8 flex items-center justify-center rounded-lg bg-green-500/10 text-green-600 dark:bg-emerald-500/20 dark:text-emerald-400 hover:bg-green-500 hover:text-white dark:hover:bg-emerald-500 transition-colors shadow-sm active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3717
3713
|
title: "Update",
|
|
3718
|
-
children: isSavingAsync || submitLoading ? /* @__PURE__ */ (0,
|
|
3714
|
+
children: isSavingAsync || submitLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3719
3715
|
import_lucide_react11.Loader2,
|
|
3720
3716
|
{
|
|
3721
3717
|
size: 16,
|
|
3722
3718
|
className: "animate-spin"
|
|
3723
3719
|
}
|
|
3724
|
-
) : /* @__PURE__ */ (0,
|
|
3720
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Check, { size: 16, strokeWidth: 2.5 })
|
|
3725
3721
|
}
|
|
3726
3722
|
),
|
|
3727
|
-
/* @__PURE__ */ (0,
|
|
3723
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3728
3724
|
"button",
|
|
3729
3725
|
{
|
|
3730
3726
|
onClick: handleCancelEdit,
|
|
3731
3727
|
disabled: isSavingAsync || submitLoading,
|
|
3732
3728
|
className: "flex-1 h-8 flex items-center justify-center rounded-lg bg-red-500/10 text-red-600 dark:bg-red-500/20 dark:text-red-400 hover:bg-red-500 hover:text-white dark:hover:bg-red-500 transition-colors shadow-sm active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed",
|
|
3733
3729
|
title: "Cancel",
|
|
3734
|
-
children: /* @__PURE__ */ (0,
|
|
3730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.X, { size: 16, strokeWidth: 2.5 })
|
|
3735
3731
|
}
|
|
3736
3732
|
)
|
|
3737
|
-
] }) : /* @__PURE__ */ (0,
|
|
3733
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: renderAddButton ? renderAddButton(
|
|
3738
3734
|
entryData,
|
|
3739
3735
|
handleSaveField,
|
|
3740
3736
|
isSavingAsync
|
|
3741
|
-
) : /* @__PURE__ */ (0,
|
|
3737
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3742
3738
|
"button",
|
|
3743
3739
|
{
|
|
3744
3740
|
onClick: handleSaveField,
|
|
@@ -3749,14 +3745,14 @@ function PostTable({
|
|
|
3749
3745
|
},
|
|
3750
3746
|
title: "Add Row",
|
|
3751
3747
|
children: [
|
|
3752
|
-
isSavingAsync || submitLoading ? /* @__PURE__ */ (0,
|
|
3748
|
+
isSavingAsync || submitLoading ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3753
3749
|
import_lucide_react11.Loader2,
|
|
3754
3750
|
{
|
|
3755
3751
|
size: 14,
|
|
3756
3752
|
className: "animate-spin"
|
|
3757
3753
|
}
|
|
3758
|
-
) : /* @__PURE__ */ (0,
|
|
3759
|
-
/* @__PURE__ */ (0,
|
|
3754
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Plus, { size: 14, strokeWidth: 2.5 }),
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: isSavingAsync || submitLoading ? "Adding..." : "Add" })
|
|
3760
3756
|
]
|
|
3761
3757
|
}
|
|
3762
3758
|
) }) })
|
|
@@ -3782,7 +3778,7 @@ function PostTable({
|
|
|
3782
3778
|
});
|
|
3783
3779
|
}
|
|
3784
3780
|
};
|
|
3785
|
-
return /* @__PURE__ */ (0,
|
|
3781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3786
3782
|
"td",
|
|
3787
3783
|
{
|
|
3788
3784
|
"data-column-id": column.id,
|
|
@@ -3808,7 +3804,7 @@ function PostTable({
|
|
|
3808
3804
|
minWidth: column.columnDef.meta?.width ?? column.columnDef.minSize,
|
|
3809
3805
|
maxWidth: column.columnDef.meta?.width ?? column.columnDef.maxSize
|
|
3810
3806
|
},
|
|
3811
|
-
children: /* @__PURE__ */ (0,
|
|
3807
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3812
3808
|
"div",
|
|
3813
3809
|
{
|
|
3814
3810
|
className: cn(
|
|
@@ -3839,7 +3835,7 @@ function PostTable({
|
|
|
3839
3835
|
onChange: onChangeValue,
|
|
3840
3836
|
rowData: entryData,
|
|
3841
3837
|
setRowData: setEntryData
|
|
3842
|
-
}) : /* @__PURE__ */ (0,
|
|
3838
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3843
3839
|
Fields_default.Input,
|
|
3844
3840
|
{
|
|
3845
3841
|
id: `pti-${accessor}`,
|
|
@@ -3851,7 +3847,7 @@ function PostTable({
|
|
|
3851
3847
|
placeholder: `${typeof column.columnDef.header === "string" ? column.columnDef.header : column.id}`
|
|
3852
3848
|
}
|
|
3853
3849
|
),
|
|
3854
|
-
typeof error === "string" && /* @__PURE__ */ (0,
|
|
3850
|
+
typeof error === "string" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute left-1/2 -translate-x-1/2 bottom-full mb-2 z-9999 pointer-events-none opacity-0 group-hover:opacity-100 focus-within:opacity-100 group-focus-within:opacity-100 transition-opacity whitespace-nowrap bg-red-500 text-white text-xs px-2.5 py-1.5 rounded shadow-lg before:content-[''] before:absolute before:top-full before:left-1/2 before:-translate-x-1/2 before:border-4 before:border-transparent before:border-t-red-500", children: error })
|
|
3855
3851
|
]
|
|
3856
3852
|
}
|
|
3857
3853
|
)
|
|
@@ -3867,7 +3863,7 @@ function PostTable({
|
|
|
3867
3863
|
(group) => group.headers.some(
|
|
3868
3864
|
(header) => header.column.columnDef.footer
|
|
3869
3865
|
)
|
|
3870
|
-
) && /* @__PURE__ */ (0,
|
|
3866
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tfoot", { className: "bg-gray-50/50 dark:bg-zinc-900/50 border-t border-gray-200 dark:border-zinc-800", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tr", { children: footerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3871
3867
|
"td",
|
|
3872
3868
|
{
|
|
3873
3869
|
className: cn(
|
|
@@ -3895,9 +3891,9 @@ function PostTable({
|
|
|
3895
3891
|
}
|
|
3896
3892
|
|
|
3897
3893
|
// src/components/tables/SimpleTable.tsx
|
|
3898
|
-
var
|
|
3894
|
+
var import_react17 = require("react");
|
|
3899
3895
|
var import_react_table3 = require("@tanstack/react-table");
|
|
3900
|
-
var
|
|
3896
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3901
3897
|
function SimpleTable({
|
|
3902
3898
|
columns: userColumns,
|
|
3903
3899
|
data,
|
|
@@ -3913,7 +3909,7 @@ function SimpleTable({
|
|
|
3913
3909
|
emptyState,
|
|
3914
3910
|
skeletonCount = 5
|
|
3915
3911
|
}) {
|
|
3916
|
-
const columns = (0,
|
|
3912
|
+
const columns = (0, import_react17.useMemo)(() => {
|
|
3917
3913
|
const cols = userColumns.filter((col) => !col.hide).map((col) => ({
|
|
3918
3914
|
...col,
|
|
3919
3915
|
accessorKey: col.key || col.accessorKey,
|
|
@@ -3929,7 +3925,7 @@ function SimpleTable({
|
|
|
3929
3925
|
id: "index",
|
|
3930
3926
|
width: 75,
|
|
3931
3927
|
className: "whitespace-nowrap px-2 text-center",
|
|
3932
|
-
cell: (info) => /* @__PURE__ */ (0,
|
|
3928
|
+
cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
|
|
3933
3929
|
});
|
|
3934
3930
|
}
|
|
3935
3931
|
return cols;
|
|
@@ -3939,24 +3935,24 @@ function SimpleTable({
|
|
|
3939
3935
|
columns,
|
|
3940
3936
|
getCoreRowModel: (0, import_react_table3.getCoreRowModel)()
|
|
3941
3937
|
});
|
|
3942
|
-
const hasFooters = (0,
|
|
3938
|
+
const hasFooters = (0, import_react17.useMemo)(() => {
|
|
3943
3939
|
return table.getFooterGroups().some(
|
|
3944
3940
|
(group) => group.headers.some(
|
|
3945
3941
|
(header) => !header.isPlaceholder && header.column.columnDef.footer
|
|
3946
3942
|
)
|
|
3947
3943
|
);
|
|
3948
3944
|
}, [table]);
|
|
3949
|
-
return /* @__PURE__ */ (0,
|
|
3950
|
-
/* @__PURE__ */ (0,
|
|
3945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `w-full overflow-hidden ${className}`, children: [
|
|
3946
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3951
3947
|
"table",
|
|
3952
3948
|
{
|
|
3953
3949
|
className: `w-full max-w-full text-left border-collapse table-fixed ${verticalLines ? "border border-black dark:border-white" : ""}`,
|
|
3954
3950
|
children: [
|
|
3955
|
-
/* @__PURE__ */ (0,
|
|
3951
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("thead", { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3956
3952
|
"tr",
|
|
3957
3953
|
{
|
|
3958
3954
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-200 dark:border-zinc-800"}`,
|
|
3959
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0,
|
|
3955
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3960
3956
|
"th",
|
|
3961
3957
|
{
|
|
3962
3958
|
className: `${rowPadding} font-semibold text-gray-900 dark:text-zinc-100 text-sm align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -3975,15 +3971,15 @@ function SimpleTable({
|
|
|
3975
3971
|
},
|
|
3976
3972
|
headerGroup.id
|
|
3977
3973
|
)) }),
|
|
3978
|
-
/* @__PURE__ */ (0,
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading && data.length === 0 ? Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3979
3975
|
"tr",
|
|
3980
3976
|
{
|
|
3981
3977
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
|
|
3982
|
-
children: columns.map((col, colIdx) => /* @__PURE__ */ (0,
|
|
3978
|
+
children: columns.map((col, colIdx) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3983
3979
|
"td",
|
|
3984
3980
|
{
|
|
3985
3981
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
|
|
3986
|
-
children: /* @__PURE__ */ (0,
|
|
3982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3987
3983
|
"div",
|
|
3988
3984
|
{
|
|
3989
3985
|
className: `h-4 bg-gray-200 dark:bg-zinc-800/50 rounded-sm animate-pulse ${colIdx % 2 === 0 ? "w-3/4" : "w-1/2"} ${colIdx === 0 ? "w-4" : ""}`
|
|
@@ -3994,18 +3990,18 @@ function SimpleTable({
|
|
|
3994
3990
|
))
|
|
3995
3991
|
},
|
|
3996
3992
|
`skeleton-row-${i}`
|
|
3997
|
-
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ (0,
|
|
3993
|
+
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3998
3994
|
"td",
|
|
3999
3995
|
{
|
|
4000
3996
|
colSpan: columns.length,
|
|
4001
3997
|
className: "text-center text-gray-500 font-medium",
|
|
4002
|
-
children: emptyState || /* @__PURE__ */ (0,
|
|
3998
|
+
children: emptyState || /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "py-8", children: "No transactions found." })
|
|
4003
3999
|
}
|
|
4004
|
-
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ (0,
|
|
4000
|
+
) }) : table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4005
4001
|
"tr",
|
|
4006
4002
|
{
|
|
4007
4003
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"} hover:bg-gray-50/50 dark:hover:bg-zinc-900/30 transition-colors`,
|
|
4008
|
-
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0,
|
|
4004
|
+
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4009
4005
|
"td",
|
|
4010
4006
|
{
|
|
4011
4007
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""} ${cell.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -4016,11 +4012,11 @@ function SimpleTable({
|
|
|
4016
4012
|
},
|
|
4017
4013
|
row.id
|
|
4018
4014
|
)) }),
|
|
4019
|
-
hasFooters && !isLoading && /* @__PURE__ */ (0,
|
|
4015
|
+
hasFooters && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tfoot", { className: "text-black dark:text-white font-bold font-sans tabular-nums", children: table.getFooterGroups().map((footerGroup) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4020
4016
|
"tr",
|
|
4021
4017
|
{
|
|
4022
4018
|
className: `${verticalLines ? "border-t border-black dark:border-white" : "bg-gray-50/30 dark:bg-zinc-900/10"}`,
|
|
4023
|
-
children: footerGroup.headers.map((header) => /* @__PURE__ */ (0,
|
|
4019
|
+
children: footerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4024
4020
|
"td",
|
|
4025
4021
|
{
|
|
4026
4022
|
className: `text-sm ${rowPadding} ${verticalLines ? "border-x border-black dark:border-white" : ""} ${header.column.columnDef.className || "wrap-break-word"}`,
|
|
@@ -4037,14 +4033,14 @@ function SimpleTable({
|
|
|
4037
4033
|
]
|
|
4038
4034
|
}
|
|
4039
4035
|
),
|
|
4040
|
-
componentFooter && /* @__PURE__ */ (0,
|
|
4036
|
+
componentFooter && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-2 pt-3 border-t border-gray-200 dark:border-zinc-800", children: componentFooter() })
|
|
4041
4037
|
] });
|
|
4042
4038
|
}
|
|
4043
4039
|
|
|
4044
4040
|
// src/components/Badge.tsx
|
|
4045
|
-
var
|
|
4046
|
-
var
|
|
4047
|
-
var Badge =
|
|
4041
|
+
var import_react18 = __toESM(require("react"));
|
|
4042
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4043
|
+
var Badge = import_react18.default.forwardRef(
|
|
4048
4044
|
({
|
|
4049
4045
|
children,
|
|
4050
4046
|
className,
|
|
@@ -4065,7 +4061,7 @@ var Badge = import_react19.default.forwardRef(
|
|
|
4065
4061
|
md: "px-2.5 py-1 text-xs leading-tight font-semibold",
|
|
4066
4062
|
lg: "px-3 py-1.5 text-sm leading-tight font-semibold"
|
|
4067
4063
|
};
|
|
4068
|
-
return /* @__PURE__ */ (0,
|
|
4064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4069
4065
|
"span",
|
|
4070
4066
|
{
|
|
4071
4067
|
ref,
|
|
@@ -4079,13 +4075,13 @@ var Badge = import_react19.default.forwardRef(
|
|
|
4079
4075
|
Badge.displayName = "Badge";
|
|
4080
4076
|
|
|
4081
4077
|
// src/components/Branding.tsx
|
|
4082
|
-
var
|
|
4078
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4083
4079
|
var Branding = ({
|
|
4084
4080
|
text,
|
|
4085
4081
|
disabled = false,
|
|
4086
4082
|
className
|
|
4087
4083
|
}) => {
|
|
4088
|
-
return /* @__PURE__ */ (0,
|
|
4084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4089
4085
|
"p",
|
|
4090
4086
|
{
|
|
4091
4087
|
className: cn(
|
|
@@ -4099,10 +4095,10 @@ var Branding = ({
|
|
|
4099
4095
|
};
|
|
4100
4096
|
|
|
4101
4097
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4102
|
-
var
|
|
4098
|
+
var import_react19 = require("react");
|
|
4103
4099
|
var import_react_to_print = require("react-to-print");
|
|
4104
4100
|
var import_lucide_react12 = require("lucide-react");
|
|
4105
|
-
var
|
|
4101
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4106
4102
|
var useA4StatementView = ({
|
|
4107
4103
|
url,
|
|
4108
4104
|
v = 1,
|
|
@@ -4111,7 +4107,7 @@ var useA4StatementView = ({
|
|
|
4111
4107
|
startPage = 1
|
|
4112
4108
|
} = {}) => {
|
|
4113
4109
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4114
|
-
const contentRef = (0,
|
|
4110
|
+
const contentRef = (0, import_react19.useRef)(null);
|
|
4115
4111
|
const reactToPrintFn = (0, import_react_to_print.useReactToPrint)({
|
|
4116
4112
|
contentRef
|
|
4117
4113
|
});
|
|
@@ -4121,7 +4117,7 @@ var useA4StatementView = ({
|
|
|
4121
4117
|
await get({ url, v, params, delay });
|
|
4122
4118
|
}
|
|
4123
4119
|
};
|
|
4124
|
-
(0,
|
|
4120
|
+
(0, import_react19.useEffect)(() => {
|
|
4125
4121
|
getData();
|
|
4126
4122
|
}, [url, v, JSON.stringify(params), delay]);
|
|
4127
4123
|
const A4DataViewComponent = ({
|
|
@@ -4152,12 +4148,12 @@ var useA4StatementView = ({
|
|
|
4152
4148
|
}) => {
|
|
4153
4149
|
const { store } = useWarqadConfig();
|
|
4154
4150
|
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4155
|
-
const measureContainerRef = (0,
|
|
4156
|
-
const [pages, setPages] = (0,
|
|
4157
|
-
const [isMeasuring, setIsMeasuring] = (0,
|
|
4158
|
-
const [globalFilter, setGlobalFilter] = (0,
|
|
4159
|
-
const [currentPageIndex, setCurrentPageIndex] = (0,
|
|
4160
|
-
const [pageSearch, setPageSearch] = (0,
|
|
4151
|
+
const measureContainerRef = (0, import_react19.useRef)(null);
|
|
4152
|
+
const [pages, setPages] = (0, import_react19.useState)([]);
|
|
4153
|
+
const [isMeasuring, setIsMeasuring] = (0, import_react19.useState)(true);
|
|
4154
|
+
const [globalFilter, setGlobalFilter] = (0, import_react19.useState)("");
|
|
4155
|
+
const [currentPageIndex, setCurrentPageIndex] = (0, import_react19.useState)(0);
|
|
4156
|
+
const [pageSearch, setPageSearch] = (0, import_react19.useState)("");
|
|
4161
4157
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4162
4158
|
const filteredDisplayData = data.filter((row) => {
|
|
4163
4159
|
if (!globalFilter) return true;
|
|
@@ -4173,20 +4169,20 @@ var useA4StatementView = ({
|
|
|
4173
4169
|
const columnsWithFooters = columns.filter(
|
|
4174
4170
|
(col) => col.renderFooter && !col.hide
|
|
4175
4171
|
);
|
|
4176
|
-
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ (0,
|
|
4172
|
+
const DisplayFinalTotalEl = columnsWithFooters.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4177
4173
|
"div",
|
|
4178
4174
|
{
|
|
4179
4175
|
id: "a4-final-total",
|
|
4180
4176
|
className: "mt-6 flex flex-wrap justify-end items-center pt-4 border-t border-black dark:border-zinc-700 print:border-black gap-4",
|
|
4181
4177
|
children: [
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4183
|
-
columnsWithFooters.map((col, idx) => /* @__PURE__ */ (0,
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs mr-auto", children: "Grand Totals" }),
|
|
4179
|
+
columnsWithFooters.map((col, idx) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4184
4180
|
"div",
|
|
4185
4181
|
{
|
|
4186
4182
|
className: "flex items-center gap-3 px-4 py-2 rounded-md border border-black dark:border-zinc-700 print:border-black",
|
|
4187
4183
|
children: [
|
|
4188
|
-
/* @__PURE__ */ (0,
|
|
4189
|
-
/* @__PURE__ */ (0,
|
|
4184
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-black dark:text-white print:text-black font-bold uppercase tracking-widest text-xs", children: typeof col.header === "string" ? col.header : typeof col.key === "string" ? col.key : "Total" }),
|
|
4185
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-base font-bold font-sans tabular-nums text-black dark:text-white print:text-black", children: col.renderFooter(filteredDisplayData) })
|
|
4190
4186
|
]
|
|
4191
4187
|
},
|
|
4192
4188
|
col.key || idx
|
|
@@ -4202,7 +4198,7 @@ var useA4StatementView = ({
|
|
|
4202
4198
|
renderFooter: c.renderFooter ? c.renderFooter.toString() : ""
|
|
4203
4199
|
}))
|
|
4204
4200
|
});
|
|
4205
|
-
(0,
|
|
4201
|
+
(0, import_react19.useEffect)(() => {
|
|
4206
4202
|
if (filteredDisplayData && filteredDisplayData.length > 0) {
|
|
4207
4203
|
setIsMeasuring(true);
|
|
4208
4204
|
setPages((prev) => prev.length === 0 ? [[]] : prev);
|
|
@@ -4217,7 +4213,7 @@ var useA4StatementView = ({
|
|
|
4217
4213
|
setCurrentPageIndex(0);
|
|
4218
4214
|
}
|
|
4219
4215
|
}, [depsString]);
|
|
4220
|
-
(0,
|
|
4216
|
+
(0, import_react19.useEffect)(() => {
|
|
4221
4217
|
if (!isMeasuring || filteredDisplayData.length === 0) return;
|
|
4222
4218
|
const timer = setTimeout(() => {
|
|
4223
4219
|
if (!measureContainerRef.current) return;
|
|
@@ -4273,28 +4269,28 @@ var useA4StatementView = ({
|
|
|
4273
4269
|
}, 150);
|
|
4274
4270
|
return () => clearTimeout(timer);
|
|
4275
4271
|
}, [isMeasuring, depsString]);
|
|
4276
|
-
const HeaderEl = /* @__PURE__ */ (0,
|
|
4272
|
+
const HeaderEl = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4277
4273
|
"div",
|
|
4278
4274
|
{
|
|
4279
4275
|
className: "flex justify-between items-start mb-5 px-8 pt-8",
|
|
4280
4276
|
id: "a4-header-section",
|
|
4281
4277
|
children: [
|
|
4282
|
-
/* @__PURE__ */ (0,
|
|
4283
|
-
/* @__PURE__ */ (0,
|
|
4284
|
-
/* @__PURE__ */ (0,
|
|
4278
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("section", { children: [
|
|
4279
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h1", { className: "text-4xl font-bold text-blue-600 dark:text-blue-500 print:text-blue-600 tracking-tight uppercase", children: title }),
|
|
4280
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-gray-500 dark:text-gray-400 print:text-gray-500 mt-1 uppercase text-xs font-semibold tracking-wider", children: subtitle })
|
|
4285
4281
|
] }) }) }),
|
|
4286
|
-
/* @__PURE__ */ (0,
|
|
4287
|
-
/* @__PURE__ */ (0,
|
|
4288
|
-
/* @__PURE__ */ (0,
|
|
4289
|
-
store?.address && /* @__PURE__ */ (0,
|
|
4290
|
-
store?.phone && /* @__PURE__ */ (0,
|
|
4291
|
-
store?.email && /* @__PURE__ */ (0,
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-right", children: [
|
|
4283
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h2", { className: "text-lg font-bold text-gray-800 dark:text-gray-100 print:text-gray-800", children: store?.name }),
|
|
4284
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-sm text-gray-500 dark:text-gray-400 print:text-gray-500 leading-relaxed text-right flex flex-col items-end", children: [
|
|
4285
|
+
store?.address && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "whitespace-pre-line", children: store.address }),
|
|
4286
|
+
store?.phone && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: store.phone }),
|
|
4287
|
+
store?.email && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: store.email })
|
|
4292
4288
|
] })
|
|
4293
4289
|
] })
|
|
4294
4290
|
]
|
|
4295
4291
|
}
|
|
4296
4292
|
);
|
|
4297
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0,
|
|
4293
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4298
4294
|
InfoGrid,
|
|
4299
4295
|
{
|
|
4300
4296
|
className: "mb-4",
|
|
@@ -4302,29 +4298,29 @@ var useA4StatementView = ({
|
|
|
4302
4298
|
isLoading: isActuallyLoading
|
|
4303
4299
|
}
|
|
4304
4300
|
) }) : null;
|
|
4305
|
-
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0,
|
|
4306
|
-
isActuallyLoading ? /* @__PURE__ */ (0,
|
|
4307
|
-
/* @__PURE__ */ (0,
|
|
4308
|
-
/* @__PURE__ */ (0,
|
|
4309
|
-
url && !isActuallyLoading && /* @__PURE__ */ (0,
|
|
4301
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4302
|
+
isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
|
|
4305
|
+
url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4310
4306
|
"button",
|
|
4311
4307
|
{
|
|
4312
4308
|
onClick: () => getData(),
|
|
4313
4309
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4314
4310
|
children: [
|
|
4315
|
-
/* @__PURE__ */ (0,
|
|
4311
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 14 }),
|
|
4316
4312
|
"Try Again"
|
|
4317
4313
|
]
|
|
4318
4314
|
}
|
|
4319
4315
|
)
|
|
4320
4316
|
] }) }) : null;
|
|
4321
|
-
return /* @__PURE__ */ (0,
|
|
4322
|
-
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0,
|
|
4317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4318
|
+
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4323
4319
|
"div",
|
|
4324
4320
|
{
|
|
4325
4321
|
style: { width: "210mm", boxSizing: "border-box" },
|
|
4326
4322
|
className: "bg-white",
|
|
4327
|
-
children: /* @__PURE__ */ (0,
|
|
4323
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4328
4324
|
"div",
|
|
4329
4325
|
{
|
|
4330
4326
|
ref: measureContainerRef,
|
|
@@ -4332,9 +4328,9 @@ var useA4StatementView = ({
|
|
|
4332
4328
|
children: [
|
|
4333
4329
|
HeaderEl,
|
|
4334
4330
|
DisplayInfoGridEl,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4336
|
-
/* @__PURE__ */ (0,
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4331
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4332
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-800 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4333
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4338
4334
|
SimpleTable,
|
|
4339
4335
|
{
|
|
4340
4336
|
columns,
|
|
@@ -4352,52 +4348,52 @@ var useA4StatementView = ({
|
|
|
4352
4348
|
)
|
|
4353
4349
|
}
|
|
4354
4350
|
) }),
|
|
4355
|
-
/* @__PURE__ */ (0,
|
|
4351
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4356
4352
|
"div",
|
|
4357
4353
|
{
|
|
4358
4354
|
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4359
|
-
children: /* @__PURE__ */ (0,
|
|
4355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4360
4356
|
PageA4,
|
|
4361
4357
|
{
|
|
4362
4358
|
className: "w-full",
|
|
4363
4359
|
pageNumber: pageIndex + 1,
|
|
4364
4360
|
totalPages: pages.length,
|
|
4365
4361
|
isLastPage: pageIndex === pages.length - 1,
|
|
4366
|
-
children: /* @__PURE__ */ (0,
|
|
4367
|
-
/* @__PURE__ */ (0,
|
|
4362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4368
4364
|
headers,
|
|
4369
|
-
printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0,
|
|
4370
|
-
/* @__PURE__ */ (0,
|
|
4365
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4371
4367
|
"button",
|
|
4372
4368
|
{
|
|
4373
4369
|
onClick: async () => await getData(),
|
|
4374
4370
|
disabled: isLoading,
|
|
4375
4371
|
className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
|
|
4376
4372
|
children: [
|
|
4377
|
-
/* @__PURE__ */ (0,
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4378
4374
|
import_lucide_react12.RefreshCw,
|
|
4379
4375
|
{
|
|
4380
4376
|
size: 16,
|
|
4381
4377
|
className: isLoading ? "animate-spin" : ""
|
|
4382
4378
|
}
|
|
4383
4379
|
),
|
|
4384
|
-
/* @__PURE__ */ (0,
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4385
4381
|
]
|
|
4386
4382
|
}
|
|
4387
4383
|
),
|
|
4388
|
-
/* @__PURE__ */ (0,
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4389
4385
|
"button",
|
|
4390
4386
|
{
|
|
4391
4387
|
onClick: () => reactToPrintFn(),
|
|
4392
4388
|
className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
|
|
4393
4389
|
children: [
|
|
4394
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Printer, { size: 16 }),
|
|
4395
4391
|
"Print"
|
|
4396
4392
|
]
|
|
4397
4393
|
}
|
|
4398
4394
|
),
|
|
4399
|
-
/* @__PURE__ */ (0,
|
|
4400
|
-
/* @__PURE__ */ (0,
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
4396
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4401
4397
|
"button",
|
|
4402
4398
|
{
|
|
4403
4399
|
onClick: (e) => {
|
|
@@ -4408,11 +4404,11 @@ var useA4StatementView = ({
|
|
|
4408
4404
|
},
|
|
4409
4405
|
disabled: currentPageIndex === 0,
|
|
4410
4406
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4411
|
-
children: /* @__PURE__ */ (0,
|
|
4407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronLeft, { size: 18 })
|
|
4412
4408
|
}
|
|
4413
4409
|
),
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4415
|
-
/* @__PURE__ */ (0,
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4416
4412
|
Select,
|
|
4417
4413
|
{
|
|
4418
4414
|
value: currentPageIndex + 1,
|
|
@@ -4425,9 +4421,9 @@ var useA4StatementView = ({
|
|
|
4425
4421
|
variant: "ghost",
|
|
4426
4422
|
containerClassName: "inline-block",
|
|
4427
4423
|
children: [
|
|
4428
|
-
/* @__PURE__ */ (0,
|
|
4429
|
-
/* @__PURE__ */ (0,
|
|
4430
|
-
/* @__PURE__ */ (0,
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
4426
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4431
4427
|
"input",
|
|
4432
4428
|
{
|
|
4433
4429
|
type: "text",
|
|
@@ -4439,17 +4435,17 @@ var useA4StatementView = ({
|
|
|
4439
4435
|
autoFocus: true
|
|
4440
4436
|
}
|
|
4441
4437
|
) }),
|
|
4442
|
-
/* @__PURE__ */ (0,
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4443
4439
|
(p) => String(p).includes(pageSearch)
|
|
4444
|
-
).map((p) => /* @__PURE__ */ (0,
|
|
4440
|
+
).map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectItem, { value: p, children: p }, p)) })
|
|
4445
4441
|
] })
|
|
4446
4442
|
]
|
|
4447
4443
|
}
|
|
4448
4444
|
),
|
|
4449
|
-
/* @__PURE__ */ (0,
|
|
4450
|
-
/* @__PURE__ */ (0,
|
|
4445
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4451
4447
|
] }),
|
|
4452
|
-
/* @__PURE__ */ (0,
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4453
4449
|
"button",
|
|
4454
4450
|
{
|
|
4455
4451
|
onClick: (e) => {
|
|
@@ -4460,7 +4456,7 @@ var useA4StatementView = ({
|
|
|
4460
4456
|
},
|
|
4461
4457
|
disabled: currentPageIndex === pages.length - 1,
|
|
4462
4458
|
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4463
|
-
children: /* @__PURE__ */ (0,
|
|
4459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronRight, { size: 18 })
|
|
4464
4460
|
}
|
|
4465
4461
|
)
|
|
4466
4462
|
] })
|
|
@@ -4468,10 +4464,10 @@ var useA4StatementView = ({
|
|
|
4468
4464
|
] }),
|
|
4469
4465
|
pageIndex === 0 && HeaderEl,
|
|
4470
4466
|
pageIndex === 0 && DisplayInfoGridEl,
|
|
4471
|
-
/* @__PURE__ */ (0,
|
|
4472
|
-
pageIndex === 0 && /* @__PURE__ */ (0,
|
|
4473
|
-
/* @__PURE__ */ (0,
|
|
4474
|
-
/* @__PURE__ */ (0,
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4468
|
+
pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
|
|
4469
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4475
4471
|
"input",
|
|
4476
4472
|
{
|
|
4477
4473
|
type: "text",
|
|
@@ -4482,9 +4478,9 @@ var useA4StatementView = ({
|
|
|
4482
4478
|
}
|
|
4483
4479
|
)
|
|
4484
4480
|
] }),
|
|
4485
|
-
pageIndex === 0 && /* @__PURE__ */ (0,
|
|
4486
|
-
pageIndex > 0 && /* @__PURE__ */ (0,
|
|
4487
|
-
statusOverlay ? /* @__PURE__ */ (0,
|
|
4481
|
+
pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4482
|
+
pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7 print:h-0" }),
|
|
4483
|
+
statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4488
4484
|
SimpleTable,
|
|
4489
4485
|
{
|
|
4490
4486
|
columns,
|
|
@@ -4520,10 +4516,10 @@ var useA4StatementView = ({
|
|
|
4520
4516
|
var useA4DataView_default = useA4StatementView;
|
|
4521
4517
|
|
|
4522
4518
|
// src/hooks/Fetches/useTransaction.tsx
|
|
4523
|
-
var
|
|
4519
|
+
var import_react20 = require("react");
|
|
4524
4520
|
var import_lucide_react13 = require("lucide-react");
|
|
4525
4521
|
var import_moment = __toESM(require("moment"));
|
|
4526
|
-
var
|
|
4522
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4527
4523
|
var useTransaction = ({
|
|
4528
4524
|
url,
|
|
4529
4525
|
v = 1,
|
|
@@ -4531,7 +4527,7 @@ var useTransaction = ({
|
|
|
4531
4527
|
params = {},
|
|
4532
4528
|
dateFilter = true
|
|
4533
4529
|
}) => {
|
|
4534
|
-
const [date, setDate] = (0,
|
|
4530
|
+
const [date, setDate] = (0, import_react20.useState)(
|
|
4535
4531
|
(0, import_moment.default)().format("DD/MM/YYYY")
|
|
4536
4532
|
);
|
|
4537
4533
|
const dateObj = {};
|
|
@@ -4549,7 +4545,7 @@ var useTransaction = ({
|
|
|
4549
4545
|
delay
|
|
4550
4546
|
});
|
|
4551
4547
|
};
|
|
4552
|
-
(0,
|
|
4548
|
+
(0, import_react20.useEffect)(() => {
|
|
4553
4549
|
getData();
|
|
4554
4550
|
}, [url, v, JSON.stringify(params), delay, date]);
|
|
4555
4551
|
const TransactionViewComponent = ({
|
|
@@ -4576,21 +4572,21 @@ var useTransaction = ({
|
|
|
4576
4572
|
createTitle = "Add New",
|
|
4577
4573
|
...rest
|
|
4578
4574
|
}) => {
|
|
4579
|
-
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ (0,
|
|
4575
|
+
const emptyState = !isLoading && (error || !data || data.length === 0) ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4580
4576
|
"div",
|
|
4581
4577
|
{
|
|
4582
4578
|
className: `flex flex-col relative w-full items-center justify-center py-12 min-h-[300px] ${className}`,
|
|
4583
|
-
children: /* @__PURE__ */ (0,
|
|
4584
|
-
error ? /* @__PURE__ */ (0,
|
|
4585
|
-
/* @__PURE__ */ (0,
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4587
|
-
url && /* @__PURE__ */ (0,
|
|
4579
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4580
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: error ? "Failed to Load Data" : "No Records Found" }),
|
|
4582
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the data." : "There are no transactions or records available to display here." }),
|
|
4583
|
+
url && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4588
4584
|
"button",
|
|
4589
4585
|
{
|
|
4590
4586
|
onClick: () => getData(),
|
|
4591
4587
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4592
4588
|
children: [
|
|
4593
|
-
/* @__PURE__ */ (0,
|
|
4589
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.RefreshCw, { size: 14 }),
|
|
4594
4590
|
"Try Again"
|
|
4595
4591
|
]
|
|
4596
4592
|
}
|
|
@@ -4598,14 +4594,14 @@ var useTransaction = ({
|
|
|
4598
4594
|
] })
|
|
4599
4595
|
}
|
|
4600
4596
|
) : void 0;
|
|
4601
|
-
return /* @__PURE__ */ (0,
|
|
4602
|
-
/* @__PURE__ */ (0,
|
|
4603
|
-
/* @__PURE__ */ (0,
|
|
4604
|
-
/* @__PURE__ */ (0,
|
|
4605
|
-
/* @__PURE__ */ (0,
|
|
4597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Card, { children: [
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("header", { className: "flex items-center justify-between gap-4 py-2", children: [
|
|
4599
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "space-y-1", children: [
|
|
4600
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card.Title, { children: title }),
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card.Description, { children: description })
|
|
4606
4602
|
] }),
|
|
4607
|
-
/* @__PURE__ */ (0,
|
|
4608
|
-
dateFilter && /* @__PURE__ */ (0,
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("section", { className: "flex gap-2 items-center", children: [
|
|
4604
|
+
dateFilter && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4609
4605
|
Fields_default.DateInput,
|
|
4610
4606
|
{
|
|
4611
4607
|
value: date,
|
|
@@ -4615,20 +4611,20 @@ var useTransaction = ({
|
|
|
4615
4611
|
}
|
|
4616
4612
|
}
|
|
4617
4613
|
),
|
|
4618
|
-
/* @__PURE__ */ (0,
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4619
4615
|
Button,
|
|
4620
4616
|
{
|
|
4621
4617
|
size: "sm",
|
|
4622
4618
|
className: "rounded-md!",
|
|
4623
4619
|
onClick: onCreate,
|
|
4624
4620
|
variant: "primary",
|
|
4625
|
-
icon: /* @__PURE__ */ (0,
|
|
4621
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.Plus, {}),
|
|
4626
4622
|
children: createTitle
|
|
4627
4623
|
}
|
|
4628
4624
|
)
|
|
4629
4625
|
] })
|
|
4630
4626
|
] }) }),
|
|
4631
|
-
/* @__PURE__ */ (0,
|
|
4627
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card.Content, { className: "space-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: `w-full ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4632
4628
|
DataTable,
|
|
4633
4629
|
{
|
|
4634
4630
|
columns,
|
|
@@ -4843,6 +4839,1429 @@ var storage = {
|
|
|
4843
4839
|
return keys;
|
|
4844
4840
|
}
|
|
4845
4841
|
};
|
|
4842
|
+
|
|
4843
|
+
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
4844
|
+
var import_react23 = require("react");
|
|
4845
|
+
|
|
4846
|
+
// ../../node_modules/@ant-design/icons/es/components/Context.js
|
|
4847
|
+
var import_react21 = require("react");
|
|
4848
|
+
var IconContext = /* @__PURE__ */ (0, import_react21.createContext)({});
|
|
4849
|
+
var Context_default = IconContext;
|
|
4850
|
+
|
|
4851
|
+
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
4852
|
+
var React14 = __toESM(require("react"));
|
|
4853
|
+
var import_clsx2 = require("clsx");
|
|
4854
|
+
|
|
4855
|
+
// ../../node_modules/@ant-design/fast-color/es/presetColors.js
|
|
4856
|
+
var presetColors_default = {
|
|
4857
|
+
aliceblue: "9ehhb",
|
|
4858
|
+
antiquewhite: "9sgk7",
|
|
4859
|
+
aqua: "1ekf",
|
|
4860
|
+
aquamarine: "4zsno",
|
|
4861
|
+
azure: "9eiv3",
|
|
4862
|
+
beige: "9lhp8",
|
|
4863
|
+
bisque: "9zg04",
|
|
4864
|
+
black: "0",
|
|
4865
|
+
blanchedalmond: "9zhe5",
|
|
4866
|
+
blue: "73",
|
|
4867
|
+
blueviolet: "5e31e",
|
|
4868
|
+
brown: "6g016",
|
|
4869
|
+
burlywood: "8ouiv",
|
|
4870
|
+
cadetblue: "3qba8",
|
|
4871
|
+
chartreuse: "4zshs",
|
|
4872
|
+
chocolate: "87k0u",
|
|
4873
|
+
coral: "9yvyo",
|
|
4874
|
+
cornflowerblue: "3xael",
|
|
4875
|
+
cornsilk: "9zjz0",
|
|
4876
|
+
crimson: "8l4xo",
|
|
4877
|
+
cyan: "1ekf",
|
|
4878
|
+
darkblue: "3v",
|
|
4879
|
+
darkcyan: "rkb",
|
|
4880
|
+
darkgoldenrod: "776yz",
|
|
4881
|
+
darkgray: "6mbhl",
|
|
4882
|
+
darkgreen: "jr4",
|
|
4883
|
+
darkgrey: "6mbhl",
|
|
4884
|
+
darkkhaki: "7ehkb",
|
|
4885
|
+
darkmagenta: "5f91n",
|
|
4886
|
+
darkolivegreen: "3bzfz",
|
|
4887
|
+
darkorange: "9yygw",
|
|
4888
|
+
darkorchid: "5z6x8",
|
|
4889
|
+
darkred: "5f8xs",
|
|
4890
|
+
darksalmon: "9441m",
|
|
4891
|
+
darkseagreen: "5lwgf",
|
|
4892
|
+
darkslateblue: "2th1n",
|
|
4893
|
+
darkslategray: "1ugcv",
|
|
4894
|
+
darkslategrey: "1ugcv",
|
|
4895
|
+
darkturquoise: "14up",
|
|
4896
|
+
darkviolet: "5rw7n",
|
|
4897
|
+
deeppink: "9yavn",
|
|
4898
|
+
deepskyblue: "11xb",
|
|
4899
|
+
dimgray: "442g9",
|
|
4900
|
+
dimgrey: "442g9",
|
|
4901
|
+
dodgerblue: "16xof",
|
|
4902
|
+
firebrick: "6y7tu",
|
|
4903
|
+
floralwhite: "9zkds",
|
|
4904
|
+
forestgreen: "1cisi",
|
|
4905
|
+
fuchsia: "9y70f",
|
|
4906
|
+
gainsboro: "8m8kc",
|
|
4907
|
+
ghostwhite: "9pq0v",
|
|
4908
|
+
goldenrod: "8j4f4",
|
|
4909
|
+
gold: "9zda8",
|
|
4910
|
+
gray: "50i2o",
|
|
4911
|
+
green: "pa8",
|
|
4912
|
+
greenyellow: "6senj",
|
|
4913
|
+
grey: "50i2o",
|
|
4914
|
+
honeydew: "9eiuo",
|
|
4915
|
+
hotpink: "9yrp0",
|
|
4916
|
+
indianred: "80gnw",
|
|
4917
|
+
indigo: "2xcoy",
|
|
4918
|
+
ivory: "9zldc",
|
|
4919
|
+
khaki: "9edu4",
|
|
4920
|
+
lavenderblush: "9ziet",
|
|
4921
|
+
lavender: "90c8q",
|
|
4922
|
+
lawngreen: "4vk74",
|
|
4923
|
+
lemonchiffon: "9zkct",
|
|
4924
|
+
lightblue: "6s73a",
|
|
4925
|
+
lightcoral: "9dtog",
|
|
4926
|
+
lightcyan: "8s1rz",
|
|
4927
|
+
lightgoldenrodyellow: "9sjiq",
|
|
4928
|
+
lightgray: "89jo3",
|
|
4929
|
+
lightgreen: "5nkwg",
|
|
4930
|
+
lightgrey: "89jo3",
|
|
4931
|
+
lightpink: "9z6wx",
|
|
4932
|
+
lightsalmon: "9z2ii",
|
|
4933
|
+
lightseagreen: "19xgq",
|
|
4934
|
+
lightskyblue: "5arju",
|
|
4935
|
+
lightslategray: "4nwk9",
|
|
4936
|
+
lightslategrey: "4nwk9",
|
|
4937
|
+
lightsteelblue: "6wau6",
|
|
4938
|
+
lightyellow: "9zlcw",
|
|
4939
|
+
lime: "1edc",
|
|
4940
|
+
limegreen: "1zcxe",
|
|
4941
|
+
linen: "9shk6",
|
|
4942
|
+
magenta: "9y70f",
|
|
4943
|
+
maroon: "4zsow",
|
|
4944
|
+
mediumaquamarine: "40eju",
|
|
4945
|
+
mediumblue: "5p",
|
|
4946
|
+
mediumorchid: "79qkz",
|
|
4947
|
+
mediumpurple: "5r3rv",
|
|
4948
|
+
mediumseagreen: "2d9ip",
|
|
4949
|
+
mediumslateblue: "4tcku",
|
|
4950
|
+
mediumspringgreen: "1di2",
|
|
4951
|
+
mediumturquoise: "2uabw",
|
|
4952
|
+
mediumvioletred: "7rn9h",
|
|
4953
|
+
midnightblue: "z980",
|
|
4954
|
+
mintcream: "9ljp6",
|
|
4955
|
+
mistyrose: "9zg0x",
|
|
4956
|
+
moccasin: "9zfzp",
|
|
4957
|
+
navajowhite: "9zest",
|
|
4958
|
+
navy: "3k",
|
|
4959
|
+
oldlace: "9wq92",
|
|
4960
|
+
olive: "50hz4",
|
|
4961
|
+
olivedrab: "472ub",
|
|
4962
|
+
orange: "9z3eo",
|
|
4963
|
+
orangered: "9ykg0",
|
|
4964
|
+
orchid: "8iu3a",
|
|
4965
|
+
palegoldenrod: "9bl4a",
|
|
4966
|
+
palegreen: "5yw0o",
|
|
4967
|
+
paleturquoise: "6v4ku",
|
|
4968
|
+
palevioletred: "8k8lv",
|
|
4969
|
+
papayawhip: "9zi6t",
|
|
4970
|
+
peachpuff: "9ze0p",
|
|
4971
|
+
peru: "80oqn",
|
|
4972
|
+
pink: "9z8wb",
|
|
4973
|
+
plum: "8nba5",
|
|
4974
|
+
powderblue: "6wgdi",
|
|
4975
|
+
purple: "4zssg",
|
|
4976
|
+
rebeccapurple: "3zk49",
|
|
4977
|
+
red: "9y6tc",
|
|
4978
|
+
rosybrown: "7cv4f",
|
|
4979
|
+
royalblue: "2jvtt",
|
|
4980
|
+
saddlebrown: "5fmkz",
|
|
4981
|
+
salmon: "9rvci",
|
|
4982
|
+
sandybrown: "9jn1c",
|
|
4983
|
+
seagreen: "1tdnb",
|
|
4984
|
+
seashell: "9zje6",
|
|
4985
|
+
sienna: "6973h",
|
|
4986
|
+
silver: "7ir40",
|
|
4987
|
+
skyblue: "5arjf",
|
|
4988
|
+
slateblue: "45e4t",
|
|
4989
|
+
slategray: "4e100",
|
|
4990
|
+
slategrey: "4e100",
|
|
4991
|
+
snow: "9zke2",
|
|
4992
|
+
springgreen: "1egv",
|
|
4993
|
+
steelblue: "2r1kk",
|
|
4994
|
+
tan: "87yx8",
|
|
4995
|
+
teal: "pds",
|
|
4996
|
+
thistle: "8ggk8",
|
|
4997
|
+
tomato: "9yqfb",
|
|
4998
|
+
turquoise: "2j4r4",
|
|
4999
|
+
violet: "9b10u",
|
|
5000
|
+
wheat: "9ld4j",
|
|
5001
|
+
white: "9zldr",
|
|
5002
|
+
whitesmoke: "9lhpx",
|
|
5003
|
+
yellow: "9zl6o",
|
|
5004
|
+
yellowgreen: "61fzm"
|
|
5005
|
+
};
|
|
5006
|
+
|
|
5007
|
+
// ../../node_modules/@ant-design/fast-color/es/FastColor.js
|
|
5008
|
+
var round = Math.round;
|
|
5009
|
+
function splitColorStr(str, parseNum) {
|
|
5010
|
+
const match = str.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [];
|
|
5011
|
+
const numList = match.map((item) => parseFloat(item));
|
|
5012
|
+
for (let i = 0; i < 3; i += 1) {
|
|
5013
|
+
numList[i] = parseNum(numList[i] || 0, match[i] || "", i);
|
|
5014
|
+
}
|
|
5015
|
+
if (match[3]) {
|
|
5016
|
+
numList[3] = match[3].includes("%") ? numList[3] / 100 : numList[3];
|
|
5017
|
+
} else {
|
|
5018
|
+
numList[3] = 1;
|
|
5019
|
+
}
|
|
5020
|
+
return numList;
|
|
5021
|
+
}
|
|
5022
|
+
var parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
|
|
5023
|
+
function limitRange(value, max) {
|
|
5024
|
+
const mergedMax = max || 255;
|
|
5025
|
+
if (value > mergedMax) {
|
|
5026
|
+
return mergedMax;
|
|
5027
|
+
}
|
|
5028
|
+
if (value < 0) {
|
|
5029
|
+
return 0;
|
|
5030
|
+
}
|
|
5031
|
+
return value;
|
|
5032
|
+
}
|
|
5033
|
+
var FastColor = class _FastColor {
|
|
5034
|
+
/**
|
|
5035
|
+
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
|
|
5036
|
+
*/
|
|
5037
|
+
isValid = true;
|
|
5038
|
+
/**
|
|
5039
|
+
* Red, R in RGB
|
|
5040
|
+
*/
|
|
5041
|
+
r = 0;
|
|
5042
|
+
/**
|
|
5043
|
+
* Green, G in RGB
|
|
5044
|
+
*/
|
|
5045
|
+
g = 0;
|
|
5046
|
+
/**
|
|
5047
|
+
* Blue, B in RGB
|
|
5048
|
+
*/
|
|
5049
|
+
b = 0;
|
|
5050
|
+
/**
|
|
5051
|
+
* Alpha/Opacity, A in RGBA/HSLA
|
|
5052
|
+
*/
|
|
5053
|
+
a = 1;
|
|
5054
|
+
// HSV privates
|
|
5055
|
+
_h;
|
|
5056
|
+
_hsl_s;
|
|
5057
|
+
_hsv_s;
|
|
5058
|
+
_l;
|
|
5059
|
+
_v;
|
|
5060
|
+
// intermediate variables to calculate HSL/HSV
|
|
5061
|
+
_max;
|
|
5062
|
+
_min;
|
|
5063
|
+
_brightness;
|
|
5064
|
+
constructor(input) {
|
|
5065
|
+
function matchFormat(str) {
|
|
5066
|
+
return str[0] in input && str[1] in input && str[2] in input;
|
|
5067
|
+
}
|
|
5068
|
+
if (!input) {
|
|
5069
|
+
} else if (typeof input === "string") {
|
|
5070
|
+
let matchPrefix2 = function(prefix) {
|
|
5071
|
+
return trimStr.startsWith(prefix);
|
|
5072
|
+
};
|
|
5073
|
+
var matchPrefix = matchPrefix2;
|
|
5074
|
+
const trimStr = input.trim();
|
|
5075
|
+
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
|
|
5076
|
+
this.fromHexString(trimStr);
|
|
5077
|
+
} else if (matchPrefix2("rgb")) {
|
|
5078
|
+
this.fromRgbString(trimStr);
|
|
5079
|
+
} else if (matchPrefix2("hsl")) {
|
|
5080
|
+
this.fromHslString(trimStr);
|
|
5081
|
+
} else if (matchPrefix2("hsv") || matchPrefix2("hsb")) {
|
|
5082
|
+
this.fromHsvString(trimStr);
|
|
5083
|
+
} else {
|
|
5084
|
+
const presetColor = presetColors_default[trimStr.toLowerCase()];
|
|
5085
|
+
if (presetColor) {
|
|
5086
|
+
this.fromHexString(
|
|
5087
|
+
// Convert 36 hex to 16 hex
|
|
5088
|
+
parseInt(presetColor, 36).toString(16).padStart(6, "0")
|
|
5089
|
+
);
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
} else if (input instanceof _FastColor) {
|
|
5093
|
+
this.r = input.r;
|
|
5094
|
+
this.g = input.g;
|
|
5095
|
+
this.b = input.b;
|
|
5096
|
+
this.a = input.a;
|
|
5097
|
+
this._h = input._h;
|
|
5098
|
+
this._hsl_s = input._hsl_s;
|
|
5099
|
+
this._hsv_s = input._hsv_s;
|
|
5100
|
+
this._l = input._l;
|
|
5101
|
+
this._v = input._v;
|
|
5102
|
+
} else if (matchFormat("rgb")) {
|
|
5103
|
+
this.r = limitRange(input.r);
|
|
5104
|
+
this.g = limitRange(input.g);
|
|
5105
|
+
this.b = limitRange(input.b);
|
|
5106
|
+
this.a = typeof input.a === "number" ? limitRange(input.a, 1) : 1;
|
|
5107
|
+
} else if (matchFormat("hsl")) {
|
|
5108
|
+
this.fromHsl(input);
|
|
5109
|
+
} else if (matchFormat("hsv")) {
|
|
5110
|
+
this.fromHsv(input);
|
|
5111
|
+
} else {
|
|
5112
|
+
throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(input));
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
// ======================= Setter =======================
|
|
5116
|
+
setR(value) {
|
|
5117
|
+
return this._sc("r", value);
|
|
5118
|
+
}
|
|
5119
|
+
setG(value) {
|
|
5120
|
+
return this._sc("g", value);
|
|
5121
|
+
}
|
|
5122
|
+
setB(value) {
|
|
5123
|
+
return this._sc("b", value);
|
|
5124
|
+
}
|
|
5125
|
+
setA(value) {
|
|
5126
|
+
return this._sc("a", value, 1);
|
|
5127
|
+
}
|
|
5128
|
+
setHue(value) {
|
|
5129
|
+
const hsv = this.toHsv();
|
|
5130
|
+
hsv.h = value;
|
|
5131
|
+
return this._c(hsv);
|
|
5132
|
+
}
|
|
5133
|
+
// ======================= Getter =======================
|
|
5134
|
+
/**
|
|
5135
|
+
* Returns the perceived luminance of a color, from 0-1.
|
|
5136
|
+
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
5137
|
+
*/
|
|
5138
|
+
getLuminance() {
|
|
5139
|
+
function adjustGamma(raw) {
|
|
5140
|
+
const val = raw / 255;
|
|
5141
|
+
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
5142
|
+
}
|
|
5143
|
+
const R = adjustGamma(this.r);
|
|
5144
|
+
const G = adjustGamma(this.g);
|
|
5145
|
+
const B = adjustGamma(this.b);
|
|
5146
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
5147
|
+
}
|
|
5148
|
+
getHue() {
|
|
5149
|
+
if (typeof this._h === "undefined") {
|
|
5150
|
+
const delta = this.getMax() - this.getMin();
|
|
5151
|
+
if (delta === 0) {
|
|
5152
|
+
this._h = 0;
|
|
5153
|
+
} else {
|
|
5154
|
+
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
5155
|
+
}
|
|
5156
|
+
}
|
|
5157
|
+
return this._h;
|
|
5158
|
+
}
|
|
5159
|
+
/**
|
|
5160
|
+
* @deprecated should use getHSVSaturation or getHSLSaturation instead
|
|
5161
|
+
*/
|
|
5162
|
+
getSaturation() {
|
|
5163
|
+
return this.getHSVSaturation();
|
|
5164
|
+
}
|
|
5165
|
+
getHSVSaturation() {
|
|
5166
|
+
if (typeof this._hsv_s === "undefined") {
|
|
5167
|
+
const delta = this.getMax() - this.getMin();
|
|
5168
|
+
if (delta === 0) {
|
|
5169
|
+
this._hsv_s = 0;
|
|
5170
|
+
} else {
|
|
5171
|
+
this._hsv_s = delta / this.getMax();
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
return this._hsv_s;
|
|
5175
|
+
}
|
|
5176
|
+
getHSLSaturation() {
|
|
5177
|
+
if (typeof this._hsl_s === "undefined") {
|
|
5178
|
+
const delta = this.getMax() - this.getMin();
|
|
5179
|
+
if (delta === 0) {
|
|
5180
|
+
this._hsl_s = 0;
|
|
5181
|
+
} else {
|
|
5182
|
+
const l = this.getLightness();
|
|
5183
|
+
this._hsl_s = delta / 255 / (1 - Math.abs(2 * l - 1));
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
return this._hsl_s;
|
|
5187
|
+
}
|
|
5188
|
+
getLightness() {
|
|
5189
|
+
if (typeof this._l === "undefined") {
|
|
5190
|
+
this._l = (this.getMax() + this.getMin()) / 510;
|
|
5191
|
+
}
|
|
5192
|
+
return this._l;
|
|
5193
|
+
}
|
|
5194
|
+
getValue() {
|
|
5195
|
+
if (typeof this._v === "undefined") {
|
|
5196
|
+
this._v = this.getMax() / 255;
|
|
5197
|
+
}
|
|
5198
|
+
return this._v;
|
|
5199
|
+
}
|
|
5200
|
+
/**
|
|
5201
|
+
* Returns the perceived brightness of the color, from 0-255.
|
|
5202
|
+
* Note: this is not the b of HSB
|
|
5203
|
+
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
5204
|
+
*/
|
|
5205
|
+
getBrightness() {
|
|
5206
|
+
if (typeof this._brightness === "undefined") {
|
|
5207
|
+
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3;
|
|
5208
|
+
}
|
|
5209
|
+
return this._brightness;
|
|
5210
|
+
}
|
|
5211
|
+
// ======================== Func ========================
|
|
5212
|
+
darken(amount = 10) {
|
|
5213
|
+
const h = this.getHue();
|
|
5214
|
+
const s = this.getSaturation();
|
|
5215
|
+
let l = this.getLightness() - amount / 100;
|
|
5216
|
+
if (l < 0) {
|
|
5217
|
+
l = 0;
|
|
5218
|
+
}
|
|
5219
|
+
return this._c({
|
|
5220
|
+
h,
|
|
5221
|
+
s,
|
|
5222
|
+
l,
|
|
5223
|
+
a: this.a
|
|
5224
|
+
});
|
|
5225
|
+
}
|
|
5226
|
+
lighten(amount = 10) {
|
|
5227
|
+
const h = this.getHue();
|
|
5228
|
+
const s = this.getSaturation();
|
|
5229
|
+
let l = this.getLightness() + amount / 100;
|
|
5230
|
+
if (l > 1) {
|
|
5231
|
+
l = 1;
|
|
5232
|
+
}
|
|
5233
|
+
return this._c({
|
|
5234
|
+
h,
|
|
5235
|
+
s,
|
|
5236
|
+
l,
|
|
5237
|
+
a: this.a
|
|
5238
|
+
});
|
|
5239
|
+
}
|
|
5240
|
+
/**
|
|
5241
|
+
* Mix the current color a given amount with another color, from 0 to 100.
|
|
5242
|
+
* 0 means no mixing (return current color).
|
|
5243
|
+
*/
|
|
5244
|
+
mix(input, amount = 50) {
|
|
5245
|
+
const color = this._c(input);
|
|
5246
|
+
const p = amount / 100;
|
|
5247
|
+
const calc = (key) => (color[key] - this[key]) * p + this[key];
|
|
5248
|
+
const rgba = {
|
|
5249
|
+
r: round(calc("r")),
|
|
5250
|
+
g: round(calc("g")),
|
|
5251
|
+
b: round(calc("b")),
|
|
5252
|
+
a: round(calc("a") * 100) / 100
|
|
5253
|
+
};
|
|
5254
|
+
return this._c(rgba);
|
|
5255
|
+
}
|
|
5256
|
+
/**
|
|
5257
|
+
* Mix the color with pure white, from 0 to 100.
|
|
5258
|
+
* Providing 0 will do nothing, providing 100 will always return white.
|
|
5259
|
+
*/
|
|
5260
|
+
tint(amount = 10) {
|
|
5261
|
+
return this.mix({
|
|
5262
|
+
r: 255,
|
|
5263
|
+
g: 255,
|
|
5264
|
+
b: 255,
|
|
5265
|
+
a: 1
|
|
5266
|
+
}, amount);
|
|
5267
|
+
}
|
|
5268
|
+
/**
|
|
5269
|
+
* Mix the color with pure black, from 0 to 100.
|
|
5270
|
+
* Providing 0 will do nothing, providing 100 will always return black.
|
|
5271
|
+
*/
|
|
5272
|
+
shade(amount = 10) {
|
|
5273
|
+
return this.mix({
|
|
5274
|
+
r: 0,
|
|
5275
|
+
g: 0,
|
|
5276
|
+
b: 0,
|
|
5277
|
+
a: 1
|
|
5278
|
+
}, amount);
|
|
5279
|
+
}
|
|
5280
|
+
onBackground(background) {
|
|
5281
|
+
const bg = this._c(background);
|
|
5282
|
+
const alpha = this.a + bg.a * (1 - this.a);
|
|
5283
|
+
const calc = (key) => {
|
|
5284
|
+
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
|
|
5285
|
+
};
|
|
5286
|
+
return this._c({
|
|
5287
|
+
r: calc("r"),
|
|
5288
|
+
g: calc("g"),
|
|
5289
|
+
b: calc("b"),
|
|
5290
|
+
a: alpha
|
|
5291
|
+
});
|
|
5292
|
+
}
|
|
5293
|
+
// ======================= Status =======================
|
|
5294
|
+
isDark() {
|
|
5295
|
+
return this.getBrightness() < 128;
|
|
5296
|
+
}
|
|
5297
|
+
isLight() {
|
|
5298
|
+
return this.getBrightness() >= 128;
|
|
5299
|
+
}
|
|
5300
|
+
// ======================== MISC ========================
|
|
5301
|
+
equals(other) {
|
|
5302
|
+
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
5303
|
+
}
|
|
5304
|
+
clone() {
|
|
5305
|
+
return this._c(this);
|
|
5306
|
+
}
|
|
5307
|
+
// ======================= Format =======================
|
|
5308
|
+
toHexString() {
|
|
5309
|
+
let hex = "#";
|
|
5310
|
+
const rHex = (this.r || 0).toString(16);
|
|
5311
|
+
hex += rHex.length === 2 ? rHex : "0" + rHex;
|
|
5312
|
+
const gHex = (this.g || 0).toString(16);
|
|
5313
|
+
hex += gHex.length === 2 ? gHex : "0" + gHex;
|
|
5314
|
+
const bHex = (this.b || 0).toString(16);
|
|
5315
|
+
hex += bHex.length === 2 ? bHex : "0" + bHex;
|
|
5316
|
+
if (typeof this.a === "number" && this.a >= 0 && this.a < 1) {
|
|
5317
|
+
const aHex = round(this.a * 255).toString(16);
|
|
5318
|
+
hex += aHex.length === 2 ? aHex : "0" + aHex;
|
|
5319
|
+
}
|
|
5320
|
+
return hex;
|
|
5321
|
+
}
|
|
5322
|
+
/** CSS support color pattern */
|
|
5323
|
+
toHsl() {
|
|
5324
|
+
return {
|
|
5325
|
+
h: this.getHue(),
|
|
5326
|
+
s: this.getHSLSaturation(),
|
|
5327
|
+
l: this.getLightness(),
|
|
5328
|
+
a: this.a
|
|
5329
|
+
};
|
|
5330
|
+
}
|
|
5331
|
+
/** CSS support color pattern */
|
|
5332
|
+
toHslString() {
|
|
5333
|
+
const h = this.getHue();
|
|
5334
|
+
const s = round(this.getHSLSaturation() * 100);
|
|
5335
|
+
const l = round(this.getLightness() * 100);
|
|
5336
|
+
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
|
|
5337
|
+
}
|
|
5338
|
+
/** Same as toHsb */
|
|
5339
|
+
toHsv() {
|
|
5340
|
+
return {
|
|
5341
|
+
h: this.getHue(),
|
|
5342
|
+
s: this.getHSVSaturation(),
|
|
5343
|
+
v: this.getValue(),
|
|
5344
|
+
a: this.a
|
|
5345
|
+
};
|
|
5346
|
+
}
|
|
5347
|
+
toRgb() {
|
|
5348
|
+
return {
|
|
5349
|
+
r: this.r,
|
|
5350
|
+
g: this.g,
|
|
5351
|
+
b: this.b,
|
|
5352
|
+
a: this.a
|
|
5353
|
+
};
|
|
5354
|
+
}
|
|
5355
|
+
toRgbString() {
|
|
5356
|
+
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
5357
|
+
}
|
|
5358
|
+
toString() {
|
|
5359
|
+
return this.toRgbString();
|
|
5360
|
+
}
|
|
5361
|
+
// ====================== Privates ======================
|
|
5362
|
+
/** Return a new FastColor object with one channel changed */
|
|
5363
|
+
_sc(rgb, value, max) {
|
|
5364
|
+
const clone = this.clone();
|
|
5365
|
+
clone[rgb] = limitRange(value, max);
|
|
5366
|
+
return clone;
|
|
5367
|
+
}
|
|
5368
|
+
_c(input) {
|
|
5369
|
+
return new this.constructor(input);
|
|
5370
|
+
}
|
|
5371
|
+
getMax() {
|
|
5372
|
+
if (typeof this._max === "undefined") {
|
|
5373
|
+
this._max = Math.max(this.r, this.g, this.b);
|
|
5374
|
+
}
|
|
5375
|
+
return this._max;
|
|
5376
|
+
}
|
|
5377
|
+
getMin() {
|
|
5378
|
+
if (typeof this._min === "undefined") {
|
|
5379
|
+
this._min = Math.min(this.r, this.g, this.b);
|
|
5380
|
+
}
|
|
5381
|
+
return this._min;
|
|
5382
|
+
}
|
|
5383
|
+
fromHexString(trimStr) {
|
|
5384
|
+
const withoutPrefix = trimStr.replace("#", "");
|
|
5385
|
+
function connectNum(index1, index2) {
|
|
5386
|
+
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
|
|
5387
|
+
}
|
|
5388
|
+
if (withoutPrefix.length < 6) {
|
|
5389
|
+
this.r = connectNum(0);
|
|
5390
|
+
this.g = connectNum(1);
|
|
5391
|
+
this.b = connectNum(2);
|
|
5392
|
+
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
|
|
5393
|
+
} else {
|
|
5394
|
+
this.r = connectNum(0, 1);
|
|
5395
|
+
this.g = connectNum(2, 3);
|
|
5396
|
+
this.b = connectNum(4, 5);
|
|
5397
|
+
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
|
|
5398
|
+
}
|
|
5399
|
+
}
|
|
5400
|
+
fromHsl({
|
|
5401
|
+
h: _h,
|
|
5402
|
+
s,
|
|
5403
|
+
l,
|
|
5404
|
+
a
|
|
5405
|
+
}) {
|
|
5406
|
+
const h = (_h % 360 + 360) % 360;
|
|
5407
|
+
this._h = h;
|
|
5408
|
+
this._hsl_s = s;
|
|
5409
|
+
this._l = l;
|
|
5410
|
+
this.a = typeof a === "number" ? a : 1;
|
|
5411
|
+
if (s <= 0) {
|
|
5412
|
+
const rgb = round(l * 255);
|
|
5413
|
+
this.r = rgb;
|
|
5414
|
+
this.g = rgb;
|
|
5415
|
+
this.b = rgb;
|
|
5416
|
+
return;
|
|
5417
|
+
}
|
|
5418
|
+
let r = 0, g = 0, b = 0;
|
|
5419
|
+
const huePrime = h / 60;
|
|
5420
|
+
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
5421
|
+
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
5422
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
5423
|
+
r = chroma;
|
|
5424
|
+
g = secondComponent;
|
|
5425
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
5426
|
+
r = secondComponent;
|
|
5427
|
+
g = chroma;
|
|
5428
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
5429
|
+
g = chroma;
|
|
5430
|
+
b = secondComponent;
|
|
5431
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
5432
|
+
g = secondComponent;
|
|
5433
|
+
b = chroma;
|
|
5434
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
5435
|
+
r = secondComponent;
|
|
5436
|
+
b = chroma;
|
|
5437
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
5438
|
+
r = chroma;
|
|
5439
|
+
b = secondComponent;
|
|
5440
|
+
}
|
|
5441
|
+
const lightnessModification = l - chroma / 2;
|
|
5442
|
+
this.r = round((r + lightnessModification) * 255);
|
|
5443
|
+
this.g = round((g + lightnessModification) * 255);
|
|
5444
|
+
this.b = round((b + lightnessModification) * 255);
|
|
5445
|
+
}
|
|
5446
|
+
fromHsv({
|
|
5447
|
+
h: _h,
|
|
5448
|
+
s,
|
|
5449
|
+
v,
|
|
5450
|
+
a
|
|
5451
|
+
}) {
|
|
5452
|
+
const h = (_h % 360 + 360) % 360;
|
|
5453
|
+
this._h = h;
|
|
5454
|
+
this._hsv_s = s;
|
|
5455
|
+
this._v = v;
|
|
5456
|
+
this.a = typeof a === "number" ? a : 1;
|
|
5457
|
+
const vv = round(v * 255);
|
|
5458
|
+
this.r = vv;
|
|
5459
|
+
this.g = vv;
|
|
5460
|
+
this.b = vv;
|
|
5461
|
+
if (s <= 0) {
|
|
5462
|
+
return;
|
|
5463
|
+
}
|
|
5464
|
+
const hh = h / 60;
|
|
5465
|
+
const i = Math.floor(hh);
|
|
5466
|
+
const ff = hh - i;
|
|
5467
|
+
const p = round(v * (1 - s) * 255);
|
|
5468
|
+
const q = round(v * (1 - s * ff) * 255);
|
|
5469
|
+
const t = round(v * (1 - s * (1 - ff)) * 255);
|
|
5470
|
+
switch (i) {
|
|
5471
|
+
case 0:
|
|
5472
|
+
this.g = t;
|
|
5473
|
+
this.b = p;
|
|
5474
|
+
break;
|
|
5475
|
+
case 1:
|
|
5476
|
+
this.r = q;
|
|
5477
|
+
this.b = p;
|
|
5478
|
+
break;
|
|
5479
|
+
case 2:
|
|
5480
|
+
this.r = p;
|
|
5481
|
+
this.b = t;
|
|
5482
|
+
break;
|
|
5483
|
+
case 3:
|
|
5484
|
+
this.r = p;
|
|
5485
|
+
this.g = q;
|
|
5486
|
+
break;
|
|
5487
|
+
case 4:
|
|
5488
|
+
this.r = t;
|
|
5489
|
+
this.g = p;
|
|
5490
|
+
break;
|
|
5491
|
+
case 5:
|
|
5492
|
+
default:
|
|
5493
|
+
this.g = p;
|
|
5494
|
+
this.b = q;
|
|
5495
|
+
break;
|
|
5496
|
+
}
|
|
5497
|
+
}
|
|
5498
|
+
fromHsvString(trimStr) {
|
|
5499
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
5500
|
+
this.fromHsv({
|
|
5501
|
+
h: cells[0],
|
|
5502
|
+
s: cells[1],
|
|
5503
|
+
v: cells[2],
|
|
5504
|
+
a: cells[3]
|
|
5505
|
+
});
|
|
5506
|
+
}
|
|
5507
|
+
fromHslString(trimStr) {
|
|
5508
|
+
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
5509
|
+
this.fromHsl({
|
|
5510
|
+
h: cells[0],
|
|
5511
|
+
s: cells[1],
|
|
5512
|
+
l: cells[2],
|
|
5513
|
+
a: cells[3]
|
|
5514
|
+
});
|
|
5515
|
+
}
|
|
5516
|
+
fromRgbString(trimStr) {
|
|
5517
|
+
const cells = splitColorStr(trimStr, (num, txt) => (
|
|
5518
|
+
// Convert percentage to number. e.g. 50% -> 128
|
|
5519
|
+
txt.includes("%") ? round(num / 100 * 255) : num
|
|
5520
|
+
));
|
|
5521
|
+
this.r = cells[0];
|
|
5522
|
+
this.g = cells[1];
|
|
5523
|
+
this.b = cells[2];
|
|
5524
|
+
this.a = cells[3];
|
|
5525
|
+
}
|
|
5526
|
+
};
|
|
5527
|
+
|
|
5528
|
+
// ../../node_modules/@ant-design/colors/es/generate.js
|
|
5529
|
+
var hueStep = 2;
|
|
5530
|
+
var saturationStep = 0.16;
|
|
5531
|
+
var saturationStep2 = 0.05;
|
|
5532
|
+
var brightnessStep1 = 0.05;
|
|
5533
|
+
var brightnessStep2 = 0.15;
|
|
5534
|
+
var lightColorCount = 5;
|
|
5535
|
+
var darkColorCount = 4;
|
|
5536
|
+
var darkColorMap = [{
|
|
5537
|
+
index: 7,
|
|
5538
|
+
amount: 15
|
|
5539
|
+
}, {
|
|
5540
|
+
index: 6,
|
|
5541
|
+
amount: 25
|
|
5542
|
+
}, {
|
|
5543
|
+
index: 5,
|
|
5544
|
+
amount: 30
|
|
5545
|
+
}, {
|
|
5546
|
+
index: 5,
|
|
5547
|
+
amount: 45
|
|
5548
|
+
}, {
|
|
5549
|
+
index: 5,
|
|
5550
|
+
amount: 65
|
|
5551
|
+
}, {
|
|
5552
|
+
index: 5,
|
|
5553
|
+
amount: 85
|
|
5554
|
+
}, {
|
|
5555
|
+
index: 4,
|
|
5556
|
+
amount: 90
|
|
5557
|
+
}, {
|
|
5558
|
+
index: 3,
|
|
5559
|
+
amount: 95
|
|
5560
|
+
}, {
|
|
5561
|
+
index: 2,
|
|
5562
|
+
amount: 97
|
|
5563
|
+
}, {
|
|
5564
|
+
index: 1,
|
|
5565
|
+
amount: 98
|
|
5566
|
+
}];
|
|
5567
|
+
function getHue(hsv, i, light) {
|
|
5568
|
+
let hue;
|
|
5569
|
+
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
5570
|
+
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
5571
|
+
} else {
|
|
5572
|
+
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
5573
|
+
}
|
|
5574
|
+
if (hue < 0) {
|
|
5575
|
+
hue += 360;
|
|
5576
|
+
} else if (hue >= 360) {
|
|
5577
|
+
hue -= 360;
|
|
5578
|
+
}
|
|
5579
|
+
return hue;
|
|
5580
|
+
}
|
|
5581
|
+
function getSaturation(hsv, i, light) {
|
|
5582
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
5583
|
+
return hsv.s;
|
|
5584
|
+
}
|
|
5585
|
+
let saturation;
|
|
5586
|
+
if (light) {
|
|
5587
|
+
saturation = hsv.s - saturationStep * i;
|
|
5588
|
+
} else if (i === darkColorCount) {
|
|
5589
|
+
saturation = hsv.s + saturationStep;
|
|
5590
|
+
} else {
|
|
5591
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
5592
|
+
}
|
|
5593
|
+
if (saturation > 1) {
|
|
5594
|
+
saturation = 1;
|
|
5595
|
+
}
|
|
5596
|
+
if (light && i === lightColorCount && saturation > 0.1) {
|
|
5597
|
+
saturation = 0.1;
|
|
5598
|
+
}
|
|
5599
|
+
if (saturation < 0.06) {
|
|
5600
|
+
saturation = 0.06;
|
|
5601
|
+
}
|
|
5602
|
+
return Math.round(saturation * 100) / 100;
|
|
5603
|
+
}
|
|
5604
|
+
function getValue(hsv, i, light) {
|
|
5605
|
+
let value;
|
|
5606
|
+
if (light) {
|
|
5607
|
+
value = hsv.v + brightnessStep1 * i;
|
|
5608
|
+
} else {
|
|
5609
|
+
value = hsv.v - brightnessStep2 * i;
|
|
5610
|
+
}
|
|
5611
|
+
value = Math.max(0, Math.min(1, value));
|
|
5612
|
+
return Math.round(value * 100) / 100;
|
|
5613
|
+
}
|
|
5614
|
+
function generate(color, opts = {}) {
|
|
5615
|
+
const patterns = [];
|
|
5616
|
+
const pColor = new FastColor(color);
|
|
5617
|
+
const hsv = pColor.toHsv();
|
|
5618
|
+
for (let i = lightColorCount; i > 0; i -= 1) {
|
|
5619
|
+
const c = new FastColor({
|
|
5620
|
+
h: getHue(hsv, i, true),
|
|
5621
|
+
s: getSaturation(hsv, i, true),
|
|
5622
|
+
v: getValue(hsv, i, true)
|
|
5623
|
+
});
|
|
5624
|
+
patterns.push(c);
|
|
5625
|
+
}
|
|
5626
|
+
patterns.push(pColor);
|
|
5627
|
+
for (let i = 1; i <= darkColorCount; i += 1) {
|
|
5628
|
+
const c = new FastColor({
|
|
5629
|
+
h: getHue(hsv, i),
|
|
5630
|
+
s: getSaturation(hsv, i),
|
|
5631
|
+
v: getValue(hsv, i)
|
|
5632
|
+
});
|
|
5633
|
+
patterns.push(c);
|
|
5634
|
+
}
|
|
5635
|
+
if (opts.theme === "dark") {
|
|
5636
|
+
return darkColorMap.map(({
|
|
5637
|
+
index,
|
|
5638
|
+
amount
|
|
5639
|
+
}) => new FastColor(opts.backgroundColor || "#141414").mix(patterns[index], amount).toHexString());
|
|
5640
|
+
}
|
|
5641
|
+
return patterns.map((c) => c.toHexString());
|
|
5642
|
+
}
|
|
5643
|
+
|
|
5644
|
+
// ../../node_modules/@ant-design/colors/es/presets.js
|
|
5645
|
+
var red = ["#fff1f0", "#ffccc7", "#ffa39e", "#ff7875", "#ff4d4f", "#f5222d", "#cf1322", "#a8071a", "#820014", "#5c0011"];
|
|
5646
|
+
red.primary = red[5];
|
|
5647
|
+
var volcano = ["#fff2e8", "#ffd8bf", "#ffbb96", "#ff9c6e", "#ff7a45", "#fa541c", "#d4380d", "#ad2102", "#871400", "#610b00"];
|
|
5648
|
+
volcano.primary = volcano[5];
|
|
5649
|
+
var orange = ["#fff7e6", "#ffe7ba", "#ffd591", "#ffc069", "#ffa940", "#fa8c16", "#d46b08", "#ad4e00", "#873800", "#612500"];
|
|
5650
|
+
orange.primary = orange[5];
|
|
5651
|
+
var gold = ["#fffbe6", "#fff1b8", "#ffe58f", "#ffd666", "#ffc53d", "#faad14", "#d48806", "#ad6800", "#874d00", "#613400"];
|
|
5652
|
+
gold.primary = gold[5];
|
|
5653
|
+
var yellow = ["#feffe6", "#ffffb8", "#fffb8f", "#fff566", "#ffec3d", "#fadb14", "#d4b106", "#ad8b00", "#876800", "#614700"];
|
|
5654
|
+
yellow.primary = yellow[5];
|
|
5655
|
+
var lime = ["#fcffe6", "#f4ffb8", "#eaff8f", "#d3f261", "#bae637", "#a0d911", "#7cb305", "#5b8c00", "#3f6600", "#254000"];
|
|
5656
|
+
lime.primary = lime[5];
|
|
5657
|
+
var green = ["#f6ffed", "#d9f7be", "#b7eb8f", "#95de64", "#73d13d", "#52c41a", "#389e0d", "#237804", "#135200", "#092b00"];
|
|
5658
|
+
green.primary = green[5];
|
|
5659
|
+
var cyan = ["#e6fffb", "#b5f5ec", "#87e8de", "#5cdbd3", "#36cfc9", "#13c2c2", "#08979c", "#006d75", "#00474f", "#002329"];
|
|
5660
|
+
cyan.primary = cyan[5];
|
|
5661
|
+
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
|
|
5662
|
+
blue.primary = blue[5];
|
|
5663
|
+
var geekblue = ["#f0f5ff", "#d6e4ff", "#adc6ff", "#85a5ff", "#597ef7", "#2f54eb", "#1d39c4", "#10239e", "#061178", "#030852"];
|
|
5664
|
+
geekblue.primary = geekblue[5];
|
|
5665
|
+
var purple = ["#f9f0ff", "#efdbff", "#d3adf7", "#b37feb", "#9254de", "#722ed1", "#531dab", "#391085", "#22075e", "#120338"];
|
|
5666
|
+
purple.primary = purple[5];
|
|
5667
|
+
var magenta = ["#fff0f6", "#ffd6e7", "#ffadd2", "#ff85c0", "#f759ab", "#eb2f96", "#c41d7f", "#9e1068", "#780650", "#520339"];
|
|
5668
|
+
magenta.primary = magenta[5];
|
|
5669
|
+
var grey = ["#a6a6a6", "#999999", "#8c8c8c", "#808080", "#737373", "#666666", "#404040", "#1a1a1a", "#000000", "#000000"];
|
|
5670
|
+
grey.primary = grey[5];
|
|
5671
|
+
var redDark = ["#2a1215", "#431418", "#58181c", "#791a1f", "#a61d24", "#d32029", "#e84749", "#f37370", "#f89f9a", "#fac8c3"];
|
|
5672
|
+
redDark.primary = redDark[5];
|
|
5673
|
+
var volcanoDark = ["#2b1611", "#441d12", "#592716", "#7c3118", "#aa3e19", "#d84a1b", "#e87040", "#f3956a", "#f8b692", "#fad4bc"];
|
|
5674
|
+
volcanoDark.primary = volcanoDark[5];
|
|
5675
|
+
var orangeDark = ["#2b1d11", "#442a11", "#593815", "#7c4a15", "#aa6215", "#d87a16", "#e89a3c", "#f3b765", "#f8cf8d", "#fae3b7"];
|
|
5676
|
+
orangeDark.primary = orangeDark[5];
|
|
5677
|
+
var goldDark = ["#2b2111", "#443111", "#594214", "#7c5914", "#aa7714", "#d89614", "#e8b339", "#f3cc62", "#f8df8b", "#faedb5"];
|
|
5678
|
+
goldDark.primary = goldDark[5];
|
|
5679
|
+
var yellowDark = ["#2b2611", "#443b11", "#595014", "#7c6e14", "#aa9514", "#d8bd14", "#e8d639", "#f3ea62", "#f8f48b", "#fafab5"];
|
|
5680
|
+
yellowDark.primary = yellowDark[5];
|
|
5681
|
+
var limeDark = ["#1f2611", "#2e3c10", "#3e4f13", "#536d13", "#6f9412", "#8bbb11", "#a9d134", "#c9e75d", "#e4f88b", "#f0fab5"];
|
|
5682
|
+
limeDark.primary = limeDark[5];
|
|
5683
|
+
var greenDark = ["#162312", "#1d3712", "#274916", "#306317", "#3c8618", "#49aa19", "#6abe39", "#8fd460", "#b2e58b", "#d5f2bb"];
|
|
5684
|
+
greenDark.primary = greenDark[5];
|
|
5685
|
+
var cyanDark = ["#112123", "#113536", "#144848", "#146262", "#138585", "#13a8a8", "#33bcb7", "#58d1c9", "#84e2d8", "#b2f1e8"];
|
|
5686
|
+
cyanDark.primary = cyanDark[5];
|
|
5687
|
+
var blueDark = ["#111a2c", "#112545", "#15325b", "#15417e", "#1554ad", "#1668dc", "#3c89e8", "#65a9f3", "#8dc5f8", "#b7dcfa"];
|
|
5688
|
+
blueDark.primary = blueDark[5];
|
|
5689
|
+
var geekblueDark = ["#131629", "#161d40", "#1c2755", "#203175", "#263ea0", "#2b4acb", "#5273e0", "#7f9ef3", "#a8c1f8", "#d2e0fa"];
|
|
5690
|
+
geekblueDark.primary = geekblueDark[5];
|
|
5691
|
+
var purpleDark = ["#1a1325", "#24163a", "#301c4d", "#3e2069", "#51258f", "#642ab5", "#854eca", "#ab7ae0", "#cda8f0", "#ebd7fa"];
|
|
5692
|
+
purpleDark.primary = purpleDark[5];
|
|
5693
|
+
var magentaDark = ["#291321", "#40162f", "#551c3b", "#75204f", "#a02669", "#cb2b83", "#e0529c", "#f37fb7", "#f8a8cc", "#fad2e3"];
|
|
5694
|
+
magentaDark.primary = magentaDark[5];
|
|
5695
|
+
var greyDark = ["#151515", "#1f1f1f", "#2d2d2d", "#393939", "#494949", "#5a5a5a", "#6a6a6a", "#7b7b7b", "#888888", "#969696"];
|
|
5696
|
+
greyDark.primary = greyDark[5];
|
|
5697
|
+
|
|
5698
|
+
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
5699
|
+
var React13 = __toESM(require("react"));
|
|
5700
|
+
|
|
5701
|
+
// ../../node_modules/@rc-component/util/es/Dom/canUseDom.js
|
|
5702
|
+
function canUseDom() {
|
|
5703
|
+
return !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
// ../../node_modules/@rc-component/util/es/Dom/contains.js
|
|
5707
|
+
function contains(root, n) {
|
|
5708
|
+
if (!root) {
|
|
5709
|
+
return false;
|
|
5710
|
+
}
|
|
5711
|
+
if (root.contains) {
|
|
5712
|
+
return root.contains(n);
|
|
5713
|
+
}
|
|
5714
|
+
let node = n;
|
|
5715
|
+
while (node) {
|
|
5716
|
+
if (node === root) {
|
|
5717
|
+
return true;
|
|
5718
|
+
}
|
|
5719
|
+
node = node.parentNode;
|
|
5720
|
+
}
|
|
5721
|
+
return false;
|
|
5722
|
+
}
|
|
5723
|
+
|
|
5724
|
+
// ../../node_modules/@rc-component/util/es/Dom/dynamicCSS.js
|
|
5725
|
+
var APPEND_ORDER = "data-rc-order";
|
|
5726
|
+
var APPEND_PRIORITY = "data-rc-priority";
|
|
5727
|
+
var MARK_KEY = `rc-util-key`;
|
|
5728
|
+
var containerCache = /* @__PURE__ */ new Map();
|
|
5729
|
+
function getMark({
|
|
5730
|
+
mark
|
|
5731
|
+
} = {}) {
|
|
5732
|
+
if (mark) {
|
|
5733
|
+
return mark.startsWith("data-") ? mark : `data-${mark}`;
|
|
5734
|
+
}
|
|
5735
|
+
return MARK_KEY;
|
|
5736
|
+
}
|
|
5737
|
+
function getContainer(option) {
|
|
5738
|
+
if (option.attachTo) {
|
|
5739
|
+
return option.attachTo;
|
|
5740
|
+
}
|
|
5741
|
+
const head = document.querySelector("head");
|
|
5742
|
+
return head || document.body;
|
|
5743
|
+
}
|
|
5744
|
+
function getOrder(prepend) {
|
|
5745
|
+
if (prepend === "queue") {
|
|
5746
|
+
return "prependQueue";
|
|
5747
|
+
}
|
|
5748
|
+
return prepend ? "prepend" : "append";
|
|
5749
|
+
}
|
|
5750
|
+
function findStyles(container) {
|
|
5751
|
+
return Array.from((containerCache.get(container) || container).children).filter((node) => node.tagName === "STYLE");
|
|
5752
|
+
}
|
|
5753
|
+
function injectCSS(css, option = {}) {
|
|
5754
|
+
if (!canUseDom()) {
|
|
5755
|
+
return null;
|
|
5756
|
+
}
|
|
5757
|
+
const {
|
|
5758
|
+
csp,
|
|
5759
|
+
prepend,
|
|
5760
|
+
priority = 0
|
|
5761
|
+
} = option;
|
|
5762
|
+
const mergedOrder = getOrder(prepend);
|
|
5763
|
+
const isPrependQueue = mergedOrder === "prependQueue";
|
|
5764
|
+
const styleNode = document.createElement("style");
|
|
5765
|
+
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
5766
|
+
if (isPrependQueue && priority) {
|
|
5767
|
+
styleNode.setAttribute(APPEND_PRIORITY, `${priority}`);
|
|
5768
|
+
}
|
|
5769
|
+
if (csp?.nonce) {
|
|
5770
|
+
styleNode.nonce = csp?.nonce;
|
|
5771
|
+
}
|
|
5772
|
+
styleNode.innerHTML = css;
|
|
5773
|
+
const container = getContainer(option);
|
|
5774
|
+
const {
|
|
5775
|
+
firstChild
|
|
5776
|
+
} = container;
|
|
5777
|
+
if (prepend) {
|
|
5778
|
+
if (isPrependQueue) {
|
|
5779
|
+
const existStyle = (option.styles || findStyles(container)).filter((node) => {
|
|
5780
|
+
if (!["prepend", "prependQueue"].includes(node.getAttribute(APPEND_ORDER))) {
|
|
5781
|
+
return false;
|
|
5782
|
+
}
|
|
5783
|
+
const nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
5784
|
+
return priority >= nodePriority;
|
|
5785
|
+
});
|
|
5786
|
+
if (existStyle.length) {
|
|
5787
|
+
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
5788
|
+
return styleNode;
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
container.insertBefore(styleNode, firstChild);
|
|
5792
|
+
} else {
|
|
5793
|
+
container.appendChild(styleNode);
|
|
5794
|
+
}
|
|
5795
|
+
return styleNode;
|
|
5796
|
+
}
|
|
5797
|
+
function findExistNode(key, option = {}) {
|
|
5798
|
+
let {
|
|
5799
|
+
styles
|
|
5800
|
+
} = option;
|
|
5801
|
+
styles ||= findStyles(getContainer(option));
|
|
5802
|
+
return styles.find((node) => node.getAttribute(getMark(option)) === key);
|
|
5803
|
+
}
|
|
5804
|
+
function syncRealContainer(container, option) {
|
|
5805
|
+
const cachedRealContainer = containerCache.get(container);
|
|
5806
|
+
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
5807
|
+
const placeholderStyle = injectCSS("", option);
|
|
5808
|
+
const {
|
|
5809
|
+
parentNode
|
|
5810
|
+
} = placeholderStyle;
|
|
5811
|
+
containerCache.set(container, parentNode);
|
|
5812
|
+
container.removeChild(placeholderStyle);
|
|
5813
|
+
}
|
|
5814
|
+
}
|
|
5815
|
+
function updateCSS(css, key, originOption = {}) {
|
|
5816
|
+
const container = getContainer(originOption);
|
|
5817
|
+
const styles = findStyles(container);
|
|
5818
|
+
const option = {
|
|
5819
|
+
...originOption,
|
|
5820
|
+
styles
|
|
5821
|
+
};
|
|
5822
|
+
syncRealContainer(container, option);
|
|
5823
|
+
const existNode = findExistNode(key, option);
|
|
5824
|
+
if (existNode) {
|
|
5825
|
+
if (option.csp?.nonce && existNode.nonce !== option.csp?.nonce) {
|
|
5826
|
+
existNode.nonce = option.csp?.nonce;
|
|
5827
|
+
}
|
|
5828
|
+
if (existNode.innerHTML !== css) {
|
|
5829
|
+
existNode.innerHTML = css;
|
|
5830
|
+
}
|
|
5831
|
+
return existNode;
|
|
5832
|
+
}
|
|
5833
|
+
const newNode = injectCSS(css, option);
|
|
5834
|
+
newNode.setAttribute(getMark(option), key);
|
|
5835
|
+
return newNode;
|
|
5836
|
+
}
|
|
5837
|
+
|
|
5838
|
+
// ../../node_modules/@rc-component/util/es/Dom/shadow.js
|
|
5839
|
+
function getRoot(ele) {
|
|
5840
|
+
return ele?.getRootNode?.();
|
|
5841
|
+
}
|
|
5842
|
+
function inShadow(ele) {
|
|
5843
|
+
return getRoot(ele) instanceof ShadowRoot;
|
|
5844
|
+
}
|
|
5845
|
+
function getShadowRoot(ele) {
|
|
5846
|
+
return inShadow(ele) ? getRoot(ele) : null;
|
|
5847
|
+
}
|
|
5848
|
+
|
|
5849
|
+
// ../../node_modules/@rc-component/util/es/warning.js
|
|
5850
|
+
var warned = {};
|
|
5851
|
+
var preWarningFns = [];
|
|
5852
|
+
var preMessage = (fn) => {
|
|
5853
|
+
preWarningFns.push(fn);
|
|
5854
|
+
};
|
|
5855
|
+
function warning(valid, message) {
|
|
5856
|
+
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
5857
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "warning"), message);
|
|
5858
|
+
if (finalMessage) {
|
|
5859
|
+
console.error(`Warning: ${finalMessage}`);
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5863
|
+
function note(valid, message) {
|
|
5864
|
+
if (process.env.NODE_ENV !== "production" && !valid && console !== void 0) {
|
|
5865
|
+
const finalMessage = preWarningFns.reduce((msg, preMessageFn) => preMessageFn(msg ?? "", "note"), message);
|
|
5866
|
+
if (finalMessage) {
|
|
5867
|
+
console.warn(`Note: ${finalMessage}`);
|
|
5868
|
+
}
|
|
5869
|
+
}
|
|
5870
|
+
}
|
|
5871
|
+
function resetWarned() {
|
|
5872
|
+
warned = {};
|
|
5873
|
+
}
|
|
5874
|
+
function call(method, valid, message) {
|
|
5875
|
+
if (!valid && !warned[message]) {
|
|
5876
|
+
method(false, message);
|
|
5877
|
+
warned[message] = true;
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5880
|
+
function warningOnce(valid, message) {
|
|
5881
|
+
call(warning, valid, message);
|
|
5882
|
+
}
|
|
5883
|
+
function noteOnce(valid, message) {
|
|
5884
|
+
call(note, valid, message);
|
|
5885
|
+
}
|
|
5886
|
+
warningOnce.preMessage = preMessage;
|
|
5887
|
+
warningOnce.resetWarned = resetWarned;
|
|
5888
|
+
warningOnce.noteOnce = noteOnce;
|
|
5889
|
+
|
|
5890
|
+
// ../../node_modules/@ant-design/icons/es/utils.js
|
|
5891
|
+
var import_react22 = __toESM(require("react"));
|
|
5892
|
+
function camelCase(input) {
|
|
5893
|
+
return input.replace(/-(.)/g, (match, g) => g.toUpperCase());
|
|
5894
|
+
}
|
|
5895
|
+
function warning2(valid, message) {
|
|
5896
|
+
warningOnce(valid, `[@ant-design/icons] ${message}`);
|
|
5897
|
+
}
|
|
5898
|
+
function isIconDefinition(target) {
|
|
5899
|
+
return typeof target === "object" && typeof target.name === "string" && typeof target.theme === "string" && (typeof target.icon === "object" || typeof target.icon === "function");
|
|
5900
|
+
}
|
|
5901
|
+
function normalizeAttrs(attrs = {}) {
|
|
5902
|
+
return Object.keys(attrs).reduce((acc, key) => {
|
|
5903
|
+
const val = attrs[key];
|
|
5904
|
+
switch (key) {
|
|
5905
|
+
case "class":
|
|
5906
|
+
acc.className = val;
|
|
5907
|
+
delete acc.class;
|
|
5908
|
+
break;
|
|
5909
|
+
default:
|
|
5910
|
+
delete acc[key];
|
|
5911
|
+
acc[camelCase(key)] = val;
|
|
5912
|
+
}
|
|
5913
|
+
return acc;
|
|
5914
|
+
}, {});
|
|
5915
|
+
}
|
|
5916
|
+
function generate2(node, key, rootProps) {
|
|
5917
|
+
if (!rootProps) {
|
|
5918
|
+
return /* @__PURE__ */ import_react22.default.createElement(node.tag, {
|
|
5919
|
+
key,
|
|
5920
|
+
...normalizeAttrs(node.attrs)
|
|
5921
|
+
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
5922
|
+
}
|
|
5923
|
+
return /* @__PURE__ */ import_react22.default.createElement(node.tag, {
|
|
5924
|
+
key,
|
|
5925
|
+
...normalizeAttrs(node.attrs),
|
|
5926
|
+
...rootProps
|
|
5927
|
+
}, (node.children || []).map((child, index) => generate2(child, `${key}-${node.tag}-${index}`)));
|
|
5928
|
+
}
|
|
5929
|
+
function getSecondaryColor(primaryColor) {
|
|
5930
|
+
return generate(primaryColor)[0];
|
|
5931
|
+
}
|
|
5932
|
+
function normalizeTwoToneColors(twoToneColor) {
|
|
5933
|
+
if (!twoToneColor) {
|
|
5934
|
+
return [];
|
|
5935
|
+
}
|
|
5936
|
+
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
5937
|
+
}
|
|
5938
|
+
var iconStyles = `
|
|
5939
|
+
.anticon {
|
|
5940
|
+
display: inline-flex;
|
|
5941
|
+
align-items: center;
|
|
5942
|
+
color: inherit;
|
|
5943
|
+
font-style: normal;
|
|
5944
|
+
line-height: 0;
|
|
5945
|
+
text-align: center;
|
|
5946
|
+
text-transform: none;
|
|
5947
|
+
vertical-align: -0.125em;
|
|
5948
|
+
text-rendering: optimizeLegibility;
|
|
5949
|
+
-webkit-font-smoothing: antialiased;
|
|
5950
|
+
-moz-osx-font-smoothing: grayscale;
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5953
|
+
.anticon > * {
|
|
5954
|
+
line-height: 1;
|
|
5955
|
+
}
|
|
5956
|
+
|
|
5957
|
+
.anticon svg {
|
|
5958
|
+
display: inline-block;
|
|
5959
|
+
vertical-align: inherit;
|
|
5960
|
+
}
|
|
5961
|
+
|
|
5962
|
+
.anticon::before {
|
|
5963
|
+
display: none;
|
|
5964
|
+
}
|
|
5965
|
+
|
|
5966
|
+
.anticon .anticon-icon {
|
|
5967
|
+
display: block;
|
|
5968
|
+
}
|
|
5969
|
+
|
|
5970
|
+
.anticon[tabindex] {
|
|
5971
|
+
cursor: pointer;
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5974
|
+
.anticon-spin::before,
|
|
5975
|
+
.anticon-spin {
|
|
5976
|
+
display: inline-block;
|
|
5977
|
+
-webkit-animation: loadingCircle 1s infinite linear;
|
|
5978
|
+
animation: loadingCircle 1s infinite linear;
|
|
5979
|
+
}
|
|
5980
|
+
|
|
5981
|
+
@-webkit-keyframes loadingCircle {
|
|
5982
|
+
100% {
|
|
5983
|
+
-webkit-transform: rotate(360deg);
|
|
5984
|
+
transform: rotate(360deg);
|
|
5985
|
+
}
|
|
5986
|
+
}
|
|
5987
|
+
|
|
5988
|
+
@keyframes loadingCircle {
|
|
5989
|
+
100% {
|
|
5990
|
+
-webkit-transform: rotate(360deg);
|
|
5991
|
+
transform: rotate(360deg);
|
|
5992
|
+
}
|
|
5993
|
+
}
|
|
5994
|
+
`;
|
|
5995
|
+
var useInsertStyles = (eleRef) => {
|
|
5996
|
+
const {
|
|
5997
|
+
csp,
|
|
5998
|
+
prefixCls,
|
|
5999
|
+
layer
|
|
6000
|
+
} = (0, import_react22.useContext)(Context_default);
|
|
6001
|
+
let mergedStyleStr = iconStyles;
|
|
6002
|
+
if (prefixCls) {
|
|
6003
|
+
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
|
|
6004
|
+
}
|
|
6005
|
+
if (layer) {
|
|
6006
|
+
mergedStyleStr = `@layer ${layer} {
|
|
6007
|
+
${mergedStyleStr}
|
|
6008
|
+
}`;
|
|
6009
|
+
}
|
|
6010
|
+
(0, import_react22.useEffect)(() => {
|
|
6011
|
+
const ele = eleRef.current;
|
|
6012
|
+
const shadowRoot = getShadowRoot(ele);
|
|
6013
|
+
updateCSS(mergedStyleStr, "@ant-design-icons", {
|
|
6014
|
+
prepend: !layer,
|
|
6015
|
+
csp,
|
|
6016
|
+
attachTo: shadowRoot
|
|
6017
|
+
});
|
|
6018
|
+
}, []);
|
|
6019
|
+
};
|
|
6020
|
+
|
|
6021
|
+
// ../../node_modules/@ant-design/icons/es/components/IconBase.js
|
|
6022
|
+
var twoToneColorPalette = {
|
|
6023
|
+
primaryColor: "#333",
|
|
6024
|
+
secondaryColor: "#E6E6E6",
|
|
6025
|
+
calculated: false
|
|
6026
|
+
};
|
|
6027
|
+
function setTwoToneColors({
|
|
6028
|
+
primaryColor,
|
|
6029
|
+
secondaryColor
|
|
6030
|
+
}) {
|
|
6031
|
+
twoToneColorPalette.primaryColor = primaryColor;
|
|
6032
|
+
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
6033
|
+
twoToneColorPalette.calculated = !!secondaryColor;
|
|
6034
|
+
}
|
|
6035
|
+
function getTwoToneColors() {
|
|
6036
|
+
return {
|
|
6037
|
+
...twoToneColorPalette
|
|
6038
|
+
};
|
|
6039
|
+
}
|
|
6040
|
+
var IconBase = (props) => {
|
|
6041
|
+
const {
|
|
6042
|
+
icon,
|
|
6043
|
+
className,
|
|
6044
|
+
onClick,
|
|
6045
|
+
style,
|
|
6046
|
+
primaryColor,
|
|
6047
|
+
secondaryColor,
|
|
6048
|
+
...restProps
|
|
6049
|
+
} = props;
|
|
6050
|
+
const svgRef = React13.useRef(null);
|
|
6051
|
+
let colors = twoToneColorPalette;
|
|
6052
|
+
if (primaryColor) {
|
|
6053
|
+
colors = {
|
|
6054
|
+
primaryColor,
|
|
6055
|
+
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
6056
|
+
};
|
|
6057
|
+
}
|
|
6058
|
+
useInsertStyles(svgRef);
|
|
6059
|
+
warning2(isIconDefinition(icon), `icon should be icon definiton, but got ${icon}`);
|
|
6060
|
+
if (!isIconDefinition(icon)) {
|
|
6061
|
+
return null;
|
|
6062
|
+
}
|
|
6063
|
+
let target = icon;
|
|
6064
|
+
if (target && typeof target.icon === "function") {
|
|
6065
|
+
target = {
|
|
6066
|
+
...target,
|
|
6067
|
+
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
6068
|
+
};
|
|
6069
|
+
}
|
|
6070
|
+
return generate2(target.icon, `svg-${target.name}`, {
|
|
6071
|
+
className,
|
|
6072
|
+
onClick,
|
|
6073
|
+
style,
|
|
6074
|
+
"data-icon": target.name,
|
|
6075
|
+
width: "1em",
|
|
6076
|
+
height: "1em",
|
|
6077
|
+
fill: "currentColor",
|
|
6078
|
+
"aria-hidden": "true",
|
|
6079
|
+
...restProps,
|
|
6080
|
+
ref: svgRef
|
|
6081
|
+
});
|
|
6082
|
+
};
|
|
6083
|
+
IconBase.displayName = "IconReact";
|
|
6084
|
+
IconBase.getTwoToneColors = getTwoToneColors;
|
|
6085
|
+
IconBase.setTwoToneColors = setTwoToneColors;
|
|
6086
|
+
var IconBase_default = IconBase;
|
|
6087
|
+
|
|
6088
|
+
// ../../node_modules/@ant-design/icons/es/components/twoTonePrimaryColor.js
|
|
6089
|
+
function setTwoToneColor(twoToneColor) {
|
|
6090
|
+
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
6091
|
+
return IconBase_default.setTwoToneColors({
|
|
6092
|
+
primaryColor,
|
|
6093
|
+
secondaryColor
|
|
6094
|
+
});
|
|
6095
|
+
}
|
|
6096
|
+
function getTwoToneColor() {
|
|
6097
|
+
const colors = IconBase_default.getTwoToneColors();
|
|
6098
|
+
if (!colors.calculated) {
|
|
6099
|
+
return colors.primaryColor;
|
|
6100
|
+
}
|
|
6101
|
+
return [colors.primaryColor, colors.secondaryColor];
|
|
6102
|
+
}
|
|
6103
|
+
|
|
6104
|
+
// ../../node_modules/@ant-design/icons/es/components/AntdIcon.js
|
|
6105
|
+
function _extends() {
|
|
6106
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
6107
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6108
|
+
var source = arguments[i];
|
|
6109
|
+
for (var key in source) {
|
|
6110
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6111
|
+
target[key] = source[key];
|
|
6112
|
+
}
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6115
|
+
return target;
|
|
6116
|
+
};
|
|
6117
|
+
return _extends.apply(this, arguments);
|
|
6118
|
+
}
|
|
6119
|
+
setTwoToneColor(blue.primary);
|
|
6120
|
+
var Icon = /* @__PURE__ */ React14.forwardRef((props, ref) => {
|
|
6121
|
+
const {
|
|
6122
|
+
// affect outter <i>...</i>
|
|
6123
|
+
className,
|
|
6124
|
+
// affect inner <svg>...</svg>
|
|
6125
|
+
icon,
|
|
6126
|
+
spin,
|
|
6127
|
+
rotate,
|
|
6128
|
+
tabIndex,
|
|
6129
|
+
onClick,
|
|
6130
|
+
// other
|
|
6131
|
+
twoToneColor,
|
|
6132
|
+
...restProps
|
|
6133
|
+
} = props;
|
|
6134
|
+
const {
|
|
6135
|
+
prefixCls = "anticon",
|
|
6136
|
+
rootClassName
|
|
6137
|
+
} = React14.useContext(Context_default);
|
|
6138
|
+
const classString = (0, import_clsx2.clsx)(rootClassName, prefixCls, {
|
|
6139
|
+
[`${prefixCls}-${icon.name}`]: !!icon.name,
|
|
6140
|
+
[`${prefixCls}-spin`]: !!spin || icon.name === "loading"
|
|
6141
|
+
}, className);
|
|
6142
|
+
let iconTabIndex = tabIndex;
|
|
6143
|
+
if (iconTabIndex === void 0 && onClick) {
|
|
6144
|
+
iconTabIndex = -1;
|
|
6145
|
+
}
|
|
6146
|
+
const svgStyle = rotate ? {
|
|
6147
|
+
msTransform: `rotate(${rotate}deg)`,
|
|
6148
|
+
transform: `rotate(${rotate}deg)`
|
|
6149
|
+
} : void 0;
|
|
6150
|
+
const [primaryColor, secondaryColor] = normalizeTwoToneColors(twoToneColor);
|
|
6151
|
+
return /* @__PURE__ */ React14.createElement("span", _extends({
|
|
6152
|
+
role: "img",
|
|
6153
|
+
"aria-label": icon.name
|
|
6154
|
+
}, restProps, {
|
|
6155
|
+
ref,
|
|
6156
|
+
tabIndex: iconTabIndex,
|
|
6157
|
+
onClick,
|
|
6158
|
+
className: classString
|
|
6159
|
+
}), /* @__PURE__ */ React14.createElement(IconBase_default, {
|
|
6160
|
+
icon,
|
|
6161
|
+
primaryColor,
|
|
6162
|
+
secondaryColor,
|
|
6163
|
+
style: svgStyle
|
|
6164
|
+
}));
|
|
6165
|
+
});
|
|
6166
|
+
Icon.getTwoToneColor = getTwoToneColor;
|
|
6167
|
+
Icon.setTwoToneColor = setTwoToneColor;
|
|
6168
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6169
|
+
Icon.displayName = "AntdIcon";
|
|
6170
|
+
}
|
|
6171
|
+
var AntdIcon_default = Icon;
|
|
6172
|
+
|
|
6173
|
+
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
6174
|
+
var React15 = __toESM(require("react"));
|
|
6175
|
+
|
|
6176
|
+
// ../../node_modules/@ant-design/icons-svg/es/asn/PlusOutlined.js
|
|
6177
|
+
var PlusOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
6178
|
+
var PlusOutlined_default = PlusOutlined;
|
|
6179
|
+
|
|
6180
|
+
// ../../node_modules/@ant-design/icons/es/icons/PlusOutlined.js
|
|
6181
|
+
function _extends2() {
|
|
6182
|
+
_extends2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
6183
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
6184
|
+
var source = arguments[i];
|
|
6185
|
+
for (var key in source) {
|
|
6186
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
6187
|
+
target[key] = source[key];
|
|
6188
|
+
}
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
return target;
|
|
6192
|
+
};
|
|
6193
|
+
return _extends2.apply(this, arguments);
|
|
6194
|
+
}
|
|
6195
|
+
var PlusOutlined2 = (props, ref) => /* @__PURE__ */ React15.createElement(AntdIcon_default, _extends2({}, props, {
|
|
6196
|
+
ref,
|
|
6197
|
+
icon: PlusOutlined_default
|
|
6198
|
+
}));
|
|
6199
|
+
var RefIcon = /* @__PURE__ */ React15.forwardRef(PlusOutlined2);
|
|
6200
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6201
|
+
RefIcon.displayName = "PlusOutlined";
|
|
6202
|
+
}
|
|
6203
|
+
var PlusOutlined_default2 = RefIcon;
|
|
6204
|
+
|
|
6205
|
+
// src/hooks/uploads/useAntdImageUpload.tsx
|
|
6206
|
+
var import_antd2 = require("antd");
|
|
6207
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6208
|
+
var getBase64 = (file) => new Promise((resolve, reject) => {
|
|
6209
|
+
const reader = new FileReader();
|
|
6210
|
+
reader.readAsDataURL(file);
|
|
6211
|
+
reader.onload = () => resolve(reader.result);
|
|
6212
|
+
reader.onerror = (error) => reject(error);
|
|
6213
|
+
});
|
|
6214
|
+
var useAntdImageUpload = ({ length = 1 }) => {
|
|
6215
|
+
const [fileList, setFileList] = (0, import_react23.useState)([]);
|
|
6216
|
+
const [previewOpen, setPreviewOpen] = (0, import_react23.useState)(false);
|
|
6217
|
+
const [previewImage, setPreviewImage] = (0, import_react23.useState)("");
|
|
6218
|
+
const handlePreview = async (file) => {
|
|
6219
|
+
if (!file.url && !file.preview) {
|
|
6220
|
+
file.preview = await getBase64(file.originFileObj);
|
|
6221
|
+
}
|
|
6222
|
+
setPreviewImage(file.url || file.preview);
|
|
6223
|
+
setPreviewOpen(true);
|
|
6224
|
+
};
|
|
6225
|
+
const handleChange = ({ fileList: newFileList }) => {
|
|
6226
|
+
setFileList(
|
|
6227
|
+
newFileList.map((f) => ({
|
|
6228
|
+
...f,
|
|
6229
|
+
status: "done"
|
|
6230
|
+
// mark done immediately
|
|
6231
|
+
}))
|
|
6232
|
+
);
|
|
6233
|
+
};
|
|
6234
|
+
const ImageBox = () => /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
6235
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6236
|
+
import_antd2.Upload,
|
|
6237
|
+
{
|
|
6238
|
+
listType: "picture-card",
|
|
6239
|
+
fileList,
|
|
6240
|
+
onPreview: handlePreview,
|
|
6241
|
+
onChange: handleChange,
|
|
6242
|
+
beforeUpload: () => false,
|
|
6243
|
+
children: fileList.length >= length ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("button", { style: { border: 0, background: "none" }, type: "button", children: [
|
|
6244
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PlusOutlined_default2, {}),
|
|
6245
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { style: { marginTop: 8 }, children: "Upload" })
|
|
6246
|
+
] })
|
|
6247
|
+
}
|
|
6248
|
+
),
|
|
6249
|
+
previewImage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
6250
|
+
import_antd2.Image,
|
|
6251
|
+
{
|
|
6252
|
+
style: { display: "none" },
|
|
6253
|
+
preview: {
|
|
6254
|
+
visible: previewOpen,
|
|
6255
|
+
onVisibleChange: (visible) => setPreviewOpen(visible),
|
|
6256
|
+
afterOpenChange: (visible) => !visible && setPreviewImage("")
|
|
6257
|
+
},
|
|
6258
|
+
src: previewImage
|
|
6259
|
+
}
|
|
6260
|
+
)
|
|
6261
|
+
] });
|
|
6262
|
+
return { ImageBox, fileList, setFileList };
|
|
6263
|
+
};
|
|
6264
|
+
var useAntdImageUpload_default = useAntdImageUpload;
|
|
4846
6265
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4847
6266
|
0 && (module.exports = {
|
|
4848
6267
|
Badge,
|
|
@@ -4887,6 +6306,7 @@ var storage = {
|
|
|
4887
6306
|
generatePdf,
|
|
4888
6307
|
storage,
|
|
4889
6308
|
useA4StatementView,
|
|
6309
|
+
useAntdImageUpload,
|
|
4890
6310
|
useApi,
|
|
4891
6311
|
useModal,
|
|
4892
6312
|
useSearchApiContext,
|