next-recomponents 2.0.33 → 2.0.35
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +61 -55
- package/dist/index.mjs +156 -150
- package/package.json +1 -1
- package/src/modal/index.tsx +11 -21
- package/src/pop/index.tsx +59 -44
package/dist/index.d.mts
CHANGED
|
@@ -232,12 +232,12 @@ type PopupColor = "white" | "primary" | "secondary" | "info" | "danger" | "warni
|
|
|
232
232
|
|
|
233
233
|
declare function usePopup(): {
|
|
234
234
|
alert: (message: string, color?: PopupColor) => Promise<void>;
|
|
235
|
-
confirm:
|
|
236
|
-
prompt:
|
|
235
|
+
confirm: (message: string, color?: PopupColor) => Promise<boolean>;
|
|
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
239
|
close: (confirmed: boolean, value?: string) => void;
|
|
239
240
|
updateMessage: (message: ReactNode) => void;
|
|
240
|
-
PopupComponent: () => react_jsx_runtime.JSX.Element | null;
|
|
241
241
|
};
|
|
242
242
|
|
|
243
243
|
export { Alert, Button, Container, DocumentViewer, Form, Input, Modal, MyCalendar, Pre, Select, Table, Table3, type TableButtonProps, type TableButtonProps as TableEventProps, TextArea, regularExpresions, useDates, useExcel, useFormValues, usePopup, useResources };
|
package/dist/index.d.ts
CHANGED
|
@@ -232,12 +232,12 @@ type PopupColor = "white" | "primary" | "secondary" | "info" | "danger" | "warni
|
|
|
232
232
|
|
|
233
233
|
declare function usePopup(): {
|
|
234
234
|
alert: (message: string, color?: PopupColor) => Promise<void>;
|
|
235
|
-
confirm:
|
|
236
|
-
prompt:
|
|
235
|
+
confirm: (message: string, color?: PopupColor) => Promise<boolean>;
|
|
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
239
|
close: (confirmed: boolean, value?: string) => void;
|
|
239
240
|
updateMessage: (message: ReactNode) => void;
|
|
240
|
-
PopupComponent: () => react_jsx_runtime.JSX.Element | null;
|
|
241
241
|
};
|
|
242
242
|
|
|
243
243
|
export { Alert, Button, Container, DocumentViewer, Form, Input, Modal, MyCalendar, Pre, Select, Table, Table3, type TableButtonProps, type TableButtonProps as TableEventProps, TextArea, regularExpresions, useDates, useExcel, useFormValues, usePopup, useResources };
|
package/dist/index.js
CHANGED
|
@@ -36958,7 +36958,7 @@ var import_react10 = require("react");
|
|
|
36958
36958
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
36959
36959
|
function PopupActions({
|
|
36960
36960
|
type,
|
|
36961
|
-
confirm
|
|
36961
|
+
confirm,
|
|
36962
36962
|
focusRing,
|
|
36963
36963
|
onConfirm,
|
|
36964
36964
|
onCancel
|
|
@@ -36977,7 +36977,7 @@ function PopupActions({
|
|
|
36977
36977
|
"button",
|
|
36978
36978
|
{
|
|
36979
36979
|
onClick: onConfirm,
|
|
36980
|
-
className: `px-5 py-2 rounded-lg text-sm font-semibold text-white ${
|
|
36980
|
+
className: `px-5 py-2 rounded-lg text-sm font-semibold text-white ${confirm} transition focus:outline-none focus:ring-2 ${focusRing}`,
|
|
36981
36981
|
children: "Aceptar"
|
|
36982
36982
|
}
|
|
36983
36983
|
)
|
|
@@ -37193,18 +37193,16 @@ var INITIAL_STATE = {
|
|
|
37193
37193
|
inputValue: "",
|
|
37194
37194
|
color: "primary",
|
|
37195
37195
|
icons: true,
|
|
37196
|
-
full: false
|
|
37197
|
-
message: null
|
|
37196
|
+
full: false
|
|
37198
37197
|
};
|
|
37199
37198
|
function usePopup() {
|
|
37200
37199
|
const [popup, setPopup] = (0, import_react10.useState)(INITIAL_STATE);
|
|
37200
|
+
const messageRef = (0, import_react10.useRef)(null);
|
|
37201
37201
|
const open = (0, import_react10.useCallback)(
|
|
37202
37202
|
(partial) => {
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
inputValue: ""
|
|
37207
|
-
});
|
|
37203
|
+
const { message, ...rest } = partial;
|
|
37204
|
+
messageRef.current = message;
|
|
37205
|
+
setPopup({ ...rest, visible: true, inputValue: "" });
|
|
37208
37206
|
},
|
|
37209
37207
|
[]
|
|
37210
37208
|
);
|
|
@@ -37213,19 +37211,9 @@ function usePopup() {
|
|
|
37213
37211
|
var _a, _b;
|
|
37214
37212
|
if (confirmed) (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
37215
37213
|
else (_b = prev.onCancel) == null ? void 0 : _b.call(prev);
|
|
37216
|
-
return {
|
|
37217
|
-
...prev,
|
|
37218
|
-
visible: false,
|
|
37219
|
-
inputValue: ""
|
|
37220
|
-
};
|
|
37214
|
+
return { ...prev, visible: false, inputValue: "" };
|
|
37221
37215
|
});
|
|
37222
37216
|
}, []);
|
|
37223
|
-
const updateMessage = (0, import_react10.useCallback)((message) => {
|
|
37224
|
-
setPopup((prev) => ({
|
|
37225
|
-
...prev,
|
|
37226
|
-
message
|
|
37227
|
-
}));
|
|
37228
|
-
}, []);
|
|
37229
37217
|
const alert2 = (0, import_react10.useCallback)(
|
|
37230
37218
|
(message, color = "primary") => new Promise(
|
|
37231
37219
|
(resolve) => open({
|
|
@@ -37233,9 +37221,7 @@ function usePopup() {
|
|
|
37233
37221
|
message,
|
|
37234
37222
|
color,
|
|
37235
37223
|
onConfirm: () => resolve(),
|
|
37236
|
-
onCancel: () => resolve()
|
|
37237
|
-
icons: true,
|
|
37238
|
-
full: false
|
|
37224
|
+
onCancel: () => resolve()
|
|
37239
37225
|
})
|
|
37240
37226
|
),
|
|
37241
37227
|
[open]
|
|
@@ -37246,36 +37232,58 @@ function usePopup() {
|
|
|
37246
37232
|
type: "modal",
|
|
37247
37233
|
message,
|
|
37248
37234
|
color,
|
|
37249
|
-
icons,
|
|
37250
|
-
full,
|
|
37251
37235
|
onConfirm: () => resolve(),
|
|
37252
|
-
onCancel: () => resolve()
|
|
37236
|
+
onCancel: () => resolve(),
|
|
37237
|
+
icons,
|
|
37238
|
+
full
|
|
37253
37239
|
})
|
|
37254
37240
|
),
|
|
37255
37241
|
[open]
|
|
37256
37242
|
);
|
|
37257
|
-
const
|
|
37258
|
-
|
|
37259
|
-
|
|
37260
|
-
|
|
37261
|
-
|
|
37262
|
-
|
|
37263
|
-
|
|
37264
|
-
|
|
37265
|
-
|
|
37266
|
-
|
|
37267
|
-
|
|
37268
|
-
|
|
37269
|
-
|
|
37270
|
-
|
|
37243
|
+
const confirm = (0, import_react10.useCallback)(
|
|
37244
|
+
(message, color = "primary") => new Promise(
|
|
37245
|
+
(resolve) => open({
|
|
37246
|
+
type: "confirm",
|
|
37247
|
+
message,
|
|
37248
|
+
color,
|
|
37249
|
+
onConfirm: () => resolve(true),
|
|
37250
|
+
onCancel: () => resolve(false)
|
|
37251
|
+
})
|
|
37252
|
+
),
|
|
37253
|
+
[open]
|
|
37254
|
+
);
|
|
37255
|
+
const prompt = (0, import_react10.useCallback)(
|
|
37256
|
+
(message, color = "primary") => new Promise(
|
|
37257
|
+
(resolve) => open({
|
|
37258
|
+
type: "prompt",
|
|
37259
|
+
message,
|
|
37260
|
+
color,
|
|
37261
|
+
onConfirm: (value) => resolve(value != null ? value : ""),
|
|
37262
|
+
onCancel: () => resolve(null)
|
|
37263
|
+
})
|
|
37264
|
+
),
|
|
37265
|
+
[open]
|
|
37266
|
+
);
|
|
37267
|
+
const updateMessage = (0, import_react10.useCallback)((message) => {
|
|
37268
|
+
messageRef.current = message;
|
|
37269
|
+
setPopup((prev) => ({ ...prev }));
|
|
37270
|
+
}, []);
|
|
37271
|
+
const PopupComponent = popup.visible ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
37272
|
+
PopupOverlay,
|
|
37273
|
+
{
|
|
37274
|
+
popup: { ...popup, message: messageRef.current },
|
|
37275
|
+
onClose: close,
|
|
37276
|
+
onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
|
|
37277
|
+
}
|
|
37278
|
+
) : null;
|
|
37271
37279
|
return {
|
|
37272
37280
|
alert: alert2,
|
|
37273
37281
|
confirm,
|
|
37274
37282
|
prompt,
|
|
37275
37283
|
modal,
|
|
37284
|
+
PopupComponent,
|
|
37276
37285
|
close,
|
|
37277
|
-
updateMessage
|
|
37278
|
-
PopupComponent
|
|
37286
|
+
updateMessage
|
|
37279
37287
|
};
|
|
37280
37288
|
}
|
|
37281
37289
|
|
|
@@ -37289,25 +37297,23 @@ function Modal({
|
|
|
37289
37297
|
}) {
|
|
37290
37298
|
const pop = usePopup();
|
|
37291
37299
|
const hide = () => pop.close(false);
|
|
37292
|
-
const
|
|
37293
|
-
|
|
37294
|
-
|
|
37295
|
-
|
|
37296
|
-
});
|
|
37297
|
-
}, [children]);
|
|
37300
|
+
const childrenWithHide = (0, import_react11.useMemo)(
|
|
37301
|
+
() => (0, import_react11.cloneElement)(children, { hide }),
|
|
37302
|
+
[children]
|
|
37303
|
+
);
|
|
37298
37304
|
(0, import_react11.useEffect)(() => {
|
|
37299
|
-
pop.updateMessage(
|
|
37300
|
-
}, [
|
|
37305
|
+
pop.updateMessage(childrenWithHide);
|
|
37306
|
+
}, [childrenWithHide]);
|
|
37301
37307
|
const props = button == null ? void 0 : button.props;
|
|
37302
|
-
const
|
|
37308
|
+
const onClick = props == null ? void 0 : props.onClick;
|
|
37303
37309
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
37304
37310
|
(0, import_react11.cloneElement)(button, {
|
|
37305
|
-
onClick:
|
|
37306
|
-
|
|
37307
|
-
|
|
37311
|
+
onClick: (e) => {
|
|
37312
|
+
onClick == null ? void 0 : onClick(e);
|
|
37313
|
+
pop.modal(childrenWithHide, color, false, true);
|
|
37308
37314
|
}
|
|
37309
37315
|
}),
|
|
37310
|
-
|
|
37316
|
+
pop.PopupComponent
|
|
37311
37317
|
] });
|
|
37312
37318
|
}
|
|
37313
37319
|
|
package/dist/index.mjs
CHANGED
|
@@ -36938,13 +36938,13 @@ function Select({
|
|
|
36938
36938
|
import { cloneElement as cloneElement2, useEffect as useEffect6, useMemo as useMemo4 } from "react";
|
|
36939
36939
|
|
|
36940
36940
|
// src/pop/index.tsx
|
|
36941
|
-
import { useState as useState9, useCallback } from "react";
|
|
36941
|
+
import { useState as useState9, useCallback, useRef as useRef3 } from "react";
|
|
36942
36942
|
|
|
36943
36943
|
// src/pop/actions.tsx
|
|
36944
36944
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
36945
36945
|
function PopupActions({
|
|
36946
36946
|
type,
|
|
36947
|
-
confirm
|
|
36947
|
+
confirm,
|
|
36948
36948
|
focusRing,
|
|
36949
36949
|
onConfirm,
|
|
36950
36950
|
onCancel
|
|
@@ -36963,7 +36963,7 @@ function PopupActions({
|
|
|
36963
36963
|
"button",
|
|
36964
36964
|
{
|
|
36965
36965
|
onClick: onConfirm,
|
|
36966
|
-
className: `px-5 py-2 rounded-lg text-sm font-semibold text-white ${
|
|
36966
|
+
className: `px-5 py-2 rounded-lg text-sm font-semibold text-white ${confirm} transition focus:outline-none focus:ring-2 ${focusRing}`,
|
|
36967
36967
|
children: "Aceptar"
|
|
36968
36968
|
}
|
|
36969
36969
|
)
|
|
@@ -37179,18 +37179,16 @@ var INITIAL_STATE = {
|
|
|
37179
37179
|
inputValue: "",
|
|
37180
37180
|
color: "primary",
|
|
37181
37181
|
icons: true,
|
|
37182
|
-
full: false
|
|
37183
|
-
message: null
|
|
37182
|
+
full: false
|
|
37184
37183
|
};
|
|
37185
37184
|
function usePopup() {
|
|
37186
37185
|
const [popup, setPopup] = useState9(INITIAL_STATE);
|
|
37186
|
+
const messageRef = useRef3(null);
|
|
37187
37187
|
const open = useCallback(
|
|
37188
37188
|
(partial) => {
|
|
37189
|
-
|
|
37190
|
-
|
|
37191
|
-
|
|
37192
|
-
inputValue: ""
|
|
37193
|
-
});
|
|
37189
|
+
const { message, ...rest } = partial;
|
|
37190
|
+
messageRef.current = message;
|
|
37191
|
+
setPopup({ ...rest, visible: true, inputValue: "" });
|
|
37194
37192
|
},
|
|
37195
37193
|
[]
|
|
37196
37194
|
);
|
|
@@ -37199,19 +37197,9 @@ function usePopup() {
|
|
|
37199
37197
|
var _a, _b;
|
|
37200
37198
|
if (confirmed) (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
|
|
37201
37199
|
else (_b = prev.onCancel) == null ? void 0 : _b.call(prev);
|
|
37202
|
-
return {
|
|
37203
|
-
...prev,
|
|
37204
|
-
visible: false,
|
|
37205
|
-
inputValue: ""
|
|
37206
|
-
};
|
|
37200
|
+
return { ...prev, visible: false, inputValue: "" };
|
|
37207
37201
|
});
|
|
37208
37202
|
}, []);
|
|
37209
|
-
const updateMessage = useCallback((message) => {
|
|
37210
|
-
setPopup((prev) => ({
|
|
37211
|
-
...prev,
|
|
37212
|
-
message
|
|
37213
|
-
}));
|
|
37214
|
-
}, []);
|
|
37215
37203
|
const alert2 = useCallback(
|
|
37216
37204
|
(message, color = "primary") => new Promise(
|
|
37217
37205
|
(resolve) => open({
|
|
@@ -37219,9 +37207,7 @@ function usePopup() {
|
|
|
37219
37207
|
message,
|
|
37220
37208
|
color,
|
|
37221
37209
|
onConfirm: () => resolve(),
|
|
37222
|
-
onCancel: () => resolve()
|
|
37223
|
-
icons: true,
|
|
37224
|
-
full: false
|
|
37210
|
+
onCancel: () => resolve()
|
|
37225
37211
|
})
|
|
37226
37212
|
),
|
|
37227
37213
|
[open]
|
|
@@ -37232,41 +37218,63 @@ function usePopup() {
|
|
|
37232
37218
|
type: "modal",
|
|
37233
37219
|
message,
|
|
37234
37220
|
color,
|
|
37235
|
-
icons,
|
|
37236
|
-
full,
|
|
37237
37221
|
onConfirm: () => resolve(),
|
|
37238
|
-
onCancel: () => resolve()
|
|
37222
|
+
onCancel: () => resolve(),
|
|
37223
|
+
icons,
|
|
37224
|
+
full
|
|
37239
37225
|
})
|
|
37240
37226
|
),
|
|
37241
37227
|
[open]
|
|
37242
37228
|
);
|
|
37243
|
-
const
|
|
37244
|
-
|
|
37245
|
-
|
|
37246
|
-
|
|
37247
|
-
|
|
37248
|
-
|
|
37249
|
-
|
|
37250
|
-
|
|
37251
|
-
|
|
37252
|
-
|
|
37253
|
-
|
|
37254
|
-
|
|
37255
|
-
|
|
37256
|
-
|
|
37229
|
+
const confirm = useCallback(
|
|
37230
|
+
(message, color = "primary") => new Promise(
|
|
37231
|
+
(resolve) => open({
|
|
37232
|
+
type: "confirm",
|
|
37233
|
+
message,
|
|
37234
|
+
color,
|
|
37235
|
+
onConfirm: () => resolve(true),
|
|
37236
|
+
onCancel: () => resolve(false)
|
|
37237
|
+
})
|
|
37238
|
+
),
|
|
37239
|
+
[open]
|
|
37240
|
+
);
|
|
37241
|
+
const prompt = useCallback(
|
|
37242
|
+
(message, color = "primary") => new Promise(
|
|
37243
|
+
(resolve) => open({
|
|
37244
|
+
type: "prompt",
|
|
37245
|
+
message,
|
|
37246
|
+
color,
|
|
37247
|
+
onConfirm: (value) => resolve(value != null ? value : ""),
|
|
37248
|
+
onCancel: () => resolve(null)
|
|
37249
|
+
})
|
|
37250
|
+
),
|
|
37251
|
+
[open]
|
|
37252
|
+
);
|
|
37253
|
+
const updateMessage = useCallback((message) => {
|
|
37254
|
+
messageRef.current = message;
|
|
37255
|
+
setPopup((prev) => ({ ...prev }));
|
|
37256
|
+
}, []);
|
|
37257
|
+
const PopupComponent = popup.visible ? /* @__PURE__ */ jsx15(
|
|
37258
|
+
PopupOverlay,
|
|
37259
|
+
{
|
|
37260
|
+
popup: { ...popup, message: messageRef.current },
|
|
37261
|
+
onClose: close,
|
|
37262
|
+
onInputChange: (v) => setPopup((prev) => ({ ...prev, inputValue: v }))
|
|
37263
|
+
}
|
|
37264
|
+
) : null;
|
|
37257
37265
|
return {
|
|
37258
37266
|
alert: alert2,
|
|
37259
37267
|
confirm,
|
|
37260
37268
|
prompt,
|
|
37261
37269
|
modal,
|
|
37270
|
+
PopupComponent,
|
|
37262
37271
|
close,
|
|
37263
|
-
updateMessage
|
|
37264
|
-
PopupComponent
|
|
37272
|
+
updateMessage
|
|
37265
37273
|
};
|
|
37266
37274
|
}
|
|
37267
37275
|
|
|
37268
37276
|
// src/modal/index.tsx
|
|
37269
|
-
import { Fragment as Fragment2,
|
|
37277
|
+
import { Fragment as Fragment2, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
37270
37278
|
function Modal({
|
|
37271
37279
|
button,
|
|
37272
37280
|
children,
|
|
@@ -37275,33 +37283,31 @@ function Modal({
|
|
|
37275
37283
|
}) {
|
|
37276
37284
|
const pop = usePopup();
|
|
37277
37285
|
const hide = () => pop.close(false);
|
|
37278
|
-
const
|
|
37279
|
-
|
|
37280
|
-
|
|
37281
|
-
|
|
37282
|
-
});
|
|
37283
|
-
}, [children]);
|
|
37286
|
+
const childrenWithHide = useMemo4(
|
|
37287
|
+
() => cloneElement2(children, { hide }),
|
|
37288
|
+
[children]
|
|
37289
|
+
);
|
|
37284
37290
|
useEffect6(() => {
|
|
37285
|
-
pop.updateMessage(
|
|
37286
|
-
}, [
|
|
37291
|
+
pop.updateMessage(childrenWithHide);
|
|
37292
|
+
}, [childrenWithHide]);
|
|
37287
37293
|
const props = button == null ? void 0 : button.props;
|
|
37288
|
-
const
|
|
37294
|
+
const onClick = props == null ? void 0 : props.onClick;
|
|
37289
37295
|
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
37290
37296
|
cloneElement2(button, {
|
|
37291
|
-
onClick:
|
|
37292
|
-
|
|
37293
|
-
|
|
37297
|
+
onClick: (e) => {
|
|
37298
|
+
onClick == null ? void 0 : onClick(e);
|
|
37299
|
+
pop.modal(childrenWithHide, color, false, true);
|
|
37294
37300
|
}
|
|
37295
37301
|
}),
|
|
37296
|
-
|
|
37302
|
+
pop.PopupComponent
|
|
37297
37303
|
] });
|
|
37298
37304
|
}
|
|
37299
37305
|
|
|
37300
37306
|
// src/pre/index.tsx
|
|
37301
|
-
import { jsx as
|
|
37307
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
37302
37308
|
var Pre = ({ data }) => {
|
|
37303
37309
|
const formatted = JSON.stringify(data, null, 2);
|
|
37304
|
-
return /* @__PURE__ */
|
|
37310
|
+
return /* @__PURE__ */ jsx16(
|
|
37305
37311
|
"pre",
|
|
37306
37312
|
{
|
|
37307
37313
|
style: {
|
|
@@ -37352,9 +37358,9 @@ import {
|
|
|
37352
37358
|
import DatePicker from "react-datepicker";
|
|
37353
37359
|
|
|
37354
37360
|
// src/calendar/calendar.icon.tsx
|
|
37355
|
-
import { jsx as
|
|
37361
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
37356
37362
|
function CalendarIcon() {
|
|
37357
|
-
return /* @__PURE__ */
|
|
37363
|
+
return /* @__PURE__ */ jsx17(
|
|
37358
37364
|
"svg",
|
|
37359
37365
|
{
|
|
37360
37366
|
stroke: "currentColor",
|
|
@@ -37364,14 +37370,14 @@ function CalendarIcon() {
|
|
|
37364
37370
|
height: "20px",
|
|
37365
37371
|
width: "20px",
|
|
37366
37372
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37367
|
-
children: /* @__PURE__ */
|
|
37373
|
+
children: /* @__PURE__ */ jsx17("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" })
|
|
37368
37374
|
}
|
|
37369
37375
|
);
|
|
37370
37376
|
}
|
|
37371
37377
|
|
|
37372
37378
|
// src/calendar/index.tsx
|
|
37373
37379
|
import { Dialog as Dialog2 } from "@mui/material";
|
|
37374
|
-
import { jsx as
|
|
37380
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
37375
37381
|
function MyCalendar({
|
|
37376
37382
|
enabledDates,
|
|
37377
37383
|
onChange,
|
|
@@ -37407,15 +37413,15 @@ function MyCalendar({
|
|
|
37407
37413
|
/* @__PURE__ */ jsxs11("div", { className: "font-bold", children: [
|
|
37408
37414
|
label,
|
|
37409
37415
|
" ",
|
|
37410
|
-
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */
|
|
37416
|
+
(otherProps == null ? void 0 : otherProps.required) && /* @__PURE__ */ jsx18("span", { className: "text-red-500", children: "*" })
|
|
37411
37417
|
] }),
|
|
37412
|
-
/* @__PURE__ */
|
|
37418
|
+
/* @__PURE__ */ jsx18("div", { children: /* @__PURE__ */ jsxs11(
|
|
37413
37419
|
"div",
|
|
37414
37420
|
{
|
|
37415
37421
|
className: "cursor-pointer flex items-center justify-center",
|
|
37416
37422
|
onClick: (e) => setOpen(true),
|
|
37417
37423
|
children: [
|
|
37418
|
-
/* @__PURE__ */
|
|
37424
|
+
/* @__PURE__ */ jsx18(
|
|
37419
37425
|
"input",
|
|
37420
37426
|
{
|
|
37421
37427
|
...otherProps,
|
|
@@ -37430,13 +37436,13 @@ function MyCalendar({
|
|
|
37430
37436
|
readOnly: true
|
|
37431
37437
|
}
|
|
37432
37438
|
),
|
|
37433
|
-
/* @__PURE__ */
|
|
37439
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute", style: { right: "10px" }, children: /* @__PURE__ */ jsx18(CalendarIcon, {}) })
|
|
37434
37440
|
]
|
|
37435
37441
|
}
|
|
37436
37442
|
) })
|
|
37437
37443
|
] }),
|
|
37438
37444
|
/* @__PURE__ */ jsxs11(Dialog2, { open, children: [
|
|
37439
|
-
/* @__PURE__ */
|
|
37445
|
+
/* @__PURE__ */ jsx18("div", { className: "flex justify-end p-5 font-bold", children: /* @__PURE__ */ jsx18(
|
|
37440
37446
|
"button",
|
|
37441
37447
|
{
|
|
37442
37448
|
className: " border-lg w-[20px] bg-red-500 text-white shadow rounded",
|
|
@@ -37444,7 +37450,7 @@ function MyCalendar({
|
|
|
37444
37450
|
children: "x"
|
|
37445
37451
|
}
|
|
37446
37452
|
) }),
|
|
37447
|
-
/* @__PURE__ */
|
|
37453
|
+
/* @__PURE__ */ jsx18("div", { className: " w-[300px] flex items-start justify-center h-[300px] p-5", children: /* @__PURE__ */ jsx18(
|
|
37448
37454
|
DatePicker,
|
|
37449
37455
|
{
|
|
37450
37456
|
inline: true,
|
|
@@ -37458,9 +37464,9 @@ function MyCalendar({
|
|
|
37458
37464
|
}
|
|
37459
37465
|
|
|
37460
37466
|
// src/doc-viewer/icon.tsx
|
|
37461
|
-
import { jsx as
|
|
37467
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
37462
37468
|
function Icon() {
|
|
37463
|
-
return /* @__PURE__ */
|
|
37469
|
+
return /* @__PURE__ */ jsx19(
|
|
37464
37470
|
"svg",
|
|
37465
37471
|
{
|
|
37466
37472
|
stroke: "currentColor",
|
|
@@ -37470,13 +37476,13 @@ function Icon() {
|
|
|
37470
37476
|
height: "200px",
|
|
37471
37477
|
width: "200px",
|
|
37472
37478
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37473
|
-
children: /* @__PURE__ */
|
|
37479
|
+
children: /* @__PURE__ */ jsx19("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" })
|
|
37474
37480
|
}
|
|
37475
37481
|
);
|
|
37476
37482
|
}
|
|
37477
37483
|
|
|
37478
37484
|
// src/doc-viewer/index.tsx
|
|
37479
|
-
import { jsx as
|
|
37485
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
37480
37486
|
function DocumentViewer({ item }) {
|
|
37481
37487
|
const { url, name, contentType, width = "100%", height = "100%" } = item;
|
|
37482
37488
|
const isImage = contentType.startsWith("image/");
|
|
@@ -37487,8 +37493,8 @@ function DocumentViewer({ item }) {
|
|
|
37487
37493
|
)}&embedded=true` : url;
|
|
37488
37494
|
return /* @__PURE__ */ jsxs12("div", { className: "border shadow rounded p-2 h-[100%]", children: [
|
|
37489
37495
|
/* @__PURE__ */ jsxs12("div", { className: "mb-1 flex justify-between ", children: [
|
|
37490
|
-
/* @__PURE__ */
|
|
37491
|
-
/* @__PURE__ */
|
|
37496
|
+
/* @__PURE__ */ jsx20("h3", { className: "font-bold", children: name }),
|
|
37497
|
+
/* @__PURE__ */ jsx20(
|
|
37492
37498
|
"a",
|
|
37493
37499
|
{
|
|
37494
37500
|
href: url,
|
|
@@ -37500,7 +37506,7 @@ function DocumentViewer({ item }) {
|
|
|
37500
37506
|
}
|
|
37501
37507
|
)
|
|
37502
37508
|
] }),
|
|
37503
|
-
isImage ? /* @__PURE__ */
|
|
37509
|
+
isImage ? /* @__PURE__ */ jsx20(
|
|
37504
37510
|
"img",
|
|
37505
37511
|
{
|
|
37506
37512
|
src: url,
|
|
@@ -37513,7 +37519,7 @@ function DocumentViewer({ item }) {
|
|
|
37513
37519
|
display: "block"
|
|
37514
37520
|
}
|
|
37515
37521
|
}
|
|
37516
|
-
) : isGoogleDocCompatible ? /* @__PURE__ */
|
|
37522
|
+
) : isGoogleDocCompatible ? /* @__PURE__ */ jsx20(
|
|
37517
37523
|
"iframe",
|
|
37518
37524
|
{
|
|
37519
37525
|
title: name,
|
|
@@ -37521,7 +37527,7 @@ function DocumentViewer({ item }) {
|
|
|
37521
37527
|
style: { width, height, border: "none" },
|
|
37522
37528
|
allowFullScreen: true
|
|
37523
37529
|
}
|
|
37524
|
-
) : /* @__PURE__ */
|
|
37530
|
+
) : /* @__PURE__ */ jsx20(
|
|
37525
37531
|
"div",
|
|
37526
37532
|
{
|
|
37527
37533
|
style: {
|
|
@@ -37531,7 +37537,7 @@ function DocumentViewer({ item }) {
|
|
|
37531
37537
|
objectFit: "cover",
|
|
37532
37538
|
display: "block"
|
|
37533
37539
|
},
|
|
37534
|
-
children: /* @__PURE__ */
|
|
37540
|
+
children: /* @__PURE__ */ jsx20(Icon, {})
|
|
37535
37541
|
}
|
|
37536
37542
|
)
|
|
37537
37543
|
] });
|
|
@@ -37542,7 +37548,7 @@ import React9, {
|
|
|
37542
37548
|
useEffect as useEffect9,
|
|
37543
37549
|
useMemo as useMemo7,
|
|
37544
37550
|
useReducer as useReducer2,
|
|
37545
|
-
useRef as
|
|
37551
|
+
useRef as useRef5,
|
|
37546
37552
|
useState as useState13
|
|
37547
37553
|
} from "react";
|
|
37548
37554
|
|
|
@@ -37550,9 +37556,9 @@ import React9, {
|
|
|
37550
37556
|
import { useEffect as useEffect8, useMemo as useMemo5, useState as useState11 } from "react";
|
|
37551
37557
|
|
|
37552
37558
|
// src/table3/filters.tsx
|
|
37553
|
-
import { jsx as
|
|
37559
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
37554
37560
|
function FilterOffIcon() {
|
|
37555
|
-
return /* @__PURE__ */
|
|
37561
|
+
return /* @__PURE__ */ jsx21(
|
|
37556
37562
|
"svg",
|
|
37557
37563
|
{
|
|
37558
37564
|
stroke: "currentColor",
|
|
@@ -37562,12 +37568,12 @@ function FilterOffIcon() {
|
|
|
37562
37568
|
height: "20px",
|
|
37563
37569
|
width: "20px",
|
|
37564
37570
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37565
|
-
children: /* @__PURE__ */
|
|
37571
|
+
children: /* @__PURE__ */ jsx21("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" })
|
|
37566
37572
|
}
|
|
37567
37573
|
);
|
|
37568
37574
|
}
|
|
37569
37575
|
function OrderDesc() {
|
|
37570
|
-
return /* @__PURE__ */
|
|
37576
|
+
return /* @__PURE__ */ jsx21(
|
|
37571
37577
|
"svg",
|
|
37572
37578
|
{
|
|
37573
37579
|
stroke: "currentColor",
|
|
@@ -37577,12 +37583,12 @@ function OrderDesc() {
|
|
|
37577
37583
|
height: "20px",
|
|
37578
37584
|
width: "20px",
|
|
37579
37585
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37580
|
-
children: /* @__PURE__ */
|
|
37586
|
+
children: /* @__PURE__ */ jsx21("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" })
|
|
37581
37587
|
}
|
|
37582
37588
|
);
|
|
37583
37589
|
}
|
|
37584
37590
|
function OrderAsc() {
|
|
37585
|
-
return /* @__PURE__ */
|
|
37591
|
+
return /* @__PURE__ */ jsx21(
|
|
37586
37592
|
"svg",
|
|
37587
37593
|
{
|
|
37588
37594
|
stroke: "currentColor",
|
|
@@ -37592,12 +37598,12 @@ function OrderAsc() {
|
|
|
37592
37598
|
height: "20px",
|
|
37593
37599
|
width: "20px",
|
|
37594
37600
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37595
|
-
children: /* @__PURE__ */
|
|
37601
|
+
children: /* @__PURE__ */ jsx21("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" })
|
|
37596
37602
|
}
|
|
37597
37603
|
);
|
|
37598
37604
|
}
|
|
37599
37605
|
function EditIcon2() {
|
|
37600
|
-
return /* @__PURE__ */
|
|
37606
|
+
return /* @__PURE__ */ jsx21(
|
|
37601
37607
|
"svg",
|
|
37602
37608
|
{
|
|
37603
37609
|
stroke: "currentColor",
|
|
@@ -37607,7 +37613,7 @@ function EditIcon2() {
|
|
|
37607
37613
|
height: "20px",
|
|
37608
37614
|
width: "20px",
|
|
37609
37615
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37610
|
-
children: /* @__PURE__ */
|
|
37616
|
+
children: /* @__PURE__ */ jsx21("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" })
|
|
37611
37617
|
}
|
|
37612
37618
|
);
|
|
37613
37619
|
}
|
|
@@ -37623,14 +37629,14 @@ function SaveIcon() {
|
|
|
37623
37629
|
width: "20px",
|
|
37624
37630
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37625
37631
|
children: [
|
|
37626
|
-
/* @__PURE__ */
|
|
37627
|
-
/* @__PURE__ */
|
|
37632
|
+
/* @__PURE__ */ jsx21("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" }),
|
|
37633
|
+
/* @__PURE__ */ jsx21("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" })
|
|
37628
37634
|
]
|
|
37629
37635
|
}
|
|
37630
37636
|
);
|
|
37631
37637
|
}
|
|
37632
37638
|
function ExcelIcon() {
|
|
37633
|
-
return /* @__PURE__ */
|
|
37639
|
+
return /* @__PURE__ */ jsx21(
|
|
37634
37640
|
"svg",
|
|
37635
37641
|
{
|
|
37636
37642
|
stroke: "currentColor",
|
|
@@ -37640,13 +37646,13 @@ function ExcelIcon() {
|
|
|
37640
37646
|
height: "20px",
|
|
37641
37647
|
width: "20px",
|
|
37642
37648
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37643
|
-
children: /* @__PURE__ */
|
|
37649
|
+
children: /* @__PURE__ */ jsx21("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" })
|
|
37644
37650
|
}
|
|
37645
37651
|
);
|
|
37646
37652
|
}
|
|
37647
37653
|
|
|
37648
37654
|
// src/table3/filter.tsx
|
|
37649
|
-
import { jsx as
|
|
37655
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
37650
37656
|
function Filter({
|
|
37651
37657
|
h,
|
|
37652
37658
|
objectData,
|
|
@@ -37708,7 +37714,7 @@ function Filter({
|
|
|
37708
37714
|
}
|
|
37709
37715
|
}, [data]);
|
|
37710
37716
|
return /* @__PURE__ */ jsxs14("th", { className: "cursor-pointer", children: [
|
|
37711
|
-
/* @__PURE__ */
|
|
37717
|
+
/* @__PURE__ */ jsx22("div", { className: "relative", children: visible && /* @__PURE__ */ jsx22(
|
|
37712
37718
|
"div",
|
|
37713
37719
|
{
|
|
37714
37720
|
className: " w-full h-screen top-0 left-0 fixed ",
|
|
@@ -37729,13 +37735,13 @@ function Filter({
|
|
|
37729
37735
|
onClick: (e) => setVisible(!visible),
|
|
37730
37736
|
children: [
|
|
37731
37737
|
sort && //
|
|
37732
|
-
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */
|
|
37733
|
-
/* @__PURE__ */
|
|
37734
|
-
selected.length < items.length && /* @__PURE__ */
|
|
37738
|
+
Object.keys(sort)[0] == h && ((sort == null ? void 0 : sort[h]) == "asc" ? /* @__PURE__ */ jsx22("div", { className: "text-green-300", children: /* @__PURE__ */ jsx22(OrderAsc, {}) }) : (sort == null ? void 0 : sort[h]) == "desc" && /* @__PURE__ */ jsx22("div", { className: "text-green-300", children: /* @__PURE__ */ jsx22(OrderDesc, {}) })),
|
|
37739
|
+
/* @__PURE__ */ jsx22("div", { children: h }),
|
|
37740
|
+
selected.length < items.length && /* @__PURE__ */ jsx22("div", { className: "text-red-500 ", children: /* @__PURE__ */ jsx22(FilterOffIcon, {}) })
|
|
37735
37741
|
]
|
|
37736
37742
|
}
|
|
37737
37743
|
),
|
|
37738
|
-
visible && /* @__PURE__ */
|
|
37744
|
+
visible && /* @__PURE__ */ jsx22(
|
|
37739
37745
|
"div",
|
|
37740
37746
|
{
|
|
37741
37747
|
className: "border shadow rounded bg-white p-1 absolute left-0 text-black",
|
|
@@ -37758,7 +37764,7 @@ function Filter({
|
|
|
37758
37764
|
},
|
|
37759
37765
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37760
37766
|
children: [
|
|
37761
|
-
/* @__PURE__ */
|
|
37767
|
+
/* @__PURE__ */ jsx22(OrderAsc, {}),
|
|
37762
37768
|
" Ordenar de la A a la Z"
|
|
37763
37769
|
]
|
|
37764
37770
|
}
|
|
@@ -37780,7 +37786,7 @@ function Filter({
|
|
|
37780
37786
|
},
|
|
37781
37787
|
className: "flex items-center gap-2 border p-1 hover:bg-blue-100",
|
|
37782
37788
|
children: [
|
|
37783
|
-
/* @__PURE__ */
|
|
37789
|
+
/* @__PURE__ */ jsx22(OrderDesc, {}),
|
|
37784
37790
|
"Ordenar de la Z a la A"
|
|
37785
37791
|
]
|
|
37786
37792
|
}
|
|
@@ -37794,11 +37800,11 @@ function Filter({
|
|
|
37794
37800
|
},
|
|
37795
37801
|
children: [
|
|
37796
37802
|
"Borrar Filtro",
|
|
37797
|
-
/* @__PURE__ */
|
|
37803
|
+
/* @__PURE__ */ jsx22("div", { className: "text-white ", children: /* @__PURE__ */ jsx22(FilterOffIcon, {}) })
|
|
37798
37804
|
]
|
|
37799
37805
|
}
|
|
37800
37806
|
),
|
|
37801
|
-
/* @__PURE__ */
|
|
37807
|
+
/* @__PURE__ */ jsx22("div", { className: "", children: /* @__PURE__ */ jsx22(
|
|
37802
37808
|
"input",
|
|
37803
37809
|
{
|
|
37804
37810
|
className: "border shadow rounded p-2 w-full",
|
|
@@ -37817,8 +37823,8 @@ function Filter({
|
|
|
37817
37823
|
}
|
|
37818
37824
|
}
|
|
37819
37825
|
) }),
|
|
37820
|
-
/* @__PURE__ */
|
|
37821
|
-
/* @__PURE__ */
|
|
37826
|
+
/* @__PURE__ */ jsx22("div", { children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer px-1", children: [
|
|
37827
|
+
/* @__PURE__ */ jsx22(
|
|
37822
37828
|
"input",
|
|
37823
37829
|
{
|
|
37824
37830
|
type: "checkbox",
|
|
@@ -37834,9 +37840,9 @@ function Filter({
|
|
|
37834
37840
|
),
|
|
37835
37841
|
"(Seleccionar Todo)"
|
|
37836
37842
|
] }) }),
|
|
37837
|
-
/* @__PURE__ */
|
|
37838
|
-
return /* @__PURE__ */
|
|
37839
|
-
/* @__PURE__ */
|
|
37843
|
+
/* @__PURE__ */ jsx22("div", { className: "overflow-auto flex gap-1 flex-col p-1 border shadow rounded h-[300px]", children: itemsFiltered.map((item) => {
|
|
37844
|
+
return /* @__PURE__ */ jsx22("div", { className: "hover:bg-gray-100 ", children: /* @__PURE__ */ jsxs14("label", { className: "flex gap-1 cursor-pointer truncate", children: [
|
|
37845
|
+
/* @__PURE__ */ jsx22(
|
|
37840
37846
|
"input",
|
|
37841
37847
|
{
|
|
37842
37848
|
type: "checkbox",
|
|
@@ -37858,7 +37864,7 @@ function Filter({
|
|
|
37858
37864
|
] }) }, item);
|
|
37859
37865
|
}) }),
|
|
37860
37866
|
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between px-1", children: [
|
|
37861
|
-
/* @__PURE__ */
|
|
37867
|
+
/* @__PURE__ */ jsx22(
|
|
37862
37868
|
"button",
|
|
37863
37869
|
{
|
|
37864
37870
|
className: "p-1 shadow rounded border bg-red-500 text-white",
|
|
@@ -37869,7 +37875,7 @@ function Filter({
|
|
|
37869
37875
|
children: "Cancelar"
|
|
37870
37876
|
}
|
|
37871
37877
|
),
|
|
37872
|
-
/* @__PURE__ */
|
|
37878
|
+
/* @__PURE__ */ jsx22(
|
|
37873
37879
|
"button",
|
|
37874
37880
|
{
|
|
37875
37881
|
className: "p-1 shadow rounded border bg-blue-500 text-white",
|
|
@@ -37888,7 +37894,7 @@ function Filter({
|
|
|
37888
37894
|
}
|
|
37889
37895
|
|
|
37890
37896
|
// src/table3/head.tsx
|
|
37891
|
-
import { jsx as
|
|
37897
|
+
import { jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
37892
37898
|
function TableHead({
|
|
37893
37899
|
headers,
|
|
37894
37900
|
selectItems,
|
|
@@ -37903,9 +37909,9 @@ function TableHead({
|
|
|
37903
37909
|
sort,
|
|
37904
37910
|
setSort
|
|
37905
37911
|
}) {
|
|
37906
|
-
return /* @__PURE__ */
|
|
37907
|
-
modal && /* @__PURE__ */
|
|
37908
|
-
selectItems && /* @__PURE__ */
|
|
37912
|
+
return /* @__PURE__ */ jsx23("thead", { children: /* @__PURE__ */ jsxs15("tr", { className: "bg-blue-500 text-white font-bold", children: [
|
|
37913
|
+
modal && /* @__PURE__ */ jsx23("th", { children: "-" }),
|
|
37914
|
+
selectItems && /* @__PURE__ */ jsx23("th", { children: /* @__PURE__ */ jsx23(
|
|
37909
37915
|
"input",
|
|
37910
37916
|
{
|
|
37911
37917
|
className: "m-2",
|
|
@@ -37933,7 +37939,7 @@ function TableHead({
|
|
|
37933
37939
|
) }),
|
|
37934
37940
|
Object.values(headers).map((h) => {
|
|
37935
37941
|
if (h.startsWith("_")) return null;
|
|
37936
|
-
return /* @__PURE__ */
|
|
37942
|
+
return /* @__PURE__ */ jsx23(
|
|
37937
37943
|
Filter,
|
|
37938
37944
|
{
|
|
37939
37945
|
objectData,
|
|
@@ -37956,7 +37962,7 @@ import { useState as useState12 } from "react";
|
|
|
37956
37962
|
|
|
37957
37963
|
// src/table3/tr.tsx
|
|
37958
37964
|
import React7 from "react";
|
|
37959
|
-
import { jsx as
|
|
37965
|
+
import { jsx as jsx24, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
37960
37966
|
function TR({
|
|
37961
37967
|
handlers,
|
|
37962
37968
|
setObjectData,
|
|
@@ -37984,7 +37990,7 @@ function TR({
|
|
|
37984
37990
|
setSelected(selected == index ? -1 : index);
|
|
37985
37991
|
},
|
|
37986
37992
|
children: [
|
|
37987
|
-
modal && /* @__PURE__ */
|
|
37993
|
+
modal && /* @__PURE__ */ jsx24("th", { className: "border", children: /* @__PURE__ */ jsx24(
|
|
37988
37994
|
"button",
|
|
37989
37995
|
{
|
|
37990
37996
|
className: "p-1 border shadow-rounded bg-blue-500 rounded text-white",
|
|
@@ -37993,10 +37999,10 @@ function TR({
|
|
|
37993
37999
|
(_a = modalRef.current) == null ? void 0 : _a.showModal();
|
|
37994
38000
|
setDialogRow(row);
|
|
37995
38001
|
},
|
|
37996
|
-
children: /* @__PURE__ */
|
|
38002
|
+
children: /* @__PURE__ */ jsx24(EditIcon2, {})
|
|
37997
38003
|
}
|
|
37998
38004
|
) }),
|
|
37999
|
-
selectItems && /* @__PURE__ */
|
|
38005
|
+
selectItems && /* @__PURE__ */ jsx24("th", { className: "border", children: /* @__PURE__ */ jsx24(
|
|
38000
38006
|
"input",
|
|
38001
38007
|
{
|
|
38002
38008
|
type: "checkbox",
|
|
@@ -38064,13 +38070,13 @@ function TR({
|
|
|
38064
38070
|
return acc;
|
|
38065
38071
|
}, {})
|
|
38066
38072
|
});
|
|
38067
|
-
return /* @__PURE__ */
|
|
38073
|
+
return /* @__PURE__ */ jsx24("td", { className: `text-black `, children: cloned }, h);
|
|
38068
38074
|
}
|
|
38069
|
-
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */
|
|
38075
|
+
return symbols && (symbols == null ? void 0 : symbols[h]) ? /* @__PURE__ */ jsx24("td", { className: `text-center border max-w-[${colSize}px] `, children: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1 w-full", children: [
|
|
38070
38076
|
symbols[h],
|
|
38071
38077
|
" ",
|
|
38072
38078
|
row[h]
|
|
38073
|
-
] }) }, h) : /* @__PURE__ */
|
|
38079
|
+
] }) }, h) : /* @__PURE__ */ jsx24("td", { className: `text-center border max-w-[${colSize}px]`, children: row[h] }, h);
|
|
38074
38080
|
})
|
|
38075
38081
|
]
|
|
38076
38082
|
},
|
|
@@ -38079,7 +38085,7 @@ function TR({
|
|
|
38079
38085
|
}
|
|
38080
38086
|
|
|
38081
38087
|
// src/table3/body.tsx
|
|
38082
|
-
import { jsx as
|
|
38088
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
38083
38089
|
function TableBody({
|
|
38084
38090
|
objectData,
|
|
38085
38091
|
setObjectData,
|
|
@@ -38123,7 +38129,7 @@ function TableBody({
|
|
|
38123
38129
|
return key >= start && key < end;
|
|
38124
38130
|
}).map(([id, k], index) => {
|
|
38125
38131
|
const row = objectData[id];
|
|
38126
|
-
return /* @__PURE__ */
|
|
38132
|
+
return /* @__PURE__ */ jsx25(
|
|
38127
38133
|
TR,
|
|
38128
38134
|
{
|
|
38129
38135
|
...{
|
|
@@ -38148,11 +38154,11 @@ function TableBody({
|
|
|
38148
38154
|
id
|
|
38149
38155
|
);
|
|
38150
38156
|
});
|
|
38151
|
-
return /* @__PURE__ */
|
|
38157
|
+
return /* @__PURE__ */ jsx25("tbody", { children: sorted });
|
|
38152
38158
|
}
|
|
38153
38159
|
|
|
38154
38160
|
// src/table3/panel.tsx
|
|
38155
|
-
import { jsx as
|
|
38161
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
38156
38162
|
function Panel({
|
|
38157
38163
|
page,
|
|
38158
38164
|
setPage,
|
|
@@ -38174,7 +38180,7 @@ function Panel({
|
|
|
38174
38180
|
},
|
|
38175
38181
|
children: [
|
|
38176
38182
|
" ",
|
|
38177
|
-
/* @__PURE__ */
|
|
38183
|
+
/* @__PURE__ */ jsx26(SaveIcon, {}),
|
|
38178
38184
|
"Guardar"
|
|
38179
38185
|
]
|
|
38180
38186
|
}
|
|
@@ -38193,22 +38199,22 @@ function Panel({
|
|
|
38193
38199
|
);
|
|
38194
38200
|
},
|
|
38195
38201
|
children: [
|
|
38196
|
-
/* @__PURE__ */
|
|
38202
|
+
/* @__PURE__ */ jsx26(ExcelIcon, {}),
|
|
38197
38203
|
"Exportar"
|
|
38198
38204
|
]
|
|
38199
38205
|
}
|
|
38200
38206
|
)
|
|
38201
38207
|
] }),
|
|
38202
38208
|
maxItems !== Infinity && /* @__PURE__ */ jsxs17("div", { className: "flex gap-2 items-center text-2xl", children: [
|
|
38203
|
-
/* @__PURE__ */
|
|
38204
|
-
/* @__PURE__ */
|
|
38209
|
+
/* @__PURE__ */ jsx26("button", { onClick: () => setPage(1), disabled: page === 1, children: "\u23EE" }),
|
|
38210
|
+
/* @__PURE__ */ jsx26("button", { onClick: () => setPage(page - 1), disabled: page === 1, children: "\u25C0" }),
|
|
38205
38211
|
/* @__PURE__ */ jsxs17("span", { className: "text-sm", children: [
|
|
38206
38212
|
"P\xE1gina ",
|
|
38207
38213
|
page,
|
|
38208
38214
|
" / ",
|
|
38209
38215
|
totalPages
|
|
38210
38216
|
] }),
|
|
38211
|
-
/* @__PURE__ */
|
|
38217
|
+
/* @__PURE__ */ jsx26(
|
|
38212
38218
|
"button",
|
|
38213
38219
|
{
|
|
38214
38220
|
onClick: () => setPage(page + 1),
|
|
@@ -38216,7 +38222,7 @@ function Panel({
|
|
|
38216
38222
|
children: "\u25B6"
|
|
38217
38223
|
}
|
|
38218
38224
|
),
|
|
38219
|
-
/* @__PURE__ */
|
|
38225
|
+
/* @__PURE__ */ jsx26(
|
|
38220
38226
|
"button",
|
|
38221
38227
|
{
|
|
38222
38228
|
onClick: () => setPage(totalPages),
|
|
@@ -38229,7 +38235,7 @@ function Panel({
|
|
|
38229
38235
|
}
|
|
38230
38236
|
|
|
38231
38237
|
// src/table3/footer.tsx
|
|
38232
|
-
import { jsx as
|
|
38238
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
38233
38239
|
function TableFooter({
|
|
38234
38240
|
objectData,
|
|
38235
38241
|
headers,
|
|
@@ -38254,9 +38260,9 @@ function TableFooter({
|
|
|
38254
38260
|
return null;
|
|
38255
38261
|
}
|
|
38256
38262
|
}
|
|
38257
|
-
return footer && /* @__PURE__ */
|
|
38258
|
-
selectItems && /* @__PURE__ */
|
|
38259
|
-
modal && /* @__PURE__ */
|
|
38263
|
+
return footer && /* @__PURE__ */ jsx27("tfoot", { children: /* @__PURE__ */ jsxs18("tr", { className: "bg-blue-500 text-white", children: [
|
|
38264
|
+
selectItems && /* @__PURE__ */ jsx27("th", {}),
|
|
38265
|
+
modal && /* @__PURE__ */ jsx27("th", {}),
|
|
38260
38266
|
headers.map((header) => {
|
|
38261
38267
|
if (header.startsWith("_")) {
|
|
38262
38268
|
return null;
|
|
@@ -38265,16 +38271,16 @@ function TableFooter({
|
|
|
38265
38271
|
symbols[header],
|
|
38266
38272
|
" ",
|
|
38267
38273
|
operacion(footer[header], header)
|
|
38268
|
-
] }, header) : /* @__PURE__ */
|
|
38274
|
+
] }, header) : /* @__PURE__ */ jsx27("th", { children: operacion(footer[header], header) }, header);
|
|
38269
38275
|
}
|
|
38270
|
-
return /* @__PURE__ */
|
|
38276
|
+
return /* @__PURE__ */ jsx27("th", {}, header);
|
|
38271
38277
|
})
|
|
38272
38278
|
] }) });
|
|
38273
38279
|
}
|
|
38274
38280
|
|
|
38275
38281
|
// src/table3/dialog.tsx
|
|
38276
38282
|
import React8, { useMemo as useMemo6 } from "react";
|
|
38277
|
-
import { jsx as
|
|
38283
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
38278
38284
|
function Dialog3({
|
|
38279
38285
|
modalRef,
|
|
38280
38286
|
children,
|
|
@@ -38309,8 +38315,8 @@ function Dialog3({
|
|
|
38309
38315
|
className: "p-6 rounded-xl shadow-2xl backdrop:bg-black/50 w-[100%] h-screen",
|
|
38310
38316
|
children: [
|
|
38311
38317
|
/* @__PURE__ */ jsxs19("div", { className: "flex justify-between items-center mb-4", children: [
|
|
38312
|
-
/* @__PURE__ */
|
|
38313
|
-
/* @__PURE__ */
|
|
38318
|
+
/* @__PURE__ */ jsx28("div", {}),
|
|
38319
|
+
/* @__PURE__ */ jsx28(
|
|
38314
38320
|
"button",
|
|
38315
38321
|
{
|
|
38316
38322
|
onClick: () => {
|
|
@@ -38322,7 +38328,7 @@ function Dialog3({
|
|
|
38322
38328
|
}
|
|
38323
38329
|
)
|
|
38324
38330
|
] }),
|
|
38325
|
-
/* @__PURE__ */
|
|
38331
|
+
/* @__PURE__ */ jsx28("div", { className: "text-gray-700", children: clonedModal })
|
|
38326
38332
|
]
|
|
38327
38333
|
}
|
|
38328
38334
|
);
|
|
@@ -38330,7 +38336,7 @@ function Dialog3({
|
|
|
38330
38336
|
var dialog_default = Dialog3;
|
|
38331
38337
|
|
|
38332
38338
|
// src/table3/index.tsx
|
|
38333
|
-
import { jsx as
|
|
38339
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
38334
38340
|
function Table3({
|
|
38335
38341
|
data,
|
|
38336
38342
|
selectItems,
|
|
@@ -38406,7 +38412,7 @@ function Table3({
|
|
|
38406
38412
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38407
38413
|
}, [objectData, maxItems]);
|
|
38408
38414
|
const [sort, setSort] = useState13(sortBy);
|
|
38409
|
-
const modalRef =
|
|
38415
|
+
const modalRef = useRef5(null);
|
|
38410
38416
|
const [dialogRow, setDialogRow] = useState13({});
|
|
38411
38417
|
const context = {
|
|
38412
38418
|
objectData,
|
|
@@ -38443,7 +38449,7 @@ function Table3({
|
|
|
38443
38449
|
const style = (props == null ? void 0 : props.style) ? { ...props.style, tableLayout: "fixed" } : { tableLayout: "fixed" };
|
|
38444
38450
|
if (!objectData) return null;
|
|
38445
38451
|
return /* @__PURE__ */ jsxs20("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
|
|
38446
|
-
modal && /* @__PURE__ */
|
|
38452
|
+
modal && /* @__PURE__ */ jsx29(
|
|
38447
38453
|
dialog_default,
|
|
38448
38454
|
{
|
|
38449
38455
|
modalRef,
|
|
@@ -38453,12 +38459,12 @@ function Table3({
|
|
|
38453
38459
|
children: modal
|
|
38454
38460
|
}
|
|
38455
38461
|
),
|
|
38456
|
-
header && /* @__PURE__ */
|
|
38457
|
-
/* @__PURE__ */
|
|
38462
|
+
header && /* @__PURE__ */ jsx29("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
38463
|
+
/* @__PURE__ */ jsx29(Panel, { ...context }),
|
|
38458
38464
|
/* @__PURE__ */ jsxs20("table", { ...props, style, children: [
|
|
38459
|
-
/* @__PURE__ */
|
|
38460
|
-
/* @__PURE__ */
|
|
38461
|
-
/* @__PURE__ */
|
|
38465
|
+
/* @__PURE__ */ jsx29(TableHead, { ...context }),
|
|
38466
|
+
/* @__PURE__ */ jsx29(TableBody, { ...context }),
|
|
38467
|
+
/* @__PURE__ */ jsx29(TableFooter, { ...context })
|
|
38462
38468
|
] })
|
|
38463
38469
|
] });
|
|
38464
38470
|
}
|
package/package.json
CHANGED
package/src/modal/index.tsx
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
1
|
import React, { ReactElement, cloneElement, useEffect, useMemo } from "react";
|
|
4
|
-
|
|
5
2
|
import usePopup from "../pop";
|
|
6
3
|
|
|
7
4
|
export type PopupColor =
|
|
@@ -27,36 +24,29 @@ export default function Modal({
|
|
|
27
24
|
title?: string;
|
|
28
25
|
}) {
|
|
29
26
|
const pop = usePopup();
|
|
30
|
-
|
|
31
27
|
const hide = () => pop.close(false);
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
key: crypto.randomUUID(),
|
|
38
|
-
});
|
|
39
|
-
}, [children]);
|
|
29
|
+
const childrenWithHide = useMemo(
|
|
30
|
+
() => cloneElement(children, { hide }),
|
|
31
|
+
[children],
|
|
32
|
+
);
|
|
40
33
|
|
|
41
|
-
// actualizar SOLO si el modal está abierto
|
|
42
34
|
useEffect(() => {
|
|
43
|
-
pop.updateMessage(
|
|
44
|
-
}, [
|
|
35
|
+
pop.updateMessage(childrenWithHide);
|
|
36
|
+
}, [childrenWithHide]);
|
|
45
37
|
|
|
46
38
|
const props = button?.props;
|
|
47
|
-
const
|
|
39
|
+
const onClick = props?.onClick;
|
|
48
40
|
|
|
49
41
|
return (
|
|
50
42
|
<>
|
|
51
43
|
{cloneElement(button, {
|
|
52
|
-
onClick:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
await pop.modal(content, color, false, true);
|
|
44
|
+
onClick: (e) => {
|
|
45
|
+
onClick?.(e as any);
|
|
46
|
+
pop.modal(childrenWithHide, color, false, true);
|
|
56
47
|
},
|
|
57
48
|
})}
|
|
58
|
-
|
|
59
|
-
<pop.PopupComponent />
|
|
49
|
+
{pop.PopupComponent}
|
|
60
50
|
</>
|
|
61
51
|
);
|
|
62
52
|
}
|
package/src/pop/index.tsx
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
+
// usePopup.ts - Solución definitiva
|
|
1
2
|
"use client";
|
|
2
3
|
|
|
3
|
-
import { useState, useCallback, type ReactNode } from "react";
|
|
4
|
+
import { useState, useCallback, useRef, type ReactNode } from "react";
|
|
4
5
|
import { PopupColor, PopupState } from "./types";
|
|
5
6
|
import { PopupOverlay } from "./overlay";
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type PopupStateWithoutMessage = Omit<PopupState, "message">;
|
|
9
|
+
|
|
10
|
+
const INITIAL_STATE: PopupStateWithoutMessage = {
|
|
8
11
|
type: "alert",
|
|
9
12
|
visible: false,
|
|
10
13
|
inputValue: "",
|
|
11
14
|
color: "primary",
|
|
12
15
|
icons: true,
|
|
13
16
|
full: false,
|
|
14
|
-
message: null,
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export default function usePopup() {
|
|
18
|
-
const [popup, setPopup] = useState<
|
|
20
|
+
const [popup, setPopup] = useState<PopupStateWithoutMessage>(INITIAL_STATE);
|
|
21
|
+
// El message vive FUERA del estado para no quedar congelado
|
|
22
|
+
const messageRef = useRef<ReactNode>(null);
|
|
19
23
|
|
|
20
24
|
const open = useCallback(
|
|
21
25
|
(partial: Omit<PopupState, "visible" | "inputValue">) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
inputValue: "",
|
|
26
|
-
});
|
|
26
|
+
const { message, ...rest } = partial;
|
|
27
|
+
messageRef.current = message as any;
|
|
28
|
+
setPopup({ ...rest, visible: true, inputValue: "" });
|
|
27
29
|
},
|
|
28
30
|
[],
|
|
29
31
|
);
|
|
@@ -32,22 +34,10 @@ export default function usePopup() {
|
|
|
32
34
|
setPopup((prev) => {
|
|
33
35
|
if (confirmed) prev.onConfirm?.(value);
|
|
34
36
|
else prev.onCancel?.();
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
...prev,
|
|
38
|
-
visible: false,
|
|
39
|
-
inputValue: "",
|
|
40
|
-
};
|
|
37
|
+
return { ...prev, visible: false, inputValue: "" };
|
|
41
38
|
});
|
|
42
39
|
}, []);
|
|
43
40
|
|
|
44
|
-
const updateMessage = useCallback((message: ReactNode) => {
|
|
45
|
-
setPopup((prev) => ({
|
|
46
|
-
...prev,
|
|
47
|
-
message,
|
|
48
|
-
}));
|
|
49
|
-
}, []);
|
|
50
|
-
|
|
51
41
|
const alert = useCallback(
|
|
52
42
|
(message: string, color: PopupColor = "primary"): Promise<void> =>
|
|
53
43
|
new Promise((resolve) =>
|
|
@@ -57,8 +47,6 @@ export default function usePopup() {
|
|
|
57
47
|
color,
|
|
58
48
|
onConfirm: () => resolve(),
|
|
59
49
|
onCancel: () => resolve(),
|
|
60
|
-
icons: true,
|
|
61
|
-
full: false,
|
|
62
50
|
}),
|
|
63
51
|
),
|
|
64
52
|
[open],
|
|
@@ -68,47 +56,74 @@ export default function usePopup() {
|
|
|
68
56
|
(
|
|
69
57
|
message: ReactNode,
|
|
70
58
|
color: PopupColor = "primary",
|
|
71
|
-
icons = false,
|
|
72
|
-
full = false,
|
|
59
|
+
icons: boolean = false,
|
|
60
|
+
full: boolean = false,
|
|
73
61
|
): Promise<void> =>
|
|
74
62
|
new Promise((resolve) =>
|
|
75
63
|
open({
|
|
76
64
|
type: "modal",
|
|
77
65
|
message,
|
|
78
66
|
color,
|
|
79
|
-
icons,
|
|
80
|
-
full,
|
|
81
67
|
onConfirm: () => resolve(),
|
|
82
68
|
onCancel: () => resolve(),
|
|
69
|
+
icons,
|
|
70
|
+
full,
|
|
71
|
+
}),
|
|
72
|
+
),
|
|
73
|
+
[open],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const confirm = useCallback(
|
|
77
|
+
(message: string, color: PopupColor = "primary"): Promise<boolean> =>
|
|
78
|
+
new Promise((resolve) =>
|
|
79
|
+
open({
|
|
80
|
+
type: "confirm",
|
|
81
|
+
message,
|
|
82
|
+
color,
|
|
83
|
+
onConfirm: () => resolve(true),
|
|
84
|
+
onCancel: () => resolve(false),
|
|
85
|
+
}),
|
|
86
|
+
),
|
|
87
|
+
[open],
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const prompt = useCallback(
|
|
91
|
+
(message: string, color: PopupColor = "primary"): Promise<string | null> =>
|
|
92
|
+
new Promise((resolve) =>
|
|
93
|
+
open({
|
|
94
|
+
type: "prompt",
|
|
95
|
+
message,
|
|
96
|
+
color,
|
|
97
|
+
onConfirm: (value) => resolve(value ?? ""),
|
|
98
|
+
onCancel: () => resolve(null),
|
|
83
99
|
}),
|
|
84
100
|
),
|
|
85
101
|
[open],
|
|
86
102
|
);
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
// ✅ Actualiza la ref en cada render cuando el modal está abierto
|
|
105
|
+
// Esto permite que cambios en el children del padre se reflejen
|
|
106
|
+
const updateMessage = useCallback((message: ReactNode) => {
|
|
107
|
+
messageRef.current = message;
|
|
108
|
+
// Fuerza re-render del PopupComponent
|
|
109
|
+
setPopup((prev) => ({ ...prev }));
|
|
110
|
+
}, []);
|
|
90
111
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
inputValue: v,
|
|
99
|
-
}))
|
|
100
|
-
}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
};
|
|
112
|
+
const PopupComponent = popup.visible ? (
|
|
113
|
+
<PopupOverlay
|
|
114
|
+
popup={{ ...popup, message: messageRef.current }}
|
|
115
|
+
onClose={close}
|
|
116
|
+
onInputChange={(v) => setPopup((prev) => ({ ...prev, inputValue: v }))}
|
|
117
|
+
/>
|
|
118
|
+
) : null;
|
|
104
119
|
|
|
105
120
|
return {
|
|
106
121
|
alert,
|
|
107
122
|
confirm,
|
|
108
123
|
prompt,
|
|
109
124
|
modal,
|
|
125
|
+
PopupComponent,
|
|
110
126
|
close,
|
|
111
127
|
updateMessage,
|
|
112
|
-
PopupComponent,
|
|
113
128
|
};
|
|
114
129
|
}
|