@mailstep/design-system 0.7.61 → 0.7.62-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/Blocks/CommonGrid/CommonGrid.d.ts +1 -1
- package/ui/Blocks/CommonGrid/CommonGrid.js +3 -14
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +8 -2
- package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.js +2 -2
- package/ui/Blocks/CommonGrid/components/GridInfo/index.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/GridInfo/index.js +7 -0
- package/ui/Blocks/CommonGrid/components/GridStatus/index.d.ts +9 -0
- package/ui/Blocks/CommonGrid/components/GridStatus/index.js +10 -0
- package/ui/Blocks/CommonGrid/components/HeadCell.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/HeadCell.js +2 -2
- package/ui/Blocks/CommonGrid/components/HeadRow.d.ts +2 -1
- package/ui/Blocks/CommonGrid/components/HeadRow.js +2 -2
- package/ui/Blocks/CommonGrid/components/OversizedScroll.d.ts +1 -2
- package/ui/Blocks/CommonGrid/components/OversizedScroll.js +4 -4
- package/ui/Blocks/CommonGrid/components/Table.d.ts +14 -1
- package/ui/Blocks/CommonGrid/components/Table.js +7 -2
- package/ui/Blocks/CommonGrid/hooks/useQuickFilter.d.ts +1 -1
- package/ui/Blocks/CommonGrid/hooks/useQuickFilter.js +7 -7
- package/ui/Blocks/CommonGrid/store/index.js +1 -0
- package/ui/Blocks/CommonGrid/storybook/stories/gridStates.stories.d.ts +8 -0
- package/ui/Blocks/CommonGrid/storybook/stories/gridStates.stories.js +12 -0
- package/ui/Blocks/CommonGrid/styles.d.ts +1 -1
- package/ui/Blocks/CommonGrid/styles.js +1 -1
- package/ui/Blocks/CommonGrid/types.d.ts +3 -0
- package/ui/Blocks/CommonGrid/utils/hasSortTerminated.d.ts +9 -0
- package/ui/Blocks/CommonGrid/utils/hasSortTerminated.js +11 -0
- package/ui/Elements/Alert/Alert.d.ts +3 -2
- package/ui/Elements/Alert/Alert.js +7 -7
- package/ui/Elements/Alert/stories/Alert.stories.d.ts +2 -1
- package/ui/Elements/Alert/styles.d.ts +6 -3
- package/ui/Elements/Alert/styles.js +15 -3
- package/ui/Elements/Alert/types.d.ts +1 -4
- package/ui/index.es.js +8752 -8703
- package/ui/index.umd.js +620 -619
- package/ui/utils/translations.js +1 -1
- package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.d.ts +0 -10
- package/ui/Blocks/CommonGrid/storybook/stories/loading.stories.js +0 -12
package/package.json
CHANGED
|
@@ -7,5 +7,5 @@ type Props = CommonGridProps & {
|
|
|
7
7
|
hasGroups: boolean;
|
|
8
8
|
hasFilters: boolean;
|
|
9
9
|
};
|
|
10
|
-
declare const CommonGrid: ({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, columnLayout, displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters }: Props) => JSX.Element;
|
|
10
|
+
declare const CommonGrid: ({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, columnLayout, displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters, isSortTerminated }: Props) => JSX.Element;
|
|
11
11
|
export default CommonGrid;
|
|
@@ -14,14 +14,13 @@ import React from 'react';
|
|
|
14
14
|
import DataRow from './components/DataRow';
|
|
15
15
|
import FilterRow from './components/FilterRow';
|
|
16
16
|
import FloatingButton from './components/FloatingButton/FloatingButton';
|
|
17
|
+
import { GridStatus } from './components/GridStatus';
|
|
17
18
|
import GroupRow from './components/GroupRow';
|
|
18
19
|
import HeadRow from './components/HeadRow';
|
|
19
20
|
import OversizedScroll from './components/OversizedScroll';
|
|
20
|
-
import { Row, MessageCell } from './components/Table';
|
|
21
21
|
import useColumnSizes from './hooks/useColumnSizes';
|
|
22
22
|
import useRowsKeyControls from './hooks/useRowsKeyControls';
|
|
23
23
|
import useUxReset from './hooks/useUxReset';
|
|
24
|
-
import { Trans } from '@lingui/react';
|
|
25
24
|
import { x } from '@xstyled/styled-components';
|
|
26
25
|
import { initialState } from './store';
|
|
27
26
|
import { getGroups } from './utils';
|
|
@@ -40,21 +39,11 @@ var CommonGrid = function (_a) {
|
|
|
40
39
|
// redux props
|
|
41
40
|
gridSelectors = _a.gridSelectors, gridActions = _a.gridActions,
|
|
42
41
|
// input props
|
|
43
|
-
isLoading = _a.isLoading, rowsData = _a.rowsData, hasColouredRows = _a.hasColouredRows, actionColumnDefinition = _a.actionColumnDefinition, allowRowSelect = _a.allowRowSelect, allowRowSelectOnAction = _a.allowRowSelectOnAction, onRowAction = _a.onRowAction, onRowClick = _a.onRowClick, _b = _a.columnLayout, columnLayout = _b === void 0 ? 'normal' : _b, displayColumnsDefinitions = _a.displayColumnsDefinitions, className = _a.className, minColumnWidth = _a.minColumnWidth, errorMessage = _a.errorMessage, floatingButtonProps = _a.floatingButtonProps, hasGroups = _a.hasGroups, hasFilters = _a.hasFilters;
|
|
42
|
+
isLoading = _a.isLoading, rowsData = _a.rowsData, hasColouredRows = _a.hasColouredRows, actionColumnDefinition = _a.actionColumnDefinition, allowRowSelect = _a.allowRowSelect, allowRowSelectOnAction = _a.allowRowSelectOnAction, onRowAction = _a.onRowAction, onRowClick = _a.onRowClick, _b = _a.columnLayout, columnLayout = _b === void 0 ? 'normal' : _b, displayColumnsDefinitions = _a.displayColumnsDefinitions, className = _a.className, minColumnWidth = _a.minColumnWidth, errorMessage = _a.errorMessage, floatingButtonProps = _a.floatingButtonProps, hasGroups = _a.hasGroups, hasFilters = _a.hasFilters, isSortTerminated = _a.isSortTerminated;
|
|
44
43
|
var _c = gridSelectors.uxState, uxState = _c === void 0 ? defaultUxState : _c, _d = gridSelectors.columnsWidth, columnsWidth = _d === void 0 ? defaultColumnsWidth : _d, columnsWidthVariant = gridSelectors.columnsWidthVariant, _e = gridSelectors.page, page = _e === void 0 ? 1 : _e, filter = gridSelectors.filter, sorting = gridSelectors.sorting, _f = gridSelectors.rowsPerPage, rowsPerPage = _f === void 0 ? 10 : _f;
|
|
45
44
|
var clearUxState = gridActions.clearUxState, handleUxChange = gridActions.handleUxChange, _g = gridActions.addFilter, addFilter = _g === void 0 ? defaultVoidFunction : _g, _h = gridActions.addSorting, addSorting = _h === void 0 ? defaultVoidFunction : _h, _j = gridActions.setColumnWidth, setColumnWidth = _j === void 0 ? defaultVoidFunction : _j;
|
|
46
45
|
var handleRowsKeyDown = useRowsKeyControls(rowsData, uxState, handleUxChange);
|
|
47
46
|
useUxReset(rowsData, uxState, clearUxState);
|
|
48
|
-
var GridMessage;
|
|
49
|
-
var messageClass = 'info';
|
|
50
|
-
if (isLoading)
|
|
51
|
-
GridMessage = _jsx(Trans, { id: "dataGrid.status.loadingData", message: "... loading data ..." });
|
|
52
|
-
if (!isLoading && (!rowsData || rowsData.length < 1))
|
|
53
|
-
GridMessage = _jsx(Trans, { id: "dataGrid.status.noDataFound", message: "No data found." });
|
|
54
|
-
if (!isLoading && errorMessage) {
|
|
55
|
-
GridMessage = errorMessage;
|
|
56
|
-
messageClass = 'error';
|
|
57
|
-
}
|
|
58
47
|
var _k = useColumnSizes(displayColumnsDefinitions, columnsWidth, columnsWidthVariant, setColumnWidth, columnLayout, minColumnWidth), displayColumnsWidth = _k.displayColumnsWidth, totalColumnsWidth = _k.totalColumnsWidth, gridBoxRef = _k.gridBoxRef, handleResizeDrag = _k.handleResizeDrag;
|
|
59
48
|
var groups = React.useMemo(function () {
|
|
60
49
|
return getGroups(displayColumnsDefinitions);
|
|
@@ -62,7 +51,7 @@ var CommonGrid = function (_a) {
|
|
|
62
51
|
var commonGridRef = React.useCallback(function (node) {
|
|
63
52
|
gridBoxRef.current = node;
|
|
64
53
|
}, []);
|
|
65
|
-
return (_jsxs(_Fragment, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout,
|
|
54
|
+
return (_jsxs(_Fragment, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout, totalColumnsWidth: totalColumnsWidth, floatingChildren: _jsx(GridStatus, { isLoading: isLoading, rowsData: rowsData, errorMessage: errorMessage }), ref: commonGridRef, children: [_jsxs("div", { className: "gridHead", children: [hasGroups && (_jsx(GroupRow, { actionColumn: actionColumnDefinition, columns: displayColumnsDefinitions, displayColumnsWidth: displayColumnsWidth, groups: groups })), _jsx(HeadRow, { columns: displayColumnsDefinitions, onAddSort: addSorting, columnLayout: columnLayout, sortingValues: sorting, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag, groups: groups, handleDragEnd: handleDragEnd, isSortTerminated: isSortTerminated }), hasFilters && (_jsx(FilterRow, { filters: filters, comparators: comparators, columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onChange: addFilter, filterValues: filter, displayColumnsWidth: displayColumnsWidth, groups: groups, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange }))] }), _jsx("div", { className: "body flx_1", style: rowsStyles, tabIndex: -1, onKeyDown: handleRowsKeyDown, children: !isLoading &&
|
|
66
55
|
rowsData &&
|
|
67
56
|
displayColumnsDefinitions &&
|
|
68
57
|
rowsData.map(function (row, index) {
|
|
@@ -27,6 +27,7 @@ import HidePrint from '../HidePrint/HidePrint';
|
|
|
27
27
|
import { useModal } from '../Modal/hooks/useModal';
|
|
28
28
|
import ActionHead from './components/ActionHead';
|
|
29
29
|
import ControlButtons from './components/ControlButtons';
|
|
30
|
+
import { GridInfo } from './components/GridInfo';
|
|
30
31
|
import { GridModals } from './components/GridModals';
|
|
31
32
|
import TablePagination from './components/TablePagination';
|
|
32
33
|
import useEditReadAsColumn from './hooks/useEditReadAsColumn';
|
|
@@ -34,12 +35,13 @@ import { useGridAutoRowsPerPage } from './hooks/useGridAutoRowsPerPage';
|
|
|
34
35
|
import useManageColumn from './hooks/useManageColumn';
|
|
35
36
|
import { usePresetState } from './hooks/usePresetsState';
|
|
36
37
|
import { getRowsPerPage } from './utils/getRowsPerPage';
|
|
38
|
+
import hasSortTerminated from './utils/hasSortTerminated';
|
|
37
39
|
import { x } from '@xstyled/styled-components';
|
|
38
40
|
import { CommonGridWithStyles, BottomWrapper, CommonGridWrap, ContentContainer, StyledButtonStrip } from './styles';
|
|
39
41
|
import { getFilters } from './utils';
|
|
40
42
|
var CommonGridContainer = function (props) {
|
|
41
43
|
var _a;
|
|
42
|
-
var _b = props.optimizeFilters, optimizeFilters = _b === void 0 ? false : _b, extraControlButtons = props.extraControlButtons, onBatchAction = props.onBatchAction, processCheckedValues = props.processCheckedValues, processCheckedValuesTitle = props.processCheckedValuesTitle, hideControlButtons = props.hideControlButtons, quickFilter = props.quickFilter, floatingButtonProps = props.floatingButtonProps, queryRowsParam = props.queryRowsParam, customPaginationHandler = props.customPaginationHandler, _c = props.autoHeight, autoHeight = _c === void 0 ? true : _c, gridName = props.gridName, _d = props.withPresets, withPresets = _d === void 0 ? true : _d, _e = props.withManageColumnButton, withManageColumnButton = _e === void 0 ? true : _e, _f = props.withPagination, withPagination = _f === void 0 ? true : _f, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "onBatchAction", "processCheckedValues", "processCheckedValuesTitle", "hideControlButtons", "quickFilter", "floatingButtonProps", "queryRowsParam", "customPaginationHandler", "autoHeight", "gridName", "withPresets", "withManageColumnButton", "withPagination"]);
|
|
44
|
+
var _b = props.optimizeFilters, optimizeFilters = _b === void 0 ? false : _b, extraControlButtons = props.extraControlButtons, onBatchAction = props.onBatchAction, processCheckedValues = props.processCheckedValues, processCheckedValuesTitle = props.processCheckedValuesTitle, hideControlButtons = props.hideControlButtons, quickFilter = props.quickFilter, floatingButtonProps = props.floatingButtonProps, queryRowsParam = props.queryRowsParam, customPaginationHandler = props.customPaginationHandler, _c = props.autoHeight, autoHeight = _c === void 0 ? true : _c, gridName = props.gridName, _d = props.withPresets, withPresets = _d === void 0 ? true : _d, _e = props.withManageColumnButton, withManageColumnButton = _e === void 0 ? true : _e, _f = props.withPagination, withPagination = _f === void 0 ? true : _f, allowSortingOnlyUnderTotalRows = props.allowSortingOnlyUnderTotalRows, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "onBatchAction", "processCheckedValues", "processCheckedValuesTitle", "hideControlButtons", "quickFilter", "floatingButtonProps", "queryRowsParam", "customPaginationHandler", "autoHeight", "gridName", "withPresets", "withManageColumnButton", "withPagination", "allowSortingOnlyUnderTotalRows"]);
|
|
43
45
|
var gridActions = passDownProps.gridActions, gridSelectors = passDownProps.gridSelectors, rowsData = passDownProps.rowsData, actionColumnDefinition = passDownProps.actionColumnDefinition;
|
|
44
46
|
var _g = useState(false), displayManageColumnButton = _g[0], setDisplayManageColumnButton = _g[1];
|
|
45
47
|
var gridRef = useRef(null);
|
|
@@ -66,6 +68,10 @@ var CommonGridContainer = function (props) {
|
|
|
66
68
|
onClose: onClose
|
|
67
69
|
}), columnsConfigValues = _j.columnsConfigValues, setColumnsConfigOptions = _j.setColumnsConfigOptions, onConfirmForm = _j.onConfirmForm, resetColumnConfig = _j.resetColumnConfig, handleDragEnd = _j.handleDragEnd, onCloseForm = _j.onCloseForm, displayColumnsDefinitions = _j.displayColumnsDefinitions, manageColumnsFormDefinitions = _j.manageColumnsFormDefinitions;
|
|
68
70
|
var _k = usePresetState(), isPresetsModalOpen = _k.isPresetsModalOpen, onClosePresetsModal = _k.onClosePresetsModal, onOpenPresetsModal = _k.onOpenPresetsModal, setSelectedPresetName = _k.setSelectedPresetName, selectedPresetName = _k.selectedPresetName;
|
|
69
|
-
|
|
71
|
+
var _l = hasSortTerminated({
|
|
72
|
+
allowSortingOnlyUnderTotalRows: allowSortingOnlyUnderTotalRows,
|
|
73
|
+
totalRowsCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount
|
|
74
|
+
}), isSortTerminatedAppeal = _l.isSortTerminatedAppeal, isSortTerminated = _l.isSortTerminated;
|
|
75
|
+
return (_jsxs(_Fragment, { children: [_jsxs(ContentContainer, { ref: gridRef, children: [_jsxs(CommonGridWrap, { withPagination: withPagination, children: [withButtonStrip && (_jsx(HidePrint, { children: _jsx(StyledButtonStrip, { className: "buttonsStrip", children: _jsx(ControlButtons, { hideControlButtons: hideControlButtons, extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, quickFilter: quickFilter, displayColumnsDefinitions: displayColumnsDefinitions, filters: filters, setDisplayManageColumnButton: setDisplayManageColumnButton, displayManageColumnButton: displayManageColumnButton, openManageColumnForm: openManageColumnForm, onOpenPresetsModal: onOpenPresetsModal, selectedPresetName: selectedPresetName, withPresets: withPresets, gridName: gridName, withManageColumnButton: withManageColumnButton }) }) })), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { withButtonStrip: withButtonStrip, hasGroupsOrFilters: hasGroupsOrFilters, filters: filters, floatingButtonProps: floatingButtonProps, handleDragEnd: handleDragEnd(false), displayColumnsDefinitions: displayColumnsDefinitions, hasFilters: hasFilters, hasGroups: hasGroups, isSortTerminated: isSortTerminated, hasColouredRows: true }))] }), _jsxs(BottomWrapper, { withPagination: withPagination, children: [(processCheckedValues || !!((_a = actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions) === null || _a === void 0 ? void 0 : _a.length)) && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionOptions: actionColumnDefinition === null || actionColumnDefinition === void 0 ? void 0 : actionColumnDefinition.actionOptions, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "space-between", alignItems: "center", w: "100%", children: [_jsx(GridInfo, { isSortTerminatedAppeal: isSortTerminatedAppeal, isSortTerminated: isSortTerminated }), withPagination && (_jsxs(x.div, { display: "flex", alignItems: "center", className: "paginatorWrapper", 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, autoRowsPerPage: autoRowsPerPage })] }))] })] })] }), _jsx(GridModals, { manageColumnFormVisible: manageColumnFormVisible, onCloseForm: onCloseForm, resetColumnConfig: resetColumnConfig, onConfirmForm: onConfirmForm, manageColumnsFormDefinitions: manageColumnsFormDefinitions, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, handleDragEnd: handleDragEnd(true), gridName: gridName, gridActions: gridActions, gridSelectors: gridSelectors, onClosePresetsModal: onClosePresetsModal, isPresetsModalOpen: isPresetsModalOpen, selectedPresetName: selectedPresetName, setSelectedPresetName: setSelectedPresetName })] }));
|
|
70
76
|
};
|
|
71
77
|
export default CommonGridContainer;
|
|
@@ -32,7 +32,7 @@ var ControlButtons = function (_a) {
|
|
|
32
32
|
quickFilter: quickFilter,
|
|
33
33
|
displayColumnsDefinitions: displayColumnsDefinitions,
|
|
34
34
|
filters: filters
|
|
35
|
-
}), searchedValue = _c.searchedValue, translatedValue = _c.translatedValue, onChangeInputValue = _c.onChangeInputValue, onClear = _c.onClear,
|
|
35
|
+
}), searchedValue = _c.searchedValue, translatedValue = _c.translatedValue, onChangeInputValue = _c.onChangeInputValue, onClear = _c.onClear, onClearSettings = _c.onClearSettings, onDisplayInput = _c.onDisplayInput, displayInput = _c.displayInput, isMobileInputView = _c.isMobileInputView, isMobile = _c.isMobile, filter = _c.filter;
|
|
36
36
|
useEffect(function () {
|
|
37
37
|
setDisplayManageColumnButton(!isMobileInputView && !!withManageColumnButton);
|
|
38
38
|
}, [isMobileInputView, withManageColumnButton, setDisplayManageColumnButton]);
|
|
@@ -41,6 +41,6 @@ var ControlButtons = function (_a) {
|
|
|
41
41
|
id: 'controlButtons.searchPlaceholder',
|
|
42
42
|
message: "Search ".concat(translatedValue, " ..."),
|
|
43
43
|
values: { translatedValue: translatedValue }
|
|
44
|
-
}), onChange: onChangeInputValue, onClear: onClear, onClick: onDisplayInput, displayInput: displayInput, isMobileInputView: isMobileInputView, alwaysShowClear: isMobile })), _jsx(ExtraControlButtons, { extraControlButtons: extraControlButtons, targetPosition: ExtraControlButtonPosition.TopLeft }), _jsx(x.div, { children: filtersOn && (_jsx(Button, { type: "button", onClick:
|
|
44
|
+
}), onChange: onChangeInputValue, onClear: onClear, onClick: onDisplayInput, displayInput: displayInput, isMobileInputView: isMobileInputView, alwaysShowClear: isMobile })), _jsx(ExtraControlButtons, { extraControlButtons: extraControlButtons, targetPosition: ExtraControlButtonPosition.TopLeft }), _jsx(x.div, { children: filtersOn && (_jsx(Button, { type: "button", onClick: onClearSettings, variant: "default", appearance: "secondary", "data-cy": "resetFiltersBtn", children: _jsx(Trans, { id: "dataGrid.buttonClearSettings", message: "Reset" }) })) })] })), withPresets && gridName && (_jsxs(_Fragment, { children: [_jsx(x.div, { mx: "12px", children: _jsx(Button, { onClick: onOpenPresetsModal, type: "button", variant: "default", appearance: "tertiary", children: _jsx(Trans, { id: "dataGrid.presets.title", message: "Presets" }) }) }), selectedPresetName && (_jsx(Tag, __assign({ size: "medium" }, palletes.redWhite, { children: _jsx(H6, { mt: 0, mb: 0, variant: "semiBold", children: selectedPresetName }) })))] }))] }), _jsxs(Right, { children: [_jsx(ExtraControlButtons, { extraControlButtons: extraControlButtons, targetPosition: ExtraControlButtonPosition.TopRight }), displayManageColumnButton && (_jsx(StyledColumnButton, { type: "button", variant: "ghost", appearance: "primary", iconLeft: _jsx(Settings2, {}), onClick: openManageColumnForm, children: _jsx(H6, { variant: "semiBold", mt: 0, mb: 0, children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) }))] })] }));
|
|
45
45
|
};
|
|
46
46
|
export default ControlButtons;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Alert from '../../../../Elements/Alert';
|
|
3
|
+
import { Trans } from '@lingui/react';
|
|
4
|
+
export var GridInfo = function (_a) {
|
|
5
|
+
var isSortTerminatedAppeal = _a.isSortTerminatedAppeal, isSortTerminated = _a.isSortTerminated;
|
|
6
|
+
return (_jsxs("span", { children: [isSortTerminatedAppeal && !isSortTerminated && (_jsx(Alert, { intent: "warning", height: "auto", inline: true, text: _jsx(Trans, { id: "dataGrid.sortingTerminatedAppeal", message: "Too many results, please set a filter" }) })), isSortTerminated && (_jsx(Alert, { intent: "danger", height: "auto", inline: true, text: _jsx(Trans, { id: "dataGrid.sortingTerminated", message: "Too many results, sorting cannot be used" }) }))] }));
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { RowProps } from '../../types';
|
|
3
|
+
type Props<TData extends RowProps = RowProps> = {
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
rowsData: TData[];
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const GridStatus: FC<Props>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Row, MessageCell, MessageCellBody } from '../Table';
|
|
3
|
+
import { Trans } from '@lingui/react';
|
|
4
|
+
export var GridStatus = function (_a) {
|
|
5
|
+
var isLoading = _a.isLoading, rowsData = _a.rowsData, errorMessage = _a.errorMessage;
|
|
6
|
+
var hasError = !isLoading && errorMessage;
|
|
7
|
+
var isEmpty = !isLoading && !errorMessage && (!rowsData || rowsData.length < 1);
|
|
8
|
+
var variant = hasError ? 'error' : 'info';
|
|
9
|
+
return (_jsx(Row, { className: "dataRow", align: "center", children: _jsx(MessageCell, { children: _jsxs(MessageCellBody, { variant: variant, children: [isLoading && _jsx(Trans, { id: "dataGrid.status.loadingData", message: "... loading data ..." }), hasError && errorMessage, isEmpty && _jsx(Trans, { id: "dataGrid.status.noDataFound", message: "No data found." })] }) }) }));
|
|
10
|
+
};
|
|
@@ -11,6 +11,8 @@ type HeadCellProps = {
|
|
|
11
11
|
onSetSort: (column: string, systemName?: string) => (value: SortingValueType) => void;
|
|
12
12
|
group: Group;
|
|
13
13
|
hasResize: boolean;
|
|
14
|
+
totalRowsCount?: number;
|
|
15
|
+
isSortTerminated?: boolean;
|
|
14
16
|
};
|
|
15
17
|
export declare const HeadCell: FC<HeadCellProps>;
|
|
16
18
|
export {};
|
|
@@ -18,12 +18,12 @@ import Resize from './Resize';
|
|
|
18
18
|
import { Cell } from './Table';
|
|
19
19
|
export var HeadCell = function (_a) {
|
|
20
20
|
var _b;
|
|
21
|
-
var column = _a.column, isDragDisabled = _a.isDragDisabled, displayColumnsWidth = _a.displayColumnsWidth, onResizeOut = _a.onResizeOut, onResizeOver = _a.onResizeOver, onResize = _a.onResize, sortingValues = _a.sortingValues, onSetSort = _a.onSetSort, group = _a.group, hasResize = _a.hasResize;
|
|
21
|
+
var column = _a.column, isDragDisabled = _a.isDragDisabled, displayColumnsWidth = _a.displayColumnsWidth, onResizeOut = _a.onResizeOut, onResizeOver = _a.onResizeOver, onResize = _a.onResize, sortingValues = _a.sortingValues, onSetSort = _a.onSetSort, group = _a.group, hasResize = _a.hasResize, isSortTerminated = _a.isSortTerminated;
|
|
22
22
|
var _c = useSortable({
|
|
23
23
|
id: column.name,
|
|
24
24
|
disabled: isDragDisabled || !!column.sticky,
|
|
25
25
|
animateLayoutChanges: function () { return false; }
|
|
26
26
|
}), attributes = _c.attributes, listeners = _c.listeners, setNodeRef = _c.setNodeRef, transform = _c.transform, transition = _c.transition;
|
|
27
27
|
var cellClassName = "cell".concat(getStickyCollClassNames(!!(column === null || column === void 0 ? void 0 : column.sticky), column === null || column === void 0 ? void 0 : column.stickTo), " ").concat(getGroupClassNames(group));
|
|
28
|
-
return (_jsxs(Cell, __assign({}, getCellSizeProps(column, displayColumnsWidth[column.name]), attributes, listeners, { className: cellClassName, transition: transition, transform: CSS.Transform.toString(transform), ref: setNodeRef, children: [_jsx(ColumnTitle, { title: column === null || column === void 0 ? void 0 : column.title, isSortable: !!column.sorting, onSetSort: onSetSort(column.name, column.systemName), sortValue: ((_b = sortingValues.find(function (sorting) { return sorting.column === getSortName(column); })) === null || _b === void 0 ? void 0 : _b.direction) || null }), hasResize && onResizeOut && onResizeOver && (_jsx(Resize, { onResize: onResize(column.name), onResizeOver: onResizeOver, onResizeOut: onResizeOut }))] })));
|
|
28
|
+
return (_jsxs(Cell, __assign({}, getCellSizeProps(column, displayColumnsWidth[column.name]), attributes, listeners, { className: cellClassName, transition: transition, transform: CSS.Transform.toString(transform), ref: setNodeRef, children: [_jsx(ColumnTitle, { title: column === null || column === void 0 ? void 0 : column.title, isSortable: !!column.sorting && !isSortTerminated, onSetSort: onSetSort(column.name, column.systemName), sortValue: ((_b = sortingValues.find(function (sorting) { return sorting.column === getSortName(column); })) === null || _b === void 0 ? void 0 : _b.direction) || null }), hasResize && onResizeOut && onResizeOver && (_jsx(Resize, { onResize: onResize(column.name), onResizeOver: onResizeOver, onResizeOut: onResizeOut }))] })));
|
|
29
29
|
};
|
|
@@ -9,6 +9,7 @@ type HeadRowProps = {
|
|
|
9
9
|
handleResizeDrag: (column: string, width: number) => void;
|
|
10
10
|
handleDragEnd: (event: DragEndEvent) => void;
|
|
11
11
|
groups: Group[];
|
|
12
|
+
isSortTerminated?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const HeadRow: ({ columns, onAddSort, handleDragEnd, sortingValues, displayColumnsWidth, columnLayout, handleResizeDrag, groups }: HeadRowProps) => JSX.Element;
|
|
14
|
+
declare const HeadRow: ({ columns, onAddSort, handleDragEnd, sortingValues, displayColumnsWidth, columnLayout, handleResizeDrag, groups, isSortTerminated }: HeadRowProps) => JSX.Element;
|
|
14
15
|
export default HeadRow;
|
|
@@ -25,7 +25,7 @@ var getStickyComponent = function (columns, stickyTo, displayColumnsWidth) {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
var HeadRow = function (_a) {
|
|
28
|
-
var columns = _a.columns, onAddSort = _a.onAddSort, handleDragEnd = _a.handleDragEnd, _b = _a.sortingValues, sortingValues = _b === void 0 ? [] : _b, displayColumnsWidth = _a.displayColumnsWidth, columnLayout = _a.columnLayout, handleResizeDrag = _a.handleResizeDrag, groups = _a.groups;
|
|
28
|
+
var columns = _a.columns, onAddSort = _a.onAddSort, handleDragEnd = _a.handleDragEnd, _b = _a.sortingValues, sortingValues = _b === void 0 ? [] : _b, displayColumnsWidth = _a.displayColumnsWidth, columnLayout = _a.columnLayout, handleResizeDrag = _a.handleResizeDrag, groups = _a.groups, isSortTerminated = _a.isSortTerminated;
|
|
29
29
|
var _c = useState(false), showUIElements = _c[0], setShowUIElements = _c[1];
|
|
30
30
|
useEffect(function () {
|
|
31
31
|
setShowUIElements(true);
|
|
@@ -49,6 +49,6 @@ var HeadRow = function (_a) {
|
|
|
49
49
|
return name;
|
|
50
50
|
}), strategy: horizontalListSortingStrategy, children: _jsxs(Row, { className: "headRow", children: [getStickyComponent(columns, 'left', displayColumnsWidth), columns
|
|
51
51
|
.filter(function (item) { return !item.sticky; })
|
|
52
|
-
.map(function (column, index) { return (_jsx(HeadCell, { column: column, isDragDisabled: isDragDisabled, displayColumnsWidth: displayColumnsWidth, onResizeOut: onResizeOut, onResizeOver: onResizeOver, onResize: onResize, sortingValues: sortingValues, onSetSort: onSetSort, group: groups[index], hasResize: columnLayout === 'normal' || !!columns[index + 1] }, column.name)); }), getStickyComponent(columns, 'right', displayColumnsWidth)] }) }) })) }));
|
|
52
|
+
.map(function (column, index) { return (_jsx(HeadCell, { column: column, isDragDisabled: isDragDisabled, displayColumnsWidth: displayColumnsWidth, onResizeOut: onResizeOut, onResizeOver: onResizeOver, onResize: onResize, sortingValues: sortingValues, onSetSort: onSetSort, group: groups[index], hasResize: columnLayout === 'normal' || !!columns[index + 1], isSortTerminated: isSortTerminated }, column.name)); }), getStickyComponent(columns, 'right', displayColumnsWidth)] }) }) })) }));
|
|
53
53
|
};
|
|
54
54
|
export default HeadRow;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CommonGridProps } from '../types';
|
|
2
|
+
import type { CommonGridProps } from '../types';
|
|
3
3
|
type OversizedScrollProps = {
|
|
4
4
|
columnLayout: Required<CommonGridProps>['columnLayout'];
|
|
5
|
-
isLoading?: boolean;
|
|
6
5
|
children: React.ReactNode;
|
|
7
6
|
floatingChildren?: React.ReactNode;
|
|
8
7
|
totalColumnsWidth: number;
|
|
@@ -6,15 +6,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import styled, { css } from '@xstyled/styled-components';
|
|
8
8
|
var ScrollWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (props) {
|
|
9
|
-
return props.columnLayout
|
|
9
|
+
return props.columnLayout !== 'no-scroll' && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow-x: ", ";\n position: relative;\n @media (min-width: 1024px) {\n overflow-x: auto;\n }\n "], ["\n overflow-x: ", ";\n position: relative;\n @media (min-width: 1024px) {\n overflow-x: auto;\n }\n "])), props.columnLayout === 'sticky' ? 'inherit' : 'auto');
|
|
10
10
|
});
|
|
11
11
|
var ScrollSizer = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), function (props) {
|
|
12
|
-
return props.columnLayout
|
|
12
|
+
return props.columnLayout !== 'no-scroll' && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", "px;\n "], ["\n width: ", "px;\n "])), props.totalColumnsWidth);
|
|
13
13
|
});
|
|
14
14
|
var FloatPosition = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: sticky;\n left: 0;\n"], ["\n position: sticky;\n left: 0;\n"])));
|
|
15
15
|
var OversizedScroll = function (_a, ref) {
|
|
16
|
-
var columnLayout = _a.columnLayout,
|
|
17
|
-
return (_jsxs(ScrollWrapper, { columnLayout: columnLayout,
|
|
16
|
+
var columnLayout = _a.columnLayout, children = _a.children, floatingChildren = _a.floatingChildren, totalColumnsWidth = _a.totalColumnsWidth;
|
|
17
|
+
return (_jsxs(ScrollWrapper, { columnLayout: columnLayout, className: "gridWrapper", ref: ref, children: [_jsx(ScrollSizer, { columnLayout: columnLayout, totalColumnsWidth: totalColumnsWidth, children: children }), floatingChildren && _jsx(FloatPosition, { children: floatingChildren })] }));
|
|
18
18
|
};
|
|
19
19
|
var forwardedWrapper = React.forwardRef(OversizedScroll);
|
|
20
20
|
export default forwardedWrapper;
|
|
@@ -31,6 +31,19 @@ export declare const MessageCell: import("styled-components").StyledComponent<"d
|
|
|
31
31
|
flexShrink?: number | undefined;
|
|
32
32
|
transition?: string | undefined;
|
|
33
33
|
transform?: string | undefined;
|
|
34
|
+
}, never>;
|
|
35
|
+
declare const variantColors: {
|
|
36
|
+
error: (props: import("@xstyled/util").Props<import("@xstyled/system").Theme>) => import("@xstyled/system").CSSScalar;
|
|
37
|
+
info: (props: import("@xstyled/util").Props<import("@xstyled/system").Theme>) => import("@xstyled/system").CSSScalar;
|
|
38
|
+
};
|
|
39
|
+
export declare const MessageCellBody: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
40
|
+
align?: string | undefined;
|
|
41
|
+
flexBasis?: number | undefined;
|
|
42
|
+
flexGrow?: number | undefined;
|
|
43
|
+
flexShrink?: number | undefined;
|
|
44
|
+
transition?: string | undefined;
|
|
45
|
+
transform?: string | undefined;
|
|
34
46
|
} & {
|
|
35
|
-
|
|
47
|
+
variant: keyof typeof variantColors;
|
|
36
48
|
}, never>;
|
|
49
|
+
export {};
|
|
@@ -7,5 +7,10 @@ export var Row = styled.div(templateObject_1 || (templateObject_1 = __makeTempla
|
|
|
7
7
|
export var Cell = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", ";\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: ", ";\n transition: ", ";\n transform: ", ";\n"], ["\n ", ";\n display: flex;\n overflow: hidden;\n align-items: center;\n justify-content: ", ";\n transition: ", ";\n transform: ", ";\n"])), system, function (props) { return props.align; }, function (props) { return props.transition; }, function (props) { return props.transform; });
|
|
8
8
|
export var StyledDataRow = styled(Row)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), function (props) { return (props.isEven ? th('colors.bgLightGray') : 'white'); });
|
|
9
9
|
export var TextCell = styled(Cell)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-overflow: ellipsis;\n white-space: nowrap;\n"], ["\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
|
|
10
|
-
export var MessageCell = styled(Cell)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width:
|
|
11
|
-
var
|
|
10
|
+
export var MessageCell = styled(Cell)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100vw;\n position: sticky;\n left: 0;\n justify-content: center;\n"], ["\n width: 100vw;\n position: sticky;\n left: 0;\n justify-content: center;\n"])));
|
|
11
|
+
var variantColors = {
|
|
12
|
+
error: th('colors.red1'),
|
|
13
|
+
info: th('colors.gray1')
|
|
14
|
+
};
|
|
15
|
+
export var MessageCellBody = styled(Cell)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding: 2px 10px;\n border-radius: 4px;\n color: ", ";\n"], ["\n padding: 2px 10px;\n border-radius: 4px;\n color: ", ";\n"])), function (props) { return variantColors[props.variant]; });
|
|
16
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -12,7 +12,7 @@ declare const useQuickFilter: ({ gridActions, gridSelectors, quickFilter, displa
|
|
|
12
12
|
searchedValue: string;
|
|
13
13
|
translatedValue: any;
|
|
14
14
|
onChangeInputValue: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
-
|
|
15
|
+
onClearSettings: () => void;
|
|
16
16
|
onDisplayInput: () => void;
|
|
17
17
|
displayInput: boolean;
|
|
18
18
|
onClear: () => void;
|
|
@@ -13,11 +13,11 @@ var defaultVoidFunction = function () {
|
|
|
13
13
|
var useQuickFilter = function (_a) {
|
|
14
14
|
var _b, _c;
|
|
15
15
|
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, quickFilter = _a.quickFilter, displayColumnsDefinitions = _a.displayColumnsDefinitions, filters = _a.filters;
|
|
16
|
-
var
|
|
16
|
+
var _d = gridActions.addFilter, addFilter = _d === void 0 ? defaultVoidFunction : _d, _e = gridActions.clearSettings, clearSettings = _e === void 0 ? defaultVoidFunction : _e;
|
|
17
17
|
var filter = gridSelectors.filter;
|
|
18
18
|
var isMobile = useCheckDeviceWidth().isMobile;
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var _f = useState(''), searchedValue = _f[0], setSearchedValue = _f[1];
|
|
20
|
+
var _g = useState(false), displayInput = _g[0], setDisplayInput = _g[1];
|
|
21
21
|
var handleAddFilter = useAddFilter(addFilter);
|
|
22
22
|
var quickFilterValues = quickFilter ? (_b = filter === null || filter === void 0 ? void 0 : filter[quickFilter]) === null || _b === void 0 ? void 0 : _b.value : undefined;
|
|
23
23
|
var searchedColumnsDefinitions = (displayColumnsDefinitions === null || displayColumnsDefinitions === void 0 ? void 0 : displayColumnsDefinitions.find(function (item) { return item.name === quickFilter; })) || null;
|
|
@@ -62,16 +62,16 @@ var useQuickFilter = function (_a) {
|
|
|
62
62
|
var onDisplayInput = useCallback(function () {
|
|
63
63
|
setDisplayInput(true);
|
|
64
64
|
}, []);
|
|
65
|
-
var
|
|
66
|
-
|
|
65
|
+
var onClearSettings = useCallback(function () {
|
|
66
|
+
clearSettings === null || clearSettings === void 0 ? void 0 : clearSettings();
|
|
67
67
|
setSearchedValue === null || setSearchedValue === void 0 ? void 0 : setSearchedValue('');
|
|
68
|
-
}, [
|
|
68
|
+
}, [clearSettings, setSearchedValue]);
|
|
69
69
|
var translatedValue = getTranslatedValue(searchedColumnsDefinitions);
|
|
70
70
|
return {
|
|
71
71
|
searchedValue: searchedValue,
|
|
72
72
|
translatedValue: translatedValue,
|
|
73
73
|
onChangeInputValue: onChangeInputValue,
|
|
74
|
-
|
|
74
|
+
onClearSettings: onClearSettings,
|
|
75
75
|
onDisplayInput: onDisplayInput,
|
|
76
76
|
displayInput: displayInput,
|
|
77
77
|
onClear: onClear,
|
|
@@ -122,6 +122,7 @@ export default (function (state, action) {
|
|
|
122
122
|
draft[gridName].page = initialState.page;
|
|
123
123
|
draft[gridName].filter = initialState.filter;
|
|
124
124
|
draft[gridName].uxState = initialState.uxState;
|
|
125
|
+
draft[gridName].sorting = [];
|
|
125
126
|
break;
|
|
126
127
|
case actionTypes.setPage:
|
|
127
128
|
draft[gridName].page = action.page;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
};
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const LoadingState: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const ErrorState: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const WarningSortState: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const TerminatedSortState: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { LinguiContainer } from '../../../../utils/LinguiContainer';
|
|
3
|
+
import CommonGrid from '../../CommonGridContainer';
|
|
4
|
+
import { columnDefinitions } from '../utils/columnDefinition';
|
|
5
|
+
import { createRandomData, gridSelectors, gridDummyActions } from '../utils/utils';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Blocks/CommonGrid'
|
|
8
|
+
};
|
|
9
|
+
export var LoadingState = function () { return (_jsx(LinguiContainer, { children: _jsx(CommonGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), gridSelectors: gridSelectors, gridActions: gridDummyActions, isLoading: true }) })); };
|
|
10
|
+
export var ErrorState = function () { return (_jsx(LinguiContainer, { children: _jsx(CommonGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), gridSelectors: gridSelectors, gridActions: gridDummyActions, errorMessage: "error message" }) })); };
|
|
11
|
+
export var WarningSortState = function () { return (_jsx(LinguiContainer, { children: _jsx(CommonGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), gridSelectors: gridSelectors, gridActions: gridDummyActions, totalRowsCount: 10, allowSortingOnlyUnderTotalRows: [5, 20] }) })); };
|
|
12
|
+
export var TerminatedSortState = function () { return (_jsx(LinguiContainer, { children: _jsx(CommonGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), gridSelectors: gridSelectors, gridActions: gridDummyActions, totalRowsCount: 100, allowSortingOnlyUnderTotalRows: [5, 20] }) })); };
|
|
@@ -7,7 +7,7 @@ export declare const CommonGridWrap: import("styled-components").StyledComponent
|
|
|
7
7
|
withPagination: boolean;
|
|
8
8
|
}, "color">;
|
|
9
9
|
export declare const StyledButtonStrip: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, import("@xstyled/system").Theme, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme>, "color">;
|
|
10
|
-
export declare const CommonGridWithStyles: import("styled-components").StyledComponent<({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, columnLayout, displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters }: import("./types").CommonGridProps & {
|
|
10
|
+
export declare const CommonGridWithStyles: import("styled-components").StyledComponent<({ filters, comparators, handleDragEnd, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowClick, columnLayout, displayColumnsDefinitions, className, minColumnWidth, errorMessage, floatingButtonProps, hasGroups, hasFilters, isSortTerminated }: import("./types").CommonGridProps & {
|
|
11
11
|
filters?: import("./types").FiltersConfig | undefined;
|
|
12
12
|
handleDragEnd: (item: import("@dnd-kit/core").DragEndEvent) => void;
|
|
13
13
|
displayColumnsDefinitions: import("./types").ColumnDefinition[];
|
|
@@ -6,7 +6,7 @@ import { gridRowHeight, gridFooterHeight, gridButtonStripHeight, gridHeadHeight,
|
|
|
6
6
|
import styled, { x } from '@xstyled/styled-components';
|
|
7
7
|
import { th } from '@xstyled/system';
|
|
8
8
|
import CommonGrid from './CommonGrid';
|
|
9
|
-
export var BottomWrapper = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: 2;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n
|
|
9
|
+
export var BottomWrapper = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: fixed;\n z-index: 2;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"], ["\n position: fixed;\n z-index: 2;\n bottom: 0px;\n padding: ", ";\n left: 0;\n width: 100%;\n height: ", "px;\n background-color: bgLightGray;\n\n @media print {\n display: none;\n }\n\n @media (min-width: 1024px) {\n position: relative;\n bottom: 0;\n margin-bottom: 0;\n }\n"])), function (_a) {
|
|
10
10
|
var withPagination = _a.withPagination;
|
|
11
11
|
return (withPagination ? '10px 0' : '0px');
|
|
12
12
|
}, function (_a) {
|
|
@@ -238,6 +238,7 @@ export type GridActionsType = {
|
|
|
238
238
|
setFilters?: (filters: Filtering) => void;
|
|
239
239
|
resetFilters?: () => void;
|
|
240
240
|
addSorting?: (column: string, direction: SortingValueType) => void;
|
|
241
|
+
resetSorting?: () => void;
|
|
241
242
|
openConfigForm?: () => void;
|
|
242
243
|
closeConfigForm?: () => void;
|
|
243
244
|
clearSettings?: () => void;
|
|
@@ -279,6 +280,7 @@ export type CommonGridProps<TData extends RowProps = RowProps> = {
|
|
|
279
280
|
floatingButtonProps?: FloatingButtonProps;
|
|
280
281
|
editReadPosition?: EditReadPosition;
|
|
281
282
|
comparators?: CustomComparators;
|
|
283
|
+
isSortTerminated?: boolean;
|
|
282
284
|
};
|
|
283
285
|
export declare enum EditReadPosition {
|
|
284
286
|
Left = "left",
|
|
@@ -323,6 +325,7 @@ export type GridProps = CommonGridProps & {
|
|
|
323
325
|
withPresets?: boolean;
|
|
324
326
|
withManageColumnButton?: boolean;
|
|
325
327
|
withPagination?: boolean;
|
|
328
|
+
allowSortingOnlyUnderTotalRows?: [number, number];
|
|
326
329
|
};
|
|
327
330
|
export type Item = {
|
|
328
331
|
title: string | JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type HasSortTerminatedProps = {
|
|
2
|
+
allowSortingOnlyUnderTotalRows?: [number, number];
|
|
3
|
+
totalRowsCount?: number;
|
|
4
|
+
};
|
|
5
|
+
declare const hasSortTerminated: ({ allowSortingOnlyUnderTotalRows, totalRowsCount }: HasSortTerminatedProps) => {
|
|
6
|
+
isSortTerminatedAppeal: boolean;
|
|
7
|
+
isSortTerminated: boolean;
|
|
8
|
+
};
|
|
9
|
+
export default hasSortTerminated;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var hasSortTerminated = function (_a) {
|
|
2
|
+
var allowSortingOnlyUnderTotalRows = _a.allowSortingOnlyUnderTotalRows, totalRowsCount = _a.totalRowsCount;
|
|
3
|
+
var allowSorting = allowSortingOnlyUnderTotalRows && totalRowsCount;
|
|
4
|
+
var isSortTerminatedAppeal = !!(allowSorting && totalRowsCount > allowSortingOnlyUnderTotalRows[0]);
|
|
5
|
+
var isSortTerminated = !!(allowSorting && totalRowsCount > allowSortingOnlyUnderTotalRows[1]);
|
|
6
|
+
return {
|
|
7
|
+
isSortTerminatedAppeal: isSortTerminatedAppeal,
|
|
8
|
+
isSortTerminated: isSortTerminated
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default hasSortTerminated;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../Icon';
|
|
2
3
|
import { x, useTheme } from '@xstyled/styled-components';
|
|
3
4
|
import { th } from '@xstyled/styled-components';
|
|
4
|
-
import { Icon } from '../Icon';
|
|
5
5
|
import { IconWrap, LinkWrapper, StyledAlert, VerticalSeparator, Text, Title, CloseBtn, ActionButton, Description } from './styles';
|
|
6
6
|
var alertBackgroundColor = {
|
|
7
7
|
success: 'green10',
|
|
8
8
|
info: 'blue10',
|
|
9
9
|
warning: 'yellow10',
|
|
10
|
-
danger: 'red10'
|
|
10
|
+
danger: 'red10'
|
|
11
11
|
};
|
|
12
12
|
var alertColorFill = {
|
|
13
13
|
success: 'successColor',
|
|
14
14
|
info: 'blue60',
|
|
15
15
|
warning: 'yellow70',
|
|
16
|
-
danger: 'dangerColor'
|
|
16
|
+
danger: 'dangerColor'
|
|
17
17
|
};
|
|
18
18
|
var alertIconMap = {
|
|
19
19
|
success: 'circleCheck',
|
|
20
20
|
info: 'info',
|
|
21
21
|
warning: 'circleTriangle',
|
|
22
|
-
danger: 'circleTriangle'
|
|
22
|
+
danger: 'circleTriangle'
|
|
23
23
|
};
|
|
24
|
-
var Alert = function (
|
|
25
|
-
var intent =
|
|
24
|
+
var Alert = function (_a) {
|
|
25
|
+
var intent = _a.intent, inline = _a.inline, onClick = _a.onClick, onClose = _a.onClose, title = _a.title, text = _a.text, href = _a.href, actionLabel = _a.actionLabel, actionType = _a.actionType, desc = _a.desc, _b = _a.closeAnywhere, closeAnywhere = _b === void 0 ? false : _b, height = _a.height;
|
|
26
26
|
var theme = useTheme();
|
|
27
27
|
var bgColor = th.color(intent ? alertBackgroundColor[intent] : 'transparent')({ theme: theme });
|
|
28
28
|
var colorFill = th.color(intent ? alertColorFill[intent] : 'transparent')({ theme: theme });
|
|
29
29
|
var icon = intent && alertIconMap[intent];
|
|
30
|
-
return (_jsxs(StyledAlert, { "$bgColor": bgColor, "$colorFill": colorFill, "$inline": inline, onClick: closeAnywhere ? onClose : undefined, children: [_jsxs(x.div, { display: "flex", alignItems: "center", children: [inline && _jsx(VerticalSeparator, { "$colorFill": colorFill }), icon && (_jsx(IconWrap, { children: _jsx(Icon, { icon: icon, size: "20px", fill: colorFill }) })), _jsxs("div", { children: [_jsx(Title, { children: title }), _jsxs(Text, { children: [" ", text] })] })] }), _jsxs(x.div, { display: "flex", alignItems: "center", children: [href && actionType === 'link' && (_jsx(LinkWrapper, { "$colorFill": colorFill, to: href, children: actionLabel !== null && actionLabel !== void 0 ? actionLabel : 'Link' })), onClick && actionType === 'button' && (_jsx(ActionButton, { "$colorFill": colorFill, onClick: onClick, children: actionLabel !== null && actionLabel !== void 0 ? actionLabel : 'Submit' })), onClose && !closeAnywhere && (_jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { icon: "close", size: "15px", fill: "gray" }) })), desc && _jsx(Description, { children: desc })] })] }));
|
|
30
|
+
return (_jsxs(StyledAlert, { "$bgColor": bgColor, "$colorFill": colorFill, "$inline": inline, onClick: closeAnywhere ? onClose : undefined, height: height, icon: icon, children: [_jsxs(x.div, { display: "flex", alignItems: "center", children: [inline && _jsx(VerticalSeparator, { "$colorFill": colorFill, height: height }), icon && (_jsx(IconWrap, { children: _jsx(Icon, { icon: icon, size: "20px", fill: colorFill }) })), _jsxs("div", { children: [_jsx(Title, { children: title }), _jsxs(Text, { children: [" ", text] })] })] }), _jsxs(x.div, { display: "flex", alignItems: "center", children: [href && actionType === 'link' && (_jsx(LinkWrapper, { "$colorFill": colorFill, to: href, children: actionLabel !== null && actionLabel !== void 0 ? actionLabel : 'Link' })), onClick && actionType === 'button' && (_jsx(ActionButton, { "$colorFill": colorFill, onClick: onClick, children: actionLabel !== null && actionLabel !== void 0 ? actionLabel : 'Submit' })), onClose && !closeAnywhere && (_jsx(CloseBtn, { onClick: onClose, children: _jsx(Icon, { icon: "close", size: "15px", fill: "gray" }) })), desc && _jsx(Description, { children: desc })] })] }));
|
|
31
31
|
};
|
|
32
32
|
export default Alert;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { StoryObj } from '@storybook/react';
|
|
2
3
|
declare const meta: {
|
|
3
4
|
title: string;
|
|
4
|
-
component: import("../types").
|
|
5
|
+
component: import("react").FC<import("../types").AlertProps>;
|
|
5
6
|
tags: string[];
|
|
6
7
|
argTypes: {};
|
|
7
8
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const StyledAlert: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, any, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme> & {
|
|
3
3
|
$inline?: boolean | undefined;
|
|
4
|
-
$colorFill:
|
|
5
|
-
$bgColor:
|
|
4
|
+
$colorFill: string;
|
|
5
|
+
$bgColor: string;
|
|
6
|
+
height?: string | undefined;
|
|
7
|
+
icon?: string | undefined;
|
|
6
8
|
}, "color">;
|
|
7
9
|
export declare const VerticalSeparator: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, any, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme> & {
|
|
8
|
-
$colorFill?:
|
|
10
|
+
$colorFill?: string | undefined;
|
|
11
|
+
height?: string | undefined;
|
|
9
12
|
}, "color">;
|
|
10
13
|
export declare const IconWrap: import("styled-components").StyledComponent<(props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color">) => import("react").ReactElement<any, "div">, any, import("@xstyled/system").SystemProps<import("@xstyled/system").Theme>, "color">;
|
|
11
14
|
export declare const Title: import("styled-components").StyledComponent<"span", any, {}, never>;
|