@gisce/react-ooui 1.1.65 → 1.1.66

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.
@@ -669,78 +669,88 @@ const Button = (e) => {
669
669
  }
670
670
  b();
671
671
  }
672
- return /* @__PURE__ */ jsx(Field$1, {
673
- ooui: new Field$2({
674
- ooui: t
675
- }),
676
- children: /* @__PURE__ */ jsxs(Dropdown.Button, {
677
- disabled: !s || h,
678
- onClick: C,
679
- icon: /* @__PURE__ */ jsx(DownOutlined, {}),
680
- type: d ? "primary" : void 0,
681
- overlay: Items({
682
- ooui: n
672
+ if (t.buttons.length === 0)
673
+ return null;
674
+ if (t.buttons.length > 1)
675
+ return /* @__PURE__ */ jsx(Field$1, {
676
+ ooui: new Field$2({
677
+ ooui: t
683
678
  }),
684
- children: [x(), o]
685
- })
686
- });
679
+ children: /* @__PURE__ */ jsxs(Dropdown.Button, {
680
+ disabled: !s || h,
681
+ onClick: C,
682
+ icon: /* @__PURE__ */ jsx(DownOutlined, {}),
683
+ type: d ? "primary" : void 0,
684
+ overlay: /* @__PURE__ */ jsx(Items, {
685
+ ooui: n,
686
+ executeButtonAction: y,
687
+ lang: g
688
+ }),
689
+ children: [x(), o]
690
+ })
691
+ });
692
+ if (r)
693
+ return /* @__PURE__ */ jsx(Button, {
694
+ ooui: r
695
+ });
687
696
  }, Items = (e) => {
688
697
  const {
689
- ooui: t
690
- } = e, r = t.map((n) => {
698
+ ooui: t,
699
+ executeButtonAction: r,
700
+ lang: n
701
+ } = e;
702
+ if (!t)
703
+ return null;
704
+ const a = t.map((o) => {
691
705
  const {
692
- id: a,
693
- caption: o,
694
- activated: s,
695
- buttonType: u,
696
- confirmMessage: l,
697
- icon: c,
698
- context: d,
699
- readOnly: f,
700
- danger: p
701
- } = n, h = useContext(FormContext$1), {
702
- executeButtonAction: v
703
- } = h || {}, [y, _] = useState(!1), {
704
- lang: m
705
- } = useContext(LocaleContext);
706
- async function g() {
707
- _(!0), await v({
708
- type: u,
709
- action: a,
710
- context: d
706
+ id: s,
707
+ caption: u,
708
+ activated: l,
709
+ buttonType: c,
710
+ confirmMessage: d,
711
+ icon: f,
712
+ context: p,
713
+ readOnly: h,
714
+ danger: v
715
+ } = o, [y, _] = useState(!1);
716
+ async function m() {
717
+ _(!0), await r({
718
+ type: c,
719
+ action: s,
720
+ context: p
711
721
  }), _(!1);
712
722
  }
713
- function x() {
714
- if (l) {
723
+ function g() {
724
+ if (d) {
715
725
  showDialog$9({
716
- confirmMessage: l,
717
- lang: m,
726
+ confirmMessage: d,
727
+ lang: n,
718
728
  onOk: () => {
719
- g();
729
+ m();
720
730
  }
721
731
  });
722
732
  return;
723
733
  }
724
- g();
734
+ m();
725
735
  }
726
- function b() {
736
+ function x() {
727
737
  if (y)
728
738
  return /* @__PURE__ */ jsx(LoadingOutlined$3, {});
729
- if (c) {
730
- const C = iconMapper(c);
731
- return C && /* @__PURE__ */ jsx(C, {});
739
+ if (f) {
740
+ const b = iconMapper(f);
741
+ return b && /* @__PURE__ */ jsx(b, {});
732
742
  }
733
743
  }
734
744
  return /* @__PURE__ */ jsx(Menu.Item, {
735
- disabled: !s || f,
736
- onClick: x,
737
- icon: b(),
738
- danger: p,
739
- children: o
745
+ disabled: !l || h,
746
+ onClick: g,
747
+ icon: x(),
748
+ danger: v,
749
+ children: u
740
750
  });
741
751
  });
742
752
  return /* @__PURE__ */ jsx(Menu, {
743
- children: r
753
+ children: a
744
754
  });
745
755
  }, Config = {
746
756
  requiredClass: "bg-blue-100",