next-recomponents 1.5.99 → 1.6.2

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.mjs CHANGED
@@ -11132,25 +11132,25 @@ function TD(_a) {
11132
11132
  "mapedData",
11133
11133
  "setMapedData"
11134
11134
  ]);
11135
- var _a2, _b2;
11135
+ var _a2, _b2, _c;
11136
11136
  const [isHidded, setIsHidded] = useState4(false);
11137
- const newProps = symbols && React3.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(
11137
+ const newProps = symbols && React3.isValidElement(symbols[item == null ? void 0 : item.name]) && ((_c = Object.keys((_a2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _a2.props)) == null ? void 0 : _c.reduce(
11138
11138
  (acc, i) => {
11139
11139
  try {
11140
11140
  const newAcc = __spreadValues({}, acc);
11141
11141
  const hasEvent = `${i}`.startsWith("on");
11142
11142
  if (hasEvent) {
11143
- newAcc[i] = (e) => {
11143
+ newAcc[i] = (e) => __async(null, null, function* () {
11144
11144
  var _a3, _b3;
11145
11145
  e.item = item;
11146
- (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
11147
- };
11146
+ yield (_b3 = (_a3 = symbols[item == null ? void 0 : item.name].props)[i]) == null ? void 0 : _b3.call(_a3, e);
11147
+ });
11148
11148
  }
11149
11149
  return newAcc;
11150
11150
  } catch (error) {
11151
11151
  }
11152
11152
  },
11153
- { defaultValue: item == null ? void 0 : item.content }
11153
+ __spreadValues({}, (_b2 = symbols[item == null ? void 0 : item.name]) == null ? void 0 : _b2.props)
11154
11154
  ));
11155
11155
  return /* @__PURE__ */ jsx8(
11156
11156
  "td",
@@ -11165,7 +11165,8 @@ function TD(_a) {
11165
11165
  children: /* @__PURE__ */ jsxs6("div", { className: symbols && symbols[item == null ? void 0 : item.name] && "flex justify-between", children: [
11166
11166
  symbols && /* @__PURE__ */ jsx8("div", { children: React3.Children.map(symbols[item == null ? void 0 : item.name], (child) => {
11167
11167
  if (React3.isValidElement(child)) {
11168
- return React3.cloneElement(child, __spreadValues({}, newProps));
11168
+ const { type, props: props2 } = child;
11169
+ return React3.createElement(type, __spreadValues({}, newProps));
11169
11170
  }
11170
11171
  return child;
11171
11172
  }) }),
@@ -32073,6 +32074,7 @@ function HTable(_a) {
32073
32074
  return null;
32074
32075
  }
32075
32076
  }
32077
+ const dataKey = ((_b2 = md == null ? void 0 : md.id) == null ? void 0 : _b2.content) || trKey;
32076
32078
  return /* @__PURE__ */ jsx11(
32077
32079
  "tr",
32078
32080
  {
@@ -32080,6 +32082,7 @@ function HTable(_a) {
32080
32082
  var _a3;
32081
32083
  (_a3 = modalRef.current) == null ? void 0 : _a3.showModal();
32082
32084
  },
32085
+ "data-key": dataKey,
32083
32086
  onClick: (e) => setSelected(trKey),
32084
32087
  className: [
32085
32088
  "hover:bg-green-100 ",
@@ -32104,7 +32107,7 @@ function HTable(_a) {
32104
32107
  );
32105
32108
  })
32106
32109
  },
32107
- ((_b2 = md == null ? void 0 : md.id) == null ? void 0 : _b2.content) || trKey
32110
+ dataKey
32108
32111
  );
32109
32112
  }) }),
32110
32113
  totals && /* @__PURE__ */ jsx11("tfoot", { className: "bg-gray-800 text-white", children: /* @__PURE__ */ jsx11("tr", { children: head.map((h, fkey) => {
@@ -32285,178 +32288,67 @@ function useResources({
32285
32288
  [key]: {
32286
32289
  loaded: false,
32287
32290
  id: (_a = endpoints[key]) == null ? void 0 : _a.id,
32288
- defaultParams: (_b = endpoints[key]) == null ? void 0 : _b.defaultParams
32291
+ defaultParams: (_b = endpoints[key]) == null ? void 0 : _b.defaultParams,
32292
+ data: [],
32293
+ selectedItem: {}
32289
32294
  }
32290
32295
  });
32291
32296
  return newAcc;
32292
32297
  }, {})
32293
32298
  );
32294
- const results = Object.keys(endpoints).reduce((acc, key) => {
32295
- var _c, _d, _e, _f, _g, _h, _i;
32296
- const endpoint = endpoints[key];
32297
- const showFunc = (_a, autoLoad = false) => __async(null, null, function* () {
32298
- var _b = _a, { limit = 10, page = 1, merge = true } = _b, query = __objRest(_b, ["limit", "page", "merge"]);
32299
- const options = {
32300
- method: "GET",
32301
- url: `${baseURI}/${key}`,
32302
- params: __spreadValues({ limit, page }, query),
32303
- headers: { Authorization: token }
32304
- };
32305
- const newInfo = __spreadValues({}, info);
32306
- newInfo[key] = newInfo[key] || {};
32307
- newInfo[key].state = "loading";
32308
- newInfo[key].errorMessage = "";
32309
- newInfo[key].params = query;
32310
- newInfo[key].loaded = true;
32311
- setInfo(newInfo);
32312
- try {
32313
- const consulta = yield axios.request(options);
32314
- const d = consulta.data;
32315
- newInfo[key].state = "success";
32316
- newInfo[key].errorMessage = "";
32317
- newInfo[key].data = merge ? page == 1 ? d.data : [...d.data, ...newInfo[key].data || []] : d.data;
32318
- newInfo[key].totalItems = d.totalItems;
32319
- newInfo[key].totalPages = d.totalPages;
32320
- newInfo[key].currentPage = d.currentPage;
32321
- setInfo(__spreadValues({}, newInfo));
32322
- return d.data;
32323
- } catch (error) {
32324
- const item = http_codes_default.find((s) => s.code == error.status);
32325
- newInfo[key].state = "error";
32326
- newInfo[key].errorMessage = item == null ? void 0 : item.meaning;
32327
- if (error.status == 403) {
32328
- onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32329
- }
32330
- setInfo(__spreadValues({}, newInfo));
32331
- return error;
32332
- }
32333
- });
32334
- const findFunc = (id3, query, autoLoad = false) => __async(null, null, function* () {
32335
- var _a, _b, _c2;
32336
- const options = {
32337
- method: "GET",
32338
- url: `${baseURI}/${key}/${id3}`,
32339
- params: __spreadValues({}, query),
32340
- headers: { Authorization: token }
32341
- };
32342
- const newInfo = __spreadValues({}, info);
32343
- newInfo[key] = newInfo[key] || {};
32344
- newInfo[key].state = "loading";
32345
- newInfo[key].errorMessage = "";
32346
- newInfo[key].params = query;
32347
- newInfo[key].loaded = true;
32348
- setInfo(newInfo);
32349
- try {
32350
- const consulta = yield axios.request(options);
32351
- const d = consulta.data;
32352
- newInfo[key].state = "success";
32353
- newInfo[key].errorMessage = "";
32354
- if (autoLoad) {
32355
- } else {
32356
- newInfo[key].selectedItem = d;
32357
- const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32358
- (d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
32359
- );
32360
- if (index >= 0) {
32361
- newInfo[key].data[index] = d;
32362
- } else {
32363
- if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
32364
- newInfo[key].data.unshift(d);
32365
- } else {
32366
- newInfo[key].data = [d];
32367
- }
32368
- }
32369
- }
32370
- setInfo(__spreadValues({}, newInfo));
32371
- return d;
32372
- } catch (error) {
32373
- const item = http_codes_default.find((s) => s.code == error.status);
32374
- newInfo[key].state = "error";
32375
- newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32376
- if (error.status == 403) {
32377
- onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32378
- }
32379
- setInfo(__spreadValues({}, newInfo));
32380
- return error;
32381
- }
32382
- });
32383
- acc[key] = __spreadProps(__spreadValues({}, endpoint), {
32384
- loaded: false,
32385
- show: showFunc,
32386
- find: findFunc,
32387
- create: (data) => __async(null, null, function* () {
32388
- var _a, _b, _c2, _d2, _e2, _f2;
32299
+ const results = Object.keys(endpoints).reduce(
32300
+ (acc, key) => {
32301
+ var _c, _d, _e, _f, _g, _h, _i;
32302
+ const endpoint = endpoints[key];
32303
+ const showFunc = (_a, autoLoad = false) => __async(null, null, function* () {
32304
+ var _b = _a, { limit = 10, page = 1, merge = true } = _b, query = __objRest(_b, ["limit", "page", "merge"]);
32389
32305
  const options = {
32390
- method: "POST",
32306
+ method: "GET",
32391
32307
  url: `${baseURI}/${key}`,
32392
- data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
32308
+ params: __spreadValues({ limit, page }, query),
32393
32309
  headers: { Authorization: token }
32394
32310
  };
32395
32311
  const newInfo = __spreadValues({}, info);
32396
- newInfo[key] = newInfo[key] || {};
32397
32312
  newInfo[key].state = "loading";
32398
32313
  newInfo[key].errorMessage = "";
32314
+ newInfo[key].params = query;
32315
+ newInfo[key].loaded = true;
32399
32316
  setInfo(newInfo);
32400
32317
  try {
32401
32318
  const consulta = yield axios.request(options);
32402
32319
  const d = consulta.data;
32403
32320
  newInfo[key].state = "success";
32404
32321
  newInfo[key].errorMessage = "";
32405
- if (Array.isArray(data)) {
32406
- for (let datum of data) {
32407
- const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32408
- (d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
32409
- );
32410
- if (index >= 0) {
32411
- newInfo[key].data[index] = d;
32412
- } else {
32413
- if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
32414
- newInfo[key].data.unshift(d);
32415
- } else {
32416
- newInfo[key].data = [d];
32417
- }
32418
- }
32419
- }
32420
- } else {
32421
- newInfo[key].selectedItem = d;
32422
- const index = (_e2 = (_d2 = newInfo[key]) == null ? void 0 : _d2.data) == null ? void 0 : _e2.findIndex(
32423
- (d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
32424
- );
32425
- if (index >= 0) {
32426
- newInfo[key].data[index] = d;
32427
- } else {
32428
- if ((_f2 = newInfo[key]) == null ? void 0 : _f2.data) {
32429
- newInfo[key].data.unshift(d);
32430
- } else {
32431
- newInfo[key].data = [d];
32432
- }
32433
- }
32434
- }
32322
+ newInfo[key].data = merge ? page == 1 ? d.data : [...d.data, ...newInfo[key].data || []] : d.data;
32323
+ newInfo[key].totalItems = d.totalItems;
32324
+ newInfo[key].totalPages = d.totalPages;
32325
+ newInfo[key].currentPage = d.currentPage;
32435
32326
  setInfo(__spreadValues({}, newInfo));
32436
- return d;
32327
+ return d.data;
32437
32328
  } catch (error) {
32438
32329
  const item = http_codes_default.find((s) => s.code == error.status);
32439
32330
  newInfo[key].state = "error";
32440
- newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32331
+ newInfo[key].errorMessage = item == null ? void 0 : item.meaning;
32441
32332
  if (error.status == 403) {
32442
32333
  onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32443
32334
  }
32444
32335
  setInfo(__spreadValues({}, newInfo));
32445
32336
  return error;
32446
32337
  }
32447
- }),
32448
- update: (id3, data) => __async(null, null, function* () {
32449
- var _a, _b, _c2;
32338
+ });
32339
+ const findFunc = (id3, query) => __async(null, null, function* () {
32340
+ var _a, _b, _c2, _d2;
32450
32341
  const options = {
32451
- method: "PATCH",
32342
+ method: "GET",
32452
32343
  url: `${baseURI}/${key}/${id3}`,
32453
- data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
32344
+ params: __spreadValues({}, query),
32454
32345
  headers: { Authorization: token }
32455
32346
  };
32456
32347
  const newInfo = __spreadValues({}, info);
32457
- newInfo[key] = newInfo[key] || {};
32458
32348
  newInfo[key].state = "loading";
32459
32349
  newInfo[key].errorMessage = "";
32350
+ newInfo[key].params = query;
32351
+ newInfo[key].loaded = true;
32460
32352
  setInfo(newInfo);
32461
32353
  try {
32462
32354
  const consulta = yield axios.request(options);
@@ -32464,13 +32356,12 @@ function useResources({
32464
32356
  newInfo[key].state = "success";
32465
32357
  newInfo[key].errorMessage = "";
32466
32358
  newInfo[key].selectedItem = d;
32467
- const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32468
- (d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
32469
- );
32359
+ const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex((d2) => (d2 == null ? void 0 : d2.id) == id3);
32360
+ console.log("index", index, (_c2 = newInfo[key]) == null ? void 0 : _c2.data);
32470
32361
  if (index >= 0) {
32471
32362
  newInfo[key].data[index] = d;
32472
32363
  } else {
32473
- if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
32364
+ if ((_d2 = newInfo[key]) == null ? void 0 : _d2.data) {
32474
32365
  newInfo[key].data.unshift(d);
32475
32366
  } else {
32476
32367
  newInfo[key].data = [d];
@@ -32488,62 +32379,171 @@ function useResources({
32488
32379
  setInfo(__spreadValues({}, newInfo));
32489
32380
  return error;
32490
32381
  }
32491
- }),
32492
- remove: (id3) => __async(null, null, function* () {
32493
- var _a, _b;
32494
- const options = {
32495
- method: "DELETE",
32496
- url: `${baseURI}/${key}/${id3}`,
32497
- headers: { Authorization: token }
32498
- };
32499
- const newInfo = __spreadValues({}, info);
32500
- newInfo[key] = newInfo[key] || {};
32501
- newInfo[key].state = "loading";
32502
- newInfo[key].errorMessage = "";
32503
- setInfo(newInfo);
32504
- try {
32505
- const consulta = yield axios.request(options);
32506
- const d = consulta.data;
32507
- newInfo[key].state = "success";
32382
+ });
32383
+ acc[key] = __spreadProps(__spreadValues({}, endpoint), {
32384
+ loaded: false,
32385
+ show: showFunc,
32386
+ find: findFunc,
32387
+ create: (data) => __async(null, null, function* () {
32388
+ var _a, _b, _c2, _d2, _e2, _f2;
32389
+ const options = {
32390
+ method: "POST",
32391
+ url: `${baseURI}/${key}`,
32392
+ data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
32393
+ headers: { Authorization: token }
32394
+ };
32395
+ const newInfo = __spreadValues({}, info);
32396
+ newInfo[key].state = "loading";
32508
32397
  newInfo[key].errorMessage = "";
32509
- newInfo[key].selectedItem = d;
32510
- const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32511
- (d2) => (d2 == null ? void 0 : d2.id) == (d2 == null ? void 0 : d2.id)
32512
- );
32513
- if (index >= 0) {
32514
- newInfo[key].data.splice(index, 1);
32398
+ setInfo(newInfo);
32399
+ try {
32400
+ const consulta = yield axios.request(options);
32401
+ const d = consulta.data;
32402
+ newInfo[key].state = "success";
32403
+ newInfo[key].errorMessage = "";
32404
+ if (Array.isArray(data)) {
32405
+ for (let datum of data) {
32406
+ const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32407
+ (d2) => (d2 == null ? void 0 : d2.id) == (datum == null ? void 0 : datum.id)
32408
+ );
32409
+ if (index >= 0) {
32410
+ newInfo[key].data[index] = d;
32411
+ } else {
32412
+ if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
32413
+ newInfo[key].data.unshift(d);
32414
+ } else {
32415
+ newInfo[key].data = [d];
32416
+ }
32417
+ }
32418
+ }
32419
+ newInfo[key].data = newInfo[key].data.flat();
32420
+ } else {
32421
+ newInfo[key].selectedItem = d;
32422
+ const index = (_e2 = (_d2 = newInfo[key]) == null ? void 0 : _d2.data) == null ? void 0 : _e2.findIndex(
32423
+ (d2) => (d2 == null ? void 0 : d2.id) == (data == null ? void 0 : data.id)
32424
+ );
32425
+ if (index >= 0) {
32426
+ newInfo[key].data[index] = d;
32427
+ } else {
32428
+ if ((_f2 = newInfo[key]) == null ? void 0 : _f2.data) {
32429
+ newInfo[key].data.unshift(d);
32430
+ } else {
32431
+ newInfo[key].data = [d];
32432
+ }
32433
+ }
32434
+ }
32435
+ setInfo(__spreadValues({}, newInfo));
32436
+ return d;
32437
+ } catch (error) {
32438
+ const item = http_codes_default.find((s) => s.code == error.status);
32439
+ newInfo[key].state = "error";
32440
+ newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32441
+ if (error.status == 403) {
32442
+ onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32443
+ }
32444
+ setInfo(__spreadValues({}, newInfo));
32445
+ return error;
32515
32446
  }
32516
- setInfo(__spreadValues({}, newInfo));
32517
- return d.data;
32518
- } catch (error) {
32519
- const item = http_codes_default.find((s) => s.code == error.status);
32520
- newInfo[key].state = "error";
32521
- newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32522
- if (error.status == 403) {
32523
- onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32447
+ }),
32448
+ update: (id3, data) => __async(null, null, function* () {
32449
+ var _a, _b, _c2;
32450
+ const options = {
32451
+ method: "PATCH",
32452
+ url: `${baseURI}/${key}/${id3}`,
32453
+ data: Array.isArray(data) ? [...data] : __spreadValues({}, data),
32454
+ headers: { Authorization: token }
32455
+ };
32456
+ const newInfo = __spreadValues({}, info);
32457
+ newInfo[key].state = "loading";
32458
+ newInfo[key].errorMessage = "";
32459
+ setInfo(newInfo);
32460
+ try {
32461
+ const consulta = yield axios.request(options);
32462
+ const d = consulta.data;
32463
+ newInfo[key].state = "success";
32464
+ newInfo[key].errorMessage = "";
32465
+ newInfo[key].selectedItem = d;
32466
+ const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32467
+ (d2) => (d2 == null ? void 0 : d2.id) == id3
32468
+ );
32469
+ if (index >= 0) {
32470
+ newInfo[key].data[index] = d;
32471
+ } else {
32472
+ if ((_c2 = newInfo[key]) == null ? void 0 : _c2.data) {
32473
+ newInfo[key].data.unshift(d);
32474
+ } else {
32475
+ newInfo[key].data = [d];
32476
+ }
32477
+ }
32478
+ setInfo(__spreadValues({}, newInfo));
32479
+ return d;
32480
+ } catch (error) {
32481
+ const item = http_codes_default.find((s) => s.code == error.status);
32482
+ newInfo[key].state = "error";
32483
+ newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32484
+ if (error.status == 403) {
32485
+ onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32486
+ }
32487
+ setInfo(__spreadValues({}, newInfo));
32488
+ return error;
32524
32489
  }
32525
- setInfo(__spreadValues({}, newInfo));
32526
- return error;
32527
- }
32528
- }),
32529
- totalPages: (_c = info[key]) == null ? void 0 : _c.totalPages,
32530
- currentPage: (_d = info[key]) == null ? void 0 : _d.currentPage,
32531
- state: ((_e = info[key]) == null ? void 0 : _e.state) || "success",
32532
- errorMessage: (_f = info[key]) == null ? void 0 : _f.errorMessage,
32533
- params: (_g = info[key]) == null ? void 0 : _g.params,
32534
- setLoaded: () => {
32535
- const newInfo = __spreadValues({}, info);
32536
- newInfo[key].loaded = true;
32537
- setInfo(newInfo);
32538
- },
32539
- getAllPages: (limit = 10) => __async(null, null, function* () {
32540
- console.log("Not aviable");
32541
- }),
32542
- data: ((_h = info[key]) == null ? void 0 : _h.data) || [],
32543
- selectedItem: ((_i = info[key]) == null ? void 0 : _i.selectedItem) || {}
32544
- });
32545
- return acc;
32546
- }, {});
32490
+ }),
32491
+ remove: (id3) => __async(null, null, function* () {
32492
+ var _a, _b;
32493
+ const options = {
32494
+ method: "DELETE",
32495
+ url: `${baseURI}/${key}/${id3}`,
32496
+ headers: { Authorization: token }
32497
+ };
32498
+ const newInfo = __spreadValues({}, info);
32499
+ newInfo[key].state = "loading";
32500
+ newInfo[key].errorMessage = "";
32501
+ setInfo(newInfo);
32502
+ try {
32503
+ const consulta = yield axios.request(options);
32504
+ const d = consulta.data;
32505
+ newInfo[key].state = "success";
32506
+ newInfo[key].errorMessage = "";
32507
+ newInfo[key].selectedItem = d;
32508
+ const index = (_b = (_a = newInfo[key]) == null ? void 0 : _a.data) == null ? void 0 : _b.findIndex(
32509
+ (d2) => (d2 == null ? void 0 : d2.id) == id3
32510
+ );
32511
+ if (index >= 0) {
32512
+ newInfo[key].data.splice(index, 1);
32513
+ }
32514
+ setInfo(__spreadValues({}, newInfo));
32515
+ return d.data;
32516
+ } catch (error) {
32517
+ const item = http_codes_default.find((s) => s.code == error.status);
32518
+ newInfo[key].state = "error";
32519
+ newInfo[key].errorMessage = (item == null ? void 0 : item.meaning) || error.message;
32520
+ if (error.status == 403) {
32521
+ onError == null ? void 0 : onError(__spreadValues({ error }, { errorMessage: item == null ? void 0 : item.meaning }));
32522
+ }
32523
+ setInfo(__spreadValues({}, newInfo));
32524
+ return error;
32525
+ }
32526
+ }),
32527
+ totalPages: (_c = info[key]) == null ? void 0 : _c.totalPages,
32528
+ currentPage: (_d = info[key]) == null ? void 0 : _d.currentPage,
32529
+ state: ((_e = info[key]) == null ? void 0 : _e.state) || "success",
32530
+ errorMessage: (_f = info[key]) == null ? void 0 : _f.errorMessage,
32531
+ params: (_g = info[key]) == null ? void 0 : _g.params,
32532
+ setLoaded: () => {
32533
+ const newInfo = __spreadValues({}, info);
32534
+ newInfo[key].loaded = true;
32535
+ setInfo(newInfo);
32536
+ },
32537
+ getAllPages: (limit = 10) => __async(null, null, function* () {
32538
+ console.log("Not aviable");
32539
+ }),
32540
+ data: ((_h = info[key]) == null ? void 0 : _h.data) || [],
32541
+ selectedItem: ((_i = info[key]) == null ? void 0 : _i.selectedItem) || {}
32542
+ });
32543
+ return acc;
32544
+ },
32545
+ {}
32546
+ );
32547
32547
  function doSome() {
32548
32548
  return __async(this, null, function* () {
32549
32549
  var _a, _b, _c, _d, _e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "1.5.99",
3
+ "version": "1.6.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/table/h.tsx CHANGED
@@ -159,13 +159,14 @@ export default function HTable({
159
159
  return null;
160
160
  }
161
161
  }
162
-
162
+ const dataKey = md?.id?.content || trKey;
163
163
  return (
164
164
  <tr
165
165
  onDoubleClick={(e) => {
166
166
  modalRef.current?.showModal();
167
167
  }}
168
- key={md?.id?.content || trKey}
168
+ data-key={dataKey}
169
+ key={dataKey}
169
170
  onClick={(e) => setSelected(trKey)}
170
171
  className={[
171
172
  "hover:bg-green-100 ",
package/src/table/td.tsx CHANGED
@@ -37,15 +37,15 @@ export default function TD({
37
37
  const newAcc = { ...acc };
38
38
  const hasEvent = `${i}`.startsWith("on");
39
39
  if (hasEvent) {
40
- newAcc[i] = (e: any) => {
40
+ newAcc[i] = async (e: any) => {
41
41
  e.item = item;
42
- symbols[item?.name].props[i]?.(e);
42
+ await symbols[item?.name].props[i]?.(e);
43
43
  };
44
44
  }
45
45
  return newAcc;
46
46
  } catch (error) {}
47
47
  },
48
- { defaultValue: item?.content }
48
+ { ...symbols[item?.name]?.props }
49
49
  );
50
50
 
51
51
  return (
@@ -64,7 +64,8 @@ export default function TD({
64
64
  <div>
65
65
  {React.Children.map(symbols[item?.name], (child) => {
66
66
  if (React.isValidElement(child)) {
67
- return React.cloneElement(child, {
67
+ const { type, props } = child;
68
+ return React.createElement(type, {
68
69
  ...newProps,
69
70
  });
70
71
  }