next-recomponents 2.0.5 → 2.0.7

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
@@ -35780,7 +35780,7 @@ function ModalDialog({ open, onClose, modal, selectedRow }) {
35780
35780
  ) }),
35781
35781
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mt-4 m-auto p-5", children: selectedRow && import_react4.default.cloneElement(
35782
35782
  modal,
35783
- { row: selectedRow }
35783
+ { row: selectedRow, hide: onClose }
35784
35784
  ) })
35785
35785
  ] });
35786
35786
  }
@@ -35842,12 +35842,12 @@ function useColumns(rows, options) {
35842
35842
  return import_react4.default.cloneElement(buttons[key], {
35843
35843
  className: `${(_a2 = params == null ? void 0 : params.className) != null ? _a2 : ""} m-auto text-xs`,
35844
35844
  children: (_b = params == null ? void 0 : params.row) == null ? void 0 : _b[key],
35845
- onClick: (e) => {
35845
+ onClick: async (e) => {
35846
35846
  var _a3, _b2;
35847
35847
  e.row = params == null ? void 0 : params.row;
35848
35848
  if ((_b2 = (_a3 = buttons[key]) == null ? void 0 : _a3.props) == null ? void 0 : _b2.onClick) {
35849
- const newVal = buttons[key].props.onClick(e);
35850
- if (newVal) handleRowUpdate(newVal);
35849
+ const newVal = await buttons[key].props.onClick(e);
35850
+ if (newVal) handleRowUpdate({ ...e.row, newVal });
35851
35851
  }
35852
35852
  }
35853
35853
  });
package/dist/index.mjs CHANGED
@@ -35760,7 +35760,7 @@ function ModalDialog({ open, onClose, modal, selectedRow }) {
35760
35760
  ) }),
35761
35761
  /* @__PURE__ */ jsx6("div", { className: "mt-4 m-auto p-5", children: selectedRow && React3.cloneElement(
35762
35762
  modal,
35763
- { row: selectedRow }
35763
+ { row: selectedRow, hide: onClose }
35764
35764
  ) })
35765
35765
  ] });
35766
35766
  }
@@ -35822,12 +35822,12 @@ function useColumns(rows, options) {
35822
35822
  return React3.cloneElement(buttons[key], {
35823
35823
  className: `${(_a2 = params == null ? void 0 : params.className) != null ? _a2 : ""} m-auto text-xs`,
35824
35824
  children: (_b = params == null ? void 0 : params.row) == null ? void 0 : _b[key],
35825
- onClick: (e) => {
35825
+ onClick: async (e) => {
35826
35826
  var _a3, _b2;
35827
35827
  e.row = params == null ? void 0 : params.row;
35828
35828
  if ((_b2 = (_a3 = buttons[key]) == null ? void 0 : _a3.props) == null ? void 0 : _b2.onClick) {
35829
- const newVal = buttons[key].props.onClick(e);
35830
- if (newVal) handleRowUpdate(newVal);
35829
+ const newVal = await buttons[key].props.onClick(e);
35830
+ if (newVal) handleRowUpdate({ ...e.row, newVal });
35831
35831
  }
35832
35832
  }
35833
35833
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-recomponents",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "description nueva",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -173,7 +173,7 @@ function ModalDialog({ open, onClose, modal, selectedRow }: ModalDialogProps) {
173
173
  {selectedRow &&
174
174
  React.cloneElement(
175
175
  modal as React.ReactElement,
176
- { row: selectedRow } as any,
176
+ { row: selectedRow, hide: onClose } as any,
177
177
  )}
178
178
  </div>
179
179
  </Dialog>
@@ -275,11 +275,12 @@ function useColumns(
275
275
  React.cloneElement(buttons[key], {
276
276
  className: `${params?.className ?? ""} m-auto text-xs`,
277
277
  children: params?.row?.[key],
278
- onClick: (e: any) => {
278
+ onClick: async (e: TableButtonProps) => {
279
279
  e.row = params?.row;
280
280
  if (buttons[key]?.props?.onClick) {
281
- const newVal = buttons[key].props.onClick(e);
282
- if (newVal) handleRowUpdate(newVal);
281
+ const newVal = await buttons[key].props.onClick(e);
282
+
283
+ if (newVal) handleRowUpdate({ ...e.row, newVal });
283
284
  }
284
285
  },
285
286
  })