next-recomponents 2.0.32 → 2.0.34
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -15
- package/dist/index.mjs +112 -113
- package/package.json +1 -1
- package/src/modal/index.tsx +8 -11
- package/src/pop/index.tsx +10 -20
package/dist/index.d.mts
CHANGED
|
@@ -235,7 +235,7 @@ declare function usePopup(): {
|
|
|
235
235
|
confirm: (message: string, color?: PopupColor) => Promise<boolean>;
|
|
236
236
|
prompt: (message: string, color?: PopupColor) => Promise<string | null>;
|
|
237
237
|
modal: (message: ReactNode, color?: PopupColor, icons?: boolean, full?: boolean) => Promise<void>;
|
|
238
|
-
PopupComponent: react_jsx_runtime.JSX.Element | null;
|
|
238
|
+
PopupComponent: () => react_jsx_runtime.JSX.Element | null;
|
|
239
239
|
close: (confirmed: boolean, value?: string) => void;
|
|
240
240
|
updateMessage: (message: ReactNode) => void;
|
|
241
241
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -235,7 +235,7 @@ declare function usePopup(): {
|
|
|
235
235
|
confirm: (message: string, color?: PopupColor) => Promise<boolean>;
|
|
236
236
|
prompt: (message: string, color?: PopupColor) => Promise<string | null>;
|
|
237
237
|
modal: (message: ReactNode, color?: PopupColor, icons?: boolean, full?: boolean) => Promise<void>;
|
|
238
|
-
PopupComponent: react_jsx_runtime.JSX.Element | null;
|
|
238
|
+
PopupComponent: () => react_jsx_runtime.JSX.Element | null;
|
|
239
239
|
close: (confirmed: boolean, value?: string) => void;
|
|
240
240
|
updateMessage: (message: ReactNode) => void;
|
|
241
241
|
};
|
package/dist/index.js
CHANGED
|
@@ -37268,14 +37268,17 @@ function usePopup() {
|
|
|
37268
37268
|
messageRef.current = message;
|
|
37269
37269
|
setPopup((prev) => ({ ...prev }));
|
|
37270
37270
|
}, []);
|
|
37271
|
-
const PopupComponent =
|
|
37272
|
-
|
|
37273
|
-
|
|
37274
|
-
|
|
37275
|
-
|
|
37276
|
-
|
|
37277
|
-
|
|
37278
|
-
|
|
37271
|
+
const PopupComponent = (0, import_react10.useCallback)(() => {
|
|
37272
|
+
if (!popup.visible) return null;
|
|
37273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
37274
|
+
PopupOverlay,
|
|
37275
|
+
{
|
|
37276
|
+
popup: { ...popup, message: messageRef.current },
|
|
37277
|
+
onClose: close,
|
|
37278
|
+
onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
|
|
37279
|
+
}
|
|
37280
|
+
);
|
|
37281
|
+
}, [popup, close]);
|
|
37279
37282
|
return {
|
|
37280
37283
|
alert: alert2,
|
|
37281
37284
|
confirm,
|
|
@@ -37296,21 +37299,17 @@ function Modal({
|
|
|
37296
37299
|
title
|
|
37297
37300
|
}) {
|
|
37298
37301
|
const pop = usePopup();
|
|
37299
|
-
const hide = () => pop.close(false);
|
|
37300
|
-
const childrenWithHide = (0, import_react11.cloneElement)(children, { hide });
|
|
37301
|
-
(0, import_react11.useEffect)(() => {
|
|
37302
|
-
pop.updateMessage(childrenWithHide);
|
|
37303
|
-
}, [children]);
|
|
37302
|
+
const hide = (0, import_react11.useCallback)(() => pop.close(false), [pop.close]);
|
|
37304
37303
|
const props = button == null ? void 0 : button.props;
|
|
37305
37304
|
const onClick = props == null ? void 0 : props.onClick;
|
|
37306
37305
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
37307
37306
|
(0, import_react11.cloneElement)(button, {
|
|
37308
37307
|
onClick: (e) => {
|
|
37309
37308
|
onClick == null ? void 0 : onClick(e);
|
|
37310
|
-
pop.modal(
|
|
37309
|
+
pop.modal((0, import_react11.cloneElement)(children, { hide }), color, false, true);
|
|
37311
37310
|
}
|
|
37312
37311
|
}),
|
|
37313
|
-
pop.PopupComponent
|
|
37312
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(pop.PopupComponent, {})
|
|
37314
37313
|
] });
|
|
37315
37314
|
}
|
|
37316
37315
|
|
package/dist/index.mjs
CHANGED
|
@@ -36935,7 +36935,7 @@ function Select({
|
|
|
36935
36935
|
}
|
|
36936
36936
|
|
|
36937
36937
|
// src/modal/index.tsx
|
|
36938
|
-
import { cloneElement as cloneElement2,
|
|
36938
|
+
import { cloneElement as cloneElement2, useCallback as useCallback2 } from "react";
|
|
36939
36939
|
|
|
36940
36940
|
// src/pop/index.tsx
|
|
36941
36941
|
import { useState as useState9, useCallback, useRef as useRef3 } from "react";
|
|
@@ -37254,14 +37254,17 @@ function usePopup() {
|
|
|
37254
37254
|
messageRef.current = message;
|
|
37255
37255
|
setPopup((prev) => ({ ...prev }));
|
|
37256
37256
|
}, []);
|
|
37257
|
-
const PopupComponent =
|
|
37258
|
-
|
|
37259
|
-
|
|
37260
|
-
|
|
37261
|
-
|
|
37262
|
-
|
|
37263
|
-
|
|
37264
|
-
|
|
37257
|
+
const PopupComponent = useCallback(() => {
|
|
37258
|
+
if (!popup.visible) return null;
|
|
37259
|
+
return /* @__PURE__ */ jsx15(
|
|
37260
|
+
PopupOverlay,
|
|
37261
|
+
{
|
|
37262
|
+
popup: { ...popup, message: messageRef.current },
|
|
37263
|
+
onClose: close,
|
|
37264
|
+
onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
|
|
37265
|
+
}
|
|
37266
|
+
);
|
|
37267
|
+
}, [popup, close]);
|
|
37265
37268
|
return {
|
|
37266
37269
|
alert: alert2,
|
|
37267
37270
|
confirm,
|
|
@@ -37274,7 +37277,7 @@ function usePopup() {
|
|
|
37274
37277
|
}
|
|
37275
37278
|
|
|
37276
37279
|
// src/modal/index.tsx
|
|
37277
|
-
import { Fragment as Fragment2, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
37280
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
37278
37281
|
function Modal({
|
|
37279
37282
|
button,
|
|
37280
37283
|
children,
|
|
@@ -37282,29 +37285,25 @@ function Modal({
|
|
|
37282
37285
|
title
|
|
37283
37286
|
}) {
|
|
37284
37287
|
const pop = usePopup();
|
|
37285
|
-
const hide = () => pop.close(false);
|
|
37286
|
-
const childrenWithHide = cloneElement2(children, { hide });
|
|
37287
|
-
useEffect6(() => {
|
|
37288
|
-
pop.updateMessage(childrenWithHide);
|
|
37289
|
-
}, [children]);
|
|
37288
|
+
const hide = useCallback2(() => pop.close(false), [pop.close]);
|
|
37290
37289
|
const props = button == null ? void 0 : button.props;
|
|
37291
37290
|
const onClick = props == null ? void 0 : props.onClick;
|
|
37292
37291
|
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
37293
37292
|
cloneElement2(button, {
|
|
37294
37293
|
onClick: (e) => {
|
|
37295
37294
|
onClick == null ? void 0 : onClick(e);
|
|
37296
|
-
pop.modal(
|
|
37295
|
+
pop.modal(cloneElement2(children, { hide }), color, false, true);
|
|
37297
37296
|
}
|
|
37298
37297
|
}),
|
|
37299
|
-
pop.PopupComponent
|
|
37298
|
+
/* @__PURE__ */ jsx16(pop.PopupComponent, {})
|
|
37300
37299
|
] });
|
|
37301
37300
|
}
|
|
37302
37301
|
|
|
37303
37302
|
// src/pre/index.tsx
|
|
37304
|
-
import { jsx as
|
|
37303
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
37305
37304
|
var Pre = ({ data }) => {
|
|
37306
37305
|
const formatted = JSON.stringify(data, null, 2);
|
|
37307
|
-
return /* @__PURE__ */
|
|
37306
|
+
return /* @__PURE__ */ jsx17(
|
|
37308
37307
|
"pre",
|
|
37309
37308
|
{
|
|
37310
37309
|
style: {
|
|
@@ -37355,9 +37354,9 @@ import {
|
|
|
37355
37354
|
import DatePicker from "react-datepicker";
|
|
37356
37355
|
|
|
37357
37356
|
// src/calendar/calendar.icon.tsx
|
|
37358
|
-
import { jsx as
|
|
37357
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
37359
37358
|
function CalendarIcon() {
|
|
37360
|
-
return /* @__PURE__ */
|
|
37359
|
+
return /* @__PURE__ */ jsx18(
|
|
37361
37360
|
"svg",
|
|
37362
37361
|
{
|
|
37363
37362
|
stroke: "currentColor",
|
|
@@ -37367,14 +37366,14 @@ function CalendarIcon() {
|
|
|
37367
37366
|
height: "20px",
|
|
37368
37367
|
width: "20px",
|
|
37369
37368
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37370
|
-
children: /* @__PURE__ */
|
|
37369
|
+
children: /* @__PURE__ */ jsx18("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" })
|
|
37371
37370
|
}
|
|
37372
37371
|
);
|
|
37373
37372
|
}
|
|
37374
37373
|
|
|
37375
37374
|
// src/calendar/index.tsx
|
|
37376
37375
|
import { Dialog as Dialog2 } from "@mui/material";
|
|
37377
|
-
import { jsx as
|
|
37376
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
37378
37377
|
function MyCalendar({
|
|
37379
37378
|
enabledDates,
|
|
37380
37379
|
onChange,
|
|
@@ -37410,15 +37409,15 @@ function MyCalendar({
|
|
|
37410
37409
|
/* @__PURE__ */ jsxs11("div", { className: "font-bold", children: [
|
|
37411
37410
|
label,
|
|
37412
37411
|
" ",
|
|
37413
|
-
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */
|
|
37412
|
+
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ jsx19("span", { className: "text-red-500", children: "*" })
|
|
37414
37413
|
] }),
|
|
37415
|
-
/* @__PURE__ */
|
|
37414
|
+
/* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsxs11(
|
|
37416
37415
|
"div",
|
|
37417
37416
|
{
|
|
37418
37417
|
className: "cursor-pointer flex items-center justify-center",
|
|
37419
37418
|
onClick: (e) => setOpen(true),
|
|
37420
37419
|
children: [
|
|
37421
|
-
/* @__PURE__ */
|
|
37420
|
+
/* @__PURE__ */ jsx19(
|
|
37422
37421
|
"input",
|
|
37423
37422
|
{
|
|
37424
37423
|
...otherProps,
|
|
@@ -37433,13 +37432,13 @@ function MyCalendar({
|
|
|
37433
37432
|
readOnly: true
|
|
37434
37433
|
}
|
|
37435
37434
|
),
|
|
37436
|
-
/* @__PURE__ */
|
|
37435
|
+
/* @__PURE__ */ jsx19("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx19(CalendarIcon, {}) })
|
|
37437
37436
|
]
|
|
37438
37437
|
}
|
|
37439
37438
|
) })
|
|
37440
37439
|
] }),
|
|
37441
37440
|
/* @__PURE__ */ jsxs11(Dialog2, { open, children: [
|
|
37442
|
-
/* @__PURE__ */
|
|
37441
|
+
/* @__PURE__ */ jsx19("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ jsx19(
|
|
37443
37442
|
"button",
|
|
37444
37443
|
{
|
|
37445
37444
|
className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
|
|
@@ -37447,7 +37446,7 @@ function MyCalendar({
|
|
|
37447
37446
|
children: "x"
|
|
37448
37447
|
}
|
|
37449
37448
|
) }),
|
|
37450
|
-
/* @__PURE__ */
|
|
37449
|
+
/* @__PURE__ */ jsx19("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx19(
|
|
37451
37450
|
DatePicker,
|
|
37452
37451
|
{
|
|
37453
37452
|
inline: true,
|
|
@@ -37461,9 +37460,9 @@ function MyCalendar({
|
|
|
37461
37460
|
}
|
|
37462
37461
|
|
|
37463
37462
|
// src/doc-viewer/icon.tsx
|
|
37464
|
-
import { jsx as
|
|
37463
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
37465
37464
|
function Icon() {
|
|
37466
|
-
return /* @__PURE__ */
|
|
37465
|
+
return /* @__PURE__ */ jsx20(
|
|
37467
37466
|
"svg",
|
|
37468
37467
|
{
|
|
37469
37468
|
stroke: "currentColor",
|
|
@@ -37473,13 +37472,13 @@ function Icon() {
|
|
|
37473
37472
|
height: "200px",
|
|
37474
37473
|
width: "200px",
|
|
37475
37474
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37476
|
-
children: /* @__PURE__ */
|
|
37475
|
+
children: /* @__PURE__ */ jsx20("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" })
|
|
37477
37476
|
}
|
|
37478
37477
|
);
|
|
37479
37478
|
}
|
|
37480
37479
|
|
|
37481
37480
|
// src/doc-viewer/index.tsx
|
|
37482
|
-
import { jsx as
|
|
37481
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
37483
37482
|
function DocumentViewer({ item }) {
|
|
37484
37483
|
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
37485
37484
|
const isImage = contentType.startsWith("image/");
|
|
@@ -37490,8 +37489,8 @@ function DocumentViewer({ item }) {
|
|
|
37490
37489
|
)}&embedded=true` : url;
|
|
37491
37490
|
return /* @__PURE__ */ jsxs12("div", { className: "border shadow rounded p-2 h-[100%]", children: [
|
|
37492
37491
|
/* @__PURE__ */ jsxs12("div", { className: "mb-1 flex justify-between ", children: [
|
|
37493
|
-
/* @__PURE__ */
|
|
37494
|
-
/* @__PURE__ */
|
|
37492
|
+
/* @__PURE__ */ jsx21("h3", { className: "font-bold", children: name }),
|
|
37493
|
+
/* @__PURE__ */ jsx21(
|
|
37495
37494
|
"a",
|
|
37496
37495
|
{
|
|
37497
37496
|
href: url,
|
|
@@ -37503,7 +37502,7 @@ function DocumentViewer({ item }) {
|
|
|
37503
37502
|
}
|
|
37504
37503
|
)
|
|
37505
37504
|
] }),
|
|
37506
|
-
isImage ? /* @__PURE__ */
|
|
37505
|
+
isImage ? /* @__PURE__ */ jsx21(
|
|
37507
37506
|
"img",
|
|
37508
37507
|
{
|
|
37509
37508
|
src: url,
|
|
@@ -37516,7 +37515,7 @@ function DocumentViewer({ item }) {
|
|
|
37516
37515
|
display: "block"
|
|
37517
37516
|
}
|
|
37518
37517
|
}
|
|
37519
|
-
) : isGoogleDocCompatible ? /* @__PURE__ */
|
|
37518
|
+
) : isGoogleDocCompatible ? /* @__PURE__ */ jsx21(
|
|
37520
37519
|
"iframe",
|
|
37521
37520
|
{
|
|
37522
37521
|
title: name,
|
|
@@ -37524,7 +37523,7 @@ function DocumentViewer({ item }) {
|
|
|
37524
37523
|
style: { width, height, border: "none" },
|
|
37525
37524
|
allowFullScreen: true
|
|
37526
37525
|
}
|
|
37527
|
-
) : /* @__PURE__ */
|
|
37526
|
+
) : /* @__PURE__ */ jsx21(
|
|
37528
37527
|
"div",
|
|
37529
37528
|
{
|
|
37530
37529
|
style: {
|
|
@@ -37534,7 +37533,7 @@ function DocumentViewer({ item }) {
|
|
|
37534
37533
|
objectFit: "cover",
|
|
37535
37534
|
display: "block"
|
|
37536
37535
|
},
|
|
37537
|
-
children: /* @__PURE__ */
|
|
37536
|
+
children: /* @__PURE__ */ jsx21(Icon, {})
|
|
37538
37537
|
}
|
|
37539
37538
|
)
|
|
37540
37539
|
] });
|
|
@@ -37542,7 +37541,7 @@ function DocumentViewer({ item }) {
|
|
|
37542
37541
|
|
|
37543
37542
|
// src/table3/index.tsx
|
|
37544
37543
|
import React9, {
|
|
37545
|
-
useEffect as
|
|
37544
|
+
useEffect as useEffect8,
|
|
37546
37545
|
useMemo as useMemo6,
|
|
37547
37546
|
useReducer as useReducer2,
|
|
37548
37547
|
useRef as useRef5,
|
|
@@ -37550,12 +37549,12 @@ import React9, {
|
|
|
37550
37549
|
} from "react";
|
|
37551
37550
|
|
|
37552
37551
|
// src/table3/filter.tsx
|
|
37553
|
-
import { useEffect as
|
|
37552
|
+
import { useEffect as useEffect7, useMemo as useMemo4, useState as useState11 } from "react";
|
|
37554
37553
|
|
|
37555
37554
|
// src/table3/filters.tsx
|
|
37556
|
-
import { jsx as
|
|
37555
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
37557
37556
|
function FilterOffIcon() {
|
|
37558
|
-
return /* @__PURE__ */
|
|
37557
|
+
return /* @__PURE__ */ jsx22(
|
|
37559
37558
|
"svg",
|
|
37560
37559
|
{
|
|
37561
37560
|
stroke: "currentColor",
|
|
@@ -37565,12 +37564,12 @@ function FilterOffIcon() {
|
|
|
37565
37564
|
height: "20px",
|
|
37566
37565
|
width: "20px",
|
|
37567
37566
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37568
|
-
children: /* @__PURE__ */
|
|
37567
|
+
children: /* @__PURE__ */ jsx22("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" })
|
|
37569
37568
|
}
|
|
37570
37569
|
);
|
|
37571
37570
|
}
|
|
37572
37571
|
function OrderDesc() {
|
|
37573
|
-
return /* @__PURE__ */
|
|
37572
|
+
return /* @__PURE__ */ jsx22(
|
|
37574
37573
|
"svg",
|
|
37575
37574
|
{
|
|
37576
37575
|
stroke: "currentColor",
|
|
@@ -37580,12 +37579,12 @@ function OrderDesc() {
|
|
|
37580
37579
|
height: "20px",
|
|
37581
37580
|
width: "20px",
|
|
37582
37581
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37583
|
-
children: /* @__PURE__ */
|
|
37582
|
+
children: /* @__PURE__ */ jsx22("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" })
|
|
37584
37583
|
}
|
|
37585
37584
|
);
|
|
37586
37585
|
}
|
|
37587
37586
|
function OrderAsc() {
|
|
37588
|
-
return /* @__PURE__ */
|
|
37587
|
+
return /* @__PURE__ */ jsx22(
|
|
37589
37588
|
"svg",
|
|
37590
37589
|
{
|
|
37591
37590
|
stroke: "currentColor",
|
|
@@ -37595,12 +37594,12 @@ function OrderAsc() {
|
|
|
37595
37594
|
height: "20px",
|
|
37596
37595
|
width: "20px",
|
|
37597
37596
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37598
|
-
children: /* @__PURE__ */
|
|
37597
|
+
children: /* @__PURE__ */ jsx22("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" })
|
|
37599
37598
|
}
|
|
37600
37599
|
);
|
|
37601
37600
|
}
|
|
37602
37601
|
function EditIcon2() {
|
|
37603
|
-
return /* @__PURE__ */
|
|
37602
|
+
return /* @__PURE__ */ jsx22(
|
|
37604
37603
|
"svg",
|
|
37605
37604
|
{
|
|
37606
37605
|
stroke: "currentColor",
|
|
@@ -37610,7 +37609,7 @@ function EditIcon2() {
|
|
|
37610
37609
|
height: "20px",
|
|
37611
37610
|
width: "20px",
|
|
37612
37611
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37613
|
-
children: /* @__PURE__ */
|
|
37612
|
+
children: /* @__PURE__ */ jsx22("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" })
|
|
37614
37613
|
}
|
|
37615
37614
|
);
|
|
37616
37615
|
}
|
|
@@ -37626,14 +37625,14 @@ function SaveIcon() {
|
|
|
37626
37625
|
width: "20px",
|
|
37627
37626
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37628
37627
|
children: [
|
|
37629
|
-
/* @__PURE__ */
|
|
37630
|
-
/* @__PURE__ */
|
|
37628
|
+
/* @__PURE__ */ jsx22("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" }),
|
|
37629
|
+
/* @__PURE__ */ jsx22("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" })
|
|
37631
37630
|
]
|
|
37632
37631
|
}
|
|
37633
37632
|
);
|
|
37634
37633
|
}
|
|
37635
37634
|
function ExcelIcon() {
|
|
37636
|
-
return /* @__PURE__ */
|
|
37635
|
+
return /* @__PURE__ */ jsx22(
|
|
37637
37636
|
"svg",
|
|
37638
37637
|
{
|
|
37639
37638
|
stroke: "currentColor",
|
|
@@ -37643,13 +37642,13 @@ function ExcelIcon() {
|
|
|
37643
37642
|
height: "20px",
|
|
37644
37643
|
width: "20px",
|
|
37645
37644
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37646
|
-
children: /* @__PURE__ */
|
|
37645
|
+
children: /* @__PURE__ */ jsx22("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" })
|
|
37647
37646
|
}
|
|
37648
37647
|
);
|
|
37649
37648
|
}
|
|
37650
37649
|
|
|
37651
37650
|
// src/table3/filter.tsx
|
|
37652
|
-
import { jsx as
|
|
37651
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
37653
37652
|
function Filter({
|
|
37654
37653
|
h,
|
|
37655
37654
|
objectData,
|
|
@@ -37704,14 +37703,14 @@ function Filter({
|
|
|
37704
37703
|
const hidden = Object.values(objectData).filter(
|
|
37705
37704
|
(d) => d._visible === false
|
|
37706
37705
|
);
|
|
37707
|
-
|
|
37706
|
+
useEffect7(() => {
|
|
37708
37707
|
if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
|
|
37709
37708
|
const news = [...new Set(data.map((o) => o[h]))];
|
|
37710
37709
|
setSelected(news);
|
|
37711
37710
|
}
|
|
37712
37711
|
}, [data]);
|
|
37713
37712
|
return /* @__PURE__ */ jsxs14("th", { className: "cursor-pointer", children: [
|
|
37714
|
-
/* @__PURE__ */
|
|
37713
|
+
/* @__PURE__ */ jsx23("div", { className: "relative", children: visible && /* @__PURE__ */ jsx23(
|
|
37715
37714
|
"div",
|
|
37716
37715
|
{
|
|
37717
37716
|
className: " w-full h-screen top-0 left-0 fixed ",
|
|
@@ -37732,13 +37731,13 @@ function Filter({
|
|
|
37732
37731
|
onClick: (e) => setVisible(!visible),
|
|
37733
37732
|
children: [
|
|
37734
37733
|
sort && //
|
|
37735
|
-
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */
|
|
37736
|
-
/* @__PURE__ */
|
|
37737
|
-
selected.length < items.length && /* @__PURE__ */
|
|
37734
|
+
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ jsx23("div", { className: "text-green-300", children: /* @__PURE__ */ jsx23(OrderAsc, {}) }) : (sort == null ? void 0 : sort[h]) == "desc" && /* @__PURE__ */ jsx23("div", { className: "text-green-300", children: /* @__PURE__ */ jsx23(OrderDesc, {}) })),
|
|
37735
|
+
/* @__PURE__ */ jsx23("div", { children: h }),
|
|
37736
|
+
selected.length < items.length && /* @__PURE__ */ jsx23("div", { className: "text-red-500 ", children: /* @__PURE__ */ jsx23(FilterOffIcon, {}) })
|
|
37738
37737
|
]
|
|
37739
37738
|
}
|
|
37740
37739
|
),
|
|
37741
|
-
visible && /* @__PURE__ */
|
|
37740
|
+
visible && /* @__PURE__ */ jsx23(
|
|
37742
37741
|
"div",
|
|
37743
37742
|
{
|
|
37744
37743
|
className: "border shadow rounded bg-white p-1 absolute left-0 text-black",
|
|
@@ -37761,7 +37760,7 @@ function Filter({
|
|
|
37761
37760
|
},
|
|
37762
37761
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37763
37762
|
children: [
|
|
37764
|
-
/* @__PURE__ */
|
|
37763
|
+
/* @__PURE__ */ jsx23(OrderAsc, {}),
|
|
37765
37764
|
" Ordenar de la A a la Z"
|
|
37766
37765
|
]
|
|
37767
37766
|
}
|
|
@@ -37783,7 +37782,7 @@ function Filter({
|
|
|
37783
37782
|
},
|
|
37784
37783
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37785
37784
|
children: [
|
|
37786
|
-
/* @__PURE__ */
|
|
37785
|
+
/* @__PURE__ */ jsx23(OrderDesc, {}),
|
|
37787
37786
|
"Ordenar de la Z a la A"
|
|
37788
37787
|
]
|
|
37789
37788
|
}
|
|
@@ -37797,11 +37796,11 @@ function Filter({
|
|
|
37797
37796
|
},
|
|
37798
37797
|
children: [
|
|
37799
37798
|
"Borrar Filtro",
|
|
37800
|
-
/* @__PURE__ */
|
|
37799
|
+
/* @__PURE__ */ jsx23("div", { className: "text-white ", children: /* @__PURE__ */ jsx23(FilterOffIcon, {}) })
|
|
37801
37800
|
]
|
|
37802
37801
|
}
|
|
37803
37802
|
),
|
|
37804
|
-
/* @__PURE__ */
|
|
37803
|
+
/* @__PURE__ */ jsx23("div", { className: "", children: /* @__PURE__ */ jsx23(
|
|
37805
37804
|
"input",
|
|
37806
37805
|
{
|
|
37807
37806
|
className: "border shadow rounded p-2 w-full",
|
|
@@ -37820,8 +37819,8 @@ function Filter({
|
|
|
37820
37819
|
}
|
|
37821
37820
|
}
|
|
37822
37821
|
) }),
|
|
37823
|
-
/* @__PURE__ */
|
|
37824
|
-
/* @__PURE__ */
|
|
37822
|
+
/* @__PURE__ */ jsx23("div", { children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer px-1", children: [
|
|
37823
|
+
/* @__PURE__ */ jsx23(
|
|
37825
37824
|
"input",
|
|
37826
37825
|
{
|
|
37827
37826
|
type: "checkbox",
|
|
@@ -37837,9 +37836,9 @@ function Filter({
|
|
|
37837
37836
|
),
|
|
37838
37837
|
"(Seleccionar Todo)"
|
|
37839
37838
|
] }) }),
|
|
37840
|
-
/* @__PURE__ */
|
|
37841
|
-
return /* @__PURE__ */
|
|
37842
|
-
/* @__PURE__ */
|
|
37839
|
+
/* @__PURE__ */ jsx23("div", { className: "overflow-auto flex gap-1 flex-col p-1 border shadow rounded h-[300px]", children: itemsFiltered.map((item) => {
|
|
37840
|
+
return /* @__PURE__ */ jsx23("div", { className: "hover:bg-gray-100 ", children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer truncate", children: [
|
|
37841
|
+
/* @__PURE__ */ jsx23(
|
|
37843
37842
|
"input",
|
|
37844
37843
|
{
|
|
37845
37844
|
type: "checkbox",
|
|
@@ -37861,7 +37860,7 @@ function Filter({
|
|
|
37861
37860
|
] }) }, item);
|
|
37862
37861
|
}) }),
|
|
37863
37862
|
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between px-1", children: [
|
|
37864
|
-
/* @__PURE__ */
|
|
37863
|
+
/* @__PURE__ */ jsx23(
|
|
37865
37864
|
"button",
|
|
37866
37865
|
{
|
|
37867
37866
|
className: "p-1 shadow rounded border bg-red-500 text-white",
|
|
@@ -37872,7 +37871,7 @@ function Filter({
|
|
|
37872
37871
|
children: "Cancelar"
|
|
37873
37872
|
}
|
|
37874
37873
|
),
|
|
37875
|
-
/* @__PURE__ */
|
|
37874
|
+
/* @__PURE__ */ jsx23(
|
|
37876
37875
|
"button",
|
|
37877
37876
|
{
|
|
37878
37877
|
className: "p-1 shadow rounded border bg-blue-500 text-white",
|
|
@@ -37891,7 +37890,7 @@ function Filter({
|
|
|
37891
37890
|
}
|
|
37892
37891
|
|
|
37893
37892
|
// src/table3/head.tsx
|
|
37894
|
-
import { jsx as
|
|
37893
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
37895
37894
|
function TableHead({
|
|
37896
37895
|
headers,
|
|
37897
37896
|
selectItems,
|
|
@@ -37906,9 +37905,9 @@ function TableHead({
|
|
|
37906
37905
|
sort,
|
|
37907
37906
|
setSort
|
|
37908
37907
|
}) {
|
|
37909
|
-
return /* @__PURE__ */
|
|
37910
|
-
modal && /* @__PURE__ */
|
|
37911
|
-
selectItems && /* @__PURE__ */
|
|
37908
|
+
return /* @__PURE__ */ jsx24("thead", { children: /* @__PURE__ */ jsxs15("tr", { className: "bg-blue-500 text-white font-bold", children: [
|
|
37909
|
+
modal && /* @__PURE__ */ jsx24("th", { children: "-" }),
|
|
37910
|
+
selectItems && /* @__PURE__ */ jsx24("th", { children: /* @__PURE__ */ jsx24(
|
|
37912
37911
|
"input",
|
|
37913
37912
|
{
|
|
37914
37913
|
className: "m-2",
|
|
@@ -37936,7 +37935,7 @@ function TableHead({
|
|
|
37936
37935
|
) }),
|
|
37937
37936
|
Object.values(headers).map((h) => {
|
|
37938
37937
|
if (h.startsWith("_")) return null;
|
|
37939
|
-
return /* @__PURE__ */
|
|
37938
|
+
return /* @__PURE__ */ jsx24(
|
|
37940
37939
|
Filter,
|
|
37941
37940
|
{
|
|
37942
37941
|
objectData,
|
|
@@ -37959,7 +37958,7 @@ import { useState as useState12 } from "react";
|
|
|
37959
37958
|
|
|
37960
37959
|
// src/table3/tr.tsx
|
|
37961
37960
|
import React7 from "react";
|
|
37962
|
-
import { jsx as
|
|
37961
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
37963
37962
|
function TR({
|
|
37964
37963
|
handlers,
|
|
37965
37964
|
setObjectData,
|
|
@@ -37987,7 +37986,7 @@ function TR({
|
|
|
37987
37986
|
setSelected(selected == index ? -1 : index);
|
|
37988
37987
|
},
|
|
37989
37988
|
children: [
|
|
37990
|
-
modal && /* @__PURE__ */
|
|
37989
|
+
modal && /* @__PURE__ */ jsx25("th", { className: "border", children: /* @__PURE__ */ jsx25(
|
|
37991
37990
|
"button",
|
|
37992
37991
|
{
|
|
37993
37992
|
className: "p-1 border shadow-rounded bg-blue-500 rounded text-white",
|
|
@@ -37996,10 +37995,10 @@ function TR({
|
|
|
37996
37995
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
37997
37996
|
setDialogRow(row);
|
|
37998
37997
|
},
|
|
37999
|
-
children: /* @__PURE__ */
|
|
37998
|
+
children: /* @__PURE__ */ jsx25(EditIcon2, {})
|
|
38000
37999
|
}
|
|
38001
38000
|
) }),
|
|
38002
|
-
selectItems && /* @__PURE__ */
|
|
38001
|
+
selectItems && /* @__PURE__ */ jsx25("th", { className: "border", children: /* @__PURE__ */ jsx25(
|
|
38003
38002
|
"input",
|
|
38004
38003
|
{
|
|
38005
38004
|
type: "checkbox",
|
|
@@ -38067,13 +38066,13 @@ function TR({
|
|
|
38067
38066
|
return acc;
|
|
38068
38067
|
}, {})
|
|
38069
38068
|
});
|
|
38070
|
-
return /* @__PURE__ */
|
|
38069
|
+
return /* @__PURE__ */ jsx25("td", { className: `text-black `, children: cloned }, h);
|
|
38071
38070
|
}
|
|
38072
|
-
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */
|
|
38071
|
+
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ jsx25("td", { className: `text-center border max-w-[${colSize}px] `, children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1 w-full", children: [
|
|
38073
38072
|
symbols[h],
|
|
38074
38073
|
" ",
|
|
38075
38074
|
row[h]
|
|
38076
|
-
] }) }, h) : /* @__PURE__ */
|
|
38075
|
+
] }) }, h) : /* @__PURE__ */ jsx25("td", { className: `text-center border max-w-[${colSize}px]`, children: row[h] }, h);
|
|
38077
38076
|
})
|
|
38078
38077
|
]
|
|
38079
38078
|
},
|
|
@@ -38082,7 +38081,7 @@ function TR({
|
|
|
38082
38081
|
}
|
|
38083
38082
|
|
|
38084
38083
|
// src/table3/body.tsx
|
|
38085
|
-
import { jsx as
|
|
38084
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
38086
38085
|
function TableBody({
|
|
38087
38086
|
objectData,
|
|
38088
38087
|
setObjectData,
|
|
@@ -38126,7 +38125,7 @@ function TableBody({
|
|
|
38126
38125
|
return key >= start && key < end;
|
|
38127
38126
|
}).map(([id, k], index) => {
|
|
38128
38127
|
const row = objectData[id];
|
|
38129
|
-
return /* @__PURE__ */
|
|
38128
|
+
return /* @__PURE__ */ jsx26(
|
|
38130
38129
|
TR,
|
|
38131
38130
|
{
|
|
38132
38131
|
...{
|
|
@@ -38151,11 +38150,11 @@ function TableBody({
|
|
|
38151
38150
|
id
|
|
38152
38151
|
);
|
|
38153
38152
|
});
|
|
38154
|
-
return /* @__PURE__ */
|
|
38153
|
+
return /* @__PURE__ */ jsx26("tbody", { children: sorted });
|
|
38155
38154
|
}
|
|
38156
38155
|
|
|
38157
38156
|
// src/table3/panel.tsx
|
|
38158
|
-
import { jsx as
|
|
38157
|
+
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
38159
38158
|
function Panel({
|
|
38160
38159
|
page,
|
|
38161
38160
|
setPage,
|
|
@@ -38177,7 +38176,7 @@ function Panel({
|
|
|
38177
38176
|
},
|
|
38178
38177
|
children: [
|
|
38179
38178
|
" ",
|
|
38180
|
-
/* @__PURE__ */
|
|
38179
|
+
/* @__PURE__ */ jsx27(SaveIcon, {}),
|
|
38181
38180
|
"Guardar"
|
|
38182
38181
|
]
|
|
38183
38182
|
}
|
|
@@ -38196,22 +38195,22 @@ function Panel({
|
|
|
38196
38195
|
);
|
|
38197
38196
|
},
|
|
38198
38197
|
children: [
|
|
38199
|
-
/* @__PURE__ */
|
|
38198
|
+
/* @__PURE__ */ jsx27(ExcelIcon, {}),
|
|
38200
38199
|
"Exportar"
|
|
38201
38200
|
]
|
|
38202
38201
|
}
|
|
38203
38202
|
)
|
|
38204
38203
|
] }),
|
|
38205
38204
|
maxItems !== Infinity && /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 items-center text-2xl", children: [
|
|
38206
|
-
/* @__PURE__ */
|
|
38207
|
-
/* @__PURE__ */
|
|
38205
|
+
/* @__PURE__ */ jsx27("button", { onClick: () => setPage(1), disabled: page === 1, children: "\u23EE" }),
|
|
38206
|
+
/* @__PURE__ */ jsx27("button", { onClick: () => setPage(page - 1), disabled: page === 1, children: "\u25C0" }),
|
|
38208
38207
|
/* @__PURE__ */ jsxs17("span", { className: "text-sm", children: [
|
|
38209
38208
|
"P\xE1gina ",
|
|
38210
38209
|
page,
|
|
38211
38210
|
" / ",
|
|
38212
38211
|
totalPages
|
|
38213
38212
|
] }),
|
|
38214
|
-
/* @__PURE__ */
|
|
38213
|
+
/* @__PURE__ */ jsx27(
|
|
38215
38214
|
"button",
|
|
38216
38215
|
{
|
|
38217
38216
|
onClick: () => setPage(page + 1),
|
|
@@ -38219,7 +38218,7 @@ function Panel({
|
|
|
38219
38218
|
children: "\u25B6"
|
|
38220
38219
|
}
|
|
38221
38220
|
),
|
|
38222
|
-
/* @__PURE__ */
|
|
38221
|
+
/* @__PURE__ */ jsx27(
|
|
38223
38222
|
"button",
|
|
38224
38223
|
{
|
|
38225
38224
|
onClick: () => setPage(totalPages),
|
|
@@ -38232,7 +38231,7 @@ function Panel({
|
|
|
38232
38231
|
}
|
|
38233
38232
|
|
|
38234
38233
|
// src/table3/footer.tsx
|
|
38235
|
-
import { jsx as
|
|
38234
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
38236
38235
|
function TableFooter({
|
|
38237
38236
|
objectData,
|
|
38238
38237
|
headers,
|
|
@@ -38257,9 +38256,9 @@ function TableFooter({
|
|
|
38257
38256
|
return null;
|
|
38258
38257
|
}
|
|
38259
38258
|
}
|
|
38260
|
-
return footer && /* @__PURE__ */
|
|
38261
|
-
selectItems && /* @__PURE__ */
|
|
38262
|
-
modal && /* @__PURE__ */
|
|
38259
|
+
return footer && /* @__PURE__ */ jsx28("tfoot", { children: /* @__PURE__ */ jsxs18("tr", { className: "bg-blue-500 text-white", children: [
|
|
38260
|
+
selectItems && /* @__PURE__ */ jsx28("th", {}),
|
|
38261
|
+
modal && /* @__PURE__ */ jsx28("th", {}),
|
|
38263
38262
|
headers.map((header) => {
|
|
38264
38263
|
if (header.startsWith("_")) {
|
|
38265
38264
|
return null;
|
|
@@ -38268,16 +38267,16 @@ function TableFooter({
|
|
|
38268
38267
|
symbols[header],
|
|
38269
38268
|
" ",
|
|
38270
38269
|
operacion(footer[header], header)
|
|
38271
|
-
] }, header) : /* @__PURE__ */
|
|
38270
|
+
] }, header) : /* @__PURE__ */ jsx28("th", { children: operacion(footer[header], header) }, header);
|
|
38272
38271
|
}
|
|
38273
|
-
return /* @__PURE__ */
|
|
38272
|
+
return /* @__PURE__ */ jsx28("th", {}, header);
|
|
38274
38273
|
})
|
|
38275
38274
|
] }) });
|
|
38276
38275
|
}
|
|
38277
38276
|
|
|
38278
38277
|
// src/table3/dialog.tsx
|
|
38279
38278
|
import React8, { useMemo as useMemo5 } from "react";
|
|
38280
|
-
import { jsx as
|
|
38279
|
+
import { jsx as jsx29, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
38281
38280
|
function Dialog3({
|
|
38282
38281
|
modalRef,
|
|
38283
38282
|
children,
|
|
@@ -38312,8 +38311,8 @@ function Dialog3({
|
|
|
38312
38311
|
className: "p-6 rounded-xl shadow-2xl backdrop:bg-black/50 w-[100%] h-screen",
|
|
38313
38312
|
children: [
|
|
38314
38313
|
/* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center mb-4", children: [
|
|
38315
|
-
/* @__PURE__ */
|
|
38316
|
-
/* @__PURE__ */
|
|
38314
|
+
/* @__PURE__ */ jsx29("div", {}),
|
|
38315
|
+
/* @__PURE__ */ jsx29(
|
|
38317
38316
|
"button",
|
|
38318
38317
|
{
|
|
38319
38318
|
onClick: () => {
|
|
@@ -38325,7 +38324,7 @@ function Dialog3({
|
|
|
38325
38324
|
}
|
|
38326
38325
|
)
|
|
38327
38326
|
] }),
|
|
38328
|
-
/* @__PURE__ */
|
|
38327
|
+
/* @__PURE__ */ jsx29("div", { className: "text-gray-700", children: clonedModal })
|
|
38329
38328
|
]
|
|
38330
38329
|
}
|
|
38331
38330
|
);
|
|
@@ -38333,7 +38332,7 @@ function Dialog3({
|
|
|
38333
38332
|
var dialog_default = Dialog3;
|
|
38334
38333
|
|
|
38335
38334
|
// src/table3/index.tsx
|
|
38336
|
-
import { jsx as
|
|
38335
|
+
import { jsx as jsx30, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
38337
38336
|
function Table3({
|
|
38338
38337
|
data,
|
|
38339
38338
|
selectItems,
|
|
@@ -38392,7 +38391,7 @@ function Table3({
|
|
|
38392
38391
|
}
|
|
38393
38392
|
}
|
|
38394
38393
|
const [objectData, setObjectData] = useReducer2(dataReducer, null);
|
|
38395
|
-
|
|
38394
|
+
useEffect8(() => {
|
|
38396
38395
|
setObjectData(data);
|
|
38397
38396
|
setPage(1);
|
|
38398
38397
|
}, [data]);
|
|
@@ -38437,7 +38436,7 @@ function Table3({
|
|
|
38437
38436
|
setSort,
|
|
38438
38437
|
...props
|
|
38439
38438
|
};
|
|
38440
|
-
|
|
38439
|
+
useEffect8(() => {
|
|
38441
38440
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
38442
38441
|
const newDialogRow = objectData[dialogRow == null ? void 0 : dialogRow.id] || objectData[dialogRow == null ? void 0 : dialogRow._id];
|
|
38443
38442
|
setDialogRow(newDialogRow);
|
|
@@ -38446,7 +38445,7 @@ function Table3({
|
|
|
38446
38445
|
const style = (props == null ? void 0 : props.style) ? { ...props.style, tableLayout: "fixed" } : { tableLayout: "fixed" };
|
|
38447
38446
|
if (!objectData) return null;
|
|
38448
38447
|
return /* @__PURE__ */ jsxs20("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
|
|
38449
|
-
modal && /* @__PURE__ */
|
|
38448
|
+
modal && /* @__PURE__ */ jsx30(
|
|
38450
38449
|
dialog_default,
|
|
38451
38450
|
{
|
|
38452
38451
|
modalRef,
|
|
@@ -38456,12 +38455,12 @@ function Table3({
|
|
|
38456
38455
|
children: modal
|
|
38457
38456
|
}
|
|
38458
38457
|
),
|
|
38459
|
-
header && /* @__PURE__ */
|
|
38460
|
-
/* @__PURE__ */
|
|
38458
|
+
header && /* @__PURE__ */ jsx30("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
38459
|
+
/* @__PURE__ */ jsx30(Panel, { ...context }),
|
|
38461
38460
|
/* @__PURE__ */ jsxs20("table", { ...props, style, children: [
|
|
38462
|
-
/* @__PURE__ */
|
|
38463
|
-
/* @__PURE__ */
|
|
38464
|
-
/* @__PURE__ */
|
|
38461
|
+
/* @__PURE__ */ jsx30(TableHead, { ...context }),
|
|
38462
|
+
/* @__PURE__ */ jsx30(TableBody, { ...context }),
|
|
38463
|
+
/* @__PURE__ */ jsx30(TableFooter, { ...context })
|
|
38465
38464
|
] })
|
|
38466
38465
|
] });
|
|
38467
38466
|
}
|
package/package.json
CHANGED
package/src/modal/index.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { ReactElement, cloneElement,
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { ReactElement, cloneElement, useCallback } from "react";
|
|
3
3
|
import usePopup from "../pop";
|
|
4
4
|
|
|
5
5
|
export type PopupColor =
|
|
@@ -25,14 +25,8 @@ export default function Modal({
|
|
|
25
25
|
title?: string;
|
|
26
26
|
}) {
|
|
27
27
|
const pop = usePopup();
|
|
28
|
-
const hide = () => pop.close(false);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
const childrenWithHide = cloneElement(children, { hide });
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
pop.updateMessage(childrenWithHide);
|
|
35
|
-
}, [children]); // children como dep para detectar cambios del padre
|
|
29
|
+
const hide = useCallback(() => pop.close(false), [pop.close]);
|
|
36
30
|
|
|
37
31
|
const props = button?.props;
|
|
38
32
|
const onClick = props?.onClick;
|
|
@@ -42,10 +36,13 @@ export default function Modal({
|
|
|
42
36
|
{cloneElement(button, {
|
|
43
37
|
onClick: (e) => {
|
|
44
38
|
onClick?.(e as any);
|
|
45
|
-
|
|
39
|
+
// En la apertura pasamos children con hide
|
|
40
|
+
pop.modal(cloneElement(children, { hide }), color, false, true);
|
|
46
41
|
},
|
|
47
42
|
})}
|
|
48
|
-
|
|
43
|
+
|
|
44
|
+
{/* ✅ Componente, no elemento JSX */}
|
|
45
|
+
<pop.PopupComponent />
|
|
49
46
|
</>
|
|
50
47
|
);
|
|
51
48
|
}
|
package/src/pop/index.tsx
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
// usePopup.ts - Solución definitiva
|
|
2
2
|
"use client";
|
|
3
|
-
|
|
4
3
|
import { useState, useCallback, useRef, type ReactNode } from "react";
|
|
5
4
|
import { PopupColor, PopupState } from "./types";
|
|
6
5
|
import { PopupOverlay } from "./overlay";
|
|
7
|
-
|
|
8
6
|
type PopupStateWithoutMessage = Omit<PopupState, "message">;
|
|
9
|
-
|
|
10
7
|
const INITIAL_STATE: PopupStateWithoutMessage = {
|
|
11
8
|
type: "alert",
|
|
12
9
|
visible: false,
|
|
@@ -15,12 +12,10 @@ const INITIAL_STATE: PopupStateWithoutMessage = {
|
|
|
15
12
|
icons: true,
|
|
16
13
|
full: false,
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
export default function usePopup() {
|
|
20
16
|
const [popup, setPopup] = useState<PopupStateWithoutMessage>(INITIAL_STATE);
|
|
21
17
|
// El message vive FUERA del estado para no quedar congelado
|
|
22
18
|
const messageRef = useRef<ReactNode>(null);
|
|
23
|
-
|
|
24
19
|
const open = useCallback(
|
|
25
20
|
(partial: Omit<PopupState, "visible" | "inputValue">) => {
|
|
26
21
|
const { message, ...rest } = partial;
|
|
@@ -29,7 +24,6 @@ export default function usePopup() {
|
|
|
29
24
|
},
|
|
30
25
|
[],
|
|
31
26
|
);
|
|
32
|
-
|
|
33
27
|
const close = useCallback((confirmed: boolean, value?: string) => {
|
|
34
28
|
setPopup((prev) => {
|
|
35
29
|
if (confirmed) prev.onConfirm?.(value);
|
|
@@ -37,7 +31,6 @@ export default function usePopup() {
|
|
|
37
31
|
return { ...prev, visible: false, inputValue: "" };
|
|
38
32
|
});
|
|
39
33
|
}, []);
|
|
40
|
-
|
|
41
34
|
const alert = useCallback(
|
|
42
35
|
(message: string, color: PopupColor = "primary"): Promise<void> =>
|
|
43
36
|
new Promise((resolve) =>
|
|
@@ -51,7 +44,6 @@ export default function usePopup() {
|
|
|
51
44
|
),
|
|
52
45
|
[open],
|
|
53
46
|
);
|
|
54
|
-
|
|
55
47
|
const modal = useCallback(
|
|
56
48
|
(
|
|
57
49
|
message: ReactNode,
|
|
@@ -72,7 +64,6 @@ export default function usePopup() {
|
|
|
72
64
|
),
|
|
73
65
|
[open],
|
|
74
66
|
);
|
|
75
|
-
|
|
76
67
|
const confirm = useCallback(
|
|
77
68
|
(message: string, color: PopupColor = "primary"): Promise<boolean> =>
|
|
78
69
|
new Promise((resolve) =>
|
|
@@ -86,7 +77,6 @@ export default function usePopup() {
|
|
|
86
77
|
),
|
|
87
78
|
[open],
|
|
88
79
|
);
|
|
89
|
-
|
|
90
80
|
const prompt = useCallback(
|
|
91
81
|
(message: string, color: PopupColor = "primary"): Promise<string | null> =>
|
|
92
82
|
new Promise((resolve) =>
|
|
@@ -100,7 +90,6 @@ export default function usePopup() {
|
|
|
100
90
|
),
|
|
101
91
|
[open],
|
|
102
92
|
);
|
|
103
|
-
|
|
104
93
|
// ✅ Actualiza la ref en cada render cuando el modal está abierto
|
|
105
94
|
// Esto permite que cambios en el children del padre se reflejen
|
|
106
95
|
const updateMessage = useCallback((message: ReactNode) => {
|
|
@@ -108,15 +97,16 @@ export default function usePopup() {
|
|
|
108
97
|
// Fuerza re-render del PopupComponent
|
|
109
98
|
setPopup((prev) => ({ ...prev }));
|
|
110
99
|
}, []);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
const PopupComponent = useCallback(() => {
|
|
101
|
+
if (!popup.visible) return null;
|
|
102
|
+
return (
|
|
103
|
+
<PopupOverlay
|
|
104
|
+
popup={{ ...popup, message: messageRef.current }}
|
|
105
|
+
onClose={close}
|
|
106
|
+
onInputChange={(v) => setPopup((prev) => ({ ...prev, inputValue: v }))}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}, [popup, close]); // messageRef no necesita estar aquí, es mutable
|
|
120
110
|
return {
|
|
121
111
|
alert,
|
|
122
112
|
confirm,
|