@mailstep/design-system 0.6.5 → 0.6.6
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/package.json +1 -1
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +1 -1
- package/ui/Elements/Pagination/Pagination.d.ts +4 -2
- package/ui/Elements/Pagination/Pagination.js +11 -15
- package/ui/Elements/Pagination/index.d.ts +1 -0
- package/ui/Elements/Pagination/stories/Pagination.stories.d.ts +3 -2
- package/ui/Elements/Pagination/stories/Pagination.stories.js +28 -2
- package/ui/Elements/Spinner/styles.js +1 -2
- package/ui/index.es.js +23 -21
- package/ui/index.umd.js +2 -2
package/package.json
CHANGED
|
@@ -61,6 +61,6 @@ var StyledCommonGrid = function (props) {
|
|
|
61
61
|
gridSelectors: gridSelectors,
|
|
62
62
|
onClose: onClose,
|
|
63
63
|
}), columnsConfigValues = _d.columnsConfigValues, setColumnsConfigOptions = _d.setColumnsConfigOptions, onConfirmForm = _d.onConfirmForm, resetColumnConfig = _d.resetColumnConfig, handleDragEnd = _d.handleDragEnd, onCloseForm = _d.onCloseForm, displayColumnsDefinitions = _d.displayColumnsDefinitions, manageColumnsFormDefinitions = _d.manageColumnsFormDefinitions;
|
|
64
|
-
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", sizing: "iconLg", appearance: "ghost", icon: _jsx(Settings2, {}), onClick: openManageColumnForm, children: _jsx(H6, { variant: "semiBold", children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, height: gridHeight, floatingButtonProps: floatingButtonProps, handleDragEnd: handleDragEnd(false), displayColumnsDefinitions: displayColumnsDefinitions, hasColouredRows: true }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isFixed: !!gridHeight, children: [processCheckedValues && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', children: [_jsx(Pagination, { page: gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.page, itemCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount, itemPerPage: (gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) || 10, onPageChange: gridActions === null || gridActions === void 0 ? void 0 : gridActions.setPage, customPaginationHandler: customPaginationHandler }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors, customPaginationHandler: customPaginationHandler })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose: onCloseForm, onCancel: onCloseForm, onExtraAction: resetColumnConfig, onConfirm: onConfirmForm, width: "auto", minWidth: "350px", hasFooter: true, extraActionLabel: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }), cancelLabel: _jsx(Trans, { id: "form.buttonCancel", message: "Cancel" }), confirmLabel: _jsx(Trans, { id: "form.buttonConfirm", message: "Confirm" }), children: _jsx(ManageColumnForm, { columns: manageColumnsFormDefinitions, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, handleDragEnd: handleDragEnd(true) }) }))] }));
|
|
64
|
+
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", sizing: "iconLg", appearance: "ghost", icon: _jsx(Settings2, {}), onClick: openManageColumnForm, children: _jsx(H6, { variant: "semiBold", children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, height: gridHeight, floatingButtonProps: floatingButtonProps, handleDragEnd: handleDragEnd(false), displayColumnsDefinitions: displayColumnsDefinitions, hasColouredRows: true }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isFixed: !!gridHeight, children: [processCheckedValues && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', children: [_jsx(Pagination, { page: gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.page, itemCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount, itemPerPage: (gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) || 10, onPageChange: gridActions === null || gridActions === void 0 ? void 0 : gridActions.setPage, customPaginationHandler: customPaginationHandler, radius: window.innerWidth < 768 ? 3 : 5, rate: window.innerWidth < 768 ? 1 : 4 }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors, customPaginationHandler: customPaginationHandler })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose: onCloseForm, onCancel: onCloseForm, onExtraAction: resetColumnConfig, onConfirm: onConfirmForm, width: "auto", minWidth: "350px", hasFooter: true, extraActionLabel: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }), cancelLabel: _jsx(Trans, { id: "form.buttonCancel", message: "Cancel" }), confirmLabel: _jsx(Trans, { id: "form.buttonConfirm", message: "Confirm" }), children: _jsx(ManageColumnForm, { columns: manageColumnsFormDefinitions, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, handleDragEnd: handleDragEnd(true) }) }))] }));
|
|
65
65
|
};
|
|
66
66
|
export default StyledCommonGrid;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type PaginationProps = {
|
|
2
2
|
page?: number;
|
|
3
3
|
itemCount?: number;
|
|
4
4
|
itemPerPage: number;
|
|
5
|
+
radius?: number;
|
|
6
|
+
rate?: number;
|
|
5
7
|
onPageChange?: (number: number, rows: number) => void;
|
|
6
8
|
customPaginationHandler?: (page: number, rows: number) => void;
|
|
7
9
|
};
|
|
8
|
-
declare const Pagination: ({ onPageChange, itemPerPage, itemCount, page, customPaginationHandler }:
|
|
10
|
+
declare const Pagination: ({ onPageChange, itemPerPage, itemCount, page, radius, rate, customPaginationHandler, }: PaginationProps) => JSX.Element;
|
|
9
11
|
export default Pagination;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useMemo } from 'react';
|
|
3
3
|
import { Btn, GoIcon, Wrapper, PageBtn, DotsWrapper } from './styled';
|
|
4
4
|
var Pagination = function (_a) {
|
|
5
|
-
var onPageChange = _a.onPageChange,
|
|
5
|
+
var onPageChange = _a.onPageChange, _b = _a.itemPerPage, itemPerPage = _b === void 0 ? 3 : _b, _c = _a.itemCount, itemCount = _c === void 0 ? 0 : _c, page = _a.page, _d = _a.radius, radius = _d === void 0 ? 5 : _d, _e = _a.rate, rate = _e === void 0 ? 4 : _e, customPaginationHandler = _a.customPaginationHandler;
|
|
6
6
|
var setPage = useCallback(function (number) { return function () {
|
|
7
7
|
if (customPaginationHandler) {
|
|
8
8
|
customPaginationHandler(number, itemPerPage);
|
|
@@ -13,31 +13,27 @@ var Pagination = function (_a) {
|
|
|
13
13
|
}
|
|
14
14
|
}; }, [itemPerPage, onPageChange, customPaginationHandler]);
|
|
15
15
|
var pageX = page !== null && page !== void 0 ? page : 1;
|
|
16
|
-
var pageCount = Math.max(Math.ceil(
|
|
16
|
+
var pageCount = Math.max(Math.ceil(itemCount / itemPerPage), 1);
|
|
17
17
|
var arrayOfPages = useMemo(function () {
|
|
18
18
|
var pageNumbers = Array.from({ length: pageCount }, function (_, i) { return i + 1; });
|
|
19
19
|
// first and last page are still visible
|
|
20
20
|
// if number of pages is less than 6 (display all pages without dots and duplication of first and last char)
|
|
21
|
-
if (pageCount <
|
|
21
|
+
if (pageCount < radius + 1) {
|
|
22
22
|
return pageNumbers.slice(1, pageCount - 1);
|
|
23
|
-
// if current page is less than
|
|
23
|
+
// if current page is less than radius (display first radius pages)
|
|
24
24
|
}
|
|
25
|
-
else if (pageX <
|
|
26
|
-
return pageNumbers.slice(1,
|
|
27
|
-
// display last
|
|
25
|
+
else if (pageX < radius) {
|
|
26
|
+
return pageNumbers.slice(1, Math.min(pageX + rate, radius));
|
|
27
|
+
// display last radius pages
|
|
28
28
|
}
|
|
29
|
-
else if (pageX > pageCount -
|
|
30
|
-
return pageNumbers.slice(pageCount -
|
|
31
|
-
}
|
|
32
|
-
else if (window.innerWidth < 768) {
|
|
33
|
-
// display dispersion of 1 chars from current page (part between dots)
|
|
34
|
-
return pageNumbers.slice(pageX - 2, pageX + 1);
|
|
29
|
+
else if (pageX > pageCount - Math.floor(radius / 2)) {
|
|
30
|
+
return pageNumbers.slice(pageCount - rate - 1, pageCount - 1);
|
|
35
31
|
}
|
|
36
32
|
else {
|
|
37
33
|
// display dispersion of 2 chars from current page (part between dots)
|
|
38
|
-
return pageNumbers.slice(pageX -
|
|
34
|
+
return pageNumbers.slice(pageX - Math.ceil(radius / 2), Math.min(pageX + Math.floor(radius / 2), pageCount - 1));
|
|
39
35
|
}
|
|
40
36
|
}, [pageCount, pageX]);
|
|
41
|
-
return (_jsxs(Wrapper, { children: [_jsx(Btn, { disabled: pageX <= 1, onClick: setPage(pageX - 1), children: _jsx(GoIcon, { icon: "goLeft", isActive: pageX > 1 }) }), _jsx(PageBtn, { isCurrent: pageX === 1, onClick: setPage(1), children: 1 }),
|
|
37
|
+
return (_jsxs(Wrapper, { children: [_jsx(Btn, { disabled: pageX <= 1, onClick: setPage(pageX - 1), children: _jsx(GoIcon, { icon: "goLeft", isActive: pageX > 1 }) }), _jsx(PageBtn, { isCurrent: pageX === 1, onClick: setPage(1), children: 1 }), arrayOfPages[0] > 2 && _jsx(DotsWrapper, { children: "..." }), arrayOfPages === null || arrayOfPages === void 0 ? void 0 : arrayOfPages.map(function (number) { return (_jsx(PageBtn, { isCurrent: pageX === number, onClick: setPage(number !== null && number !== void 0 ? number : 1), children: number }, number)); }), arrayOfPages[arrayOfPages.length - 1] < pageCount - 1 && _jsx(DotsWrapper, { children: "..." }), pageCount !== 1 && (_jsx(PageBtn, { isCurrent: pageX === pageCount, onClick: setPage(pageCount), children: pageCount })), _jsx(Btn, { disabled: pageX >= pageCount, onClick: setPage(pageX + 1), children: _jsx(GoIcon, { icon: "goRight", isActive: pageX < pageCount }) })] }));
|
|
42
38
|
};
|
|
43
39
|
export default Pagination;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { PaginationProps } from '../';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ onPageChange, itemPerPage, itemCount, page, customPaginationHandler }:
|
|
5
|
+
component: ({ onPageChange, itemPerPage, itemCount, page, radius, rate, customPaginationHandler, }: PaginationProps) => JSX.Element;
|
|
6
6
|
tags: string[];
|
|
7
7
|
argTypes: {};
|
|
8
8
|
};
|
|
@@ -10,3 +10,4 @@ export default meta;
|
|
|
10
10
|
type Story = StoryObj<typeof meta>;
|
|
11
11
|
export declare const Default: Story;
|
|
12
12
|
export declare const ManyPages: Story;
|
|
13
|
+
export declare const Shorter: Story;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from 'react';
|
|
1
14
|
import { Pagination } from '../';
|
|
2
15
|
var meta = {
|
|
3
16
|
title: 'Elements/Pagination',
|
|
@@ -6,17 +19,30 @@ var meta = {
|
|
|
6
19
|
argTypes: {},
|
|
7
20
|
};
|
|
8
21
|
export default meta;
|
|
22
|
+
var withSetState = function (arg) {
|
|
23
|
+
var _a = useState(1), page = _a[0], setPage = _a[1];
|
|
24
|
+
return _jsx(Pagination, __assign({}, arg, { page: page, onPageChange: setPage }));
|
|
25
|
+
};
|
|
9
26
|
export var Default = {
|
|
10
27
|
args: {
|
|
11
28
|
itemCount: 100,
|
|
12
29
|
itemPerPage: 8,
|
|
13
|
-
page: 1,
|
|
14
30
|
},
|
|
31
|
+
render: withSetState,
|
|
15
32
|
};
|
|
16
33
|
export var ManyPages = {
|
|
17
34
|
args: {
|
|
18
35
|
itemCount: 1000,
|
|
19
36
|
itemPerPage: 8,
|
|
20
|
-
page: 1,
|
|
21
37
|
},
|
|
38
|
+
render: withSetState,
|
|
39
|
+
};
|
|
40
|
+
export var Shorter = {
|
|
41
|
+
args: {
|
|
42
|
+
itemCount: 100,
|
|
43
|
+
itemPerPage: 8,
|
|
44
|
+
radius: 3,
|
|
45
|
+
rate: 1,
|
|
46
|
+
},
|
|
47
|
+
render: withSetState,
|
|
22
48
|
};
|
|
@@ -2,8 +2,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
-
import styled, { th } from '@xstyled/styled-components';
|
|
6
|
-
import { keyframes } from 'styled-components';
|
|
5
|
+
import styled, { th, keyframes } from '@xstyled/styled-components';
|
|
7
6
|
var KeyframesCircularDash = keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0px;\n }\n\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"], ["\n 0% {\n stroke-dasharray: 1px, 200px;\n stroke-dashoffset: 0px;\n }\n\n 50% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -15px;\n }\n\n 100% {\n stroke-dasharray: 100px, 200px;\n stroke-dashoffset: -125px;\n }\n"])));
|
|
8
7
|
var KeyframesCircularRotate = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n 100% {\n transform: rotate(360deg);\n }\n"], ["\n 100% {\n transform: rotate(360deg);\n }\n"])));
|
|
9
8
|
export var Svg = styled.svg(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s linear infinite;\n"], ["\n width: ", "px;\n height: ", "px;\n animation: ", " 1.4s linear infinite;\n"])), function (_a) {
|
package/ui/index.es.js
CHANGED
|
@@ -17519,31 +17519,33 @@ const Cce = (e, t) => Object.entries(e).map(([r, n]) => `${n} ${r}`).join(", "),
|
|
|
17519
17519
|
}
|
|
17520
17520
|
`, Vce = ({
|
|
17521
17521
|
onPageChange: e,
|
|
17522
|
-
itemPerPage: t,
|
|
17523
|
-
itemCount: r,
|
|
17522
|
+
itemPerPage: t = 3,
|
|
17523
|
+
itemCount: r = 0,
|
|
17524
17524
|
page: n,
|
|
17525
|
-
|
|
17525
|
+
radius: i = 5,
|
|
17526
|
+
rate: o = 4,
|
|
17527
|
+
customPaginationHandler: l
|
|
17526
17528
|
}) => {
|
|
17527
|
-
const
|
|
17528
|
-
if (
|
|
17529
|
-
|
|
17529
|
+
const c = Oe((g) => () => {
|
|
17530
|
+
if (l) {
|
|
17531
|
+
l(g, t);
|
|
17530
17532
|
return;
|
|
17531
17533
|
}
|
|
17532
|
-
e && e(
|
|
17533
|
-
}, [t, e,
|
|
17534
|
-
const
|
|
17535
|
-
length:
|
|
17536
|
-
}, (
|
|
17537
|
-
return
|
|
17538
|
-
}, [
|
|
17534
|
+
e && e(g, t);
|
|
17535
|
+
}, [t, e, l]), u = n ?? 1, f = Math.max(Math.ceil(r / t), 1), h = it(() => {
|
|
17536
|
+
const g = Array.from({
|
|
17537
|
+
length: f
|
|
17538
|
+
}, (v, m) => m + 1);
|
|
17539
|
+
return f < i + 1 ? g.slice(1, f - 1) : u < i ? g.slice(1, Math.min(u + o, i)) : u > f - Math.floor(i / 2) ? g.slice(f - o - 1, f - 1) : g.slice(u - Math.ceil(i / 2), Math.min(u + Math.floor(i / 2), f - 1));
|
|
17540
|
+
}, [f, u]);
|
|
17539
17541
|
return /* @__PURE__ */ b.jsxs(Bce, { children: [
|
|
17540
|
-
/* @__PURE__ */ b.jsx(uk, { disabled:
|
|
17541
|
-
/* @__PURE__ */ b.jsx(L8, { isCurrent:
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
/* @__PURE__ */ b.jsx(uk, { disabled:
|
|
17542
|
+
/* @__PURE__ */ b.jsx(uk, { disabled: u <= 1, onClick: c(u - 1), children: /* @__PURE__ */ b.jsx(dk, { icon: "goLeft", isActive: u > 1 }) }),
|
|
17543
|
+
/* @__PURE__ */ b.jsx(L8, { isCurrent: u === 1, onClick: c(1), children: 1 }),
|
|
17544
|
+
h[0] > 2 && /* @__PURE__ */ b.jsx(fk, { children: "..." }),
|
|
17545
|
+
h == null ? void 0 : h.map((g) => /* @__PURE__ */ b.jsx(L8, { isCurrent: u === g, onClick: c(g ?? 1), children: g }, g)),
|
|
17546
|
+
h[h.length - 1] < f - 1 && /* @__PURE__ */ b.jsx(fk, { children: "..." }),
|
|
17547
|
+
f !== 1 && /* @__PURE__ */ b.jsx(L8, { isCurrent: u === f, onClick: c(f), children: f }),
|
|
17548
|
+
/* @__PURE__ */ b.jsx(uk, { disabled: u >= f, onClick: c(u + 1), children: /* @__PURE__ */ b.jsx(dk, { icon: "goRight", isActive: u < f }) })
|
|
17547
17549
|
] });
|
|
17548
17550
|
}, jce = ae.div`
|
|
17549
17551
|
position: relative;
|
|
@@ -50855,7 +50857,7 @@ const KCe = ki.div`
|
|
|
50855
50857
|
/* @__PURE__ */ b.jsx(sM, { children: /* @__PURE__ */ b.jsxs(aCe, { ref: I, isFixed: !!S, children: [
|
|
50856
50858
|
o && /* @__PURE__ */ b.jsx(YCe, { rowsData: w, onBatchAction: i, gridActions: v, gridSelectors: m, actionColumn: E, processCheckedValues: o, processCheckedValuesTitle: l }),
|
|
50857
50859
|
/* @__PURE__ */ b.jsxs(gt.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? "60px" : "32px", children: [
|
|
50858
|
-
/* @__PURE__ */ b.jsx(Vce, { page: m == null ? void 0 : m.page, itemCount: g == null ? void 0 : g.totalRowsCount, itemPerPage: (m == null ? void 0 : m.rowsPerPage) || 10, onPageChange: v == null ? void 0 : v.setPage, customPaginationHandler: h }),
|
|
50860
|
+
/* @__PURE__ */ b.jsx(Vce, { page: m == null ? void 0 : m.page, itemCount: g == null ? void 0 : g.totalRowsCount, itemPerPage: (m == null ? void 0 : m.rowsPerPage) || 10, onPageChange: v == null ? void 0 : v.setPage, customPaginationHandler: h, radius: window.innerWidth < 768 ? 3 : 5, rate: window.innerWidth < 768 ? 1 : 4 }),
|
|
50859
50861
|
/* @__PURE__ */ b.jsx(qCe, { gridActions: v, gridSelectors: m, customPaginationHandler: h })
|
|
50860
50862
|
] })
|
|
50861
50863
|
] }) }),
|
package/ui/index.umd.js
CHANGED
|
@@ -1960,7 +1960,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1960
1960
|
&:hover {
|
|
1961
1961
|
color: blue2;
|
|
1962
1962
|
}
|
|
1963
|
-
`,nN=({onPageChange:e,itemPerPage:t,itemCount:r,page:n,customPaginationHandler:
|
|
1963
|
+
`,nN=({onPageChange:e,itemPerPage:t=3,itemCount:r=0,page:n,radius:i=5,rate:o=4,customPaginationHandler:l})=>{const u=I.useCallback(g=>()=>{if(l){l(g,t);return}e&&e(g,t)},[t,e,l]),c=n??1,f=Math.max(Math.ceil(r/t),1),h=I.useMemo(()=>{const g=Array.from({length:f},(v,m)=>m+1);return f<i+1?g.slice(1,f-1):c<i?g.slice(1,Math.min(c+o,i)):c>f-Math.floor(i/2)?g.slice(f-o-1,f-1):g.slice(c-Math.ceil(i/2),Math.min(c+Math.floor(i/2),f-1))},[f,c]);return b.jsxs(Mce,{children:[b.jsx(eN,{disabled:c<=1,onClick:u(c-1),children:b.jsx(tN,{icon:"goLeft",isActive:c>1})}),b.jsx(jb,{isCurrent:c===1,onClick:u(1),children:1}),h[0]>2&&b.jsx(rN,{children:"..."}),h==null?void 0:h.map(g=>b.jsx(jb,{isCurrent:c===g,onClick:u(g??1),children:g},g)),h[h.length-1]<f-1&&b.jsx(rN,{children:"..."}),f!==1&&b.jsx(jb,{isCurrent:c===f,onClick:u(f),children:f}),b.jsx(eN,{disabled:c>=f,onClick:u(c+1),children:b.jsx(tN,{icon:"goRight",isActive:c<f})})]})},Nce=oe.div`
|
|
1964
1964
|
position: relative;
|
|
1965
1965
|
display: flex;
|
|
1966
1966
|
width: 100%;
|
|
@@ -3789,7 +3789,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
3789
3789
|
border: 1px solid ${ne.color("lightGray6")};
|
|
3790
3790
|
border-radius: 8px;
|
|
3791
3791
|
margin-bottom: 15px;
|
|
3792
|
-
`,Kxe=({column:e,columnsConfigValues:t,setColumnsConfigOptions:r,searchedValue:n,innerRef:i,draggableProps:o,dragHandleProps:l})=>{var m,w,E,S;const[u,c]=I.useState((t==null?void 0:t.includes(e.name))??!1),f=I.useMemo(()=>({...o==null?void 0:o.style}),[o]),h=qxe.isObject(e==null?void 0:e.title)&&"props"in e.title&&((m=e.title)==null?void 0:m.props)&&pt._({id:(E=(w=e.title)==null?void 0:w.props)==null?void 0:E.id,message:(S=e.title)==null?void 0:S.props.message}),g=h&&h.toLocaleLowerCase().includes(n.toLocaleLowerCase()),v=I.useCallback(()=>{r(C=>({...C,[e.name]:u?{isHidden:!0}:{}})),c(!u)},[r,u,e.name]);return b.jsxs(Qxe,{$isVisible:g,...o,...l,ref:i,style:f,children:[b.jsxs(dt.div,{display:"flex",alignItems:"center",children:[b.jsx(dt.div,{w:"28px",children:b.jsx(Zf,{name:"",variant:"grid",onChange:v,spaceAround:!1,checked:u})}),b.jsx(Mp,{variant:"medium",ml:"8px",children:h})]}),b.jsx(tO,{})]})},$xe=({columns:e,columnsConfigValues:t,setColumnsConfigOptions:r,handleDragEnd:n})=>{const[i,o]=I.useState(""),l=I.useCallback(c=>{o(c.target.value)},[o]),u=I.useCallback(()=>{o("")},[o]);return b.jsxs(dt.div,{children:[b.jsx(tc,{icon:"search",type:"text",value:i,placeholder:pt._({id:"manageColumn.searchPlaceholder",message:"Find column..."}),onChange:l,onClear:u,variant:"gray"}),b.jsx(NV,{onDragEnd:n,children:b.jsx(U7,{droppableId:"droppable",direction:"vertical",children:c=>b.jsx(dt.div,{h:"400px",overflowY:"scroll",mt:"20px",ref:c.innerRef,...c.droppableProps,children:e==null?void 0:e.map((f,h)=>b.jsx(YV,{draggableId:f.name,index:h,isDragDisabled:!!i,children:(g,v)=>b.jsx(Kxe,{column:f,innerRef:g.innerRef,columnsConfigValues:t,setColumnsConfigOptions:r,searchedValue:i,draggableProps:g.draggableProps,dragHandleProps:g.dragHandleProps},h)},f.name))})})})]})},eEe=e=>{const{optimizeFilters:t=!1,extraControlButtons:r,eshopSelect:n,onBatchAction:i,processCheckedValues:o,processCheckedValuesTitle:l,hideControlButtons:u,floatingButtonProps:c,queryRowsParam:f,customPaginationHandler:h,...g}=e,{gridActions:v,gridSelectors:m,rowsData:w,actionColumnDefinition:E}=g,{gridHeight:S,gridRef:C,paginationRef:k}=Qhe();I.useEffect(()=>{var pe;if(!f&&S&&S>0){const be=Math.max(Math.floor(S/S6e-2),E6e);be&&((pe=v.setRowsPerPage)==null||pe.call(v,be))}},[S,v,f]);const P=o5e(g),T=I.useMemo(()=>I6e(t),[t]),D=P.columnsDefinitions,{onOpen:B,isOpen:F,onClose:W}=ab(),{columnsConfigValues:G,setColumnsConfigOptions:J,onConfirmForm:R,resetColumnConfig:j,handleDragEnd:V,onCloseForm:te,displayColumnsDefinitions:Y,manageColumnsFormDefinitions:ie}=s5e({columns:D,gridActions:v,gridSelectors:m,onClose:W});return b.jsxs(ixe,{children:[b.jsxs(axe,{children:[b.jsx(Pj,{children:b.jsxs(oxe,{className:"buttonsStrip",children:[!u&&b.jsx(bxe,{extraControlButtons:r,gridActions:v,gridSelectors:m,eshopSelect:n}),b.jsx(sxe,{type:"button",sizing:"iconLg",appearance:"ghost",icon:b.jsx($k,{}),onClick:B,children:b.jsx(Mp,{variant:"semiBold",children:b.jsx(Tr,{id:"manageColumn.title",message:"Manage column"})})})]})}),b.jsx(lxe,{...g,...P,filters:T,gridRef:C,height:S,floatingButtonProps:c,handleDragEnd:V(!1),displayColumnsDefinitions:Y,hasColouredRows:!0})]}),b.jsx(Pj,{children:b.jsxs(nxe,{ref:k,isFixed:!!S,children:[o&&b.jsx(Gxe,{rowsData:w,onBatchAction:i,gridActions:v,gridSelectors:m,actionColumn:E,processCheckedValues:o,processCheckedValuesTitle:l}),b.jsxs(dt.div,{display:"flex",justifyContent:"center",alignItems:"center",className:"paginatorWrapper",w:"100%",h:window.innerWidth>1204?"60px":"32px",children:[b.jsx(nN,{page:m==null?void 0:m.page,itemCount:g==null?void 0:g.totalRowsCount,itemPerPage:(m==null?void 0:m.rowsPerPage)||10,onPageChange:v==null?void 0:v.setPage,customPaginationHandler:h}),b.jsx(Xxe,{gridActions:v,gridSelectors:m,customPaginationHandler:h})]})]})}),F&&b.jsx(ib,{title:b.jsx(Tr,{id:"manageColumn.title",message:"Manage columns"}),onClose:te,onCancel:te,onExtraAction:j,onConfirm:R,width:"auto",minWidth:"350px",hasFooter:!0,extraActionLabel:b.jsx(Tr,{id:"dataGrid.buttonClearConfig",message:"Reset config"}),cancelLabel:b.jsx(Tr,{id:"form.buttonCancel",message:"Cancel"}),confirmLabel:b.jsx(Tr,{id:"form.buttonConfirm",message:"Confirm"}),children:b.jsx($xe,{columns:ie,columnsConfigValues:G,setColumnsConfigOptions:J,handleDragEnd:V(!0)})})]})};var w9={};/**
|
|
3792
|
+
`,Kxe=({column:e,columnsConfigValues:t,setColumnsConfigOptions:r,searchedValue:n,innerRef:i,draggableProps:o,dragHandleProps:l})=>{var m,w,E,S;const[u,c]=I.useState((t==null?void 0:t.includes(e.name))??!1),f=I.useMemo(()=>({...o==null?void 0:o.style}),[o]),h=qxe.isObject(e==null?void 0:e.title)&&"props"in e.title&&((m=e.title)==null?void 0:m.props)&&pt._({id:(E=(w=e.title)==null?void 0:w.props)==null?void 0:E.id,message:(S=e.title)==null?void 0:S.props.message}),g=h&&h.toLocaleLowerCase().includes(n.toLocaleLowerCase()),v=I.useCallback(()=>{r(C=>({...C,[e.name]:u?{isHidden:!0}:{}})),c(!u)},[r,u,e.name]);return b.jsxs(Qxe,{$isVisible:g,...o,...l,ref:i,style:f,children:[b.jsxs(dt.div,{display:"flex",alignItems:"center",children:[b.jsx(dt.div,{w:"28px",children:b.jsx(Zf,{name:"",variant:"grid",onChange:v,spaceAround:!1,checked:u})}),b.jsx(Mp,{variant:"medium",ml:"8px",children:h})]}),b.jsx(tO,{})]})},$xe=({columns:e,columnsConfigValues:t,setColumnsConfigOptions:r,handleDragEnd:n})=>{const[i,o]=I.useState(""),l=I.useCallback(c=>{o(c.target.value)},[o]),u=I.useCallback(()=>{o("")},[o]);return b.jsxs(dt.div,{children:[b.jsx(tc,{icon:"search",type:"text",value:i,placeholder:pt._({id:"manageColumn.searchPlaceholder",message:"Find column..."}),onChange:l,onClear:u,variant:"gray"}),b.jsx(NV,{onDragEnd:n,children:b.jsx(U7,{droppableId:"droppable",direction:"vertical",children:c=>b.jsx(dt.div,{h:"400px",overflowY:"scroll",mt:"20px",ref:c.innerRef,...c.droppableProps,children:e==null?void 0:e.map((f,h)=>b.jsx(YV,{draggableId:f.name,index:h,isDragDisabled:!!i,children:(g,v)=>b.jsx(Kxe,{column:f,innerRef:g.innerRef,columnsConfigValues:t,setColumnsConfigOptions:r,searchedValue:i,draggableProps:g.draggableProps,dragHandleProps:g.dragHandleProps},h)},f.name))})})})]})},eEe=e=>{const{optimizeFilters:t=!1,extraControlButtons:r,eshopSelect:n,onBatchAction:i,processCheckedValues:o,processCheckedValuesTitle:l,hideControlButtons:u,floatingButtonProps:c,queryRowsParam:f,customPaginationHandler:h,...g}=e,{gridActions:v,gridSelectors:m,rowsData:w,actionColumnDefinition:E}=g,{gridHeight:S,gridRef:C,paginationRef:k}=Qhe();I.useEffect(()=>{var pe;if(!f&&S&&S>0){const be=Math.max(Math.floor(S/S6e-2),E6e);be&&((pe=v.setRowsPerPage)==null||pe.call(v,be))}},[S,v,f]);const P=o5e(g),T=I.useMemo(()=>I6e(t),[t]),D=P.columnsDefinitions,{onOpen:B,isOpen:F,onClose:W}=ab(),{columnsConfigValues:G,setColumnsConfigOptions:J,onConfirmForm:R,resetColumnConfig:j,handleDragEnd:V,onCloseForm:te,displayColumnsDefinitions:Y,manageColumnsFormDefinitions:ie}=s5e({columns:D,gridActions:v,gridSelectors:m,onClose:W});return b.jsxs(ixe,{children:[b.jsxs(axe,{children:[b.jsx(Pj,{children:b.jsxs(oxe,{className:"buttonsStrip",children:[!u&&b.jsx(bxe,{extraControlButtons:r,gridActions:v,gridSelectors:m,eshopSelect:n}),b.jsx(sxe,{type:"button",sizing:"iconLg",appearance:"ghost",icon:b.jsx($k,{}),onClick:B,children:b.jsx(Mp,{variant:"semiBold",children:b.jsx(Tr,{id:"manageColumn.title",message:"Manage column"})})})]})}),b.jsx(lxe,{...g,...P,filters:T,gridRef:C,height:S,floatingButtonProps:c,handleDragEnd:V(!1),displayColumnsDefinitions:Y,hasColouredRows:!0})]}),b.jsx(Pj,{children:b.jsxs(nxe,{ref:k,isFixed:!!S,children:[o&&b.jsx(Gxe,{rowsData:w,onBatchAction:i,gridActions:v,gridSelectors:m,actionColumn:E,processCheckedValues:o,processCheckedValuesTitle:l}),b.jsxs(dt.div,{display:"flex",justifyContent:"center",alignItems:"center",className:"paginatorWrapper",w:"100%",h:window.innerWidth>1204?"60px":"32px",children:[b.jsx(nN,{page:m==null?void 0:m.page,itemCount:g==null?void 0:g.totalRowsCount,itemPerPage:(m==null?void 0:m.rowsPerPage)||10,onPageChange:v==null?void 0:v.setPage,customPaginationHandler:h,radius:window.innerWidth<768?3:5,rate:window.innerWidth<768?1:4}),b.jsx(Xxe,{gridActions:v,gridSelectors:m,customPaginationHandler:h})]})]})}),F&&b.jsx(ib,{title:b.jsx(Tr,{id:"manageColumn.title",message:"Manage columns"}),onClose:te,onCancel:te,onExtraAction:j,onConfirm:R,width:"auto",minWidth:"350px",hasFooter:!0,extraActionLabel:b.jsx(Tr,{id:"dataGrid.buttonClearConfig",message:"Reset config"}),cancelLabel:b.jsx(Tr,{id:"form.buttonCancel",message:"Cancel"}),confirmLabel:b.jsx(Tr,{id:"form.buttonConfirm",message:"Confirm"}),children:b.jsx($xe,{columns:ie,columnsConfigValues:G,setColumnsConfigOptions:J,handleDragEnd:V(!0)})})]})};var w9={};/**
|
|
3793
3793
|
* @license React
|
|
3794
3794
|
* use-sync-external-store-with-selector.production.min.js
|
|
3795
3795
|
*
|