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

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 +52 -58
  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
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-1",
3
+ "version": "5.8.8",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {