@konstructio/ui 0.1.2-alpha.16 → 0.1.2-alpha.17
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,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { u as
|
|
4
|
-
import { useState as t, useMemo as
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as j } from "@tanstack/react-query";
|
|
3
|
+
import { u as k, g as q, a as A } from "../../../index-Dx2grAuN.js";
|
|
4
|
+
import { useState as t, useMemo as D, useCallback as n } from "react";
|
|
5
5
|
import { TableContext as K } from "./table.context.js";
|
|
6
6
|
import { DEFAULT_PAGE_SIZE as G } from "../constants/pagination.js";
|
|
7
7
|
const B = ({
|
|
8
|
-
children:
|
|
8
|
+
children: f,
|
|
9
9
|
id: r,
|
|
10
|
-
data:
|
|
10
|
+
data: g = [],
|
|
11
11
|
columns: h = [],
|
|
12
12
|
totalItems: p,
|
|
13
|
-
fetchData:
|
|
13
|
+
fetchData: m,
|
|
14
14
|
queryOptions: M = {}
|
|
15
15
|
}) => {
|
|
16
|
-
const [
|
|
16
|
+
const [u, S] = t([]), [c, d] = t(0), [l, y] = t(), [o, C] = t(G), [i, b] = t(p), P = D(
|
|
17
17
|
() => Math.ceil(i / o),
|
|
18
18
|
[i, o]
|
|
19
|
-
), [a, w] = t({}), { data: O, isLoading: T, isFetching: F } =
|
|
19
|
+
), [a, w] = t({}), { data: O, isLoading: T, isFetching: F } = j({
|
|
20
20
|
queryKey: [
|
|
21
21
|
...typeof r == "string" ? [r] : r,
|
|
22
22
|
c,
|
|
@@ -26,41 +26,41 @@ const B = ({
|
|
|
26
26
|
],
|
|
27
27
|
refetchOnMount: !1,
|
|
28
28
|
refetchOnWindowFocus: !1,
|
|
29
|
-
initialData:
|
|
30
|
-
queryFn:
|
|
29
|
+
initialData: g,
|
|
30
|
+
queryFn: async () => m ? m({
|
|
31
31
|
page: Math.max(c + 1, 1),
|
|
32
32
|
pageSize: o,
|
|
33
33
|
termOfSearch: l,
|
|
34
34
|
...Object.keys(a).length > 0 ? a : {}
|
|
35
|
-
}).then(({ data: e, totalItemsCount: s }) => (s &&
|
|
35
|
+
}).then(({ data: e, totalItemsCount: s }) => (s && b(s), e)) : g ?? [],
|
|
36
36
|
...M
|
|
37
37
|
}), R = n((e) => {
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
38
|
+
y(e), d(0);
|
|
39
|
+
}, []), x = n((e, s) => {
|
|
40
40
|
const z = e.toLowerCase().replace(/\s+/g, "_");
|
|
41
|
-
w((
|
|
42
|
-
...
|
|
41
|
+
w((E) => ({
|
|
42
|
+
...E,
|
|
43
43
|
[z]: s
|
|
44
44
|
}));
|
|
45
|
-
}, []),
|
|
46
|
-
(e) =>
|
|
45
|
+
}, []), I = n((e) => d(e), []), L = n(
|
|
46
|
+
(e) => C(e),
|
|
47
47
|
[]
|
|
48
|
-
),
|
|
48
|
+
), v = k({
|
|
49
49
|
data: O,
|
|
50
50
|
columns: h,
|
|
51
51
|
state: {
|
|
52
|
-
sorting:
|
|
52
|
+
sorting: u
|
|
53
53
|
},
|
|
54
|
-
onSortingChange:
|
|
55
|
-
getCoreRowModel:
|
|
56
|
-
getSortedRowModel:
|
|
54
|
+
onSortingChange: S,
|
|
55
|
+
getCoreRowModel: A(),
|
|
56
|
+
getSortedRowModel: q()
|
|
57
57
|
});
|
|
58
|
-
return /* @__PURE__ */
|
|
58
|
+
return /* @__PURE__ */ _(
|
|
59
59
|
K.Provider,
|
|
60
60
|
{
|
|
61
61
|
value: {
|
|
62
|
-
sortedData:
|
|
63
|
-
table:
|
|
62
|
+
sortedData: u,
|
|
63
|
+
table: v,
|
|
64
64
|
tableFetching: F,
|
|
65
65
|
tableLoading: T,
|
|
66
66
|
totalItems: i,
|
|
@@ -69,13 +69,13 @@ const B = ({
|
|
|
69
69
|
multiselectSelected: a,
|
|
70
70
|
pageSize: o,
|
|
71
71
|
totalPages: P,
|
|
72
|
-
handlePage:
|
|
73
|
-
onPageSize:
|
|
72
|
+
handlePage: I,
|
|
73
|
+
onPageSize: L,
|
|
74
74
|
onChangeTermOfSearch: R,
|
|
75
|
-
onSorting:
|
|
76
|
-
onSelectMultiselect:
|
|
75
|
+
onSorting: S,
|
|
76
|
+
onSelectMultiselect: x
|
|
77
77
|
},
|
|
78
|
-
children:
|
|
78
|
+
children: f
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
};
|
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.
|
|
5
|
+
"version": "0.1.2-alpha.16",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
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.
|
|
5
|
+
"version": "0.1.2-alpha.17",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|