@mailstep/design-system 0.8.12 → 0.8.14
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 +3 -10
- package/ui/Blocks/CommonGrid/HoC/withReduxActions.js +0 -1
- package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.d.ts +1 -3
- package/ui/Blocks/CommonGrid/components/ControlButtons/ControlButtons.js +7 -14
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.d.ts +0 -1
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +7 -27
- package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.d.ts +0 -1
- package/ui/Blocks/CommonGrid/components/Filters/DatePickerRange/DatePickerRange.js +5 -17
- package/ui/Blocks/CommonGrid/components/GridInfo/index.js +0 -2
- package/ui/Blocks/CommonGrid/components/QuickFilter/QuickFilter.d.ts +1 -1
- package/ui/Blocks/CommonGrid/components/QuickFilter/QuickFilter.js +2 -2
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +1 -1
- package/ui/Blocks/CommonGrid/hooks/useQuickFilter.d.ts +2 -2
- package/ui/Blocks/CommonGrid/hooks/useQuickFilter.js +2 -2
- package/ui/Blocks/CommonGrid/store/index.d.ts +6 -4
- package/ui/Blocks/CommonGrid/store/index.js +2 -9
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.d.ts +0 -18
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +9 -37
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.d.ts +0 -2
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +14 -18
- package/ui/Blocks/CommonGrid/styles.d.ts +0 -1
- package/ui/Blocks/CommonGrid/styles.js +3 -6
- package/ui/Blocks/CommonGrid/types.d.ts +1 -1
- package/ui/Blocks/CommonGrid/utils/index.d.ts +0 -2
- package/ui/Blocks/CommonGrid/utils/index.js +2 -10
- package/ui/Elements/DropdownMenu/components/MenuItem.js +1 -1
- package/ui/Elements/Icon/icons/index.d.ts +0 -2
- package/ui/Elements/Icon/icons/index.js +0 -2
- package/ui/index.es.js +16062 -16884
- package/ui/index.umd.js +454 -494
- package/ui/utils/translations.js +1 -1
- package/ui/Blocks/CommonGrid/components/MobileFilterDropdown.d.ts +0 -4
- package/ui/Blocks/CommonGrid/components/MobileFilterDropdown.js +0 -13
- package/ui/Blocks/CommonGrid/components/MobileFilterModal.d.ts +0 -20
- package/ui/Blocks/CommonGrid/components/MobileFilterModal.js +0 -69
- package/ui/Blocks/CommonGrid/components/MobileSortModal.d.ts +0 -13
- package/ui/Blocks/CommonGrid/components/MobileSortModal.js +0 -34
- package/ui/Elements/Icon/icons/Filter.d.ts +0 -4
- package/ui/Elements/Icon/icons/Filter.js +0 -13
- package/ui/Elements/Icon/icons/Sort.d.ts +0 -4
- package/ui/Elements/Icon/icons/Sort.js +0 -13
package/package.json
CHANGED
|
@@ -23,15 +23,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
24
|
import { useRef, useMemo, useState } from 'react';
|
|
25
25
|
import { Pagination } from '../../Elements/Pagination';
|
|
26
|
-
import { useCheckDeviceWidth } from '../../utils/CheckDeviceWidth/checkDeviceWidth';
|
|
27
26
|
import HidePrint from '../HidePrint/HidePrint';
|
|
28
27
|
import { useModal } from '../Modal/hooks/useModal';
|
|
29
28
|
import ActionHead from './components/ActionHead';
|
|
30
29
|
import ControlButtons from './components/ControlButtons';
|
|
31
30
|
import { GridInfo } from './components/GridInfo';
|
|
32
31
|
import { GridModals } from './components/GridModals';
|
|
33
|
-
import MobileFilterModal from './components/MobileFilterModal';
|
|
34
|
-
import MobileSortModal from './components/MobileSortModal';
|
|
35
32
|
import TablePagination from './components/TablePagination';
|
|
36
33
|
import useEditReadAsColumn from './hooks/useEditReadAsColumn';
|
|
37
34
|
import { useGridAutoRowsPerPage } from './hooks/useGridAutoRowsPerPage';
|
|
@@ -53,10 +50,8 @@ var CommonGridContainer = function (props) {
|
|
|
53
50
|
var withButtonStrip = !!(extendedExtraControlButtons === null || extendedExtraControlButtons === void 0 ? void 0 : extendedExtraControlButtons.length) || !hideControlButtons || !!withPresets || !!withManageColumnButton;
|
|
54
51
|
var hasGroups = !!props.columnsDefinitions.find(function (col) { return col.group; });
|
|
55
52
|
var hasFilters = !!props.columnsDefinitions.find(function (col) { return col.filtering; });
|
|
56
|
-
var hasSortableColumns = !!props.columnsDefinitions.find(function (col) { return col.sorting; });
|
|
57
53
|
var hasGroupsOrFilters = hasGroups || hasFilters;
|
|
58
54
|
var autoRowsPerPage = getRowsPerPage(gridRef, withPagination, withButtonStrip, hasGroupsOrFilters);
|
|
59
|
-
var isMobile = useCheckDeviceWidth().isMobile;
|
|
60
55
|
useGridAutoRowsPerPage({
|
|
61
56
|
autoHeight: autoHeight,
|
|
62
57
|
gridActions: gridActions,
|
|
@@ -75,12 +70,10 @@ var CommonGridContainer = function (props) {
|
|
|
75
70
|
onClose: onClose
|
|
76
71
|
}), columnsConfigValues = _j.columnsConfigValues, setColumnsConfigOptions = _j.setColumnsConfigOptions, onConfirmForm = _j.onConfirmForm, resetColumnConfig = _j.resetColumnConfig, handleDragEnd = _j.handleDragEnd, onCloseForm = _j.onCloseForm, displayColumnsDefinitions = _j.displayColumnsDefinitions, manageColumnsFormDefinitions = _j.manageColumnsFormDefinitions;
|
|
77
72
|
var _k = usePresetState(), isPresetsModalOpen = _k.isPresetsModalOpen, onClosePresetsModal = _k.onClosePresetsModal, onOpenPresetsModal = _k.onOpenPresetsModal, setSelectedPresetName = _k.setSelectedPresetName, selectedPresetName = _k.selectedPresetName;
|
|
78
|
-
var _l =
|
|
79
|
-
var _m = useModal(), isMobileSortOpen = _m.isOpen, openMobileSort = _m.onOpen, closeMobileSort = _m.onClose;
|
|
80
|
-
var _o = hasSortTerminated({
|
|
73
|
+
var _l = hasSortTerminated({
|
|
81
74
|
allowSortingOnlyUnderTotalRows: allowSortingOnlyUnderTotalRows,
|
|
82
75
|
totalRowsCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount
|
|
83
|
-
}), isSortTerminatedAppeal =
|
|
84
|
-
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: extendedExtraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, quickFilter: quickFilter,
|
|
76
|
+
}), isSortTerminatedAppeal = _l.isSortTerminatedAppeal, isSortTerminated = _l.isSortTerminated;
|
|
77
|
+
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: extendedExtraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, quickFilter: quickFilter, columns: columns, 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 })] }));
|
|
85
78
|
};
|
|
86
79
|
export default CommonGridContainer;
|
|
@@ -29,7 +29,6 @@ var withReduxActions = function (gridName, prefix) {
|
|
|
29
29
|
setFilters: actions.setFilters,
|
|
30
30
|
resetFilters: actions.resetFilters,
|
|
31
31
|
addSorting: actions.addSorting,
|
|
32
|
-
resetSorting: actions.resetSorting,
|
|
33
32
|
clearSettings: actions.clearSettings,
|
|
34
33
|
setColumnWidth: actions.setColumnWidth,
|
|
35
34
|
resetGrid: actions.resetGrid,
|
|
@@ -6,7 +6,7 @@ type Props = {
|
|
|
6
6
|
gridActions: GridActionsType;
|
|
7
7
|
gridSelectors: GridSelectorsType;
|
|
8
8
|
quickFilter?: CommonGridProps['quickFilter'];
|
|
9
|
-
|
|
9
|
+
columns?: Array<ColumnDefinition<string>>;
|
|
10
10
|
filters?: FiltersConfig;
|
|
11
11
|
hideControlButtons?: boolean;
|
|
12
12
|
displayManageColumnButton?: boolean;
|
|
@@ -17,8 +17,6 @@ type Props = {
|
|
|
17
17
|
selectedPresetName: string;
|
|
18
18
|
withPresets?: boolean;
|
|
19
19
|
withManageColumnButton?: boolean;
|
|
20
|
-
onOpenMobileFilters?: () => void;
|
|
21
|
-
onOpenMobileSorting?: () => void;
|
|
22
20
|
};
|
|
23
21
|
declare const ControlButtons: FC<Props>;
|
|
24
22
|
export default ControlButtons;
|
|
@@ -12,15 +12,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect } from 'react';
|
|
14
14
|
import Button from '../../../../Elements/Button/Button';
|
|
15
|
-
import { Filter } from '../../../../Elements/Icon/icons/Filter';
|
|
16
15
|
import { Settings2 } from '../../../../Elements/Icon/icons/Settings2';
|
|
17
|
-
import { Sort } from '../../../../Elements/Icon/icons/Sort';
|
|
18
16
|
import Tag from '../../../../Elements/Tag/Tag';
|
|
19
17
|
import { palettes } from '../../../../Elements/Tag/palettes';
|
|
20
18
|
import { H6 } from '../../../../Elements/Typography';
|
|
21
19
|
import useQuickFilter from '../../hooks/useQuickFilter';
|
|
22
20
|
import { ExtraControlButtonPosition } from '../../types';
|
|
23
|
-
import { isFilterActive } from '../../utils';
|
|
24
21
|
import ExtraControlButtons from '../ExtraControlButtons';
|
|
25
22
|
import QuickFilter from '../QuickFilter';
|
|
26
23
|
import { i18n } from '@lingui/core';
|
|
@@ -28,26 +25,22 @@ import { Trans } from '@lingui/react';
|
|
|
28
25
|
import { x } from '@xstyled/styled-components';
|
|
29
26
|
import { ControlButtonsContainer, Left, Right, StyledColumnButton } from './styles';
|
|
30
27
|
var ControlButtons = function (_a) {
|
|
31
|
-
var _b,
|
|
32
|
-
var
|
|
33
|
-
var _e = useQuickFilter({
|
|
28
|
+
var extraControlButtons = _a.extraControlButtons, gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, _b = _a.quickFilter, quickFilter = _b === void 0 ? '' : _b, columns = _a.columns, filters = _a.filters, hideControlButtons = _a.hideControlButtons, displayManageColumnButton = _a.displayManageColumnButton, openManageColumnForm = _a.openManageColumnForm, setDisplayManageColumnButton = _a.setDisplayManageColumnButton, onOpenPresetsModal = _a.onOpenPresetsModal, gridName = _a.gridName, selectedPresetName = _a.selectedPresetName, withPresets = _a.withPresets, withManageColumnButton = _a.withManageColumnButton;
|
|
29
|
+
var _c = useQuickFilter({
|
|
34
30
|
gridActions: gridActions,
|
|
35
31
|
gridSelectors: gridSelectors,
|
|
36
32
|
quickFilter: quickFilter,
|
|
37
|
-
|
|
33
|
+
columns: columns,
|
|
38
34
|
filters: filters
|
|
39
|
-
}), searchedValue =
|
|
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;
|
|
40
36
|
useEffect(function () {
|
|
41
37
|
setDisplayManageColumnButton(!isMobileInputView && !!withManageColumnButton);
|
|
42
38
|
}, [isMobileInputView, withManageColumnButton, setDisplayManageColumnButton]);
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
var hasSortableColumns = !!(displayColumnsDefinitions === null || displayColumnsDefinitions === void 0 ? void 0 : displayColumnsDefinitions.some(function (col) { return col.sorting; }));
|
|
46
|
-
var sortCount = (_c = (_b = gridSelectors.sorting) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
47
|
-
return (_jsxs(ControlButtonsContainer, { children: [_jsxs(Left, { children: [!hideControlButtons && (_jsxs(_Fragment, { children: [quickFilter && !isMobile && (_jsx(QuickFilter, { searchedValue: searchedValue, placeholderText: i18n._({
|
|
39
|
+
var filtersOn = !!filter && Object.values(filter).some(function (item) { var _a; return ((_a = item.value) === null || _a === void 0 ? void 0 : _a.value) !== '' && item.value !== ''; });
|
|
40
|
+
return (_jsxs(ControlButtonsContainer, { children: [_jsxs(Left, { children: [!hideControlButtons && (_jsxs(_Fragment, { children: [quickFilter && (_jsx(QuickFilter, { searchedValue: searchedValue, placeholderText: i18n._({
|
|
48
41
|
id: 'controlButtons.searchPlaceholder',
|
|
49
42
|
message: "Search ".concat(translatedValue, " ..."),
|
|
50
43
|
values: { translatedValue: translatedValue }
|
|
51
|
-
}), onChange: onChangeInputValue, onClear: onClear, onClick: onDisplayInput, displayInput: displayInput, isMobileInputView: isMobileInputView })), _jsx(ExtraControlButtons, { extraControlButtons: extraControlButtons, targetPosition: ExtraControlButtonPosition.TopLeft
|
|
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" }, palettes.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" }) }) }))] })] }));
|
|
52
45
|
};
|
|
53
46
|
export default ControlButtons;
|
|
@@ -5,7 +5,6 @@ export declare const Row: import('styled-components').StyledComponent<"div", imp
|
|
|
5
5
|
type Props = {
|
|
6
6
|
extraControlButtons: CommonGridProps['extraControlButtons'];
|
|
7
7
|
targetPosition: ExtraControlButton['position'];
|
|
8
|
-
isMobile?: boolean;
|
|
9
8
|
};
|
|
10
9
|
declare const ExtraControlButtons: FC<Props>;
|
|
11
10
|
export default ExtraControlButtons;
|
|
@@ -16,7 +16,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
16
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import Button from '../../../../Elements/Button/Button';
|
|
18
18
|
import DropdownSelect from '../../../../Elements/DropdownSelect';
|
|
19
|
-
import ButtonMore from '../ButtonMore/ButtonMore';
|
|
20
19
|
import styled, { x } from '@xstyled/styled-components';
|
|
21
20
|
export var Row = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n & > * {\n margin-right: 12px;\n }\n z-index: 2;\n"], ["\n display: flex;\n & > * {\n margin-right: 12px;\n }\n z-index: 2;\n"])));
|
|
22
21
|
var StyledButton = styled(Button)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: none;\n\n @media (min-width: 1024px) {\n display: block;\n }\n"], ["\n display: none;\n\n @media (min-width: 1024px) {\n display: block;\n }\n"])));
|
|
@@ -35,32 +34,13 @@ var ControlButton = function (_a) {
|
|
|
35
34
|
}
|
|
36
35
|
};
|
|
37
36
|
var ExtraControlButtons = function (_a) {
|
|
38
|
-
var extraControlButtons = _a.extraControlButtons, targetPosition = _a.targetPosition
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var onSelect = _a.onSelect, onClick = _a.onClick, options = _a.options, label = _a.label;
|
|
46
|
-
if (options && onSelect) {
|
|
47
|
-
return options.map(function (option) { return ({
|
|
48
|
-
title: option.label,
|
|
49
|
-
onClick: function () {
|
|
50
|
-
onSelect(option.value);
|
|
51
|
-
}
|
|
52
|
-
}); });
|
|
53
|
-
}
|
|
54
|
-
if (label && onClick) {
|
|
55
|
-
return [{ title: label, onClick: onClick }];
|
|
56
|
-
}
|
|
57
|
-
return [];
|
|
58
|
-
});
|
|
59
|
-
if (items.length === 0)
|
|
60
|
-
return null;
|
|
61
|
-
return _jsx(ButtonMore, { items: items });
|
|
62
|
-
}
|
|
63
|
-
return (_jsx(Row, { children: buttons.map(function (button, idx) { return (_jsx(x.div, { children: _jsx(ControlButton, __assign({}, button)) }, idx)); }) }));
|
|
37
|
+
var extraControlButtons = _a.extraControlButtons, targetPosition = _a.targetPosition;
|
|
38
|
+
return (_jsx(Row, { children: (extraControlButtons || [])
|
|
39
|
+
.filter(function (_a) {
|
|
40
|
+
var position = _a.position;
|
|
41
|
+
return position == targetPosition;
|
|
42
|
+
})
|
|
43
|
+
.map(function (button, idx) { return (_jsx(x.div, { children: _jsx(ControlButton, __assign({}, button)) }, idx)); }) }));
|
|
64
44
|
};
|
|
65
45
|
export default ExtraControlButtons;
|
|
66
46
|
var templateObject_1, templateObject_2;
|
|
@@ -11,7 +11,6 @@ type DatePickerRangeProps = FilterComponentProps<Date[]> & {
|
|
|
11
11
|
type DateRangeProps = DatePickerRangeProps & {
|
|
12
12
|
error?: string;
|
|
13
13
|
label?: string;
|
|
14
|
-
compact?: boolean;
|
|
15
14
|
};
|
|
16
15
|
declare const DatePickerRange: FC<DateRangeProps>;
|
|
17
16
|
export default DatePickerRange;
|
|
@@ -33,27 +33,15 @@ import { useClickOutside } from '../../../../Modal/hooks/useClickOutside';
|
|
|
33
33
|
import { getCleanValues } from './utils/getCleanValues';
|
|
34
34
|
import { pickerRangeToString } from './utils/pickerRangeToString';
|
|
35
35
|
import { i18n } from '@lingui/core';
|
|
36
|
-
import styled
|
|
37
|
-
var RangeWrapper = styled.div(
|
|
38
|
-
var $compact = _a.$compact;
|
|
39
|
-
return ($compact ? 'flex' : 'inline-flex');
|
|
40
|
-
}, function (_a) {
|
|
41
|
-
var $compact = _a.$compact;
|
|
42
|
-
return ($compact ? 'column' : 'row');
|
|
43
|
-
}, function (_a) {
|
|
44
|
-
var $compact = _a.$compact;
|
|
45
|
-
return ($compact ? '0' : '20px');
|
|
46
|
-
}, function (_a) {
|
|
47
|
-
var $compact = _a.$compact;
|
|
48
|
-
return $compact && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n .rdtPicker {\n min-width: unset;\n width: 100%;\n box-sizing: border-box;\n padding: 0.5rem 0.5rem;\n }\n .rdtPicker .rdtDays {\n min-width: unset;\n }\n .rdtPicker td {\n padding: 0 0.2rem;\n }\n "], ["\n .rdtPicker {\n min-width: unset;\n width: 100%;\n box-sizing: border-box;\n padding: 0.5rem 0.5rem;\n }\n .rdtPicker .rdtDays {\n min-width: unset;\n }\n .rdtPicker td {\n padding: 0 0.2rem;\n }\n "])));
|
|
49
|
-
});
|
|
36
|
+
import styled from '@xstyled/styled-components';
|
|
37
|
+
var RangeWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n margin-right: 20px;\n"], ["\n display: inline-flex;\n margin-right: 20px;\n"])));
|
|
50
38
|
var OverlayComponentDefault = function (_a) {
|
|
51
39
|
var children = _a.children;
|
|
52
40
|
return _jsx("div", { children: children });
|
|
53
41
|
};
|
|
54
42
|
var DatePickerRange = function (props) {
|
|
55
43
|
var _a, _b, _c;
|
|
56
|
-
var onChange = props.onChange, error = props.error, label = props.label, value = props.value, others = props.others, filterTime = props.filterTime, initialView = props.initialView,
|
|
44
|
+
var onChange = props.onChange, error = props.error, label = props.label, value = props.value, others = props.others, filterTime = props.filterTime, initialView = props.initialView, _d = props.OverlayComponent, OverlayComponent = _d === void 0 ? OverlayComponentDefault : _d, rest = __rest(props, ["onChange", "error", "label", "value", "others", "filterTime", "initialView", "OverlayComponent"]);
|
|
57
45
|
var _e = useState((_a = value === null || value === void 0 ? void 0 : value[0]) !== null && _a !== void 0 ? _a : undefined), startRangeValue = _e[0], setStartRangeValue = _e[1];
|
|
58
46
|
var _f = useState((_b = value === null || value === void 0 ? void 0 : value[1]) !== null && _b !== void 0 ? _b : undefined), endRangeValue = _f[0], setEndRangeValue = _f[1];
|
|
59
47
|
var timeFormat = filterTime ? 'HH:mm' : false;
|
|
@@ -106,7 +94,7 @@ var DatePickerRange = function (props) {
|
|
|
106
94
|
// Check if the second value is not selected and the first value is the same as the initial value
|
|
107
95
|
var secondDatePickerValue = cleanValue[1] === null ? cleanValue[0] : cleanValue[1];
|
|
108
96
|
var ref = useClickOutside({ onClose: onClose });
|
|
109
|
-
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue, others), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, {
|
|
97
|
+
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue, others), label: props.label, onFocus: openPicker, iconOnClick: openPicker, onClear: clear, error: error, readOnly: true }), _jsx(OverlayComponent, { children: _jsx(_Fragment, { children: isOpen && (_jsxs(RangeWrapper, { className: "ignore-element-for-closing-hook", children: [_jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: (_c = cleanValue[0]) !== null && _c !== void 0 ? _c : '', initialViewDate: initialViewDate[0], secondValue: endRangeValue, onChange: setDateFrom, others: others === null || others === void 0 ? void 0 : others[0], onChangeOthers: handleOthersChangeFrom, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, others: others === null || others === void 0 ? void 0 : others[1], onChangeOthers: handleOthersChangeTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, isSecondDatePicker: true }))] })) }) })] }));
|
|
110
98
|
};
|
|
111
99
|
export default DatePickerRange;
|
|
112
|
-
var templateObject_1
|
|
100
|
+
var templateObject_1;
|
|
@@ -4,7 +4,5 @@ import { Trans } from '@lingui/react';
|
|
|
4
4
|
import { x } from '@xstyled/styled-components';
|
|
5
5
|
export var GridInfo = function (_a) {
|
|
6
6
|
var isSortTerminatedAppeal = _a.isSortTerminatedAppeal, isSortTerminated = _a.isSortTerminated;
|
|
7
|
-
if (!isSortTerminatedAppeal)
|
|
8
|
-
return null;
|
|
9
7
|
return (_jsxs(x.span, { ml: "8px", fontSize: "12px", display: "flex", gap: "8px", alignItems: "center", children: [isSortTerminatedAppeal && !isSortTerminated && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "circleTriangle", size: "20px", fill: "yellow70" }), _jsx(Trans, { id: "dataGrid.sortingTerminatedAppeal", message: "Too many results, please set a filter" })] })), isSortTerminated && (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: "circleTriangle", size: "20px", fill: "dangerColor" }), _jsx(Trans, { id: "dataGrid.sortingTerminated", message: "Too many results, sorting cannot be used" })] }))] }));
|
|
10
8
|
};
|
|
@@ -10,5 +10,5 @@ type QuickFilterProps = {
|
|
|
10
10
|
isMobileInputView?: boolean;
|
|
11
11
|
alwaysShowClear?: boolean;
|
|
12
12
|
};
|
|
13
|
-
declare const QuickFilter: ({ searchedValue, placeholderText, onChange, onClick, displayInput, onClear, isMobileInputView, alwaysShowClear }: QuickFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const QuickFilter: ({ searchedValue, placeholderText, onChange, onClick, displayInput, onClear, isMobileInputView, alwaysShowClear, }: QuickFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
export default QuickFilter;
|
|
@@ -3,9 +3,9 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import Button from '../../../../Elements/Button';
|
|
7
6
|
import Input from '../../../../Forms/Input';
|
|
8
7
|
import styled, { x } from '@xstyled/styled-components';
|
|
8
|
+
import Button from '../../../../Elements/Button';
|
|
9
9
|
var StyledInput = styled(Input)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: ", ";\n z-index: ", ";\n width: ", ";\n"], ["\n position: ", ";\n z-index: ", ";\n width: ", ";\n"])), function (_a) {
|
|
10
10
|
var isMobileInputView = _a.isMobileInputView;
|
|
11
11
|
return (isMobileInputView ? 'absolute' : 'relative');
|
|
@@ -14,7 +14,7 @@ var StyledInput = styled(Input)(templateObject_1 || (templateObject_1 = __makeTe
|
|
|
14
14
|
return (isMobileInputView ? '3' : '1');
|
|
15
15
|
}, function (_a) {
|
|
16
16
|
var isMobileInputView = _a.isMobileInputView;
|
|
17
|
-
return (isMobileInputView ? '
|
|
17
|
+
return (isMobileInputView ? '90vw' : 'auto');
|
|
18
18
|
});
|
|
19
19
|
var QuickFilter = function (_a) {
|
|
20
20
|
var searchedValue = _a.searchedValue, placeholderText = _a.placeholderText, onChange = _a.onChange, onClick = _a.onClick, displayInput = _a.displayInput, onClear = _a.onClear, isMobileInputView = _a.isMobileInputView, alwaysShowClear = _a.alwaysShowClear;
|
|
@@ -60,7 +60,7 @@ var useManageColumn = function (_a) {
|
|
|
60
60
|
setColumnsConfigOptions(columnConfig || {});
|
|
61
61
|
}, [columnsOrderValue, onClose]);
|
|
62
62
|
var getSortedColumns = useCallback(function (orderValues, isManageModal) {
|
|
63
|
-
var list =
|
|
63
|
+
var list = columns.filter(function (column) { return isManageModal ? !column.alwaysOff : isColumnOn(column, columnsConfigOptions); });
|
|
64
64
|
var sortFunction = function (col1, col2) {
|
|
65
65
|
var i = (orderValues || []).indexOf(col1.name);
|
|
66
66
|
var j = (orderValues || []).indexOf(col2.name);
|
|
@@ -6,10 +6,10 @@ type Props = {
|
|
|
6
6
|
gridSelectors: GridSelectorsType;
|
|
7
7
|
quickFilter?: CommonGridProps['quickFilter'];
|
|
8
8
|
filter?: CommonGridProps['gridSelectors']['filter'];
|
|
9
|
-
|
|
9
|
+
columns?: ColumnDefinition<string>[];
|
|
10
10
|
filters?: FiltersConfig;
|
|
11
11
|
};
|
|
12
|
-
declare const useQuickFilter: ({ gridActions, gridSelectors, quickFilter,
|
|
12
|
+
declare const useQuickFilter: ({ gridActions, gridSelectors, quickFilter, columns, filters }: Props) => {
|
|
13
13
|
searchedValue: string;
|
|
14
14
|
translatedValue: import('react').ReactNode;
|
|
15
15
|
onChangeInputValue: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -12,7 +12,7 @@ var defaultVoidFunction = function () {
|
|
|
12
12
|
};
|
|
13
13
|
var useQuickFilter = function (_a) {
|
|
14
14
|
var _b, _c;
|
|
15
|
-
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, quickFilter = _a.quickFilter,
|
|
15
|
+
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, quickFilter = _a.quickFilter, columns = _a.columns, filters = _a.filters;
|
|
16
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;
|
|
@@ -20,7 +20,7 @@ var useQuickFilter = function (_a) {
|
|
|
20
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
|
-
var searchedColumnsDefinitions = (
|
|
23
|
+
var searchedColumnsDefinitions = (columns === null || columns === void 0 ? void 0 : columns.find(function (item) { return item.name === quickFilter; })) || null;
|
|
24
24
|
var filterType = createFilterType(searchedColumnsDefinitions || {});
|
|
25
25
|
var filtersDefaultComparator = ((_c = filters === null || filters === void 0 ? void 0 : filters[filterType].defaultExtraProps) === null || _c === void 0 ? void 0 : _c.defaultComparator) || 'eq';
|
|
26
26
|
var searchComparator = (quickFilterValues && quickFilterValues.comparator) || filtersDefaultComparator;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { FilterProps, SortingValueType, InitProps, GridState, GridSelectorsType, ColumnConfig, Filtering, GridPresets } from '../types';
|
|
2
2
|
|
|
3
3
|
type DefaultRootState = {};
|
|
4
|
-
export type MultiState =
|
|
4
|
+
export type MultiState = {
|
|
5
|
+
[key: string]: GridState;
|
|
6
|
+
};
|
|
5
7
|
export declare const initialState: GridState;
|
|
6
8
|
export declare const actionPrefix = "@store/CommonGrid";
|
|
7
9
|
export declare const actionTypes: {
|
|
@@ -20,7 +22,6 @@ export declare const actionTypes: {
|
|
|
20
22
|
addFilter: string;
|
|
21
23
|
setFilters: string;
|
|
22
24
|
addSorting: string;
|
|
23
|
-
resetSorting: string;
|
|
24
25
|
clearSettings: string;
|
|
25
26
|
resetGrid: string;
|
|
26
27
|
setColumnWidth: string;
|
|
@@ -39,7 +40,9 @@ export declare const createActions: (gridName: string) => {
|
|
|
39
40
|
setPresets: (presets: GridPresets) => Action;
|
|
40
41
|
createPreset: (presetName: string, filters: Filtering) => Action;
|
|
41
42
|
deletePreset: (presetName: string) => Action;
|
|
42
|
-
setColumnWidth: (columnsWidth: null |
|
|
43
|
+
setColumnWidth: (columnsWidth: null | {
|
|
44
|
+
[anyKey: string]: number;
|
|
45
|
+
}, columnLayout: "normal" | "no-scroll" | "sticky") => Action;
|
|
43
46
|
resetGrid: () => Action;
|
|
44
47
|
setColumnsOrder: (columnsOrder: string[]) => Action;
|
|
45
48
|
setRowsPerPage: (rowsPerPage: number) => Action;
|
|
@@ -47,7 +50,6 @@ export declare const createActions: (gridName: string) => {
|
|
|
47
50
|
addFilter: (column: string, value: any, filterProps: FilterProps, others?: any) => Action;
|
|
48
51
|
setFilters: (filters: Filtering) => Action;
|
|
49
52
|
addSorting: (column: string, direction: SortingValueType) => Action;
|
|
50
|
-
resetSorting: () => Action;
|
|
51
53
|
clearSettings: () => Action;
|
|
52
54
|
};
|
|
53
55
|
export declare const createSelectors: (gridName: string) => {
|
|
@@ -46,7 +46,6 @@ export var actionTypes = {
|
|
|
46
46
|
addFilter: "".concat(actionPrefix, "/addFilter"),
|
|
47
47
|
setFilters: "".concat(actionPrefix, "/setFilters"),
|
|
48
48
|
addSorting: "".concat(actionPrefix, "/addSorting"),
|
|
49
|
-
resetSorting: "".concat(actionPrefix, "/resetSorting"),
|
|
50
49
|
clearSettings: "".concat(actionPrefix, "/clearSettings"),
|
|
51
50
|
resetGrid: "".concat(actionPrefix, "/resetGrid"),
|
|
52
51
|
setColumnWidth: "".concat(actionPrefix, "/setColumnWidth"),
|
|
@@ -57,7 +56,7 @@ export default (function (state, action) {
|
|
|
57
56
|
if (state === void 0) { state = {}; }
|
|
58
57
|
return produce(state, function (draft) {
|
|
59
58
|
var _a, _b, _c;
|
|
60
|
-
var _d, _e, _f, _g, _h
|
|
59
|
+
var _d, _e, _f, _g, _h;
|
|
61
60
|
// version migrations
|
|
62
61
|
if (!migrationChecked && state && Object.keys(state).length > 0) {
|
|
63
62
|
draft = migrateState(draft);
|
|
@@ -119,9 +118,6 @@ export default (function (state, action) {
|
|
|
119
118
|
}
|
|
120
119
|
draft[gridName].sorting = sorting;
|
|
121
120
|
break;
|
|
122
|
-
case actionTypes.resetSorting:
|
|
123
|
-
draft[gridName].sorting = ((_j = draft[gridName].defaultSorting) === null || _j === void 0 ? void 0 : _j.length) ? draft[gridName].defaultSorting : initialState.sorting;
|
|
124
|
-
break;
|
|
125
121
|
case actionTypes.clearSettings:
|
|
126
122
|
draft[gridName].page = initialState.page;
|
|
127
123
|
draft[gridName].filter = initialState.filter;
|
|
@@ -215,7 +211,6 @@ export var createActions = function (gridName) { return ({
|
|
|
215
211
|
column: column,
|
|
216
212
|
direction: direction
|
|
217
213
|
}); },
|
|
218
|
-
resetSorting: function () { return ({ gridName: gridName, type: actionTypes.resetSorting }); },
|
|
219
214
|
clearSettings: function () { return ({ gridName: gridName, type: actionTypes.clearSettings }); }
|
|
220
215
|
}); };
|
|
221
216
|
export var createSelectors = function (gridName) { return ({
|
|
@@ -229,9 +224,7 @@ export var createSelectors = function (gridName) { return ({
|
|
|
229
224
|
return getOr(initialState.columnConfig, "commonGrid.".concat(gridName, ".columnConfig"), state);
|
|
230
225
|
},
|
|
231
226
|
getPage: function (state) { return getOr(initialState.page, "commonGrid.".concat(gridName, ".page"), state); },
|
|
232
|
-
getPresets: function (state) {
|
|
233
|
-
return getOr(initialState.presets, "commonGrid.".concat(gridName, ".presets"), state);
|
|
234
|
-
},
|
|
227
|
+
getPresets: function (state) { return getOr(initialState.presets, "commonGrid.".concat(gridName, ".presets"), state); },
|
|
235
228
|
getRowsPerPage: function (state) {
|
|
236
229
|
return getOr(initialState.rowsPerPage, "commonGrid.".concat(gridName, ".rowsPerPage"), state);
|
|
237
230
|
},
|
|
@@ -9,21 +9,3 @@ export declare const ComplexWithPaginationAndRedux: {
|
|
|
9
9
|
name: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare const ComplexWithCheckbox: {
|
|
13
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
story: {
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export declare const ComplexWithEditButton: {
|
|
19
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
story: {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export declare const ComplexWithStickyColumn: {
|
|
25
|
-
(): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
story: {
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
@@ -5,9 +5,16 @@ import withReduxActions from '../../HoC/withReduxActions';
|
|
|
5
5
|
import { useAddFilter } from '../../hooks/useAddFilter';
|
|
6
6
|
import { ExtraControlButtonPosition } from '../../types';
|
|
7
7
|
import { onRowEditClick, onRowReadClick, onRowAction, onRowClick, onBatchAction } from '../utils/actions';
|
|
8
|
-
import { columnDefinitions, enumColumn
|
|
8
|
+
import { columnDefinitions, enumColumn } from '../utils/columnDefinition';
|
|
9
9
|
import { ReduxGrid, createRandomData, enumValues, gridDummyActions, onAsyncLoadFilterOptions } from '../utils/utils';
|
|
10
10
|
import withRedux from '../utils/withRedux';
|
|
11
|
+
var ActionColumnButtons = {
|
|
12
|
+
flexBasis: 80,
|
|
13
|
+
forceCheckboxes: true,
|
|
14
|
+
addRowNumbers: false,
|
|
15
|
+
canRowEdit: true,
|
|
16
|
+
canRowRead: false
|
|
17
|
+
};
|
|
11
18
|
var FilterSetter = function (_a) {
|
|
12
19
|
var gridActions = _a.gridActions;
|
|
13
20
|
var handleAddFilter = useAddFilter(gridActions === null || gridActions === void 0 ? void 0 : gridActions.addFilter);
|
|
@@ -23,17 +30,6 @@ var extraControlButtons = [
|
|
|
23
30
|
position: ExtraControlButtonPosition.TopRight,
|
|
24
31
|
label: 'Create',
|
|
25
32
|
onClick: alert
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
position: ExtraControlButtonPosition.TopRight,
|
|
29
|
-
label: 'Select',
|
|
30
|
-
onSelect: function (value) {
|
|
31
|
-
console.log(value);
|
|
32
|
-
},
|
|
33
|
-
options: [
|
|
34
|
-
{ label: 'Option 1', value: 'option1' },
|
|
35
|
-
{ label: 'Option 2', value: 'option2' }
|
|
36
|
-
]
|
|
37
33
|
}
|
|
38
34
|
];
|
|
39
35
|
var comparators = {
|
|
@@ -51,31 +47,7 @@ export default {
|
|
|
51
47
|
title: 'Blocks/CommonGrid',
|
|
52
48
|
decorators: [withRedux]
|
|
53
49
|
};
|
|
54
|
-
export var ComplexWithPaginationAndRedux = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), onRowAction: onRowAction, onRowClick: onRowClick, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName" })] })); };
|
|
50
|
+
export var ComplexWithPaginationAndRedux = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, actionColumnDefinition: ActionColumnButtons, rowsData: createRandomData(10), onRowAction: onRowAction, onRowClick: onRowClick, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName" })] })); };
|
|
55
51
|
ComplexWithPaginationAndRedux.story = {
|
|
56
52
|
name: 'Complex, with pagination and redux'
|
|
57
53
|
};
|
|
58
|
-
export var ComplexWithCheckbox = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), onRowAction: onRowAction, onRowClick: onRowClick, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName", actionColumnDefinition: {
|
|
59
|
-
flexBasis: 40,
|
|
60
|
-
forceCheckboxes: true,
|
|
61
|
-
addRowNumbers: false,
|
|
62
|
-
canRowEdit: false,
|
|
63
|
-
canRowRead: false
|
|
64
|
-
} })] })); };
|
|
65
|
-
ComplexWithCheckbox.story = {
|
|
66
|
-
name: 'Complex, with checkbox'
|
|
67
|
-
};
|
|
68
|
-
export var ComplexWithEditButton = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitions, rowsData: createRandomData(10), onRowAction: onRowAction, onRowClick: onRowClick, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName", actionColumnDefinition: {
|
|
69
|
-
flexBasis: 70,
|
|
70
|
-
forceCheckboxes: true,
|
|
71
|
-
addRowNumbers: false,
|
|
72
|
-
canRowEdit: true,
|
|
73
|
-
canRowRead: false
|
|
74
|
-
} })] })); };
|
|
75
|
-
ComplexWithEditButton.story = {
|
|
76
|
-
name: 'Complex, with edit button'
|
|
77
|
-
};
|
|
78
|
-
export var ComplexWithStickyColumn = function () { return (_jsxs(LinguiContainer, { children: [_jsx(ConnectedFilterSetter, { gridActions: gridDummyActions }), _jsx(ReduxGrid, { columnsDefinitions: columnDefinitionsWithSticky, rowsData: createRandomData(10), onRowAction: onRowAction, onRowClick: onRowClick, onRowReadClick: onRowReadClick, onRowEditClick: onRowEditClick, totalRowsCount: 200, onBatchAction: onBatchAction, getRowsPerPage: getRowsPerPage, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridNameSticky" })] })); };
|
|
79
|
-
ComplexWithStickyColumn.story = {
|
|
80
|
-
name: 'Complex, with sticky column'
|
|
81
|
-
};
|
|
@@ -8,5 +8,3 @@ export declare const oversizedColumnDefinition: {
|
|
|
8
8
|
}[];
|
|
9
9
|
export declare const enumColumn: ColumnDefinition;
|
|
10
10
|
export declare const columnDefinitions: ColumnDefinition[];
|
|
11
|
-
export declare const stickyColumn: ColumnDefinition;
|
|
12
|
-
export declare const columnDefinitionsWithSticky: ColumnDefinition[];
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
1
|
import { ComplexCell } from '../components/ComplexCell';
|
|
11
2
|
import { EnumCellExample } from '../components/EnumCellExample';
|
|
12
3
|
import { enumValues } from './utils';
|
|
@@ -109,14 +100,19 @@ export var columnDefinitions = [
|
|
|
109
100
|
title: 'Complex Column',
|
|
110
101
|
flexBasis: 350,
|
|
111
102
|
cellComponent: ComplexCell
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'stickyColumn',
|
|
106
|
+
title: 'Sticky Column',
|
|
107
|
+
flexBasis: 160,
|
|
108
|
+
alwaysOn: true,
|
|
109
|
+
sticky: true,
|
|
110
|
+
stickTo: 'right'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'alwaysOffColumn',
|
|
114
|
+
title: 'Always Off Column',
|
|
115
|
+
flexBasis: 0,
|
|
116
|
+
alwaysOff: true,
|
|
112
117
|
}
|
|
113
118
|
];
|
|
114
|
-
export var stickyColumn = {
|
|
115
|
-
name: 'stickyColumn',
|
|
116
|
-
title: 'Sticky Column',
|
|
117
|
-
flexBasis: 160,
|
|
118
|
-
alwaysOn: true,
|
|
119
|
-
sticky: true,
|
|
120
|
-
stickTo: 'right'
|
|
121
|
-
};
|
|
122
|
-
export var columnDefinitionsWithSticky = __spreadArray(__spreadArray([], columnDefinitions, true), [stickyColumn], false);
|