@luscii-healthtech/web-ui 0.1.31 → 0.2.2
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/components/ListTable/ListTable.d.ts +6 -7
- package/dist/components/PaginationMenu/PaginationMenu.d.ts +3 -20
- package/dist/components/PaginationMenu/PaginationMenu.types.d.ts +37 -0
- package/dist/components/PaginationMenu/PaginationMenu.utils.d.ts +15 -0
- package/dist/components/PaginationMenu/PaginationMenuLarge.d.ts +1 -11
- package/dist/components/PaginationMenu/PaginationMenuSmall.d.ts +1 -6
- package/dist/index.d.ts +2 -1
- package/dist/web-ui.cjs.development.css +26 -26
- package/dist/web-ui.cjs.development.js +137 -119
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +137 -119
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ButtonV2/ButtonV2.tsx +2 -3
- package/src/components/ListTable/ListTable.tsx +44 -14
- package/src/components/PaginationMenu/PaginationMenu.tsx +41 -0
- package/src/components/PaginationMenu/PaginationMenu.types.ts +46 -0
- package/src/components/PaginationMenu/PaginationMenu.utils.ts +49 -0
- package/src/components/PaginationMenu/PaginationMenuLarge.tsx +69 -69
- package/src/components/PaginationMenu/PaginationMenuSmall.tsx +29 -26
- package/src/index.tsx +7 -1
- package/src/components/PaginationMenu/PaginationMenu.js +0 -31
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextProps } from "../Text/Text";
|
|
3
3
|
import { RestPropped } from "../../types/general.types";
|
|
4
|
+
import { Localization, OnPaginationChange, PageSize } from "../PaginationMenu/PaginationMenu.types";
|
|
4
5
|
export declare type ListTableItem = RestPropped;
|
|
5
6
|
export interface ListTableProps<ItemType extends ListTableItem, CellType> extends RestPropped {
|
|
6
7
|
items?: ItemType[];
|
|
7
8
|
configuration: ListTablePropsConfiguration<ItemType, CellType>;
|
|
8
9
|
pageCount?: number;
|
|
9
10
|
currentPage?: number;
|
|
11
|
+
onPaginationChange?: OnPaginationChange;
|
|
12
|
+
pageSize?: PageSize;
|
|
13
|
+
localization?: Localization;
|
|
14
|
+
resultCount?: number;
|
|
10
15
|
onRowClick?: (arg: ItemType) => void;
|
|
11
|
-
onPageClick?: (arg: number) => void;
|
|
12
16
|
isLoading?: boolean;
|
|
13
17
|
showHeader?: boolean;
|
|
14
18
|
className?: string;
|
|
15
|
-
localization: {
|
|
16
|
-
page: string;
|
|
17
|
-
next: string;
|
|
18
|
-
previous: string;
|
|
19
|
-
};
|
|
20
19
|
}
|
|
21
20
|
export interface ListTablePropsConfiguration<ItemType extends ListTableItem, CellType> {
|
|
22
21
|
emptyValue?: string;
|
|
@@ -31,5 +30,5 @@ export interface ListTablePropsConfigurationField<ItemType extends ListTableItem
|
|
|
31
30
|
field: (arg: ItemType) => string | CellType;
|
|
32
31
|
textProps?: Omit<TextProps, "text">;
|
|
33
32
|
}
|
|
34
|
-
export declare function ListTable<ItemType extends ListTableItem, CellType>({ items, configuration, pageCount, currentPage,
|
|
33
|
+
export declare function ListTable<ItemType extends ListTableItem, CellType>({ items, configuration, pageCount, currentPage, onPaginationChange, pageSize, localization, resultCount, onRowClick, isLoading, showHeader, className, ...restProps }: ListTableProps<ItemType, CellType>): JSX.Element;
|
|
35
34
|
export default ListTable;
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
currentPage: any;
|
|
5
|
-
onPageClick: any;
|
|
6
|
-
small: any;
|
|
7
|
-
className: any;
|
|
8
|
-
localization: any;
|
|
9
|
-
}): JSX.Element;
|
|
10
|
-
declare namespace PaginationMenu {
|
|
11
|
-
export namespace propTypes {
|
|
12
|
-
export const pageCount: PropTypes.Validator<number>;
|
|
13
|
-
export const currentPage: PropTypes.Validator<number>;
|
|
14
|
-
export const onPageClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
-
export const small: PropTypes.Requireable<boolean>;
|
|
16
|
-
export const className: PropTypes.Requireable<string>;
|
|
17
|
-
export const localization: PropTypes.Requireable<object>;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
import PropTypes from "prop-types";
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaginationMenuProps } from "./PaginationMenu.types";
|
|
3
|
+
export declare const PaginationMenu: (props: PaginationMenuProps) => JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface PaginationMenuProps {
|
|
2
|
+
pageCount: number;
|
|
3
|
+
currentPageNumber: number;
|
|
4
|
+
onChange: OnPaginationChange;
|
|
5
|
+
pageSize?: PageSize;
|
|
6
|
+
localization?: Localization;
|
|
7
|
+
resultCount?: number;
|
|
8
|
+
small?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PaginationMenuSmallProps {
|
|
12
|
+
pageCount: number;
|
|
13
|
+
currentPageNumber: number;
|
|
14
|
+
onChange: OnPaginationChange;
|
|
15
|
+
pageSize?: PageSize;
|
|
16
|
+
}
|
|
17
|
+
export interface PaginationMenuLargeProps {
|
|
18
|
+
pageCount: number;
|
|
19
|
+
currentPageNumber: number;
|
|
20
|
+
onChange: OnPaginationChange;
|
|
21
|
+
pageSize?: PageSize;
|
|
22
|
+
localization: Localization;
|
|
23
|
+
resultCount?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare type OnPaginationChange = (pageNumber: number, pageSize?: PageSize) => void;
|
|
26
|
+
export declare type PageSize = 50 | 100 | 150 | 200;
|
|
27
|
+
export interface Localization {
|
|
28
|
+
display: string;
|
|
29
|
+
page: string;
|
|
30
|
+
previous: string;
|
|
31
|
+
next: string;
|
|
32
|
+
of: string;
|
|
33
|
+
}
|
|
34
|
+
export declare type Option = {
|
|
35
|
+
value: number;
|
|
36
|
+
label: string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Localization, Option, PageSize } from "./PaginationMenu.types";
|
|
2
|
+
export declare const PAGE_SIZE_OPTIONS: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: PageSize;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const getPageNumberOptions: (pageCount: number) => Option[];
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @returns When the pageSize and resultCount params are present,
|
|
10
|
+
* this function returns a text indicating the range of elements that are being displayed,
|
|
11
|
+
* otherwise it returns a text indicating the current page and the page count.
|
|
12
|
+
* @example 1-50 of 100
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export declare const getSummaryText: (pageCount: number, currentPageNumber: number, localization: Localization, pageSize?: number | undefined, resultCount?: number | undefined) => string;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
pageCount: number;
|
|
4
|
-
currentPage: number;
|
|
5
|
-
onPageClick: (page: number) => void;
|
|
6
|
-
localization: {
|
|
7
|
-
previous: string;
|
|
8
|
-
next: string;
|
|
9
|
-
page: string;
|
|
10
|
-
};
|
|
11
|
-
}
|
|
2
|
+
import { PaginationMenuLargeProps } from "./PaginationMenu.types";
|
|
12
3
|
export declare const PaginationMenuLarge: (props: PaginationMenuLargeProps) => JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
pageCount: number;
|
|
4
|
-
currentPage: number;
|
|
5
|
-
onPageClick: (page: number) => void;
|
|
6
|
-
}
|
|
2
|
+
import { PaginationMenuSmallProps } from "./PaginationMenu.types";
|
|
7
3
|
export declare const PaginationMenuSmall: (props: PaginationMenuSmallProps) => JSX.Element;
|
|
8
|
-
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ export { NavMenu } from "./components/NavMenu/NavMenu";
|
|
|
27
27
|
export { NotificationBanner, NotificationBannerColor, NotificationBannerLinkProps, } from "./components/NotificationBanner/NotificationBanner";
|
|
28
28
|
export { default as Page } from "./components/Page/Page";
|
|
29
29
|
export { default as CRUDPage } from "./components/Page/CRUDPage";
|
|
30
|
-
export {
|
|
30
|
+
export { PaginationMenu } from "./components/PaginationMenu/PaginationMenu";
|
|
31
|
+
export { PageSize as PaginationMenuPageSize, OnPaginationChange as OnPaginationMenuChange, Localization as PaginationMenuLocalization, PaginationMenuProps, } from "./components/PaginationMenu/PaginationMenu.types";
|
|
31
32
|
export { default as PreviewPhone } from "./components/PreviewPhone/PreviewPhone";
|
|
32
33
|
export { default as Radio } from "./components/Radio/Radio";
|
|
33
34
|
export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
|
|
@@ -190,6 +190,18 @@
|
|
|
190
190
|
.cweb-checkbox.type-switch.is-checked .cweb-checkbox-icon-container:after {
|
|
191
191
|
left: 32px; }
|
|
192
192
|
|
|
193
|
+
.vitals-confirmation-dialog {
|
|
194
|
+
margin-top: 4rem !important; }
|
|
195
|
+
.vitals-confirmation-dialog .vitals-confirmation-dialog-content {
|
|
196
|
+
padding: 24px; }
|
|
197
|
+
.vitals-confirmation-dialog .vitals-confirmation-dialog-content .vitals-confirmation-dialog-action-container {
|
|
198
|
+
display: flex;
|
|
199
|
+
justify-content: space-between;
|
|
200
|
+
flex-direction: row;
|
|
201
|
+
align-items: center;
|
|
202
|
+
width: 100%;
|
|
203
|
+
margin-top: 16px; }
|
|
204
|
+
|
|
193
205
|
.cweb-box-shadow-default {
|
|
194
206
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24), 0 0 2px 0 rgba(0, 0, 0, 0.12); }
|
|
195
207
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
@@ -432,18 +444,6 @@
|
|
|
432
444
|
.cweb-datepicker-calendar .react-datepicker__day.react-datepicker__day--outside-month {
|
|
433
445
|
color: #cccccc; }
|
|
434
446
|
|
|
435
|
-
.vitals-confirmation-dialog {
|
|
436
|
-
margin-top: 4rem !important; }
|
|
437
|
-
.vitals-confirmation-dialog .vitals-confirmation-dialog-content {
|
|
438
|
-
padding: 24px; }
|
|
439
|
-
.vitals-confirmation-dialog .vitals-confirmation-dialog-content .vitals-confirmation-dialog-action-container {
|
|
440
|
-
display: flex;
|
|
441
|
-
justify-content: space-between;
|
|
442
|
-
flex-direction: row;
|
|
443
|
-
align-items: center;
|
|
444
|
-
width: 100%;
|
|
445
|
-
margin-top: 16px; }
|
|
446
|
-
|
|
447
447
|
.cweb-box-shadow-default {
|
|
448
448
|
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.24), 0 0 2px 0 rgba(0, 0, 0, 0.12); }
|
|
449
449
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
|
@@ -516,20 +516,6 @@
|
|
|
516
516
|
background: url("../../assets/error-icon.svg") no-repeat center;
|
|
517
517
|
background-size: contain; }
|
|
518
518
|
|
|
519
|
-
.cweb-list-item {
|
|
520
|
-
display: flex;
|
|
521
|
-
justify-content: flex-start;
|
|
522
|
-
flex-direction: row;
|
|
523
|
-
align-items: center;
|
|
524
|
-
padding: 16px 0 16px 0;
|
|
525
|
-
border-bottom: 1px solid #eeeeee; }
|
|
526
|
-
.cweb-list-item:last-child {
|
|
527
|
-
border-bottom: none; }
|
|
528
|
-
.cweb-list-item.cweb-list-item-clickable {
|
|
529
|
-
cursor: pointer; }
|
|
530
|
-
.cweb-list-item.cweb-list-item-clickable:hover {
|
|
531
|
-
background-color: #f2fafd; }
|
|
532
|
-
|
|
533
519
|
.cweb-info-block {
|
|
534
520
|
position: relative;
|
|
535
521
|
padding: 16px 16px 16px 56px;
|
|
@@ -546,6 +532,20 @@
|
|
|
546
532
|
background: url("../../assets/info-icon.svg") no-repeat center;
|
|
547
533
|
background-size: contain; }
|
|
548
534
|
|
|
535
|
+
.cweb-list-item {
|
|
536
|
+
display: flex;
|
|
537
|
+
justify-content: flex-start;
|
|
538
|
+
flex-direction: row;
|
|
539
|
+
align-items: center;
|
|
540
|
+
padding: 16px 0 16px 0;
|
|
541
|
+
border-bottom: 1px solid #eeeeee; }
|
|
542
|
+
.cweb-list-item:last-child {
|
|
543
|
+
border-bottom: none; }
|
|
544
|
+
.cweb-list-item.cweb-list-item-clickable {
|
|
545
|
+
cursor: pointer; }
|
|
546
|
+
.cweb-list-item.cweb-list-item-clickable:hover {
|
|
547
|
+
background-color: #f2fafd; }
|
|
548
|
+
|
|
549
549
|
.cweb-loading {
|
|
550
550
|
display: flex;
|
|
551
551
|
justify-content: center;
|
|
@@ -322,9 +322,8 @@ var ButtonV2 = function ButtonV2(_ref) {
|
|
|
322
322
|
|
|
323
323
|
var buttonClassName = classNames(["h-11", "relative flex flex-row justify-center items-center", "border", "transition-outline transition-colors duration-300 ease-in-out", "rounded-full", "leading-none", "shadow-sm", "cursor-pointer", "focus:outline-primary"], {
|
|
324
324
|
"w-11": !text && icon,
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"py-3": text && !icon
|
|
325
|
+
"pl-4 pr-6": text && icon,
|
|
326
|
+
"px-4": text && !icon
|
|
328
327
|
}, {
|
|
329
328
|
"opacity-50": isDisabled,
|
|
330
329
|
"pointer-events-none": isDisabled || isPending
|
|
@@ -1898,30 +1897,29 @@ var ListItem = function ListItem(props) {
|
|
|
1898
1897
|
};
|
|
1899
1898
|
|
|
1900
1899
|
var PaginationMenuSmall = function PaginationMenuSmall(props) {
|
|
1901
|
-
function
|
|
1902
|
-
event.
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
}
|
|
1900
|
+
var handleOnChange = function handleOnChange(event) {
|
|
1901
|
+
var pageNumber = event.currentTarget.dataset.page;
|
|
1902
|
+
pageNumber && props.onChange(parseInt(pageNumber, 10), props.pageSize);
|
|
1903
|
+
};
|
|
1906
1904
|
|
|
1907
|
-
return /*#__PURE__*/
|
|
1905
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TertiaryButton, {
|
|
1908
1906
|
"data-test-id": "prev-button",
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
text: props.
|
|
1907
|
+
icon: LeftArrowIcon,
|
|
1908
|
+
"data-page": props.currentPageNumber - 1,
|
|
1909
|
+
onClick: handleOnChange,
|
|
1910
|
+
isDisabled: props.currentPageNumber === 1
|
|
1911
|
+
}), /*#__PURE__*/React__default.createElement(Text, {
|
|
1912
|
+
className: "ml-4",
|
|
1913
|
+
text: props.currentPageNumber + " / " + props.pageCount,
|
|
1916
1914
|
type: "sm",
|
|
1917
1915
|
color: "gray-500"
|
|
1918
|
-
}), /*#__PURE__*/
|
|
1916
|
+
}), /*#__PURE__*/React__default.createElement(TertiaryButton, {
|
|
1917
|
+
className: "ml-4",
|
|
1919
1918
|
"data-test-id": "next-button",
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
onClick: handleOnPageClick
|
|
1919
|
+
icon: RightArrowIcon,
|
|
1920
|
+
isDisabled: props.currentPageNumber === props.pageCount,
|
|
1921
|
+
"data-page": props.currentPageNumber + 1,
|
|
1922
|
+
onClick: handleOnChange
|
|
1925
1923
|
}));
|
|
1926
1924
|
};
|
|
1927
1925
|
|
|
@@ -2038,118 +2036,134 @@ var CustomSelect = /*#__PURE__*/React__default.forwardRef(function (props, _ref)
|
|
|
2038
2036
|
}));
|
|
2039
2037
|
});
|
|
2040
2038
|
|
|
2041
|
-
var
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
label:
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2039
|
+
var PAGE_SIZES = [50, 100, 150, 200];
|
|
2040
|
+
var PAGE_SIZE_OPTIONS = /*#__PURE__*/PAGE_SIZES.map(function (pageSize) {
|
|
2041
|
+
return {
|
|
2042
|
+
label: pageSize.toString(),
|
|
2043
|
+
value: pageSize
|
|
2044
|
+
};
|
|
2045
|
+
});
|
|
2046
|
+
var getPageNumberOptions = function getPageNumberOptions(pageCount) {
|
|
2047
|
+
var items = [];
|
|
2048
2048
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
label:
|
|
2052
|
-
value:
|
|
2049
|
+
for (var i = 1; i <= pageCount; i++) {
|
|
2050
|
+
items.push({
|
|
2051
|
+
label: i.toString(),
|
|
2052
|
+
value: i
|
|
2053
2053
|
});
|
|
2054
|
-
}, [props.currentPage]);
|
|
2055
|
-
|
|
2056
|
-
function handleOnPageClick(event) {
|
|
2057
|
-
event.preventDefault();
|
|
2058
|
-
var newPage = event.currentTarget.dataset.page;
|
|
2059
|
-
|
|
2060
|
-
if (newPage) {
|
|
2061
|
-
setPage({
|
|
2062
|
-
value: newPage,
|
|
2063
|
-
label: newPage
|
|
2064
|
-
});
|
|
2065
|
-
props.onPageClick(parseInt(newPage, 10));
|
|
2066
|
-
}
|
|
2067
2054
|
}
|
|
2068
2055
|
|
|
2069
|
-
|
|
2070
|
-
|
|
2056
|
+
return items;
|
|
2057
|
+
};
|
|
2058
|
+
/**
|
|
2059
|
+
*
|
|
2060
|
+
* @returns When the pageSize and resultCount params are present,
|
|
2061
|
+
* this function returns a text indicating the range of elements that are being displayed,
|
|
2062
|
+
* otherwise it returns a text indicating the current page and the page count.
|
|
2063
|
+
* @example 1-50 of 100
|
|
2064
|
+
*
|
|
2065
|
+
*/
|
|
2066
|
+
|
|
2067
|
+
var getSummaryText = function getSummaryText(pageCount, currentPageNumber, localization, pageSize, resultCount) {
|
|
2068
|
+
if (pageSize && resultCount) {
|
|
2069
|
+
var lowestElement = (currentPageNumber - 1) * pageSize + 1;
|
|
2070
|
+
var highestElement = currentPageNumber === pageCount ? resultCount : currentPageNumber * pageSize;
|
|
2071
|
+
return lowestElement + "-" + highestElement + " " + localization.of + " " + resultCount;
|
|
2072
|
+
} else {
|
|
2073
|
+
return localization.page + " " + currentPageNumber + " / " + pageCount;
|
|
2071
2074
|
}
|
|
2075
|
+
};
|
|
2072
2076
|
|
|
2073
|
-
|
|
2074
|
-
|
|
2077
|
+
var PaginationMenuLarge = function PaginationMenuLarge(props) {
|
|
2078
|
+
var handleOnPageNumberSelect = function handleOnPageNumberSelect(optionSelected) {
|
|
2079
|
+
optionSelected && props.onChange(optionSelected.value, props.pageSize);
|
|
2080
|
+
};
|
|
2075
2081
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
+
var handleOnPageSizeSelect = function handleOnPageSizeSelect(optionSelected) {
|
|
2083
|
+
var pageSize = PAGE_SIZE_OPTIONS.find(function (option) {
|
|
2084
|
+
return option === optionSelected;
|
|
2085
|
+
});
|
|
2086
|
+
pageSize && props.onChange(1, pageSize.value);
|
|
2087
|
+
};
|
|
2082
2088
|
|
|
2083
|
-
|
|
2084
|
-
|
|
2089
|
+
var handleOnPrevNextButtonClick = function handleOnPrevNextButtonClick(event) {
|
|
2090
|
+
var newPage = event.currentTarget.dataset.page;
|
|
2091
|
+
newPage && props.onChange(parseInt(newPage, 10), props.pageSize);
|
|
2092
|
+
};
|
|
2085
2093
|
|
|
2086
|
-
return /*#__PURE__*/
|
|
2087
|
-
className: "flex flex-row
|
|
2088
|
-
}, /*#__PURE__*/
|
|
2089
|
-
|
|
2094
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
|
|
2095
|
+
className: "flex flex-row items-center"
|
|
2096
|
+
}, props.pageSize && props.resultCount && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Text, {
|
|
2097
|
+
text: props.localization.display
|
|
2098
|
+
}), /*#__PURE__*/React__default.createElement(CustomSelect, {
|
|
2099
|
+
className: "w-24 ml-2 mr-4",
|
|
2100
|
+
options: PAGE_SIZE_OPTIONS,
|
|
2101
|
+
onChange: handleOnPageSizeSelect,
|
|
2102
|
+
value: {
|
|
2103
|
+
label: props.pageSize.toString(),
|
|
2104
|
+
value: props.pageSize
|
|
2105
|
+
},
|
|
2106
|
+
menuPlacement: "auto"
|
|
2107
|
+
})), /*#__PURE__*/React__default.createElement(Text, {
|
|
2090
2108
|
text: props.localization.page
|
|
2091
|
-
}), /*#__PURE__*/
|
|
2092
|
-
className: "w-24",
|
|
2093
|
-
options:
|
|
2094
|
-
onChange:
|
|
2095
|
-
value:
|
|
2109
|
+
}), /*#__PURE__*/React__default.createElement(CustomSelect, {
|
|
2110
|
+
className: "w-24 ml-2",
|
|
2111
|
+
options: getPageNumberOptions(props.pageCount),
|
|
2112
|
+
onChange: handleOnPageNumberSelect,
|
|
2113
|
+
value: {
|
|
2114
|
+
label: props.currentPageNumber.toString(),
|
|
2115
|
+
value: props.currentPageNumber
|
|
2116
|
+
},
|
|
2096
2117
|
isDisabled: props.pageCount < 2,
|
|
2097
2118
|
menuPlacement: "auto"
|
|
2098
|
-
})), /*#__PURE__*/
|
|
2099
|
-
className: "
|
|
2100
|
-
}, /*#__PURE__*/
|
|
2101
|
-
|
|
2102
|
-
text: props.localization.page + " " + props.currentPage + " / " + props.pageCount,
|
|
2119
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
2120
|
+
className: "ml-4 flex flex-row items-center"
|
|
2121
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
2122
|
+
text: getSummaryText(props.pageCount, props.currentPageNumber, props.localization, props.pageSize, props.resultCount),
|
|
2103
2123
|
color: "gray-500"
|
|
2104
|
-
}), /*#__PURE__*/
|
|
2124
|
+
}), /*#__PURE__*/React__default.createElement(SecondaryButton, {
|
|
2105
2125
|
"data-test-id": "prev-button",
|
|
2106
|
-
role: BUTTON_ROLES.SECONDARY,
|
|
2107
2126
|
text: props.localization.previous,
|
|
2108
|
-
"data-page": props.
|
|
2109
|
-
onClick:
|
|
2110
|
-
isDisabled: props.
|
|
2111
|
-
className: "
|
|
2112
|
-
}), /*#__PURE__*/
|
|
2127
|
+
"data-page": props.currentPageNumber - 1,
|
|
2128
|
+
onClick: handleOnPrevNextButtonClick,
|
|
2129
|
+
isDisabled: props.currentPageNumber === 1,
|
|
2130
|
+
className: "ml-4"
|
|
2131
|
+
}), /*#__PURE__*/React__default.createElement(SecondaryButton, {
|
|
2113
2132
|
"data-test-id": "next-button",
|
|
2114
|
-
role: BUTTON_ROLES.SECONDARY,
|
|
2115
2133
|
text: props.localization.next,
|
|
2116
|
-
isDisabled: props.
|
|
2117
|
-
"data-page": props.
|
|
2118
|
-
onClick:
|
|
2119
|
-
className: "
|
|
2134
|
+
isDisabled: props.currentPageNumber === props.pageCount,
|
|
2135
|
+
"data-page": props.currentPageNumber + 1,
|
|
2136
|
+
onClick: handleOnPrevNextButtonClick,
|
|
2137
|
+
className: "ml-4"
|
|
2120
2138
|
})));
|
|
2121
2139
|
};
|
|
2122
2140
|
|
|
2123
|
-
PaginationMenu
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2141
|
+
var PaginationMenu = function PaginationMenu(props) {
|
|
2142
|
+
var buildPaginationLarge = function buildPaginationLarge() {
|
|
2143
|
+
if (!props.localization) {
|
|
2144
|
+
console.error("Localization is required to use the non small Pagination component, please make sure to pass it as a prop.");
|
|
2145
|
+
return /*#__PURE__*/React__default.createElement("span", null, "Invalid props passed to this component.");
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
return /*#__PURE__*/React__default.createElement(PaginationMenuLarge, {
|
|
2149
|
+
pageCount: props.pageCount,
|
|
2150
|
+
currentPageNumber: props.currentPageNumber,
|
|
2151
|
+
onChange: props.onChange,
|
|
2152
|
+
pageSize: props.pageSize,
|
|
2153
|
+
localization: props.localization,
|
|
2154
|
+
resultCount: props.resultCount
|
|
2155
|
+
});
|
|
2156
|
+
};
|
|
2131
2157
|
|
|
2132
|
-
function PaginationMenu(_ref) {
|
|
2133
|
-
var pageCount = _ref.pageCount,
|
|
2134
|
-
currentPage = _ref.currentPage,
|
|
2135
|
-
onPageClick = _ref.onPageClick,
|
|
2136
|
-
small = _ref.small,
|
|
2137
|
-
className = _ref.className,
|
|
2138
|
-
localization = _ref.localization;
|
|
2139
|
-
var containerClassName = classNames("flex flex-row flex-space-between w-full items-center", className);
|
|
2140
2158
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2141
|
-
className:
|
|
2142
|
-
}, small ? /*#__PURE__*/React__default.createElement(PaginationMenuSmall, {
|
|
2143
|
-
pageCount: pageCount,
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
onPageClick: onPageClick,
|
|
2150
|
-
localization: localization
|
|
2151
|
-
}));
|
|
2152
|
-
}
|
|
2159
|
+
className: "flex flex-row w-full items-center justify-between"
|
|
2160
|
+
}, props.small ? /*#__PURE__*/React__default.createElement(PaginationMenuSmall, {
|
|
2161
|
+
pageCount: props.pageCount,
|
|
2162
|
+
currentPageNumber: props.currentPageNumber,
|
|
2163
|
+
pageSize: props.pageSize,
|
|
2164
|
+
onChange: props.onChange
|
|
2165
|
+
}) : buildPaginationLarge());
|
|
2166
|
+
};
|
|
2153
2167
|
|
|
2154
2168
|
var loadingImage = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"68\" height=\"20\" viewBox=\"0 0 68 20\">\n <g fill=\"none\" fill-rule=\"nonzero\">\n <circle cx=\"10\" cy=\"10\" r=\"10\" fill=\"#F09\">\n <animate attributeName=\"opacity\" dur=\"2s\" values=\"1;0.6;1\" repeatCount=\"indefinite\" begin=\"0.1\"/>\n <animate attributeName=\"r\" dur=\"2s\" repeatCount=\"indefinite\" values=\"10;8;10\" begin=\"0.1\"/>\n </circle>\n <circle cx=\"34\" cy=\"10\" r=\"10\" fill=\"#6ABFA5\">\n <animate attributeName=\"opacity\" dur=\"2s\" values=\"1;0.6;1\" repeatCount=\"indefinite\" begin=\"0.6\"/>\n <animate attributeName=\"r\" dur=\"2s\" repeatCount=\"indefinite\" values=\"10;8;10\" begin=\"0.6\"/>\n </circle>\n <circle cx=\"58\" cy=\"10\" r=\"10\" fill=\"#6670A5\">\n <animate attributeName=\"opacity\" dur=\"2s\" values=\"1;0.6;1\" repeatCount=\"indefinite\" begin=\"1.1\"/>\n <animate attributeName=\"r\" dur=\"2s\" repeatCount=\"indefinite\" values=\"10;8;10\" begin=\"1.1\"/>\n </circle>\n </g>\n</svg>";
|
|
2155
2169
|
|
|
@@ -2287,7 +2301,7 @@ function ListTableHeader(_ref) {
|
|
|
2287
2301
|
})));
|
|
2288
2302
|
}
|
|
2289
2303
|
|
|
2290
|
-
var _excluded$9 = ["items", "configuration", "pageCount", "currentPage", "
|
|
2304
|
+
var _excluded$9 = ["items", "configuration", "pageCount", "currentPage", "onPaginationChange", "pageSize", "localization", "resultCount", "onRowClick", "isLoading", "showHeader", "className"];
|
|
2291
2305
|
function ListTable(_ref) {
|
|
2292
2306
|
var _ref$items = _ref.items,
|
|
2293
2307
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
@@ -2296,14 +2310,16 @@ function ListTable(_ref) {
|
|
|
2296
2310
|
pageCount = _ref$pageCount === void 0 ? 0 : _ref$pageCount,
|
|
2297
2311
|
_ref$currentPage = _ref.currentPage,
|
|
2298
2312
|
currentPage = _ref$currentPage === void 0 ? 1 : _ref$currentPage,
|
|
2299
|
-
|
|
2313
|
+
onPaginationChange = _ref.onPaginationChange,
|
|
2314
|
+
pageSize = _ref.pageSize,
|
|
2315
|
+
localization = _ref.localization,
|
|
2316
|
+
resultCount = _ref.resultCount,
|
|
2300
2317
|
onRowClick = _ref.onRowClick,
|
|
2301
2318
|
_ref$isLoading = _ref.isLoading,
|
|
2302
2319
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
2303
2320
|
_ref$showHeader = _ref.showHeader,
|
|
2304
2321
|
showHeader = _ref$showHeader === void 0 ? true : _ref$showHeader,
|
|
2305
2322
|
className = _ref.className,
|
|
2306
|
-
localization = _ref.localization,
|
|
2307
2323
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
2308
2324
|
|
|
2309
2325
|
// For not displaying empty view at creation
|
|
@@ -2344,15 +2360,17 @@ function ListTable(_ref) {
|
|
|
2344
2360
|
}), /*#__PURE__*/React__default.createElement(Text, {
|
|
2345
2361
|
className: classNames("no-item-found-text", "w-56 text-base text-gray-600 text-center whitespace-pre-wrap"),
|
|
2346
2362
|
text: configuration.emptyListText
|
|
2347
|
-
}))))), !showEmptyView && pageCount > 0 &&
|
|
2363
|
+
}))))), !showEmptyView && pageCount > 0 && onPaginationChange && /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", {
|
|
2348
2364
|
colSpan: configuration.fields.length
|
|
2349
2365
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
2350
2366
|
className: classNames("cweb-list-table-footer", "flex justify-center flex-row items-center", "h-20 py-4 px-4")
|
|
2351
2367
|
}, /*#__PURE__*/React__default.createElement(PaginationMenu, {
|
|
2352
|
-
onPageClick: onPageClick,
|
|
2353
2368
|
pageCount: pageCount,
|
|
2354
|
-
|
|
2355
|
-
|
|
2369
|
+
currentPageNumber: currentPage,
|
|
2370
|
+
onChange: onPaginationChange,
|
|
2371
|
+
pageSize: pageSize,
|
|
2372
|
+
localization: localization,
|
|
2373
|
+
resultCount: resultCount
|
|
2356
2374
|
})))))));
|
|
2357
2375
|
}
|
|
2358
2376
|
|