next-recomponents 2.0.65 → 2.0.67
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 +137 -144
- package/dist/index.mjs +85 -94
- package/package.json +1 -1
- package/src/text-area/index.tsx +16 -21
- package/src/use-resources/index.ts +12 -12
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 = {
|
|
@@ -36664,30 +36655,30 @@ function useResources({
|
|
|
36664
36655
|
);
|
|
36665
36656
|
async function doSome() {
|
|
36666
36657
|
var _a, _b, _c, _d, _e;
|
|
36667
|
-
const
|
|
36668
|
-
|
|
36669
|
-
|
|
36670
|
-
|
|
36671
|
-
|
|
36672
|
-
|
|
36673
|
-
|
|
36674
|
-
|
|
36675
|
-
|
|
36676
|
-
|
|
36658
|
+
const keys2 = Object.keys(info);
|
|
36659
|
+
for (let key of keys2) {
|
|
36660
|
+
if (key) {
|
|
36661
|
+
if ((_a = info[key]) == null ? void 0 : _a.id) {
|
|
36662
|
+
await results[key].find((_b = info[key]) == null ? void 0 : _b.id, (_c = info[key]) == null ? void 0 : _c.defaultParams);
|
|
36663
|
+
} else if ((_d = info[key]) == null ? void 0 : _d.defaultParams) {
|
|
36664
|
+
await results[key].show((_e = info[key]) == null ? void 0 : _e.defaultParams);
|
|
36665
|
+
} else {
|
|
36666
|
+
results[key].setLoaded();
|
|
36667
|
+
}
|
|
36677
36668
|
}
|
|
36678
36669
|
}
|
|
36679
36670
|
}
|
|
36680
36671
|
useEffect4(() => {
|
|
36681
36672
|
doSome();
|
|
36682
|
-
}, [
|
|
36673
|
+
}, []);
|
|
36683
36674
|
return results;
|
|
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
|
);
|
|
@@ -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>
|
|
@@ -448,23 +448,23 @@ export default function useResources<T extends Record<string, ItemsRecord>>({
|
|
|
448
448
|
);
|
|
449
449
|
|
|
450
450
|
async function doSome() {
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
451
|
+
const keys = Object.keys(info);
|
|
452
|
+
|
|
453
|
+
for (let key of keys) {
|
|
454
|
+
if (key) {
|
|
455
|
+
if (info[key]?.id) {
|
|
456
|
+
await results[key].find(info[key]?.id, info[key]?.defaultParams);
|
|
457
|
+
} else if (info[key]?.defaultParams) {
|
|
458
|
+
await results[key].show(info[key]?.defaultParams);
|
|
459
|
+
} else {
|
|
460
|
+
results[key].setLoaded();
|
|
461
|
+
}
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
465
|
useEffect(() => {
|
|
466
466
|
doSome();
|
|
467
|
-
}, [
|
|
467
|
+
}, []);
|
|
468
468
|
|
|
469
469
|
return results;
|
|
470
470
|
}
|