next-recomponents 2.0.66 → 2.0.68
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 +127 -134
- package/dist/index.mjs +75 -84
- package/package.json +1 -1
- package/src/table-advanced/h.table.tsx +1 -1
- package/src/text-area/index.tsx +16 -21
package/dist/index.d.mts
CHANGED
|
@@ -101,7 +101,7 @@ interface Props$2 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
101
101
|
label?: React$1.ReactNode;
|
|
102
102
|
maxLength?: number;
|
|
103
103
|
}
|
|
104
|
-
declare function TextArea({ label, className, maxLength, onChange,
|
|
104
|
+
declare function TextArea({ label, className, maxLength, onChange, value, ...props }: Props$2): react_jsx_runtime.JSX.Element;
|
|
105
105
|
|
|
106
106
|
interface DefaultParams {
|
|
107
107
|
[key: string]: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ interface Props$2 extends DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
101
101
|
label?: React$1.ReactNode;
|
|
102
102
|
maxLength?: number;
|
|
103
103
|
}
|
|
104
|
-
declare function TextArea({ label, className, maxLength, onChange,
|
|
104
|
+
declare function TextArea({ label, className, maxLength, onChange, value, ...props }: Props$2): react_jsx_runtime.JSX.Element;
|
|
105
105
|
|
|
106
106
|
interface DefaultParams {
|
|
107
107
|
[key: string]: any;
|
package/dist/index.js
CHANGED
|
@@ -36169,41 +36169,34 @@ function Table(props) {
|
|
|
36169
36169
|
}
|
|
36170
36170
|
|
|
36171
36171
|
// src/text-area/index.tsx
|
|
36172
|
-
var import_react6 = require("react");
|
|
36173
36172
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
36174
36173
|
function TextArea({
|
|
36175
36174
|
label,
|
|
36176
36175
|
className,
|
|
36177
36176
|
maxLength,
|
|
36178
36177
|
onChange,
|
|
36179
|
-
|
|
36178
|
+
value,
|
|
36180
36179
|
...props
|
|
36181
36180
|
}) {
|
|
36182
|
-
const
|
|
36183
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full relative my-3", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex items-center border rounded bg-white
|
|
36181
|
+
const currentValue = String(value != null ? value : "");
|
|
36182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "w-full relative my-3", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative flex items-center border rounded bg-white", children: [
|
|
36184
36183
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
36185
36184
|
"textarea",
|
|
36186
36185
|
{
|
|
36187
36186
|
...props,
|
|
36188
36187
|
className: ["p-1 w-full transparent", className].join(" "),
|
|
36189
|
-
value,
|
|
36190
|
-
|
|
36191
|
-
|
|
36192
|
-
e.target.value = e.target.value.slice(0, maxLength);
|
|
36193
|
-
}
|
|
36194
|
-
setValue(e.target.value);
|
|
36195
|
-
onChange == null ? void 0 : onChange(e);
|
|
36196
|
-
}
|
|
36188
|
+
value: currentValue,
|
|
36189
|
+
maxLength,
|
|
36190
|
+
onChange
|
|
36197
36191
|
}
|
|
36198
36192
|
),
|
|
36199
|
-
" ",
|
|
36200
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "absolute -top-2.5 left-2 text-xs font-bold px-1", children: [
|
|
36193
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "absolute -top-2.5 left-2 text-xs font-bold px-1", children: [
|
|
36201
36194
|
label,
|
|
36202
36195
|
" ",
|
|
36203
|
-
|
|
36196
|
+
props.required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-red-500", children: "*" })
|
|
36204
36197
|
] }),
|
|
36205
|
-
maxLength && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "
|
|
36206
|
-
|
|
36198
|
+
maxLength && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "text-xs text-gray text-right", children: [
|
|
36199
|
+
currentValue.length,
|
|
36207
36200
|
" / ",
|
|
36208
36201
|
maxLength
|
|
36209
36202
|
] })
|
|
@@ -36211,12 +36204,12 @@ function TextArea({
|
|
|
36211
36204
|
}
|
|
36212
36205
|
|
|
36213
36206
|
// src/use-resources/index.ts
|
|
36214
|
-
var
|
|
36207
|
+
var import_react7 = require("react");
|
|
36215
36208
|
|
|
36216
36209
|
// src/use-resources/get.token.tsx
|
|
36217
|
-
var
|
|
36210
|
+
var import_react6 = require("react");
|
|
36218
36211
|
function useToken() {
|
|
36219
|
-
const token = (0,
|
|
36212
|
+
const token = (0, import_react6.useMemo)(() => {
|
|
36220
36213
|
if (typeof window != "undefined") {
|
|
36221
36214
|
const t = window.localStorage.getItem("token");
|
|
36222
36215
|
if (t) return t;
|
|
@@ -36308,7 +36301,7 @@ function useResources({
|
|
|
36308
36301
|
onError
|
|
36309
36302
|
}) {
|
|
36310
36303
|
const token = useToken();
|
|
36311
|
-
const [info, setInfo] = (0,
|
|
36304
|
+
const [info, setInfo] = (0, import_react7.useState)(
|
|
36312
36305
|
Object.keys(endpoints).reduce((acc, key) => {
|
|
36313
36306
|
var _a, _b;
|
|
36314
36307
|
const newAcc = {
|
|
@@ -36698,14 +36691,14 @@ function useResources({
|
|
|
36698
36691
|
}
|
|
36699
36692
|
}
|
|
36700
36693
|
}
|
|
36701
|
-
(0,
|
|
36694
|
+
(0, import_react7.useEffect)(() => {
|
|
36702
36695
|
doSome();
|
|
36703
36696
|
}, []);
|
|
36704
36697
|
return results;
|
|
36705
36698
|
}
|
|
36706
36699
|
|
|
36707
36700
|
// src/select/index.tsx
|
|
36708
|
-
var
|
|
36701
|
+
var import_react8 = __toESM(require("react"));
|
|
36709
36702
|
|
|
36710
36703
|
// src/select/icon.tsx
|
|
36711
36704
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
@@ -36752,13 +36745,13 @@ function Select({
|
|
|
36752
36745
|
strictMode = true,
|
|
36753
36746
|
...props
|
|
36754
36747
|
}) {
|
|
36755
|
-
const [isOpen, setIsOpen] = (0,
|
|
36756
|
-
const [inputValue, setInputValue] = (0,
|
|
36757
|
-
const [options, setOptions] = (0,
|
|
36748
|
+
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
36749
|
+
const [inputValue, setInputValue] = (0, import_react8.useState)("");
|
|
36750
|
+
const [options, setOptions] = (0, import_react8.useState)(
|
|
36758
36751
|
[]
|
|
36759
36752
|
);
|
|
36760
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
36761
|
-
(0,
|
|
36753
|
+
const [dropdownPos, setDropdownPos] = (0, import_react8.useState)({ left: 0, width: 0 });
|
|
36754
|
+
(0, import_react8.useEffect)(() => {
|
|
36762
36755
|
if (isOpen && containerRef.current) {
|
|
36763
36756
|
const rect = containerRef.current.getBoundingClientRect();
|
|
36764
36757
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -36780,23 +36773,23 @@ function Select({
|
|
|
36780
36773
|
}
|
|
36781
36774
|
}
|
|
36782
36775
|
}, [isOpen]);
|
|
36783
|
-
const [filtered, setFiltered] = (0,
|
|
36776
|
+
const [filtered, setFiltered] = (0, import_react8.useState)(
|
|
36784
36777
|
[]
|
|
36785
36778
|
);
|
|
36786
|
-
const [hasEdition, setHasEdition] = (0,
|
|
36787
|
-
const [highlightedIndex, setHighlightedIndex] = (0,
|
|
36788
|
-
const inputRef = (0,
|
|
36779
|
+
const [hasEdition, setHasEdition] = (0, import_react8.useState)(false);
|
|
36780
|
+
const [highlightedIndex, setHighlightedIndex] = (0, import_react8.useState)(-1);
|
|
36781
|
+
const inputRef = (0, import_react8.useRef)(null);
|
|
36789
36782
|
const validOption = (value) => {
|
|
36790
36783
|
return options.find((opt) => opt.label == value);
|
|
36791
36784
|
};
|
|
36792
36785
|
const normalize = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z]/g, "");
|
|
36793
|
-
(0,
|
|
36786
|
+
(0, import_react8.useEffect)(() => {
|
|
36794
36787
|
var _a;
|
|
36795
|
-
const parsedOptions =
|
|
36788
|
+
const parsedOptions = import_react8.default.Children.toArray(children).filter((child) => {
|
|
36796
36789
|
return child.type === "option";
|
|
36797
36790
|
}).map((child) => {
|
|
36798
36791
|
var _a2;
|
|
36799
|
-
const label2 =
|
|
36792
|
+
const label2 = import_react8.default.Children.toArray(child.props.children).join("");
|
|
36800
36793
|
return {
|
|
36801
36794
|
value: ((_a2 = child.props) == null ? void 0 : _a2.value) || label2,
|
|
36802
36795
|
label: label2
|
|
@@ -36807,7 +36800,7 @@ function Select({
|
|
|
36807
36800
|
const value = (props == null ? void 0 : props.value) ? ((_a = parsedOptions.find((opt) => opt.value == props.value)) == null ? void 0 : _a.label) || "" : "";
|
|
36808
36801
|
setInputValue(value);
|
|
36809
36802
|
}, [children]);
|
|
36810
|
-
(0,
|
|
36803
|
+
(0, import_react8.useEffect)(() => {
|
|
36811
36804
|
const items = options.filter((opt) => {
|
|
36812
36805
|
if (!hasEdition) return true;
|
|
36813
36806
|
const normilizedLabel = normalize(`${opt == null ? void 0 : opt.label}`);
|
|
@@ -36836,9 +36829,9 @@ function Select({
|
|
|
36836
36829
|
setInputValue(v);
|
|
36837
36830
|
setIsOpen(false);
|
|
36838
36831
|
};
|
|
36839
|
-
const containerRef = (0,
|
|
36840
|
-
const [openUpwards, setOpenUpwards] = (0,
|
|
36841
|
-
(0,
|
|
36832
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
36833
|
+
const [openUpwards, setOpenUpwards] = (0, import_react8.useState)(false);
|
|
36834
|
+
(0, import_react8.useEffect)(() => {
|
|
36842
36835
|
if (isOpen && containerRef.current) {
|
|
36843
36836
|
const rect = containerRef.current.getBoundingClientRect();
|
|
36844
36837
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -36981,10 +36974,10 @@ function Select({
|
|
|
36981
36974
|
}
|
|
36982
36975
|
|
|
36983
36976
|
// src/modal/index.tsx
|
|
36984
|
-
var
|
|
36977
|
+
var import_react10 = require("react");
|
|
36985
36978
|
|
|
36986
36979
|
// src/pop/index.tsx
|
|
36987
|
-
var
|
|
36980
|
+
var import_react9 = require("react");
|
|
36988
36981
|
|
|
36989
36982
|
// src/pop/actions.tsx
|
|
36990
36983
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -37221,9 +37214,9 @@ var INITIAL_STATE = {
|
|
|
37221
37214
|
full: false
|
|
37222
37215
|
};
|
|
37223
37216
|
function usePopup() {
|
|
37224
|
-
const [popup, setPopup] = (0,
|
|
37225
|
-
const messageRef = (0,
|
|
37226
|
-
const open = (0,
|
|
37217
|
+
const [popup, setPopup] = (0, import_react9.useState)(INITIAL_STATE);
|
|
37218
|
+
const messageRef = (0, import_react9.useRef)(null);
|
|
37219
|
+
const open = (0, import_react9.useCallback)(
|
|
37227
37220
|
(partial) => {
|
|
37228
37221
|
const { message, ...rest } = partial;
|
|
37229
37222
|
messageRef.current = message;
|
|
@@ -37231,7 +37224,7 @@ function usePopup() {
|
|
|
37231
37224
|
},
|
|
37232
37225
|
[]
|
|
37233
37226
|
);
|
|
37234
|
-
const close = (0,
|
|
37227
|
+
const close = (0, import_react9.useCallback)(
|
|
37235
37228
|
async (confirmed, value) => {
|
|
37236
37229
|
var _a, _b, _c;
|
|
37237
37230
|
const prev = { ...popup };
|
|
@@ -37249,7 +37242,7 @@ function usePopup() {
|
|
|
37249
37242
|
},
|
|
37250
37243
|
[popup]
|
|
37251
37244
|
);
|
|
37252
|
-
const alert2 = (0,
|
|
37245
|
+
const alert2 = (0, import_react9.useCallback)(
|
|
37253
37246
|
(message, color = "primary") => new Promise(
|
|
37254
37247
|
(resolve) => open({
|
|
37255
37248
|
type: "alert",
|
|
@@ -37261,7 +37254,7 @@ function usePopup() {
|
|
|
37261
37254
|
),
|
|
37262
37255
|
[open]
|
|
37263
37256
|
);
|
|
37264
|
-
const modal = (0,
|
|
37257
|
+
const modal = (0, import_react9.useCallback)(
|
|
37265
37258
|
(message, color = "primary", icons = false, full = false, onClose) => new Promise(
|
|
37266
37259
|
(resolve) => open({
|
|
37267
37260
|
type: "modal",
|
|
@@ -37278,7 +37271,7 @@ function usePopup() {
|
|
|
37278
37271
|
),
|
|
37279
37272
|
[open]
|
|
37280
37273
|
);
|
|
37281
|
-
const confirm = (0,
|
|
37274
|
+
const confirm = (0, import_react9.useCallback)(
|
|
37282
37275
|
(message, color = "primary") => new Promise(
|
|
37283
37276
|
(resolve) => open({
|
|
37284
37277
|
type: "confirm",
|
|
@@ -37290,7 +37283,7 @@ function usePopup() {
|
|
|
37290
37283
|
),
|
|
37291
37284
|
[open]
|
|
37292
37285
|
);
|
|
37293
|
-
const prompt = (0,
|
|
37286
|
+
const prompt = (0, import_react9.useCallback)(
|
|
37294
37287
|
(message, color = "primary") => new Promise(
|
|
37295
37288
|
(resolve) => open({
|
|
37296
37289
|
type: "prompt",
|
|
@@ -37302,7 +37295,7 @@ function usePopup() {
|
|
|
37302
37295
|
),
|
|
37303
37296
|
[open]
|
|
37304
37297
|
);
|
|
37305
|
-
const updateMessage = (0,
|
|
37298
|
+
const updateMessage = (0, import_react9.useCallback)((message) => {
|
|
37306
37299
|
messageRef.current = message;
|
|
37307
37300
|
setPopup((prev) => ({ ...prev }));
|
|
37308
37301
|
}, []);
|
|
@@ -37338,17 +37331,17 @@ function Modal({
|
|
|
37338
37331
|
const hide = () => {
|
|
37339
37332
|
pop.close(false);
|
|
37340
37333
|
};
|
|
37341
|
-
const childrenWithHide = (0,
|
|
37342
|
-
() => (0,
|
|
37334
|
+
const childrenWithHide = (0, import_react10.useMemo)(
|
|
37335
|
+
() => (0, import_react10.cloneElement)(children, { hide }),
|
|
37343
37336
|
[children]
|
|
37344
37337
|
);
|
|
37345
|
-
(0,
|
|
37338
|
+
(0, import_react10.useEffect)(() => {
|
|
37346
37339
|
pop.updateMessage(childrenWithHide);
|
|
37347
37340
|
}, [childrenWithHide]);
|
|
37348
37341
|
const props = button == null ? void 0 : button.props;
|
|
37349
37342
|
const onClick = props == null ? void 0 : props.onClick;
|
|
37350
37343
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "", children: [
|
|
37351
|
-
(0,
|
|
37344
|
+
(0, import_react10.cloneElement)(button, {
|
|
37352
37345
|
onClick: (e) => {
|
|
37353
37346
|
onClick == null ? void 0 : onClick(e);
|
|
37354
37347
|
pop.modal(childrenWithHide, color, false, true, onClose);
|
|
@@ -37407,7 +37400,7 @@ function useDates() {
|
|
|
37407
37400
|
}
|
|
37408
37401
|
|
|
37409
37402
|
// src/calendar/index.tsx
|
|
37410
|
-
var
|
|
37403
|
+
var import_react11 = require("react");
|
|
37411
37404
|
var import_react_datepicker = __toESM(require("react-datepicker"));
|
|
37412
37405
|
|
|
37413
37406
|
// src/calendar/calendar.icon.tsx
|
|
@@ -37440,11 +37433,11 @@ function MyCalendar({
|
|
|
37440
37433
|
value,
|
|
37441
37434
|
...otherProps
|
|
37442
37435
|
}) {
|
|
37443
|
-
const [selectedDate, setSelectedDate] = (0,
|
|
37444
|
-
const [dateStr, setDateStr] = (0,
|
|
37436
|
+
const [selectedDate, setSelectedDate] = (0, import_react11.useState)(null);
|
|
37437
|
+
const [dateStr, setDateStr] = (0, import_react11.useState)(
|
|
37445
37438
|
defaultValue || value || ""
|
|
37446
37439
|
);
|
|
37447
|
-
const [open, setOpen] = (0,
|
|
37440
|
+
const [open, setOpen] = (0, import_react11.useState)(false);
|
|
37448
37441
|
function handleChange(date) {
|
|
37449
37442
|
if (!date) return;
|
|
37450
37443
|
setSelectedDate(date);
|
|
@@ -37633,10 +37626,10 @@ function DocumentViewer({
|
|
|
37633
37626
|
}
|
|
37634
37627
|
|
|
37635
37628
|
// src/table3/index.tsx
|
|
37636
|
-
var
|
|
37629
|
+
var import_react16 = __toESM(require("react"));
|
|
37637
37630
|
|
|
37638
37631
|
// src/table3/filter.tsx
|
|
37639
|
-
var
|
|
37632
|
+
var import_react12 = require("react");
|
|
37640
37633
|
|
|
37641
37634
|
// src/table3/filters.tsx
|
|
37642
37635
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
@@ -37746,14 +37739,14 @@ function Filter({
|
|
|
37746
37739
|
sort,
|
|
37747
37740
|
setSort
|
|
37748
37741
|
}) {
|
|
37749
|
-
const [visible, setVisible] = (0,
|
|
37750
|
-
const [text, setText] = (0,
|
|
37751
|
-
const items = (0,
|
|
37742
|
+
const [visible, setVisible] = (0, import_react12.useState)(false);
|
|
37743
|
+
const [text, setText] = (0, import_react12.useState)("");
|
|
37744
|
+
const items = (0, import_react12.useMemo)(
|
|
37752
37745
|
() => [...new Set(Object.values(objectData).map((o) => o[h]))],
|
|
37753
37746
|
[objectData]
|
|
37754
37747
|
);
|
|
37755
|
-
const [selected, setSelected] = (0,
|
|
37756
|
-
const itemsFiltered = (0,
|
|
37748
|
+
const [selected, setSelected] = (0, import_react12.useState)(items);
|
|
37749
|
+
const itemsFiltered = (0, import_react12.useMemo)(
|
|
37757
37750
|
() => items.sort((a, b) => `${a}`.localeCompare(b)).filter((item) => {
|
|
37758
37751
|
if (!text) return true;
|
|
37759
37752
|
return `${item}`.toLowerCase().includes(text.toLowerCase());
|
|
@@ -37790,7 +37783,7 @@ function Filter({
|
|
|
37790
37783
|
const hidden = Object.values(objectData).filter(
|
|
37791
37784
|
(d) => d._visible === false
|
|
37792
37785
|
);
|
|
37793
|
-
(0,
|
|
37786
|
+
(0, import_react12.useEffect)(() => {
|
|
37794
37787
|
if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
|
|
37795
37788
|
const news = [...new Set(data.map((o) => o[h]))];
|
|
37796
37789
|
setSelected(news);
|
|
@@ -38041,10 +38034,10 @@ function TableHead({
|
|
|
38041
38034
|
}
|
|
38042
38035
|
|
|
38043
38036
|
// src/table3/body.tsx
|
|
38044
|
-
var
|
|
38037
|
+
var import_react14 = require("react");
|
|
38045
38038
|
|
|
38046
38039
|
// src/table3/tr.tsx
|
|
38047
|
-
var
|
|
38040
|
+
var import_react13 = __toESM(require("react"));
|
|
38048
38041
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
38049
38042
|
function TR({
|
|
38050
38043
|
handlers,
|
|
@@ -38106,7 +38099,7 @@ function TR({
|
|
|
38106
38099
|
return null;
|
|
38107
38100
|
} else if (handlers == null ? void 0 : handlers[h]) {
|
|
38108
38101
|
const original = handlers[h];
|
|
38109
|
-
const cloned =
|
|
38102
|
+
const cloned = import_react13.default.cloneElement(original, {
|
|
38110
38103
|
// si es controlado por value → actualiza con row[h]
|
|
38111
38104
|
value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
|
|
38112
38105
|
// si usa children → actualiza con row[h] también
|
|
@@ -38186,7 +38179,7 @@ function TableBody({
|
|
|
38186
38179
|
symbols,
|
|
38187
38180
|
sort
|
|
38188
38181
|
}) {
|
|
38189
|
-
const [selected, setSelected] = (0,
|
|
38182
|
+
const [selected, setSelected] = (0, import_react14.useState)(-1);
|
|
38190
38183
|
const sorted = Object.entries(objectData).sort(([, a], [, b]) => {
|
|
38191
38184
|
for (const [key, order] of Object.entries(
|
|
38192
38185
|
sort || { id: "desc", _id: "desc" }
|
|
@@ -38362,7 +38355,7 @@ function TableFooter({
|
|
|
38362
38355
|
}
|
|
38363
38356
|
|
|
38364
38357
|
// src/table3/dialog.tsx
|
|
38365
|
-
var
|
|
38358
|
+
var import_react15 = __toESM(require("react"));
|
|
38366
38359
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
38367
38360
|
function Dialog3({
|
|
38368
38361
|
modalRef,
|
|
@@ -38379,9 +38372,9 @@ function Dialog3({
|
|
|
38379
38372
|
var _a;
|
|
38380
38373
|
return (_a = modalRef.current) == null ? void 0 : _a.close();
|
|
38381
38374
|
};
|
|
38382
|
-
const clonedModal = (0,
|
|
38383
|
-
if (dialogRow &&
|
|
38384
|
-
return
|
|
38375
|
+
const clonedModal = (0, import_react15.useMemo)(() => {
|
|
38376
|
+
if (dialogRow && import_react15.default.isValidElement(children)) {
|
|
38377
|
+
return import_react15.default.cloneElement(children, {
|
|
38385
38378
|
key: JSON.stringify(dialogRow),
|
|
38386
38379
|
row: dialogRow,
|
|
38387
38380
|
show,
|
|
@@ -38435,8 +38428,8 @@ function Table3({
|
|
|
38435
38428
|
sortBy,
|
|
38436
38429
|
...props
|
|
38437
38430
|
}) {
|
|
38438
|
-
const [handlers, setHandlers] = (0,
|
|
38439
|
-
const [page, setPage] = (0,
|
|
38431
|
+
const [handlers, setHandlers] = (0, import_react16.useState)({});
|
|
38432
|
+
const [page, setPage] = (0, import_react16.useState)(1);
|
|
38440
38433
|
function dataReducer(a, b) {
|
|
38441
38434
|
if (b == null) return {};
|
|
38442
38435
|
if (Array.isArray(b)) {
|
|
@@ -38457,7 +38450,7 @@ function Table3({
|
|
|
38457
38450
|
};
|
|
38458
38451
|
const newHandlers = { ...handlers };
|
|
38459
38452
|
for (let item in cc) {
|
|
38460
|
-
const isReactComponent =
|
|
38453
|
+
const isReactComponent = import_react16.default.isValidElement(cc[item]);
|
|
38461
38454
|
if (isReactComponent) {
|
|
38462
38455
|
newHandlers[item] = cc[item];
|
|
38463
38456
|
const value = ((_c = (_b = cc[item]) == null ? void 0 : _b.props) == null ? void 0 : _c.value) || (typeof ((_e = (_d = cc[item]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) !== "object" ? (_g = (_f = cc[item]) == null ? void 0 : _f.props) == null ? void 0 : _g.children : "");
|
|
@@ -38477,12 +38470,12 @@ function Table3({
|
|
|
38477
38470
|
return newA;
|
|
38478
38471
|
}
|
|
38479
38472
|
}
|
|
38480
|
-
const [objectData, setObjectData] = (0,
|
|
38481
|
-
(0,
|
|
38473
|
+
const [objectData, setObjectData] = (0, import_react16.useReducer)(dataReducer, null);
|
|
38474
|
+
(0, import_react16.useEffect)(() => {
|
|
38482
38475
|
setObjectData(data);
|
|
38483
38476
|
setPage(1);
|
|
38484
38477
|
}, [data]);
|
|
38485
|
-
const headers = (0,
|
|
38478
|
+
const headers = (0, import_react16.useMemo)(() => {
|
|
38486
38479
|
if (!objectData) return [];
|
|
38487
38480
|
return [
|
|
38488
38481
|
...new Set(
|
|
@@ -38490,13 +38483,13 @@ function Table3({
|
|
|
38490
38483
|
)
|
|
38491
38484
|
];
|
|
38492
38485
|
}, [objectData]);
|
|
38493
|
-
const totalPages = (0,
|
|
38486
|
+
const totalPages = (0, import_react16.useMemo)(() => {
|
|
38494
38487
|
if (!objectData) return 0;
|
|
38495
38488
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38496
38489
|
}, [objectData, maxItems]);
|
|
38497
|
-
const [sort, setSort] = (0,
|
|
38498
|
-
const modalRef = (0,
|
|
38499
|
-
const [dialogRow, setDialogRow] = (0,
|
|
38490
|
+
const [sort, setSort] = (0, import_react16.useState)(sortBy);
|
|
38491
|
+
const modalRef = (0, import_react16.useRef)(null);
|
|
38492
|
+
const [dialogRow, setDialogRow] = (0, import_react16.useState)({});
|
|
38500
38493
|
const context = {
|
|
38501
38494
|
objectData,
|
|
38502
38495
|
headers,
|
|
@@ -38523,7 +38516,7 @@ function Table3({
|
|
|
38523
38516
|
setSort,
|
|
38524
38517
|
...props
|
|
38525
38518
|
};
|
|
38526
|
-
(0,
|
|
38519
|
+
(0, import_react16.useEffect)(() => {
|
|
38527
38520
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
38528
38521
|
const newDialogRow = objectData[dialogRow == null ? void 0 : dialogRow.id] || objectData[dialogRow == null ? void 0 : dialogRow._id];
|
|
38529
38522
|
setDialogRow(newDialogRow);
|
|
@@ -38553,13 +38546,13 @@ function Table3({
|
|
|
38553
38546
|
}
|
|
38554
38547
|
|
|
38555
38548
|
// src/table-advanced/index.tsx
|
|
38556
|
-
var
|
|
38549
|
+
var import_react21 = require("react");
|
|
38557
38550
|
|
|
38558
38551
|
// src/table-advanced/h.table.tsx
|
|
38559
|
-
var
|
|
38552
|
+
var import_react19 = __toESM(require("react"));
|
|
38560
38553
|
|
|
38561
38554
|
// src/table-advanced/header.tsx
|
|
38562
|
-
var
|
|
38555
|
+
var import_react17 = require("react");
|
|
38563
38556
|
var import_react_dom = require("react-dom");
|
|
38564
38557
|
|
|
38565
38558
|
// src/table-advanced/icons.tsx
|
|
@@ -38813,32 +38806,32 @@ function Header({
|
|
|
38813
38806
|
index,
|
|
38814
38807
|
length
|
|
38815
38808
|
}) {
|
|
38816
|
-
const [visible, setVisible] = (0,
|
|
38817
|
-
const [hovered, setHovered] = (0,
|
|
38809
|
+
const [visible, setVisible] = (0, import_react17.useState)(false);
|
|
38810
|
+
const [hovered, setHovered] = (0, import_react17.useState)(false);
|
|
38818
38811
|
const sortIndex = context.sort.findIndex((b) => b.field == header);
|
|
38819
|
-
const [text, setText] = (0,
|
|
38820
|
-
const cellRef = (0,
|
|
38821
|
-
const [coords, setCoords] = (0,
|
|
38812
|
+
const [text, setText] = (0, import_react17.useState)("");
|
|
38813
|
+
const cellRef = (0, import_react17.useRef)(null);
|
|
38814
|
+
const [coords, setCoords] = (0, import_react17.useState)(
|
|
38822
38815
|
null
|
|
38823
38816
|
);
|
|
38824
|
-
const filteredValues = (0,
|
|
38817
|
+
const filteredValues = (0, import_react17.useMemo)(() => {
|
|
38825
38818
|
return [...new Set(context.data.map((d) => d[header]))].filter((d) => {
|
|
38826
38819
|
if (text == "") return true;
|
|
38827
38820
|
return `${d}`.toLowerCase().includes(text.toLowerCase());
|
|
38828
38821
|
});
|
|
38829
38822
|
}, [context.data, header, text]);
|
|
38830
|
-
const [selected, setSelected] = (0,
|
|
38823
|
+
const [selected, setSelected] = (0, import_react17.useState)([]);
|
|
38831
38824
|
const hasFilter = context.filters.find((b) => b.field == header);
|
|
38832
|
-
(0,
|
|
38825
|
+
(0, import_react17.useEffect)(() => {
|
|
38833
38826
|
setSelected(filteredValues);
|
|
38834
38827
|
}, [filteredValues]);
|
|
38835
|
-
(0,
|
|
38828
|
+
(0, import_react17.useEffect)(() => {
|
|
38836
38829
|
if (visible) {
|
|
38837
38830
|
context.setCurrentHeader(header);
|
|
38838
38831
|
}
|
|
38839
38832
|
setText("");
|
|
38840
38833
|
}, [visible]);
|
|
38841
|
-
(0,
|
|
38834
|
+
(0, import_react17.useEffect)(() => {
|
|
38842
38835
|
if (!visible || !cellRef.current) {
|
|
38843
38836
|
setCoords(null);
|
|
38844
38837
|
return;
|
|
@@ -39177,39 +39170,39 @@ function valueFormatter({
|
|
|
39177
39170
|
}
|
|
39178
39171
|
|
|
39179
39172
|
// src/table-advanced/use.pagination.tsx
|
|
39180
|
-
var
|
|
39173
|
+
var import_react18 = require("react");
|
|
39181
39174
|
function usePaginacion({
|
|
39182
39175
|
total,
|
|
39183
39176
|
tamanioPagina = 100,
|
|
39184
39177
|
paginaInicial = 1
|
|
39185
39178
|
}) {
|
|
39186
|
-
const [totalPaginas, setTotalPaginas] = (0,
|
|
39179
|
+
const [totalPaginas, setTotalPaginas] = (0, import_react18.useState)(
|
|
39187
39180
|
Math.max(1, Math.ceil(total / tamanioPagina))
|
|
39188
39181
|
);
|
|
39189
|
-
const [pagina, setPagina] = (0,
|
|
39182
|
+
const [pagina, setPagina] = (0, import_react18.useState)(
|
|
39190
39183
|
Math.min(Math.max(paginaInicial, 1), totalPaginas)
|
|
39191
39184
|
);
|
|
39192
39185
|
const inicio = total === 0 ? 0 : (pagina - 1) * tamanioPagina + 1;
|
|
39193
39186
|
const fin = Math.min(pagina * tamanioPagina, total);
|
|
39194
|
-
const rango = (0,
|
|
39187
|
+
const rango = (0, import_react18.useMemo)(() => {
|
|
39195
39188
|
if (total === 0) return "0 a 0";
|
|
39196
39189
|
return `${inicio} a ${fin}`;
|
|
39197
39190
|
}, [inicio, fin, total]);
|
|
39198
39191
|
const hasNext = pagina < totalPaginas;
|
|
39199
39192
|
const hasPrev = pagina > 1;
|
|
39200
|
-
const next = (0,
|
|
39193
|
+
const next = (0, import_react18.useCallback)(() => {
|
|
39201
39194
|
setPagina((p) => Math.min(p + 1, totalPaginas));
|
|
39202
39195
|
}, [totalPaginas]);
|
|
39203
|
-
const prev = (0,
|
|
39196
|
+
const prev = (0, import_react18.useCallback)(() => {
|
|
39204
39197
|
setPagina((p) => Math.max(p - 1, 1));
|
|
39205
39198
|
}, []);
|
|
39206
|
-
const irAPagina = (0,
|
|
39199
|
+
const irAPagina = (0, import_react18.useCallback)(
|
|
39207
39200
|
(n) => {
|
|
39208
39201
|
setPagina(Math.min(Math.max(n, 1), totalPaginas));
|
|
39209
39202
|
},
|
|
39210
39203
|
[totalPaginas]
|
|
39211
39204
|
);
|
|
39212
|
-
(0,
|
|
39205
|
+
(0, import_react18.useEffect)(() => {
|
|
39213
39206
|
setTotalPaginas(Math.max(1, Math.ceil(total / tamanioPagina)));
|
|
39214
39207
|
setPagina(1);
|
|
39215
39208
|
}, [total]);
|
|
@@ -39234,11 +39227,11 @@ var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
|
39234
39227
|
function HTable({
|
|
39235
39228
|
context
|
|
39236
39229
|
}) {
|
|
39237
|
-
const [isLoading, setIsloading] = (0,
|
|
39230
|
+
const [isLoading, setIsloading] = (0, import_react19.useState)(false);
|
|
39238
39231
|
const { cols, headers } = context;
|
|
39239
|
-
const [currentIndex, setCurrentIndex] = (0,
|
|
39240
|
-
const tableRef = (0,
|
|
39241
|
-
const modalRef = (0,
|
|
39232
|
+
const [currentIndex, setCurrentIndex] = (0, import_react19.useState)(-1);
|
|
39233
|
+
const tableRef = (0, import_react19.useRef)(null);
|
|
39234
|
+
const modalRef = (0, import_react19.useRef)(null);
|
|
39242
39235
|
const catDensities = { confortable: 80, compact: 30, standard: 53 };
|
|
39243
39236
|
const padding = (context == null ? void 0 : context.rowHeight) || (context == null ? void 0 : context.density) ? catDensities[context == null ? void 0 : context.density] : 53;
|
|
39244
39237
|
function useResizableColumns(headers2, defaultWidth = 160, minWidth = 60) {
|
|
@@ -39251,8 +39244,8 @@ function HTable({
|
|
|
39251
39244
|
function resize(headers3) {
|
|
39252
39245
|
return Object.fromEntries(headers3.map((h) => [h, getWidth(h)]));
|
|
39253
39246
|
}
|
|
39254
|
-
const [widths2, setWidths2] = (0,
|
|
39255
|
-
const startDrag2 = (0,
|
|
39247
|
+
const [widths2, setWidths2] = (0, import_react19.useState)({});
|
|
39248
|
+
const startDrag2 = (0, import_react19.useCallback)(
|
|
39256
39249
|
(e, headerKey) => {
|
|
39257
39250
|
var _a;
|
|
39258
39251
|
e.preventDefault();
|
|
@@ -39287,7 +39280,7 @@ function HTable({
|
|
|
39287
39280
|
return { widths: widths2, gridTemplateColumns: gridTemplateColumns2, startDrag: startDrag2, setWidths: setWidths2 };
|
|
39288
39281
|
}
|
|
39289
39282
|
const { gridTemplateColumns, startDrag, widths, setWidths } = useResizableColumns(headers);
|
|
39290
|
-
(0,
|
|
39283
|
+
(0, import_react19.useEffect)(() => {
|
|
39291
39284
|
if (!tableRef.current) return;
|
|
39292
39285
|
const observer = new ResizeObserver(([entry]) => {
|
|
39293
39286
|
const ocultos = headers.filter(
|
|
@@ -39318,7 +39311,7 @@ function HTable({
|
|
|
39318
39311
|
observer.observe(tableRef.current);
|
|
39319
39312
|
return () => observer.disconnect();
|
|
39320
39313
|
}, [headers.length]);
|
|
39321
|
-
const searchedData = (0,
|
|
39314
|
+
const searchedData = (0, import_react19.useMemo)(() => {
|
|
39322
39315
|
return context.filteredData.filter((row) => {
|
|
39323
39316
|
if (context.searchBy === "") return true;
|
|
39324
39317
|
return Object.values(row).some(
|
|
@@ -39538,7 +39531,7 @@ function HTable({
|
|
|
39538
39531
|
context.setEditions(newEditions);
|
|
39539
39532
|
}
|
|
39540
39533
|
}
|
|
39541
|
-
) : ((_c = context.buttons) == null ? void 0 : _c[key]) ?
|
|
39534
|
+
) : ((_c = context.buttons) == null ? void 0 : _c[key]) ? import_react19.default.cloneElement(context.buttons[key], {
|
|
39542
39535
|
// children: context.buttons[key]?.props?.children
|
|
39543
39536
|
// ? item
|
|
39544
39537
|
// : undefined,
|
|
@@ -39582,7 +39575,7 @@ function HTable({
|
|
|
39582
39575
|
}) : ["number", "string"].includes(typeof item) ? valueFormatter({
|
|
39583
39576
|
value: item,
|
|
39584
39577
|
currentCoin: context.currentCoin
|
|
39585
|
-
}) :
|
|
39578
|
+
}) : import_react19.default.isValidElement(item) ? item : JSON.stringify(item)
|
|
39586
39579
|
},
|
|
39587
39580
|
row.id + i
|
|
39588
39581
|
);
|
|
@@ -39679,7 +39672,7 @@ function HTable({
|
|
|
39679
39672
|
"div",
|
|
39680
39673
|
{
|
|
39681
39674
|
className: "bg-white/40 absolute inset-0 text-black flex items-center justify-center",
|
|
39682
|
-
style: { zIndex:
|
|
39675
|
+
style: { zIndex: 10 },
|
|
39683
39676
|
children: "Loading..."
|
|
39684
39677
|
}
|
|
39685
39678
|
)
|
|
@@ -39717,7 +39710,7 @@ function ModalContent({
|
|
|
39717
39710
|
}
|
|
39718
39711
|
)
|
|
39719
39712
|
] }),
|
|
39720
|
-
|
|
39713
|
+
import_react19.default.cloneElement(context.modal, {
|
|
39721
39714
|
row: searchedData[currentIndex],
|
|
39722
39715
|
hide
|
|
39723
39716
|
})
|
|
@@ -39725,7 +39718,7 @@ function ModalContent({
|
|
|
39725
39718
|
}
|
|
39726
39719
|
|
|
39727
39720
|
// src/table-advanced/context.ts
|
|
39728
|
-
var
|
|
39721
|
+
var import_react20 = require("react");
|
|
39729
39722
|
|
|
39730
39723
|
// src/table-advanced/filter.reducer.ts
|
|
39731
39724
|
var filterReducer = (acc, b) => {
|
|
@@ -39753,19 +39746,19 @@ var sortReducer = (acc, b) => {
|
|
|
39753
39746
|
// src/table-advanced/context.ts
|
|
39754
39747
|
function useContext({ onSelect }) {
|
|
39755
39748
|
const excel = useExcel();
|
|
39756
|
-
const [editions, setEditions] = (0,
|
|
39757
|
-
const [selected, setSelected] = (0,
|
|
39758
|
-
const [data, setData] = (0,
|
|
39749
|
+
const [editions, setEditions] = (0, import_react20.useState)([]);
|
|
39750
|
+
const [selected, setSelected] = (0, import_react20.useState)([]);
|
|
39751
|
+
const [data, setData] = (0, import_react20.useState)([]);
|
|
39759
39752
|
const headers = [...new Set(data.map((b) => Object.keys(b)).flat())];
|
|
39760
|
-
const [currentHeader, setCurrentHeader] = (0,
|
|
39753
|
+
const [currentHeader, setCurrentHeader] = (0, import_react20.useState)(null);
|
|
39761
39754
|
const cols = headers.length;
|
|
39762
|
-
const [filters, setFilters] = (0,
|
|
39755
|
+
const [filters, setFilters] = (0, import_react20.useReducer)(
|
|
39763
39756
|
filterReducer,
|
|
39764
39757
|
new Array()
|
|
39765
39758
|
);
|
|
39766
|
-
const [searchBy, setSearchBy] = (0,
|
|
39767
|
-
const [sort, setSort] = (0,
|
|
39768
|
-
const sortedData = (0,
|
|
39759
|
+
const [searchBy, setSearchBy] = (0, import_react20.useState)("");
|
|
39760
|
+
const [sort, setSort] = (0, import_react20.useReducer)(sortReducer, new Array());
|
|
39761
|
+
const sortedData = (0, import_react20.useMemo)(() => {
|
|
39769
39762
|
return [...data].sort((a, b) => {
|
|
39770
39763
|
for (const { field, type } of sort.reverse()) {
|
|
39771
39764
|
const av = a[field];
|
|
@@ -39795,7 +39788,7 @@ function useContext({ onSelect }) {
|
|
|
39795
39788
|
}
|
|
39796
39789
|
return true;
|
|
39797
39790
|
});
|
|
39798
|
-
(0,
|
|
39791
|
+
(0, import_react20.useEffect)(() => {
|
|
39799
39792
|
if (filters.length == 0) {
|
|
39800
39793
|
setEditions([]);
|
|
39801
39794
|
}
|
|
@@ -39828,7 +39821,7 @@ var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
|
39828
39821
|
function TableAdvanced(tableProps) {
|
|
39829
39822
|
const { data, ...props } = tableProps;
|
|
39830
39823
|
const context = useContext({ onSelect: Boolean(tableProps.onSelect) });
|
|
39831
|
-
(0,
|
|
39824
|
+
(0, import_react21.useEffect)(() => {
|
|
39832
39825
|
context.setData(
|
|
39833
39826
|
Array.isArray(data) ? data.map((d) => {
|
|
39834
39827
|
return {
|
|
@@ -39839,7 +39832,7 @@ function TableAdvanced(tableProps) {
|
|
|
39839
39832
|
}) : data
|
|
39840
39833
|
);
|
|
39841
39834
|
}, [data]);
|
|
39842
|
-
(0,
|
|
39835
|
+
(0, import_react21.useEffect)(() => {
|
|
39843
39836
|
if (tableProps == null ? void 0 : tableProps.sortBy) {
|
|
39844
39837
|
const [k, v] = Object.entries(tableProps.sortBy)[0];
|
|
39845
39838
|
context.setSort({ [k]: v });
|
|
@@ -39858,15 +39851,15 @@ function TableAdvanced(tableProps) {
|
|
|
39858
39851
|
}
|
|
39859
39852
|
|
|
39860
39853
|
// src/tabs/index.tsx
|
|
39861
|
-
var
|
|
39854
|
+
var import_react22 = __toESM(require("react"));
|
|
39862
39855
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
39863
39856
|
function TabContainer({
|
|
39864
39857
|
children,
|
|
39865
39858
|
labelMaxWidth,
|
|
39866
39859
|
currentIndex = 0
|
|
39867
39860
|
}) {
|
|
39868
|
-
const [index, setIndex] = (0,
|
|
39869
|
-
const items =
|
|
39861
|
+
const [index, setIndex] = (0, import_react22.useState)(0);
|
|
39862
|
+
const items = import_react22.default.Children.toArray(
|
|
39870
39863
|
children
|
|
39871
39864
|
);
|
|
39872
39865
|
const labels = items.map((c) => c.props.label);
|
|
@@ -39875,7 +39868,7 @@ function TabContainer({
|
|
|
39875
39868
|
if (e.key === "ArrowLeft")
|
|
39876
39869
|
setIndex((k - 1 + labels.length) % labels.length);
|
|
39877
39870
|
};
|
|
39878
|
-
(0,
|
|
39871
|
+
(0, import_react22.useEffect)(() => {
|
|
39879
39872
|
setIndex(currentIndex);
|
|
39880
39873
|
}, [currentIndex]);
|
|
39881
39874
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "w-full bg-white border shadow rounded-lg ", children: [
|
package/dist/index.mjs
CHANGED
|
@@ -36146,43 +36146,34 @@ function Table(props) {
|
|
|
36146
36146
|
}
|
|
36147
36147
|
|
|
36148
36148
|
// src/text-area/index.tsx
|
|
36149
|
-
import {
|
|
36150
|
-
useState as useState6
|
|
36151
|
-
} from "react";
|
|
36152
36149
|
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
36153
36150
|
function TextArea({
|
|
36154
36151
|
label,
|
|
36155
36152
|
className,
|
|
36156
36153
|
maxLength,
|
|
36157
36154
|
onChange,
|
|
36158
|
-
|
|
36155
|
+
value,
|
|
36159
36156
|
...props
|
|
36160
36157
|
}) {
|
|
36161
|
-
const
|
|
36162
|
-
return /* @__PURE__ */ jsx7("div", { className: "w-full relative my-3", children: /* @__PURE__ */ jsxs6("div", { className: "relative flex items-center border rounded bg-white
|
|
36158
|
+
const currentValue = String(value != null ? value : "");
|
|
36159
|
+
return /* @__PURE__ */ jsx7("div", { className: "w-full relative my-3", children: /* @__PURE__ */ jsxs6("div", { className: "relative flex items-center border rounded bg-white", children: [
|
|
36163
36160
|
/* @__PURE__ */ jsx7(
|
|
36164
36161
|
"textarea",
|
|
36165
36162
|
{
|
|
36166
36163
|
...props,
|
|
36167
36164
|
className: ["p-1 w-full transparent", className].join(" "),
|
|
36168
|
-
value,
|
|
36169
|
-
|
|
36170
|
-
|
|
36171
|
-
e.target.value = e.target.value.slice(0, maxLength);
|
|
36172
|
-
}
|
|
36173
|
-
setValue(e.target.value);
|
|
36174
|
-
onChange == null ? void 0 : onChange(e);
|
|
36175
|
-
}
|
|
36165
|
+
value: currentValue,
|
|
36166
|
+
maxLength,
|
|
36167
|
+
onChange
|
|
36176
36168
|
}
|
|
36177
36169
|
),
|
|
36178
|
-
" ",
|
|
36179
|
-
/* @__PURE__ */ jsxs6("label", { className: "absolute -top-2.5 left-2 text-xs font-bold px-1", children: [
|
|
36170
|
+
/* @__PURE__ */ jsxs6("label", { className: "absolute -top-2.5 left-2 text-xs font-bold px-1", children: [
|
|
36180
36171
|
label,
|
|
36181
36172
|
" ",
|
|
36182
|
-
|
|
36173
|
+
props.required && /* @__PURE__ */ jsx7("span", { className: "text-red-500", children: "*" })
|
|
36183
36174
|
] }),
|
|
36184
|
-
maxLength && /* @__PURE__ */ jsxs6("div", { className: "
|
|
36185
|
-
|
|
36175
|
+
maxLength && /* @__PURE__ */ jsxs6("div", { className: "text-xs text-gray text-right", children: [
|
|
36176
|
+
currentValue.length,
|
|
36186
36177
|
" / ",
|
|
36187
36178
|
maxLength
|
|
36188
36179
|
] })
|
|
@@ -36190,7 +36181,7 @@ function TextArea({
|
|
|
36190
36181
|
}
|
|
36191
36182
|
|
|
36192
36183
|
// src/use-resources/index.ts
|
|
36193
|
-
import { useEffect as useEffect4, useState as
|
|
36184
|
+
import { useEffect as useEffect4, useState as useState6 } from "react";
|
|
36194
36185
|
|
|
36195
36186
|
// src/use-resources/get.token.tsx
|
|
36196
36187
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -36287,7 +36278,7 @@ function useResources({
|
|
|
36287
36278
|
onError
|
|
36288
36279
|
}) {
|
|
36289
36280
|
const token = useToken();
|
|
36290
|
-
const [info, setInfo] =
|
|
36281
|
+
const [info, setInfo] = useState6(
|
|
36291
36282
|
Object.keys(endpoints).reduce((acc, key) => {
|
|
36292
36283
|
var _a, _b;
|
|
36293
36284
|
const newAcc = {
|
|
@@ -36684,10 +36675,10 @@ function useResources({
|
|
|
36684
36675
|
}
|
|
36685
36676
|
|
|
36686
36677
|
// src/select/index.tsx
|
|
36687
|
-
import
|
|
36678
|
+
import React4, {
|
|
36688
36679
|
useEffect as useEffect5,
|
|
36689
36680
|
useRef as useRef2,
|
|
36690
|
-
useState as
|
|
36681
|
+
useState as useState7
|
|
36691
36682
|
} from "react";
|
|
36692
36683
|
|
|
36693
36684
|
// src/select/icon.tsx
|
|
@@ -36735,12 +36726,12 @@ function Select({
|
|
|
36735
36726
|
strictMode = true,
|
|
36736
36727
|
...props
|
|
36737
36728
|
}) {
|
|
36738
|
-
const [isOpen, setIsOpen] =
|
|
36739
|
-
const [inputValue, setInputValue] =
|
|
36740
|
-
const [options, setOptions] =
|
|
36729
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
36730
|
+
const [inputValue, setInputValue] = useState7("");
|
|
36731
|
+
const [options, setOptions] = useState7(
|
|
36741
36732
|
[]
|
|
36742
36733
|
);
|
|
36743
|
-
const [dropdownPos, setDropdownPos] =
|
|
36734
|
+
const [dropdownPos, setDropdownPos] = useState7({ left: 0, width: 0 });
|
|
36744
36735
|
useEffect5(() => {
|
|
36745
36736
|
if (isOpen && containerRef.current) {
|
|
36746
36737
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -36763,11 +36754,11 @@ function Select({
|
|
|
36763
36754
|
}
|
|
36764
36755
|
}
|
|
36765
36756
|
}, [isOpen]);
|
|
36766
|
-
const [filtered, setFiltered] =
|
|
36757
|
+
const [filtered, setFiltered] = useState7(
|
|
36767
36758
|
[]
|
|
36768
36759
|
);
|
|
36769
|
-
const [hasEdition, setHasEdition] =
|
|
36770
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
36760
|
+
const [hasEdition, setHasEdition] = useState7(false);
|
|
36761
|
+
const [highlightedIndex, setHighlightedIndex] = useState7(-1);
|
|
36771
36762
|
const inputRef = useRef2(null);
|
|
36772
36763
|
const validOption = (value) => {
|
|
36773
36764
|
return options.find((opt) => opt.label == value);
|
|
@@ -36775,11 +36766,11 @@ function Select({
|
|
|
36775
36766
|
const normalize = (str) => str.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z]/g, "");
|
|
36776
36767
|
useEffect5(() => {
|
|
36777
36768
|
var _a;
|
|
36778
|
-
const parsedOptions =
|
|
36769
|
+
const parsedOptions = React4.Children.toArray(children).filter((child) => {
|
|
36779
36770
|
return child.type === "option";
|
|
36780
36771
|
}).map((child) => {
|
|
36781
36772
|
var _a2;
|
|
36782
|
-
const label2 =
|
|
36773
|
+
const label2 = React4.Children.toArray(child.props.children).join("");
|
|
36783
36774
|
return {
|
|
36784
36775
|
value: ((_a2 = child.props) == null ? void 0 : _a2.value) || label2,
|
|
36785
36776
|
label: label2
|
|
@@ -36820,7 +36811,7 @@ function Select({
|
|
|
36820
36811
|
setIsOpen(false);
|
|
36821
36812
|
};
|
|
36822
36813
|
const containerRef = useRef2(null);
|
|
36823
|
-
const [openUpwards, setOpenUpwards] =
|
|
36814
|
+
const [openUpwards, setOpenUpwards] = useState7(false);
|
|
36824
36815
|
useEffect5(() => {
|
|
36825
36816
|
if (isOpen && containerRef.current) {
|
|
36826
36817
|
const rect = containerRef.current.getBoundingClientRect();
|
|
@@ -36967,7 +36958,7 @@ function Select({
|
|
|
36967
36958
|
import { cloneElement as cloneElement2, useEffect as useEffect6, useMemo as useMemo4 } from "react";
|
|
36968
36959
|
|
|
36969
36960
|
// src/pop/index.tsx
|
|
36970
|
-
import { useState as
|
|
36961
|
+
import { useState as useState8, useCallback, useRef as useRef3 } from "react";
|
|
36971
36962
|
|
|
36972
36963
|
// src/pop/actions.tsx
|
|
36973
36964
|
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
@@ -37204,7 +37195,7 @@ var INITIAL_STATE = {
|
|
|
37204
37195
|
full: false
|
|
37205
37196
|
};
|
|
37206
37197
|
function usePopup() {
|
|
37207
|
-
const [popup, setPopup] =
|
|
37198
|
+
const [popup, setPopup] = useState8(INITIAL_STATE);
|
|
37208
37199
|
const messageRef = useRef3(null);
|
|
37209
37200
|
const open = useCallback(
|
|
37210
37201
|
(partial) => {
|
|
@@ -37391,7 +37382,7 @@ function useDates() {
|
|
|
37391
37382
|
|
|
37392
37383
|
// src/calendar/index.tsx
|
|
37393
37384
|
import {
|
|
37394
|
-
useState as
|
|
37385
|
+
useState as useState9
|
|
37395
37386
|
} from "react";
|
|
37396
37387
|
import DatePicker from "react-datepicker";
|
|
37397
37388
|
|
|
@@ -37425,11 +37416,11 @@ function MyCalendar({
|
|
|
37425
37416
|
value,
|
|
37426
37417
|
...otherProps
|
|
37427
37418
|
}) {
|
|
37428
|
-
const [selectedDate, setSelectedDate] =
|
|
37429
|
-
const [dateStr, setDateStr] =
|
|
37419
|
+
const [selectedDate, setSelectedDate] = useState9(null);
|
|
37420
|
+
const [dateStr, setDateStr] = useState9(
|
|
37430
37421
|
defaultValue || value || ""
|
|
37431
37422
|
);
|
|
37432
|
-
const [open, setOpen] =
|
|
37423
|
+
const [open, setOpen] = useState9(false);
|
|
37433
37424
|
function handleChange(date) {
|
|
37434
37425
|
if (!date) return;
|
|
37435
37426
|
setSelectedDate(date);
|
|
@@ -37618,16 +37609,16 @@ function DocumentViewer({
|
|
|
37618
37609
|
}
|
|
37619
37610
|
|
|
37620
37611
|
// src/table3/index.tsx
|
|
37621
|
-
import
|
|
37612
|
+
import React8, {
|
|
37622
37613
|
useEffect as useEffect9,
|
|
37623
37614
|
useMemo as useMemo7,
|
|
37624
37615
|
useReducer as useReducer2,
|
|
37625
37616
|
useRef as useRef5,
|
|
37626
|
-
useState as
|
|
37617
|
+
useState as useState12
|
|
37627
37618
|
} from "react";
|
|
37628
37619
|
|
|
37629
37620
|
// src/table3/filter.tsx
|
|
37630
|
-
import { useEffect as useEffect8, useMemo as useMemo5, useState as
|
|
37621
|
+
import { useEffect as useEffect8, useMemo as useMemo5, useState as useState10 } from "react";
|
|
37631
37622
|
|
|
37632
37623
|
// src/table3/filters.tsx
|
|
37633
37624
|
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
@@ -37737,13 +37728,13 @@ function Filter({
|
|
|
37737
37728
|
sort,
|
|
37738
37729
|
setSort
|
|
37739
37730
|
}) {
|
|
37740
|
-
const [visible, setVisible] =
|
|
37741
|
-
const [text, setText] =
|
|
37731
|
+
const [visible, setVisible] = useState10(false);
|
|
37732
|
+
const [text, setText] = useState10("");
|
|
37742
37733
|
const items = useMemo5(
|
|
37743
37734
|
() => [...new Set(Object.values(objectData).map((o) => o[h]))],
|
|
37744
37735
|
[objectData]
|
|
37745
37736
|
);
|
|
37746
|
-
const [selected, setSelected] =
|
|
37737
|
+
const [selected, setSelected] = useState10(items);
|
|
37747
37738
|
const itemsFiltered = useMemo5(
|
|
37748
37739
|
() => items.sort((a, b) => `${a}`.localeCompare(b)).filter((item) => {
|
|
37749
37740
|
if (!text) return true;
|
|
@@ -38032,10 +38023,10 @@ function TableHead({
|
|
|
38032
38023
|
}
|
|
38033
38024
|
|
|
38034
38025
|
// src/table3/body.tsx
|
|
38035
|
-
import { useState as
|
|
38026
|
+
import { useState as useState11 } from "react";
|
|
38036
38027
|
|
|
38037
38028
|
// src/table3/tr.tsx
|
|
38038
|
-
import
|
|
38029
|
+
import React6 from "react";
|
|
38039
38030
|
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
38040
38031
|
function TR({
|
|
38041
38032
|
handlers,
|
|
@@ -38097,7 +38088,7 @@ function TR({
|
|
|
38097
38088
|
return null;
|
|
38098
38089
|
} else if (handlers == null ? void 0 : handlers[h]) {
|
|
38099
38090
|
const original = handlers[h];
|
|
38100
|
-
const cloned =
|
|
38091
|
+
const cloned = React6.cloneElement(original, {
|
|
38101
38092
|
// si es controlado por value → actualiza con row[h]
|
|
38102
38093
|
value: ((_a = original.props) == null ? void 0 : _a.value) !== void 0 ? row[h] : void 0,
|
|
38103
38094
|
// si usa children → actualiza con row[h] también
|
|
@@ -38177,7 +38168,7 @@ function TableBody({
|
|
|
38177
38168
|
symbols,
|
|
38178
38169
|
sort
|
|
38179
38170
|
}) {
|
|
38180
|
-
const [selected, setSelected] =
|
|
38171
|
+
const [selected, setSelected] = useState11(-1);
|
|
38181
38172
|
const sorted = Object.entries(objectData).sort(([, a], [, b]) => {
|
|
38182
38173
|
for (const [key, order] of Object.entries(
|
|
38183
38174
|
sort || { id: "desc", _id: "desc" }
|
|
@@ -38353,7 +38344,7 @@ function TableFooter({
|
|
|
38353
38344
|
}
|
|
38354
38345
|
|
|
38355
38346
|
// src/table3/dialog.tsx
|
|
38356
|
-
import
|
|
38347
|
+
import React7, { useMemo as useMemo6 } from "react";
|
|
38357
38348
|
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
38358
38349
|
function Dialog3({
|
|
38359
38350
|
modalRef,
|
|
@@ -38371,8 +38362,8 @@ function Dialog3({
|
|
|
38371
38362
|
return (_a = modalRef.current) == null ? void 0 : _a.close();
|
|
38372
38363
|
};
|
|
38373
38364
|
const clonedModal = useMemo6(() => {
|
|
38374
|
-
if (dialogRow &&
|
|
38375
|
-
return
|
|
38365
|
+
if (dialogRow && React7.isValidElement(children)) {
|
|
38366
|
+
return React7.cloneElement(children, {
|
|
38376
38367
|
key: JSON.stringify(dialogRow),
|
|
38377
38368
|
row: dialogRow,
|
|
38378
38369
|
show,
|
|
@@ -38426,8 +38417,8 @@ function Table3({
|
|
|
38426
38417
|
sortBy,
|
|
38427
38418
|
...props
|
|
38428
38419
|
}) {
|
|
38429
|
-
const [handlers, setHandlers] =
|
|
38430
|
-
const [page, setPage] =
|
|
38420
|
+
const [handlers, setHandlers] = useState12({});
|
|
38421
|
+
const [page, setPage] = useState12(1);
|
|
38431
38422
|
function dataReducer(a, b) {
|
|
38432
38423
|
if (b == null) return {};
|
|
38433
38424
|
if (Array.isArray(b)) {
|
|
@@ -38448,7 +38439,7 @@ function Table3({
|
|
|
38448
38439
|
};
|
|
38449
38440
|
const newHandlers = { ...handlers };
|
|
38450
38441
|
for (let item in cc) {
|
|
38451
|
-
const isReactComponent =
|
|
38442
|
+
const isReactComponent = React8.isValidElement(cc[item]);
|
|
38452
38443
|
if (isReactComponent) {
|
|
38453
38444
|
newHandlers[item] = cc[item];
|
|
38454
38445
|
const value = ((_c = (_b = cc[item]) == null ? void 0 : _b.props) == null ? void 0 : _c.value) || (typeof ((_e = (_d = cc[item]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) !== "object" ? (_g = (_f = cc[item]) == null ? void 0 : _f.props) == null ? void 0 : _g.children : "");
|
|
@@ -38485,9 +38476,9 @@ function Table3({
|
|
|
38485
38476
|
if (!objectData) return 0;
|
|
38486
38477
|
return maxItems ? Math.ceil(Object.keys(objectData).length / maxItems) : 1;
|
|
38487
38478
|
}, [objectData, maxItems]);
|
|
38488
|
-
const [sort, setSort] =
|
|
38479
|
+
const [sort, setSort] = useState12(sortBy);
|
|
38489
38480
|
const modalRef = useRef5(null);
|
|
38490
|
-
const [dialogRow, setDialogRow] =
|
|
38481
|
+
const [dialogRow, setDialogRow] = useState12({});
|
|
38491
38482
|
const context = {
|
|
38492
38483
|
objectData,
|
|
38493
38484
|
headers,
|
|
@@ -38547,16 +38538,16 @@ function Table3({
|
|
|
38547
38538
|
import { useEffect as useEffect14 } from "react";
|
|
38548
38539
|
|
|
38549
38540
|
// src/table-advanced/h.table.tsx
|
|
38550
|
-
import
|
|
38541
|
+
import React9, {
|
|
38551
38542
|
useCallback as useCallback3,
|
|
38552
38543
|
useEffect as useEffect12,
|
|
38553
38544
|
useMemo as useMemo10,
|
|
38554
38545
|
useRef as useRef7,
|
|
38555
|
-
useState as
|
|
38546
|
+
useState as useState15
|
|
38556
38547
|
} from "react";
|
|
38557
38548
|
|
|
38558
38549
|
// src/table-advanced/header.tsx
|
|
38559
|
-
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef6, useState as
|
|
38550
|
+
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef6, useState as useState13 } from "react";
|
|
38560
38551
|
import { createPortal } from "react-dom";
|
|
38561
38552
|
|
|
38562
38553
|
// src/table-advanced/icons.tsx
|
|
@@ -38810,12 +38801,12 @@ function Header({
|
|
|
38810
38801
|
index,
|
|
38811
38802
|
length
|
|
38812
38803
|
}) {
|
|
38813
|
-
const [visible, setVisible] =
|
|
38814
|
-
const [hovered, setHovered] =
|
|
38804
|
+
const [visible, setVisible] = useState13(false);
|
|
38805
|
+
const [hovered, setHovered] = useState13(false);
|
|
38815
38806
|
const sortIndex = context.sort.findIndex((b) => b.field == header);
|
|
38816
|
-
const [text, setText] =
|
|
38807
|
+
const [text, setText] = useState13("");
|
|
38817
38808
|
const cellRef = useRef6(null);
|
|
38818
|
-
const [coords, setCoords] =
|
|
38809
|
+
const [coords, setCoords] = useState13(
|
|
38819
38810
|
null
|
|
38820
38811
|
);
|
|
38821
38812
|
const filteredValues = useMemo8(() => {
|
|
@@ -38824,7 +38815,7 @@ function Header({
|
|
|
38824
38815
|
return `${d}`.toLowerCase().includes(text.toLowerCase());
|
|
38825
38816
|
});
|
|
38826
38817
|
}, [context.data, header, text]);
|
|
38827
|
-
const [selected, setSelected] =
|
|
38818
|
+
const [selected, setSelected] = useState13([]);
|
|
38828
38819
|
const hasFilter = context.filters.find((b) => b.field == header);
|
|
38829
38820
|
useEffect10(() => {
|
|
38830
38821
|
setSelected(filteredValues);
|
|
@@ -39174,16 +39165,16 @@ function valueFormatter({
|
|
|
39174
39165
|
}
|
|
39175
39166
|
|
|
39176
39167
|
// src/table-advanced/use.pagination.tsx
|
|
39177
|
-
import { useState as
|
|
39168
|
+
import { useState as useState14, useMemo as useMemo9, useCallback as useCallback2, useEffect as useEffect11 } from "react";
|
|
39178
39169
|
function usePaginacion({
|
|
39179
39170
|
total,
|
|
39180
39171
|
tamanioPagina = 100,
|
|
39181
39172
|
paginaInicial = 1
|
|
39182
39173
|
}) {
|
|
39183
|
-
const [totalPaginas, setTotalPaginas] =
|
|
39174
|
+
const [totalPaginas, setTotalPaginas] = useState14(
|
|
39184
39175
|
Math.max(1, Math.ceil(total / tamanioPagina))
|
|
39185
39176
|
);
|
|
39186
|
-
const [pagina, setPagina] =
|
|
39177
|
+
const [pagina, setPagina] = useState14(
|
|
39187
39178
|
Math.min(Math.max(paginaInicial, 1), totalPaginas)
|
|
39188
39179
|
);
|
|
39189
39180
|
const inicio = total === 0 ? 0 : (pagina - 1) * tamanioPagina + 1;
|
|
@@ -39231,9 +39222,9 @@ import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
|
39231
39222
|
function HTable({
|
|
39232
39223
|
context
|
|
39233
39224
|
}) {
|
|
39234
|
-
const [isLoading, setIsloading] =
|
|
39225
|
+
const [isLoading, setIsloading] = useState15(false);
|
|
39235
39226
|
const { cols, headers } = context;
|
|
39236
|
-
const [currentIndex, setCurrentIndex] =
|
|
39227
|
+
const [currentIndex, setCurrentIndex] = useState15(-1);
|
|
39237
39228
|
const tableRef = useRef7(null);
|
|
39238
39229
|
const modalRef = useRef7(null);
|
|
39239
39230
|
const catDensities = { confortable: 80, compact: 30, standard: 53 };
|
|
@@ -39248,7 +39239,7 @@ function HTable({
|
|
|
39248
39239
|
function resize(headers3) {
|
|
39249
39240
|
return Object.fromEntries(headers3.map((h) => [h, getWidth(h)]));
|
|
39250
39241
|
}
|
|
39251
|
-
const [widths2, setWidths2] =
|
|
39242
|
+
const [widths2, setWidths2] = useState15({});
|
|
39252
39243
|
const startDrag2 = useCallback3(
|
|
39253
39244
|
(e, headerKey) => {
|
|
39254
39245
|
var _a;
|
|
@@ -39535,7 +39526,7 @@ function HTable({
|
|
|
39535
39526
|
context.setEditions(newEditions);
|
|
39536
39527
|
}
|
|
39537
39528
|
}
|
|
39538
|
-
) : ((_c = context.buttons) == null ? void 0 : _c[key]) ?
|
|
39529
|
+
) : ((_c = context.buttons) == null ? void 0 : _c[key]) ? React9.cloneElement(context.buttons[key], {
|
|
39539
39530
|
// children: context.buttons[key]?.props?.children
|
|
39540
39531
|
// ? item
|
|
39541
39532
|
// : undefined,
|
|
@@ -39579,7 +39570,7 @@ function HTable({
|
|
|
39579
39570
|
}) : ["number", "string"].includes(typeof item) ? valueFormatter({
|
|
39580
39571
|
value: item,
|
|
39581
39572
|
currentCoin: context.currentCoin
|
|
39582
|
-
}) :
|
|
39573
|
+
}) : React9.isValidElement(item) ? item : JSON.stringify(item)
|
|
39583
39574
|
},
|
|
39584
39575
|
row.id + i
|
|
39585
39576
|
);
|
|
@@ -39676,7 +39667,7 @@ function HTable({
|
|
|
39676
39667
|
"div",
|
|
39677
39668
|
{
|
|
39678
39669
|
className: "bg-white/40 absolute inset-0 text-black flex items-center justify-center",
|
|
39679
|
-
style: { zIndex:
|
|
39670
|
+
style: { zIndex: 10 },
|
|
39680
39671
|
children: "Loading..."
|
|
39681
39672
|
}
|
|
39682
39673
|
)
|
|
@@ -39714,7 +39705,7 @@ function ModalContent({
|
|
|
39714
39705
|
}
|
|
39715
39706
|
)
|
|
39716
39707
|
] }),
|
|
39717
|
-
|
|
39708
|
+
React9.cloneElement(context.modal, {
|
|
39718
39709
|
row: searchedData[currentIndex],
|
|
39719
39710
|
hide
|
|
39720
39711
|
})
|
|
@@ -39722,7 +39713,7 @@ function ModalContent({
|
|
|
39722
39713
|
}
|
|
39723
39714
|
|
|
39724
39715
|
// src/table-advanced/context.ts
|
|
39725
|
-
import { useEffect as useEffect13, useMemo as useMemo11, useReducer as useReducer3, useState as
|
|
39716
|
+
import { useEffect as useEffect13, useMemo as useMemo11, useReducer as useReducer3, useState as useState16 } from "react";
|
|
39726
39717
|
|
|
39727
39718
|
// src/table-advanced/filter.reducer.ts
|
|
39728
39719
|
var filterReducer = (acc, b) => {
|
|
@@ -39750,17 +39741,17 @@ var sortReducer = (acc, b) => {
|
|
|
39750
39741
|
// src/table-advanced/context.ts
|
|
39751
39742
|
function useContext({ onSelect }) {
|
|
39752
39743
|
const excel = useExcel();
|
|
39753
|
-
const [editions, setEditions] =
|
|
39754
|
-
const [selected, setSelected] =
|
|
39755
|
-
const [data, setData] =
|
|
39744
|
+
const [editions, setEditions] = useState16([]);
|
|
39745
|
+
const [selected, setSelected] = useState16([]);
|
|
39746
|
+
const [data, setData] = useState16([]);
|
|
39756
39747
|
const headers = [...new Set(data.map((b) => Object.keys(b)).flat())];
|
|
39757
|
-
const [currentHeader, setCurrentHeader] =
|
|
39748
|
+
const [currentHeader, setCurrentHeader] = useState16(null);
|
|
39758
39749
|
const cols = headers.length;
|
|
39759
39750
|
const [filters, setFilters] = useReducer3(
|
|
39760
39751
|
filterReducer,
|
|
39761
39752
|
new Array()
|
|
39762
39753
|
);
|
|
39763
|
-
const [searchBy, setSearchBy] =
|
|
39754
|
+
const [searchBy, setSearchBy] = useState16("");
|
|
39764
39755
|
const [sort, setSort] = useReducer3(sortReducer, new Array());
|
|
39765
39756
|
const sortedData = useMemo11(() => {
|
|
39766
39757
|
return [...data].sort((a, b) => {
|
|
@@ -39855,15 +39846,15 @@ function TableAdvanced(tableProps) {
|
|
|
39855
39846
|
}
|
|
39856
39847
|
|
|
39857
39848
|
// src/tabs/index.tsx
|
|
39858
|
-
import
|
|
39849
|
+
import React10, { useEffect as useEffect15, useState as useState18 } from "react";
|
|
39859
39850
|
import { Fragment as Fragment3, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
39860
39851
|
function TabContainer({
|
|
39861
39852
|
children,
|
|
39862
39853
|
labelMaxWidth,
|
|
39863
39854
|
currentIndex = 0
|
|
39864
39855
|
}) {
|
|
39865
|
-
const [index, setIndex] =
|
|
39866
|
-
const items =
|
|
39856
|
+
const [index, setIndex] = useState18(0);
|
|
39857
|
+
const items = React10.Children.toArray(
|
|
39867
39858
|
children
|
|
39868
39859
|
);
|
|
39869
39860
|
const labels = items.map((c) => c.props.label);
|
package/package.json
CHANGED
package/src/text-area/index.tsx
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
DetailedHTMLProps,
|
|
3
|
-
TextareaHTMLAttributes,
|
|
4
|
-
useState,
|
|
5
|
-
} from "react";
|
|
1
|
+
import React, { DetailedHTMLProps, TextareaHTMLAttributes } from "react";
|
|
6
2
|
|
|
7
3
|
interface Props extends DetailedHTMLProps<
|
|
8
4
|
TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
@@ -11,36 +7,35 @@ interface Props extends DetailedHTMLProps<
|
|
|
11
7
|
label?: React.ReactNode;
|
|
12
8
|
maxLength?: number;
|
|
13
9
|
}
|
|
10
|
+
|
|
14
11
|
export default function TextArea({
|
|
15
12
|
label,
|
|
16
13
|
className,
|
|
17
14
|
maxLength,
|
|
18
15
|
onChange,
|
|
19
|
-
|
|
16
|
+
value,
|
|
20
17
|
...props
|
|
21
18
|
}: Props) {
|
|
22
|
-
const
|
|
19
|
+
const currentValue = String(value ?? "");
|
|
20
|
+
|
|
23
21
|
return (
|
|
24
22
|
<div className="w-full relative my-3">
|
|
25
|
-
<div className="relative flex items-center border rounded bg-white
|
|
23
|
+
<div className="relative flex items-center border rounded bg-white">
|
|
26
24
|
<textarea
|
|
27
25
|
{...props}
|
|
28
26
|
className={["p-1 w-full transparent", className].join(" ")}
|
|
29
|
-
value={
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}}
|
|
37
|
-
></textarea>{" "}
|
|
38
|
-
<label className="absolute -top-2.5 left-2 text-xs font-bold px-1">
|
|
39
|
-
{label} {props?.required && <span className="text-red-500">*</span>}
|
|
27
|
+
value={currentValue}
|
|
28
|
+
maxLength={maxLength}
|
|
29
|
+
onChange={onChange}
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<label className="absolute -top-2.5 left-2 text-xs font-bold px-1">
|
|
33
|
+
{label} {props.required && <span className="text-red-500">*</span>}
|
|
40
34
|
</label>
|
|
35
|
+
|
|
41
36
|
{maxLength && (
|
|
42
|
-
<div className="
|
|
43
|
-
{
|
|
37
|
+
<div className="text-xs text-gray text-right">
|
|
38
|
+
{currentValue.length} / {maxLength}
|
|
44
39
|
</div>
|
|
45
40
|
)}
|
|
46
41
|
</div>
|