mimir-ui-kit 1.38.43 → 1.39.0
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/assets/stories.css +1 -0
- package/dist/assets/styles2.css +1 -0
- package/dist/combobox-Dv6-ANkb.js +508 -0
- package/dist/components/Dropdown/Dropdown.js +176 -176
- package/dist/components/MultiSelectSearch/MultiSelectSearch.js +1 -1
- package/dist/components/SelectSearch/SelectSearch.js +1 -1
- package/dist/components/Table/ColumnOrderSettings.d.ts +18 -0
- package/dist/components/Table/ColumnOrderSettings.js +177 -0
- package/dist/components/Table/Table.d.ts +3 -0
- package/dist/components/Table/Table.js +204 -0
- package/dist/components/Table/TableBody.d.ts +5 -0
- package/dist/components/Table/TableBody.js +109 -0
- package/dist/components/Table/TableCard.d.ts +5 -0
- package/dist/components/Table/TableCard.js +45 -0
- package/dist/components/Table/TableCardsView.d.ts +5 -0
- package/dist/components/Table/TableCardsView.js +84 -0
- package/dist/components/Table/TableFilters.d.ts +12 -0
- package/dist/components/Table/TableFilters.js +165 -0
- package/dist/components/Table/TableHeader.d.ts +3 -0
- package/dist/components/Table/TableHeader.js +70 -0
- package/dist/components/Table/TableRow.d.ts +5 -0
- package/dist/components/Table/TableRow.js +76 -0
- package/dist/components/Table/TableScrollButtons.d.ts +11 -0
- package/dist/components/Table/TableScrollButtons.js +35 -0
- package/dist/components/Table/constants.d.ts +128 -0
- package/dist/components/Table/constants.js +434 -0
- package/dist/components/Table/hooks/index.d.ts +4 -0
- package/dist/components/Table/hooks/index.js +10 -0
- package/dist/components/Table/hooks/useTableInstance.d.ts +3 -0
- package/dist/components/Table/hooks/useTableInstance.js +68 -0
- package/dist/components/Table/hooks/useTableScroll.d.ts +8 -0
- package/dist/components/Table/hooks/useTableScroll.js +54 -0
- package/dist/components/Table/hooks/useTableState.d.ts +13 -0
- package/dist/components/Table/hooks/useTableState.js +56 -0
- package/dist/components/Table/hooks/useTableVirtualization.d.ts +13 -0
- package/dist/components/Table/hooks/useTableVirtualization.js +97 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/index.js +10 -0
- package/dist/components/Table/types.d.ts +150 -0
- package/dist/components/Table/utils.d.ts +4 -0
- package/dist/components/Table/utils.js +25 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +72 -64
- package/dist/index-CVk4sixt.js +1862 -0
- package/dist/index-D5H8gPPn.js +546 -0
- package/dist/index.js +106 -98
- package/dist/{portal-D3A00sie.js → portal-C_u5auU1.js} +179 -183
- package/dist/stories.module-fud786VB.js +29 -0
- package/dist/styles.module--QBQYoA9.js +36 -0
- package/package.json +3 -1
- package/dist/combobox-BD-GHvMy.js +0 -980
@@ -7,7 +7,7 @@ import { Icon as O } from "../../icons/Icon.js";
|
|
7
7
|
import { Button as Q } from "../Button/Button.js";
|
8
8
|
import { I as B } from "../../Input-DAmc_HxO.js";
|
9
9
|
import { EInputVariant as X } from "../Input/constants.js";
|
10
|
-
import { H as Y, U as M, G as j, K as Z, W as ee } from "../../combobox-
|
10
|
+
import { H as Y, U as M, G as j, K as Z, W as ee } from "../../combobox-Dv6-ANkb.js";
|
11
11
|
import '../../assets/SelectSearch.css';const te = "_disabled_1bph7_6", oe = "_container_1bph7_13", ne = "_full_1bph7_28", se = "_button_1bph7_40", ae = "_options_1bph7_54", ie = "_top_1bph7_65", le = "_bottom_1bph7_71", re = "_m_1bph7_98", ce = "_l_1bph7_113", de = "_option_1bph7_54", pe = "_clear_1bph7_167", e = {
|
12
12
|
"select-search": "_select-search_1bph7_2",
|
13
13
|
disabled: te,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
2
|
+
|
3
|
+
type TColumnOrderSettingsProps = {
|
4
|
+
columns: {
|
5
|
+
id: string;
|
6
|
+
header: ReactNode;
|
7
|
+
}[];
|
8
|
+
columnOrder: string[];
|
9
|
+
onColumnOrderChange: (newOrder: string[]) => void;
|
10
|
+
isOpen: boolean;
|
11
|
+
onClose: () => void;
|
12
|
+
defaultColumnOrder?: string[];
|
13
|
+
visibleColumns?: Record<string, boolean>;
|
14
|
+
onVisibleColumnsChange?: (visibleColumns: Record<string, boolean>) => void;
|
15
|
+
requiredColumns?: string[];
|
16
|
+
};
|
17
|
+
export declare const ColumnOrderSettings: ({ columns, columnOrder, onColumnOrderChange, isOpen, onClose, defaultColumnOrder, visibleColumns, onVisibleColumnsChange, requiredColumns }: TColumnOrderSettingsProps) => import("react/jsx-runtime").JSX.Element;
|
18
|
+
export {};
|
@@ -0,0 +1,177 @@
|
|
1
|
+
import { jsxs as g, jsx as s } from "react/jsx-runtime";
|
2
|
+
import { c as x } from "../../index-DIxK0V-G.js";
|
3
|
+
import { useState as p, useEffect as J, useCallback as l } from "react";
|
4
|
+
import { c as r } from "../../stories.module-fud786VB.js";
|
5
|
+
import { Icon as K } from "../../icons/Icon.js";
|
6
|
+
import { Button as O } from "../Button/Button.js";
|
7
|
+
import { EButtonVariantBorderless as M, EButtonForm as k, EButtonVariantOutline as Q, EButtonVariantDefault as U } from "../Button/constants.js";
|
8
|
+
import { EDrawerPosition as W } from "../Drawer/constants.js";
|
9
|
+
import { Drawer as X } from "../Drawer/Drawer.js";
|
10
|
+
import { Switcher as Y } from "../Switcher/Switcher.js";
|
11
|
+
const ot = ({
|
12
|
+
columns: m,
|
13
|
+
columnOrder: E,
|
14
|
+
onColumnOrderChange: w,
|
15
|
+
isOpen: D,
|
16
|
+
onClose: h,
|
17
|
+
defaultColumnOrder: I,
|
18
|
+
visibleColumns: S = {},
|
19
|
+
onVisibleColumnsChange: u,
|
20
|
+
requiredColumns: n = []
|
21
|
+
}) => {
|
22
|
+
const [i, v] = p([]), [o, b] = p(null), [y, d] = p(null), [N, B] = p({});
|
23
|
+
J(() => {
|
24
|
+
D && (v([...E]), B({ ...S }));
|
25
|
+
}, [D, E, S]);
|
26
|
+
const L = l(
|
27
|
+
(t) => {
|
28
|
+
n.includes(t) || b(t);
|
29
|
+
},
|
30
|
+
[n]
|
31
|
+
), V = l(
|
32
|
+
(t, e) => {
|
33
|
+
t.preventDefault(), !(!o || o === e || n.includes(e)) && d(e);
|
34
|
+
},
|
35
|
+
[o, n]
|
36
|
+
), z = l(
|
37
|
+
(t, e) => {
|
38
|
+
if (t.preventDefault(), !o || o === e || n.includes(e))
|
39
|
+
return;
|
40
|
+
const a = [...i], f = a.indexOf(o), c = a.indexOf(e);
|
41
|
+
a.splice(f, 1), a.splice(c, 0, o), v(a), d(null);
|
42
|
+
},
|
43
|
+
[o, i, n]
|
44
|
+
), A = l(() => {
|
45
|
+
b(null), d(null);
|
46
|
+
}, []), F = l(
|
47
|
+
(t, e) => {
|
48
|
+
t.preventDefault(), !(o === e || n.includes(e)) && d(e);
|
49
|
+
},
|
50
|
+
[o, n]
|
51
|
+
), R = l(() => {
|
52
|
+
d(null);
|
53
|
+
}, []), j = l(
|
54
|
+
(t, e) => {
|
55
|
+
!e && n.includes(t) || B((a) => ({
|
56
|
+
...a,
|
57
|
+
[t]: e
|
58
|
+
}));
|
59
|
+
},
|
60
|
+
[n]
|
61
|
+
), G = l(() => {
|
62
|
+
w(i), u == null || u(N), h();
|
63
|
+
}, [
|
64
|
+
i,
|
65
|
+
N,
|
66
|
+
w,
|
67
|
+
u,
|
68
|
+
h
|
69
|
+
]), H = () => {
|
70
|
+
h();
|
71
|
+
}, P = l(() => {
|
72
|
+
const t = I || m.map((a) => a.id);
|
73
|
+
v(t);
|
74
|
+
const e = {};
|
75
|
+
m.forEach((a) => {
|
76
|
+
e[a.id] = !0;
|
77
|
+
}), B(e);
|
78
|
+
}, [m, I]), T = /* @__PURE__ */ g("div", { className: r.columnOrderFooter, children: [
|
79
|
+
/* @__PURE__ */ s(
|
80
|
+
O,
|
81
|
+
{
|
82
|
+
onClick: P,
|
83
|
+
variant: M.Asphalt,
|
84
|
+
form: k.BorderlessButton,
|
85
|
+
className: r.footerButton,
|
86
|
+
size: "xxl",
|
87
|
+
children: "По умолчанию"
|
88
|
+
}
|
89
|
+
),
|
90
|
+
/* @__PURE__ */ g("div", { className: r.footerButtonGroup, children: [
|
91
|
+
/* @__PURE__ */ s(
|
92
|
+
O,
|
93
|
+
{
|
94
|
+
onClick: H,
|
95
|
+
variant: Q.Asphalt,
|
96
|
+
form: k.OutlineButton,
|
97
|
+
className: r.footerButton,
|
98
|
+
size: "xxl",
|
99
|
+
children: "Отменить"
|
100
|
+
}
|
101
|
+
),
|
102
|
+
/* @__PURE__ */ s(
|
103
|
+
O,
|
104
|
+
{
|
105
|
+
onClick: G,
|
106
|
+
variant: U.PrimarySapphire,
|
107
|
+
className: r.footerButton,
|
108
|
+
size: "xxl",
|
109
|
+
children: "Сохранить"
|
110
|
+
}
|
111
|
+
)
|
112
|
+
] })
|
113
|
+
] });
|
114
|
+
return /* @__PURE__ */ s(
|
115
|
+
X,
|
116
|
+
{
|
117
|
+
isOpen: D,
|
118
|
+
onClose: h,
|
119
|
+
title: "Настройка порядка столбцов",
|
120
|
+
position: W.RIGHT,
|
121
|
+
classNameContent: r.columnOrderDrawer,
|
122
|
+
showCloseButton: !0,
|
123
|
+
footer: T,
|
124
|
+
children: /* @__PURE__ */ s("div", { className: r.columnOrderList, children: i.map((t) => {
|
125
|
+
const e = m.find((c) => c.id === t), a = n.includes(t), f = N[t] !== !1;
|
126
|
+
return e ? /* @__PURE__ */ g(
|
127
|
+
"div",
|
128
|
+
{
|
129
|
+
draggable: !a,
|
130
|
+
onDragStart: () => L(t),
|
131
|
+
onDragOver: (c) => V(c, t),
|
132
|
+
onDrop: (c) => z(c, t),
|
133
|
+
onDragEnd: A,
|
134
|
+
onDragEnter: (c) => F(c, t),
|
135
|
+
onDragLeave: R,
|
136
|
+
className: x(r.columnOrderItem, {
|
137
|
+
[r.dragging]: o === t,
|
138
|
+
[r.dragOver]: y === t,
|
139
|
+
[r.disabled]: a,
|
140
|
+
[r.hidden]: !f
|
141
|
+
}),
|
142
|
+
children: [
|
143
|
+
/* @__PURE__ */ s(
|
144
|
+
K,
|
145
|
+
{
|
146
|
+
iconName: "DragHandleVertical24px",
|
147
|
+
className: x(r.iconDrag, {
|
148
|
+
[r.iconDisabled]: a
|
149
|
+
})
|
150
|
+
}
|
151
|
+
),
|
152
|
+
/* @__PURE__ */ g("div", { className: r.columnNameAndSwitch, children: [
|
153
|
+
/* @__PURE__ */ s("div", { className: r.columnName, children: typeof e.header == "string" ? e.header : "Столбец" }),
|
154
|
+
/* @__PURE__ */ s(
|
155
|
+
Y,
|
156
|
+
{
|
157
|
+
checked: f,
|
158
|
+
onChange: () => j(t, !f),
|
159
|
+
disabled: a,
|
160
|
+
className: x(r.columnSwitch, {
|
161
|
+
[r.disabled]: a
|
162
|
+
}),
|
163
|
+
hasLabel: !1
|
164
|
+
}
|
165
|
+
)
|
166
|
+
] })
|
167
|
+
]
|
168
|
+
},
|
169
|
+
t
|
170
|
+
) : null;
|
171
|
+
}) })
|
172
|
+
}
|
173
|
+
);
|
174
|
+
};
|
175
|
+
export {
|
176
|
+
ot as ColumnOrderSettings
|
177
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { TTableProps } from './types';
|
2
|
+
|
3
|
+
export declare const Table: <T extends Record<string, unknown>>({ data, columns, tableClassNameContainer, isSelectable, selectedRowIds, onSelectedRowsChange, isLoading, onSort, virtualized, height, width, variant, displayMode, scrollContainerClassName, tableClassName, headerClassName, headerTextClassName, headerRowClassName, headerCellClassName, bodyClassName, virtualBodyClassName, rowClassName, cellClassName, selectCellClassName, scrollButtonsClassName, cardClassName, cardHeaderClassName, cardValueClassName, initialSorting, initialRowSelection, serverSideSorting, columnOrder, onColumnOrderChange, visibleColumns, globalFilter, onGlobalFilterChange, enableGlobalFilter, columnsToSearch, showScrollButtons, autoShowScrollButtons, buttonsScrollVariant, onCardActionsClick, showCardActions }: TTableProps<T>) => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,204 @@
|
|
1
|
+
import { jsxs as H, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { c as m } from "../../index-DIxK0V-G.js";
|
3
|
+
import { useEffect as ye, useMemo as T } from "react";
|
4
|
+
import { ETableDisplayMode as b, TABLE_OPTIONS as R, ETableVariant as Se, ETableScrollButtonVariant as ge } from "./constants.js";
|
5
|
+
import { useTableInstance as Be } from "./hooks/useTableInstance.js";
|
6
|
+
import { useTableScroll as Le } from "./hooks/useTableScroll.js";
|
7
|
+
import { useTableState as Ne } from "./hooks/useTableState.js";
|
8
|
+
import { c as l } from "../../styles.module--QBQYoA9.js";
|
9
|
+
import { TableBody as Oe } from "./TableBody.js";
|
10
|
+
import { TableCardsView as Ae } from "./TableCardsView.js";
|
11
|
+
import { TableHeader as He } from "./TableHeader.js";
|
12
|
+
import { TableScrollButtons as Re } from "./TableScrollButtons.js";
|
13
|
+
import { Loader as Ie } from "../Loader/Loader.js";
|
14
|
+
const Ke = ({
|
15
|
+
data: u,
|
16
|
+
columns: I,
|
17
|
+
tableClassNameContainer: v,
|
18
|
+
isSelectable: t = !1,
|
19
|
+
selectedRowIds: w,
|
20
|
+
onSelectedRowsChange: D,
|
21
|
+
isLoading: F = !1,
|
22
|
+
onSort: V,
|
23
|
+
virtualized: o = !1,
|
24
|
+
height: h = R.DEFAULT_HEIGHT,
|
25
|
+
width: E = R.DEFAULT_WIDTH,
|
26
|
+
variant: n = Se.WhiteHeader,
|
27
|
+
displayMode: d = b.TABLE,
|
28
|
+
scrollContainerClassName: $,
|
29
|
+
tableClassName: x,
|
30
|
+
headerClassName: G,
|
31
|
+
headerTextClassName: J,
|
32
|
+
headerRowClassName: U,
|
33
|
+
headerCellClassName: W,
|
34
|
+
bodyClassName: _,
|
35
|
+
virtualBodyClassName: j,
|
36
|
+
rowClassName: p,
|
37
|
+
cellClassName: y,
|
38
|
+
selectCellClassName: S,
|
39
|
+
scrollButtonsClassName: K,
|
40
|
+
cardClassName: C,
|
41
|
+
cardHeaderClassName: M,
|
42
|
+
cardValueClassName: P,
|
43
|
+
initialSorting: k = [],
|
44
|
+
initialRowSelection: q = {},
|
45
|
+
serverSideSorting: g = !1,
|
46
|
+
columnOrder: a,
|
47
|
+
onColumnOrderChange: Q,
|
48
|
+
visibleColumns: s,
|
49
|
+
globalFilter: X = "",
|
50
|
+
onGlobalFilterChange: B,
|
51
|
+
enableGlobalFilter: Y = !1,
|
52
|
+
columnsToSearch: Z,
|
53
|
+
showScrollButtons: z = !1,
|
54
|
+
autoShowScrollButtons: L = !1,
|
55
|
+
buttonsScrollVariant: ee = ge.WHITE,
|
56
|
+
onCardActionsClick: re,
|
57
|
+
showCardActions: te = !1
|
58
|
+
}) => {
|
59
|
+
const {
|
60
|
+
sorting: c,
|
61
|
+
rowSelection: N,
|
62
|
+
internalGlobalFilter: oe,
|
63
|
+
columnOrderToUse: le,
|
64
|
+
handleSortingChange: ne,
|
65
|
+
handleGlobalFilterChange: ae,
|
66
|
+
handleRowSelectionChange: se,
|
67
|
+
handleColumnOrderChange: ce
|
68
|
+
} = Ne({
|
69
|
+
initialSorting: k,
|
70
|
+
initialRowSelection: q,
|
71
|
+
onSort: V,
|
72
|
+
onGlobalFilterChange: B,
|
73
|
+
onColumnOrderChange: Q,
|
74
|
+
serverSideSorting: g,
|
75
|
+
data: u,
|
76
|
+
columnOrder: a
|
77
|
+
}), {
|
78
|
+
scrollContainerRef: r,
|
79
|
+
isOverflowing: fe,
|
80
|
+
handleScrollLeft: ie,
|
81
|
+
handleScrollRight: me
|
82
|
+
} = Le({
|
83
|
+
autoShowScrollButtons: L
|
84
|
+
}), f = B ? X : oe, i = Be({
|
85
|
+
data: u,
|
86
|
+
columns: I,
|
87
|
+
isSelectable: t,
|
88
|
+
sorting: c,
|
89
|
+
rowSelection: N,
|
90
|
+
columnOrderToUse: le,
|
91
|
+
effectiveGlobalFilter: f,
|
92
|
+
handleSortingChange: ne,
|
93
|
+
handleRowSelectionChange: se,
|
94
|
+
handleColumnOrderChange: ce,
|
95
|
+
handleGlobalFilterChange: ae,
|
96
|
+
enableGlobalFilter: Y,
|
97
|
+
serverSideSorting: g,
|
98
|
+
variant: n,
|
99
|
+
rowClassName: p,
|
100
|
+
cellClassName: y,
|
101
|
+
selectCellClassName: S,
|
102
|
+
visibleColumns: s,
|
103
|
+
columnsToSearch: Z,
|
104
|
+
selectedRowIds: w,
|
105
|
+
onSelectedRowsChange: D
|
106
|
+
});
|
107
|
+
ye(() => {
|
108
|
+
if (o && r.current) {
|
109
|
+
const Ee = setTimeout(() => {
|
110
|
+
var O;
|
111
|
+
const de = new Event("scroll", { bubbles: !0 });
|
112
|
+
(O = r.current) == null || O.dispatchEvent(de), setTimeout(() => {
|
113
|
+
var A;
|
114
|
+
const pe = new Event("scroll", { bubbles: !0 });
|
115
|
+
(A = r.current) == null || A.dispatchEvent(pe);
|
116
|
+
}, 50);
|
117
|
+
}, 0);
|
118
|
+
return () => clearTimeout(Ee);
|
119
|
+
}
|
120
|
+
}, [N, o]);
|
121
|
+
const Te = L ? fe : z, be = T(() => ({ height: h, width: E }), [h, E]), ue = T(
|
122
|
+
() => `${JSON.stringify(c)}-${JSON.stringify(a)}-${JSON.stringify(s)}`,
|
123
|
+
[c, a, s]
|
124
|
+
), he = T(() => `full-table-${f}`, [f]);
|
125
|
+
return /* @__PURE__ */ H(
|
126
|
+
"div",
|
127
|
+
{
|
128
|
+
className: m(l.tableContainer, v),
|
129
|
+
style: be,
|
130
|
+
children: [
|
131
|
+
F && /* @__PURE__ */ e("div", { className: l.loaderOverlay, children: /* @__PURE__ */ e(Ie, {}) }),
|
132
|
+
Te && d === b.TABLE && /* @__PURE__ */ e(
|
133
|
+
Re,
|
134
|
+
{
|
135
|
+
handleScrollLeft: ie,
|
136
|
+
handleScrollRight: me,
|
137
|
+
className: K,
|
138
|
+
buttonsVariant: ee
|
139
|
+
}
|
140
|
+
),
|
141
|
+
/* @__PURE__ */ e(
|
142
|
+
"div",
|
143
|
+
{
|
144
|
+
ref: r,
|
145
|
+
className: m(l.tableScroll, $),
|
146
|
+
children: d === b.TABLE ? /* @__PURE__ */ H(
|
147
|
+
"table",
|
148
|
+
{
|
149
|
+
className: m(l.table, x),
|
150
|
+
children: [
|
151
|
+
/* @__PURE__ */ e(
|
152
|
+
He,
|
153
|
+
{
|
154
|
+
table: i,
|
155
|
+
isSelectable: t,
|
156
|
+
headerClassName: G,
|
157
|
+
headerTextClassName: J,
|
158
|
+
headerCellClassName: W,
|
159
|
+
headerRowClassName: U,
|
160
|
+
variant: n
|
161
|
+
}
|
162
|
+
),
|
163
|
+
/* @__PURE__ */ e(
|
164
|
+
Oe,
|
165
|
+
{
|
166
|
+
table: i,
|
167
|
+
virtualized: o,
|
168
|
+
variant: n,
|
169
|
+
bodyClassName: _,
|
170
|
+
virtualBodyClassName: j,
|
171
|
+
rowClassName: p,
|
172
|
+
cellClassName: y,
|
173
|
+
selectCellClassName: S,
|
174
|
+
scrollRef: r,
|
175
|
+
isSelectable: t
|
176
|
+
}
|
177
|
+
)
|
178
|
+
]
|
179
|
+
},
|
180
|
+
ue
|
181
|
+
) : /* @__PURE__ */ e(
|
182
|
+
Ae,
|
183
|
+
{
|
184
|
+
table: i,
|
185
|
+
virtualized: o,
|
186
|
+
scrollRef: r,
|
187
|
+
isSelectable: t,
|
188
|
+
cardClassName: C,
|
189
|
+
cardHeaderClassName: M,
|
190
|
+
cardValueClassName: P,
|
191
|
+
onCardActionsClick: re,
|
192
|
+
showCardActions: te
|
193
|
+
}
|
194
|
+
)
|
195
|
+
}
|
196
|
+
)
|
197
|
+
]
|
198
|
+
},
|
199
|
+
he
|
200
|
+
);
|
201
|
+
};
|
202
|
+
export {
|
203
|
+
Ke as Table
|
204
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { TTableBodyProps } from './types';
|
2
|
+
|
3
|
+
declare function TableBodyComponent<T extends object>({ table, virtualized, bodyClassName, virtualBodyClassName, rowClassName, cellClassName, selectCellClassName, variant, scrollRef, isSelectable }: TTableBodyProps<T>): import("react/jsx-runtime").JSX.Element;
|
4
|
+
export declare const TableBody: typeof TableBodyComponent;
|
5
|
+
export {};
|
@@ -0,0 +1,109 @@
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
2
|
+
import { c as m } from "../../index-DIxK0V-G.js";
|
3
|
+
import { memo as E, useRef as G, useState as x, useEffect as $ } from "react";
|
4
|
+
import { ETableVariant as B } from "./constants.js";
|
5
|
+
import { useTableVirtualization as H } from "./hooks/useTableVirtualization.js";
|
6
|
+
import { c as t } from "../../styles.module--QBQYoA9.js";
|
7
|
+
import { TableRow as k } from "./TableRow.js";
|
8
|
+
function R({
|
9
|
+
table: r,
|
10
|
+
virtualized: o,
|
11
|
+
bodyClassName: T,
|
12
|
+
virtualBodyClassName: V,
|
13
|
+
rowClassName: f,
|
14
|
+
cellClassName: y,
|
15
|
+
selectCellClassName: u,
|
16
|
+
variant: l = B.WhiteHeader,
|
17
|
+
scrollRef: A,
|
18
|
+
isSelectable: g
|
19
|
+
}) {
|
20
|
+
const p = G(null), [i, I] = x(0), [a, K] = x(0), { rows: n } = r.getRowModel(), w = r.getAllColumns();
|
21
|
+
$(() => {
|
22
|
+
o && K((e) => e + 1);
|
23
|
+
}, [w, o]), $(() => {
|
24
|
+
if (o) {
|
25
|
+
const e = r.getState().rowSelection;
|
26
|
+
Object.keys(e).length === n.length && n.length > 0 && I((d) => d + 1);
|
27
|
+
}
|
28
|
+
}, [r.getState().rowSelection, n.length, o]);
|
29
|
+
const { virtualizer: h, rowRefs: W } = H({
|
30
|
+
rows: n,
|
31
|
+
virtualized: o,
|
32
|
+
scrollRef: A,
|
33
|
+
rowSelection: r.getState().rowSelection,
|
34
|
+
columns: w
|
35
|
+
});
|
36
|
+
if (!o)
|
37
|
+
return /* @__PURE__ */ c(
|
38
|
+
"tbody",
|
39
|
+
{
|
40
|
+
ref: p,
|
41
|
+
className: m(t.body, T),
|
42
|
+
children: n.map((e, s) => /* @__PURE__ */ c(
|
43
|
+
k,
|
44
|
+
{
|
45
|
+
row: e,
|
46
|
+
isSelectable: g,
|
47
|
+
variant: l,
|
48
|
+
rowClassName: f,
|
49
|
+
cellClassName: y,
|
50
|
+
selectCellClassName: u,
|
51
|
+
rowIndex: s
|
52
|
+
},
|
53
|
+
`${e.id}-${i}`
|
54
|
+
))
|
55
|
+
},
|
56
|
+
`tbody-${i}`
|
57
|
+
);
|
58
|
+
const C = h.getVirtualItems(), j = { height: h.getTotalSize(), position: "relative" };
|
59
|
+
return /* @__PURE__ */ c(
|
60
|
+
"tbody",
|
61
|
+
{
|
62
|
+
ref: p,
|
63
|
+
className: m(t.body, t.virtualBody, V),
|
64
|
+
style: j,
|
65
|
+
children: C.map((e) => {
|
66
|
+
const s = n[e.index], S = {
|
67
|
+
position: "absolute",
|
68
|
+
top: 0,
|
69
|
+
transform: `translateY(${e.start}px)`,
|
70
|
+
width: "100%",
|
71
|
+
willChange: "transform"
|
72
|
+
}, d = m(
|
73
|
+
t.row,
|
74
|
+
l === B.WhiteHeader ? e.index % 2 === 0 ? t.rowWhiteBackground : t.rowGrayBackground : e.index % 2 === 0 ? t.rowGrayBackground : t.rowWhiteBackground
|
75
|
+
);
|
76
|
+
return /* @__PURE__ */ c(
|
77
|
+
"tr",
|
78
|
+
{
|
79
|
+
ref: (b) => {
|
80
|
+
b && (W.current[s.id] = b);
|
81
|
+
},
|
82
|
+
style: S,
|
83
|
+
className: d,
|
84
|
+
children: /* @__PURE__ */ c(
|
85
|
+
k,
|
86
|
+
{
|
87
|
+
row: s,
|
88
|
+
isSelectable: g,
|
89
|
+
variant: l,
|
90
|
+
rowClassName: f,
|
91
|
+
cellClassName: y,
|
92
|
+
selectCellClassName: u,
|
93
|
+
isVirtualized: !0,
|
94
|
+
rowIndex: e.index,
|
95
|
+
columnsKey: a
|
96
|
+
}
|
97
|
+
)
|
98
|
+
},
|
99
|
+
`${e.key}-${i}-${a}`
|
100
|
+
);
|
101
|
+
})
|
102
|
+
},
|
103
|
+
`tbody-virtual-${i}-${a}`
|
104
|
+
);
|
105
|
+
}
|
106
|
+
const J = E(R);
|
107
|
+
export {
|
108
|
+
J as TableBody
|
109
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { TTableCardProps } from './types';
|
2
|
+
|
3
|
+
declare function TableCardComponent<T extends object>({ row, isSelectable, cardClassName, cardHeaderClassName, cardValueClassName, onSelect, onActionsClick, showActions }: TTableCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
4
|
+
export declare const TableCard: typeof TableCardComponent;
|
5
|
+
export {};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { f as b } from "../../index-CVk4sixt.js";
|
3
|
+
import { c as o } from "../../index-DIxK0V-G.js";
|
4
|
+
import { memo as v } from "react";
|
5
|
+
import { c as a } from "../../styles.module--QBQYoA9.js";
|
6
|
+
import { Icon as l } from "../../icons/Icon.js";
|
7
|
+
import { CheckboxMimir as k } from "../CheckboxMimir/CheckboxMimir.js";
|
8
|
+
function A({
|
9
|
+
row: r,
|
10
|
+
isSelectable: m,
|
11
|
+
cardClassName: t,
|
12
|
+
cardHeaderClassName: f,
|
13
|
+
cardValueClassName: h,
|
14
|
+
onSelect: i,
|
15
|
+
onActionsClick: s,
|
16
|
+
showActions: p = !1
|
17
|
+
}) {
|
18
|
+
const C = r.getIsSelected(), N = r.getVisibleCells(), u = (c) => {
|
19
|
+
i && i(c);
|
20
|
+
}, g = (c) => {
|
21
|
+
s && s(c, r.original);
|
22
|
+
};
|
23
|
+
return /* @__PURE__ */ d("div", { className: o(a.tableCard, t), children: [
|
24
|
+
m && /* @__PURE__ */ e("div", { className: a.cardCheckbox, children: /* @__PURE__ */ e(
|
25
|
+
k,
|
26
|
+
{
|
27
|
+
checked: C,
|
28
|
+
onChange: u
|
29
|
+
}
|
30
|
+
) }),
|
31
|
+
p && /* @__PURE__ */ e("div", { className: a.cardActions, onClick: g, children: /* @__PURE__ */ e(l, { iconName: "Kebab24px" }) }),
|
32
|
+
/* @__PURE__ */ e("div", { className: a.cardContent, children: N.map((c) => {
|
33
|
+
const n = c.column, x = typeof n.columnDef.header == "string" ? n.columnDef.header : "";
|
34
|
+
return /* @__PURE__ */ d("div", { className: a.cardField, children: [
|
35
|
+
/* @__PURE__ */ e("div", { className: o(a.cardValue, h), children: b(c.column.columnDef.cell, c.getContext()) }),
|
36
|
+
/* @__PURE__ */ e("div", { className: o(a.cardHeader, f), children: x })
|
37
|
+
] }, c.id);
|
38
|
+
}) }),
|
39
|
+
/* @__PURE__ */ e("div", { className: a.cardArrow, children: /* @__PURE__ */ e(l, { iconName: "ArrowUpRight32px" }) })
|
40
|
+
] });
|
41
|
+
}
|
42
|
+
const V = v(A);
|
43
|
+
export {
|
44
|
+
V as TableCard
|
45
|
+
};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { TTableCardsViewProps } from './types';
|
2
|
+
|
3
|
+
declare function TableCardsViewComponent<T extends object>({ table, virtualized, scrollRef, isSelectable, cardClassName, cardHeaderClassName, cardValueClassName, onCardActionsClick, showCardActions }: TTableCardsViewProps<T>): import("react/jsx-runtime").JSX.Element;
|
4
|
+
export declare const TableCardsView: typeof TableCardsViewComponent;
|
5
|
+
export {};
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
2
|
+
import { memo as V, useRef as b } from "react";
|
3
|
+
import { useTableVirtualization as v } from "./hooks/useTableVirtualization.js";
|
4
|
+
import { c as u } from "../../styles.module--QBQYoA9.js";
|
5
|
+
import { TableCard as g } from "./TableCard.js";
|
6
|
+
function y({
|
7
|
+
table: r,
|
8
|
+
virtualized: s,
|
9
|
+
scrollRef: S,
|
10
|
+
isSelectable: c,
|
11
|
+
cardClassName: l,
|
12
|
+
cardHeaderClassName: a,
|
13
|
+
cardValueClassName: m,
|
14
|
+
onCardActionsClick: f,
|
15
|
+
showCardActions: p = !1
|
16
|
+
}) {
|
17
|
+
const h = b(null), { rows: n } = r.getRowModel(), { virtualizer: d, rowRefs: w } = v({
|
18
|
+
rows: n,
|
19
|
+
virtualized: s,
|
20
|
+
scrollRef: S,
|
21
|
+
rowSelection: r.getState().rowSelection
|
22
|
+
});
|
23
|
+
if (!s)
|
24
|
+
return /* @__PURE__ */ o("div", { className: u.cardsContainer, children: n.map((t) => /* @__PURE__ */ o(
|
25
|
+
g,
|
26
|
+
{
|
27
|
+
row: t,
|
28
|
+
isSelectable: c,
|
29
|
+
cardClassName: l,
|
30
|
+
cardHeaderClassName: a,
|
31
|
+
cardValueClassName: m,
|
32
|
+
onSelect: (e) => t.toggleSelected(e),
|
33
|
+
onActionsClick: f,
|
34
|
+
showActions: p
|
35
|
+
},
|
36
|
+
t.id
|
37
|
+
)) });
|
38
|
+
const T = d.getVirtualItems(), x = d.getTotalSize();
|
39
|
+
return /* @__PURE__ */ o(
|
40
|
+
"div",
|
41
|
+
{
|
42
|
+
ref: h,
|
43
|
+
className: u.cardsVirtualContainer,
|
44
|
+
style: { height: x, position: "relative" },
|
45
|
+
children: T.map((t) => {
|
46
|
+
const e = n[t.index];
|
47
|
+
return /* @__PURE__ */ o(
|
48
|
+
"div",
|
49
|
+
{
|
50
|
+
ref: (i) => {
|
51
|
+
i && (w.current[e.id] = i);
|
52
|
+
},
|
53
|
+
style: {
|
54
|
+
position: "absolute",
|
55
|
+
top: 0,
|
56
|
+
transform: `translateY(${t.start}px)`,
|
57
|
+
width: "100%"
|
58
|
+
},
|
59
|
+
children: /* @__PURE__ */ o(
|
60
|
+
g,
|
61
|
+
{
|
62
|
+
row: e,
|
63
|
+
isSelectable: c,
|
64
|
+
cardClassName: l,
|
65
|
+
cardHeaderClassName: a,
|
66
|
+
cardValueClassName: m,
|
67
|
+
onSelect: (i) => e.toggleSelected(i),
|
68
|
+
onActionsClick: f,
|
69
|
+
showActions: p
|
70
|
+
}
|
71
|
+
)
|
72
|
+
},
|
73
|
+
t.key
|
74
|
+
);
|
75
|
+
})
|
76
|
+
}
|
77
|
+
);
|
78
|
+
}
|
79
|
+
const R = V(
|
80
|
+
y
|
81
|
+
);
|
82
|
+
export {
|
83
|
+
R as TableCardsView
|
84
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { TTableFilter, TTableFilterValues } from './types';
|
2
|
+
|
3
|
+
type TTableFiltersProps = {
|
4
|
+
filters: TTableFilter[];
|
5
|
+
filterValues: TTableFilterValues;
|
6
|
+
isOpen: boolean;
|
7
|
+
onClose: () => void;
|
8
|
+
onApply: (newFilterValues: TTableFilterValues) => void;
|
9
|
+
onReset: () => void;
|
10
|
+
};
|
11
|
+
export declare const TableFilters: ({ filters, filterValues, isOpen, onClose, onApply, onReset }: TTableFiltersProps) => import("react/jsx-runtime").JSX.Element;
|
12
|
+
export {};
|