next-recomponents 2.0.43 → 2.0.45

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
@@ -37185,14 +37185,15 @@ function usePopup() {
37185
37185
  );
37186
37186
  const close = (0, import_react10.useCallback)(
37187
37187
  async (confirmed, value) => {
37188
- var _a, _b;
37188
+ var _a, _b, _c;
37189
37189
  const prev = { ...popup };
37190
37190
  let visible = false;
37191
37191
  if (confirmed) {
37192
37192
  (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
37193
- } else if (prev == null ? void 0 : prev.onCancel) {
37194
- visible = !Boolean(await ((_b = prev.onCancel) == null ? void 0 : _b.call(prev)));
37193
+ } else if (prev == null ? void 0 : prev.onClose) {
37194
+ visible = !Boolean(await ((_b = prev.onClose) == null ? void 0 : _b.call(prev)));
37195
37195
  } else {
37196
+ (_c = prev.onCancel) == null ? void 0 : _c.call(prev);
37196
37197
  visible = false;
37197
37198
  }
37198
37199
  const data = { ...prev, visible, inputValue: "" };
@@ -37218,10 +37219,9 @@ function usePopup() {
37218
37219
  type: "modal",
37219
37220
  message,
37220
37221
  color,
37221
- // onConfirm: () => {
37222
- // resolve();
37223
- // },
37224
- onCancel: onClose ? async () => {
37222
+ onConfirm: () => resolve(),
37223
+ onCancel: () => resolve(),
37224
+ onClose: onClose ? async () => {
37225
37225
  return await (onClose == null ? void 0 : onClose());
37226
37226
  } : void 0,
37227
37227
  icons,
@@ -38770,10 +38770,10 @@ function Header({
38770
38770
  "div",
38771
38771
  {
38772
38772
  ref: cellRef,
38773
- className: "break-words border text-center relative ",
38773
+ className: "shadow ",
38774
38774
  style: { zIndex: 10, height: `${padding}px`, maxHeight: "100px" },
38775
38775
  children: [
38776
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-5 items-center justify-between h-full cursor-pointer", children: [
38776
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between items-center ", children: [
38777
38777
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex gap-2", children: [
38778
38778
  hasFilter ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
38779
38779
  "div",
@@ -38801,7 +38801,8 @@ function Header({
38801
38801
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
38802
38802
  "div",
38803
38803
  {
38804
- className: "w-full",
38804
+ className: "font-bold flex truncate text-xs items-center ",
38805
+ style: { height: `${padding}px` },
38805
38806
  onClick: (e) => {
38806
38807
  context.setSort({
38807
38808
  [header]: "TOGGLE"
@@ -39153,10 +39154,14 @@ function HTable({
39153
39154
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
39154
39155
  "div",
39155
39156
  {
39156
- className: [context.className, "bg-white relative"].join(" "),
39157
+ className: [
39158
+ context.className,
39159
+ "bg-white relative",
39160
+ "p-2 border shadow rounded-2xl"
39161
+ ].join(" "),
39157
39162
  ref: tableRef,
39158
39163
  children: [
39159
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "bg-white px-1 font-bold", children: context.header }),
39164
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "bg-white px-1 font-bold rounded-full", children: context.header }),
39160
39165
  /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "bg-white flex gap-2 items-center", children: [
39161
39166
  context.searchable && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Searchable, { context }),
39162
39167
  context.exportName && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
@@ -39165,8 +39170,13 @@ function HTable({
39165
39170
  onClick: (e) => {
39166
39171
  context.excel.export(
39167
39172
  context.data.map((d) => {
39168
- const { __select__, __modal__, ...datums } = d;
39169
- return datums;
39173
+ const obj = {};
39174
+ for (let key in d) {
39175
+ if (!key.startsWith("_")) {
39176
+ obj[key] = d[key];
39177
+ }
39178
+ }
39179
+ return obj;
39170
39180
  })
39171
39181
  );
39172
39182
  },
@@ -39220,8 +39230,7 @@ function HTable({
39220
39230
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
39221
39231
  "div",
39222
39232
  {
39223
- className: "bg-white",
39224
- style: { position: "relative" },
39233
+ className: "bg-white relative w-full bg-red-100",
39225
39234
  children: [
39226
39235
  /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
39227
39236
  Header,
@@ -39257,7 +39266,7 @@ function HTable({
39257
39266
  searchedData.map((row, rowIndex) => {
39258
39267
  const items = Object.entries(row);
39259
39268
  return items.map(([key, item], i) => {
39260
- var _a, _b, _c, _d, _e, _f, _g;
39269
+ var _a, _b, _c, _d, _e;
39261
39270
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, key)) return null;
39262
39271
  if (key.startsWith("_") && !key.startsWith("__")) return null;
39263
39272
  if (key == "__modal__") {
@@ -39352,7 +39361,10 @@ function HTable({
39352
39361
  children: ((_e = (_d = context.buttons[key]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) ? item : null,
39353
39362
  onClick: async (e) => {
39354
39363
  var _a2, _b2;
39355
- const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, e)) || {};
39364
+ const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, {
39365
+ e,
39366
+ row
39367
+ })) || {};
39356
39368
  const newData = [...context.data];
39357
39369
  const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
39358
39370
  newData[index] = { ...newData[index], ...ret };
@@ -39361,7 +39373,10 @@ function HTable({
39361
39373
  onChange: async (e) => {
39362
39374
  var _a2, _b2, _c2;
39363
39375
  const value = e.target.value;
39364
- const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, e)) || {};
39376
+ const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, {
39377
+ e,
39378
+ row
39379
+ })) || {};
39365
39380
  const newData = [...context.data];
39366
39381
  const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
39367
39382
  if (index >= 0) {
@@ -39374,8 +39389,7 @@ function HTable({
39374
39389
  }
39375
39390
  }
39376
39391
  context.setData(newData);
39377
- },
39378
- className: `${(_g = (_f = context.buttons[key]) == null ? void 0 : _f.props) == null ? void 0 : _g.className} text-xs w-full`
39392
+ }
39379
39393
  }) : ["number", "string"].includes(typeof item) ? valueFormatter({
39380
39394
  value: item,
39381
39395
  currentCoin: context.currentCoin
package/dist/index.mjs CHANGED
@@ -37170,14 +37170,15 @@ function usePopup() {
37170
37170
  );
37171
37171
  const close = useCallback(
37172
37172
  async (confirmed, value) => {
37173
- var _a, _b;
37173
+ var _a, _b, _c;
37174
37174
  const prev = { ...popup };
37175
37175
  let visible = false;
37176
37176
  if (confirmed) {
37177
37177
  (_a = prev.onConfirm) == null ? void 0 : _a.call(prev, value);
37178
- } else if (prev == null ? void 0 : prev.onCancel) {
37179
- visible = !Boolean(await ((_b = prev.onCancel) == null ? void 0 : _b.call(prev)));
37178
+ } else if (prev == null ? void 0 : prev.onClose) {
37179
+ visible = !Boolean(await ((_b = prev.onClose) == null ? void 0 : _b.call(prev)));
37180
37180
  } else {
37181
+ (_c = prev.onCancel) == null ? void 0 : _c.call(prev);
37181
37182
  visible = false;
37182
37183
  }
37183
37184
  const data = { ...prev, visible, inputValue: "" };
@@ -37203,10 +37204,9 @@ function usePopup() {
37203
37204
  type: "modal",
37204
37205
  message,
37205
37206
  color,
37206
- // onConfirm: () => {
37207
- // resolve();
37208
- // },
37209
- onCancel: onClose ? async () => {
37207
+ onConfirm: () => resolve(),
37208
+ onCancel: () => resolve(),
37209
+ onClose: onClose ? async () => {
37210
37210
  return await (onClose == null ? void 0 : onClose());
37211
37211
  } : void 0,
37212
37212
  icons,
@@ -38768,10 +38768,10 @@ function Header({
38768
38768
  "div",
38769
38769
  {
38770
38770
  ref: cellRef,
38771
- className: "break-words border text-center relative ",
38771
+ className: "shadow ",
38772
38772
  style: { zIndex: 10, height: `${padding}px`, maxHeight: "100px" },
38773
38773
  children: [
38774
- /* @__PURE__ */ jsxs23("div", { className: "flex gap-5 items-center justify-between h-full cursor-pointer", children: [
38774
+ /* @__PURE__ */ jsxs23("div", { className: "flex justify-between items-center ", children: [
38775
38775
  /* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
38776
38776
  hasFilter ? /* @__PURE__ */ jsx31(
38777
38777
  "div",
@@ -38799,7 +38799,8 @@ function Header({
38799
38799
  /* @__PURE__ */ jsx31(
38800
38800
  "div",
38801
38801
  {
38802
- className: "w-full",
38802
+ className: "font-bold flex truncate text-xs items-center ",
38803
+ style: { height: `${padding}px` },
38803
38804
  onClick: (e) => {
38804
38805
  context.setSort({
38805
38806
  [header]: "TOGGLE"
@@ -39151,10 +39152,14 @@ function HTable({
39151
39152
  return /* @__PURE__ */ jsxs25(
39152
39153
  "div",
39153
39154
  {
39154
- className: [context.className, "bg-white relative"].join(" "),
39155
+ className: [
39156
+ context.className,
39157
+ "bg-white relative",
39158
+ "p-2 border shadow rounded-2xl"
39159
+ ].join(" "),
39155
39160
  ref: tableRef,
39156
39161
  children: [
39157
- /* @__PURE__ */ jsx33("div", { className: "bg-white px-1 font-bold", children: context.header }),
39162
+ /* @__PURE__ */ jsx33("div", { className: "bg-white px-1 font-bold rounded-full", children: context.header }),
39158
39163
  /* @__PURE__ */ jsxs25("div", { className: "bg-white flex gap-2 items-center", children: [
39159
39164
  context.searchable && /* @__PURE__ */ jsx33(Searchable, { context }),
39160
39165
  context.exportName && /* @__PURE__ */ jsxs25(
@@ -39163,8 +39168,13 @@ function HTable({
39163
39168
  onClick: (e) => {
39164
39169
  context.excel.export(
39165
39170
  context.data.map((d) => {
39166
- const { __select__, __modal__, ...datums } = d;
39167
- return datums;
39171
+ const obj = {};
39172
+ for (let key in d) {
39173
+ if (!key.startsWith("_")) {
39174
+ obj[key] = d[key];
39175
+ }
39176
+ }
39177
+ return obj;
39168
39178
  })
39169
39179
  );
39170
39180
  },
@@ -39218,8 +39228,7 @@ function HTable({
39218
39228
  return /* @__PURE__ */ jsxs25(
39219
39229
  "div",
39220
39230
  {
39221
- className: "bg-white",
39222
- style: { position: "relative" },
39231
+ className: "bg-white relative w-full bg-red-100",
39223
39232
  children: [
39224
39233
  /* @__PURE__ */ jsx33(
39225
39234
  Header,
@@ -39255,7 +39264,7 @@ function HTable({
39255
39264
  searchedData.map((row, rowIndex) => {
39256
39265
  const items = Object.entries(row);
39257
39266
  return items.map(([key, item], i) => {
39258
- var _a, _b, _c, _d, _e, _f, _g;
39267
+ var _a, _b, _c, _d, _e;
39259
39268
  if ((_b = (_a = context == null ? void 0 : context.hideColumns) == null ? void 0 : _a.includes) == null ? void 0 : _b.call(_a, key)) return null;
39260
39269
  if (key.startsWith("_") && !key.startsWith("__")) return null;
39261
39270
  if (key == "__modal__") {
@@ -39350,7 +39359,10 @@ function HTable({
39350
39359
  children: ((_e = (_d = context.buttons[key]) == null ? void 0 : _d.props) == null ? void 0 : _e.children) ? item : null,
39351
39360
  onClick: async (e) => {
39352
39361
  var _a2, _b2;
39353
- const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, e)) || {};
39362
+ const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onClick) == null ? void 0 : _b2.call(_a2, {
39363
+ e,
39364
+ row
39365
+ })) || {};
39354
39366
  const newData = [...context.data];
39355
39367
  const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
39356
39368
  newData[index] = { ...newData[index], ...ret };
@@ -39359,7 +39371,10 @@ function HTable({
39359
39371
  onChange: async (e) => {
39360
39372
  var _a2, _b2, _c2;
39361
39373
  const value = e.target.value;
39362
- const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, e)) || {};
39374
+ const ret = await ((_b2 = (_a2 = context.buttons[key].props) == null ? void 0 : _a2.onChange) == null ? void 0 : _b2.call(_a2, {
39375
+ e,
39376
+ row
39377
+ })) || {};
39363
39378
  const newData = [...context.data];
39364
39379
  const index = newData.findIndex((f) => f.id == (row == null ? void 0 : row.id));
39365
39380
  if (index >= 0) {
@@ -39372,8 +39387,7 @@ function HTable({
39372
39387
  }
39373
39388
  }
39374
39389
  context.setData(newData);
39375
- },
39376
- className: `${(_g = (_f = context.buttons[key]) == null ? void 0 : _f.props) == null ? void 0 : _g.className} text-xs w-full`
39390
+ }
39377
39391
  }) : ["number", "string"].includes(typeof item) ? valueFormatter({
39378
39392
  value: item,
39379
39393
  currentCoin: context.currentCoin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.43",
3
+ "version": "2.0.45",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/pop/index.tsx CHANGED
@@ -24,6 +24,7 @@ export default function usePopup() {
24
24
  const open = useCallback(
25
25
  (partial: Omit<PopupState, "visible" | "inputValue">) => {
26
26
  const { message, ...rest } = partial;
27
+
27
28
  messageRef.current = message as any;
28
29
  setPopup({ ...rest, visible: true, inputValue: "" });
29
30
  },
@@ -36,9 +37,10 @@ export default function usePopup() {
36
37
  let visible = false;
37
38
  if (confirmed) {
38
39
  prev.onConfirm?.(value);
39
- } else if (prev?.onCancel) {
40
- visible = !Boolean(await prev.onCancel?.());
40
+ } else if (prev?.onClose) {
41
+ visible = !Boolean(await prev.onClose?.());
41
42
  } else {
43
+ prev.onCancel?.();
42
44
  visible = false;
43
45
  }
44
46
 
@@ -76,10 +78,9 @@ export default function usePopup() {
76
78
  type: "modal",
77
79
  message,
78
80
  color,
79
- // onConfirm: () => {
80
- // resolve();
81
- // },
82
- onCancel: onClose
81
+ onConfirm: () => resolve(),
82
+ onCancel: () => resolve(),
83
+ onClose: onClose
83
84
  ? async () => {
84
85
  return await onClose?.();
85
86
  }
package/src/pop/types.ts CHANGED
@@ -41,6 +41,7 @@ export interface PopupState {
41
41
  color: PopupColor;
42
42
  onConfirm?: (value?: string) => void;
43
43
  onCancel?: () => void | Promise<boolean | void>;
44
+ onClose?: () => void | Promise<boolean | void>;
44
45
  icons?: boolean;
45
46
  full?: boolean;
46
47
  }
@@ -153,10 +153,16 @@ export default function HTable({
153
153
  });
154
154
  return (
155
155
  <div
156
- className={[context.className, "bg-white relative"].join(" ")}
156
+ className={[
157
+ context.className,
158
+ "bg-white relative",
159
+ "p-2 border shadow rounded-2xl",
160
+ ].join(" ")}
157
161
  ref={tableRef}
158
162
  >
159
- <div className="bg-white px-1 font-bold">{context.header}</div>
163
+ <div className="bg-white px-1 font-bold rounded-full">
164
+ {context.header}
165
+ </div>
160
166
  <div className="bg-white flex gap-2 items-center">
161
167
  {context.searchable && <Searchable context={context} />}
162
168
  {context.exportName && (
@@ -164,8 +170,14 @@ export default function HTable({
164
170
  onClick={(e) => {
165
171
  context.excel.export(
166
172
  context.data.map((d) => {
167
- const { __select__, __modal__, ...datums } = d;
168
- return datums;
173
+ const obj: any = {};
174
+
175
+ for (let key in d) {
176
+ if (!key.startsWith("_")) {
177
+ obj[key] = d[key];
178
+ }
179
+ }
180
+ return obj;
169
181
  }),
170
182
  );
171
183
  }}
@@ -228,8 +240,8 @@ export default function HTable({
228
240
  return (
229
241
  <div
230
242
  key={header}
231
- className="bg-white"
232
- style={{ position: "relative" }}
243
+ className="bg-white relative w-full bg-red-100"
244
+ // style={{ position: "relative" }}
233
245
  >
234
246
  <Header
235
247
  padding={padding}
@@ -405,7 +417,10 @@ export default function HTable({
405
417
  : null,
406
418
  onClick: async (e: any) => {
407
419
  const ret =
408
- (await context.buttons[key].props?.onClick?.(e)) || {};
420
+ (await context.buttons[key].props?.onClick?.({
421
+ e,
422
+ row,
423
+ })) || {};
409
424
  const newData = [...context.data];
410
425
  const index = newData.findIndex((f) => f.id == row?.id);
411
426
  newData[index] = { ...newData[index], ...ret };
@@ -414,7 +429,10 @@ export default function HTable({
414
429
  onChange: async (e: { target: { value: string } }) => {
415
430
  const value = e.target.value;
416
431
  const ret =
417
- (await context.buttons[key].props?.onChange?.(e)) || {};
432
+ (await context.buttons[key].props?.onChange?.({
433
+ e,
434
+ row,
435
+ })) || {};
418
436
 
419
437
  const newData = [...context.data];
420
438
  const index = newData.findIndex((f) => f.id == row?.id);
@@ -432,7 +450,6 @@ export default function HTable({
432
450
 
433
451
  context.setData(newData);
434
452
  },
435
- className: `${context.buttons[key]?.props?.className} text-xs w-full`,
436
453
  })
437
454
  ) : ["number", "string"].includes(typeof item) ? (
438
455
  valueFormatter({
@@ -121,10 +121,10 @@ export function Header({
121
121
  <div className="">
122
122
  <div
123
123
  ref={cellRef}
124
- className={"break-words border text-center relative "}
124
+ className={"shadow "}
125
125
  style={{ zIndex: 10, height: `${padding}px`, maxHeight: "100px" }}
126
126
  >
127
- <div className="flex gap-5 items-center justify-between h-full cursor-pointer">
127
+ <div className="flex justify-between items-center ">
128
128
  <div className="flex gap-2">
129
129
  {hasFilter ? (
130
130
  <div
@@ -158,7 +158,8 @@ export function Header({
158
158
  </div>
159
159
  </div>
160
160
  <div
161
- className="w-full"
161
+ className="font-bold flex truncate text-xs items-center "
162
+ style={{ height: `${padding}px` }}
162
163
  onClick={(e) => {
163
164
  context.setSort({
164
165
  [header]: "TOGGLE",