@sito/dashboard 0.0.69 → 0.0.70
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.
- package/dist/{FiltersProvider-BoCTMqk8.js → FiltersProvider-BV023mmu.js} +1 -1
- package/dist/{FiltersProvider-Bxge43VS.cjs → FiltersProvider-DVMj0LV0.cjs} +1 -1
- package/dist/FiltersProvider.cjs +1 -1
- package/dist/FiltersProvider.js +1 -1
- package/dist/SvgIcons.cjs +1 -1
- package/dist/SvgIcons.js +11 -9
- package/dist/Table-CWcHaZeQ.cjs +1 -0
- package/dist/Table-LcN-UV8f.js +1184 -0
- package/dist/Table.cjs +1 -1
- package/dist/Table.css +1 -1
- package/dist/Table.js +9 -8
- package/dist/TableColumns-BjTNomZf.cjs +1 -0
- package/dist/{Filters-DL5jd8ps.js → TableColumns-CIddkosX.js} +37 -9
- package/dist/TableOptions.cjs +1 -1
- package/dist/TableOptions.js +1 -1
- package/dist/TableOptionsProvider-BgnISoXx.js +120 -0
- package/dist/TableOptionsProvider-i4uVLLwH.cjs +1 -0
- package/dist/components/Form/CheckInput/types.d.ts +1 -1
- package/dist/components/Form/FileInput/types.d.ts +2 -2
- package/dist/components/Form/SelectInput/types.d.ts +1 -1
- package/dist/components/Form/TextInput/types.d.ts +1 -1
- package/dist/components/Form/types.d.ts +2 -1
- package/dist/components/SvgIcons/BarsStaggered.d.ts +7 -0
- package/dist/components/SvgIcons/ChevronDown.d.ts +1 -1
- package/dist/components/SvgIcons/ChevronLeft.d.ts +1 -1
- package/dist/components/SvgIcons/ChevronRight.d.ts +1 -1
- package/dist/components/SvgIcons/ChevronUp.d.ts +1 -1
- package/dist/components/SvgIcons/Close.d.ts +1 -1
- package/dist/components/SvgIcons/Ellipsis.d.ts +1 -1
- package/dist/components/SvgIcons/File.d.ts +1 -1
- package/dist/components/SvgIcons/Filters.d.ts +1 -1
- package/dist/components/SvgIcons/TableColumns.d.ts +7 -0
- package/dist/components/SvgIcons/index.d.ts +2 -0
- package/dist/components/Table/components/ColumnVisibilityMenu.d.ts +12 -0
- package/dist/components/Table/components/TableHeader/types.d.ts +2 -0
- package/dist/components/Table/components/index.d.ts +1 -0
- package/dist/components/Table/components/types.d.ts +2 -0
- package/dist/components/Table/utils.d.ts +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +58 -55
- package/dist/providers/TableOptions/types.d.ts +5 -0
- package/package.json +1 -1
- package/dist/Filters-Dyee8QYH.cjs +0 -1
- package/dist/Table-BLhy0EYJ.cjs +0 -1
- package/dist/Table-CeD0yXGZ.js +0 -1113
- package/dist/TableOptionsProvider-BJdeNIQj.cjs +0 -1
- package/dist/TableOptionsProvider-DBr-FW53.js +0 -106
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const N=require("react/jsx-runtime"),b=require("./query-81BrXp3i.cjs"),e=require("react"),T=[20,50,100],j=e.createContext(void 0),h=s=>{if(s===null||typeof s>"u")return!1;if(typeof s=="string")return s.trim().length>0;if(Array.isArray(s))return s.length>0;if(typeof s=="object"){const o=s;return"start"in o||"end"in o?h(o.start)||h(o.end):!0}return!0},B=s=>{const{children:o}=s,[c,A]=e.useState(0),[i,q]=e.useState(20),[C,a]=e.useState(0),[l,g]=e.useState("id"),[u,p]=e.useState(b.SortOrder.DESC),[d,f]=e.useState({}),S=e.useCallback((t,r)=>r<=0?0:Math.max(0,Math.ceil(t/r)-1),[]),m=e.useCallback(t=>{const r=Number.isFinite(t)?Math.max(0,t):0;A(r),a(n=>Math.min(n,S(r,i)))},[S,i]),M=e.useCallback(t=>{!Number.isFinite(t)||t<=0||(q(t),a(0))},[]),F=e.useCallback(t=>{if(!Number.isFinite(t))return;const r=Math.max(0,Math.floor(t));a(Math.min(r,S(c,i)))},[S,i,c]),x=e.useCallback((t,r)=>{let n=u;l===t&&(u===b.SortOrder.ASC?n=b.SortOrder.DESC:n=b.SortOrder.ASC),g(t),p(n),r&&r(t,n)},[l,u]),y=e.useCallback(t=>{const r=Object.entries(t).reduce((n,[E,O])=>(O&&h(O.value)&&(n[E]=O.value),n),{});f(r),a(0)},[]),k=e.useCallback(t=>{f(t?r=>{const n={...r};return delete n[t],n}:{}),a(0)},[f]),P=e.useMemo(()=>Object.keys(d).length,[d]),w=e.useMemo(()=>({onSort:x,total:c,setTotal:m,sortingBy:l,setSortingBy:g,sortingOrder:u,setSortingOrder:p,pageSize:i,pageSizes:T,setPageSize:M,currentPage:C,setCurrentPage:F,filters:d,onFilterApply:y,clearFilters:k,countOfFilters:P}),[x,c,m,l,g,u,p,i,T,M,C,F,d,y,k,P]);return N.jsx(j.Provider,{value:w,children:o})},D=()=>{const s=e.useContext(j);if(!s)throw new Error("tableOptionsContext must be used within a Provider");return s};exports.TableOptionsProvider=B;exports.useTableOptions=D;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { jsx as V } from "react/jsx-runtime";
|
|
2
|
-
import { S as g } from "./query-CwuehjY1.js";
|
|
3
|
-
import { useState as a, useCallback as s, useMemo as j, createContext as z, useContext as q } from "react";
|
|
4
|
-
const w = [20, 50, 100], E = z(
|
|
5
|
-
void 0
|
|
6
|
-
), O = (r) => {
|
|
7
|
-
if (r === null || typeof r > "u") return !1;
|
|
8
|
-
if (typeof r == "string")
|
|
9
|
-
return r.trim().length > 0;
|
|
10
|
-
if (Array.isArray(r))
|
|
11
|
-
return r.length > 0;
|
|
12
|
-
if (typeof r == "object") {
|
|
13
|
-
const o = r;
|
|
14
|
-
return "start" in o || "end" in o ? O(o.start) || O(o.end) : !0;
|
|
15
|
-
}
|
|
16
|
-
return !0;
|
|
17
|
-
}, I = (r) => {
|
|
18
|
-
const { children: o } = r, [l, N] = a(0), [i, k] = a(20), [F, c] = a(0), [f, h] = a("id"), [u, S] = a(g.DESC), [d, p] = a({}), m = s(
|
|
19
|
-
(t, e) => e <= 0 ? 0 : Math.max(0, Math.ceil(t / e) - 1),
|
|
20
|
-
[]
|
|
21
|
-
), M = s(
|
|
22
|
-
(t) => {
|
|
23
|
-
const e = Number.isFinite(t) ? Math.max(0, t) : 0;
|
|
24
|
-
N(e), c(
|
|
25
|
-
(n) => Math.min(n, m(e, i))
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
[m, i]
|
|
29
|
-
), x = s((t) => {
|
|
30
|
-
!Number.isFinite(t) || t <= 0 || (k(t), c(0));
|
|
31
|
-
}, []), C = s(
|
|
32
|
-
(t) => {
|
|
33
|
-
if (!Number.isFinite(t)) return;
|
|
34
|
-
const e = Math.max(0, Math.floor(t));
|
|
35
|
-
c(Math.min(e, m(l, i)));
|
|
36
|
-
},
|
|
37
|
-
[m, i, l]
|
|
38
|
-
), y = s(
|
|
39
|
-
(t, e) => {
|
|
40
|
-
let n = u;
|
|
41
|
-
f === t && (u === g.ASC ? n = g.DESC : n = g.ASC), h(t), S(n), e && e(t, n);
|
|
42
|
-
},
|
|
43
|
-
[f, u]
|
|
44
|
-
), P = s((t) => {
|
|
45
|
-
const e = Object.entries(t).reduce(
|
|
46
|
-
(n, [D, b]) => (b && O(b.value) && (n[D] = b.value), n),
|
|
47
|
-
{}
|
|
48
|
-
);
|
|
49
|
-
p(e), c(0);
|
|
50
|
-
}, []), T = s(
|
|
51
|
-
(t) => {
|
|
52
|
-
p(t ? (e) => {
|
|
53
|
-
const n = { ...e };
|
|
54
|
-
return delete n[t], n;
|
|
55
|
-
} : {}), c(0);
|
|
56
|
-
},
|
|
57
|
-
[p]
|
|
58
|
-
), A = j(() => Object.keys(d).length, [d]), B = j(
|
|
59
|
-
() => ({
|
|
60
|
-
onSort: y,
|
|
61
|
-
total: l,
|
|
62
|
-
setTotal: M,
|
|
63
|
-
sortingBy: f,
|
|
64
|
-
setSortingBy: h,
|
|
65
|
-
sortingOrder: u,
|
|
66
|
-
setSortingOrder: S,
|
|
67
|
-
pageSize: i,
|
|
68
|
-
pageSizes: w,
|
|
69
|
-
setPageSize: x,
|
|
70
|
-
currentPage: F,
|
|
71
|
-
setCurrentPage: C,
|
|
72
|
-
filters: d,
|
|
73
|
-
onFilterApply: P,
|
|
74
|
-
clearFilters: T,
|
|
75
|
-
countOfFilters: A
|
|
76
|
-
}),
|
|
77
|
-
[
|
|
78
|
-
y,
|
|
79
|
-
l,
|
|
80
|
-
M,
|
|
81
|
-
f,
|
|
82
|
-
h,
|
|
83
|
-
u,
|
|
84
|
-
S,
|
|
85
|
-
i,
|
|
86
|
-
w,
|
|
87
|
-
x,
|
|
88
|
-
F,
|
|
89
|
-
C,
|
|
90
|
-
d,
|
|
91
|
-
P,
|
|
92
|
-
T,
|
|
93
|
-
A
|
|
94
|
-
]
|
|
95
|
-
);
|
|
96
|
-
return /* @__PURE__ */ V(E.Provider, { value: B, children: o });
|
|
97
|
-
}, J = () => {
|
|
98
|
-
const r = q(E);
|
|
99
|
-
if (!r)
|
|
100
|
-
throw new Error("tableOptionsContext must be used within a Provider");
|
|
101
|
-
return r;
|
|
102
|
-
};
|
|
103
|
-
export {
|
|
104
|
-
I as T,
|
|
105
|
-
J as u
|
|
106
|
-
};
|