next-recomponents 1.3.4 → 1.3.6

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 CHANGED
@@ -11120,9 +11120,6 @@ var regularExpresions = {
11120
11120
  };
11121
11121
  var regular_expresions_default = regularExpresions;
11122
11122
 
11123
- // src/table/index.tsx
11124
- var import_react26 = require("react");
11125
-
11126
11123
  // src/table/h.tsx
11127
11124
  var import_react25 = __toESM(require("react"));
11128
11125
 
@@ -11136,7 +11133,6 @@ function TD(_a) {
11136
11133
  index,
11137
11134
  color: color2,
11138
11135
  symbols,
11139
- handlers,
11140
11136
  mapedData,
11141
11137
  setMapedData
11142
11138
  } = _b, props = __objRest(_b, [
@@ -11145,11 +11141,10 @@ function TD(_a) {
11145
11141
  "index",
11146
11142
  "color",
11147
11143
  "symbols",
11148
- "handlers",
11149
11144
  "mapedData",
11150
11145
  "setMapedData"
11151
11146
  ]);
11152
- var _a2, _b2, _c, _d;
11147
+ var _a2, _b2;
11153
11148
  const [isHidded, setIsHidded] = (0, import_react23.useState)(false);
11154
11149
  const newProps = symbols && import_react23.default.isValidElement(symbols[item == null ? void 0 : item.name]) && ((_b2 = Object.keys((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props)) == null ? void 0 : _b2.reduce(
11155
11150
  (acc, i) => {
@@ -11169,59 +11164,52 @@ function TD(_a) {
11169
11164
  },
11170
11165
  { defaultValue: item == null ? void 0 : item.content }
11171
11166
  ));
11172
- const newProps2 = handlers && import_react23.default.isValidElement(handlers[item == null ? void 0 : item.name]) && ((_d = Object.keys((_c = handlers[item == null ? void 0 : item.name]) == null ? void 0 : _c.props)) == null ? void 0 : _d.reduce(
11173
- (acc, i) => {
11174
- try {
11175
- const newAcc = __spreadValues({}, acc);
11176
- const hasEvent = `${i}`.startsWith("on");
11177
- if (hasEvent) {
11178
- newAcc[i] = (e) => {
11179
- var _a3, _b3;
11180
- e.item = item;
11181
- (_b3 = (_a3 = handlers[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
11182
- if (i == "onChange") {
11183
- const newData = [...mapedData];
11184
- newData[index][item == null ? void 0 : item.name].content = e.target.value;
11185
- setMapedData == null ? void 0 : setMapedData(newData);
11186
- }
11187
- };
11188
- }
11189
- return newAcc;
11190
- } catch (error) {
11191
- }
11192
- },
11193
- { value: item == null ? void 0 : item.content }
11194
- ));
11195
11167
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
11196
11168
  "td",
11197
11169
  {
11198
11170
  onDoubleClick: (e) => setIsHidded(!isHidded),
11199
- title: item == null ? void 0 : item.title,
11200
11171
  className: [
11201
11172
  isHidded && color2,
11202
11173
  !isHidded && "whitespace-nowrap overflow-hidden text-ellipsis ",
11203
- "border-b max-w-[200px] p-5 ",
11204
- ["number", "money"].includes(item == null ? void 0 : item.cellTypeOf) && "text-right"
11174
+ "border-b max-w-[200px] p-5 "
11175
+ // ["number", "money"].includes(item?.cellTypeOf) && "text-right",
11205
11176
  ].join(" "),
11206
- children: handlers && handlers[item == null ? void 0 : item.name] ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: import_react23.default.Children.map(handlers[item == null ? void 0 : item.name], (child) => {
11207
- if (import_react23.default.isValidElement(child)) {
11208
- return import_react23.default.cloneElement(child, __spreadValues({}, newProps2));
11209
- }
11210
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
11211
- "div",
11212
- {
11213
- className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between",
11214
- children: [
11215
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: symbols && import_react23.default.Children.map(symbols[item == null ? void 0 : item.name], (child) => {
11216
- if (import_react23.default.isValidElement(child)) {
11217
- return import_react23.default.cloneElement(child, __spreadValues({}, newProps));
11177
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between", children: [
11178
+ symbols && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: import_react23.default.Children.map(symbols[item == null ? void 0 : item.name], (child) => {
11179
+ if (import_react23.default.isValidElement(child)) {
11180
+ return import_react23.default.cloneElement(child, __spreadValues({}, newProps));
11181
+ }
11182
+ return child;
11183
+ }) }),
11184
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: (item == null ? void 0 : item.handler) ? import_react23.default.Children.map(item.handler, (handler) => {
11185
+ if (import_react23.default.isValidElement(handler)) {
11186
+ return import_react23.default.cloneElement(handler, {
11187
+ value: mapedData[index][item.name].content,
11188
+ onChange: (e) => {
11189
+ var _a3, _b3;
11190
+ const nmd = [...mapedData];
11191
+ nmd[index][item.name].content = e.target.value;
11192
+ e.item = Object.assign(
11193
+ {},
11194
+ ...nmd.map(
11195
+ (d) => Object.keys(d).map((k) => ({ [k]: d[k].content }))
11196
+ )[index]
11197
+ );
11198
+ e.setData = (data) => {
11199
+ const nmd2 = [...mapedData];
11200
+ for (let datum in data) {
11201
+ nmd2[index][datum].content = data[datum];
11202
+ }
11203
+ setMapedData == null ? void 0 : setMapedData(nmd2);
11204
+ };
11205
+ setMapedData == null ? void 0 : setMapedData(nmd);
11206
+ (_b3 = (_a3 = handler == null ? void 0 : handler.props) == null ? void 0 : _a3.onChange) == null ? void 0 : _b3.call(_a3, e);
11218
11207
  }
11219
- return child;
11220
- }) }),
11221
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: item == null ? void 0 : item.content })
11222
- ]
11223
- }
11224
- )
11208
+ });
11209
+ }
11210
+ return handler;
11211
+ }) : item.content })
11212
+ ] })
11225
11213
  }
11226
11214
  );
11227
11215
  }
@@ -11243,6 +11231,24 @@ function FilterOffIcon() {
11243
11231
  }
11244
11232
  );
11245
11233
  }
11234
+ function SaveIcon() {
11235
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
11236
+ "svg",
11237
+ {
11238
+ stroke: "currentColor",
11239
+ fill: "currentColor",
11240
+ strokeWidth: "0",
11241
+ viewBox: "0 0 512 512",
11242
+ height: "20px",
11243
+ width: "20px",
11244
+ xmlns: "http://www.w3.org/2000/svg",
11245
+ children: [
11246
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M272 64h-16c-4.4 0-8 3.6-8 8v72c0 4.4 7.6 8 12 8h12c4.4 0 8-3.6 8-8V72c0-4.4-3.6-8-8-8z" }),
11247
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M433.9 130.1L382 78.2c-9-9-21.3-14.2-34.1-14.2h-28c-8.8 0-16 7.3-16 16.2v80c0 8.8-7.2 16-16 16H160c-8.8 0-16-7.2-16-16v-80c0-8.8-7.2-16.2-16-16.2H96c-17.6 0-32 14.4-32 32v320c0 17.6 14.4 32 32 32h320c17.6 0 32-14.4 32-32V164c0-12.7-5.1-24.9-14.1-33.9zM322 400.1c0 8.8-8 16-17.8 16H143.8c-9.8 0-17.8-7.2-17.8-16v-96c0-8.8 8-16 17.8-16h160.4c9.8 0 17.8 7.2 17.8 16v96z" })
11248
+ ]
11249
+ }
11250
+ );
11251
+ }
11246
11252
  function ExcelIcon() {
11247
11253
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
11248
11254
  "svg",
@@ -11274,11 +11280,7 @@ function FilterMenu({
11274
11280
  const [newMapedData, setNewMapedData] = (0, import_react24.useState)([]);
11275
11281
  (0, import_react24.useEffect)(() => {
11276
11282
  setNewMapedData(
11277
- [
11278
- ...new Set(
11279
- mapedData.filter((md) => md.__visible__ === true).map((md) => md[h])
11280
- )
11281
- ].filter((item) => {
11283
+ [...new Set(mapedData.map((md) => md[h]))].filter((item) => {
11282
11284
  return item && `${item}`.toLowerCase().includes(text.toLowerCase());
11283
11285
  })
11284
11286
  );
@@ -11341,10 +11343,11 @@ function FilterMenu({
11341
11343
  checked: mapedData.map((d) => d[h].exclude).every((d) => d === false),
11342
11344
  onChange: (e) => {
11343
11345
  const nmd = [...mapedData];
11346
+ const all = nmd.map((d) => d[h].exclude).every((d) => d === false);
11344
11347
  setMapedData(
11345
11348
  nmd.map((d) => {
11346
11349
  const newd = __spreadValues({}, d);
11347
- newd[h].exclude = false;
11350
+ newd[h].exclude = all;
11348
11351
  return newd;
11349
11352
  })
11350
11353
  );
@@ -11424,163 +11427,6 @@ function FilterMenu({
11424
11427
  ] });
11425
11428
  }
11426
11429
 
11427
- // src/table/h.tsx
11428
- var import_jsx_runtime12 = require("react/jsx-runtime");
11429
- function HTable(_a) {
11430
- var _b = _a, {
11431
- data,
11432
- mapedData,
11433
- setMapedData,
11434
- symbols,
11435
- totals,
11436
- exportName
11437
- } = _b, props = __objRest(_b, [
11438
- "data",
11439
- "mapedData",
11440
- "setMapedData",
11441
- "symbols",
11442
- "totals",
11443
- "exportName"
11444
- ]);
11445
- const [selected, setSelected] = (0, import_react25.useState)(null);
11446
- const [selectedFilter, setSelectedFilter] = (0, import_react25.useState)(null);
11447
- const modalRef = (0, import_react25.useRef)(null);
11448
- const head = (0, import_react25.useMemo)(() => {
11449
- return [...new Set(data.map((d) => Object.keys(d)).flat())];
11450
- }, [data]);
11451
- const mapedTotals = (0, import_react25.useMemo)(() => {
11452
- return mapedData == null ? void 0 : mapedData.reduce((acc, md) => {
11453
- head.forEach((h) => {
11454
- var _a2, _b2;
11455
- const value = isNaN(+((_a2 = md[h]) == null ? void 0 : _a2.content)) ? 0 : +((_b2 = md[h]) == null ? void 0 : _b2.content);
11456
- if (acc[h]) {
11457
- acc[h] += value;
11458
- } else {
11459
- acc[h] = value;
11460
- }
11461
- });
11462
- return acc;
11463
- }, {});
11464
- }, [mapedData]);
11465
- (0, import_react25.useEffect)(() => {
11466
- const newData = data.map((d, trkey) => {
11467
- const obj = { __visible__: true };
11468
- for (let key in d) {
11469
- const typeOf = typeof d[key];
11470
- const isObject2 = typeOf == "object";
11471
- const isDate = typeOf == "string" && d[key].includes("T");
11472
- const cellTypeOf = isDate ? "date" : isObject2 ? "object" : typeOf;
11473
- const content = cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? import_react25.default.isValidElement(d[key]) ? d[key] : JSON.stringify(d[key]) : d[key];
11474
- obj[key] = {
11475
- index: trkey,
11476
- originalData: content,
11477
- cellTypeOf,
11478
- title: content,
11479
- content,
11480
- name: key,
11481
- exclude: false
11482
- };
11483
- }
11484
- return obj;
11485
- });
11486
- setMapedData(newData);
11487
- }, [data]);
11488
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", __spreadProps(__spreadValues({}, props), { className: "w-full border-collapse table-auto", children: [
11489
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { children: head.map((h, key) => {
11490
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
11491
- "th",
11492
- {
11493
- className: "whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px] border-b p-5",
11494
- children: [
11495
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11496
- "div",
11497
- {
11498
- className: "cursor-pointer flex ",
11499
- onClick: (e) => {
11500
- setSelectedFilter(key == selectedFilter ? null : key);
11501
- },
11502
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-white w-full bg-black rounded p-1 flex justify-center", children: [
11503
- h,
11504
- " ",
11505
- !mapedData.map((d) => d[h].exclude).every((d) => d === false) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-red-300", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FilterOffIcon, {}) })
11506
- ] })
11507
- }
11508
- ),
11509
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11510
- FilterMenu,
11511
- {
11512
- h,
11513
- mapedData,
11514
- setMapedData,
11515
- index: key,
11516
- selectedFilter,
11517
- setSelectedFilter
11518
- }
11519
- )
11520
- ]
11521
- },
11522
- h
11523
- );
11524
- }) }) }),
11525
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-gray-200", children: mapedData.map((md, trKey) => {
11526
- var _a2;
11527
- const color2 = trKey % 2 == 0 ? "bg-white" : "bg-gray-100";
11528
- for (let d in md) {
11529
- if (md[d].exclude === true) {
11530
- return null;
11531
- }
11532
- }
11533
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11534
- "tr",
11535
- {
11536
- onDoubleClick: (e) => {
11537
- var _a3;
11538
- (_a3 = modalRef.current) == null ? void 0 : _a3.showModal();
11539
- },
11540
- onClick: (e) => setSelected(trKey),
11541
- className: [
11542
- "hover:bg-green-100 ",
11543
- color2,
11544
- selected == trKey && "bg-green-200 hover:bg-green-300"
11545
- ].join(" "),
11546
- children: head.map((h, tdKey) => {
11547
- var _a3;
11548
- const item = md[h];
11549
- const id3 = trKey + "-" + (((_a3 = md == null ? void 0 : md.id) == null ? void 0 : _a3.content) || tdKey) + "-" + h;
11550
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11551
- TD,
11552
- {
11553
- index: trKey,
11554
- symbols,
11555
- handlers: props.handlers,
11556
- item,
11557
- color: color2,
11558
- mapedData,
11559
- setMapedData
11560
- },
11561
- id3
11562
- );
11563
- })
11564
- },
11565
- ((_a2 = md == null ? void 0 : md.id) == null ? void 0 : _a2.content) || trKey
11566
- );
11567
- }) }),
11568
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tfoot", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { children: head.map((h, fkey) => {
11569
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
11570
- "th",
11571
- {
11572
- className: "text-right border-b max-w-[200px] p-5 ",
11573
- children: totals && totals.includes(h) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between text-white w-full bg-black rounded p-1", children: [
11574
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-1", children: symbols && symbols[h] && symbols[h] }),
11575
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-1", children: mapedTotals[h] })
11576
- ] })
11577
- },
11578
- fkey
11579
- );
11580
- }) }) })
11581
- ] })) });
11582
- }
11583
-
11584
11430
  // ../../node_modules/xlsx/xlsx.mjs
11585
11431
  var XLSX = {};
11586
11432
  XLSX.version = "0.18.5";
@@ -32082,45 +31928,217 @@ function useExportdata() {
32082
31928
  };
32083
31929
  }
32084
31930
 
32085
- // src/table/index.tsx
32086
- var import_jsx_runtime13 = require("react/jsx-runtime");
32087
- function Table(props) {
32088
- const [mapedData, setMapedData] = (0, import_react26.useState)([]);
32089
- const isArray = Array.isArray(props.data);
31931
+ // src/table/h.tsx
31932
+ var import_jsx_runtime12 = require("react/jsx-runtime");
31933
+ function HTable(_a) {
31934
+ var _b = _a, {
31935
+ data,
31936
+ symbols,
31937
+ totals,
31938
+ exportName,
31939
+ onSave
31940
+ } = _b, props = __objRest(_b, [
31941
+ "data",
31942
+ "symbols",
31943
+ "totals",
31944
+ "exportName",
31945
+ "onSave"
31946
+ ]);
31947
+ if (!Array.isArray(data)) return null;
31948
+ const [mapedData, setMapedData] = (0, import_react25.useState)([...data]);
32090
31949
  const exported = useExportdata();
32091
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "bg-gray-200 border rounded shadow p-1", children: [
32092
- (props == null ? void 0 : props.exportName) && props.data.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
32093
- "button",
32094
- {
32095
- className: "p-2 border rounded shadow bg-green-800 text-white flex gap-1",
32096
- onClick: (e) => exported.export(
32097
- mapedData.map((md) => {
32098
- const _a = md, { __visible__ } = _a, newMd = __objRest(_a, ["__visible__"]);
32099
- for (let i of Object.keys(newMd)) {
32100
- newMd[i] = newMd[i].content;
32101
- }
32102
- return newMd;
32103
- }),
32104
- props.exportName
32105
- ),
32106
- children: [
32107
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ExcelIcon, {}),
32108
- " Exportar"
32109
- ]
31950
+ const [selected, setSelected] = (0, import_react25.useState)(null);
31951
+ const [selectedFilter, setSelectedFilter] = (0, import_react25.useState)(null);
31952
+ const modalRef = (0, import_react25.useRef)(null);
31953
+ const head = (0, import_react25.useMemo)(() => {
31954
+ return [...new Set(data.map((d) => Object.keys(d)).flat())];
31955
+ }, [data]);
31956
+ const mapedTotals = (0, import_react25.useMemo)(() => {
31957
+ return mapedData == null ? void 0 : mapedData.reduce((acc, md) => {
31958
+ head.forEach((h) => {
31959
+ var _a2, _b2;
31960
+ const value = isNaN(+((_a2 = md[h]) == null ? void 0 : _a2.content)) ? 0 : +((_b2 = md[h]) == null ? void 0 : _b2.content);
31961
+ if (acc[h]) {
31962
+ acc[h] += value;
31963
+ } else {
31964
+ acc[h] = value;
31965
+ }
31966
+ });
31967
+ return acc;
31968
+ }, {});
31969
+ }, [mapedData]);
31970
+ (0, import_react25.useEffect)(() => {
31971
+ setMapedData(data);
31972
+ }, [data]);
31973
+ (0, import_react25.useEffect)(() => {
31974
+ const newData = data.map((d, trkey) => {
31975
+ var _a2, _b2;
31976
+ const obj = {};
31977
+ for (let key in d) {
31978
+ const item = {};
31979
+ for (let key2 in d) {
31980
+ item[key2] = ((_a2 = d[key2]) == null ? void 0 : _a2.content) || d[key2];
31981
+ }
31982
+ const typeOf = typeof d[key];
31983
+ const isObject2 = typeOf == "object";
31984
+ const isDate = typeOf == "string" && d[key].toString().includes("T");
31985
+ const cellTypeOf = isDate ? "date" : isObject2 ? "object" : typeOf;
31986
+ const content = cellTypeOf == "date" ? d[key].split("T").join(" ").split(".")[0] : cellTypeOf == "object" ? import_react25.default.isValidElement(d[key]) ? ((_b2 = d[key]) == null ? void 0 : _b2.props).defaultValue : JSON.stringify(d[key]) : d[key];
31987
+ const handler = import_react25.default.isValidElement(d[key]) ? d[key] : null;
31988
+ obj[key] = {
31989
+ index: trkey,
31990
+ originalData: content,
31991
+ cellTypeOf,
31992
+ title: content,
31993
+ content,
31994
+ name: key,
31995
+ exclude: false,
31996
+ handler
31997
+ };
32110
31998
  }
32111
- ) }),
32112
- isArray ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
32113
- HTable,
32114
- __spreadValues({}, __spreadProps(__spreadValues({}, props), {
32115
- mapedData,
32116
- setMapedData
32117
- }))
32118
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: " p-5 border rounded shadow bg-yellw-500", children: "No es un array" })
31999
+ return obj;
32000
+ });
32001
+ setMapedData(newData);
32002
+ }, [data]);
32003
+ const values = (0, import_react25.useMemo)(() => {
32004
+ return mapedData.map((d) => Object.keys(d).map((k) => ({ [k]: d[k].content }))).map((d) => Object.assign({}, ...d));
32005
+ }, [mapedData]);
32006
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
32007
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex gap-2", children: [
32008
+ onSave && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
32009
+ "button",
32010
+ {
32011
+ className: "p-2 border rounded shadow bg-blue-800 text-white flex gap-1",
32012
+ onClick: (e) => {
32013
+ onSave({ data: values });
32014
+ },
32015
+ children: [
32016
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SaveIcon, {}),
32017
+ " Guardar"
32018
+ ]
32019
+ }
32020
+ ),
32021
+ exportName && mapedData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
32022
+ "button",
32023
+ {
32024
+ className: "p-2 border rounded shadow bg-green-800 text-white flex gap-1",
32025
+ onClick: (e) => exported.export(values, exportName),
32026
+ children: [
32027
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExcelIcon, {}),
32028
+ " Exportar"
32029
+ ]
32030
+ }
32031
+ ) })
32032
+ ] }),
32033
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", __spreadProps(__spreadValues({}, props), { className: "w-full border-collapse table-auto", children: [
32034
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("thead", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { children: head.map((h, key) => {
32035
+ var _a2;
32036
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
32037
+ "th",
32038
+ {
32039
+ className: "whitespace-nowrap overflow-hidden text-ellipsis max-w-[200px] border-b p-2",
32040
+ children: [
32041
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32042
+ "div",
32043
+ {
32044
+ className: "cursor-pointer flex ",
32045
+ onClick: (e) => {
32046
+ setSelectedFilter(key == selectedFilter ? null : key);
32047
+ },
32048
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-white w-full bg-black rounded flex justify-center", children: [
32049
+ h,
32050
+ " ",
32051
+ !((_a2 = mapedData == null ? void 0 : mapedData.map((d) => {
32052
+ var _a3;
32053
+ return (_a3 = d[h]) == null ? void 0 : _a3.exclude;
32054
+ })) == null ? void 0 : _a2.every((d) => d === false)) && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-red-300", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FilterOffIcon, {}) })
32055
+ ] })
32056
+ }
32057
+ ),
32058
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32059
+ FilterMenu,
32060
+ {
32061
+ h,
32062
+ mapedData,
32063
+ setMapedData,
32064
+ index: key,
32065
+ selectedFilter,
32066
+ setSelectedFilter
32067
+ }
32068
+ )
32069
+ ]
32070
+ },
32071
+ h
32072
+ );
32073
+ }) }) }),
32074
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tbody", { className: "divide-y divide-gray-200", children: mapedData.map((md, trKey) => {
32075
+ var _a2;
32076
+ const color2 = trKey % 2 == 0 ? "bg-white" : "bg-gray-100";
32077
+ for (let d in md) {
32078
+ if (md[d].exclude === true) {
32079
+ return null;
32080
+ }
32081
+ }
32082
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32083
+ "tr",
32084
+ {
32085
+ onDoubleClick: (e) => {
32086
+ var _a3;
32087
+ (_a3 = modalRef.current) == null ? void 0 : _a3.showModal();
32088
+ },
32089
+ onClick: (e) => setSelected(trKey),
32090
+ className: [
32091
+ "hover:bg-green-100 ",
32092
+ color2,
32093
+ selected == trKey && "bg-green-200 hover:bg-green-300"
32094
+ ].join(" "),
32095
+ children: head.map((h, tdKey) => {
32096
+ var _a3;
32097
+ const item = md[h];
32098
+ const id3 = trKey + "-" + (((_a3 = md == null ? void 0 : md.id) == null ? void 0 : _a3.content) || tdKey) + "-" + h;
32099
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32100
+ TD,
32101
+ {
32102
+ index: trKey,
32103
+ symbols,
32104
+ item,
32105
+ color: color2,
32106
+ mapedData,
32107
+ setMapedData
32108
+ },
32109
+ id3
32110
+ );
32111
+ })
32112
+ },
32113
+ ((_a2 = md == null ? void 0 : md.id) == null ? void 0 : _a2.content) || trKey
32114
+ );
32115
+ }) }),
32116
+ totals && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tfoot", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("tr", { children: head.map((h, fkey) => {
32117
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
32118
+ "th",
32119
+ {
32120
+ className: "text-right border-b max-w-[200px] p-2 ",
32121
+ children: totals.includes(h) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex justify-between text-white w-full bg-black rounded ", children: [
32122
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-1", children: symbols && symbols[h] && symbols[h] }),
32123
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "p-1", children: mapedTotals[h] })
32124
+ ] })
32125
+ },
32126
+ fkey
32127
+ );
32128
+ }) }) })
32129
+ ] }))
32119
32130
  ] });
32120
32131
  }
32121
32132
 
32133
+ // src/table/index.tsx
32134
+ var import_jsx_runtime13 = require("react/jsx-runtime");
32135
+ function Table(_a) {
32136
+ var props = __objRest(_a, []);
32137
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "bg-gray-200 border rounded shadow p-1", children: Array.isArray(props.data) ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HTable, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: " p-5 border rounded shadow bg-yellw-500", children: "No es un array" }) });
32138
+ }
32139
+
32122
32140
  // src/text-area/index.tsx
32123
- var import_react27 = require("react");
32141
+ var import_react26 = require("react");
32124
32142
  var import_jsx_runtime14 = require("react/jsx-runtime");
32125
32143
  function TextArea(_a) {
32126
32144
  var _b = _a, {
@@ -32136,7 +32154,7 @@ function TextArea(_a) {
32136
32154
  "onChange",
32137
32155
  "children"
32138
32156
  ]);
32139
- const [value, setValue] = (0, import_react27.useState)(children);
32157
+ const [value, setValue] = (0, import_react26.useState)(children);
32140
32158
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "flex flex-col gap-1", children: [
32141
32159
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "font-bold ", children: label }),
32142
32160
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
@@ -32166,12 +32184,12 @@ function TextArea(_a) {
32166
32184
  }
32167
32185
 
32168
32186
  // src/use-resources/index.ts
32169
- var import_react29 = require("react");
32187
+ var import_react28 = require("react");
32170
32188
 
32171
32189
  // src/use-resources/get.token.tsx
32172
- var import_react28 = require("react");
32190
+ var import_react27 = require("react");
32173
32191
  function useToken() {
32174
- const token = (0, import_react28.useMemo)(() => {
32192
+ const token = (0, import_react27.useMemo)(() => {
32175
32193
  if (typeof window != "undefined") {
32176
32194
  const t = window.localStorage.getItem("token");
32177
32195
  if (t) return t;
@@ -32264,8 +32282,8 @@ function useResources({
32264
32282
  onError
32265
32283
  }) {
32266
32284
  const token = useToken();
32267
- const [info, setInfo] = (0, import_react29.useState)({});
32268
- const result = (0, import_react29.useMemo)(() => {
32285
+ const [info, setInfo] = (0, import_react28.useState)({});
32286
+ const result = (0, import_react28.useMemo)(() => {
32269
32287
  var _c, _d, _e, _f, _g, _h, _i;
32270
32288
  const r = {};
32271
32289
  for (const key in endpoints) {
@@ -32500,7 +32518,7 @@ function useResources({
32500
32518
  }
32501
32519
  return r;
32502
32520
  }, [info, token, endpoints]);
32503
- (0, import_react29.useEffect)(() => {
32521
+ (0, import_react28.useEffect)(() => {
32504
32522
  var _a, _b;
32505
32523
  for (let item in result) {
32506
32524
  if ((_a = result[item]) == null ? void 0 : _a.id) {
@@ -32514,7 +32532,7 @@ function useResources({
32514
32532
  }
32515
32533
 
32516
32534
  // src/select/index.tsx
32517
- var import_react30 = __toESM(require("react"));
32535
+ var import_react29 = __toESM(require("react"));
32518
32536
 
32519
32537
  // src/select/icon.tsx
32520
32538
  var import_jsx_runtime15 = require("react/jsx-runtime");
@@ -32566,21 +32584,21 @@ function Select(_a) {
32566
32584
  "children",
32567
32585
  "strictMode"
32568
32586
  ]);
32569
- const [isOpen, setIsOpen] = (0, import_react30.useState)(false);
32570
- const [inputValue, setInputValue] = (0, import_react30.useState)((props == null ? void 0 : props.value) || "");
32571
- const [options, setOptions] = (0, import_react30.useState)(
32587
+ const [isOpen, setIsOpen] = (0, import_react29.useState)(false);
32588
+ const [inputValue, setInputValue] = (0, import_react29.useState)((props == null ? void 0 : props.value) || "");
32589
+ const [options, setOptions] = (0, import_react29.useState)(
32572
32590
  []
32573
32591
  );
32574
- const [filtered, setFiltered] = (0, import_react30.useState)(
32592
+ const [filtered, setFiltered] = (0, import_react29.useState)(
32575
32593
  []
32576
32594
  );
32577
- const [highlightedIndex, setHighlightedIndex] = (0, import_react30.useState)(-1);
32578
- const inputRef = (0, import_react30.useRef)(null);
32595
+ const [highlightedIndex, setHighlightedIndex] = (0, import_react29.useState)(-1);
32596
+ const inputRef = (0, import_react29.useRef)(null);
32579
32597
  const validOption = (value) => {
32580
32598
  return options.find((opt) => opt.label == value);
32581
32599
  };
32582
- (0, import_react30.useEffect)(() => {
32583
- const parsedOptions = import_react30.default.Children.toArray(children).filter((child) => {
32600
+ (0, import_react29.useEffect)(() => {
32601
+ const parsedOptions = import_react29.default.Children.toArray(children).filter((child) => {
32584
32602
  return child.type === "option";
32585
32603
  }).map((child) => {
32586
32604
  const el = child;
@@ -32592,7 +32610,7 @@ function Select(_a) {
32592
32610
  setOptions(parsedOptions);
32593
32611
  setFiltered(parsedOptions);
32594
32612
  }, [children]);
32595
- (0, import_react30.useEffect)(() => {
32613
+ (0, import_react29.useEffect)(() => {
32596
32614
  setFiltered(
32597
32615
  options.filter(
32598
32616
  (opt) => {
@@ -32621,9 +32639,9 @@ function Select(_a) {
32621
32639
  setInputValue(opt.label);
32622
32640
  setIsOpen(false);
32623
32641
  };
32624
- const containerRef = (0, import_react30.useRef)(null);
32625
- const [openUpwards, setOpenUpwards] = (0, import_react30.useState)(false);
32626
- (0, import_react30.useEffect)(() => {
32642
+ const containerRef = (0, import_react29.useRef)(null);
32643
+ const [openUpwards, setOpenUpwards] = (0, import_react29.useState)(false);
32644
+ (0, import_react29.useEffect)(() => {
32627
32645
  if (isOpen && containerRef.current) {
32628
32646
  const rect = containerRef.current.getBoundingClientRect();
32629
32647
  const spaceBelow = window.innerHeight - rect.bottom;
@@ -32739,10 +32757,10 @@ function Select(_a) {
32739
32757
  }
32740
32758
 
32741
32759
  // src/modal/index.tsx
32742
- var import_react31 = __toESM(require("react"));
32760
+ var import_react30 = __toESM(require("react"));
32743
32761
  var import_jsx_runtime18 = require("react/jsx-runtime");
32744
32762
  function Modal({ button, children, ref }) {
32745
- const modalRef = ref || (0, import_react31.useRef)(null);
32763
+ const modalRef = ref || (0, import_react30.useRef)(null);
32746
32764
  function show() {
32747
32765
  var _a;
32748
32766
  typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.showModal());
@@ -32752,9 +32770,9 @@ function Modal({ button, children, ref }) {
32752
32770
  typeof modalRef == "object" && ((_a = modalRef.current) == null ? void 0 : _a.close());
32753
32771
  }
32754
32772
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
32755
- import_react31.default.Children.map(button, (child) => {
32756
- if (import_react31.default.isValidElement(child)) {
32757
- return import_react31.default.cloneElement(child, {
32773
+ import_react30.default.Children.map(button, (child) => {
32774
+ if (import_react30.default.isValidElement(child)) {
32775
+ return import_react30.default.cloneElement(child, {
32758
32776
  onClick: (e) => {
32759
32777
  var _a, _b;
32760
32778
  show();
@@ -32773,9 +32791,9 @@ function Modal({ button, children, ref }) {
32773
32791
  children: "X"
32774
32792
  }
32775
32793
  ),
32776
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-3 pt-6", children: import_react31.default.Children.map(children, (child) => {
32777
- if (import_react31.default.isValidElement(child)) {
32778
- return import_react31.default.cloneElement(child, { hide });
32794
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col gap-3 pt-6", children: import_react30.default.Children.map(children, (child) => {
32795
+ if (import_react30.default.isValidElement(child)) {
32796
+ return import_react30.default.cloneElement(child, { hide });
32779
32797
  }
32780
32798
  return child;
32781
32799
  }) })