next-recomponents 1.9.2 → 1.9.4
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.js +22 -12
- package/dist/index.mjs +23 -13
- package/package.json +1 -1
- package/src/table/filter.menu.tsx +1 -1
- package/src/table/h.tsx +2 -2
- package/src/table3/body.tsx +1 -1
- package/src/table3/filter.tsx +17 -4
- package/src/table3/head.tsx +3 -0
- package/src/table3/index.tsx +6 -4
package/dist/index.js
CHANGED
|
@@ -44265,8 +44265,8 @@ function HTable(_a) {
|
|
|
44265
44265
|
}) }) }),
|
|
44266
44266
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "divide-y divide-gray-200", children: mapedData.map((md, trKey) => {
|
|
44267
44267
|
var _a2, _b2;
|
|
44268
|
-
const start = (page - 1) * maxItems;
|
|
44269
|
-
const end = page * maxItems;
|
|
44268
|
+
const start = maxItems == Infinity ? 0 : (page - 1) * maxItems;
|
|
44269
|
+
const end = maxItems == Infinity ? Infinity : page * maxItems;
|
|
44270
44270
|
if (!hasFilters) {
|
|
44271
44271
|
if (trKey < start || trKey >= end) return null;
|
|
44272
44272
|
}
|
|
@@ -45595,7 +45595,8 @@ function Filter({
|
|
|
45595
45595
|
objectData,
|
|
45596
45596
|
setObjectData,
|
|
45597
45597
|
setPage,
|
|
45598
|
-
colSizes
|
|
45598
|
+
colSizes,
|
|
45599
|
+
data
|
|
45599
45600
|
}) {
|
|
45600
45601
|
const [visible, setVisible] = (0, import_react33.useState)(false);
|
|
45601
45602
|
const [text, setText] = (0, import_react33.useState)("");
|
|
@@ -45638,7 +45639,15 @@ function Filter({
|
|
|
45638
45639
|
setVisible(false);
|
|
45639
45640
|
setText("");
|
|
45640
45641
|
}
|
|
45641
|
-
const hidden = Object.values(objectData).filter(
|
|
45642
|
+
const hidden = Object.values(objectData).filter(
|
|
45643
|
+
(d) => d._visible === false
|
|
45644
|
+
);
|
|
45645
|
+
(0, import_react33.useEffect)(() => {
|
|
45646
|
+
if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
|
|
45647
|
+
const news = [...new Set(data.map((o) => o[h]))];
|
|
45648
|
+
setSelected(news);
|
|
45649
|
+
}
|
|
45650
|
+
}, [data]);
|
|
45642
45651
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("th", { className: "cursor-pointer", children: [
|
|
45643
45652
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "relative", children: visible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
45644
45653
|
"div",
|
|
@@ -45680,7 +45689,6 @@ function Filter({
|
|
|
45680
45689
|
},
|
|
45681
45690
|
children: [
|
|
45682
45691
|
"Borrar Filtro",
|
|
45683
|
-
" ",
|
|
45684
45692
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-white ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FilterOffIcon, {}) })
|
|
45685
45693
|
]
|
|
45686
45694
|
}
|
|
@@ -45783,6 +45791,7 @@ function TableHead({
|
|
|
45783
45791
|
objectData,
|
|
45784
45792
|
page,
|
|
45785
45793
|
setPage,
|
|
45794
|
+
data,
|
|
45786
45795
|
maxItems,
|
|
45787
45796
|
colSizes,
|
|
45788
45797
|
modal
|
|
@@ -45824,7 +45833,8 @@ function TableHead({
|
|
|
45824
45833
|
h,
|
|
45825
45834
|
setObjectData,
|
|
45826
45835
|
setPage,
|
|
45827
|
-
colSizes
|
|
45836
|
+
colSizes,
|
|
45837
|
+
data
|
|
45828
45838
|
},
|
|
45829
45839
|
h
|
|
45830
45840
|
);
|
|
@@ -45957,7 +45967,7 @@ function TableBody({
|
|
|
45957
45967
|
var _a;
|
|
45958
45968
|
return ((_a = objectData[id3]) == null ? void 0 : _a._visible) === true;
|
|
45959
45969
|
}).filter((_id, key) => {
|
|
45960
|
-
if (!maxItems) return true;
|
|
45970
|
+
if (!maxItems || maxItems == Infinity) return true;
|
|
45961
45971
|
const start = (page - 1) * maxItems;
|
|
45962
45972
|
const end = page * maxItems;
|
|
45963
45973
|
return key >= start && key < end;
|
|
@@ -46165,7 +46175,7 @@ function Table3(_a) {
|
|
|
46165
46175
|
var _b = _a, {
|
|
46166
46176
|
data,
|
|
46167
46177
|
selectItems,
|
|
46168
|
-
maxItems,
|
|
46178
|
+
maxItems = Infinity,
|
|
46169
46179
|
onSave,
|
|
46170
46180
|
exportName,
|
|
46171
46181
|
colSizes,
|
|
@@ -46261,7 +46271,8 @@ function Table3(_a) {
|
|
|
46261
46271
|
colSizes,
|
|
46262
46272
|
header,
|
|
46263
46273
|
footer,
|
|
46264
|
-
onChange
|
|
46274
|
+
onChange,
|
|
46275
|
+
data
|
|
46265
46276
|
}, props);
|
|
46266
46277
|
(0, import_react37.useEffect)(() => {
|
|
46267
46278
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
@@ -46271,7 +46282,6 @@ function Table3(_a) {
|
|
|
46271
46282
|
}, [objectData]);
|
|
46272
46283
|
const style = (props == null ? void 0 : props.style) ? __spreadProps(__spreadValues({}, props.style), { tableLayout: "fixed" }) : { tableLayout: "fixed" };
|
|
46273
46284
|
if (!objectData) return null;
|
|
46274
|
-
console.log({ objectData });
|
|
46275
46285
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
|
|
46276
46286
|
modal && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
46277
46287
|
dialog_default,
|
|
@@ -46283,8 +46293,8 @@ function Table3(_a) {
|
|
|
46283
46293
|
children: modal
|
|
46284
46294
|
}
|
|
46285
46295
|
),
|
|
46286
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
46287
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Panel, __spreadValues({}, context)),
|
|
46296
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
46297
|
+
maxItems !== Infinity && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Panel, __spreadValues({}, context)),
|
|
46288
46298
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("table", __spreadProps(__spreadValues({}, props), { style, children: [
|
|
46289
46299
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableHead, __spreadValues({}, context)),
|
|
46290
46300
|
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableBody, __spreadValues({}, context)),
|
package/dist/index.mjs
CHANGED
|
@@ -44246,8 +44246,8 @@ function HTable(_a) {
|
|
|
44246
44246
|
}) }) }),
|
|
44247
44247
|
/* @__PURE__ */ jsx12("tbody", { className: "divide-y divide-gray-200", children: mapedData.map((md, trKey) => {
|
|
44248
44248
|
var _a2, _b2;
|
|
44249
|
-
const start = (page - 1) * maxItems;
|
|
44250
|
-
const end = page * maxItems;
|
|
44249
|
+
const start = maxItems == Infinity ? 0 : (page - 1) * maxItems;
|
|
44250
|
+
const end = maxItems == Infinity ? Infinity : page * maxItems;
|
|
44251
44251
|
if (!hasFilters) {
|
|
44252
44252
|
if (trKey < start || trKey >= end) return null;
|
|
44253
44253
|
}
|
|
@@ -45585,14 +45585,15 @@ import React11, {
|
|
|
45585
45585
|
} from "react";
|
|
45586
45586
|
|
|
45587
45587
|
// src/table3/filter.tsx
|
|
45588
|
-
import { useMemo as useMemo10, useState as useState12 } from "react";
|
|
45588
|
+
import { useEffect as useEffect10, useMemo as useMemo10, useState as useState12 } from "react";
|
|
45589
45589
|
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
45590
45590
|
function Filter({
|
|
45591
45591
|
h,
|
|
45592
45592
|
objectData,
|
|
45593
45593
|
setObjectData,
|
|
45594
45594
|
setPage,
|
|
45595
|
-
colSizes
|
|
45595
|
+
colSizes,
|
|
45596
|
+
data
|
|
45596
45597
|
}) {
|
|
45597
45598
|
const [visible, setVisible] = useState12(false);
|
|
45598
45599
|
const [text, setText] = useState12("");
|
|
@@ -45635,7 +45636,15 @@ function Filter({
|
|
|
45635
45636
|
setVisible(false);
|
|
45636
45637
|
setText("");
|
|
45637
45638
|
}
|
|
45638
|
-
const hidden = Object.values(objectData).filter(
|
|
45639
|
+
const hidden = Object.values(objectData).filter(
|
|
45640
|
+
(d) => d._visible === false
|
|
45641
|
+
);
|
|
45642
|
+
useEffect10(() => {
|
|
45643
|
+
if (data.length != Object.values(objectData).map((o) => (o == null ? void 0 : o._id) || (o == null ? void 0 : o.id)).length) {
|
|
45644
|
+
const news = [...new Set(data.map((o) => o[h]))];
|
|
45645
|
+
setSelected(news);
|
|
45646
|
+
}
|
|
45647
|
+
}, [data]);
|
|
45639
45648
|
return /* @__PURE__ */ jsxs18("th", { className: "cursor-pointer", children: [
|
|
45640
45649
|
/* @__PURE__ */ jsx27("div", { className: "relative", children: visible && /* @__PURE__ */ jsx27(
|
|
45641
45650
|
"div",
|
|
@@ -45677,7 +45686,6 @@ function Filter({
|
|
|
45677
45686
|
},
|
|
45678
45687
|
children: [
|
|
45679
45688
|
"Borrar Filtro",
|
|
45680
|
-
" ",
|
|
45681
45689
|
/* @__PURE__ */ jsx27("div", { className: "text-white ", children: /* @__PURE__ */ jsx27(FilterOffIcon, {}) })
|
|
45682
45690
|
]
|
|
45683
45691
|
}
|
|
@@ -45780,6 +45788,7 @@ function TableHead({
|
|
|
45780
45788
|
objectData,
|
|
45781
45789
|
page,
|
|
45782
45790
|
setPage,
|
|
45791
|
+
data,
|
|
45783
45792
|
maxItems,
|
|
45784
45793
|
colSizes,
|
|
45785
45794
|
modal
|
|
@@ -45821,7 +45830,8 @@ function TableHead({
|
|
|
45821
45830
|
h,
|
|
45822
45831
|
setObjectData,
|
|
45823
45832
|
setPage,
|
|
45824
|
-
colSizes
|
|
45833
|
+
colSizes,
|
|
45834
|
+
data
|
|
45825
45835
|
},
|
|
45826
45836
|
h
|
|
45827
45837
|
);
|
|
@@ -45954,7 +45964,7 @@ function TableBody({
|
|
|
45954
45964
|
var _a;
|
|
45955
45965
|
return ((_a = objectData[id3]) == null ? void 0 : _a._visible) === true;
|
|
45956
45966
|
}).filter((_id, key) => {
|
|
45957
|
-
if (!maxItems) return true;
|
|
45967
|
+
if (!maxItems || maxItems == Infinity) return true;
|
|
45958
45968
|
const start = (page - 1) * maxItems;
|
|
45959
45969
|
const end = page * maxItems;
|
|
45960
45970
|
return key >= start && key < end;
|
|
@@ -46162,7 +46172,7 @@ function Table3(_a) {
|
|
|
46162
46172
|
var _b = _a, {
|
|
46163
46173
|
data,
|
|
46164
46174
|
selectItems,
|
|
46165
|
-
maxItems,
|
|
46175
|
+
maxItems = Infinity,
|
|
46166
46176
|
onSave,
|
|
46167
46177
|
exportName,
|
|
46168
46178
|
colSizes,
|
|
@@ -46258,7 +46268,8 @@ function Table3(_a) {
|
|
|
46258
46268
|
colSizes,
|
|
46259
46269
|
header,
|
|
46260
46270
|
footer,
|
|
46261
|
-
onChange
|
|
46271
|
+
onChange,
|
|
46272
|
+
data
|
|
46262
46273
|
}, props);
|
|
46263
46274
|
useEffect11(() => {
|
|
46264
46275
|
if ((dialogRow == null ? void 0 : dialogRow.id) || (dialogRow == null ? void 0 : dialogRow._id)) {
|
|
@@ -46268,7 +46279,6 @@ function Table3(_a) {
|
|
|
46268
46279
|
}, [objectData]);
|
|
46269
46280
|
const style = (props == null ? void 0 : props.style) ? __spreadProps(__spreadValues({}, props.style), { tableLayout: "fixed" }) : { tableLayout: "fixed" };
|
|
46270
46281
|
if (!objectData) return null;
|
|
46271
|
-
console.log({ objectData });
|
|
46272
46282
|
return /* @__PURE__ */ jsxs24("div", { className: "border shadow rounded m-1 p-1 bg-white", children: [
|
|
46273
46283
|
modal && /* @__PURE__ */ jsx34(
|
|
46274
46284
|
dialog_default,
|
|
@@ -46280,8 +46290,8 @@ function Table3(_a) {
|
|
|
46280
46290
|
children: modal
|
|
46281
46291
|
}
|
|
46282
46292
|
),
|
|
46283
|
-
/* @__PURE__ */ jsx34("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
46284
|
-
/* @__PURE__ */ jsx34(Panel, __spreadValues({}, context)),
|
|
46293
|
+
header && /* @__PURE__ */ jsx34("div", { className: "font-bold text-2xl py-5 px-2 bg-blue-50", children: header }),
|
|
46294
|
+
maxItems !== Infinity && /* @__PURE__ */ jsx34(Panel, __spreadValues({}, context)),
|
|
46285
46295
|
/* @__PURE__ */ jsxs24("table", __spreadProps(__spreadValues({}, props), { style, children: [
|
|
46286
46296
|
/* @__PURE__ */ jsx34(TableHead, __spreadValues({}, context)),
|
|
46287
46297
|
/* @__PURE__ */ jsx34(TableBody, __spreadValues({}, context)),
|
package/package.json
CHANGED
package/src/table/h.tsx
CHANGED
|
@@ -182,8 +182,8 @@ export default function HTable({
|
|
|
182
182
|
</thead>
|
|
183
183
|
<tbody className="divide-y divide-gray-200">
|
|
184
184
|
{mapedData.map((md: any, trKey: number) => {
|
|
185
|
-
const start = (page - 1) * maxItems;
|
|
186
|
-
const end = page * maxItems;
|
|
185
|
+
const start = maxItems == Infinity ? 0 : (page - 1) * maxItems;
|
|
186
|
+
const end = maxItems == Infinity ? Infinity : page * maxItems;
|
|
187
187
|
|
|
188
188
|
if (!hasFilters) {
|
|
189
189
|
if (trKey < start || trKey >= end) return null;
|
package/src/table3/body.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export default function TableBody({
|
|
|
40
40
|
return objectData[id]?._visible === true;
|
|
41
41
|
})
|
|
42
42
|
.filter((_id, key) => {
|
|
43
|
-
if (!maxItems) return true;
|
|
43
|
+
if (!maxItems || maxItems == Infinity) return true;
|
|
44
44
|
const start = (page - 1) * maxItems; // ej: 0 en la página 1
|
|
45
45
|
const end = page * maxItems; // ej: 10 en la página 1
|
|
46
46
|
return key >= start && key < end; // 👈 usamos < en vez de <=
|
package/src/table3/filter.tsx
CHANGED
|
@@ -8,15 +8,18 @@ export default function Filter({
|
|
|
8
8
|
setObjectData,
|
|
9
9
|
setPage,
|
|
10
10
|
colSizes,
|
|
11
|
+
data,
|
|
11
12
|
}: {
|
|
12
13
|
h: any;
|
|
13
14
|
objectData: any;
|
|
14
15
|
setObjectData: any;
|
|
15
16
|
setPage: any;
|
|
16
17
|
colSizes?: Record<string, number>;
|
|
18
|
+
data: any[];
|
|
17
19
|
}) {
|
|
18
20
|
const [visible, setVisible] = useState(false);
|
|
19
21
|
const [text, setText] = useState("");
|
|
22
|
+
|
|
20
23
|
const items = useMemo(
|
|
21
24
|
() => [...new Set(Object.values(objectData).map((o: any) => o[h]))],
|
|
22
25
|
[objectData]
|
|
@@ -72,9 +75,18 @@ export default function Filter({
|
|
|
72
75
|
setVisible(false);
|
|
73
76
|
setText("");
|
|
74
77
|
}
|
|
75
|
-
const hidden = Object.values(objectData)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
const hidden = Object.values(objectData).filter(
|
|
79
|
+
(d: any) => d._visible === false
|
|
80
|
+
);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (
|
|
83
|
+
data.length !=
|
|
84
|
+
Object.values(objectData).map((o: any) => o?._id || o?.id).length
|
|
85
|
+
) {
|
|
86
|
+
const news = [...new Set(data.map((o: any) => o[h]))];
|
|
87
|
+
setSelected(news);
|
|
88
|
+
}
|
|
89
|
+
}, [data]);
|
|
78
90
|
|
|
79
91
|
return (
|
|
80
92
|
<th className="cursor-pointer">
|
|
@@ -104,6 +116,7 @@ export default function Filter({
|
|
|
104
116
|
</div>
|
|
105
117
|
)}
|
|
106
118
|
</div>
|
|
119
|
+
|
|
107
120
|
{visible && (
|
|
108
121
|
<div
|
|
109
122
|
className="border shadow rounded bg-white p-1 absolute left-0 text-black"
|
|
@@ -117,7 +130,7 @@ export default function Filter({
|
|
|
117
130
|
filtrar(items);
|
|
118
131
|
}}
|
|
119
132
|
>
|
|
120
|
-
Borrar Filtro
|
|
133
|
+
Borrar Filtro
|
|
121
134
|
<div className="text-white ">
|
|
122
135
|
<FilterOffIcon />
|
|
123
136
|
</div>
|
package/src/table3/head.tsx
CHANGED
|
@@ -8,6 +8,7 @@ export default function TableHead({
|
|
|
8
8
|
objectData,
|
|
9
9
|
page,
|
|
10
10
|
setPage,
|
|
11
|
+
data,
|
|
11
12
|
maxItems,
|
|
12
13
|
colSizes,
|
|
13
14
|
modal,
|
|
@@ -17,6 +18,7 @@ export default function TableHead({
|
|
|
17
18
|
setObjectData: any;
|
|
18
19
|
objectData: any;
|
|
19
20
|
page: number;
|
|
21
|
+
data: any[];
|
|
20
22
|
setPage: any;
|
|
21
23
|
maxItems?: number;
|
|
22
24
|
colSizes?: Record<string, any>;
|
|
@@ -63,6 +65,7 @@ export default function TableHead({
|
|
|
63
65
|
setObjectData={setObjectData}
|
|
64
66
|
setPage={setPage}
|
|
65
67
|
colSizes={colSizes}
|
|
68
|
+
data={data}
|
|
66
69
|
/>
|
|
67
70
|
);
|
|
68
71
|
})}
|
package/src/table3/index.tsx
CHANGED
|
@@ -35,7 +35,7 @@ interface Table3Props
|
|
|
35
35
|
export default function Table3({
|
|
36
36
|
data,
|
|
37
37
|
selectItems,
|
|
38
|
-
maxItems,
|
|
38
|
+
maxItems = Infinity,
|
|
39
39
|
onSave,
|
|
40
40
|
exportName,
|
|
41
41
|
colSizes,
|
|
@@ -150,6 +150,7 @@ export default function Table3({
|
|
|
150
150
|
header,
|
|
151
151
|
footer,
|
|
152
152
|
onChange,
|
|
153
|
+
data,
|
|
153
154
|
...props,
|
|
154
155
|
};
|
|
155
156
|
|
|
@@ -166,7 +167,6 @@ export default function Table3({
|
|
|
166
167
|
: { tableLayout: "fixed" };
|
|
167
168
|
|
|
168
169
|
if (!objectData) return null;
|
|
169
|
-
console.log({ objectData });
|
|
170
170
|
return (
|
|
171
171
|
<div className="border shadow rounded m-1 p-1 bg-white">
|
|
172
172
|
{modal && (
|
|
@@ -179,8 +179,10 @@ export default function Table3({
|
|
|
179
179
|
{modal}
|
|
180
180
|
</Dialog>
|
|
181
181
|
)}
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
{header && (
|
|
183
|
+
<div className="font-bold text-2xl py-5 px-2 bg-blue-50">{header}</div>
|
|
184
|
+
)}
|
|
185
|
+
{maxItems !== Infinity && <Panel {...context} />}
|
|
184
186
|
<table {...props} style={style}>
|
|
185
187
|
<TableHead {...context} />
|
|
186
188
|
<TableBody {...context} />
|