@alphakits/ui 2.0.10 → 2.0.11
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/filter-tag/index.module.css +1 -1
- package/dist/header-search/component.d.ts +1 -0
- package/dist/header-search/component.js +20 -18
- package/dist/header-search/component.js.map +1 -1
- package/dist/header-search/index.module.css +1 -1
- package/dist/header-search/index.module.css.js +6 -4
- package/dist/header-search/index.module.css.js.map +1 -1
- package/dist/status/index.module.css +1 -1
- package/dist/table/columns.js +1 -1
- package/dist/table/columns.js.map +1 -1
- package/dist/table/components/cell/component.d.ts +1 -0
- package/dist/table/components/cell/component.js +22 -21
- package/dist/table/components/cell/component.js.map +1 -1
- package/dist/table/components/cell/index.module.css +1 -1
- package/dist/table/components/cell/index.module.css.js +14 -12
- package/dist/table/components/cell/index.module.css.js.map +1 -1
- package/dist/table/components/cells/index.d.ts +2 -1
- package/dist/table/components/cells/index.js +19 -18
- package/dist/table/components/cells/index.js.map +1 -1
- package/dist/table/components/cells/index.module.css +1 -1
- package/dist/table/components/cells/index.module.css.js +14 -12
- package/dist/table/components/cells/index.module.css.js.map +1 -1
- package/dist/table/components/pagination/index.d.ts +1 -0
- package/dist/table/components/pagination/index.js +94 -75
- package/dist/table/components/pagination/index.js.map +1 -1
- package/dist/table/components/pagination/index.module.css +1 -1
- package/dist/table/components/pagination/index.module.css.js +24 -18
- package/dist/table/components/pagination/index.module.css.js.map +1 -1
- package/dist/table/components/table-header/index.d.ts +1 -0
- package/dist/table/components/table-header/index.js +45 -43
- package/dist/table/components/table-header/index.js.map +1 -1
- package/dist/table/components/table-header/index.module.css +1 -1
- package/dist/table/components/table-header/index.module.css.js +2 -4
- package/dist/table/components/table-header/index.module.css.js.map +1 -1
- package/dist/table/index.module.css +1 -1
- package/dist/table/index.module.css.js +9 -7
- package/dist/table/index.module.css.js.map +1 -1
- package/dist/table/table.d.ts +3 -1
- package/dist/table/table.js +114 -109
- package/dist/table/table.js.map +1 -1
- package/dist/table/utils/prepare-rows.d.ts +2 -1
- package/dist/table/utils/prepare-rows.js +8 -6
- package/dist/table/utils/prepare-rows.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,96 +1,115 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Typography as
|
|
6
|
-
import { translate as
|
|
1
|
+
import { jsxs as r, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import b from "@alphakits/icons/dist/ChevronForwardS";
|
|
3
|
+
import m from "classnames";
|
|
4
|
+
import { Button as v } from "../../../button/component.js";
|
|
5
|
+
import { Typography as h } from "../../../typography/component.js";
|
|
6
|
+
import { translate as g } from "../../languages/index.js";
|
|
7
7
|
import i from "./index.module.css.js";
|
|
8
|
-
function
|
|
9
|
-
const p =
|
|
10
|
-
let
|
|
11
|
-
for (let
|
|
12
|
-
(
|
|
13
|
-
return l.forEach((
|
|
14
|
-
|
|
15
|
-
}),
|
|
8
|
+
function y(d, s) {
|
|
9
|
+
const p = d - 2, a = d + 2 + 1, l = [], c = [];
|
|
10
|
+
let o = 0;
|
|
11
|
+
for (let n = 1; n <= s; n++)
|
|
12
|
+
(n === 1 || n === s || n >= p && n < a) && l.push(n);
|
|
13
|
+
return l.forEach((n) => {
|
|
14
|
+
o && (n - o === 2 ? c.push(o + 1) : n - o !== 1 && c.push("...")), c.push(n), o = n;
|
|
15
|
+
}), c;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
pagesCount:
|
|
19
|
-
currentPage:
|
|
20
|
-
recordsPerPage:
|
|
17
|
+
const F = ({
|
|
18
|
+
pagesCount: d,
|
|
19
|
+
currentPage: s,
|
|
20
|
+
recordsPerPage: f = 30,
|
|
21
21
|
total: p,
|
|
22
|
-
language:
|
|
23
|
-
addParam: l
|
|
22
|
+
language: a,
|
|
23
|
+
addParam: l,
|
|
24
|
+
v2: c
|
|
24
25
|
}) => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
26
|
+
const o = y(s, d), n = s === 1, w = s === d, N = " ", _ = " ", u = o.length > 1 && /* @__PURE__ */ r("div", { className: i.pagination, children: [
|
|
27
|
+
/* @__PURE__ */ t(
|
|
28
|
+
v,
|
|
29
|
+
{
|
|
30
|
+
className: m(i.prev_btn, i.btn, { [i.disabled_btn]: n }),
|
|
31
|
+
leftAddons: /* @__PURE__ */ t(b, {}),
|
|
32
|
+
view: "ghost",
|
|
33
|
+
onClick: () => l({ page: s - 1 }),
|
|
34
|
+
disabled: n
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
o.map((e, x) => Number.isFinite(e) ? /* @__PURE__ */ t(
|
|
38
|
+
v,
|
|
39
|
+
{
|
|
40
|
+
className: m(
|
|
41
|
+
i.pagination_btn,
|
|
42
|
+
{ [i.active]: e === s }
|
|
43
|
+
),
|
|
44
|
+
size: "xs",
|
|
45
|
+
view: "ghost",
|
|
46
|
+
onClick: () => l({ page: e }),
|
|
47
|
+
children: e
|
|
48
|
+
},
|
|
49
|
+
e
|
|
50
|
+
) : /* @__PURE__ */ t(
|
|
51
|
+
v,
|
|
52
|
+
{
|
|
53
|
+
className: m(i.pagination_btn),
|
|
54
|
+
view: "ghost",
|
|
55
|
+
disabled: !0,
|
|
56
|
+
children: "..."
|
|
57
|
+
},
|
|
58
|
+
e + x
|
|
59
|
+
)),
|
|
60
|
+
/* @__PURE__ */ t(
|
|
61
|
+
v,
|
|
62
|
+
{
|
|
63
|
+
className: m(i.btn, { [i.disabled_btn]: w }),
|
|
64
|
+
leftAddons: /* @__PURE__ */ t(b, {}),
|
|
65
|
+
view: "ghost",
|
|
66
|
+
onClick: () => {
|
|
67
|
+
l({ page: s + 1 });
|
|
64
68
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
disabled: w
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
return c ? /* @__PURE__ */ r("div", { className: m(i.pagination_wrap, i.v2), children: [
|
|
74
|
+
/* @__PURE__ */ r("div", { className: i.pages_info, children: [
|
|
75
|
+
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "secondary", children: g(a)("totalCount") }),
|
|
76
|
+
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "primary", children: p })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ t("div", { className: i.pagination_center, children: u }),
|
|
79
|
+
/* @__PURE__ */ r("div", { className: i.select_wrap, children: [
|
|
80
|
+
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "secondary", children: g(a)("resultsOnPage") }),
|
|
81
|
+
/* @__PURE__ */ t(
|
|
82
|
+
"select",
|
|
69
83
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
l({ page: o + 1 });
|
|
84
|
+
value: f,
|
|
85
|
+
className: i.select,
|
|
86
|
+
onChange: (e) => {
|
|
87
|
+
l({ page: 1, limit: e.target.value });
|
|
75
88
|
},
|
|
76
|
-
|
|
89
|
+
children: [5, 10, 20, 30, 40, 50].map((e) => /* @__PURE__ */ t("option", { value: e, children: e }, e))
|
|
77
90
|
}
|
|
78
91
|
)
|
|
92
|
+
] })
|
|
93
|
+
] }) : /* @__PURE__ */ r("div", { className: i.pagination_wrap, children: [
|
|
94
|
+
/* @__PURE__ */ r("div", { className: i.pages_info, children: [
|
|
95
|
+
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "secondary", children: g(a)("totalCount") }),
|
|
96
|
+
/* @__PURE__ */ t(h.Text, { view: "title", weight: "medium", color: "primary", children: p })
|
|
79
97
|
] }),
|
|
80
|
-
|
|
98
|
+
u,
|
|
99
|
+
/* @__PURE__ */ t(
|
|
81
100
|
"select",
|
|
82
101
|
{
|
|
83
|
-
value:
|
|
102
|
+
value: f,
|
|
84
103
|
className: i.select,
|
|
85
|
-
onChange: (
|
|
86
|
-
l({ page: 1, limit:
|
|
104
|
+
onChange: (e) => {
|
|
105
|
+
l({ page: 1, limit: e.target.value });
|
|
87
106
|
},
|
|
88
|
-
children: [5, 10, 20, 30, 40, 50].map((
|
|
107
|
+
children: [5, 10, 20, 30, 40, 50].map((e) => /* @__PURE__ */ t("option", { value: e, children: `${g(a)("resultsOnPage")}${N}${e}${_}` }, e))
|
|
89
108
|
}
|
|
90
109
|
)
|
|
91
110
|
] });
|
|
92
111
|
};
|
|
93
112
|
export {
|
|
94
|
-
|
|
113
|
+
F as Pagination
|
|
95
114
|
};
|
|
96
115
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/table/components/pagination/index.tsx"],"sourcesContent":["import React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Button } from '../../../button';\nimport { Typography } from '../../../typography';\nimport { translate } from '../../languages';\n\nimport styles from './index.module.css';\n\nfunction pagination(current: number, last: number) {\n const delta = 2;\n const left = current - delta;\n const right = current + delta + 1;\n const range = [];\n const rangeWithDots: any = [];\n let l = 0;\n\n for (let i = 1; i <= last; i++) {\n if (i === 1 || i === last || (i >= left && i < right)) {\n range.push(i);\n }\n }\n\n range.forEach((i: number) => {\n if (l) {\n if (i - l === 2) {\n rangeWithDots.push(l + 1);\n } else if (i - l !== 1) {\n rangeWithDots.push('...');\n }\n }\n rangeWithDots.push(i);\n l = i;\n });\n\n return rangeWithDots;\n}\n\ntype Props = {\n pagesCount: number;\n currentPage: number;\n recordsPerPage: number;\n total: number;\n addParam: (param: Record<string, unknown>) => void;\n language: 'en' | 'de' | 'ru';\n};\n\nexport const Pagination: React.FC<Props> = ({\n pagesCount,\n currentPage,\n recordsPerPage = 30,\n total,\n language,\n addParam,\n}) => {\n const pg = pagination(currentPage, pagesCount);\n\n const disablePreviewsPage = currentPage === 1;\n const disableNextPage = currentPage === pagesCount;\n\n const space = '\\xa0\\xa0\\xa0\\xa0';\n const spaceAfter = '\\xa0\\xa0\\xa0';\n\n return (\n <div className={ styles.pagination_wrap }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n { pg.length > 1 && (\n <div className={ styles.pagination }>\n <Button\n className={ cn(styles.prev_btn, styles.btn, { [styles.disabled_btn]: disablePreviewsPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => addParam({ page: currentPage - 1 }) }\n disabled={ disablePreviewsPage }\n />\n { pg.map((p: number, i: number) =>\n (Number.isFinite(p) ? (\n <Button\n className={ cn(\n styles.pagination_btn,\n { [styles.active]: p === currentPage },\n ) }\n size=\"xs\"\n view=\"ghost\"\n key={ p }\n onClick={ () => addParam({ page: p }) }\n >\n { p }\n </Button>\n ) : (\n <Button\n // eslint-disable-next-line react/no-array-index-key\n key={ p + i }\n className={ cn(\n styles.pagination_btn,\n ) }\n view=\"ghost\"\n disabled={ true }\n >\n ...\n </Button>\n ))) }\n <Button\n className={ cn(styles.btn, { [styles.disabled_btn]: disableNextPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => {\n addParam({ page: currentPage + 1 });\n } }\n disabled={ disableNextPage }\n />\n </div>\n ) }\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { `${translate(language)('resultsOnPage')}${space}${size}${spaceAfter}` }\n </option>\n )) }\n </select>\n </div>\n );\n};\n"],"names":["pagination","current","last","left","right","range","rangeWithDots","l","i","Pagination","pagesCount","currentPage","recordsPerPage","total","language","addParam","pg","disablePreviewsPage","disableNextPage","space","spaceAfter","jsxs","styles","jsx","Typography","translate","Button","cn","ChevronForwardS","p","e","size"],"mappings":";;;;;;;AAUA,SAASA,EAAWC,GAAiBC,GAAc;AAE/C,QAAMC,IAAOF,IAAU,GACjBG,IAAQH,IAAU,IAAQ,GAC1BI,IAAQ,CAAA,GACRC,IAAqB,CAAA;AAC3B,MAAIC,IAAI;AAER,WAASC,IAAI,GAAGA,KAAKN,GAAMM;AACvB,KAAIA,MAAM,KAAKA,MAAMN,KAASM,KAAKL,KAAQK,IAAIJ,MAC3CC,EAAM,KAAKG,CAAC;AAIpB,SAAAH,EAAM,QAAQ,CAACG,MAAc;AACzB,IAAID,MACIC,IAAID,MAAM,IACVD,EAAc,KAAKC,IAAI,CAAC,IACjBC,IAAID,MAAM,KACjBD,EAAc,KAAK,KAAK,IAGhCA,EAAc,KAAKE,CAAC,GACpBD,IAAIC;AAAA,EACR,CAAC,GAEMF;AACX;AAWO,MAAMG,IAA8B,CAAC;AAAA,EACxC,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACJ,MAAM;AACF,QAAMC,IAAKhB,EAAWW,GAAaD,CAAU,GAEvCO,IAAsBN,MAAgB,GACtCO,IAAkBP,MAAgBD,GAElCS,IAAQ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AAAA,QAAA;AAAA,QANSO,IAAIrB;AAAA,MAAA,CAShB;AAAA,MACN,gBAAAe;AAAA,QAACG;AAAA,QAAA;AAAA,UACG,WAAYC,EAAGL,EAAO,KAAK,EAAE,CAACA,EAAO,YAAY,GAAGJ,GAAiB;AAAA,UACrE,8BAAcU,GAAA,EAAgB;AAAA,UAC9B,MAAK;AAAA,UACL,SAAU,MAAM;AACZ,YAAAb,EAAS,EAAE,MAAMJ,IAAc,EAAA,CAAG;AAAA,UACtC;AAAA,UACA,UAAWO;AAAA,QAAA;AAAA,MAAA;AAAA,IACf,GACJ;AAAA,IAGJ,gBAAAK;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,OAAQX;AAAA,QACR,WAAYU,EAAO;AAAA,QACnB,UAAW,CAACQ,MAAM;AACd,UAAAf,EAAS,EAAE,MAAM,GAAG,OAAOe,EAAE,OAAO,OAAO;AAAA,QAC/C;AAAA,QAEE,UAAA,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,EAAE,EAAE,IAAI,CAACC,MAC3B,gBAAAR,EAAC,UAAA,EAAoB,OAAQQ,GACvB,UAAA,GAAGN,EAAUX,CAAQ,EAAE,eAAe,CAAC,GAAGK,CAAK,GAAGY,CAAI,GAAGX,CAAU,GAAA,GAD3DW,CAEd,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/table/components/pagination/index.tsx"],"sourcesContent":["import React from 'react';\nimport ChevronForwardS from '@alphakits/icons/dist/ChevronForwardS';\nimport cn from 'classnames';\n\nimport { Button } from '../../../button';\nimport { Typography } from '../../../typography';\nimport { translate } from '../../languages';\n\nimport styles from './index.module.css';\n\nfunction pagination(current: number, last: number) {\n const delta = 2;\n const left = current - delta;\n const right = current + delta + 1;\n const range = [];\n const rangeWithDots: any = [];\n let l = 0;\n\n for (let i = 1; i <= last; i++) {\n if (i === 1 || i === last || (i >= left && i < right)) {\n range.push(i);\n }\n }\n\n range.forEach((i: number) => {\n if (l) {\n if (i - l === 2) {\n rangeWithDots.push(l + 1);\n } else if (i - l !== 1) {\n rangeWithDots.push('...');\n }\n }\n rangeWithDots.push(i);\n l = i;\n });\n\n return rangeWithDots;\n}\n\ntype Props = {\n pagesCount: number;\n currentPage: number;\n recordsPerPage: number;\n total: number;\n addParam: (param: Record<string, unknown>) => void;\n language: 'en' | 'de' | 'ru';\n v2?: boolean;\n};\n\nexport const Pagination: React.FC<Props> = ({\n pagesCount,\n currentPage,\n recordsPerPage = 30,\n total,\n language,\n addParam,\n v2,\n}) => {\n const pg = pagination(currentPage, pagesCount);\n\n const disablePreviewsPage = currentPage === 1;\n const disableNextPage = currentPage === pagesCount;\n\n const space = '\\xa0\\xa0\\xa0\\xa0';\n const spaceAfter = '\\xa0\\xa0\\xa0';\n\n const paginationButtons = pg.length > 1 && (\n <div className={ styles.pagination }>\n <Button\n className={ cn(styles.prev_btn, styles.btn, { [styles.disabled_btn]: disablePreviewsPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => addParam({ page: currentPage - 1 }) }\n disabled={ disablePreviewsPage }\n />\n { pg.map((p: number, i: number) =>\n (Number.isFinite(p) ? (\n <Button\n className={ cn(\n styles.pagination_btn,\n { [styles.active]: p === currentPage },\n ) }\n size=\"xs\"\n view=\"ghost\"\n key={ p }\n onClick={ () => addParam({ page: p }) }\n >\n { p }\n </Button>\n ) : (\n <Button\n // eslint-disable-next-line react/no-array-index-key\n key={ p + i }\n className={ cn(styles.pagination_btn) }\n view=\"ghost\"\n disabled={ true }\n >\n ...\n </Button>\n ))) }\n <Button\n className={ cn(styles.btn, { [styles.disabled_btn]: disableNextPage }) }\n leftAddons={ <ChevronForwardS /> }\n view=\"ghost\"\n onClick={ () => {\n addParam({ page: currentPage + 1 });\n } }\n disabled={ disableNextPage }\n />\n </div>\n );\n\n if (v2) {\n return (\n <div className={ cn(styles.pagination_wrap, styles.v2) }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n <div className={ styles.pagination_center }>\n { paginationButtons }\n </div>\n\n <div className={ styles.select_wrap }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('resultsOnPage') }\n </Typography.Text>\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { size }\n </option>\n )) }\n </select>\n </div>\n </div>\n );\n }\n\n return (\n <div className={ styles.pagination_wrap }>\n <div className={ styles.pages_info }>\n <Typography.Text view=\"title\" weight=\"medium\" color=\"secondary\">\n { translate(language)('totalCount') }\n </Typography.Text>\n\n <Typography.Text view=\"title\" weight=\"medium\" color=\"primary\">\n { total }\n </Typography.Text>\n </div>\n\n { paginationButtons }\n\n <select\n value={ recordsPerPage }\n className={ styles.select }\n onChange={ (e) => {\n addParam({ page: 1, limit: e.target.value });\n } }\n >\n { [5, 10, 20, 30, 40, 50].map((size) => (\n <option key={ size } value={ size }>\n { `${translate(language)('resultsOnPage')}${space}${size}${spaceAfter}` }\n </option>\n )) }\n </select>\n </div>\n );\n};\n"],"names":["pagination","current","last","left","right","range","rangeWithDots","l","i","Pagination","pagesCount","currentPage","recordsPerPage","total","language","addParam","v2","pg","disablePreviewsPage","disableNextPage","space","spaceAfter","paginationButtons","styles","jsx","Button","cn","ChevronForwardS","p","jsxs","Typography","translate","size"],"mappings":";;;;;;;AAUA,SAASA,EAAWC,GAAiBC,GAAc;AAE/C,QAAMC,IAAOF,IAAU,GACjBG,IAAQH,IAAU,IAAQ,GAC1BI,IAAQ,CAAA,GACRC,IAAqB,CAAA;AAC3B,MAAIC,IAAI;AAER,WAASC,IAAI,GAAGA,KA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AAA,GAD3DW,CAEd,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.pagination_wrap_kmil{height:32px;min-height:32px;padding:16px 48px 16px 0;display:flex;align-items:center;background-color:var(--color-bg-primary);position:sticky;bottom:0;box-shadow:0 -11px 13px -13px var(--color-border-primary)}.pagination_36rf{display:grid;grid-column-gap:16px;-moz-column-gap:16px;column-gap:16px;grid-auto-flow:column}.
|
|
1
|
+
.pagination_wrap_kmil{height:32px;min-height:32px;padding:16px 48px 16px 0;display:flex;align-items:center;background-color:var(--color-bg-primary);position:sticky;bottom:0;box-shadow:0 -11px 13px -13px var(--color-border-primary)}.pagination_wrap_kmil>*:not(:last-child){margin-right:16px}.pages_info_9Quw{min-width:340px;display:flex;gap:8px}.pagination_36rf{display:grid;grid-column-gap:16px;-moz-column-gap:16px;column-gap:16px;grid-auto-flow:column}.prev_btn_UnDy svg{transform:rotate(180deg)}.disabled_btn_G6J6{opacity:.5}.pagination_btn_vexg{color:var(--color-text-secondary)!important;font-weight:500;min-width:24px}.btn_-Zrx{min-width:24px!important}.pagination_btn_vexg.active_F46k{color:var(--color-text-primary)!important;font-weight:700}.select_XysE{border:none;outline:none;position:absolute;background:transparent;right:0;font-weight:500;font-size:14px;color:var(--color-text-primary)}.v2_vDHk.pagination_wrap_kmil{height:auto;min-height:40px;padding:4px 24px;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;grid-gap:16px;gap:16px;border:1px solid var(--color-border-secondary);border-radius:0 0 12px 12px;box-shadow:none;font-size:14px}.v2_vDHk.pagination_wrap_kmil>*:not(:last-child){margin-right:0}.v2_vDHk .pages_info_9Quw{min-width:0;gap:8px;align-items:baseline;color:var(--color-text-secondary);justify-self:start}.pagination_center_rtzL{display:flex;justify-content:center;justify-self:center;grid-column:2}.v2_vDHk .pagination_36rf{-moz-column-gap:4px;column-gap:4px;align-items:center}.v2_vDHk .pagination_btn_vexg{min-width:28px!important;height:28px!important;padding:0 6px!important;border-radius:6px!important;background-color:transparent!important}.v2_vDHk .pagination_btn_vexg:hover{background-color:var(--color-bg-secondary)!important}.v2_vDHk .pagination_btn_vexg.active_F46k{color:var(--color-text-primary)!important;font-weight:700;background-color:transparent!important}.v2_vDHk .btn_-Zrx{min-width:28px!important;height:28px!important;padding:0!important;color:var(--color-text-secondary)!important}.v2_vDHk .disabled_btn_G6J6{opacity:.4}.select_wrap_QwzZ{justify-self:end;grid-column:3;display:flex;align-items:center;gap:12px;color:var(--color-text-secondary)}.v2_vDHk .select_XysE{position:static;margin:0;border:1px solid var(--color-border-secondary);outline:none;border-radius:8px;height:32px;padding:0 28px 0 12px;font-weight:500;font-size:14px;line-height:1;color:var(--color-text-primary);background-color:var(--color-bg-primary);cursor:pointer;appearance:none;-webkit-appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--color-graphic-secondary, var(--color-text-secondary)) 50%),linear-gradient(135deg,var(--color-graphic-secondary, var(--color-text-secondary)) 50%,transparent 50%);background-position:calc(100% - 14px) 50%,calc(100% - 9px) 50%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}.v2_vDHk .select_XysE:focus-visible{outline:2px solid var(--color-border-link, var(--color-graphic-accent));outline-offset:1px}
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const n = "pagination_wrap_kmil", t = "
|
|
2
|
+
const n = "pagination_wrap_kmil", t = "pages_info_9Quw", a = "pagination_36rf", e = "prev_btn_UnDy", i = "disabled_btn_G6J6", _ = "pagination_btn_vexg", o = "btn_-Zrx", s = "active_F46k", c = "select_XysE", p = "v2_vDHk", g = "pagination_center_rtzL", r = "select_wrap_QwzZ", b = {
|
|
3
3
|
pagination_wrap: n,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
prev_btn:
|
|
7
|
-
disabled_btn:
|
|
8
|
-
pagination_btn:
|
|
9
|
-
btn:
|
|
10
|
-
active:
|
|
11
|
-
select:
|
|
4
|
+
pages_info: t,
|
|
5
|
+
pagination: a,
|
|
6
|
+
prev_btn: e,
|
|
7
|
+
disabled_btn: i,
|
|
8
|
+
pagination_btn: _,
|
|
9
|
+
btn: o,
|
|
10
|
+
active: s,
|
|
11
|
+
select: c,
|
|
12
|
+
v2: p,
|
|
13
|
+
pagination_center: g,
|
|
14
|
+
select_wrap: r
|
|
12
15
|
};
|
|
13
16
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
s as active,
|
|
18
|
+
o as btn,
|
|
19
|
+
b as default,
|
|
20
|
+
i as disabled_btn,
|
|
21
|
+
t as pages_info,
|
|
22
|
+
a as pagination,
|
|
23
|
+
_ as pagination_btn,
|
|
24
|
+
g as pagination_center,
|
|
21
25
|
n as pagination_wrap,
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
e as prev_btn,
|
|
27
|
+
c as select,
|
|
28
|
+
r as select_wrap,
|
|
29
|
+
p as v2
|
|
24
30
|
};
|
|
25
31
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -1,77 +1,79 @@
|
|
|
1
|
-
import { jsxs as r, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useState as f, useEffect as p, useRef as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useDebounce as
|
|
6
|
-
import
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { HeaderSearch as
|
|
10
|
-
import { translate as
|
|
1
|
+
import { jsxs as r, jsx as n, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as p, useRef as A, useCallback as b } from "react";
|
|
3
|
+
import B from "@alphakits/icons/dist/ControllerS";
|
|
4
|
+
import E from "@alphakits/icons/dist/PlusS";
|
|
5
|
+
import { useDebounce as H } from "rooks";
|
|
6
|
+
import I from "classnames";
|
|
7
|
+
import { Button as g } from "../../../button/component.js";
|
|
8
|
+
import { Flex as P } from "../../../flex/component.js";
|
|
9
|
+
import { HeaderSearch as _ } from "../../../header-search/component.js";
|
|
10
|
+
import { translate as q } from "../../languages/index.js";
|
|
11
11
|
import t from "./index.module.css.js";
|
|
12
|
-
const
|
|
13
|
-
tags:
|
|
14
|
-
searchPlaceholder:
|
|
12
|
+
const Z = ({
|
|
13
|
+
tags: m,
|
|
14
|
+
searchPlaceholder: v = "Type something..",
|
|
15
15
|
searchText: o,
|
|
16
|
-
hideSearch:
|
|
17
|
-
compact:
|
|
18
|
-
rightHeaderAddons:
|
|
19
|
-
leftHeaderAddons:
|
|
20
|
-
addParam:
|
|
16
|
+
hideSearch: C,
|
|
17
|
+
compact: S = !1,
|
|
18
|
+
rightHeaderAddons: V,
|
|
19
|
+
leftHeaderAddons: s,
|
|
20
|
+
addParam: y,
|
|
21
21
|
onCreateClick: a,
|
|
22
|
-
onFiltersClick:
|
|
22
|
+
onFiltersClick: N,
|
|
23
23
|
createButtonLabel: h,
|
|
24
24
|
showFiltersButton: j,
|
|
25
25
|
filtersButtonLabel: D,
|
|
26
|
-
language: k
|
|
26
|
+
language: k,
|
|
27
|
+
v2: w
|
|
27
28
|
}) => {
|
|
28
|
-
const [
|
|
29
|
+
const [z, d] = f(o != null ? o : ""), [c, u] = f(o != null ? o : "");
|
|
29
30
|
p(() => {
|
|
30
31
|
const e = `${o != null ? o : ""}`;
|
|
31
32
|
l.current = e.trim(), d(e), u(e);
|
|
32
33
|
}, [o]);
|
|
33
|
-
const
|
|
34
|
+
const F = H((e) => u(e), 500), l = A("");
|
|
34
35
|
p(() => {
|
|
35
36
|
const e = `${c || ""}`.trim();
|
|
36
|
-
l.current !== e && (
|
|
37
|
+
l.current !== e && (y({ searchText: e, page: 1 }), l.current = e);
|
|
37
38
|
}, [c]);
|
|
38
39
|
const i = b((e) => {
|
|
39
|
-
d(e),
|
|
40
|
-
}, []),
|
|
40
|
+
d(e), F(e);
|
|
41
|
+
}, []), R = b(() => {
|
|
41
42
|
i("");
|
|
42
43
|
}, [i]);
|
|
43
|
-
return /* @__PURE__ */ r("div", { className:
|
|
44
|
+
return /* @__PURE__ */ r("div", { className: I(t.table_header, { [t.compact]: S }), children: [
|
|
44
45
|
/* @__PURE__ */ r("div", { className: t.actions, children: [
|
|
45
|
-
/* @__PURE__ */ r(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
I,
|
|
46
|
+
/* @__PURE__ */ r(P, { justify: "start", gap: "md", children: [
|
|
47
|
+
!C && /* @__PURE__ */ n(
|
|
48
|
+
_,
|
|
49
49
|
{
|
|
50
|
-
value:
|
|
50
|
+
value: z,
|
|
51
51
|
onChange: i,
|
|
52
|
-
onClear:
|
|
53
|
-
placeholder:
|
|
52
|
+
onClear: R,
|
|
53
|
+
placeholder: v,
|
|
54
|
+
v2: w
|
|
54
55
|
}
|
|
55
|
-
)
|
|
56
|
+
),
|
|
57
|
+
s && /* @__PURE__ */ n($, { children: s })
|
|
56
58
|
] }),
|
|
57
59
|
/* @__PURE__ */ r("div", { className: t.buttons, children: [
|
|
58
|
-
|
|
60
|
+
V,
|
|
59
61
|
!!a && /* @__PURE__ */ n(
|
|
60
|
-
|
|
62
|
+
g,
|
|
61
63
|
{
|
|
62
64
|
dataTestId: "createbtn",
|
|
63
65
|
onClick: a,
|
|
64
66
|
view: "primary",
|
|
65
|
-
leftAddons: /* @__PURE__ */ n(
|
|
67
|
+
leftAddons: /* @__PURE__ */ n(E, {}),
|
|
66
68
|
size: "xs",
|
|
67
|
-
children: h ||
|
|
69
|
+
children: h || q(k)("create")
|
|
68
70
|
}
|
|
69
71
|
),
|
|
70
72
|
j && /* @__PURE__ */ n(
|
|
71
|
-
|
|
73
|
+
g,
|
|
72
74
|
{
|
|
73
|
-
leftAddons: /* @__PURE__ */ n(
|
|
74
|
-
onClick:
|
|
75
|
+
leftAddons: /* @__PURE__ */ n(B, {}),
|
|
76
|
+
onClick: N,
|
|
75
77
|
view: "outlined",
|
|
76
78
|
size: "xs",
|
|
77
79
|
children: D
|
|
@@ -79,10 +81,10 @@ const X = ({
|
|
|
79
81
|
)
|
|
80
82
|
] })
|
|
81
83
|
] }),
|
|
82
|
-
!!
|
|
84
|
+
!!m.length && /* @__PURE__ */ n("div", { className: t.tags, children: m })
|
|
83
85
|
] });
|
|
84
86
|
};
|
|
85
87
|
export {
|
|
86
|
-
|
|
88
|
+
Z as TableHeader
|
|
87
89
|
};
|
|
88
90
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/table/components/table-header/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React, {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/table/components/table-header/index.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\nimport ControllerS from '@alphakits/icons/dist/ControllerS';\nimport PlusS from '@alphakits/icons/dist/PlusS';\nimport { useDebounce } from 'rooks';\nimport cn from 'classnames';\n\nimport { Button } from '../../../button';\nimport { Flex } from '../../../flex';\nimport { HeaderSearch } from '../../../header-search';\nimport { translate } from '../../languages';\nimport { Query } from '../../types';\n\nimport styles from './index.module.css';\n\ntype Props = {\n tags: JSX.Element[];\n searchPlaceholder: string;\n searchText?: string;\n addParam: (val: Query) => void;\n onCreateClick?: () => void;\n onFiltersClick?: () => void;\n language: 'en' | 'de' | 'ru';\n showFiltersButton: boolean;\n filtersButtonLabel?: string;\n createButtonLabel?: string;\n rightHeaderAddons?: React.ReactNode;\n leftHeaderAddons?: React.ReactNode;\n hideSearch?: boolean;\n compact?: boolean;\n v2?: boolean;\n};\n\nexport const TableHeader: React.FC<Props> = ({\n tags,\n searchPlaceholder = 'Type something..',\n searchText,\n hideSearch,\n compact = false,\n rightHeaderAddons,\n leftHeaderAddons,\n addParam,\n onCreateClick,\n onFiltersClick,\n createButtonLabel,\n showFiltersButton,\n filtersButtonLabel,\n language,\n v2,\n}) => {\n // локальное состояние поля ввода\n const [value, setValue] = useState<string>(searchText ?? '');\n const [debouncedValue, setDebouncedValue] = useState<string>(searchText ?? '');\n\n // если проп searchText меняется извне — синхронизируем локальные стейты\n useEffect(() => {\n const v = `${searchText ?? ''}`;\n\n lastSentRef.current = v.trim();\n setValue(v);\n setDebouncedValue(v);\n }, [searchText]);\n\n // дебаунсим только установку debouncedValue\n const setValueDebounced = useDebounce((v: string) => setDebouncedValue(v), 500);\n\n // не отправляем одинаковые значения повторно\n const lastSentRef = useRef<string>('');\n\n useEffect(() => {\n const next = `${debouncedValue || ''}`.trim();\n\n if (lastSentRef.current === next) return;\n\n addParam({ searchText: next, page: 1 });\n lastSentRef.current = next;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debouncedValue]);\n\n const handleChangeValue = useCallback((v: string) => {\n setValue(v);\n setValueDebounced(v);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleClear = useCallback(() => {\n // достаточно обнулить значение — эффект сам отправит пустую строку\n handleChangeValue('');\n }, [handleChangeValue]);\n\n return (\n <div className={cn(styles.table_header, { [styles.compact]: compact })}>\n <div className={styles.actions}>\n <Flex justify='start' gap='md'>\n {!hideSearch && (\n <HeaderSearch\n value={value}\n onChange={handleChangeValue}\n onClear={handleClear}\n placeholder={searchPlaceholder}\n v2={v2}\n />\n )}\n\n {leftHeaderAddons && (\n <>{leftHeaderAddons}</>\n )}\n </Flex>\n\n <div className={styles.buttons}>\n {rightHeaderAddons}\n\n {!!onCreateClick && (\n <Button\n dataTestId='createbtn'\n onClick={onCreateClick}\n view='primary'\n leftAddons={<PlusS />}\n size='xs'\n >\n {createButtonLabel || translate(language)('create')}\n </Button>\n )}\n\n {showFiltersButton && (\n <Button\n leftAddons={<ControllerS />}\n onClick={onFiltersClick}\n view='outlined'\n size='xs'\n >\n {filtersButtonLabel}\n </Button>\n )}\n </div>\n </div>\n\n {!!tags.length && <div className={styles.tags}>{tags}</div>}\n </div>\n );\n};\n"],"names":["TableHeader","tags","searchPlaceholder","searchText","hideSearch","compact","rightHeaderAddons","leftHeaderAddons","addParam","onCreateClick","onFiltersClick","createButtonLabel","showFiltersButton","filtersButtonLabel","language","v2","value","setValue","useState","debouncedValue","setDebouncedValue","useEffect","v","lastSentRef","setValueDebounced","useDebounce","useRef","next","handleChangeValue","useCallback","handleClear","jsxs","cn","styles","Flex","jsx","HeaderSearch","Button","PlusS","translate","ControllerS"],"mappings":";;;;;;;;;;;AAiCO,MAAMA,IAA+B,CAAC;AAAA,EACzC,MAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,IAAAC;AACJ,MAAM;AAEF,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAiBf,KAAA,OAAAA,IAAc,EAAE,GACrD,CAACgB,GAAgBC,CAAiB,IAAIF,EAAiBf,KAAA,OAAAA,IAAc,EAAE;AAG7E,EAAAkB,EAAU,MAAM;AACZ,UAAMC,IAAI,GAAGnB,KAAA,OAAAA,IAAc,EAAE;AAE7B,IAAAoB,EAAY,UAAUD,EAAE,KAAA,GACxBL,EAASK,CAAC,GACVF,EAAkBE,CAAC;AAAA,EACvB,GAAG,CAACnB,CAAU,CAAC;AAGf,QAAMqB,IAAoBC,EAAY,CAACH,MAAcF,EAAkBE,CAAC,GAAG,GAAG,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E,QAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAIzDF,KACG,gBAAAuB;AAAA,UAACE;AAAA,UAAA;AAAA,YACG,8BAAaG,GAAA,EAAY;AAAA,YACzB,SAAS9B;AAAA,YACT,MAAK;AAAA,YACL,MAAK;AAAA,YAEJ,UAAAG;AAAA,UAAA;AAAA,QAAA;AAAA,MACL,EAAA,CAER;AAAA,IAAA,GACJ;AAAA,IAEC,CAAC,CAACZ,EAAK,4BAAW,OAAA,EAAI,WAAWgC,EAAO,MAAO,UAAAhC,EAAA,CAAK;AAAA,EAAA,GACzD;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.table_header_GXu4{width:100%;margin-bottom:
|
|
1
|
+
.table_header_GXu4{width:100%;margin-bottom:20px}.actions_GZKJ{display:flex;align-items:center;justify-content:space-between;gap:12px}.tags_PpKz{margin-top:12px;display:flex;flex-wrap:wrap;margin-right:-12px}.tags_PpKz>*:not(:last-child):not(:only-child){margin-right:12px}.tags_PpKz>*{margin:4px 0}.tag_SqNT{margin-right:12px}.buttons_3CQY{display:flex;align-items:center;gap:8px}.buttons_3CQY button:not(:last-child){margin-right:0}.compact_ull- .leftHeaderAddons_W8Yb{margin-right:12px!important}.compact_ull- .tags_PpKz{margin-top:8px;margin-right:-8px}.compact_ull- .tags_PpKz>*:not(:last-child):not(:only-child){margin-right:8px}.compact_ull- .tag_SqNT{margin-right:8px}.compact_ull- .buttons_3CQY button:not(:last-child){margin-right:8px}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const t = "table_header_GXu4", s = "actions_GZKJ",
|
|
2
|
+
const t = "table_header_GXu4", s = "actions_GZKJ", a = "tags_PpKz", o = "buttons_3CQY", c = "compact_ull-", e = {
|
|
3
3
|
table_header: t,
|
|
4
4
|
actions: s,
|
|
5
|
-
leftHeaderAddons: e,
|
|
6
5
|
tags: a,
|
|
7
6
|
buttons: o,
|
|
8
7
|
compact: c
|
|
@@ -11,8 +10,7 @@ export {
|
|
|
11
10
|
s as actions,
|
|
12
11
|
o as buttons,
|
|
13
12
|
c as compact,
|
|
14
|
-
|
|
15
|
-
e as leftHeaderAddons,
|
|
13
|
+
e as default,
|
|
16
14
|
t as table_header,
|
|
17
15
|
a as tags
|
|
18
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--text-primary-color: var(--color-text-primary);--text-secondary-color: var(--color-text-secondary);--text-tertiary-color: var(--color-text-tertiary);--border-radius: 4px;--focus-color: var(--color-border-link);--font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, sans-serif;--disabled-cursor: not-allowed;--arrow-transform: rotate(180deg)}.table_wrapper_SeB5{width:100%;box-sizing:border-box;position:relative}.table_wrapper_SeB5 .table_9sbd{position:relative;box-sizing:border-box}:is(.table_wrapper_SeB5 .table_9sbd) table{width:100%}.fill_Q-ic{height:-webkit-fill-available;flex-grow:1;display:flex;flex-direction:column}.fill_Q-ic .table_9sbd{flex-grow:1;overflow:hidden}:is(.fill_Q-ic .table_9sbd):hover{overflow:auto}.clickable_k4S8{cursor:pointer}.clickable_k4S8:hover td{background-color:var(--color-bg-special-big-objects)}
|
|
1
|
+
:root{--text-primary-color: var(--color-text-primary);--text-secondary-color: var(--color-text-secondary);--text-tertiary-color: var(--color-text-tertiary);--border-radius: 4px;--focus-color: var(--color-border-link);--font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, sans-serif;--disabled-cursor: not-allowed;--arrow-transform: rotate(180deg)}.table_wrapper_SeB5{width:100%;box-sizing:border-box;position:relative}.table_wrapper_SeB5 .table_9sbd{position:relative;box-sizing:border-box}:is(.table_wrapper_SeB5 .table_9sbd) table{width:100%}.fill_Q-ic{height:-webkit-fill-available;flex-grow:1;display:flex;flex-direction:column}.fill_Q-ic .table_9sbd{flex-grow:1;overflow:hidden}:is(.fill_Q-ic .table_9sbd):hover{overflow:auto}.clickable_k4S8{cursor:pointer}.clickable_k4S8:hover td{background-color:var(--color-bg-special-big-objects)}.v2_roBT .table_9sbd{border:1px solid var(--color-border-secondary);border-radius:12px 12px 0 0;background:var(--color-bg-primary);box-shadow:var(--shadow-xs);overflow:hidden}.v2_roBT .table_9sbd table{border-collapse:collapse;background:var(--color-bg-primary)}.v2_roBT .table_9sbd tbody tr td{transition:background-color .15s ease}.v2_roBT .clickable_k4S8:hover td{background-color:color-mix(in srgb,var(--color-bg-secondary) 92%,var(--color-bg-primary))}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import './index.module.css';
|
|
2
|
-
const l = "table_wrapper_SeB5", t = "table_9sbd",
|
|
2
|
+
const l = "table_wrapper_SeB5", t = "table_9sbd", c = "fill_Q-ic", a = "compact_kbrU", e = "clickable_k4S8", o = "v2_roBT", b = {
|
|
3
3
|
table_wrapper: l,
|
|
4
4
|
table: t,
|
|
5
|
-
fill:
|
|
5
|
+
fill: c,
|
|
6
6
|
default: "default_BxOw",
|
|
7
|
-
compact:
|
|
8
|
-
clickable: e
|
|
7
|
+
compact: a,
|
|
8
|
+
clickable: e,
|
|
9
|
+
v2: o
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
11
12
|
e as clickable,
|
|
12
|
-
|
|
13
|
+
a as compact,
|
|
13
14
|
b as default,
|
|
14
|
-
|
|
15
|
+
c as fill,
|
|
15
16
|
t as table,
|
|
16
|
-
l as table_wrapper
|
|
17
|
+
l as table_wrapper,
|
|
18
|
+
o as v2
|
|
17
19
|
};
|
|
18
20
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
package/dist/table/table.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ export type TableProps<T extends object> = Records<T> & {
|
|
|
35
35
|
language: 'de' | 'ru' | 'en';
|
|
36
36
|
/** true — параметры из URL; false — только локальное состояние. */
|
|
37
37
|
fromPath?: boolean;
|
|
38
|
+
/** Новый визуал таблицы (поиск в обводке, контейнер таблицы с тенью, обновлённый футер). */
|
|
39
|
+
v2?: boolean;
|
|
38
40
|
} & FiltersButton;
|
|
39
|
-
export declare function Table<T extends object>({ columns, searchPlaceholder, records, hideSearch, rightHeaderAddons, leftHeaderAddons, filtersButtonLabel, createButtonLabel, loading, height, view, tagsBuilder, promise, onRowClick, onCreateClick, onFiltersClick, refetch, language, fromPath, }: TableProps<T>): JSX.Element;
|
|
41
|
+
export declare function Table<T extends object>({ columns, searchPlaceholder, records, hideSearch, rightHeaderAddons, leftHeaderAddons, filtersButtonLabel, createButtonLabel, loading, height, view, tagsBuilder, promise, onRowClick, onCreateClick, onFiltersClick, refetch, language, fromPath, v2, }: TableProps<T>): JSX.Element;
|
|
40
42
|
export {};
|