@oliasoft-open-source/react-ui-library 5.8.8-beta-2 → 5.8.9-beta-1

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.
Files changed (2) hide show
  1. package/dist/index.js +78 -82
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3632,25 +3632,24 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
3632
3632
  })
3633
3633
  }), document.body)]
3634
3634
  }) : t({});
3635
- }, TableVirtualScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3636
- let r = useRef(null), i = useVirtualizer({
3635
+ }, TableVirtualScrollWrapper = ({ table: e, children: t }) => {
3636
+ let n = useRef(null), r = useVirtualizer({
3637
3637
  count: e?.rowCount ?? e.rows?.length ?? 0,
3638
- getScrollElement: () => r.current,
3638
+ getScrollElement: () => n.current,
3639
3639
  estimateSize: () => 31,
3640
3640
  overscan: 10
3641
3641
  });
3642
3642
  return /* @__PURE__ */ jsx("div", {
3643
3643
  id: "scrollWrapper",
3644
3644
  className: cx(table_module_default.scroll, table_module_default.virtualScroll),
3645
- ref: r,
3646
- children: n({
3647
- virtualizer: i,
3645
+ ref: n,
3646
+ children: t({
3647
+ virtualizer: r,
3648
3648
  tableStyle: (() => {
3649
- let e = t.current?.clientHeight ?? 0, n = i.getTotalSize() + e, r = i.getVirtualItems(), a = r.length > 0 ? r[0].start : 0, o = r.length > 0 ? i.getTotalSize() - r[r.length - 1].end : 0;
3649
+ let e = r.getVirtualItems(), t = e.length > 0 ? e[0].start : 0, n = e.length > 0 ? r.getTotalSize() - e[e.length - 1].end : 0;
3650
3650
  return {
3651
- "--virtualPaddingTop": a + "px",
3652
- "--virtualPaddingBottom": o + "px",
3653
- height: n
3651
+ "--virtualPaddingTop": t + "px",
3652
+ "--virtualPaddingBottom": n + "px"
3654
3653
  };
3655
3654
  })()
3656
3655
  })
@@ -3676,32 +3675,31 @@ var ScrollToActiveRow = ({ activeIndex: e, triggerScrollToActiveRow: t, isVirtua
3676
3675
  n,
3677
3676
  r
3678
3677
  ]), null);
3679
- const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3680
- let { infiniteScroll: r = !1, triggerScrollToActiveRow: i = !1, rows: a } = e, o = useMemo(() => typeof e.activeRowIndex == "number" ? e.activeRowIndex : Array.isArray(a) && a.length ? a.findIndex((e) => e && e.active) : -1, [a, e.activeRowIndex]);
3681
- return r ? /* @__PURE__ */ jsx(TableVirtualScrollWrapper, {
3678
+ const TableScrollWrapper = ({ table: e, children: t }) => {
3679
+ let { infiniteScroll: n = !1, triggerScrollToActiveRow: r = !1, rows: i } = e, a = useMemo(() => typeof e.activeRowIndex == "number" ? e.activeRowIndex : Array.isArray(i) && i.length ? i.findIndex((e) => e && e.active) : -1, [i, e.activeRowIndex]);
3680
+ return n ? /* @__PURE__ */ jsx(TableVirtualScrollWrapper, {
3682
3681
  table: e,
3683
- theadRef: t,
3684
- children: ({ virtualizer: e, tableStyle: t }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ScrollToActiveRow, {
3682
+ children: ({ virtualizer: e, tableStyle: n }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ScrollToActiveRow, {
3685
3683
  isVirtualized: !0,
3686
3684
  virtualizer: e,
3687
- activeIndex: o,
3688
- triggerScrollToActiveRow: i
3689
- }), n({
3685
+ activeIndex: a,
3686
+ triggerScrollToActiveRow: r
3687
+ }), t({
3690
3688
  virtualizer: e,
3691
- tableStyle: t
3689
+ tableStyle: n
3692
3690
  })] })
3693
3691
  }) : /* @__PURE__ */ jsxs("div", {
3694
3692
  id: "scrollWrapper",
3695
3693
  className: table_module_default.scroll,
3696
3694
  children: [/* @__PURE__ */ jsx(ScrollToActiveRow, {
3697
3695
  isVirtualized: !1,
3698
- activeIndex: o,
3699
- triggerScrollToActiveRow: i
3700
- }), n({})]
3696
+ activeIndex: a,
3697
+ triggerScrollToActiveRow: r
3698
+ }), t({})]
3701
3699
  });
3702
3700
  }, Table = (e) => {
3703
- let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths: a, footer: o, name: s, rows: c = [], actions: l, actionsRight: u, columnHeaderAlignments: d, columnAlignment: f, striped: m = !0, testId: h, draggable: _, defaultEmptyRow: v = null, onAddRow: y = null, bordered: b = !0, maxHeight: x, fixedWidth: S } = i, C = useRef(null), w = useRef(null), T = get(e, "table.headers", []), E = getColumnCount(c, T), D = hasRowActions(c, T), O = E + (D ? 1 : 0), k = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, A = v?.cells?.length && y && k, j = {
3704
- cells: A ? v.cells.map((e, t) => e?.type === "Input" ? {
3701
+ let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths: a, footer: o, name: s, rows: c = [], actions: l, actionsRight: u, columnHeaderAlignments: d, columnAlignment: f, striped: m = !0, testId: h, draggable: _, defaultEmptyRow: v = null, onAddRow: y = null, bordered: b = !0, maxHeight: x, fixedWidth: S } = i, C = useRef(null), w = get(e, "table.headers", []), T = getColumnCount(c, w), E = hasRowActions(c, w), D = T + (E ? 1 : 0), O = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, k = v?.cells?.length && y && O, A = {
3702
+ cells: k ? v.cells.map((e, t) => e?.type === "Input" ? {
3705
3703
  ...e,
3706
3704
  onChange: (e) => {
3707
3705
  let n = e?.target?.value, r = {
@@ -3718,12 +3716,12 @@ const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3718
3716
  disabled: !0
3719
3717
  }) : null,
3720
3718
  testId: h ? `${h}-last-empty-row` : void 0
3721
- }, M = A ? c.concat(j) : c, N = {
3719
+ }, j = k ? c.concat(A) : c, M = {
3722
3720
  ...i,
3723
- rows: M
3724
- }, P = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
3721
+ rows: j
3722
+ }, N = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
3725
3723
  return /* @__PURE__ */ jsxs("div", {
3726
- className: P,
3724
+ className: N,
3727
3725
  style: {
3728
3726
  maxHeight: x,
3729
3727
  width: S,
@@ -3737,56 +3735,52 @@ const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3737
3735
  testId: h && `${h}-title`
3738
3736
  }),
3739
3737
  /* @__PURE__ */ jsx(TableDragWrapper, {
3740
- colSpan: O,
3738
+ colSpan: D,
3741
3739
  columnAlignment: f,
3742
- columnCount: E,
3740
+ columnCount: T,
3743
3741
  draggable: _,
3744
3742
  onListReorder: t,
3745
- rowActions: D,
3746
- rows: M,
3747
- tbodyRef: w,
3743
+ rowActions: E,
3744
+ rows: j,
3745
+ tbodyRef: C,
3748
3746
  canListReorder: n,
3749
3747
  children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
3750
- table: N,
3751
- theadRef: C,
3748
+ table: M,
3752
3749
  children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsxs("table", {
3753
3750
  className: cx(table_module_default.table, m ? table_module_default.striped : ""),
3754
3751
  "data-testid": h,
3755
3752
  style: n,
3756
- children: [/* @__PURE__ */ jsx("thead", {
3753
+ children: [/* @__PURE__ */ jsx("thead", { children: w.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
3754
+ rowIndex: t,
3755
+ isHeader: !0,
3756
+ row: e,
3757
+ columnCount: T,
3758
+ columnWidths: a,
3759
+ colSpan: D,
3760
+ hasRowActions: E,
3761
+ columnAlignment: f,
3762
+ columnHeaderAlignments: d,
3763
+ draggableTable: _
3764
+ }, `0_${t}`)) }), /* @__PURE__ */ jsx("tbody", {
3757
3765
  ref: C,
3758
- children: T.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
3759
- rowIndex: t,
3760
- isHeader: !0,
3761
- row: e,
3762
- columnCount: E,
3763
- columnWidths: a,
3764
- colSpan: O,
3765
- hasRowActions: D,
3766
- columnAlignment: f,
3767
- columnHeaderAlignments: d,
3768
- draggableTable: _
3769
- }, `0_${t}`))
3770
- }), /* @__PURE__ */ jsx("tbody", {
3771
- ref: w,
3772
3766
  children: t ? t.getVirtualItems().map((t) => {
3773
- let n = t.index, i = M[n], o = r ? r({
3767
+ let n = t.index, i = j[n], o = r ? r({
3774
3768
  row: i,
3775
3769
  rowIndex: n
3776
3770
  }) : i;
3777
3771
  return /* @__PURE__ */ jsx(Row$1, {
3778
3772
  rowIndex: n,
3779
3773
  row: o,
3780
- columnCount: E,
3774
+ columnCount: T,
3781
3775
  columnWidths: a,
3782
- colSpan: O,
3783
- hasRowActions: D,
3776
+ colSpan: D,
3777
+ hasRowActions: E,
3784
3778
  columnAlignment: f,
3785
3779
  draggableTable: _,
3786
3780
  height: t.size,
3787
3781
  dropDisabled: e
3788
3782
  }, `1_${n}`);
3789
- }) : M.map((t, n) => {
3783
+ }) : j.map((t, n) => {
3790
3784
  let i = r ? r({
3791
3785
  row: t,
3792
3786
  rowIndex: n
@@ -3794,10 +3788,10 @@ const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
3794
3788
  return /* @__PURE__ */ jsx(Row$1, {
3795
3789
  rowIndex: n,
3796
3790
  row: i,
3797
- columnCount: E,
3791
+ columnCount: T,
3798
3792
  columnWidths: a,
3799
- colSpan: O,
3800
- hasRowActions: D,
3793
+ colSpan: D,
3794
+ hasRowActions: E,
3801
3795
  columnAlignment: f,
3802
3796
  draggableTable: _,
3803
3797
  dropDisabled: e
@@ -6602,7 +6596,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6602
6596
  } : {
6603
6597
  value: G,
6604
6598
  unit: U
6605
- }), kd = k || K?.value === void 0, [J, Ad] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), jd = !!(O || n), Y = C && C.find((e) => {
6599
+ }), Ad = k || K?.value === void 0, [J, jd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Md = !!(O || n), Y = C && C.find((e) => {
6606
6600
  if (!e?.value) return;
6607
6601
  if (E) return E === e.valueKey;
6608
6602
  let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
@@ -6611,7 +6605,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6611
6605
  toUnit: t
6612
6606
  });
6613
6607
  return withUnit(n, t) === e.value;
6614
- }), Md = () => {
6608
+ }), Nd = () => {
6615
6609
  let e = l ?? "", t = K.unit;
6616
6610
  if (checkConversion({
6617
6611
  value: e,
@@ -6625,7 +6619,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6625
6619
  return null;
6626
6620
  }
6627
6621
  } else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
6628
- }, Nd = (t) => {
6622
+ }, Pd = (t) => {
6629
6623
  let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
6630
6624
  h({ target: {
6631
6625
  value: s,
@@ -6638,7 +6632,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6638
6632
  }), R(() => {
6639
6633
  r.selectionStart = a, r.selectionEnd = a;
6640
6634
  });
6641
- }, Pd = (e, t) => {
6635
+ }, Fd = (e, t) => {
6642
6636
  t === K.unit || isNaN(Number(e)) || (q({
6643
6637
  value: e,
6644
6638
  unit: t
@@ -6669,7 +6663,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6669
6663
  e !== void 0 && q({
6670
6664
  value: e,
6671
6665
  unit: t
6672
- }), C && Ad(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6666
+ }), C && jd(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
6673
6667
  }
6674
6668
  }, [
6675
6669
  U,
@@ -6677,7 +6671,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6677
6671
  i,
6678
6672
  T
6679
6673
  ]);
6680
- let X = Md(), Z = label(K.unit) || K.unit || "", Fd = p || !X || X && X.length === 1, Q = getStringName(e), $, Id = (t) => {
6674
+ let X = Nd(), Z = label(K.unit) || K.unit || "", Id = p || !X || X && X.length === 1, Q = getStringName(e), $, Ld = (t) => {
6681
6675
  let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
6682
6676
  if (checkConversion({
6683
6677
  value: r,
@@ -6697,7 +6691,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6697
6691
  type: MenuType.OPTION,
6698
6692
  inline: !0,
6699
6693
  onClick: () => {
6700
- validateNumber(i).valid && !n && (Ad(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6694
+ validateNumber(i).valid && !n && (jd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
6701
6695
  value: r,
6702
6696
  name: typeof e == "string" ? e : e?.fieldName || "",
6703
6697
  predefinedSelected: !0,
@@ -6724,10 +6718,10 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6724
6718
  label: "Custom",
6725
6719
  selected: J === PredefinedOptionsMenuState.CUSTOM
6726
6720
  }], C?.length) {
6727
- let e = C.map(Id);
6721
+ let e = C.map(Ld);
6728
6722
  $ = [...$, ...e];
6729
6723
  }
6730
- let Ld = (e) => {
6724
+ let Rd = (e) => {
6731
6725
  if (isValueWithUnit(e)) {
6732
6726
  let t = getUnit(e), { value: n } = safeConvertValue({
6733
6727
  value: e,
@@ -6739,7 +6733,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6739
6733
  return n;
6740
6734
  }
6741
6735
  return e;
6742
- }, Rd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, zd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6736
+ }, zd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Bd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
6743
6737
  return /* @__PURE__ */ jsx("div", {
6744
6738
  className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
6745
6739
  children: /* @__PURE__ */ jsxs(InputGroup, {
@@ -6771,31 +6765,31 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6771
6765
  name: Q,
6772
6766
  testId: x,
6773
6767
  disabled: n,
6774
- placeholder: Ld(t),
6768
+ placeholder: Rd(t),
6775
6769
  value: K.value,
6776
- onChange: Nd,
6770
+ onChange: Pd,
6777
6771
  onFocus: v,
6778
6772
  error: i === null ? void 0 : i,
6779
6773
  warning: S === null ? void 0 : S,
6780
6774
  left: a,
6781
- allowEmpty: kd,
6775
+ allowEmpty: Ad,
6782
6776
  validationCallback: (e, t) => D(Q, t),
6783
6777
  enableCosmeticRounding: j,
6784
6778
  enableDisplayRounding: M,
6785
6779
  roundDisplayValue: N,
6786
- groupOrder: Rd,
6787
- disableInternalErrorValidationMessages: jd,
6780
+ groupOrder: zd,
6781
+ disableInternalErrorValidationMessages: Md,
6788
6782
  small: o,
6789
6783
  selectOnFocus: P,
6790
6784
  tooltip: I
6791
6785
  }, Q)
6792
6786
  }),
6793
- Z && (Fd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6794
- groupOrder: zd,
6787
+ Z && (Id || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
6788
+ groupOrder: Bd,
6795
6789
  small: o,
6796
6790
  children: Z
6797
6791
  }) : /* @__PURE__ */ jsx(Menu, {
6798
- groupOrder: zd,
6792
+ groupOrder: Bd,
6799
6793
  maxHeight: 380,
6800
6794
  disabled: r,
6801
6795
  testId: x && `${x}-menu`,
@@ -6811,7 +6805,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
6811
6805
  label: j ? safeRoundNumbers(i) : i,
6812
6806
  inline: !0,
6813
6807
  onClick: (n) => {
6814
- n.stopPropagation(), Pd(e, t);
6808
+ n.stopPropagation(), Fd(e, t);
6815
6809
  },
6816
6810
  description: r,
6817
6811
  selected: r === Z,
@@ -8436,29 +8430,31 @@ const countDeltas = (e) => (Array.isArray(e) ? e : e ? [e] : []).reduce((e, t) =
8436
8430
  if (i) return i;
8437
8431
  }
8438
8432
  return "";
8439
- }, defaultMessage = (e) => {
8433
+ };
8434
+ var toText = (e) => isObject(e) ? "Multiple property changes" : String(e);
8435
+ const defaultMessage = (e) => {
8440
8436
  switch (e.length) {
8441
8437
  case 1: {
8442
8438
  let [t] = e;
8443
8439
  return {
8444
8440
  type: "Created",
8445
8441
  before: "",
8446
- after: String(t)
8442
+ after: toText(t)
8447
8443
  };
8448
8444
  }
8449
8445
  case 2: {
8450
8446
  let [t, n] = e;
8451
8447
  return {
8452
8448
  type: "Modified",
8453
- before: String(t),
8454
- after: String(n)
8449
+ before: toText(t),
8450
+ after: toText(n)
8455
8451
  };
8456
8452
  }
8457
8453
  case 3: {
8458
8454
  let [t] = e;
8459
8455
  return {
8460
8456
  type: "Deleted",
8461
- before: String(t),
8457
+ before: toText(t),
8462
8458
  after: ""
8463
8459
  };
8464
8460
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.8.8-beta-2",
3
+ "version": "5.8.9-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {