@konstructio/ui 0.1.2-alpha.114 → 0.1.2-alpha.115

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.
@@ -1,7 +1,7 @@
1
1
  import { t } from "../../../../utils-DnIJruo0.js";
2
2
  import { useTableContext as I } from "../../contexts/table.hook.js";
3
3
  import { isPaginationBarVisible as T } from "../../utils/pagination.js";
4
- import { n as q } from "../../../../table.provider-CW1fpZcF.js";
4
+ import { n as q } from "../../../../table.provider-CzfMGbe4.js";
5
5
  import { Skeleton as G } from "../Skeleton/Skeleton.js";
6
6
  import { ExpandableRow as J } from "../ExpandableRow/ExpandableRow.js";
7
7
  import { Fragment as K } from "react";
@@ -1,6 +1,6 @@
1
1
  import { t } from "../../../../utils-DnIJruo0.js";
2
2
  import { useTableContext as g } from "../../contexts/table.hook.js";
3
- import { n as k } from "../../../../table.provider-CW1fpZcF.js";
3
+ import { n as k } from "../../../../table.provider-CzfMGbe4.js";
4
4
  import u from "../../assets/chevron-up.js";
5
5
  import C from "../../assets/chevron-down.js";
6
6
  import { jsx as r, jsxs as o } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  import { t as a } from "../../../../utils-DnIJruo0.js";
2
- import { t as D } from "../../../../table.provider-CW1fpZcF.js";
2
+ import { t as D } from "../../../../table.provider-CzfMGbe4.js";
3
3
  import { Body as rr } from "../Body/Body.js";
4
4
  import { Filter as er } from "../Filter/Filter.js";
5
5
  import { Header as lr } from "../Header/Header.js";
@@ -1,6 +1,6 @@
1
1
  import { TableContext as r } from "./table.context.js";
2
2
  import { useTableContext as e } from "./table.hook.js";
3
- import { t as a } from "../../../table.provider-CW1fpZcF.js";
3
+ import { t as a } from "../../../table.provider-CzfMGbe4.js";
4
4
  export {
5
5
  r as TableContext,
6
6
  a as TableProvider,
@@ -1,4 +1,4 @@
1
- import { t as o } from "../../../table.provider-CW1fpZcF.js";
1
+ import { t as o } from "../../../table.provider-CzfMGbe4.js";
2
2
  export {
3
3
  o as TableProvider
4
4
  };
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.113",
5
+ "version": "0.1.2-alpha.114",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
@@ -6,7 +6,7 @@ import { TableContext as qt } from "./components/VirtualizedTable/contexts/table
6
6
  import { t as fe } from "./events.types-BG1Uh8i6.js";
7
7
  import { getTableId as Pe } from "./components/VirtualizedTable/utils/get-table-id.js";
8
8
  import * as De from "react";
9
- import { useCallback as z, useEffect as k, useMemo as U, useRef as b, useState as I } from "react";
9
+ import { useCallback as z, useEffect as j, useMemo as U, useRef as b, useState as I } from "react";
10
10
  import { jsx as ce } from "react/jsx-runtime";
11
11
  import { useQuery as Nt } from "@tanstack/react-query";
12
12
  function T(e, o) {
@@ -764,8 +764,8 @@ var Se = {
764
764
  var L, P;
765
765
  const V = o.options.columnResizeDirection === "rtl" ? -1 : 1, K = (w - ((L = _?.startOffset) != null ? L : 0)) * V, X = Math.max(K / ((P = _?.startSize) != null ? P : 0), -0.999999);
766
766
  return _.columnSizingStart.forEach((ve) => {
767
- let [Re, j] = ve;
768
- a[Re] = Math.round(Math.max(j + j * X, 0) * 100) / 100;
767
+ let [Re, k] = ve;
768
+ a[Re] = Math.round(Math.max(k + k * X, 0) * 100) / 100;
769
769
  }), {
770
770
  ..._,
771
771
  deltaOffset: K,
@@ -1668,9 +1668,9 @@ var tt = [
1668
1668
  const o = e();
1669
1669
  return o === void 0 || o === "all" ? o : [.../* @__PURE__ */ new Set([...o, ...tt])];
1670
1670
  } : [.../* @__PURE__ */ new Set([...e, ...tt])], Yn = ({ children: e, classNameExpandedCell: o, classNameExpandedContent: t, classNameExpandedRow: n, classNameExpandedHeader: r, classNameActiveExpandedRow: i, classNameHoverRow: l, columns: s = [], data: u = [], defaultExpanded: a, enableExpandedRow: d, enableHoverRow: g, expandedState: f, headerContent: c, id: p, isPaginationEnabled: v, queryOptions: $ = {}, totalItems: h, getRowId: w, fetchData: _, onExpandedChange: L, renderExpandedRow: P, keepExpandColumnVisible: V }) => {
1671
- const [K, X] = I([]), [ve, Re] = I(!!_), [j, W] = I(0), [ne, dt] = I(), [oe, ft] = I(10), [ct, pt] = I(h), je = _ ? ct : h, St = Math.ceil(je / oe), [re, mt] = I({}), [ie, Ct] = I({}), [le, vt] = I({}), [se, Rt] = I({}), ht = () => {
1671
+ const [K, X] = I([]), [ve, Re] = I(!!_), [k, W] = I(0), [ne, dt] = I(), [oe, ft] = I(10), [ct, pt] = I(h), je = _ ? ct : h, St = Math.ceil(je / oe), [re, mt] = I({}), [ie, Ct] = I({}), [le, vt] = I({}), [se, Rt] = I({}), ht = () => {
1672
1672
  const S = typeof p == "string" || typeof p == "number" ? [p] : [...p];
1673
- return v && S.push(j, oe), ne && S.push(ne), Object.entries(re).forEach(([R, F]) => {
1673
+ return v && S.push(k, oe), ne && S.push(ne), Object.entries(re).forEach(([R, F]) => {
1674
1674
  S.push(`${R}:${F.join(",")}`);
1675
1675
  }), Object.entries(ie).forEach(([R, F]) => {
1676
1676
  F && S.push(`${R}:${F}`);
@@ -1692,11 +1692,11 @@ var tt = [
1692
1692
  },
1693
1693
  initialData: () => {
1694
1694
  if (!(Ke.current || u.length === 0))
1695
- return Ke.current = !0, u;
1695
+ return u;
1696
1696
  },
1697
1697
  queryFn: async ({ signal: S }) => {
1698
1698
  const { data: R, totalItemsCount: F } = await _({
1699
- page: Math.max(j + 1, 1),
1699
+ page: Math.max(k + 1, 1),
1700
1700
  pageSize: oe,
1701
1701
  termOfSearch: ne,
1702
1702
  ...Object.keys(re).length > 0 ? re : {},
@@ -1706,10 +1706,14 @@ var tt = [
1706
1706
  }, S);
1707
1707
  return Ue.current = { totalItemsCount: F }, R;
1708
1708
  }
1709
- }), [_t, Xe] = I(!1), he = b(0), We = b(!0), Qe = b(G.refetch);
1709
+ });
1710
+ j(() => {
1711
+ Ke.current = !0;
1712
+ }, []);
1713
+ const [_t, Xe] = I(!1), he = b(0), We = b(!0), Qe = b(G.refetch);
1710
1714
  Qe.current = G.refetch;
1711
1715
  const Q = _ ? G.data ?? Gn : u, Ft = _ ? G.isLoading : !1, $t = _ ? G.isFetching : !1, Mt = _ ? G.error : null, Ye = !!c;
1712
- k(() => {
1716
+ j(() => {
1713
1717
  if (!_ || G.dataUpdatedAt === 0) return;
1714
1718
  Re(!1);
1715
1719
  const { totalItemsCount: S } = Ue.current;
@@ -1752,7 +1756,7 @@ var tt = [
1752
1756
  we,
1753
1757
  L
1754
1758
  ]);
1755
- k(() => {
1759
+ j(() => {
1756
1760
  if (!d) return;
1757
1761
  const S = Pe(p), R = new AbortController(), F = (Z) => {
1758
1762
  const { detail: O } = Z, { rowId: y } = O;
@@ -1780,9 +1784,9 @@ var tt = [
1780
1784
  d,
1781
1785
  p,
1782
1786
  Y
1783
- ]), k(() => () => {
1787
+ ]), j(() => () => {
1784
1788
  We.current = !1;
1785
- }, []), k(() => {
1789
+ }, []), j(() => {
1786
1790
  if (!_) return;
1787
1791
  const S = Pe(p), R = new AbortController(), F = (E) => {
1788
1792
  const { detail: ge } = E;
@@ -1793,14 +1797,14 @@ var tt = [
1793
1797
  return document.addEventListener(fe.REFRESH, F, { signal: R.signal }), () => R.abort();
1794
1798
  }, [_, p]);
1795
1799
  const _e = U(() => Q.some((S) => !!S.meta?.expandedRow), [Q]), ue = U(() => Q.map((S, R) => w ? w(S, R) : String(R)), [Q, w]), Ht = U(() => typeof q == "boolean" ? q : ue.some((S) => !!q[S]), [q, ue]), Gt = U(() => typeof V == "boolean" ? V : typeof V == "object" ? ue.some((S) => !!V[S]) : !1, [V, ue]), Fe = _e || P && (Ht || Gt), [N, Ze] = I(!!Fe);
1796
- k(() => {
1800
+ j(() => {
1797
1801
  if (Fe) {
1798
1802
  const S = requestAnimationFrame(() => Ze(!0));
1799
1803
  return () => cancelAnimationFrame(S);
1800
1804
  } else Ze(!1);
1801
1805
  }, [Fe]);
1802
1806
  const [ae, Je] = I(!N);
1803
- k(() => {
1807
+ j(() => {
1804
1808
  if (N) Je(!1);
1805
1809
  else {
1806
1810
  const S = setTimeout(() => Je(!0), 300);
@@ -1865,7 +1869,7 @@ var tt = [
1865
1869
  dateFilters: ie,
1866
1870
  dateRangeFilters: le,
1867
1871
  timeFilters: se,
1868
- page: j,
1872
+ page: k,
1869
1873
  pageSize: oe,
1870
1874
  sortedData: K,
1871
1875
  table: zt,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.2-alpha.114",
5
+ "version": "0.1.2-alpha.115",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",