react-crud-mobile 1.3.541 → 1.3.543

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
@@ -355,7 +355,7 @@ function UIIcon({ scope }) {
355
355
  };
356
356
  let library = import_react_crud_utils4.Utils.nvl(scope.original.library, "ion");
357
357
  let icon = name.trim();
358
- if (icon) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {});
358
+ if (!icon) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, {});
359
359
  if (name.includes(" ")) {
360
360
  let split = name.split(/\s+/);
361
361
  library = split[0];
@@ -411,9 +411,11 @@ function UIButton(props) {
411
411
  let align = import_react_crud_utils5.Utils.nvl(element.align, "center");
412
412
  let variant = import_react_crud_utils5.Utils.nvl(element.variant, "default");
413
413
  let [loaderIndex, setLoaderIndex] = (0, import_react4.useState)(-1);
414
+ let [open, setOpen] = (0, import_react4.useState)(false);
414
415
  let color = element.color;
415
416
  let label = scope.getLabel();
416
417
  let icon = scope.getPart("icon");
418
+ let children = props.children;
417
419
  if (!color) color = "primaryLight";
418
420
  const styles13 = {
419
421
  buttonLabel: {
@@ -439,9 +441,25 @@ function UIButton(props) {
439
441
  justifyContent: "center",
440
442
  alignItems: "center",
441
443
  flexDirection: "row"
444
+ },
445
+ overlay: {
446
+ flex: 1,
447
+ backgroundColor: "rgba(0,0,0,0.5)",
448
+ justifyContent: "center",
449
+ alignItems: "center"
450
+ },
451
+ modal: {
452
+ backgroundColor: "#fff",
453
+ borderRadius: 12,
454
+ padding: 20,
455
+ minWidth: "80%"
442
456
  }
443
457
  };
444
- const onClick = async (e) => {
458
+ const onClick = () => {
459
+ if (children) {
460
+ setOpen(true);
461
+ return;
462
+ }
445
463
  setTimeout(() => {
446
464
  scope.call("click", {});
447
465
  }, 0);
@@ -486,9 +504,7 @@ function UIButton(props) {
486
504
  let css = style("button", def);
487
505
  if (!css.width) {
488
506
  let h = css.height;
489
- if (typeof h === "number") {
490
- css.minWidth = h;
491
- }
507
+ if (typeof h === "number") css.minWidth = h;
492
508
  }
493
509
  return css;
494
510
  });
@@ -498,7 +514,7 @@ function UIButton(props) {
498
514
  css.fontSize = import_react_crud_utils5.Utils.nvl(buttonLabel.fontSize, css.fontSize);
499
515
  return css;
500
516
  });
501
- scope.updaters.loader = (loading) => {
517
+ scope.updaters.loader = () => {
502
518
  setLoaderIndex((i) => i + 1);
503
519
  };
504
520
  let iconSize = import_react_crud_utils5.Utils.nvl(element.iconSize, buttonLabel.fontSize, 15);
@@ -508,21 +524,13 @@ function UIButton(props) {
508
524
  label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.Text, { style: buttonLabel, children: scope.lng("loading", "Aguarde...") })
509
525
  ] }) });
510
526
  }
511
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
512
- import_react_native5.Pressable,
513
- {
514
- onPress: onClick,
515
- style: ({ pressed }) => [
516
- buttonStyle,
517
- pressed && { opacity: 0.5 }
518
- // ⭐ Aqui entra o efeito!
519
- ],
520
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
521
- icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(UI_default.Icon, { size: iconSize, style: iconStyle, value: icon }) }),
522
- label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.Text, { style: buttonLabel, children: label })
523
- ] })
524
- }
525
- );
527
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
528
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.Pressable, { onPress: onClick, style: ({ pressed }) => [buttonStyle, pressed && { opacity: 0.5 }], children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
529
+ icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(UI_default.Icon, { size: iconSize, style: iconStyle, value: icon }),
530
+ label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.Text, { style: buttonLabel, children: label })
531
+ ] }) }),
532
+ children && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.Modal, { visible: open, transparent: true, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.TouchableWithoutFeedback, { onPress: () => setOpen(false), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.View, { style: styles13.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.TouchableWithoutFeedback, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native5.View, { style: styles13.modal, children }) }) }) }) })
533
+ ] });
526
534
  }
527
535
 
528
536
  // src/elements/core/UISelect.tsx
@@ -2084,7 +2092,7 @@ function UIElement(props) {
2084
2092
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, {});
2085
2093
  }
2086
2094
  const isShowChild = () => {
2087
- if (scope.isType("tabs", "view", "grid", "list", "define", "repeat", "modal", "dialog", "chart")) {
2095
+ if (scope.isType("tabs", "view", "grid", "list", "define", "repeat", "modal", "dialog", "chart", "button")) {
2088
2096
  return false;
2089
2097
  }
2090
2098
  return true;