next-recomponents 2.0.1 → 2.0.3
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 +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +711 -635
- package/dist/index.mjs +661 -585
- package/package.json +1 -1
- package/src/alert/index.tsx +145 -23
- package/src/index.tsx +1 -1
- package/src/table/index.tsx +46 -29
- package/tsconfig.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
38
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
39
10
|
};
|
|
@@ -1543,9 +1514,10 @@ var require_route_pattern_normalizer = __commonJS({
|
|
|
1543
1514
|
"prefix" in token && "suffix" in token && // Both prefix and suffix must be empty strings
|
|
1544
1515
|
// This is what causes the validation error in path-to-regexp
|
|
1545
1516
|
token.prefix === "" && token.suffix === "") {
|
|
1546
|
-
return
|
|
1517
|
+
return {
|
|
1518
|
+
...token,
|
|
1547
1519
|
prefix: "/"
|
|
1548
|
-
}
|
|
1520
|
+
};
|
|
1549
1521
|
}
|
|
1550
1522
|
return token;
|
|
1551
1523
|
});
|
|
@@ -1637,9 +1609,10 @@ var require_route_match_utils = __commonJS({
|
|
|
1637
1609
|
return (pathname) => {
|
|
1638
1610
|
const result = originalMatcher(pathname);
|
|
1639
1611
|
if (!result) return false;
|
|
1640
|
-
return
|
|
1612
|
+
return {
|
|
1613
|
+
...result,
|
|
1641
1614
|
params: (0, _routepatternnormalizer.stripParameterSeparators)(result.params)
|
|
1642
|
-
}
|
|
1615
|
+
};
|
|
1643
1616
|
};
|
|
1644
1617
|
}
|
|
1645
1618
|
function safeRouteMatcher(matcherFn) {
|
|
@@ -2003,7 +1976,8 @@ var require_constants = __commonJS({
|
|
|
2003
1976
|
*/
|
|
2004
1977
|
pagesDirNode: "pages-dir-node"
|
|
2005
1978
|
};
|
|
2006
|
-
var WEBPACK_LAYERS =
|
|
1979
|
+
var WEBPACK_LAYERS = {
|
|
1980
|
+
...WEBPACK_LAYERS_NAMES,
|
|
2007
1981
|
GROUP: {
|
|
2008
1982
|
builtinReact: [
|
|
2009
1983
|
WEBPACK_LAYERS_NAMES.reactServerComponents,
|
|
@@ -2041,7 +2015,7 @@ var require_constants = __commonJS({
|
|
|
2041
2015
|
WEBPACK_LAYERS_NAMES.actionBrowser
|
|
2042
2016
|
]
|
|
2043
2017
|
}
|
|
2044
|
-
}
|
|
2018
|
+
};
|
|
2045
2019
|
var WEBPACK_RESOURCE_QUERIES = {
|
|
2046
2020
|
edgeSSREntry: "__next_edge_ssr_entry__",
|
|
2047
2021
|
metadata: "__next_metadata__",
|
|
@@ -2363,10 +2337,11 @@ var require_route_regex = __commonJS({
|
|
|
2363
2337
|
if (!options.excludeOptionalTrailingSlash) {
|
|
2364
2338
|
namedRegex += "(?:/)?";
|
|
2365
2339
|
}
|
|
2366
|
-
return
|
|
2340
|
+
return {
|
|
2341
|
+
...getRouteRegex(normalizedRoute, options),
|
|
2367
2342
|
namedRegex: "^" + namedRegex + "$",
|
|
2368
2343
|
routeKeys: result.routeKeys
|
|
2369
|
-
}
|
|
2344
|
+
};
|
|
2370
2345
|
}
|
|
2371
2346
|
function getNamedMiddlewareRegex(normalizedRoute, options) {
|
|
2372
2347
|
const { parameterizedRoute } = getParametrizedRoute(normalizedRoute, false, false);
|
|
@@ -3211,7 +3186,7 @@ var require_link = __commonJS({
|
|
|
3211
3186
|
}
|
|
3212
3187
|
var Link2 = /* @__PURE__ */ _react.default.forwardRef(function LinkComponent(props, forwardedRef) {
|
|
3213
3188
|
let children;
|
|
3214
|
-
const
|
|
3189
|
+
const { href: hrefProp, as: asProp, children: childrenProp, prefetch: prefetchProp = null, passHref, replace, shallow, scroll, locale, onClick, onNavigate, onMouseEnter: onMouseEnterProp, onTouchStart: onTouchStartProp, legacyBehavior = false, ...restProps } = props;
|
|
3215
3190
|
children = childrenProp;
|
|
3216
3191
|
if (legacyBehavior && (typeof children === "string" || typeof children === "number")) {
|
|
3217
3192
|
children = /* @__PURE__ */ (0, _jsxruntime.jsx)("a", {
|
|
@@ -3480,9 +3455,11 @@ var require_link = __commonJS({
|
|
|
3480
3455
|
}
|
|
3481
3456
|
return /* @__PURE__ */ _react.default.cloneElement(child, childProps);
|
|
3482
3457
|
}
|
|
3483
|
-
return /* @__PURE__ */ (0, _jsxruntime.jsx)("a",
|
|
3458
|
+
return /* @__PURE__ */ (0, _jsxruntime.jsx)("a", {
|
|
3459
|
+
...restProps,
|
|
3460
|
+
...childProps,
|
|
3484
3461
|
children
|
|
3485
|
-
})
|
|
3462
|
+
});
|
|
3486
3463
|
});
|
|
3487
3464
|
var LinkStatusContext = /* @__PURE__ */ (0, _react.createContext)({
|
|
3488
3465
|
// We do not support link status in the Pages Router, so we always return false
|
|
@@ -3511,7 +3488,6 @@ var require_link2 = __commonJS({
|
|
|
3511
3488
|
// src/index.tsx
|
|
3512
3489
|
var index_exports = {};
|
|
3513
3490
|
__export(index_exports, {
|
|
3514
|
-
Alert: () => Alert,
|
|
3515
3491
|
Button: () => Button,
|
|
3516
3492
|
Container: () => Container,
|
|
3517
3493
|
DocumentViewer: () => DocumentViewer,
|
|
@@ -3528,10 +3504,14 @@ __export(index_exports, {
|
|
|
3528
3504
|
useDates: () => useDates,
|
|
3529
3505
|
useExcel: () => useExcel,
|
|
3530
3506
|
useFormValues: () => useFormValues,
|
|
3507
|
+
usePopup: () => alert_default,
|
|
3531
3508
|
useResources: () => useResources
|
|
3532
3509
|
});
|
|
3533
3510
|
module.exports = __toCommonJS(index_exports);
|
|
3534
3511
|
|
|
3512
|
+
// src/button/index.tsx
|
|
3513
|
+
var import_react = require("react");
|
|
3514
|
+
|
|
3535
3515
|
// src/button/colors.tsx
|
|
3536
3516
|
var catColor = {
|
|
3537
3517
|
white: "bg-white text-black",
|
|
@@ -3543,65 +3523,37 @@ var catColor = {
|
|
|
3543
3523
|
success: "bg-green-500 text-white"
|
|
3544
3524
|
};
|
|
3545
3525
|
|
|
3546
|
-
// src/alert/index.tsx
|
|
3547
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3548
|
-
function Alert(_a) {
|
|
3549
|
-
var _b = _a, {
|
|
3550
|
-
color = "primary",
|
|
3551
|
-
children
|
|
3552
|
-
} = _b, props = __objRest(_b, [
|
|
3553
|
-
"color",
|
|
3554
|
-
"children"
|
|
3555
|
-
]);
|
|
3556
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3557
|
-
"div",
|
|
3558
|
-
__spreadProps(__spreadValues({
|
|
3559
|
-
className: [catColor[color], "p-2 rounded shadow border"].join(" ")
|
|
3560
|
-
}, props), {
|
|
3561
|
-
children
|
|
3562
|
-
})
|
|
3563
|
-
);
|
|
3564
|
-
}
|
|
3565
|
-
|
|
3566
3526
|
// src/button/index.tsx
|
|
3567
|
-
var
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
} = _b, props = __objRest(_b, [
|
|
3579
|
-
"className",
|
|
3580
|
-
"size",
|
|
3581
|
-
"color",
|
|
3582
|
-
"children",
|
|
3583
|
-
"icon",
|
|
3584
|
-
"disabled",
|
|
3585
|
-
"full"
|
|
3586
|
-
]);
|
|
3527
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
3528
|
+
function Button({
|
|
3529
|
+
className,
|
|
3530
|
+
size = "small",
|
|
3531
|
+
color = "primary",
|
|
3532
|
+
children,
|
|
3533
|
+
icon,
|
|
3534
|
+
disabled,
|
|
3535
|
+
full = false,
|
|
3536
|
+
...props
|
|
3537
|
+
}) {
|
|
3587
3538
|
const [isLoading, setIsloading] = (0, import_react.useState)(false);
|
|
3588
|
-
return /* @__PURE__ */ (0,
|
|
3539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
3589
3540
|
"button",
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3541
|
+
{
|
|
3542
|
+
...Object.assign(
|
|
3543
|
+
{},
|
|
3544
|
+
...Object.keys(props).map((prop) => {
|
|
3545
|
+
const originalHandler = props[prop];
|
|
3546
|
+
const newProp = { [prop]: originalHandler };
|
|
3547
|
+
if (prop.startsWith("on") && typeof originalHandler === "function") {
|
|
3548
|
+
newProp[prop] = async (e) => {
|
|
3549
|
+
setIsloading(true);
|
|
3550
|
+
originalHandler && await originalHandler(e);
|
|
3551
|
+
setIsloading(false);
|
|
3552
|
+
};
|
|
3553
|
+
}
|
|
3554
|
+
return newProp;
|
|
3555
|
+
})
|
|
3556
|
+
),
|
|
3605
3557
|
className: [
|
|
3606
3558
|
className,
|
|
3607
3559
|
"p-2 border shadow rounded flex gap-1 justify-center items-center",
|
|
@@ -3613,7 +3565,7 @@ function Button(_a) {
|
|
|
3613
3565
|
icon,
|
|
3614
3566
|
children
|
|
3615
3567
|
]
|
|
3616
|
-
}
|
|
3568
|
+
}
|
|
3617
3569
|
);
|
|
3618
3570
|
}
|
|
3619
3571
|
|
|
@@ -3621,9 +3573,9 @@ function Button(_a) {
|
|
|
3621
3573
|
var import_react2 = require("react");
|
|
3622
3574
|
|
|
3623
3575
|
// src/container/icons.tsx
|
|
3624
|
-
var
|
|
3576
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
3625
3577
|
function MenuIcon() {
|
|
3626
|
-
return /* @__PURE__ */ (0,
|
|
3578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3627
3579
|
"svg",
|
|
3628
3580
|
{
|
|
3629
3581
|
stroke: "currentColor",
|
|
@@ -3633,12 +3585,12 @@ function MenuIcon() {
|
|
|
3633
3585
|
height: "20px",
|
|
3634
3586
|
width: "20px",
|
|
3635
3587
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3636
|
-
children: /* @__PURE__ */ (0,
|
|
3588
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M32 96v64h448V96H32zm0 128v64h448v-64H32zm0 128v64h448v-64H32z" })
|
|
3637
3589
|
}
|
|
3638
3590
|
);
|
|
3639
3591
|
}
|
|
3640
3592
|
function HomeIcon() {
|
|
3641
|
-
return /* @__PURE__ */ (0,
|
|
3593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3642
3594
|
"svg",
|
|
3643
3595
|
{
|
|
3644
3596
|
stroke: "currentColor",
|
|
@@ -3648,12 +3600,12 @@ function HomeIcon() {
|
|
|
3648
3600
|
height: "20px",
|
|
3649
3601
|
width: "20px",
|
|
3650
3602
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3651
|
-
children: /* @__PURE__ */ (0,
|
|
3603
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z" })
|
|
3652
3604
|
}
|
|
3653
3605
|
);
|
|
3654
3606
|
}
|
|
3655
3607
|
function ArrowUpIcon() {
|
|
3656
|
-
return /* @__PURE__ */ (0,
|
|
3608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3657
3609
|
"svg",
|
|
3658
3610
|
{
|
|
3659
3611
|
stroke: "currentColor",
|
|
@@ -3665,12 +3617,12 @@ function ArrowUpIcon() {
|
|
|
3665
3617
|
height: "20px",
|
|
3666
3618
|
width: "20px",
|
|
3667
3619
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3668
|
-
children: /* @__PURE__ */ (0,
|
|
3620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M18.2 13.3l-6.2-6.3-6.2 6.3c-.2.2-.3.5-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7z" })
|
|
3669
3621
|
}
|
|
3670
3622
|
);
|
|
3671
3623
|
}
|
|
3672
3624
|
function ArrowDownIcon() {
|
|
3673
|
-
return /* @__PURE__ */ (0,
|
|
3625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3674
3626
|
"svg",
|
|
3675
3627
|
{
|
|
3676
3628
|
stroke: "currentColor",
|
|
@@ -3682,14 +3634,14 @@ function ArrowDownIcon() {
|
|
|
3682
3634
|
height: "20px",
|
|
3683
3635
|
width: "20px",
|
|
3684
3636
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3685
|
-
children: /* @__PURE__ */ (0,
|
|
3637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M5.8 9.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.4-.3.7s.1.5.3.7z" })
|
|
3686
3638
|
}
|
|
3687
3639
|
);
|
|
3688
3640
|
}
|
|
3689
3641
|
|
|
3690
3642
|
// src/container/index.tsx
|
|
3691
3643
|
var import_link = __toESM(require_link2());
|
|
3692
|
-
var
|
|
3644
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3693
3645
|
function Container({
|
|
3694
3646
|
children,
|
|
3695
3647
|
appName,
|
|
@@ -3713,10 +3665,10 @@ function Container({
|
|
|
3713
3665
|
}
|
|
3714
3666
|
}
|
|
3715
3667
|
}, []);
|
|
3716
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-col h-screen", children: [
|
|
3669
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("header", { className: "z-40", children: [
|
|
3670
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "bg-blue-600 text-white p-4 flex justify-between items-center shadow-md", children: [
|
|
3671
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3720
3672
|
"button",
|
|
3721
3673
|
{
|
|
3722
3674
|
onClick: () => {
|
|
@@ -3724,20 +3676,20 @@ function Container({
|
|
|
3724
3676
|
handleClick(!isSidebarOpen);
|
|
3725
3677
|
},
|
|
3726
3678
|
className: "bg-blue-600 text-white px-2 py-1 rounded-r",
|
|
3727
|
-
children: /* @__PURE__ */ (0,
|
|
3679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuIcon, {})
|
|
3728
3680
|
}
|
|
3729
3681
|
),
|
|
3730
|
-
/* @__PURE__ */ (0,
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "text-xl font-bold", children: appName })
|
|
3731
3683
|
] }),
|
|
3732
|
-
/* @__PURE__ */ (0,
|
|
3684
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3733
3685
|
"div",
|
|
3734
3686
|
{
|
|
3735
3687
|
className: ` gap-2 bg-blue-400 text-white ${isSidebarOpen ? "px-[270px]" : "px-[60px]"} hidden sm:flex`,
|
|
3736
|
-
children: navItems && /* @__PURE__ */ (0,
|
|
3737
|
-
{ location: "/", name: "Home", icon: /* @__PURE__ */ (0,
|
|
3688
|
+
children: navItems && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: [
|
|
3689
|
+
{ location: "/", name: "Home", icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HomeIcon, {}) },
|
|
3738
3690
|
...navItems
|
|
3739
3691
|
].map((li, k) => {
|
|
3740
|
-
return li && /* @__PURE__ */ (0,
|
|
3692
|
+
return li && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3741
3693
|
import_link.default,
|
|
3742
3694
|
{
|
|
3743
3695
|
href: li.location,
|
|
@@ -3753,16 +3705,16 @@ function Container({
|
|
|
3753
3705
|
}
|
|
3754
3706
|
)
|
|
3755
3707
|
] }),
|
|
3756
|
-
/* @__PURE__ */ (0,
|
|
3757
|
-
/* @__PURE__ */ (0,
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex flex-1 overflow-hidden relative", children: [
|
|
3709
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3758
3710
|
"div",
|
|
3759
3711
|
{
|
|
3760
3712
|
style: {
|
|
3761
3713
|
width: typeof window !== "undefined" && (window == null ? void 0 : window.innerWidth) < 768 ? isSidebarOpen ? "100%" : 0 : isSidebarOpen ? 250 : 60
|
|
3762
3714
|
},
|
|
3763
3715
|
className: "bg-blue-500 text-white overflow-y-auto fixed md:static top-0 left-0 h-full z-50 md:z-auto transition-all duration-300 ease-in-out",
|
|
3764
|
-
children: /* @__PURE__ */ (0,
|
|
3765
|
-
/* @__PURE__ */ (0,
|
|
3716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "p-4 ", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("ul", { className: "space-y-3", children: [
|
|
3717
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3766
3718
|
"li",
|
|
3767
3719
|
{
|
|
3768
3720
|
className: "p-2 md:hidden flex items-center justify-between font-bold",
|
|
@@ -3771,7 +3723,7 @@ function Container({
|
|
|
3771
3723
|
handleClick(false);
|
|
3772
3724
|
},
|
|
3773
3725
|
children: [
|
|
3774
|
-
/* @__PURE__ */ (0,
|
|
3726
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuIcon, {}),
|
|
3775
3727
|
" ",
|
|
3776
3728
|
appName
|
|
3777
3729
|
]
|
|
@@ -3780,17 +3732,17 @@ function Container({
|
|
|
3780
3732
|
),
|
|
3781
3733
|
menuList && menuList.map((itemMenu, k) => {
|
|
3782
3734
|
const letra = `${itemMenu == null ? void 0 : itemMenu.name}`.split("")[0];
|
|
3783
|
-
const icon = /* @__PURE__ */ (0,
|
|
3784
|
-
return /* @__PURE__ */ (0,
|
|
3735
|
+
const icon = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: (itemMenu == null ? void 0 : itemMenu.icon) || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "px-1 border shadow rounded", children: letra }) });
|
|
3736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
3785
3737
|
import_link.default,
|
|
3786
3738
|
{
|
|
3787
3739
|
href: (itemMenu == null ? void 0 : itemMenu.location) || "#",
|
|
3788
3740
|
children: [
|
|
3789
|
-
isSidebarOpen && /* @__PURE__ */ (0,
|
|
3741
|
+
isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "text-sm flex p-1 gap-1 items-center hover:bg-gray-200 hover:text-black rounded", children: [
|
|
3790
3742
|
icon,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3743
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: " truncate", children: itemMenu == null ? void 0 : itemMenu.name })
|
|
3792
3744
|
] }),
|
|
3793
|
-
!isSidebarOpen && /* @__PURE__ */ (0,
|
|
3745
|
+
!isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-sm hover:bg-gray-200 hover:text-black rounded p-1", children: icon })
|
|
3794
3746
|
]
|
|
3795
3747
|
}
|
|
3796
3748
|
) }, k);
|
|
@@ -3798,7 +3750,7 @@ function Container({
|
|
|
3798
3750
|
] }) })
|
|
3799
3751
|
}
|
|
3800
3752
|
),
|
|
3801
|
-
isSidebarOpen && typeof window !== "undefined" && window.innerWidth < 768 && /* @__PURE__ */ (0,
|
|
3753
|
+
isSidebarOpen && typeof window !== "undefined" && window.innerWidth < 768 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3802
3754
|
"div",
|
|
3803
3755
|
{
|
|
3804
3756
|
className: "fixed inset-0 bg-black bg-opacity-40 z-40",
|
|
@@ -3808,21 +3760,21 @@ function Container({
|
|
|
3808
3760
|
}
|
|
3809
3761
|
}
|
|
3810
3762
|
),
|
|
3811
|
-
/* @__PURE__ */ (0,
|
|
3812
|
-
leftPanel && /* @__PURE__ */ (0,
|
|
3813
|
-
/* @__PURE__ */ (0,
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("main", { className: "flex-1 overflow-auto p-4 bg-gray-100 z-10 md:ml-0 ", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex md:flex-row flex-col h-full gap-4 ", children: [
|
|
3764
|
+
leftPanel && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("aside", { className: "w-full md:w-64 flex-shrink-0 text-xs text-blue-600 bg-gray-200 p-5 border rounded", children: leftPanel }),
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("section", { className: "flex-1", children })
|
|
3814
3766
|
] }) })
|
|
3815
3767
|
] }),
|
|
3816
|
-
footPanel && /* @__PURE__ */ (0,
|
|
3817
|
-
/* @__PURE__ */ (0,
|
|
3768
|
+
footPanel && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "bg-blue-100 overflow-hidden ", children: [
|
|
3769
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex justify-center items-center p-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3818
3770
|
"button",
|
|
3819
3771
|
{
|
|
3820
3772
|
onClick: () => setIsFooterOpen(!isFooterOpen),
|
|
3821
3773
|
className: "text-blue-700",
|
|
3822
|
-
children: isFooterOpen ? /* @__PURE__ */ (0,
|
|
3774
|
+
children: isFooterOpen ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowDownIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ArrowUpIcon, {})
|
|
3823
3775
|
}
|
|
3824
3776
|
) }),
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3826
3778
|
"div",
|
|
3827
3779
|
{
|
|
3828
3780
|
style: isFooterOpen ? { maxHeight: "500px" } : { maxHeight: "0px" },
|
|
@@ -3836,33 +3788,27 @@ function Container({
|
|
|
3836
3788
|
|
|
3837
3789
|
// src/form/index.tsx
|
|
3838
3790
|
var import_react3 = __toESM(require("react"));
|
|
3839
|
-
var
|
|
3791
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
3840
3792
|
function useFormValues(initial) {
|
|
3841
3793
|
const reducer = (state, action) => {
|
|
3842
|
-
return
|
|
3794
|
+
return { ...state, ...action };
|
|
3843
3795
|
};
|
|
3844
3796
|
return (0, import_react3.useReducer)(reducer, initial);
|
|
3845
3797
|
}
|
|
3846
|
-
function Form(
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
"onSubmit",
|
|
3855
|
-
"state",
|
|
3856
|
-
"invalidMessage",
|
|
3857
|
-
"children",
|
|
3858
|
-
"loader"
|
|
3859
|
-
]);
|
|
3798
|
+
function Form({
|
|
3799
|
+
onSubmit,
|
|
3800
|
+
state,
|
|
3801
|
+
invalidMessage = "Existen valores inv\xE1lidos en el formulario",
|
|
3802
|
+
children,
|
|
3803
|
+
loader = "Loading...",
|
|
3804
|
+
...otherProps
|
|
3805
|
+
}) {
|
|
3860
3806
|
const [isLoading, setIsLoading] = (0, import_react3.useState)(false);
|
|
3861
3807
|
const ref = (0, import_react3.useRef)(null);
|
|
3862
3808
|
const [hvalues, setHValues] = state || (0, import_react3.useState)({});
|
|
3863
3809
|
(0, import_react3.useEffect)(() => {
|
|
3864
3810
|
if (ref == null ? void 0 : ref.current) {
|
|
3865
|
-
const newValues =
|
|
3811
|
+
const newValues = { ...hvalues };
|
|
3866
3812
|
const formData = new FormData(ref.current);
|
|
3867
3813
|
for (let [k, v] of formData.entries()) {
|
|
3868
3814
|
if (!newValues[k]) {
|
|
@@ -3875,16 +3821,17 @@ function Form(_a) {
|
|
|
3875
3821
|
}
|
|
3876
3822
|
}, [state, ref]);
|
|
3877
3823
|
function hasErrors() {
|
|
3878
|
-
var
|
|
3879
|
-
const hasInvalids = (
|
|
3824
|
+
var _a;
|
|
3825
|
+
const hasInvalids = (_a = ref == null ? void 0 : ref.current) == null ? void 0 : _a.querySelectorAll(".invalid");
|
|
3880
3826
|
if (hasInvalids && (hasInvalids == null ? void 0 : hasInvalids.length) > 0) {
|
|
3881
3827
|
return true;
|
|
3882
3828
|
}
|
|
3883
3829
|
return false;
|
|
3884
3830
|
}
|
|
3885
|
-
return /* @__PURE__ */ (0,
|
|
3831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3886
3832
|
"form",
|
|
3887
|
-
|
|
3833
|
+
{
|
|
3834
|
+
...otherProps,
|
|
3888
3835
|
ref,
|
|
3889
3836
|
onSubmit: async (e) => {
|
|
3890
3837
|
e.preventDefault();
|
|
@@ -3894,19 +3841,19 @@ function Form(_a) {
|
|
|
3894
3841
|
}
|
|
3895
3842
|
if (onSubmit) {
|
|
3896
3843
|
setIsLoading(true);
|
|
3897
|
-
await onSubmit(
|
|
3844
|
+
await onSubmit({ ...e, values: hvalues });
|
|
3898
3845
|
setIsLoading(false);
|
|
3899
3846
|
}
|
|
3900
3847
|
},
|
|
3901
3848
|
children: [
|
|
3902
3849
|
import_react3.default.Children.map(children, (child) => {
|
|
3903
3850
|
if (import_react3.default.isValidElement(child)) {
|
|
3904
|
-
const props = (child == null ? void 0 : child.props) ?
|
|
3851
|
+
const props = (child == null ? void 0 : child.props) ? { ...child.props } : {};
|
|
3905
3852
|
try {
|
|
3906
3853
|
return import_react3.default.cloneElement(child, {
|
|
3907
3854
|
value: hvalues[props.name] || "",
|
|
3908
3855
|
onChange: (e) => {
|
|
3909
|
-
setHValues(
|
|
3856
|
+
setHValues({ ...hvalues, [props.name]: e.target.value });
|
|
3910
3857
|
(props == null ? void 0 : props.onChange) && props.onChange(e);
|
|
3911
3858
|
}
|
|
3912
3859
|
});
|
|
@@ -3916,48 +3863,44 @@ function Form(_a) {
|
|
|
3916
3863
|
}
|
|
3917
3864
|
return child;
|
|
3918
3865
|
}),
|
|
3919
|
-
isLoading && /* @__PURE__ */ (0,
|
|
3866
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fixed top-0 left-0 w-full h-screen flex items-center justify-center bg-white bg-opacity-50", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: loader }) })
|
|
3920
3867
|
]
|
|
3921
|
-
}
|
|
3868
|
+
}
|
|
3922
3869
|
);
|
|
3923
3870
|
}
|
|
3924
3871
|
|
|
3925
3872
|
// src/input/index.tsx
|
|
3926
|
-
var
|
|
3927
|
-
function Input(
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
"label",
|
|
3935
|
-
"className",
|
|
3936
|
-
"regex",
|
|
3937
|
-
"invalidMessage"
|
|
3938
|
-
]);
|
|
3873
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3874
|
+
function Input({
|
|
3875
|
+
label,
|
|
3876
|
+
className,
|
|
3877
|
+
regex,
|
|
3878
|
+
invalidMessage = "Valor no v\xE1lido",
|
|
3879
|
+
...props
|
|
3880
|
+
}) {
|
|
3939
3881
|
const value = `${(props == null ? void 0 : props.value) || ""}`;
|
|
3940
3882
|
const isValid = !regex ? true : regex.test(value);
|
|
3941
|
-
return /* @__PURE__ */ (0,
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
3943
|
-
/* @__PURE__ */ (0,
|
|
3883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "w-full", children: [
|
|
3884
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
3885
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "font-bold ", children: [
|
|
3944
3886
|
label,
|
|
3945
3887
|
" ",
|
|
3946
|
-
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0,
|
|
3888
|
+
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-red-500", children: "*" })
|
|
3947
3889
|
] }),
|
|
3948
|
-
/* @__PURE__ */ (0,
|
|
3890
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3949
3891
|
"input",
|
|
3950
|
-
|
|
3892
|
+
{
|
|
3893
|
+
...props,
|
|
3951
3894
|
className: [
|
|
3952
3895
|
"p-2 w-full rounded border shadow",
|
|
3953
3896
|
value != "" && !isValid && "bg-red-200 text-black",
|
|
3954
3897
|
value != "" && isValid && "bg-green-200 text-black",
|
|
3955
3898
|
className
|
|
3956
3899
|
].join(" ")
|
|
3957
|
-
}
|
|
3900
|
+
}
|
|
3958
3901
|
) })
|
|
3959
3902
|
] }),
|
|
3960
|
-
!isValid && value != "" && /* @__PURE__ */ (0,
|
|
3903
|
+
!isValid && value != "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-red-800 invalid", children: invalidMessage })
|
|
3961
3904
|
] });
|
|
3962
3905
|
}
|
|
3963
3906
|
|
|
@@ -35736,14 +35679,14 @@ function useExcel() {
|
|
|
35736
35679
|
|
|
35737
35680
|
// src/table/index.tsx
|
|
35738
35681
|
var import_material2 = require("@mui/material");
|
|
35739
|
-
var
|
|
35682
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
35740
35683
|
function Table(props) {
|
|
35741
35684
|
if (Array.isArray(props.data)) {
|
|
35742
|
-
return /* @__PURE__ */ (0,
|
|
35685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IHTable, { ...props });
|
|
35743
35686
|
} else {
|
|
35744
|
-
return /* @__PURE__ */ (0,
|
|
35745
|
-
/* @__PURE__ */ (0,
|
|
35746
|
-
/* @__PURE__ */ (0,
|
|
35687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: " bg-white border shadow rounded p-1", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("table", { className: "rounded", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("tbody", { children: Object.keys(props.data).map((k) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("tr", { className: "border-b ", children: [
|
|
35688
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("th", { className: "font-bold p-3 text-right", children: k }),
|
|
35689
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35747
35690
|
"td",
|
|
35748
35691
|
{
|
|
35749
35692
|
className: typeof props.data[k] === "number" ? "text-right" : "text-center",
|
|
@@ -35754,7 +35697,7 @@ function Table(props) {
|
|
|
35754
35697
|
}
|
|
35755
35698
|
}
|
|
35756
35699
|
function EditIcon() {
|
|
35757
|
-
return /* @__PURE__ */ (0,
|
|
35700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35758
35701
|
"svg",
|
|
35759
35702
|
{
|
|
35760
35703
|
stroke: "currentColor",
|
|
@@ -35764,7 +35707,7 @@ function EditIcon() {
|
|
|
35764
35707
|
height: "20px",
|
|
35765
35708
|
width: "20px",
|
|
35766
35709
|
xmlns: "http://www.w3.org/2000/svg",
|
|
35767
|
-
children: /* @__PURE__ */ (0,
|
|
35710
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z" })
|
|
35768
35711
|
}
|
|
35769
35712
|
);
|
|
35770
35713
|
}
|
|
@@ -35777,7 +35720,7 @@ function IHTable({
|
|
|
35777
35720
|
buttons,
|
|
35778
35721
|
exportName,
|
|
35779
35722
|
modal,
|
|
35780
|
-
height =
|
|
35723
|
+
height = 600,
|
|
35781
35724
|
width = "100%",
|
|
35782
35725
|
header,
|
|
35783
35726
|
hideColumns = [],
|
|
@@ -35785,7 +35728,7 @@ function IHTable({
|
|
|
35785
35728
|
}) {
|
|
35786
35729
|
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
35787
35730
|
if (modal) {
|
|
35788
|
-
buttons =
|
|
35731
|
+
buttons = { ...buttons, Modal: "" };
|
|
35789
35732
|
}
|
|
35790
35733
|
const handleOpen = () => setOpen(true);
|
|
35791
35734
|
const handleClose = () => {
|
|
@@ -35810,13 +35753,14 @@ function IHTable({
|
|
|
35810
35753
|
editable: editableFields == null ? void 0 : editableFields.includes(key),
|
|
35811
35754
|
type: typeof rows[0][key] === "number" ? "number" : "string",
|
|
35812
35755
|
renderCell: (buttons == null ? void 0 : buttons[key]) ? (params) => {
|
|
35813
|
-
var _a;
|
|
35756
|
+
var _a, _b;
|
|
35814
35757
|
return import_react4.default.cloneElement(buttons[key], {
|
|
35815
|
-
|
|
35758
|
+
className: ((_a = params == null ? void 0 : params.className) != null ? _a : "") + " m-auto text-xs ",
|
|
35759
|
+
children: (_b = params == null ? void 0 : params.row) == null ? void 0 : _b[key],
|
|
35816
35760
|
onClick: (e) => {
|
|
35817
|
-
var _a2,
|
|
35761
|
+
var _a2, _b2;
|
|
35818
35762
|
e.row = params == null ? void 0 : params.row;
|
|
35819
|
-
if ((
|
|
35763
|
+
if ((_b2 = (_a2 = buttons[key]) == null ? void 0 : _a2.props) == null ? void 0 : _b2.onClick) {
|
|
35820
35764
|
const newVal = buttons[key].props.onClick(e);
|
|
35821
35765
|
newVal && handleRowUpdate(newVal);
|
|
35822
35766
|
}
|
|
@@ -35833,14 +35777,14 @@ function IHTable({
|
|
|
35833
35777
|
type: "string",
|
|
35834
35778
|
renderCell: (params) => {
|
|
35835
35779
|
var _a;
|
|
35836
|
-
return /* @__PURE__ */ (0,
|
|
35780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35837
35781
|
Button,
|
|
35838
35782
|
{
|
|
35839
35783
|
className: "text-xs",
|
|
35840
35784
|
onClick: () => {
|
|
35841
35785
|
handleOpen();
|
|
35842
35786
|
},
|
|
35843
|
-
icon: /* @__PURE__ */ (0,
|
|
35787
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EditIcon, {}),
|
|
35844
35788
|
children: (_a = params == null ? void 0 : params.row) == null ? void 0 : _a["Modal"]
|
|
35845
35789
|
}
|
|
35846
35790
|
);
|
|
@@ -35876,7 +35820,7 @@ function IHTable({
|
|
|
35876
35820
|
}
|
|
35877
35821
|
return filtered2;
|
|
35878
35822
|
}, [selectedRows]);
|
|
35879
|
-
return rows.length > 0 && /* @__PURE__ */ (0,
|
|
35823
|
+
return rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
35880
35824
|
import_material.Box,
|
|
35881
35825
|
{
|
|
35882
35826
|
sx: {
|
|
@@ -35887,77 +35831,59 @@ function IHTable({
|
|
|
35887
35831
|
zIndex: 999999999
|
|
35888
35832
|
},
|
|
35889
35833
|
children: [
|
|
35890
|
-
modal && /* @__PURE__ */ (0,
|
|
35891
|
-
|
|
35892
|
-
|
|
35893
|
-
|
|
35894
|
-
|
|
35895
|
-
|
|
35896
|
-
|
|
35897
|
-
|
|
35898
|
-
|
|
35899
|
-
|
|
35900
|
-
|
|
35901
|
-
|
|
35902
|
-
|
|
35903
|
-
|
|
35904
|
-
|
|
35905
|
-
|
|
35906
|
-
|
|
35907
|
-
|
|
35908
|
-
|
|
35909
|
-
|
|
35910
|
-
(r) => Array.from(selectedRows == null ? void 0 : selectedRows.ids).includes(r.id)
|
|
35911
|
-
)
|
|
35912
|
-
}) })
|
|
35913
|
-
]
|
|
35914
|
-
}
|
|
35915
|
-
),
|
|
35916
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "font-bold text-xl p-2 bg-blue-500 text-white border shadow rounded", children: header }),
|
|
35917
|
-
(exportName || onSave || onSelect) && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex gap-2 bg-gray-200 border shadow rounded p-2", children: [
|
|
35918
|
-
exportName && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
35834
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_material2.Dialog, { open, onClose: handleClose, maxWidth: "xl", fullWidth: true, children: [
|
|
35835
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35836
|
+
"button",
|
|
35837
|
+
{
|
|
35838
|
+
onClick: () => {
|
|
35839
|
+
handleClose();
|
|
35840
|
+
},
|
|
35841
|
+
className: "text-gray-500 hover:text-gray-800 text-xl font-bold p-5",
|
|
35842
|
+
children: "\xD7"
|
|
35843
|
+
}
|
|
35844
|
+
) }),
|
|
35845
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mt-4 m-auto p-5", children: selectedRows && Array.from(selectedRows == null ? void 0 : selectedRows.ids).length > 0 && import_react4.default.cloneElement(modal, {
|
|
35846
|
+
row: rows.find(
|
|
35847
|
+
(r) => Array.from(selectedRows == null ? void 0 : selectedRows.ids).includes(r.id)
|
|
35848
|
+
)
|
|
35849
|
+
}) })
|
|
35850
|
+
] }),
|
|
35851
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "font-bold text-xl p-2 bg-blue-500 text-white border shadow rounded", children: header }),
|
|
35852
|
+
(exportName || onSave || onSelect) && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-2 bg-gray-200 border shadow rounded p-2", children: [
|
|
35853
|
+
exportName && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35919
35854
|
Button,
|
|
35920
35855
|
{
|
|
35921
35856
|
className: "bg-green-800 text-white",
|
|
35922
35857
|
onClick: (e) => {
|
|
35923
35858
|
excel.export(
|
|
35924
|
-
rows.map((
|
|
35925
|
-
var _b = _a, { _edited } = _b, r = __objRest(_b, ["_edited"]);
|
|
35926
|
-
return r;
|
|
35927
|
-
}),
|
|
35859
|
+
rows.map(({ _edited, ...r }) => r),
|
|
35928
35860
|
`${exportName}.xlsx`
|
|
35929
35861
|
);
|
|
35930
35862
|
},
|
|
35931
35863
|
children: "Exportar"
|
|
35932
35864
|
}
|
|
35933
35865
|
),
|
|
35934
|
-
onSelect ? /* @__PURE__ */ (0,
|
|
35866
|
+
onSelect ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35935
35867
|
Button,
|
|
35936
35868
|
{
|
|
35937
35869
|
disabled: filtered.length == 0,
|
|
35938
35870
|
color: filtered.length == 0 ? "white" : "primary",
|
|
35939
35871
|
onClick: (e) => {
|
|
35940
|
-
onSelect == null ? void 0 : onSelect(filtered.map((
|
|
35941
|
-
var _b = _a, { _edited } = _b, r = __objRest(_b, ["_edited"]);
|
|
35942
|
-
return r;
|
|
35943
|
-
}));
|
|
35872
|
+
onSelect == null ? void 0 : onSelect(filtered.map(({ _edited, ...r }) => r));
|
|
35944
35873
|
},
|
|
35945
35874
|
children: "Guardar Selecci\xF3n"
|
|
35946
35875
|
}
|
|
35947
|
-
) : onSave && /* @__PURE__ */ (0,
|
|
35876
|
+
) : onSave && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35948
35877
|
Button,
|
|
35949
35878
|
{
|
|
35950
35879
|
onClick: (e) => {
|
|
35951
|
-
onSave == null ? void 0 : onSave(rows.map((
|
|
35952
|
-
var _b = _a, { _edited } = _b, r = __objRest(_b, ["_edited"]);
|
|
35953
|
-
return r;
|
|
35954
|
-
}));
|
|
35880
|
+
onSave == null ? void 0 : onSave(rows.map(({ _edited, ...r }) => r));
|
|
35955
35881
|
},
|
|
35956
35882
|
children: "Guardar"
|
|
35957
35883
|
}
|
|
35958
35884
|
)
|
|
35959
35885
|
] }),
|
|
35960
|
-
/* @__PURE__ */ (0,
|
|
35886
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
35961
35887
|
import_x_data_grid.DataGrid,
|
|
35962
35888
|
{
|
|
35963
35889
|
rows,
|
|
@@ -35965,7 +35891,6 @@ function IHTable({
|
|
|
35965
35891
|
checkboxSelection: Boolean(onSelect),
|
|
35966
35892
|
rowSelectionModel: selectedRows,
|
|
35967
35893
|
onRowSelectionModelChange: (newSelection) => {
|
|
35968
|
-
console.log(newSelection);
|
|
35969
35894
|
setSelectedRows(newSelection);
|
|
35970
35895
|
},
|
|
35971
35896
|
sx: {
|
|
@@ -35979,52 +35904,70 @@ function IHTable({
|
|
|
35979
35904
|
pageSizeOptions: [5, 10]
|
|
35980
35905
|
}
|
|
35981
35906
|
),
|
|
35982
|
-
/* @__PURE__ */ (0,
|
|
35907
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CustomFooter, { footer: footer || {}, rows })
|
|
35983
35908
|
]
|
|
35984
35909
|
}
|
|
35985
35910
|
);
|
|
35986
35911
|
}
|
|
35987
|
-
function CustomFooter(
|
|
35988
|
-
|
|
35989
|
-
|
|
35990
|
-
|
|
35991
|
-
|
|
35992
|
-
|
|
35993
|
-
|
|
35994
|
-
|
|
35995
|
-
|
|
35996
|
-
|
|
35912
|
+
function CustomFooter({
|
|
35913
|
+
rows,
|
|
35914
|
+
footer
|
|
35915
|
+
}) {
|
|
35916
|
+
const entries = Object.entries(footer);
|
|
35917
|
+
if (!entries.length) return null;
|
|
35918
|
+
const compute = (key, type) => {
|
|
35919
|
+
const values = rows.map((r) => {
|
|
35920
|
+
var _a;
|
|
35921
|
+
return Number((_a = r[key]) != null ? _a : 0);
|
|
35922
|
+
}).filter((v) => !isNaN(v));
|
|
35923
|
+
if (type === "sum") return values.reduce((acc, v) => acc + v, 0);
|
|
35924
|
+
if (type === "avg")
|
|
35925
|
+
return values.length ? values.reduce((acc, v) => acc + v, 0) / values.length : 0;
|
|
35926
|
+
if (type === "count") return values.length;
|
|
35927
|
+
return 0;
|
|
35928
|
+
};
|
|
35929
|
+
const label = {
|
|
35930
|
+
sum: "Suma",
|
|
35931
|
+
avg: "Promedio",
|
|
35932
|
+
count: "Conteo"
|
|
35933
|
+
};
|
|
35934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex justify-end gap-6 px-4 py-2 bg-gray-100 border-t border-gray-300 text-sm font-semibold text-gray-700", children: entries.map(([key, type]) => {
|
|
35935
|
+
const value = compute(key, type);
|
|
35936
|
+
const formatted = type === "avg" ? value.toLocaleString(void 0, { maximumFractionDigits: 2 }) : value.toLocaleString();
|
|
35937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
35938
|
+
label[type],
|
|
35939
|
+
" de ",
|
|
35940
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-gray-900", children: key }),
|
|
35941
|
+
":",
|
|
35942
|
+
" ",
|
|
35943
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-blue-700", children: formatted })
|
|
35944
|
+
] }, key);
|
|
35997
35945
|
}) });
|
|
35998
35946
|
}
|
|
35999
35947
|
|
|
36000
35948
|
// src/text-area/index.tsx
|
|
36001
35949
|
var import_react5 = require("react");
|
|
36002
|
-
var
|
|
36003
|
-
function TextArea(
|
|
36004
|
-
|
|
36005
|
-
|
|
36006
|
-
|
|
36007
|
-
|
|
36008
|
-
|
|
36009
|
-
|
|
36010
|
-
|
|
36011
|
-
"label",
|
|
36012
|
-
"className",
|
|
36013
|
-
"maxLength",
|
|
36014
|
-
"onChange",
|
|
36015
|
-
"children"
|
|
36016
|
-
]);
|
|
35950
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
35951
|
+
function TextArea({
|
|
35952
|
+
label,
|
|
35953
|
+
className,
|
|
35954
|
+
maxLength,
|
|
35955
|
+
onChange,
|
|
35956
|
+
children = "",
|
|
35957
|
+
...props
|
|
35958
|
+
}) {
|
|
36017
35959
|
const [value, setValue] = (0, import_react5.useState)((props == null ? void 0 : props.value) || "");
|
|
36018
|
-
return /* @__PURE__ */ (0,
|
|
36019
|
-
/* @__PURE__ */ (0,
|
|
35960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
35961
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "font-bold ", children: [
|
|
36020
35962
|
label,
|
|
36021
35963
|
" ",
|
|
36022
|
-
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0,
|
|
35964
|
+
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-red-500", children: "*" })
|
|
36023
35965
|
] }),
|
|
36024
|
-
/* @__PURE__ */ (0,
|
|
36025
|
-
/* @__PURE__ */ (0,
|
|
35966
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
35967
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
36026
35968
|
"textarea",
|
|
36027
|
-
|
|
35969
|
+
{
|
|
35970
|
+
...props,
|
|
36028
35971
|
className: ["p-1 w-full rounded border shadow", className].join(
|
|
36029
35972
|
" "
|
|
36030
35973
|
),
|
|
@@ -36036,9 +35979,9 @@ function TextArea(_a) {
|
|
|
36036
35979
|
setValue(e.target.value);
|
|
36037
35980
|
onChange == null ? void 0 : onChange(e);
|
|
36038
35981
|
}
|
|
36039
|
-
}
|
|
35982
|
+
}
|
|
36040
35983
|
),
|
|
36041
|
-
maxLength && /* @__PURE__ */ (0,
|
|
35984
|
+
maxLength && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: " text-xs text-gray text-right", children: [
|
|
36042
35985
|
value.length,
|
|
36043
35986
|
" / ",
|
|
36044
35987
|
maxLength
|
|
@@ -36148,7 +36091,8 @@ function useResources({
|
|
|
36148
36091
|
const [info, setInfo] = (0, import_react7.useState)(
|
|
36149
36092
|
Object.keys(endpoints).reduce((acc, key) => {
|
|
36150
36093
|
var _a, _b;
|
|
36151
|
-
const newAcc =
|
|
36094
|
+
const newAcc = {
|
|
36095
|
+
...acc,
|
|
36152
36096
|
[key]: {
|
|
36153
36097
|
loaded: false,
|
|
36154
36098
|
id: (_a = endpoints[key]) == null ? void 0 : _a.id,
|
|
@@ -36156,23 +36100,22 @@ function useResources({
|
|
|
36156
36100
|
data: [],
|
|
36157
36101
|
selectedItem: {}
|
|
36158
36102
|
}
|
|
36159
|
-
}
|
|
36103
|
+
};
|
|
36160
36104
|
return newAcc;
|
|
36161
36105
|
}, {})
|
|
36162
36106
|
);
|
|
36163
36107
|
const results = Object.keys(endpoints).reduce(
|
|
36164
36108
|
(acc, key) => {
|
|
36165
|
-
var _c, _d, _e, _f, _g
|
|
36109
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
36166
36110
|
const endpoint = endpoints[key];
|
|
36167
|
-
const showFunc = async (
|
|
36168
|
-
var _b = _a, { limit = 10, page = 1, merge = true } = _b, query = __objRest(_b, ["limit", "page", "merge"]);
|
|
36111
|
+
const showFunc = async ({ limit = 10, page = 1, merge = true, ...query }, autoLoad = false) => {
|
|
36169
36112
|
const options = {
|
|
36170
36113
|
method: "GET",
|
|
36171
36114
|
url: `${baseURI}/${key}`,
|
|
36172
|
-
params:
|
|
36115
|
+
params: { limit, page, ...query },
|
|
36173
36116
|
headers: { Authorization: token }
|
|
36174
36117
|
};
|
|
36175
|
-
const newInfo =
|
|
36118
|
+
const newInfo = { ...info };
|
|
36176
36119
|
newInfo[key].state = "loading";
|
|
36177
36120
|
newInfo[key].errorMessage = "";
|
|
36178
36121
|
newInfo[key].params = query;
|
|
@@ -36187,28 +36130,28 @@ function useResources({
|
|
|
36187
36130
|
newInfo[key].totalItems = d.totalItems;
|
|
36188
36131
|
newInfo[key].totalPages = d.totalPages;
|
|
36189
36132
|
newInfo[key].currentPage = d.currentPage;
|
|
36190
|
-
setInfo(
|
|
36133
|
+
setInfo({ ...newInfo });
|
|
36191
36134
|
return d.data;
|
|
36192
36135
|
} catch (error) {
|
|
36193
36136
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36194
36137
|
newInfo[key].state = "error";
|
|
36195
36138
|
newInfo[key].errorMessage = item == null ? void 0 : item.meaning;
|
|
36196
36139
|
if (error.status == 403) {
|
|
36197
|
-
onError == null ? void 0 : onError(
|
|
36140
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36198
36141
|
}
|
|
36199
|
-
setInfo(
|
|
36142
|
+
setInfo({ ...newInfo });
|
|
36200
36143
|
return error;
|
|
36201
36144
|
}
|
|
36202
36145
|
};
|
|
36203
36146
|
const findFunc = async (id, query) => {
|
|
36204
|
-
var
|
|
36147
|
+
var _a2, _b2, _c2;
|
|
36205
36148
|
const options = {
|
|
36206
36149
|
method: "GET",
|
|
36207
36150
|
url: `${baseURI}/${key}/${id}`,
|
|
36208
|
-
params:
|
|
36151
|
+
params: { ...query },
|
|
36209
36152
|
headers: { Authorization: token }
|
|
36210
36153
|
};
|
|
36211
|
-
const newInfo =
|
|
36154
|
+
const newInfo = { ...info };
|
|
36212
36155
|
newInfo[key].state = "loading";
|
|
36213
36156
|
newInfo[key].errorMessage = "";
|
|
36214
36157
|
newInfo[key].params = query;
|
|
@@ -36220,7 +36163,7 @@ function useResources({
|
|
|
36220
36163
|
newInfo[key].state = "success";
|
|
36221
36164
|
newInfo[key].errorMessage = "";
|
|
36222
36165
|
newInfo[key].selectedItem = d;
|
|
36223
|
-
const index = (
|
|
36166
|
+
const index = (_b2 = (_a2 = newInfo[key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.findIndex((d2) => (d2 == null ? void 0 : d2.id) == id);
|
|
36224
36167
|
if (index >= 0) {
|
|
36225
36168
|
newInfo[key].data[index] = d;
|
|
36226
36169
|
} else {
|
|
@@ -36230,28 +36173,28 @@ function useResources({
|
|
|
36230
36173
|
newInfo[key].data = [d];
|
|
36231
36174
|
}
|
|
36232
36175
|
}
|
|
36233
|
-
setInfo(
|
|
36176
|
+
setInfo({ ...newInfo });
|
|
36234
36177
|
return d;
|
|
36235
36178
|
} catch (error) {
|
|
36236
36179
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36237
36180
|
newInfo[key].state = "error";
|
|
36238
36181
|
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
36239
36182
|
if (error.status == 403) {
|
|
36240
|
-
onError == null ? void 0 : onError(
|
|
36183
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36241
36184
|
}
|
|
36242
|
-
setInfo(
|
|
36185
|
+
setInfo({ ...newInfo });
|
|
36243
36186
|
return error;
|
|
36244
36187
|
}
|
|
36245
36188
|
};
|
|
36246
36189
|
const bodyCreateFunc = async (data) => {
|
|
36247
|
-
var
|
|
36190
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
36248
36191
|
const options = {
|
|
36249
36192
|
method: "POST",
|
|
36250
36193
|
url: `${baseURI}/${key}`,
|
|
36251
|
-
data: Array.isArray(data) ? [...data] :
|
|
36194
|
+
data: Array.isArray(data) ? [...data] : { ...data },
|
|
36252
36195
|
headers: { Authorization: token }
|
|
36253
36196
|
};
|
|
36254
|
-
const newInfo =
|
|
36197
|
+
const newInfo = { ...info };
|
|
36255
36198
|
newInfo[key].state = "loading";
|
|
36256
36199
|
newInfo[key].errorMessage = "";
|
|
36257
36200
|
setInfo(newInfo);
|
|
@@ -36262,7 +36205,7 @@ function useResources({
|
|
|
36262
36205
|
newInfo[key].errorMessage = "";
|
|
36263
36206
|
if (Array.isArray(data)) {
|
|
36264
36207
|
for (let datum of data) {
|
|
36265
|
-
const index = (
|
|
36208
|
+
const index = (_b2 = (_a2 = newInfo[key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.findIndex(
|
|
36266
36209
|
(d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
|
|
36267
36210
|
);
|
|
36268
36211
|
if (index >= 0) {
|
|
@@ -36291,22 +36234,22 @@ function useResources({
|
|
|
36291
36234
|
}
|
|
36292
36235
|
}
|
|
36293
36236
|
}
|
|
36294
|
-
setInfo(
|
|
36237
|
+
setInfo({ ...newInfo });
|
|
36295
36238
|
return d;
|
|
36296
36239
|
} catch (error) {
|
|
36297
36240
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36298
36241
|
newInfo[key].state = "error";
|
|
36299
36242
|
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
36300
36243
|
if (error.status == 403) {
|
|
36301
|
-
onError == null ? void 0 : onError(
|
|
36244
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36302
36245
|
}
|
|
36303
|
-
setInfo(
|
|
36246
|
+
setInfo({ ...newInfo });
|
|
36304
36247
|
return error;
|
|
36305
36248
|
}
|
|
36306
36249
|
};
|
|
36307
36250
|
const formCreateFunc = async (data) => {
|
|
36308
|
-
var
|
|
36309
|
-
const newInfo =
|
|
36251
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
36252
|
+
const newInfo = { ...info };
|
|
36310
36253
|
newInfo[key].state = "loading";
|
|
36311
36254
|
newInfo[key].errorMessage = "";
|
|
36312
36255
|
setInfo(newInfo);
|
|
@@ -36338,7 +36281,7 @@ function useResources({
|
|
|
36338
36281
|
newInfo[key].errorMessage = "";
|
|
36339
36282
|
if (Array.isArray(data)) {
|
|
36340
36283
|
for (let datum of data) {
|
|
36341
|
-
const index = (
|
|
36284
|
+
const index = (_b2 = (_a2 = newInfo[key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.findIndex(
|
|
36342
36285
|
(d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
|
|
36343
36286
|
);
|
|
36344
36287
|
if (index >= 0) {
|
|
@@ -36367,20 +36310,21 @@ function useResources({
|
|
|
36367
36310
|
}
|
|
36368
36311
|
}
|
|
36369
36312
|
}
|
|
36370
|
-
setInfo(
|
|
36313
|
+
setInfo({ ...newInfo });
|
|
36371
36314
|
return d;
|
|
36372
36315
|
} catch (error) {
|
|
36373
36316
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36374
36317
|
newInfo[key].state = "error";
|
|
36375
36318
|
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
36376
36319
|
if (error.status == 403) {
|
|
36377
|
-
onError == null ? void 0 : onError(
|
|
36320
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36378
36321
|
}
|
|
36379
|
-
setInfo(
|
|
36322
|
+
setInfo({ ...newInfo });
|
|
36380
36323
|
return error;
|
|
36381
36324
|
}
|
|
36382
36325
|
};
|
|
36383
|
-
acc[key] =
|
|
36326
|
+
acc[key] = {
|
|
36327
|
+
...endpoint,
|
|
36384
36328
|
loaded: false,
|
|
36385
36329
|
show: showFunc,
|
|
36386
36330
|
find: findFunc,
|
|
@@ -36394,14 +36338,14 @@ function useResources({
|
|
|
36394
36338
|
return await bodyCreateFunc(data);
|
|
36395
36339
|
},
|
|
36396
36340
|
update: async (id, data) => {
|
|
36397
|
-
var
|
|
36341
|
+
var _a2, _b2, _c2;
|
|
36398
36342
|
const options = {
|
|
36399
36343
|
method: "PATCH",
|
|
36400
36344
|
url: `${baseURI}/${key}/${id}`,
|
|
36401
|
-
data: Array.isArray(data) ? [...data] :
|
|
36345
|
+
data: Array.isArray(data) ? [...data] : { ...data },
|
|
36402
36346
|
headers: { Authorization: token }
|
|
36403
36347
|
};
|
|
36404
|
-
const newInfo =
|
|
36348
|
+
const newInfo = { ...info };
|
|
36405
36349
|
newInfo[key].state = "loading";
|
|
36406
36350
|
newInfo[key].errorMessage = "";
|
|
36407
36351
|
setInfo(newInfo);
|
|
@@ -36410,12 +36354,12 @@ function useResources({
|
|
|
36410
36354
|
const d = consulta.data;
|
|
36411
36355
|
newInfo[key].state = "success";
|
|
36412
36356
|
newInfo[key].errorMessage = "";
|
|
36413
|
-
newInfo[key].selectedItem =
|
|
36414
|
-
const index = (
|
|
36357
|
+
newInfo[key].selectedItem = { ...newInfo[key].selectedItem, ...d };
|
|
36358
|
+
const index = (_b2 = (_a2 = newInfo[key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.findIndex(
|
|
36415
36359
|
(d2) => (d2 == null ? void 0 : d2.id) == id
|
|
36416
36360
|
);
|
|
36417
36361
|
if (index >= 0) {
|
|
36418
|
-
newInfo[key].data[index] =
|
|
36362
|
+
newInfo[key].data[index] = { ...newInfo[key].data[index], ...d };
|
|
36419
36363
|
} else {
|
|
36420
36364
|
if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
|
|
36421
36365
|
newInfo[key].data.unshift(d);
|
|
@@ -36423,27 +36367,27 @@ function useResources({
|
|
|
36423
36367
|
newInfo[key].data = [d];
|
|
36424
36368
|
}
|
|
36425
36369
|
}
|
|
36426
|
-
setInfo(
|
|
36370
|
+
setInfo({ ...newInfo });
|
|
36427
36371
|
return d;
|
|
36428
36372
|
} catch (error) {
|
|
36429
36373
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36430
36374
|
newInfo[key].state = "error";
|
|
36431
36375
|
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
36432
36376
|
if (error.status == 403) {
|
|
36433
|
-
onError == null ? void 0 : onError(
|
|
36377
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36434
36378
|
}
|
|
36435
|
-
setInfo(
|
|
36379
|
+
setInfo({ ...newInfo });
|
|
36436
36380
|
return error;
|
|
36437
36381
|
}
|
|
36438
36382
|
},
|
|
36439
36383
|
remove: async (id) => {
|
|
36440
|
-
var
|
|
36384
|
+
var _a2, _b2;
|
|
36441
36385
|
const options = {
|
|
36442
36386
|
method: "DELETE",
|
|
36443
36387
|
url: `${baseURI}/${key}/${id}`,
|
|
36444
36388
|
headers: { Authorization: token }
|
|
36445
36389
|
};
|
|
36446
|
-
const newInfo =
|
|
36390
|
+
const newInfo = { ...info };
|
|
36447
36391
|
newInfo[key].state = "loading";
|
|
36448
36392
|
newInfo[key].errorMessage = "";
|
|
36449
36393
|
setInfo(newInfo);
|
|
@@ -36453,32 +36397,32 @@ function useResources({
|
|
|
36453
36397
|
newInfo[key].state = "success";
|
|
36454
36398
|
newInfo[key].errorMessage = "";
|
|
36455
36399
|
newInfo[key].selectedItem = d;
|
|
36456
|
-
const index = (
|
|
36400
|
+
const index = (_b2 = (_a2 = newInfo[key]) == null ? void 0 : _a2.data) == null ? void 0 : _b2.findIndex(
|
|
36457
36401
|
(d2) => (d2 == null ? void 0 : d2.id) == id
|
|
36458
36402
|
);
|
|
36459
36403
|
if (index >= 0) {
|
|
36460
36404
|
newInfo[key].data.splice(index, 1);
|
|
36461
36405
|
}
|
|
36462
|
-
setInfo(
|
|
36406
|
+
setInfo({ ...newInfo });
|
|
36463
36407
|
return d.data;
|
|
36464
36408
|
} catch (error) {
|
|
36465
36409
|
const item = http_codes_default.find((s) => s.code == error.status);
|
|
36466
36410
|
newInfo[key].state = "error";
|
|
36467
36411
|
newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
|
|
36468
36412
|
if (error.status == 403) {
|
|
36469
|
-
onError == null ? void 0 : onError(
|
|
36413
|
+
onError == null ? void 0 : onError({ error, ...{ errorMessage: item == null ? void 0 : item.meaning } });
|
|
36470
36414
|
}
|
|
36471
|
-
setInfo(
|
|
36415
|
+
setInfo({ ...newInfo });
|
|
36472
36416
|
return error;
|
|
36473
36417
|
}
|
|
36474
36418
|
},
|
|
36475
|
-
totalPages: (
|
|
36476
|
-
currentPage: (
|
|
36477
|
-
state: ((
|
|
36478
|
-
errorMessage: (
|
|
36479
|
-
params: (
|
|
36419
|
+
totalPages: (_a = info[key]) == null ? void 0 : _a.totalPages,
|
|
36420
|
+
currentPage: (_b = info[key]) == null ? void 0 : _b.currentPage,
|
|
36421
|
+
state: ((_c = info[key]) == null ? void 0 : _c.state) || "success",
|
|
36422
|
+
errorMessage: (_d = info[key]) == null ? void 0 : _d.errorMessage,
|
|
36423
|
+
params: (_e = info[key]) == null ? void 0 : _e.params,
|
|
36480
36424
|
setLoaded: () => {
|
|
36481
|
-
const newInfo =
|
|
36425
|
+
const newInfo = { ...info };
|
|
36482
36426
|
newInfo[key].loaded = true;
|
|
36483
36427
|
setInfo(newInfo);
|
|
36484
36428
|
},
|
|
@@ -36498,16 +36442,16 @@ function useResources({
|
|
|
36498
36442
|
currentPage = currentInfo.currentPage || currentPage + 1;
|
|
36499
36443
|
totalPages = currentInfo.totalPages || currentPage;
|
|
36500
36444
|
}
|
|
36501
|
-
const newInfo =
|
|
36445
|
+
const newInfo = { ...info };
|
|
36502
36446
|
newInfo[key].data = allData;
|
|
36503
36447
|
newInfo[key].currentPage = currentPage;
|
|
36504
36448
|
newInfo[key].totalPages = totalPages;
|
|
36505
36449
|
setInfo(newInfo);
|
|
36506
36450
|
return allData;
|
|
36507
36451
|
},
|
|
36508
|
-
data: ((
|
|
36509
|
-
selectedItem: ((
|
|
36510
|
-
}
|
|
36452
|
+
data: ((_f = info[key]) == null ? void 0 : _f.data) || [],
|
|
36453
|
+
selectedItem: ((_g = info[key]) == null ? void 0 : _g.selectedItem) || {}
|
|
36454
|
+
};
|
|
36511
36455
|
return acc;
|
|
36512
36456
|
},
|
|
36513
36457
|
{}
|
|
@@ -36537,9 +36481,9 @@ function useResources({
|
|
|
36537
36481
|
var import_react8 = __toESM(require("react"));
|
|
36538
36482
|
|
|
36539
36483
|
// src/select/icon.tsx
|
|
36540
|
-
var
|
|
36484
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
36541
36485
|
function SelectIcon() {
|
|
36542
|
-
return /* @__PURE__ */ (0,
|
|
36486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
36543
36487
|
"svg",
|
|
36544
36488
|
{
|
|
36545
36489
|
stroke: "currentColor",
|
|
@@ -36549,15 +36493,15 @@ function SelectIcon() {
|
|
|
36549
36493
|
height: "20px",
|
|
36550
36494
|
width: "20px",
|
|
36551
36495
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36552
|
-
children: /* @__PURE__ */ (0,
|
|
36496
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M31.3 192h257.3c17.8 0 26.7 21.5 14.1 34.1L174.1 354.8c-7.8 7.8-20.5 7.8-28.3 0L17.2 226.1C4.6 213.5 13.5 192 31.3 192z" })
|
|
36553
36497
|
}
|
|
36554
36498
|
);
|
|
36555
36499
|
}
|
|
36556
36500
|
|
|
36557
36501
|
// src/select/close.tsx
|
|
36558
|
-
var
|
|
36502
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
36559
36503
|
function CloseIcon() {
|
|
36560
|
-
return /* @__PURE__ */ (0,
|
|
36504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
36561
36505
|
"svg",
|
|
36562
36506
|
{
|
|
36563
36507
|
stroke: "currentColor",
|
|
@@ -36567,25 +36511,20 @@ function CloseIcon() {
|
|
|
36567
36511
|
height: "20px",
|
|
36568
36512
|
width: "20px",
|
|
36569
36513
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36570
|
-
children: /* @__PURE__ */ (0,
|
|
36514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
36571
36515
|
}
|
|
36572
36516
|
);
|
|
36573
36517
|
}
|
|
36574
36518
|
|
|
36575
36519
|
// src/select/index.tsx
|
|
36576
|
-
var
|
|
36577
|
-
function Select(
|
|
36578
|
-
|
|
36579
|
-
|
|
36580
|
-
|
|
36581
|
-
|
|
36582
|
-
|
|
36583
|
-
|
|
36584
|
-
"label",
|
|
36585
|
-
"placeholder",
|
|
36586
|
-
"children",
|
|
36587
|
-
"strictMode"
|
|
36588
|
-
]);
|
|
36520
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
36521
|
+
function Select({
|
|
36522
|
+
label,
|
|
36523
|
+
placeholder = "Selecciona...",
|
|
36524
|
+
children,
|
|
36525
|
+
strictMode = true,
|
|
36526
|
+
...props
|
|
36527
|
+
}) {
|
|
36589
36528
|
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
36590
36529
|
const [inputValue, setInputValue] = (0, import_react8.useState)("");
|
|
36591
36530
|
const [options, setOptions] = (0, import_react8.useState)(
|
|
@@ -36602,7 +36541,7 @@ function Select(_a) {
|
|
|
36602
36541
|
};
|
|
36603
36542
|
const normalize = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z]/g, "");
|
|
36604
36543
|
(0, import_react8.useEffect)(() => {
|
|
36605
|
-
var
|
|
36544
|
+
var _a;
|
|
36606
36545
|
const parsedOptions = import_react8.default.Children.toArray(children).filter((child) => {
|
|
36607
36546
|
return child.type === "option";
|
|
36608
36547
|
}).map((child) => {
|
|
@@ -36613,7 +36552,7 @@ function Select(_a) {
|
|
|
36613
36552
|
});
|
|
36614
36553
|
setOptions(parsedOptions);
|
|
36615
36554
|
setFiltered(parsedOptions);
|
|
36616
|
-
const value = (props == null ? void 0 : props.value) && ((
|
|
36555
|
+
const value = (props == null ? void 0 : props.value) && ((_a = parsedOptions.find((opt) => opt.value == props.value)) == null ? void 0 : _a.label);
|
|
36617
36556
|
setInputValue(value);
|
|
36618
36557
|
}, [children]);
|
|
36619
36558
|
(0, import_react8.useEffect)(() => {
|
|
@@ -36658,19 +36597,19 @@ function Select(_a) {
|
|
|
36658
36597
|
}
|
|
36659
36598
|
}
|
|
36660
36599
|
}, [isOpen]);
|
|
36661
|
-
return /* @__PURE__ */ (0,
|
|
36662
|
-
label && /* @__PURE__ */ (0,
|
|
36600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: containerRef, className: "w-full", children: [
|
|
36601
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "font-bold mb-1 block", children: [
|
|
36663
36602
|
label,
|
|
36664
36603
|
" ",
|
|
36665
|
-
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0,
|
|
36604
|
+
(props == null ? void 0 : props.required) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-red-500", children: "*" })
|
|
36666
36605
|
] }),
|
|
36667
|
-
/* @__PURE__ */ (0,
|
|
36668
|
-
/* @__PURE__ */ (0,
|
|
36606
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", children: [
|
|
36607
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
36669
36608
|
"input",
|
|
36670
|
-
|
|
36609
|
+
{
|
|
36671
36610
|
autoComplete: "off",
|
|
36672
|
-
ref: inputRef
|
|
36673
|
-
|
|
36611
|
+
ref: inputRef,
|
|
36612
|
+
...props,
|
|
36674
36613
|
className: [
|
|
36675
36614
|
"p-2 w-full rounded border shadow",
|
|
36676
36615
|
props == null ? void 0 : props.className
|
|
@@ -36678,13 +36617,13 @@ function Select(_a) {
|
|
|
36678
36617
|
value: inputValue,
|
|
36679
36618
|
onBlur: (e) => {
|
|
36680
36619
|
setTimeout(() => {
|
|
36681
|
-
var
|
|
36620
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
36682
36621
|
const item = validOption(e.target.value);
|
|
36683
36622
|
if (!item) {
|
|
36684
36623
|
if (strictMode) {
|
|
36685
36624
|
e.target.value = "";
|
|
36686
36625
|
setInputValue("");
|
|
36687
|
-
(_c = (
|
|
36626
|
+
(_c = (_b = (_a = e.target) == null ? void 0 : _a.classList) == null ? void 0 : _b.remove) == null ? void 0 : _c.call(_b, "bg-green-200");
|
|
36688
36627
|
(_f = (_e = (_d = e.target) == null ? void 0 : _d.classList) == null ? void 0 : _e.add) == null ? void 0 : _f.call(_e, "bg-red-200");
|
|
36689
36628
|
return;
|
|
36690
36629
|
}
|
|
@@ -36702,40 +36641,40 @@ function Select(_a) {
|
|
|
36702
36641
|
placeholder,
|
|
36703
36642
|
onFocus: () => setIsOpen(true),
|
|
36704
36643
|
onKeyDown: handleKeyDown
|
|
36705
|
-
}
|
|
36644
|
+
}
|
|
36706
36645
|
),
|
|
36707
|
-
!isOpen && /* @__PURE__ */ (0,
|
|
36708
|
-
isOpen && inputValue != "" && /* @__PURE__ */ (0,
|
|
36646
|
+
!isOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SelectIcon, {}) }),
|
|
36647
|
+
isOpen && inputValue != "" && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
36709
36648
|
"button",
|
|
36710
36649
|
{
|
|
36711
36650
|
onClick: (e) => {
|
|
36712
|
-
var
|
|
36651
|
+
var _a, _b, _c, _d, _e, _f;
|
|
36713
36652
|
setIsOpen(true);
|
|
36714
36653
|
setInputValue("");
|
|
36715
36654
|
if ((inputRef == null ? void 0 : inputRef.current) && strictMode) {
|
|
36716
|
-
(_c = (
|
|
36655
|
+
(_c = (_b = (_a = inputRef.current) == null ? void 0 : _a.classList) == null ? void 0 : _b.remove) == null ? void 0 : _c.call(_b, "bg-green-200");
|
|
36717
36656
|
(_f = (_e = (_d = inputRef.current) == null ? void 0 : _d.classList) == null ? void 0 : _e.add) == null ? void 0 : _f.call(_e, "bg-red-200");
|
|
36718
36657
|
inputRef.current.focus();
|
|
36719
36658
|
}
|
|
36720
36659
|
},
|
|
36721
36660
|
className: "absolute top-0 right-0 flex flex-col justify-center items-center px-2 py-2 font-bold text-red-500",
|
|
36722
36661
|
style: { zIndex: 999999999 },
|
|
36723
|
-
children: /* @__PURE__ */ (0,
|
|
36662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CloseIcon, {})
|
|
36724
36663
|
}
|
|
36725
36664
|
),
|
|
36726
|
-
isOpen && filtered.length > 0 && /* @__PURE__ */ (0,
|
|
36665
|
+
isOpen && filtered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
36727
36666
|
"div",
|
|
36728
36667
|
{
|
|
36729
36668
|
style: { zIndex: 9999999999 },
|
|
36730
36669
|
className: `absolute w-full border rounded shadow bg-white z-10 max-h-100 overflow-y-auto ${openUpwards ? "bottom-full mb-1" : "mt-1"}`,
|
|
36731
|
-
children: filtered.map((opt, index) => /* @__PURE__ */ (0,
|
|
36670
|
+
children: filtered.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
36732
36671
|
"div",
|
|
36733
36672
|
{
|
|
36734
36673
|
className: `p-2 cursor-pointer ${index === highlightedIndex ? "bg-blue-100" : "hover:bg-gray-100"}`,
|
|
36735
36674
|
onClick: () => {
|
|
36736
|
-
var
|
|
36675
|
+
var _a;
|
|
36737
36676
|
try {
|
|
36738
|
-
(
|
|
36677
|
+
(_a = props == null ? void 0 : props.onChange) == null ? void 0 : _a.call(props, {
|
|
36739
36678
|
target: { value: (opt == null ? void 0 : opt.value) || opt.label }
|
|
36740
36679
|
});
|
|
36741
36680
|
} catch (error) {
|
|
@@ -36764,7 +36703,7 @@ function Select(_a) {
|
|
|
36764
36703
|
}
|
|
36765
36704
|
)
|
|
36766
36705
|
] }),
|
|
36767
|
-
isOpen && /* @__PURE__ */ (0,
|
|
36706
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
36768
36707
|
"div",
|
|
36769
36708
|
{
|
|
36770
36709
|
style: { zIndex: 1 },
|
|
@@ -36782,9 +36721,9 @@ function Select(_a) {
|
|
|
36782
36721
|
var import_react9 = __toESM(require("react"));
|
|
36783
36722
|
|
|
36784
36723
|
// src/modal/close.tsx
|
|
36785
|
-
var
|
|
36724
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
36786
36725
|
function CloseIcon2() {
|
|
36787
|
-
return /* @__PURE__ */ (0,
|
|
36726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
36788
36727
|
"svg",
|
|
36789
36728
|
{
|
|
36790
36729
|
stroke: "currentColor",
|
|
@@ -36794,14 +36733,14 @@ function CloseIcon2() {
|
|
|
36794
36733
|
height: "20px",
|
|
36795
36734
|
width: "20px",
|
|
36796
36735
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36797
|
-
children: /* @__PURE__ */ (0,
|
|
36736
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M256 48C141.31 48 48 141.31 48 256s93.31 208 208 208 208-93.31 208-208S370.69 48 256 48zm86.63 272L320 342.63l-64-64-64 64L169.37 320l64-64-64-64L192 169.37l64 64 64-64L342.63 192l-64 64z" })
|
|
36798
36737
|
}
|
|
36799
36738
|
);
|
|
36800
36739
|
}
|
|
36801
36740
|
|
|
36802
36741
|
// src/modal/index.tsx
|
|
36803
36742
|
var import_material3 = require("@mui/material");
|
|
36804
|
-
var
|
|
36743
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
36805
36744
|
function Modal({ button, children, ref, title = "" }) {
|
|
36806
36745
|
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
36807
36746
|
function show() {
|
|
@@ -36810,34 +36749,35 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
36810
36749
|
function hide() {
|
|
36811
36750
|
setOpen(false);
|
|
36812
36751
|
}
|
|
36813
|
-
return /* @__PURE__ */ (0,
|
|
36752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
36814
36753
|
import_react9.default.Children.map(button, (child) => {
|
|
36815
36754
|
if (import_react9.default.isValidElement(child)) {
|
|
36816
36755
|
const { type, props } = child;
|
|
36817
|
-
return import_react9.default.createElement(type,
|
|
36756
|
+
return import_react9.default.createElement(type, {
|
|
36757
|
+
...props,
|
|
36818
36758
|
onClick: (e) => {
|
|
36819
36759
|
var _a, _b;
|
|
36820
36760
|
show();
|
|
36821
36761
|
(_b = (_a = child.props) == null ? void 0 : _a.onClick) == null ? void 0 : _b.call(_a, e);
|
|
36822
36762
|
}
|
|
36823
|
-
})
|
|
36763
|
+
});
|
|
36824
36764
|
}
|
|
36825
36765
|
return child;
|
|
36826
36766
|
}),
|
|
36827
|
-
/* @__PURE__ */ (0,
|
|
36828
|
-
/* @__PURE__ */ (0,
|
|
36767
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_material3.Dialog, { open, onClose: hide, fullWidth: true, maxWidth: "xl", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "m-auto p-5", children: [
|
|
36768
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
36829
36769
|
"button",
|
|
36830
36770
|
{
|
|
36831
36771
|
onClick: hide,
|
|
36832
36772
|
className: "absolute top-0 right-0 text-red-500 ",
|
|
36833
|
-
children: /* @__PURE__ */ (0,
|
|
36773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CloseIcon2, {})
|
|
36834
36774
|
}
|
|
36835
36775
|
),
|
|
36836
|
-
/* @__PURE__ */ (0,
|
|
36837
|
-
/* @__PURE__ */ (0,
|
|
36776
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "font-bold text-xl", children: title }),
|
|
36777
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col gap-3 pt-6", children: import_react9.default.Children.map(children, (child) => {
|
|
36838
36778
|
if (import_react9.default.isValidElement(child)) {
|
|
36839
36779
|
const { type, props } = child;
|
|
36840
|
-
return import_react9.default.createElement(type,
|
|
36780
|
+
return import_react9.default.createElement(type, { ...props, hide });
|
|
36841
36781
|
}
|
|
36842
36782
|
return child;
|
|
36843
36783
|
}) })
|
|
@@ -36846,10 +36786,10 @@ function Modal({ button, children, ref, title = "" }) {
|
|
|
36846
36786
|
}
|
|
36847
36787
|
|
|
36848
36788
|
// src/pre/index.tsx
|
|
36849
|
-
var
|
|
36789
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
36850
36790
|
var Pre = ({ data }) => {
|
|
36851
36791
|
const formatted = JSON.stringify(data, null, 2);
|
|
36852
|
-
return /* @__PURE__ */ (0,
|
|
36792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
36853
36793
|
"pre",
|
|
36854
36794
|
{
|
|
36855
36795
|
style: {
|
|
@@ -36898,9 +36838,9 @@ var import_react10 = require("react");
|
|
|
36898
36838
|
var import_react_datepicker = __toESM(require("react-datepicker"));
|
|
36899
36839
|
|
|
36900
36840
|
// src/calendar/calendar.icon.tsx
|
|
36901
|
-
var
|
|
36841
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
36902
36842
|
function CalendarIcon() {
|
|
36903
|
-
return /* @__PURE__ */ (0,
|
|
36843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
36904
36844
|
"svg",
|
|
36905
36845
|
{
|
|
36906
36846
|
stroke: "currentColor",
|
|
@@ -36910,30 +36850,23 @@ function CalendarIcon() {
|
|
|
36910
36850
|
height: "20px",
|
|
36911
36851
|
width: "20px",
|
|
36912
36852
|
xmlns: "http://www.w3.org/2000/svg",
|
|
36913
|
-
children: /* @__PURE__ */ (0,
|
|
36853
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M12 192h424c6.6 0 12 5.4 12 12v260c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V204c0-6.6 5.4-12 12-12zm436-44v-36c0-26.5-21.5-48-48-48h-48V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H160V12c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v52H48C21.5 64 0 85.5 0 112v36c0 6.6 5.4 12 12 12h424c6.6 0 12-5.4 12-12z" })
|
|
36914
36854
|
}
|
|
36915
36855
|
);
|
|
36916
36856
|
}
|
|
36917
36857
|
|
|
36918
36858
|
// src/calendar/index.tsx
|
|
36919
36859
|
var import_material4 = require("@mui/material");
|
|
36920
|
-
var
|
|
36921
|
-
function MyCalendar(
|
|
36922
|
-
|
|
36923
|
-
|
|
36924
|
-
|
|
36925
|
-
|
|
36926
|
-
|
|
36927
|
-
|
|
36928
|
-
|
|
36929
|
-
|
|
36930
|
-
"enabledDates",
|
|
36931
|
-
"onChange",
|
|
36932
|
-
"defaultValue",
|
|
36933
|
-
"className",
|
|
36934
|
-
"label",
|
|
36935
|
-
"value"
|
|
36936
|
-
]);
|
|
36860
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
36861
|
+
function MyCalendar({
|
|
36862
|
+
enabledDates,
|
|
36863
|
+
onChange,
|
|
36864
|
+
defaultValue = "",
|
|
36865
|
+
className = "",
|
|
36866
|
+
label = "",
|
|
36867
|
+
value,
|
|
36868
|
+
...otherProps
|
|
36869
|
+
}) {
|
|
36937
36870
|
const [selectedDate, setSelectedDate] = (0, import_react10.useState)(null);
|
|
36938
36871
|
const [dateStr, setDateStr] = (0, import_react10.useState)(
|
|
36939
36872
|
defaultValue || value || ""
|
|
@@ -36955,22 +36888,23 @@ function MyCalendar(_a) {
|
|
|
36955
36888
|
if (!(enabledDates == null ? void 0 : enabledDates.length)) {
|
|
36956
36889
|
return null;
|
|
36957
36890
|
}
|
|
36958
|
-
return /* @__PURE__ */ (0,
|
|
36959
|
-
/* @__PURE__ */ (0,
|
|
36960
|
-
/* @__PURE__ */ (0,
|
|
36891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "relative", children: [
|
|
36892
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
36893
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "font-bold", children: [
|
|
36961
36894
|
label,
|
|
36962
36895
|
" ",
|
|
36963
|
-
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ (0,
|
|
36896
|
+
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-red-500", children: "*" })
|
|
36964
36897
|
] }),
|
|
36965
|
-
/* @__PURE__ */ (0,
|
|
36898
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
36966
36899
|
"div",
|
|
36967
36900
|
{
|
|
36968
36901
|
className: "cursor-pointer flex items-center justify-center",
|
|
36969
36902
|
onClick: (e) => setOpen(true),
|
|
36970
36903
|
children: [
|
|
36971
|
-
/* @__PURE__ */ (0,
|
|
36904
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
36972
36905
|
"input",
|
|
36973
|
-
|
|
36906
|
+
{
|
|
36907
|
+
...otherProps,
|
|
36974
36908
|
className: [
|
|
36975
36909
|
"p-2 w-full rounded border shadow cursor-pointer",
|
|
36976
36910
|
className
|
|
@@ -36980,15 +36914,15 @@ function MyCalendar(_a) {
|
|
|
36980
36914
|
return;
|
|
36981
36915
|
},
|
|
36982
36916
|
readOnly: true
|
|
36983
|
-
}
|
|
36917
|
+
}
|
|
36984
36918
|
),
|
|
36985
|
-
/* @__PURE__ */ (0,
|
|
36919
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CalendarIcon, {}) })
|
|
36986
36920
|
]
|
|
36987
36921
|
}
|
|
36988
36922
|
) })
|
|
36989
36923
|
] }),
|
|
36990
|
-
/* @__PURE__ */ (0,
|
|
36991
|
-
/* @__PURE__ */ (0,
|
|
36924
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_material4.Dialog, { open, children: [
|
|
36925
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
36992
36926
|
"button",
|
|
36993
36927
|
{
|
|
36994
36928
|
className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
|
|
@@ -36996,7 +36930,7 @@ function MyCalendar(_a) {
|
|
|
36996
36930
|
children: "x"
|
|
36997
36931
|
}
|
|
36998
36932
|
) }),
|
|
36999
|
-
/* @__PURE__ */ (0,
|
|
36933
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
37000
36934
|
import_react_datepicker.default,
|
|
37001
36935
|
{
|
|
37002
36936
|
inline: true,
|
|
@@ -37010,9 +36944,9 @@ function MyCalendar(_a) {
|
|
|
37010
36944
|
}
|
|
37011
36945
|
|
|
37012
36946
|
// src/doc-viewer/icon.tsx
|
|
37013
|
-
var
|
|
36947
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
37014
36948
|
function Icon() {
|
|
37015
|
-
return /* @__PURE__ */ (0,
|
|
36949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
37016
36950
|
"svg",
|
|
37017
36951
|
{
|
|
37018
36952
|
stroke: "currentColor",
|
|
@@ -37022,13 +36956,13 @@ function Icon() {
|
|
|
37022
36956
|
height: "200px",
|
|
37023
36957
|
width: "200px",
|
|
37024
36958
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37025
|
-
children: /* @__PURE__ */ (0,
|
|
36959
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40v88a6,6,0,0,0,12,0V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216a2,2,0,0,1-2,2H176a6,6,0,0,0,0,12h24a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM108,130a50,50,0,0,0-46.66,32H60a34,34,0,0,0,0,68h48a50,50,0,0,0,0-100Zm0,88H60a22,22,0,0,1-1.65-43.94c-.06.47-.1.93-.15,1.4a6,6,0,1,0,12,1.08A38.57,38.57,0,0,1,71.3,170a5.71,5.71,0,0,0,.24-.86A38,38,0,1,1,108,218Z" })
|
|
37026
36960
|
}
|
|
37027
36961
|
);
|
|
37028
36962
|
}
|
|
37029
36963
|
|
|
37030
36964
|
// src/doc-viewer/index.tsx
|
|
37031
|
-
var
|
|
36965
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
37032
36966
|
function DocumentViewer({ item }) {
|
|
37033
36967
|
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
37034
36968
|
const isImage = contentType.startsWith("image/");
|
|
@@ -37037,10 +36971,10 @@ function DocumentViewer({ item }) {
|
|
|
37037
36971
|
const viewerUrl = isGoogleDocCompatible ? `https://docs.google.com/gview?url=${encodeURIComponent(
|
|
37038
36972
|
url
|
|
37039
36973
|
)}&embedded=true` : url;
|
|
37040
|
-
return /* @__PURE__ */ (0,
|
|
37041
|
-
/* @__PURE__ */ (0,
|
|
37042
|
-
/* @__PURE__ */ (0,
|
|
37043
|
-
/* @__PURE__ */ (0,
|
|
36974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "border shadow rounded p-2 h-[100%]", children: [
|
|
36975
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "mb-1 flex justify-between ", children: [
|
|
36976
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: "font-bold", children: name }),
|
|
36977
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
37044
36978
|
"a",
|
|
37045
36979
|
{
|
|
37046
36980
|
href: url,
|
|
@@ -37052,7 +36986,7 @@ function DocumentViewer({ item }) {
|
|
|
37052
36986
|
}
|
|
37053
36987
|
)
|
|
37054
36988
|
] }),
|
|
37055
|
-
isImage ? /* @__PURE__ */ (0,
|
|
36989
|
+
isImage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
37056
36990
|
"img",
|
|
37057
36991
|
{
|
|
37058
36992
|
src: url,
|
|
@@ -37065,7 +36999,7 @@ function DocumentViewer({ item }) {
|
|
|
37065
36999
|
display: "block"
|
|
37066
37000
|
}
|
|
37067
37001
|
}
|
|
37068
|
-
) : isGoogleDocCompatible ? /* @__PURE__ */ (0,
|
|
37002
|
+
) : isGoogleDocCompatible ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
37069
37003
|
"iframe",
|
|
37070
37004
|
{
|
|
37071
37005
|
title: name,
|
|
@@ -37073,7 +37007,7 @@ function DocumentViewer({ item }) {
|
|
|
37073
37007
|
style: { width, height, border: "none" },
|
|
37074
37008
|
allowFullScreen: true
|
|
37075
37009
|
}
|
|
37076
|
-
) : /* @__PURE__ */ (0,
|
|
37010
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
37077
37011
|
"div",
|
|
37078
37012
|
{
|
|
37079
37013
|
style: {
|
|
@@ -37083,7 +37017,7 @@ function DocumentViewer({ item }) {
|
|
|
37083
37017
|
objectFit: "cover",
|
|
37084
37018
|
display: "block"
|
|
37085
37019
|
},
|
|
37086
|
-
children: /* @__PURE__ */ (0,
|
|
37020
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, {})
|
|
37087
37021
|
}
|
|
37088
37022
|
)
|
|
37089
37023
|
] });
|
|
@@ -37096,9 +37030,9 @@ var import_react15 = __toESM(require("react"));
|
|
|
37096
37030
|
var import_react11 = require("react");
|
|
37097
37031
|
|
|
37098
37032
|
// src/table3/filters.tsx
|
|
37099
|
-
var
|
|
37033
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
37100
37034
|
function FilterOffIcon() {
|
|
37101
|
-
return /* @__PURE__ */ (0,
|
|
37035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
37102
37036
|
"svg",
|
|
37103
37037
|
{
|
|
37104
37038
|
stroke: "currentColor",
|
|
@@ -37108,12 +37042,12 @@ function FilterOffIcon() {
|
|
|
37108
37042
|
height: "20px",
|
|
37109
37043
|
width: "20px",
|
|
37110
37044
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37111
|
-
children: /* @__PURE__ */ (0,
|
|
37045
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M6.92893 0.514648L21.0711 14.6568L19.6569 16.071L15.834 12.2486L14 14.9999V21.9999H10V14.9999L4 5.99993H3V3.99993L7.585 3.99965L5.51472 1.92886L6.92893 0.514648ZM21 3.99993V5.99993H20L18.085 8.87193L13.213 3.99993H21Z" })
|
|
37112
37046
|
}
|
|
37113
37047
|
);
|
|
37114
37048
|
}
|
|
37115
37049
|
function OrderDesc() {
|
|
37116
|
-
return /* @__PURE__ */ (0,
|
|
37050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
37117
37051
|
"svg",
|
|
37118
37052
|
{
|
|
37119
37053
|
stroke: "currentColor",
|
|
@@ -37123,12 +37057,12 @@ function OrderDesc() {
|
|
|
37123
37057
|
height: "20px",
|
|
37124
37058
|
width: "20px",
|
|
37125
37059
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37126
|
-
children: /* @__PURE__ */ (0,
|
|
37060
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm112-128h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 65.63V48a16 16 0 0 0-16-16H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 190.37V208a16 16 0 0 0 16 16zm159.06 234.62l-59.27-160A16 16 0 0 0 372.72 288h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 480h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 480H432a16 16 0 0 0 15.06-21.38zM335.61 400L352 352l16.39 48z" })
|
|
37127
37061
|
}
|
|
37128
37062
|
);
|
|
37129
37063
|
}
|
|
37130
37064
|
function OrderAsc() {
|
|
37131
|
-
return /* @__PURE__ */ (0,
|
|
37065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
37132
37066
|
"svg",
|
|
37133
37067
|
{
|
|
37134
37068
|
stroke: "currentColor",
|
|
@@ -37138,12 +37072,12 @@ function OrderAsc() {
|
|
|
37138
37072
|
height: "20px",
|
|
37139
37073
|
width: "20px",
|
|
37140
37074
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37141
|
-
children: /* @__PURE__ */ (0,
|
|
37075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M176 352h-48V48a16 16 0 0 0-16-16H80a16 16 0 0 0-16 16v304H16c-14.19 0-21.36 17.24-11.29 27.31l80 96a16 16 0 0 0 22.62 0l80-96C197.35 369.26 190.22 352 176 352zm240-64H288a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h56l-61.26 70.45A32 32 0 0 0 272 446.37V464a16 16 0 0 0 16 16h128a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16h-56l61.26-70.45A32 32 0 0 0 432 321.63V304a16 16 0 0 0-16-16zm31.06-85.38l-59.27-160A16 16 0 0 0 372.72 32h-41.44a16 16 0 0 0-15.07 10.62l-59.27 160A16 16 0 0 0 272 224h24.83a16 16 0 0 0 15.23-11.08l4.42-12.92h71l4.41 12.92A16 16 0 0 0 407.16 224H432a16 16 0 0 0 15.06-21.38zM335.61 144L352 96l16.39 48z" })
|
|
37142
37076
|
}
|
|
37143
37077
|
);
|
|
37144
37078
|
}
|
|
37145
37079
|
function EditIcon2() {
|
|
37146
|
-
return /* @__PURE__ */ (0,
|
|
37080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
37147
37081
|
"svg",
|
|
37148
37082
|
{
|
|
37149
37083
|
stroke: "currentColor",
|
|
@@ -37153,12 +37087,12 @@ function EditIcon2() {
|
|
|
37153
37087
|
height: "20px",
|
|
37154
37088
|
width: "20px",
|
|
37155
37089
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37156
|
-
children: /* @__PURE__ */ (0,
|
|
37090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M402.6 83.2l90.2 90.2c3.8 3.8 3.8 10 0 13.8L274.4 405.6l-92.8 10.3c-12.4 1.4-22.9-9.1-21.5-21.5l10.3-92.8L388.8 83.2c3.8-3.8 10-3.8 13.8 0zm162-22.9l-48.8-48.8c-15.2-15.2-39.9-15.2-55.2 0l-35.4 35.4c-3.8 3.8-3.8 10 0 13.8l90.2 90.2c3.8 3.8 10 3.8 13.8 0l35.4-35.4c15.2-15.3 15.2-40 0-55.2zM384 346.2V448H64V128h229.8c3.2 0 6.2-1.3 8.5-3.5l40-40c7.6-7.6 2.2-20.5-8.5-20.5H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V306.2c0-10.7-12.9-16-20.5-8.5l-40 40c-2.2 2.3-3.5 5.3-3.5 8.5z" })
|
|
37157
37091
|
}
|
|
37158
37092
|
);
|
|
37159
37093
|
}
|
|
37160
37094
|
function SaveIcon() {
|
|
37161
|
-
return /* @__PURE__ */ (0,
|
|
37095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
37162
37096
|
"svg",
|
|
37163
37097
|
{
|
|
37164
37098
|
stroke: "currentColor",
|
|
@@ -37169,14 +37103,14 @@ function SaveIcon() {
|
|
|
37169
37103
|
width: "20px",
|
|
37170
37104
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37171
37105
|
children: [
|
|
37172
|
-
/* @__PURE__ */ (0,
|
|
37173
|
-
/* @__PURE__ */ (0,
|
|
37106
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M272 64h-16c-4.4 0-8 3.6-8 8v72c0 4.4 7.6 8 12 8h12c4.4 0 8-3.6 8-8V72c0-4.4-3.6-8-8-8z" }),
|
|
37107
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M433.9 130.1L382 78.2c-9-9-21.3-14.2-34.1-14.2h-28c-8.8 0-16 7.3-16 16.2v80c0 8.8-7.2 16-16 16H160c-8.8 0-16-7.2-16-16v-80c0-8.8-7.2-16.2-16-16.2H96c-17.6 0-32 14.4-32 32v320c0 17.6 14.4 32 32 32h320c17.6 0 32-14.4 32-32V164c0-12.7-5.1-24.9-14.1-33.9zM322 400.1c0 8.8-8 16-17.8 16H143.8c-9.8 0-17.8-7.2-17.8-16v-96c0-8.8 8-16 17.8-16h160.4c9.8 0 17.8 7.2 17.8 16v96z" })
|
|
37174
37108
|
]
|
|
37175
37109
|
}
|
|
37176
37110
|
);
|
|
37177
37111
|
}
|
|
37178
37112
|
function ExcelIcon() {
|
|
37179
|
-
return /* @__PURE__ */ (0,
|
|
37113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
37180
37114
|
"svg",
|
|
37181
37115
|
{
|
|
37182
37116
|
stroke: "currentColor",
|
|
@@ -37186,13 +37120,13 @@ function ExcelIcon() {
|
|
|
37186
37120
|
height: "20px",
|
|
37187
37121
|
width: "20px",
|
|
37188
37122
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37189
|
-
children: /* @__PURE__ */ (0,
|
|
37123
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M2.85858 2.87732L15.4293 1.0815C15.7027 1.04245 15.9559 1.2324 15.995 1.50577C15.9983 1.52919 16 1.55282 16 1.57648V22.4235C16 22.6996 15.7761 22.9235 15.5 22.9235C15.4763 22.9235 15.4527 22.9218 15.4293 22.9184L2.85858 21.1226C2.36593 21.0522 2 20.6303 2 20.1327V3.86727C2 3.36962 2.36593 2.9477 2.85858 2.87732ZM17 2.99997H21C21.5523 2.99997 22 3.44769 22 3.99997V20C22 20.5523 21.5523 21 21 21H17V2.99997ZM10.2 12L13 7.99997H10.6L9 10.2857L7.39999 7.99997H5L7.8 12L5 16H7.39999L9 13.7143L10.6 16H13L10.2 12Z" })
|
|
37190
37124
|
}
|
|
37191
37125
|
);
|
|
37192
37126
|
}
|
|
37193
37127
|
|
|
37194
37128
|
// src/table3/filter.tsx
|
|
37195
|
-
var
|
|
37129
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
37196
37130
|
function Filter({
|
|
37197
37131
|
h,
|
|
37198
37132
|
objectData,
|
|
@@ -37253,8 +37187,8 @@ function Filter({
|
|
|
37253
37187
|
setSelected(news);
|
|
37254
37188
|
}
|
|
37255
37189
|
}, [data]);
|
|
37256
|
-
return /* @__PURE__ */ (0,
|
|
37257
|
-
/* @__PURE__ */ (0,
|
|
37190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("th", { className: "cursor-pointer", children: [
|
|
37191
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "relative", children: visible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37258
37192
|
"div",
|
|
37259
37193
|
{
|
|
37260
37194
|
className: " w-full h-screen top-0 left-0 fixed ",
|
|
@@ -37262,8 +37196,8 @@ function Filter({
|
|
|
37262
37196
|
onClick: (e) => setVisible(!visible)
|
|
37263
37197
|
}
|
|
37264
37198
|
) }),
|
|
37265
|
-
/* @__PURE__ */ (0,
|
|
37266
|
-
/* @__PURE__ */ (0,
|
|
37199
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "relative w-full justify-center flex", children: [
|
|
37200
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
37267
37201
|
"div",
|
|
37268
37202
|
{
|
|
37269
37203
|
style: (colSizes == null ? void 0 : colSizes[h]) ? {
|
|
@@ -37275,61 +37209,63 @@ function Filter({
|
|
|
37275
37209
|
onClick: (e) => setVisible(!visible),
|
|
37276
37210
|
children: [
|
|
37277
37211
|
sort && //
|
|
37278
|
-
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ (0,
|
|
37279
|
-
/* @__PURE__ */ (0,
|
|
37280
|
-
selected.length < items.length && /* @__PURE__ */ (0,
|
|
37212
|
+
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-green-300", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OrderAsc, {}) }) : (sort == null ? void 0 : sort[h]) == "desc" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-green-300", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OrderDesc, {}) })),
|
|
37213
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: h }),
|
|
37214
|
+
selected.length < items.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-red-500 ", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FilterOffIcon, {}) })
|
|
37281
37215
|
]
|
|
37282
37216
|
}
|
|
37283
37217
|
),
|
|
37284
|
-
visible && /* @__PURE__ */ (0,
|
|
37218
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37285
37219
|
"div",
|
|
37286
37220
|
{
|
|
37287
37221
|
className: "border shadow rounded bg-white p-1 absolute left-0 text-black",
|
|
37288
37222
|
style: { zIndex: 9999 },
|
|
37289
|
-
children: /* @__PURE__ */ (0,
|
|
37290
|
-
/* @__PURE__ */ (0,
|
|
37223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col gap-1 w-[300px] min-w-[300px] resize-x overflow-auto", children: [
|
|
37224
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
37291
37225
|
"div",
|
|
37292
37226
|
{
|
|
37293
37227
|
onClick: (e) => {
|
|
37294
|
-
const newSort =
|
|
37228
|
+
const newSort = { ...sort };
|
|
37295
37229
|
newSort[h] = "asc";
|
|
37296
|
-
const reorderedSort =
|
|
37297
|
-
[h]: "asc"
|
|
37298
|
-
|
|
37299
|
-
|
|
37300
|
-
|
|
37230
|
+
const reorderedSort = {
|
|
37231
|
+
[h]: "asc",
|
|
37232
|
+
...Object.fromEntries(
|
|
37233
|
+
Object.entries(newSort).filter(([key]) => key !== h)
|
|
37234
|
+
)
|
|
37235
|
+
};
|
|
37301
37236
|
setSort(reorderedSort);
|
|
37302
37237
|
setVisible(false);
|
|
37303
37238
|
},
|
|
37304
37239
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37305
37240
|
children: [
|
|
37306
|
-
/* @__PURE__ */ (0,
|
|
37241
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OrderAsc, {}),
|
|
37307
37242
|
" Ordenar de la A a la Z"
|
|
37308
37243
|
]
|
|
37309
37244
|
}
|
|
37310
37245
|
),
|
|
37311
|
-
/* @__PURE__ */ (0,
|
|
37246
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
37312
37247
|
"div",
|
|
37313
37248
|
{
|
|
37314
37249
|
onClick: (e) => {
|
|
37315
|
-
const newSort =
|
|
37250
|
+
const newSort = { ...sort };
|
|
37316
37251
|
newSort[h] = "desc";
|
|
37317
|
-
const reorderedSort =
|
|
37318
|
-
[h]: "desc"
|
|
37319
|
-
|
|
37320
|
-
|
|
37321
|
-
|
|
37252
|
+
const reorderedSort = {
|
|
37253
|
+
[h]: "desc",
|
|
37254
|
+
...Object.fromEntries(
|
|
37255
|
+
Object.entries(newSort).filter(([key]) => key !== h)
|
|
37256
|
+
)
|
|
37257
|
+
};
|
|
37322
37258
|
setSort(reorderedSort);
|
|
37323
37259
|
setVisible(false);
|
|
37324
37260
|
},
|
|
37325
37261
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37326
37262
|
children: [
|
|
37327
|
-
/* @__PURE__ */ (0,
|
|
37263
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OrderDesc, {}),
|
|
37328
37264
|
"Ordenar de la Z a la A"
|
|
37329
37265
|
]
|
|
37330
37266
|
}
|
|
37331
37267
|
),
|
|
37332
|
-
selected.length < items.length && /* @__PURE__ */ (0,
|
|
37268
|
+
selected.length < items.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
37333
37269
|
"div",
|
|
37334
37270
|
{
|
|
37335
37271
|
className: "p-1 flex items-center justify-between px-2 bg-red-200 border shadow rounded",
|
|
@@ -37338,11 +37274,11 @@ function Filter({
|
|
|
37338
37274
|
},
|
|
37339
37275
|
children: [
|
|
37340
37276
|
"Borrar Filtro",
|
|
37341
|
-
/* @__PURE__ */ (0,
|
|
37277
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-white ", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(FilterOffIcon, {}) })
|
|
37342
37278
|
]
|
|
37343
37279
|
}
|
|
37344
37280
|
),
|
|
37345
|
-
/* @__PURE__ */ (0,
|
|
37281
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37346
37282
|
"input",
|
|
37347
37283
|
{
|
|
37348
37284
|
className: "border shadow rounded p-2 w-full",
|
|
@@ -37361,8 +37297,8 @@ function Filter({
|
|
|
37361
37297
|
}
|
|
37362
37298
|
}
|
|
37363
37299
|
) }),
|
|
37364
|
-
/* @__PURE__ */ (0,
|
|
37365
|
-
/* @__PURE__ */ (0,
|
|
37300
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex gap-1 cursor-pointer px-1", children: [
|
|
37301
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37366
37302
|
"input",
|
|
37367
37303
|
{
|
|
37368
37304
|
type: "checkbox",
|
|
@@ -37378,9 +37314,9 @@ function Filter({
|
|
|
37378
37314
|
),
|
|
37379
37315
|
"(Seleccionar Todo)"
|
|
37380
37316
|
] }) }),
|
|
37381
|
-
/* @__PURE__ */ (0,
|
|
37382
|
-
return /* @__PURE__ */ (0,
|
|
37383
|
-
/* @__PURE__ */ (0,
|
|
37317
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "overflow-auto flex gap-1 flex-col p-1 border shadow rounded h-[300px]", children: itemsFiltered.map((item) => {
|
|
37318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "hover:bg-gray-100 ", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("label", { className: "flex gap-1 cursor-pointer truncate", children: [
|
|
37319
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37384
37320
|
"input",
|
|
37385
37321
|
{
|
|
37386
37322
|
type: "checkbox",
|
|
@@ -37401,8 +37337,8 @@ function Filter({
|
|
|
37401
37337
|
item || "(Vacias)"
|
|
37402
37338
|
] }) }, item);
|
|
37403
37339
|
}) }),
|
|
37404
|
-
/* @__PURE__ */ (0,
|
|
37405
|
-
/* @__PURE__ */ (0,
|
|
37340
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex justify-between px-1", children: [
|
|
37341
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37406
37342
|
"button",
|
|
37407
37343
|
{
|
|
37408
37344
|
className: "p-1 shadow rounded border bg-red-500 text-white",
|
|
@@ -37413,7 +37349,7 @@ function Filter({
|
|
|
37413
37349
|
children: "Cancelar"
|
|
37414
37350
|
}
|
|
37415
37351
|
),
|
|
37416
|
-
/* @__PURE__ */ (0,
|
|
37352
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
37417
37353
|
"button",
|
|
37418
37354
|
{
|
|
37419
37355
|
className: "p-1 shadow rounded border bg-blue-500 text-white",
|
|
@@ -37432,7 +37368,7 @@ function Filter({
|
|
|
37432
37368
|
}
|
|
37433
37369
|
|
|
37434
37370
|
// src/table3/head.tsx
|
|
37435
|
-
var
|
|
37371
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
37436
37372
|
function TableHead({
|
|
37437
37373
|
headers,
|
|
37438
37374
|
selectItems,
|
|
@@ -37447,9 +37383,9 @@ function TableHead({
|
|
|
37447
37383
|
sort,
|
|
37448
37384
|
setSort
|
|
37449
37385
|
}) {
|
|
37450
|
-
return /* @__PURE__ */ (0,
|
|
37451
|
-
modal && /* @__PURE__ */ (0,
|
|
37452
|
-
selectItems && /* @__PURE__ */ (0,
|
|
37386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("tr", { className: "bg-blue-500 text-white font-bold", children: [
|
|
37387
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("th", { children: "-" }),
|
|
37388
|
+
selectItems && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("th", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
37453
37389
|
"input",
|
|
37454
37390
|
{
|
|
37455
37391
|
className: "m-2",
|
|
@@ -37477,7 +37413,7 @@ function TableHead({
|
|
|
37477
37413
|
) }),
|
|
37478
37414
|
Object.values(headers).map((h) => {
|
|
37479
37415
|
if (h.startsWith("_")) return null;
|
|
37480
|
-
return /* @__PURE__ */ (0,
|
|
37416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
37481
37417
|
Filter,
|
|
37482
37418
|
{
|
|
37483
37419
|
objectData,
|
|
@@ -37500,7 +37436,7 @@ var import_react13 = require("react");
|
|
|
37500
37436
|
|
|
37501
37437
|
// src/table3/tr.tsx
|
|
37502
37438
|
var import_react12 = __toESM(require("react"));
|
|
37503
|
-
var
|
|
37439
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
37504
37440
|
function TR({
|
|
37505
37441
|
handlers,
|
|
37506
37442
|
setObjectData,
|
|
@@ -37520,7 +37456,7 @@ function TR({
|
|
|
37520
37456
|
symbols
|
|
37521
37457
|
}) {
|
|
37522
37458
|
const color = selected == index ? "bg-blue-600 text-white hover:bg-blue-800" : index % 2 == 0 ? "bg-white" : "bg-blue-50";
|
|
37523
|
-
return /* @__PURE__ */ (0,
|
|
37459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
37524
37460
|
"tr",
|
|
37525
37461
|
{
|
|
37526
37462
|
className: ` hover:bg-blue-100 ${color} cursor-pointer`,
|
|
@@ -37528,7 +37464,7 @@ function TR({
|
|
|
37528
37464
|
setSelected(selected == index ? -1 : index);
|
|
37529
37465
|
},
|
|
37530
37466
|
children: [
|
|
37531
|
-
modal && /* @__PURE__ */ (0,
|
|
37467
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("th", { className: "border", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
37532
37468
|
"button",
|
|
37533
37469
|
{
|
|
37534
37470
|
className: "p-1 border shadow-rounded bg-blue-500 rounded text-white",
|
|
@@ -37537,10 +37473,10 @@ function TR({
|
|
|
37537
37473
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
37538
37474
|
setDialogRow(row);
|
|
37539
37475
|
},
|
|
37540
|
-
children: /* @__PURE__ */ (0,
|
|
37476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditIcon2, {})
|
|
37541
37477
|
}
|
|
37542
37478
|
) }),
|
|
37543
|
-
selectItems && /* @__PURE__ */ (0,
|
|
37479
|
+
selectItems && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("th", { className: "border", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
37544
37480
|
"input",
|
|
37545
37481
|
{
|
|
37546
37482
|
type: "checkbox",
|
|
@@ -37561,52 +37497,60 @@ function TR({
|
|
|
37561
37497
|
return null;
|
|
37562
37498
|
} else if (handlers == null ? void 0 : handlers[h]) {
|
|
37563
37499
|
const original = handlers[h];
|
|
37564
|
-
const cloned = import_react12.default.cloneElement(original,
|
|
37500
|
+
const cloned = import_react12.default.cloneElement(original, {
|
|
37565
37501
|
// si es controlado por value → actualiza con row[h]
|
|
37566
37502
|
value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
|
|
37567
37503
|
// si usa children → actualiza con row[h] también
|
|
37568
|
-
children: ((_b = original.props) == null ? void 0 : _b.children) ? typeof original.props.children == "object" ? (_c = original.props) == null ? void 0 : _c.children : row == null ? void 0 : row[h] : null
|
|
37569
|
-
|
|
37570
|
-
|
|
37571
|
-
|
|
37572
|
-
|
|
37573
|
-
|
|
37574
|
-
|
|
37575
|
-
|
|
37576
|
-
|
|
37577
|
-
|
|
37578
|
-
|
|
37579
|
-
|
|
37580
|
-
|
|
37581
|
-
|
|
37582
|
-
|
|
37583
|
-
|
|
37584
|
-
|
|
37585
|
-
|
|
37586
|
-
|
|
37587
|
-
|
|
37588
|
-
|
|
37589
|
-
|
|
37590
|
-
|
|
37591
|
-
|
|
37592
|
-
|
|
37593
|
-
|
|
37594
|
-
|
|
37595
|
-
|
|
37596
|
-
|
|
37597
|
-
|
|
37598
|
-
|
|
37599
|
-
|
|
37600
|
-
|
|
37601
|
-
|
|
37602
|
-
|
|
37603
|
-
|
|
37504
|
+
children: ((_b = original.props) == null ? void 0 : _b.children) ? typeof original.props.children == "object" ? (_c = original.props) == null ? void 0 : _c.children : row == null ? void 0 : row[h] : null,
|
|
37505
|
+
...original.props.hasOwnProperty("row") ? {
|
|
37506
|
+
row,
|
|
37507
|
+
updateRow: (finalResponse) => setObjectData({
|
|
37508
|
+
...(row == null ? void 0 : row._id) ? {
|
|
37509
|
+
_id: row == null ? void 0 : row._id,
|
|
37510
|
+
_updated: true,
|
|
37511
|
+
_visible: true
|
|
37512
|
+
} : {
|
|
37513
|
+
id: (row == null ? void 0 : row.id) || null,
|
|
37514
|
+
_updated: true,
|
|
37515
|
+
_visible: true
|
|
37516
|
+
},
|
|
37517
|
+
...finalResponse
|
|
37518
|
+
})
|
|
37519
|
+
} : {},
|
|
37520
|
+
...Object.keys({
|
|
37521
|
+
...original.props,
|
|
37522
|
+
onChange: (_d = original.props) == null ? void 0 : _d.onChange
|
|
37523
|
+
}).filter((action) => action.startsWith("on")).reduce((acc, action) => {
|
|
37524
|
+
acc[action] = (e) => {
|
|
37525
|
+
var _a2, _b2;
|
|
37526
|
+
e.row = row;
|
|
37527
|
+
const userResponse = ((_b2 = (_a2 = original.props) == null ? void 0 : _a2[action]) == null ? void 0 : _b2.call(_a2, e)) || {};
|
|
37528
|
+
const newObject = (row == null ? void 0 : row._id) ? {
|
|
37529
|
+
_id: row == null ? void 0 : row._id,
|
|
37530
|
+
[h]: e.target.value,
|
|
37531
|
+
_updated: true,
|
|
37532
|
+
_visible: true,
|
|
37533
|
+
...userResponse
|
|
37534
|
+
} : {
|
|
37535
|
+
id: (row == null ? void 0 : row.id) || null,
|
|
37536
|
+
[h]: e.target.value,
|
|
37537
|
+
_updated: true,
|
|
37538
|
+
_visible: true,
|
|
37539
|
+
...userResponse
|
|
37540
|
+
};
|
|
37541
|
+
const finalResponse = action == "onChange" && onChange ? onChange({ ...e, row: { ...e.row, ...newObject } }) : {};
|
|
37542
|
+
setObjectData({ ...newObject, ...finalResponse });
|
|
37543
|
+
};
|
|
37544
|
+
return acc;
|
|
37545
|
+
}, {})
|
|
37546
|
+
});
|
|
37547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: `text-black `, children: cloned }, h);
|
|
37604
37548
|
}
|
|
37605
|
-
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ (0,
|
|
37549
|
+
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: `text-center border max-w-[${colSize}px] `, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1 w-full", children: [
|
|
37606
37550
|
symbols[h],
|
|
37607
37551
|
" ",
|
|
37608
37552
|
row[h]
|
|
37609
|
-
] }) }, h) : /* @__PURE__ */ (0,
|
|
37553
|
+
] }) }, h) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: `text-center border max-w-[${colSize}px]`, children: row[h] }, h);
|
|
37610
37554
|
})
|
|
37611
37555
|
]
|
|
37612
37556
|
},
|
|
@@ -37615,7 +37559,7 @@ function TR({
|
|
|
37615
37559
|
}
|
|
37616
37560
|
|
|
37617
37561
|
// src/table3/body.tsx
|
|
37618
|
-
var
|
|
37562
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
37619
37563
|
function TableBody({
|
|
37620
37564
|
objectData,
|
|
37621
37565
|
setObjectData,
|
|
@@ -37659,34 +37603,36 @@ function TableBody({
|
|
|
37659
37603
|
return key >= start && key < end;
|
|
37660
37604
|
}).map(([id, k], index) => {
|
|
37661
37605
|
const row = objectData[id];
|
|
37662
|
-
return /* @__PURE__ */ (0,
|
|
37606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
37663
37607
|
TR,
|
|
37664
|
-
|
|
37665
|
-
|
|
37666
|
-
|
|
37667
|
-
|
|
37668
|
-
|
|
37669
|
-
|
|
37670
|
-
|
|
37671
|
-
|
|
37672
|
-
|
|
37673
|
-
|
|
37674
|
-
|
|
37675
|
-
|
|
37676
|
-
|
|
37677
|
-
|
|
37678
|
-
|
|
37679
|
-
|
|
37680
|
-
|
|
37681
|
-
|
|
37608
|
+
{
|
|
37609
|
+
...{
|
|
37610
|
+
headers,
|
|
37611
|
+
index,
|
|
37612
|
+
setObjectData,
|
|
37613
|
+
id,
|
|
37614
|
+
row,
|
|
37615
|
+
handlers,
|
|
37616
|
+
selectItems,
|
|
37617
|
+
colSizes,
|
|
37618
|
+
modal,
|
|
37619
|
+
modalRef,
|
|
37620
|
+
dialogRow,
|
|
37621
|
+
symbols,
|
|
37622
|
+
setDialogRow,
|
|
37623
|
+
setSelected,
|
|
37624
|
+
selected,
|
|
37625
|
+
onChange
|
|
37626
|
+
}
|
|
37627
|
+
},
|
|
37682
37628
|
id
|
|
37683
37629
|
);
|
|
37684
37630
|
});
|
|
37685
|
-
return /* @__PURE__ */ (0,
|
|
37631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("tbody", { children: sorted });
|
|
37686
37632
|
}
|
|
37687
37633
|
|
|
37688
37634
|
// src/table3/panel.tsx
|
|
37689
|
-
var
|
|
37635
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
37690
37636
|
function Panel({
|
|
37691
37637
|
page,
|
|
37692
37638
|
setPage,
|
|
@@ -37697,9 +37643,9 @@ function Panel({
|
|
|
37697
37643
|
maxItems
|
|
37698
37644
|
}) {
|
|
37699
37645
|
const excel = useExcel();
|
|
37700
|
-
return /* @__PURE__ */ (0,
|
|
37701
|
-
/* @__PURE__ */ (0,
|
|
37702
|
-
onSave && /* @__PURE__ */ (0,
|
|
37646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2 bg-gray-100 items-center", children: [
|
|
37647
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 ", children: [
|
|
37648
|
+
onSave && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
37703
37649
|
"button",
|
|
37704
37650
|
{
|
|
37705
37651
|
className: "p-2 border shadow rounded bg-blue-500 text-white flex items-center gap-1 text-md",
|
|
@@ -37708,41 +37654,41 @@ function Panel({
|
|
|
37708
37654
|
},
|
|
37709
37655
|
children: [
|
|
37710
37656
|
" ",
|
|
37711
|
-
/* @__PURE__ */ (0,
|
|
37657
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SaveIcon, {}),
|
|
37712
37658
|
"Guardar"
|
|
37713
37659
|
]
|
|
37714
37660
|
}
|
|
37715
37661
|
),
|
|
37716
|
-
exportName && /* @__PURE__ */ (0,
|
|
37662
|
+
exportName && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
37717
37663
|
"button",
|
|
37718
37664
|
{
|
|
37719
37665
|
className: "p-2 border shadow rounded bg-green-800 text-white flex items-center gap-1 text-md",
|
|
37720
37666
|
onClick: (e) => {
|
|
37721
37667
|
excel.export(
|
|
37722
37668
|
Object.values(objectData).reverse().map((d) => {
|
|
37723
|
-
const
|
|
37669
|
+
const { _visible, _id, _selected, ...data } = d;
|
|
37724
37670
|
return data;
|
|
37725
37671
|
}),
|
|
37726
37672
|
exportName + ".xlsx"
|
|
37727
37673
|
);
|
|
37728
37674
|
},
|
|
37729
37675
|
children: [
|
|
37730
|
-
/* @__PURE__ */ (0,
|
|
37676
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ExcelIcon, {}),
|
|
37731
37677
|
"Exportar"
|
|
37732
37678
|
]
|
|
37733
37679
|
}
|
|
37734
37680
|
)
|
|
37735
37681
|
] }),
|
|
37736
|
-
maxItems !== Infinity && /* @__PURE__ */ (0,
|
|
37737
|
-
/* @__PURE__ */ (0,
|
|
37738
|
-
/* @__PURE__ */ (0,
|
|
37739
|
-
/* @__PURE__ */ (0,
|
|
37682
|
+
maxItems !== Infinity && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2 items-center text-2xl", children: [
|
|
37683
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setPage(1), disabled: page === 1, children: "\u23EE" }),
|
|
37684
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("button", { onClick: () => setPage(page - 1), disabled: page === 1, children: "\u25C0" }),
|
|
37685
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "text-sm", children: [
|
|
37740
37686
|
"P\xE1gina ",
|
|
37741
37687
|
page,
|
|
37742
37688
|
" / ",
|
|
37743
37689
|
totalPages
|
|
37744
37690
|
] }),
|
|
37745
|
-
/* @__PURE__ */ (0,
|
|
37691
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
37746
37692
|
"button",
|
|
37747
37693
|
{
|
|
37748
37694
|
onClick: () => setPage(page + 1),
|
|
@@ -37750,7 +37696,7 @@ function Panel({
|
|
|
37750
37696
|
children: "\u25B6"
|
|
37751
37697
|
}
|
|
37752
37698
|
),
|
|
37753
|
-
/* @__PURE__ */ (0,
|
|
37699
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
37754
37700
|
"button",
|
|
37755
37701
|
{
|
|
37756
37702
|
onClick: () => setPage(totalPages),
|
|
@@ -37763,7 +37709,7 @@ function Panel({
|
|
|
37763
37709
|
}
|
|
37764
37710
|
|
|
37765
37711
|
// src/table3/footer.tsx
|
|
37766
|
-
var
|
|
37712
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
37767
37713
|
function TableFooter({
|
|
37768
37714
|
objectData,
|
|
37769
37715
|
headers,
|
|
@@ -37788,27 +37734,27 @@ function TableFooter({
|
|
|
37788
37734
|
return null;
|
|
37789
37735
|
}
|
|
37790
37736
|
}
|
|
37791
|
-
return footer && /* @__PURE__ */ (0,
|
|
37792
|
-
selectItems && /* @__PURE__ */ (0,
|
|
37793
|
-
modal && /* @__PURE__ */ (0,
|
|
37737
|
+
return footer && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("tr", { className: "bg-blue-500 text-white", children: [
|
|
37738
|
+
selectItems && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("th", {}),
|
|
37739
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("th", {}),
|
|
37794
37740
|
headers.map((header) => {
|
|
37795
37741
|
if (header.startsWith("_")) {
|
|
37796
37742
|
return null;
|
|
37797
37743
|
} else if (footer == null ? void 0 : footer[header]) {
|
|
37798
|
-
return symbols && (symbols == null ? void 0 : symbols[header]) ? /* @__PURE__ */ (0,
|
|
37744
|
+
return symbols && (symbols == null ? void 0 : symbols[header]) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("th", { className: "flex items-center gap-1", children: [
|
|
37799
37745
|
symbols[header],
|
|
37800
37746
|
" ",
|
|
37801
37747
|
operacion(footer[header], header)
|
|
37802
|
-
] }, header) : /* @__PURE__ */ (0,
|
|
37748
|
+
] }, header) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("th", { children: operacion(footer[header], header) }, header);
|
|
37803
37749
|
}
|
|
37804
|
-
return /* @__PURE__ */ (0,
|
|
37750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("th", {}, header);
|
|
37805
37751
|
})
|
|
37806
37752
|
] }) });
|
|
37807
37753
|
}
|
|
37808
37754
|
|
|
37809
37755
|
// src/table3/dialog.tsx
|
|
37810
37756
|
var import_react14 = __toESM(require("react"));
|
|
37811
|
-
var
|
|
37757
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
37812
37758
|
function Dialog4({
|
|
37813
37759
|
modalRef,
|
|
37814
37760
|
children,
|
|
@@ -37836,15 +37782,15 @@ function Dialog4({
|
|
|
37836
37782
|
}
|
|
37837
37783
|
return null;
|
|
37838
37784
|
}, [dialogRow, children]);
|
|
37839
|
-
return /* @__PURE__ */ (0,
|
|
37785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
37840
37786
|
"dialog",
|
|
37841
37787
|
{
|
|
37842
37788
|
ref: modalRef,
|
|
37843
37789
|
className: "p-6 rounded-xl shadow-2xl backdrop:bg-black/50 w-[100%] h-screen",
|
|
37844
37790
|
children: [
|
|
37845
|
-
/* @__PURE__ */ (0,
|
|
37846
|
-
/* @__PURE__ */ (0,
|
|
37847
|
-
/* @__PURE__ */ (0,
|
|
37791
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between items-center mb-4", children: [
|
|
37792
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", {}),
|
|
37793
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
37848
37794
|
"button",
|
|
37849
37795
|
{
|
|
37850
37796
|
onClick: () => {
|
|
@@ -37856,7 +37802,7 @@ function Dialog4({
|
|
|
37856
37802
|
}
|
|
37857
37803
|
)
|
|
37858
37804
|
] }),
|
|
37859
|
-
/* @__PURE__ */ (0,
|
|
37805
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "text-gray-700", children: clonedModal })
|
|
37860
37806
|
]
|
|
37861
37807
|
}
|
|
37862
37808
|
);
|
|
@@ -37864,70 +37810,61 @@ function Dialog4({
|
|
|
37864
37810
|
var dialog_default = Dialog4;
|
|
37865
37811
|
|
|
37866
37812
|
// src/table3/index.tsx
|
|
37867
|
-
var
|
|
37868
|
-
function Table3(
|
|
37869
|
-
|
|
37870
|
-
|
|
37871
|
-
|
|
37872
|
-
|
|
37873
|
-
|
|
37874
|
-
|
|
37875
|
-
|
|
37876
|
-
|
|
37877
|
-
|
|
37878
|
-
|
|
37879
|
-
|
|
37880
|
-
|
|
37881
|
-
|
|
37882
|
-
|
|
37883
|
-
"data",
|
|
37884
|
-
"selectItems",
|
|
37885
|
-
"maxItems",
|
|
37886
|
-
"onSave",
|
|
37887
|
-
"exportName",
|
|
37888
|
-
"colSizes",
|
|
37889
|
-
"modal",
|
|
37890
|
-
"header",
|
|
37891
|
-
"footer",
|
|
37892
|
-
"onChange",
|
|
37893
|
-
"symbols",
|
|
37894
|
-
"sortBy"
|
|
37895
|
-
]);
|
|
37813
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
37814
|
+
function Table3({
|
|
37815
|
+
data,
|
|
37816
|
+
selectItems,
|
|
37817
|
+
maxItems = Infinity,
|
|
37818
|
+
onSave,
|
|
37819
|
+
exportName,
|
|
37820
|
+
colSizes,
|
|
37821
|
+
modal,
|
|
37822
|
+
header,
|
|
37823
|
+
footer,
|
|
37824
|
+
onChange,
|
|
37825
|
+
symbols,
|
|
37826
|
+
sortBy,
|
|
37827
|
+
...props
|
|
37828
|
+
}) {
|
|
37896
37829
|
const [handlers, setHandlers] = (0, import_react15.useState)({});
|
|
37897
37830
|
const [page, setPage] = (0, import_react15.useState)(1);
|
|
37898
37831
|
function dataReducer(a, b) {
|
|
37899
37832
|
if (b == null) return {};
|
|
37900
37833
|
if (Array.isArray(b)) {
|
|
37901
37834
|
const obj = b.reduce((acc, bb) => {
|
|
37902
|
-
var
|
|
37835
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
37903
37836
|
const id = (bb == null ? void 0 : bb.id) || (bb == null ? void 0 : bb._id);
|
|
37904
37837
|
if (!id) throw new Error("Se necesita el id o _id");
|
|
37905
|
-
const cc = ((
|
|
37838
|
+
const cc = ((_a = a == null ? void 0 : a[id]) == null ? void 0 : _a._updated) ? {
|
|
37839
|
+
...bb,
|
|
37840
|
+
...a == null ? void 0 : a[id],
|
|
37906
37841
|
_selected: bb == null ? void 0 : bb._selected,
|
|
37907
37842
|
_visible: (bb == null ? void 0 : bb._visible) == false ? false : true
|
|
37908
|
-
}
|
|
37843
|
+
} : {
|
|
37844
|
+
...a == null ? void 0 : a[id],
|
|
37845
|
+
...bb,
|
|
37909
37846
|
_selected: bb == null ? void 0 : bb._selected,
|
|
37910
37847
|
_visible: (bb == null ? void 0 : bb._visible) == false ? false : true
|
|
37911
|
-
}
|
|
37912
|
-
const newHandlers =
|
|
37848
|
+
};
|
|
37849
|
+
const newHandlers = { ...handlers };
|
|
37913
37850
|
for (let item in cc) {
|
|
37914
37851
|
const isReactComponent = import_react15.default.isValidElement(cc[item]);
|
|
37915
37852
|
if (isReactComponent) {
|
|
37916
37853
|
newHandlers[item] = cc[item];
|
|
37917
|
-
const value = ((_c = (
|
|
37854
|
+
const value = ((_c = (_b = cc[item]) == null ? void 0 : _b.props) == null ? void 0 : _c.value) || (typeof ((_e = (_d = cc[item]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) !== "object" ? (_g = (_f = cc[item]) == null ? void 0 : _f.props) == null ? void 0 : _g.children : "");
|
|
37918
37855
|
cc[item] = value || "";
|
|
37919
37856
|
}
|
|
37920
37857
|
}
|
|
37921
37858
|
setHandlers(newHandlers);
|
|
37922
|
-
acc[id] =
|
|
37859
|
+
acc[id] = { ...bb, ...cc };
|
|
37923
37860
|
return acc;
|
|
37924
37861
|
}, {});
|
|
37925
37862
|
return obj;
|
|
37926
37863
|
} else {
|
|
37927
|
-
const newA =
|
|
37864
|
+
const newA = { ...a };
|
|
37928
37865
|
const id = (b == null ? void 0 : b.id) || (b == null ? void 0 : b._id);
|
|
37929
37866
|
if (!id) throw new Error("Se necesita el id o _id para actualizar");
|
|
37930
|
-
newA[id] =
|
|
37867
|
+
newA[id] = { ...newA[id], ...b };
|
|
37931
37868
|
return newA;
|
|
37932
37869
|
}
|
|
37933
37870
|
}
|
|
@@ -37951,7 +37888,7 @@ function Table3(_a) {
|
|
|
37951
37888
|
const [sort, setSort] = (0, import_react15.useState)(sortBy);
|
|
37952
37889
|
const modalRef = (0, import_react15.useRef)(null);
|
|
37953
37890
|
const [dialogRow, setDialogRow] = (0, import_react15.useState)({});
|
|
37954
|
-
const context =
|
|
37891
|
+
const context = {
|
|
37955
37892
|
objectData,
|
|
37956
37893
|
headers,
|
|
37957
37894
|
handlers,
|
|
@@ -37974,18 +37911,19 @@ function Table3(_a) {
|
|
|
37974
37911
|
data,
|
|
37975
37912
|
symbols,
|
|
37976
37913
|
sort,
|
|
37977
|
-
setSort
|
|
37978
|
-
|
|
37914
|
+
setSort,
|
|
37915
|
+
...props
|
|
37916
|
+
};
|
|
37979
37917
|
(0, import_react15.useEffect)(() => {
|
|
37980
37918
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
37981
37919
|
const newDialogRow = objectData[dialogRow == null ? void 0 : dialogRow.id] || objectData[dialogRow == null ? void 0 : dialogRow._id];
|
|
37982
37920
|
setDialogRow(newDialogRow);
|
|
37983
37921
|
}
|
|
37984
37922
|
}, [objectData]);
|
|
37985
|
-
const style = (props == null ? void 0 : props.style) ?
|
|
37923
|
+
const style = (props == null ? void 0 : props.style) ? { ...props.style, tableLayout: "fixed" } : { tableLayout: "fixed" };
|
|
37986
37924
|
if (!objectData) return null;
|
|
37987
|
-
return /* @__PURE__ */ (0,
|
|
37988
|
-
modal && /* @__PURE__ */ (0,
|
|
37925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
|
|
37926
|
+
modal && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
37989
37927
|
dialog_default,
|
|
37990
37928
|
{
|
|
37991
37929
|
modalRef,
|
|
@@ -37995,18 +37933,155 @@ function Table3(_a) {
|
|
|
37995
37933
|
children: modal
|
|
37996
37934
|
}
|
|
37997
37935
|
),
|
|
37998
|
-
header && /* @__PURE__ */ (0,
|
|
37999
|
-
/* @__PURE__ */ (0,
|
|
38000
|
-
/* @__PURE__ */ (0,
|
|
38001
|
-
/* @__PURE__ */ (0,
|
|
38002
|
-
/* @__PURE__ */ (0,
|
|
38003
|
-
/* @__PURE__ */ (0,
|
|
38004
|
-
] })
|
|
37936
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
37937
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Panel, { ...context }),
|
|
37938
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("table", { ...props, style, children: [
|
|
37939
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableHead, { ...context }),
|
|
37940
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableBody, { ...context }),
|
|
37941
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TableFooter, { ...context })
|
|
37942
|
+
] })
|
|
38005
37943
|
] });
|
|
38006
37944
|
}
|
|
37945
|
+
|
|
37946
|
+
// src/alert/index.tsx
|
|
37947
|
+
var import_react16 = require("react");
|
|
37948
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
37949
|
+
function usePopup() {
|
|
37950
|
+
const [popup, setPopup] = (0, import_react16.useState)({ type: "alert", message: "", visible: false, inputValue: "" });
|
|
37951
|
+
function alert2(message) {
|
|
37952
|
+
return new Promise((resolve) => {
|
|
37953
|
+
setPopup({
|
|
37954
|
+
type: "alert",
|
|
37955
|
+
message,
|
|
37956
|
+
visible: true,
|
|
37957
|
+
inputValue: "",
|
|
37958
|
+
onConfirm: () => resolve()
|
|
37959
|
+
});
|
|
37960
|
+
});
|
|
37961
|
+
}
|
|
37962
|
+
function confirm(message) {
|
|
37963
|
+
return new Promise((resolve) => {
|
|
37964
|
+
setPopup({
|
|
37965
|
+
type: "confirm",
|
|
37966
|
+
message,
|
|
37967
|
+
visible: true,
|
|
37968
|
+
inputValue: "",
|
|
37969
|
+
onConfirm: () => resolve(true),
|
|
37970
|
+
onCancel: () => resolve(false)
|
|
37971
|
+
});
|
|
37972
|
+
});
|
|
37973
|
+
}
|
|
37974
|
+
function prompt(message) {
|
|
37975
|
+
return new Promise((resolve) => {
|
|
37976
|
+
setPopup({
|
|
37977
|
+
type: "prompt",
|
|
37978
|
+
message,
|
|
37979
|
+
visible: true,
|
|
37980
|
+
inputValue: "",
|
|
37981
|
+
onConfirm: (value) => resolve(value != null ? value : ""),
|
|
37982
|
+
onCancel: () => resolve(null)
|
|
37983
|
+
});
|
|
37984
|
+
});
|
|
37985
|
+
}
|
|
37986
|
+
function close(confirmed, value) {
|
|
37987
|
+
setPopup((prev) => {
|
|
37988
|
+
var _a, _b;
|
|
37989
|
+
if (confirmed) (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
37990
|
+
else (_b = prev.onCancel) == null ? void 0 : _b.call(prev);
|
|
37991
|
+
return { ...prev, visible: false, inputValue: "" };
|
|
37992
|
+
});
|
|
37993
|
+
}
|
|
37994
|
+
const PopupComponent = popup.visible ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
37995
|
+
"div",
|
|
37996
|
+
{
|
|
37997
|
+
style: {
|
|
37998
|
+
position: "fixed",
|
|
37999
|
+
top: 0,
|
|
38000
|
+
left: 0,
|
|
38001
|
+
width: "100%",
|
|
38002
|
+
height: "100%",
|
|
38003
|
+
background: "rgba(0,0,0,0.5)",
|
|
38004
|
+
display: "flex",
|
|
38005
|
+
alignItems: "center",
|
|
38006
|
+
justifyContent: "center",
|
|
38007
|
+
zIndex: 1e3
|
|
38008
|
+
},
|
|
38009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
38010
|
+
"div",
|
|
38011
|
+
{
|
|
38012
|
+
style: {
|
|
38013
|
+
background: "#fff",
|
|
38014
|
+
padding: "24px 32px",
|
|
38015
|
+
borderRadius: "8px",
|
|
38016
|
+
minWidth: "300px",
|
|
38017
|
+
textAlign: "center",
|
|
38018
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.2)"
|
|
38019
|
+
},
|
|
38020
|
+
children: [
|
|
38021
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { style: { margin: "0 0 16px", fontSize: "16px" }, children: popup.message }),
|
|
38022
|
+
popup.type === "prompt" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
38023
|
+
"input",
|
|
38024
|
+
{
|
|
38025
|
+
autoFocus: true,
|
|
38026
|
+
type: "text",
|
|
38027
|
+
value: popup.inputValue,
|
|
38028
|
+
onChange: (e) => setPopup((prev) => ({ ...prev, inputValue: e.target.value })),
|
|
38029
|
+
onKeyDown: (e) => e.key === "Enter" && close(true, popup.inputValue),
|
|
38030
|
+
style: {
|
|
38031
|
+
width: "100%",
|
|
38032
|
+
padding: "8px 12px",
|
|
38033
|
+
marginBottom: "16px",
|
|
38034
|
+
border: "1px solid #d1d5db",
|
|
38035
|
+
borderRadius: "6px",
|
|
38036
|
+
fontSize: "14px",
|
|
38037
|
+
boxSizing: "border-box"
|
|
38038
|
+
}
|
|
38039
|
+
}
|
|
38040
|
+
),
|
|
38041
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { display: "flex", gap: "8px", justifyContent: "center" }, children: [
|
|
38042
|
+
(popup.type === "confirm" || popup.type === "prompt") && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
38043
|
+
"button",
|
|
38044
|
+
{
|
|
38045
|
+
onClick: () => close(false),
|
|
38046
|
+
style: {
|
|
38047
|
+
padding: "8px 24px",
|
|
38048
|
+
background: "#e5e7eb",
|
|
38049
|
+
color: "#374151",
|
|
38050
|
+
border: "none",
|
|
38051
|
+
borderRadius: "6px",
|
|
38052
|
+
cursor: "pointer",
|
|
38053
|
+
fontSize: "14px"
|
|
38054
|
+
},
|
|
38055
|
+
children: "Cancelar"
|
|
38056
|
+
}
|
|
38057
|
+
),
|
|
38058
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
38059
|
+
"button",
|
|
38060
|
+
{
|
|
38061
|
+
onClick: () => close(true, popup.inputValue),
|
|
38062
|
+
style: {
|
|
38063
|
+
padding: "8px 24px",
|
|
38064
|
+
background: "#3b82f6",
|
|
38065
|
+
color: "#fff",
|
|
38066
|
+
border: "none",
|
|
38067
|
+
borderRadius: "6px",
|
|
38068
|
+
cursor: "pointer",
|
|
38069
|
+
fontSize: "14px"
|
|
38070
|
+
},
|
|
38071
|
+
children: "OK"
|
|
38072
|
+
}
|
|
38073
|
+
)
|
|
38074
|
+
] })
|
|
38075
|
+
]
|
|
38076
|
+
}
|
|
38077
|
+
)
|
|
38078
|
+
}
|
|
38079
|
+
) : null;
|
|
38080
|
+
return { alert: alert2, confirm, prompt, PopupComponent };
|
|
38081
|
+
}
|
|
38082
|
+
var alert_default = usePopup;
|
|
38007
38083
|
// Annotate the CommonJS export names for ESM import in node:
|
|
38008
38084
|
0 && (module.exports = {
|
|
38009
|
-
Alert,
|
|
38010
38085
|
Button,
|
|
38011
38086
|
Container,
|
|
38012
38087
|
DocumentViewer,
|
|
@@ -38023,6 +38098,7 @@ function Table3(_a) {
|
|
|
38023
38098
|
useDates,
|
|
38024
38099
|
useExcel,
|
|
38025
38100
|
useFormValues,
|
|
38101
|
+
usePopup,
|
|
38026
38102
|
useResources
|
|
38027
38103
|
});
|
|
38028
38104
|
/*! Bundled license information:
|