@mailstep/design-system 0.5.0-beta.3 → 0.5.0-beta.31
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 +21 -15
- package/ui/Blocks/CommonGrid/CommonGrid.d.ts +5 -2
- package/ui/Blocks/CommonGrid/CommonGrid.js +2 -3
- package/ui/Blocks/CommonGrid/CommonGridContainer.js +3 -3
- package/ui/Blocks/CommonGrid/StandardButtons.js +2 -2
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.d.ts +3 -2
- package/ui/Blocks/CommonGrid/components/ActionHead/ActionHead.js +8 -11
- package/ui/Blocks/CommonGrid/components/ActionHead/components/ActionDropdownSelect.js +1 -1
- package/ui/Blocks/CommonGrid/components/BooleanSelect/BooleanSelect.js +7 -5
- package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +1 -1
- package/ui/Blocks/CommonGrid/components/DataRow.js +2 -2
- package/ui/Blocks/CommonGrid/components/DatePickerRange/DatePickerRange.js +3 -3
- package/ui/Blocks/CommonGrid/components/ExtraControlButtons/ExtraControlButtons.js +1 -1
- package/ui/Blocks/CommonGrid/components/FilterRow.js +1 -1
- package/ui/Blocks/CommonGrid/components/FloatingButton/FloatingButton.js +1 -1
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +2 -2
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ActionRow.js +2 -2
- package/ui/Blocks/CommonGrid/components/NumberRange/NumberRange.js +9 -9
- package/ui/Blocks/CommonGrid/components/TextRange/TextRange.js +12 -12
- package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.d.ts +2 -3
- package/ui/Blocks/CommonGrid/components/gridCells/HoverBubble.js +2 -3
- package/ui/Blocks/CommonGrid/components/gridCells/ToggleCell.d.ts +7 -0
- package/ui/Blocks/CommonGrid/components/gridCells/ToggleCell.js +30 -0
- package/ui/Blocks/CommonGrid/components/gridCells/index.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/gridCells/index.js +2 -0
- package/ui/Blocks/CommonGrid/hooks/useAddFilter.d.ts +4 -0
- package/ui/Blocks/CommonGrid/hooks/useAddFilter.js +14 -0
- package/ui/Blocks/CommonGrid/hooks/useFloatingButton.d.ts +3 -0
- package/ui/Blocks/CommonGrid/hooks/useFloatingButton.js +13 -0
- package/ui/Blocks/CommonGrid/hooks/useGridActionTrigger.d.ts +8 -0
- package/ui/Blocks/CommonGrid/hooks/useGridActionTrigger.js +25 -0
- package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.d.ts +8 -0
- package/ui/Blocks/CommonGrid/hooks/useToggleAllCheckbox.js +15 -0
- package/ui/Blocks/CommonGrid/index.d.ts +5 -2
- package/ui/Blocks/CommonGrid/index.js +5 -2
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +1 -1
- package/ui/Blocks/CommonGrid/styles.d.ts +3 -1
- package/ui/Blocks/CommonGrid/translations.js +2 -2
- package/ui/Blocks/CommonGrid/types.d.ts +5 -6
- package/ui/Blocks/Popover/index.d.ts +4 -2
- package/ui/Blocks/Popover/index.js +5 -3
- package/ui/Elements/DatePicker/DatePicker.d.ts +1 -1
- package/ui/Elements/DatePicker/Datetime/DateTime.d.ts +9 -16
- package/ui/Elements/DatePicker/Datetime/DateTime.js +4 -4
- package/ui/Elements/DatePicker/Datetime/components/ViewNavigation.js +0 -1
- package/ui/Elements/DatePicker/Datetime/types.d.ts +61 -0
- package/ui/Elements/DatePicker/Datetime/types.js +7 -0
- package/ui/Elements/DatePicker/Datetime/views/DaysView.d.ts +2 -4
- package/ui/Elements/DatePicker/Datetime/views/DaysView.js +1 -1
- package/ui/Elements/DatePicker/Datetime/views/MonthsView.d.ts +2 -4
- package/ui/Elements/DatePicker/Datetime/views/MonthsView.js +1 -1
- package/ui/Elements/DatePicker/Datetime/views/YearsView.d.ts +2 -4
- package/ui/Elements/DatePicker/Datetime/views/YearsView.js +1 -1
- package/ui/{Blocks/CommonGrid/components → Elements}/DropdownSelect/DropdownSelect.d.ts +1 -1
- package/ui/{Blocks/CommonGrid/components → Elements}/DropdownSelect/DropdownSelect.js +4 -4
- package/ui/Elements/Select/Select.js +4 -4
- package/ui/Elements/SingleSelect/SingleSelect.js +7 -7
- package/ui/Elements/Toggle/Toggle.d.ts +1 -1
- package/ui/Elements/Toggle/Toggle.js +2 -2
- package/ui/Elements/Toggle/stories/Toggle.stories.d.ts +1 -1
- package/ui/Elements/Toggle/types.d.ts +1 -0
- package/ui/Forms/TextArea/TextArea.d.ts +20 -0
- package/ui/Forms/TextArea/TextArea.js +34 -0
- package/ui/Forms/TextArea/index.d.ts +2 -0
- package/ui/Forms/TextArea/index.js +2 -0
- package/ui/Forms/TextArea/styles.d.ts +12 -0
- package/ui/Forms/TextArea/styles.js +31 -0
- package/ui/index.d.ts +17 -1
- package/ui/index.es.js +42672 -8537
- package/ui/index.js +17 -1
- package/ui/index.umd.js +1631 -267
- package/ui/Blocks/CommonGrid/CommonGridContext.d.ts +0 -9
- package/ui/Blocks/CommonGrid/CommonGridContext.js +0 -32
- package/ui/Blocks/CommonGrid/components/icons/ArrowSimple.d.ts +0 -2
- package/ui/Blocks/CommonGrid/components/icons/ArrowSimple.js +0 -14
- package/ui/Blocks/CommonGrid/utils/public.d.ts +0 -16
- package/ui/Blocks/CommonGrid/utils/public.js +0 -52
- /package/ui/Blocks/{CommonGrid/components/HidePrint → HidePrint}/HidePrint.d.ts +0 -0
- /package/ui/Blocks/{CommonGrid/components/HidePrint → HidePrint}/HidePrint.js +0 -0
- /package/ui/{Blocks/CommonGrid/components → Elements}/DropdownSelect/index.d.ts +0 -0
- /package/ui/{Blocks/CommonGrid/components → Elements}/DropdownSelect/index.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.31",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"test": "echo \"The tests are still waiting to be written, but it seems like they're really good at procrastinating!\""
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@babel/core": "^7.20.12",
|
|
22
23
|
"@babel/preset-env": "^7.22.4",
|
|
23
24
|
"@babel/preset-react": "^7.22.3",
|
|
24
|
-
"@babel/preset-typescript": "^7.
|
|
25
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
25
26
|
"@fortawesome/fontawesome-svg-core": "^6.3.0",
|
|
26
27
|
"@fortawesome/free-brands-svg-icons": "^6.1.1",
|
|
27
28
|
"@fortawesome/pro-duotone-svg-icons": "^6.0.0",
|
|
@@ -29,8 +30,8 @@
|
|
|
29
30
|
"@fortawesome/pro-regular-svg-icons": "^6.0.0",
|
|
30
31
|
"@fortawesome/pro-solid-svg-icons": "^6.3.0",
|
|
31
32
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
32
|
-
"@lingui/
|
|
33
|
-
"@
|
|
33
|
+
"@lingui/react": "3.17.2",
|
|
34
|
+
"@popperjs/core": "^2.11.8",
|
|
34
35
|
"@storybook/addon-controls": "7.6.8",
|
|
35
36
|
"@storybook/addon-essentials": "7.6.8",
|
|
36
37
|
"@storybook/addon-interactions": "7.6.8",
|
|
@@ -52,21 +53,27 @@
|
|
|
52
53
|
"@types/styled-components": "^5.1.26",
|
|
53
54
|
"@vitejs/plugin-react": "^4.2.1",
|
|
54
55
|
"@xstyled/styled-components": "^3.8.0",
|
|
55
|
-
"babel-loader": "^9.1.
|
|
56
|
+
"babel-loader": "^9.1.3",
|
|
57
|
+
"babel-plugin-macros": "^3.1.0",
|
|
56
58
|
"babel-plugin-named-exports-order": "^0.0.2",
|
|
57
59
|
"eslint-plugin-storybook": "0.6.15",
|
|
58
60
|
"faker": "^5.1.0",
|
|
59
61
|
"immer": "9.0.7",
|
|
60
62
|
"lodash": "^4.17.21",
|
|
63
|
+
"luxon": "^3.4.4",
|
|
64
|
+
"moment": "^2.30.1",
|
|
61
65
|
"react": "^18.2.0",
|
|
62
66
|
"react-beautiful-dnd": "^13.0.0",
|
|
63
67
|
"react-dom": "^18.2.0",
|
|
64
68
|
"react-helmet": "^6.1.0",
|
|
65
69
|
"react-image": "^4.1.0",
|
|
70
|
+
"react-onclickoutside": "^6.13.0",
|
|
71
|
+
"react-popper": "^2.3.0",
|
|
66
72
|
"react-redux": "*",
|
|
67
73
|
"react-router": "^5.1.2",
|
|
68
74
|
"react-router-dom": "^5.1.2",
|
|
69
75
|
"react-script": "^2.0.5",
|
|
76
|
+
"react-select": "^5.8.0",
|
|
70
77
|
"react-toastify": "^9.1.3",
|
|
71
78
|
"react-use-draggable-scroll": "^0.4.7",
|
|
72
79
|
"redux": ">=4.0.5",
|
|
@@ -90,19 +97,26 @@
|
|
|
90
97
|
"@fortawesome/pro-regular-svg-icons": "^6.0.0",
|
|
91
98
|
"@fortawesome/pro-solid-svg-icons": "^6.3.0",
|
|
92
99
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
93
|
-
"@lingui/
|
|
94
|
-
"@lingui/
|
|
100
|
+
"@lingui/react": "3.17.2",
|
|
101
|
+
"@lingui/core": "3.17.2",
|
|
102
|
+
"@popperjs/core": "^2.11.8",
|
|
95
103
|
"@xstyled/styled-components": "^3.8.0",
|
|
104
|
+
"babel-plugin-macros": "^3.1.0",
|
|
96
105
|
"immer": "9.0.7",
|
|
97
106
|
"lodash": "^4.17.21",
|
|
107
|
+
"luxon": "^3.4.4",
|
|
108
|
+
"moment": "^2.30.1",
|
|
98
109
|
"react": "^18.2.0",
|
|
99
110
|
"react-beautiful-dnd": "^13.0.0",
|
|
100
111
|
"react-dom": "^18.2.0",
|
|
101
112
|
"react-helmet": "^6.1.0",
|
|
102
113
|
"react-image": "^4.1.0",
|
|
114
|
+
"react-onclickoutside": "^6.13.0",
|
|
115
|
+
"react-popper": "^2.3.0",
|
|
103
116
|
"react-redux": ">=4.0.5",
|
|
104
117
|
"react-router": "^5.1.2",
|
|
105
118
|
"react-router-dom": "^5.1.2",
|
|
119
|
+
"react-select": "^5.8.0",
|
|
106
120
|
"react-toastify": "^9.1.3",
|
|
107
121
|
"react-use-draggable-scroll": "^0.4.7",
|
|
108
122
|
"redux": ">=4.0.5",
|
|
@@ -114,13 +128,5 @@
|
|
|
114
128
|
},
|
|
115
129
|
"resolutions": {
|
|
116
130
|
"jackspeak": "2.1.1"
|
|
117
|
-
},
|
|
118
|
-
"dependencies": {
|
|
119
|
-
"@popperjs/core": "^2.11.8",
|
|
120
|
-
"luxon": "^3.4.4",
|
|
121
|
-
"moment": "^2.30.1",
|
|
122
|
-
"react-onclickoutside": "^6.13.0",
|
|
123
|
-
"react-popper": "^2.3.0",
|
|
124
|
-
"react-select": "^5.8.0"
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { CommonGridProps } from './types';
|
|
2
|
-
|
|
1
|
+
import { CommonGridProps, FiltersConfig } from './types';
|
|
2
|
+
type Props = CommonGridProps & {
|
|
3
|
+
filters?: FiltersConfig;
|
|
4
|
+
};
|
|
5
|
+
declare const CommonGrid: ({ filters, gridSelectors, gridActions, isLoading, rowsData, hasColouredRows, columnsDefinitions, actionColumnDefinition, allowRowSelect, allowRowSelectOnAction, onRowAction, onRowEditClick, onRowReadClick, onRowClick, columnLayout, hideColumnConfig, className, gridRef, minColumnWidth, errorMessage, floatingButtonProps, }: Props) => JSX.Element;
|
|
3
6
|
export default CommonGrid;
|
|
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { x } from '@xstyled/styled-components';
|
|
15
15
|
import { Row, MessageCell } from './components/Table';
|
|
@@ -21,7 +21,6 @@ import HeadRow from './components/HeadRow';
|
|
|
21
21
|
import useUxReset from './hooks/useUxReset';
|
|
22
22
|
import useRowsKeyControls from './hooks/useRowsKeyControls';
|
|
23
23
|
import useColumnSizes from './hooks/useColumnSizes';
|
|
24
|
-
import { Provider as ContextProvider } from './CommonGridContext';
|
|
25
24
|
import { isColumnOn, getGroups } from './utils';
|
|
26
25
|
import { initialState } from './store';
|
|
27
26
|
import { Trans } from '@lingui/react';
|
|
@@ -95,7 +94,7 @@ var CommonGrid = function (_a) {
|
|
|
95
94
|
gridBoxRef.current = node;
|
|
96
95
|
!!gridRef && (gridRef.current = node);
|
|
97
96
|
}, []);
|
|
98
|
-
return (_jsxs(
|
|
97
|
+
return (_jsxs(_Fragment, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout, isLoading: isLoading, totalColumnsWidth: totalColumnsWidth, floatingChildren: GridMessage && (_jsx(Row, { className: "dataRow", align: "center", children: _jsx(MessageCell, { align: "center", className: "gridMessage ".concat(messageClass), children: GridMessage }) })), ref: commonGridRef, children: [_jsxs("div", { className: "gridHead", children: [columnsDefinitions.find(function (col) { return col.group; }) && (_jsx(GroupRow, { actionColumn: actionColumnDefinition, columns: displayColumnsDefinitions, displayColumnsWidth: displayColumnsWidth, groups: groups })), _jsx(HeadRow, { columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onAddSort: addSorting, columnLayout: columnLayout, setColumnsOrder: setColumnsOrder, columnsOrder: columnsOrder, sortingValues: sorting, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag, groups: groups }), columnsDefinitions.find(function (col) { return col.filtering; }) && (_jsx(FilterRow, { filters: filters, 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 &&
|
|
99
98
|
rowsData &&
|
|
100
99
|
displayColumnsDefinitions &&
|
|
101
100
|
rowsData.map(function (row, index) {
|
|
@@ -29,7 +29,7 @@ import { useModal } from '../Modal/hooks/useModal';
|
|
|
29
29
|
import useManageColumn from './hooks/useManageColumn';
|
|
30
30
|
import { CommonGridWithStyles, BottomWrapper, CommonGridWrap, ContentContainer, StyledButtonStrip, StyledColumnButton, } from './styles';
|
|
31
31
|
import { H6 } from '../../Elements/Typography';
|
|
32
|
-
import HidePrint from '
|
|
32
|
+
import HidePrint from '../HidePrint/HidePrint';
|
|
33
33
|
import ControlButtons from './components/ControlButtons';
|
|
34
34
|
import { Rows } from '../../Elements/Icon/icons/Rows';
|
|
35
35
|
import { x } from '@xstyled/styled-components';
|
|
@@ -40,7 +40,7 @@ import Modal from '../Modal';
|
|
|
40
40
|
import ManageColumnForm from './components/ManageColumnForm';
|
|
41
41
|
import { Trans } from '@lingui/react';
|
|
42
42
|
var StyledCommonGrid = function (props) {
|
|
43
|
-
var _a = props.optimizeFilters, optimizeFilters = _a === void 0 ? false : _a, extraControlButtons = props.extraControlButtons, eshopSelect = props.eshopSelect, onBatchAction = props.onBatchAction,
|
|
43
|
+
var _a = props.optimizeFilters, optimizeFilters = _a === void 0 ? false : _a, extraControlButtons = props.extraControlButtons, eshopSelect = props.eshopSelect, onBatchAction = props.onBatchAction, processCheckedValues = props.processCheckedValues, processCheckedValuesTitle = props.processCheckedValuesTitle, hideControlButtons = props.hideControlButtons, floatingButtonProps = props.floatingButtonProps, passDownProps = __rest(props, ["optimizeFilters", "extraControlButtons", "eshopSelect", "onBatchAction", "processCheckedValues", "processCheckedValuesTitle", "hideControlButtons", "floatingButtonProps"]);
|
|
44
44
|
var gridActions = passDownProps.gridActions, gridSelectors = passDownProps.gridSelectors, rowsData = passDownProps.rowsData, actionColumnDefinition = passDownProps.actionColumnDefinition;
|
|
45
45
|
var rowHeight = 40;
|
|
46
46
|
var _b = useGetGridHeight(), gridHeight = _b.gridHeight, gridRef = _b.gridRef, paginationRef = _b.paginationRef;
|
|
@@ -62,6 +62,6 @@ var StyledCommonGrid = function (props) {
|
|
|
62
62
|
gridSelectors: gridSelectors,
|
|
63
63
|
onClose: onClose,
|
|
64
64
|
}), columnsConfigValues = _d.columnsConfigValues, setColumnsConfigOptions = _d.setColumnsConfigOptions, onConfirmForm = _d.onConfirmForm, resetColumnConfig = _d.resetColumnConfig;
|
|
65
|
-
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", appearance: "ghost", icon: _jsx(Rows, {}), onClick: openManageColumnForm, children: _jsx(H6, { children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, hasColouredRows: true, floatingButtonProps: floatingButtonProps }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isAbsolute: !!gridHeight, children: [_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition,
|
|
65
|
+
return (_jsxs(ContentContainer, { children: [_jsxs(CommonGridWrap, { children: [_jsx(HidePrint, { children: _jsxs(StyledButtonStrip, { className: "buttonsStrip", children: [!hideControlButtons && (_jsx(ControlButtons, { extraControlButtons: extraControlButtons, gridActions: gridActions, gridSelectors: gridSelectors, eshopSelect: eshopSelect })), _jsx(StyledColumnButton, { type: "button", appearance: "ghost", icon: _jsx(Rows, {}), onClick: openManageColumnForm, children: _jsx(H6, { children: _jsx(Trans, { id: "manageColumn.title", message: "Manage column" }) }) })] }) }), _jsx(CommonGridWithStyles, __assign({}, passDownProps, modifiedPassDownProps, { filters: filters, gridRef: gridRef, hasColouredRows: true, floatingButtonProps: floatingButtonProps }))] }), _jsx(HidePrint, { children: _jsxs(BottomWrapper, { ref: paginationRef, isAbsolute: !!gridHeight, children: [processCheckedValues && (_jsx(ActionHead, { rowsData: rowsData, onBatchAction: onBatchAction, gridActions: gridActions, gridSelectors: gridSelectors, actionColumn: actionColumnDefinition, processCheckedValues: processCheckedValues, processCheckedValuesTitle: processCheckedValuesTitle })), _jsxs(x.div, { display: "flex", justifyContent: "center", alignItems: "center", className: "paginatorWrapper", w: "100%", h: window.innerWidth > 1204 ? '60px' : '32px', children: [_jsx(Pagination, { page: gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.page, itemCount: passDownProps === null || passDownProps === void 0 ? void 0 : passDownProps.totalRowsCount, itemPerPage: (gridSelectors === null || gridSelectors === void 0 ? void 0 : gridSelectors.rowsPerPage) || 10, onPageChange: gridActions === null || gridActions === void 0 ? void 0 : gridActions.setPage }), _jsx(TablePagination, { gridActions: gridActions, gridSelectors: gridSelectors })] })] }) }), manageColumnFormVisible && (_jsx(Modal, { title: _jsx(Trans, { id: "manageColumn.title", message: "Manage columns" }), onClose: onClose, onCancel: onClose, onExtraAction: resetColumnConfig, onConfirm: onConfirmForm, width: "auto", minWidth: "350px", hasFooter: true, extraActionLabel: _jsx(Trans, { id: "dataGrid.buttonClearConfig", message: "Reset config" }), cancelLabel: _jsx(Trans, { id: "form.buttonCancel", message: "Cancel" }), confirmLabel: _jsx(Trans, { id: "form.buttonConfirm", message: "Confirm" }), children: _jsx(ManageColumnForm, { columns: columns, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions }) }))] }));
|
|
66
66
|
};
|
|
67
67
|
export default StyledCommonGrid;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Trans } from '@lingui/react';
|
|
3
3
|
import { x } from '@xstyled/styled-components';
|
|
4
|
-
import { t } from '@lingui/macro';
|
|
5
4
|
import Select from '../../Elements/Select';
|
|
6
5
|
import ButtonMore from './components/ButtonMore/ButtonMore';
|
|
6
|
+
import { i18n } from '@lingui/core';
|
|
7
7
|
export var getCreateButton = function (onCreate, canCreate, disabled) { return ({
|
|
8
8
|
label: _jsx(Trans, { id: "dataGrid.actionOptions.createNew", message: "Create new" }),
|
|
9
9
|
style: 'primary',
|
|
@@ -43,7 +43,7 @@ export var getEshopSelect = function (eshopOptions, selectedEshop, onChange, isC
|
|
|
43
43
|
if (eshopOptions.length > 1) {
|
|
44
44
|
eshops.push({
|
|
45
45
|
position: 'top-right',
|
|
46
|
-
node: (_jsx(x.div, { w: "200px", "data-cy": "eshopSelect", children: _jsx(Select, { name: "eshop", options: eshopOptions, value: selectedEshop, onChange: onChange, isSearchable: false, isClearable: isClearable, disabled: !eshopOptions.length, placeholder:
|
|
46
|
+
node: (_jsx(x.div, { w: "200px", "data-cy": "eshopSelect", children: _jsx(Select, { name: "eshop", options: eshopOptions, value: selectedEshop, onChange: onChange, isSearchable: false, isClearable: isClearable, disabled: !eshopOptions.length, placeholder: i18n._({ id: 'products.eshopFilterPlaceholder', message: 'Select eshop...' }) }) })),
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
return eshops;
|
|
@@ -5,7 +5,8 @@ type Props = {
|
|
|
5
5
|
actionColumn?: ActionColumn;
|
|
6
6
|
onBatchAction?: OnBatchActionFn;
|
|
7
7
|
rowsData: RowProps[];
|
|
8
|
-
|
|
8
|
+
processCheckedValues?: () => void;
|
|
9
|
+
processCheckedValuesTitle?: string;
|
|
9
10
|
};
|
|
10
|
-
declare const ActionHead: ({ gridActions, gridSelectors, actionColumn, onBatchAction, rowsData,
|
|
11
|
+
declare const ActionHead: ({ gridActions, gridSelectors, actionColumn, onBatchAction, rowsData, processCheckedValues, processCheckedValuesTitle, }: Props) => JSX.Element;
|
|
11
12
|
export default ActionHead;
|
|
@@ -6,11 +6,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
import styled from '@xstyled/styled-components';
|
|
8
8
|
import { Trans } from '@lingui/react';
|
|
9
|
-
import { t } from '@lingui/macro';
|
|
10
|
-
import { useGridActionTrigger, useToggleAllCheckbox } from '../../utils/public';
|
|
11
|
-
import { useModal } from '../../../Modal/hooks/useModal';
|
|
12
9
|
import { Button } from '../../../../Elements/Button';
|
|
13
10
|
import ButtonMore from '../ButtonMore/ButtonMore';
|
|
11
|
+
import { i18n } from '@lingui/core';
|
|
12
|
+
import { useToggleAllCheckbox } from '../../hooks/useToggleAllCheckbox';
|
|
13
|
+
import { useGridActionTrigger } from '../../hooks/useGridActionTrigger';
|
|
14
14
|
var Wrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n width: 100%;\n margin-right: 2;\n gap: 24px;\n background-color: red;\n position: relative;\n"])));
|
|
15
15
|
var ActionsWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"], ["\n position: absolute;\n bottom: 32px;\n left: 50%;\n transform: translate(-50%);\n width: 596px;\n padding: 12px 24px;\n border-radius: 10px;\n background-color: #fff;\n box-shadow: dropShadow;\n z-index: 2;\n"])));
|
|
16
16
|
var StyledText = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"], ["\n font-size: 14px;\n line-height: 18px;\n color: blue2;\n font-weight: 600;\n"])));
|
|
@@ -18,12 +18,11 @@ var ContentWrap = styled.div(templateObject_4 || (templateObject_4 = __makeTempl
|
|
|
18
18
|
var ButtonsWrap = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-left: 10px;\n\n & > * {\n margin-left: 10px;\n }\n"], ["\n display: flex;\n align-items: center;\n margin-left: 10px;\n\n & > * {\n margin-left: 10px;\n }\n"])));
|
|
19
19
|
var ActionHead = function (_a) {
|
|
20
20
|
var _b;
|
|
21
|
-
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, actionColumn = _a.actionColumn, onBatchAction = _a.onBatchAction, rowsData = _a.rowsData,
|
|
21
|
+
var gridActions = _a.gridActions, gridSelectors = _a.gridSelectors, actionColumn = _a.actionColumn, onBatchAction = _a.onBatchAction, rowsData = _a.rowsData, processCheckedValues = _a.processCheckedValues, processCheckedValuesTitle = _a.processCheckedValuesTitle;
|
|
22
22
|
var handleUxChange = (gridActions || {}).handleUxChange;
|
|
23
23
|
var _c = (gridSelectors || {}).uxState, uxState = _c === void 0 ? {} : _c;
|
|
24
|
-
var _d =
|
|
25
|
-
var _e =
|
|
26
|
-
var _f = useGridActionTrigger(rowsData, uxState, actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions, onBatchAction), enabledActions = _f[0], onSubmit = _f[1];
|
|
24
|
+
var _d = useToggleAllCheckbox(rowsData, uxState, handleUxChange), checked = _d[0], toggleCheckbox = _d[1];
|
|
25
|
+
var _e = useGridActionTrigger(rowsData, uxState, actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions, onBatchAction), enabledActions = _e[0], onSubmit = _e[1];
|
|
27
26
|
var checkedRowsCount = Object.keys((uxState === null || uxState === void 0 ? void 0 : uxState.checkedRows) || []).length;
|
|
28
27
|
var checkAll = useCallback(function () {
|
|
29
28
|
if (!checked) {
|
|
@@ -35,19 +34,17 @@ var ActionHead = function (_a) {
|
|
|
35
34
|
if ((_a = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _a === void 0 ? void 0 : _a.length) {
|
|
36
35
|
return actionColumn.actionOptions.map(function (option) { return ({
|
|
37
36
|
title: option.label,
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
39
37
|
onClick: function () { return onSubmit(option.value); },
|
|
40
38
|
link: '#',
|
|
41
39
|
}); });
|
|
42
40
|
}
|
|
43
41
|
return [];
|
|
44
42
|
}, [actionColumn, onSubmit]);
|
|
45
|
-
|
|
46
|
-
return (_jsx(Wrap, { children: checkedRowsCount > 0 && (_jsx(ActionsWrap, { children: _jsxs(ContentWrap, { children: [_jsx(StyledText, { children: t({
|
|
43
|
+
return (_jsx(Wrap, { children: checkedRowsCount > 0 && (_jsx(ActionsWrap, { children: _jsxs(ContentWrap, { children: [_jsx(StyledText, { children: i18n._({
|
|
47
44
|
id: 'dataGrid.checkedRowsCount',
|
|
48
45
|
message: "Selected {checkedRowsCount} items",
|
|
49
46
|
values: { checkedRowsCount: checkedRowsCount },
|
|
50
|
-
}) }), _jsxs(ButtonsWrap, { children: [_jsx(Button, { type: "button", onClick: checkAll, appearance: "secondaryLg", "data-cy": "checkAllBtn", disabled: checked, children: _jsx(Trans, { id: "dataGrid.checkAll", message: "Check all" }) }),
|
|
47
|
+
}) }), _jsxs(ButtonsWrap, { children: [_jsx(Button, { type: "button", onClick: checkAll, appearance: "secondaryLg", "data-cy": "checkAllBtn", disabled: checked, children: _jsx(Trans, { id: "dataGrid.checkAll", message: "Check all" }) }), processCheckedValues && (_jsx(Button, { type: "button", onClick: processCheckedValues, appearance: "primary", "data-cy": "exportBtn", disabled: !rowsData.length, children: processCheckedValuesTitle ? (processCheckedValuesTitle) : (_jsx(Trans, { id: "dataGrid.actionOptions.export", message: "Export" })) })), ((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.length) && (_jsx(ButtonMore, { items: actionsOptions, disabled: !enabledActions.length || !rowsData.length, dropdownPosition: "top" }))] })] }) })) }));
|
|
51
48
|
};
|
|
52
49
|
export default ActionHead;
|
|
53
50
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -8,7 +8,7 @@ import styled from '@xstyled/styled-components';
|
|
|
8
8
|
import { th } from '@xstyled/system';
|
|
9
9
|
import { Trans } from '@lingui/react';
|
|
10
10
|
import ActionDropdownMenu from './ActionDropdownMenu';
|
|
11
|
-
import
|
|
11
|
+
import Popover from '../../../../Popover';
|
|
12
12
|
import Icon from '../../../../../Elements/Icon/Icon';
|
|
13
13
|
var Content = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n display: flex;\n align-items: center;\n padding: 1 2;\n min-width: 9rem;\n height: 28px;\n background-color: ", ";\n color: ", ";\n border: slim;\n border-color: ", ";\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: ", ";\n transition: 0.2s;\n &:not(:disabled):hover {\n color: ", ";\n border-color: ", ";\n }\n p {\n margin: 0;\n margin-right: auto;\n padding-right: 36px;\n }\n"], ["\n position: relative;\n display: flex;\n align-items: center;\n padding: 1 2;\n min-width: 9rem;\n height: 28px;\n background-color: ", ";\n color: ", ";\n border: slim;\n border-color: ", ";\n font-size: 12px;\n font-weight: 600;\n border-radius: 6px;\n cursor: ", ";\n transition: 0.2s;\n &:not(:disabled):hover {\n color: ", ";\n border-color: ", ";\n }\n p {\n margin: 0;\n margin-right: auto;\n padding-right: 36px;\n }\n"])), th.color('white'), function (_a) {
|
|
14
14
|
var $isDisabled = _a.$isDisabled;
|
|
@@ -21,15 +21,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import {
|
|
24
|
+
import { useMemo } from 'react';
|
|
25
25
|
import GridSelect from '../GridSelect';
|
|
26
|
+
import { i18n } from '@lingui/core';
|
|
26
27
|
var getFlagOptions = function () { return [
|
|
27
|
-
{ value: '', label:
|
|
28
|
-
{ value: '1', label:
|
|
29
|
-
{ value: '0', label:
|
|
28
|
+
{ value: '', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.all', message: 'All' }) },
|
|
29
|
+
{ value: '1', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.yes', message: 'Yes' }) },
|
|
30
|
+
{ value: '0', label: i18n._({ id: 'dataGrid.columnActive.filterOptions.no', message: 'No' }) },
|
|
30
31
|
]; };
|
|
31
32
|
var SelectFilter = function (_a) {
|
|
32
33
|
var restProps = __rest(_a, []);
|
|
33
|
-
|
|
34
|
+
var options = useMemo(function () { return getFlagOptions(); }, []);
|
|
35
|
+
return _jsx(GridSelect, __assign({ options: options }, restProps));
|
|
34
36
|
};
|
|
35
37
|
export default SelectFilter;
|
|
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { x } from '@xstyled/styled-components';
|
|
15
15
|
import { Cell } from './Table';
|
|
16
|
-
import { useAddFilter } from '../
|
|
16
|
+
import { useAddFilter } from '../hooks/useAddFilter';
|
|
17
17
|
import { createFilterType, getStickyCollClassNames } from '../utils';
|
|
18
18
|
import { getCellSizeProps, getGroupClassNames } from '../utils';
|
|
19
19
|
import OverlayComponent from './FilterDropdown';
|
|
@@ -32,7 +32,7 @@ import { getActionCellSizeProps } from '../utils';
|
|
|
32
32
|
import { rowClassSymbol } from '../types';
|
|
33
33
|
import { isFunction } from 'lodash/fp';
|
|
34
34
|
import { useTimeMeasurement } from './utils';
|
|
35
|
-
import
|
|
35
|
+
import Checkbox from '../../../Forms/Checkbox';
|
|
36
36
|
import Button from '../../../Elements/Button/Button';
|
|
37
37
|
var EmptySpan = function (_a) {
|
|
38
38
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
@@ -105,6 +105,6 @@ var DataRow = function (_a) {
|
|
|
105
105
|
return actionColumn ? __assign({}, getActionCellSizeProps(actionColumn)) : {};
|
|
106
106
|
}, [actionColumn]);
|
|
107
107
|
var displayReadEditCell = ((_c = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _c === void 0 ? void 0 : _c.length) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowEdit) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.canRowRead) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.forceCheckboxes);
|
|
108
|
-
return (_jsxs(StyledDataRow, { className: rowClassName, hasRowClick: !!onRowClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, isEven: isEven, children: [actionColumn && (_jsxs(_Fragment, { children: [displayReadEditCell && (_jsxs(Cell, { className: "cell", style: actionColumnStyle, children: [((_d = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _d === void 0 ? void 0 : _d.length) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.forceCheckboxes) ? (_jsx(
|
|
108
|
+
return (_jsxs(StyledDataRow, { className: rowClassName, hasRowClick: !!onRowClick, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, isEven: isEven, children: [actionColumn && (_jsxs(_Fragment, { children: [displayReadEditCell && (_jsxs(Cell, { className: "cell", style: actionColumnStyle, children: [((_d = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _d === void 0 ? void 0 : _d.length) || (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.forceCheckboxes) ? (_jsx(Checkbox, { checked: isChecked, onChange: onCheckboxChange, label: "" })) : null, _jsxs(x.div, { children: [(isFunction(actionColumn.canRowRead) ? actionColumn.canRowRead(rowData) : actionColumn.canRowRead) && (_jsx(RowActionComponent, __assign({}, rowActionProps('read'), { children: _jsx(Button, { type: "button", appearance: "primary", mb: "5px", ml: "5px", mr: "5px", className: "actionColumnButton", children: _jsx(EyeOpenIcon, { width: "16px", height: "16px" }) }) }))), (isFunction(actionColumn.canRowEdit) ? actionColumn.canRowEdit(rowData) : actionColumn.canRowEdit) && (_jsx(RowActionComponent, __assign({}, rowActionProps('edit'), { children: _jsx(Button, { type: "button", appearance: "primary", mt: "5px", mb: "5px", ml: "5px", mr: "5px", className: "actionColumnButton", children: _jsx(EditIcon, { width: "16px", height: "16px" }) }) })))] })] })), (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.addRowNumbers) && (_jsx(Cell, { className: "cell", style: actionColumnStyle, children: _jsx(x.div, { children: rowIndex }) }))] })), columns.map(function (column, key) { return (_jsx(MemoDataCell, { column: column, rowData: rowData, onRowAction: handleRowAction, displayColumnWidth: displayColumnsWidth[column.name], group: groups === null || groups === void 0 ? void 0 : groups[key] }, column.name)); })] }));
|
|
109
109
|
};
|
|
110
110
|
export default DataRow;
|
|
@@ -29,10 +29,10 @@ import React, { useState, useCallback, useMemo } from 'react';
|
|
|
29
29
|
import { DateTime } from 'luxon';
|
|
30
30
|
import styled from '@xstyled/styled-components';
|
|
31
31
|
import { sameDate } from './utils/sameDate';
|
|
32
|
-
import { t } from '@lingui/macro';
|
|
33
32
|
import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
|
|
34
33
|
import DatePicker from '../../../../Elements/DatePicker';
|
|
35
34
|
import Input from '../../../../Forms/Input';
|
|
35
|
+
import { i18n } from '@lingui/core';
|
|
36
36
|
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"
|
|
37
37
|
// User readable date range.
|
|
38
38
|
])));
|
|
@@ -64,7 +64,7 @@ var DatePickerRange = function (props) {
|
|
|
64
64
|
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];
|
|
65
65
|
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];
|
|
66
66
|
var timeFormat = filterTime ? 'HH:mm' : false;
|
|
67
|
-
var placeholder =
|
|
67
|
+
var placeholder = i18n._({ id: 'dataGrid.filterCell', message: 'Type to filter' });
|
|
68
68
|
var cleanValue = React.useMemo(function () { return [
|
|
69
69
|
typeof (value === null || value === void 0 ? void 0 : value[0]) === 'string' ? new Date(value[0]) : (value === null || value === void 0 ? void 0 : value[0]) || undefined,
|
|
70
70
|
typeof (value === null || value === void 0 ? void 0 : value[1]) === 'string' ? new Date(value[1]) : (value === null || value === void 0 ? void 0 : value[1]) || undefined,
|
|
@@ -107,7 +107,7 @@ var DatePickerRange = function (props) {
|
|
|
107
107
|
// Check if the second value is not selected and the first value is the same as the initial value
|
|
108
108
|
var secondDatePickerValue = cleanValue[1] === null ? cleanValue[0] : cleanValue[1];
|
|
109
109
|
var ref = useClickOutside({ onClose: onClose });
|
|
110
|
-
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, appearance: "grid", 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, icon: false, label: isOpen &&
|
|
110
|
+
return (_jsxs("div", { ref: ref, children: [_jsx(Input, { name: props.name, placeholder: placeholder, type: "text", icon: "calendar", value: pickerRangeToString(cleanValue), label: props.label, onFocus: openPicker, iconOnClick: openPicker, appearance: "grid", 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, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.from', message: 'From' }), isValidDate: isValidDateFrom, input: false, spaceAround: true, open: true, disabled: cleanValue[0] === null })), _jsx(DatePicker, __assign({}, rest, { timeFormat: timeFormat, value: secondDatePickerValue, initialViewDate: initialViewDate[1], secondValue: startRangeValue, onChange: setDateTo, icon: false, label: isOpen && i18n._({ id: 'dataGrid.filterCell.to', message: 'To' }), isValidDate: isValidDateTo, input: false, spaceAround: true, open: true, disabled: secondDatePickerValue === null }))] })) }) })] }));
|
|
111
111
|
};
|
|
112
112
|
export default DatePickerRange;
|
|
113
113
|
var templateObject_1;
|
|
@@ -16,7 +16,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
16
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import styled, { x } from '@xstyled/styled-components';
|
|
18
18
|
import Button from '../../../../Elements/Button/Button';
|
|
19
|
-
import DropdownSelect from '
|
|
19
|
+
import DropdownSelect from '../../../../Elements/DropdownSelect';
|
|
20
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"])));
|
|
21
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"])));
|
|
22
22
|
var ControlButton = function (_a) {
|
|
@@ -16,7 +16,7 @@ import throttle from 'lodash/throttle';
|
|
|
16
16
|
import ColumnFilterCell from './ColumnFilterCell';
|
|
17
17
|
import { Row, Cell } from './Table';
|
|
18
18
|
import { getActionCellSizeProps, getFilterName } from '../utils';
|
|
19
|
-
import { useToggleAllCheckbox } from '../
|
|
19
|
+
import { useToggleAllCheckbox } from '../hooks/useToggleAllCheckbox';
|
|
20
20
|
import Toggle from '../../../Elements/Toggle/Toggle';
|
|
21
21
|
var FilterRow = function (_a) {
|
|
22
22
|
var _b, _c;
|
|
@@ -6,7 +6,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import styled from '@xstyled/styled-components';
|
|
8
8
|
import DropdownMenu from '../../../../Elements/DropdownMenu';
|
|
9
|
-
import
|
|
9
|
+
import Popover from '../../../Popover';
|
|
10
10
|
var StyledDropdownMenu = styled(DropdownMenu)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n min-width: 160px;\n width: max-content;\n"], ["\n min-width: 160px;\n width: max-content;\n"])));
|
|
11
11
|
export var StyledButton = styled.button(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 56px;\n height: 56px;\n border-radius: 50%;\n border: none;\n background-color: red1;\n display: flex;\n z-index: 1;\n justify-content: center;\n align-items: center;\n position: fixed;\n bottom: 65px;\n right: 24px;\n\n :hover {\n cursor: pointer;\n }\n"], ["\n width: 56px;\n height: 56px;\n border-radius: 50%;\n border: none;\n background-color: red1;\n display: flex;\n z-index: 1;\n justify-content: center;\n align-items: center;\n position: fixed;\n bottom: 65px;\n right: 24px;\n\n :hover {\n cursor: pointer;\n }\n"])));
|
|
12
12
|
export var StyledCross = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .line {\n border: 1px solid white;\n display: flex;\n width: 16px;\n background-color: white;\n transition: 0.3s;\n }\n > :nth-child(1) {\n transform: ", ";\n }\n > :nth-child(2) {\n transform: ", ";\n }\n"], ["\n .line {\n border: 1px solid white;\n display: flex;\n width: 16px;\n background-color: white;\n transition: 0.3s;\n }\n > :nth-child(1) {\n transform: ", ";\n }\n > :nth-child(2) {\n transform: ", ";\n }\n"])), function (_a) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from 'react';
|
|
3
|
-
import { t } from '@lingui/macro';
|
|
4
3
|
import { x } from '@xstyled/styled-components';
|
|
5
4
|
import { ActionRow } from './components/ActionRow';
|
|
6
5
|
import { Input } from '../../../../Forms/Input/Input';
|
|
6
|
+
import { i18n } from '@lingui/core';
|
|
7
7
|
var ManageColumnForm = function (_a) {
|
|
8
8
|
var columns = _a.columns, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions;
|
|
9
9
|
var _b = useState(''), searchedValue = _b[0], setSearchedValue = _b[1];
|
|
@@ -13,7 +13,7 @@ var ManageColumnForm = function (_a) {
|
|
|
13
13
|
var clear = useCallback(function () {
|
|
14
14
|
setSearchedValue('');
|
|
15
15
|
}, [setSearchedValue]);
|
|
16
|
-
return (_jsxs(x.div, { children: [_jsx(Input, { icon: "search", type: "text", value: searchedValue, placeholder:
|
|
16
|
+
return (_jsxs(x.div, { children: [_jsx(Input, { icon: "search", type: "text", value: searchedValue, placeholder: i18n._({ id: 'manageColumn.searchPlaceholder', message: 'Find column...' }), onChange: onChangeInputValue, onClear: clear, variant: "gray" }), _jsx(x.div, { h: "400px", overflowY: "scroll", mt: "20px", children: columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
17
17
|
return (_jsx(ActionRow, { column: column, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, searchedValue: searchedValue }, index));
|
|
18
18
|
}) })] }));
|
|
19
19
|
};
|
|
@@ -16,12 +16,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { useCallback, useState } from 'react';
|
|
18
18
|
import { x, th } from '@xstyled/styled-components';
|
|
19
|
-
import { t } from '@lingui/macro';
|
|
20
19
|
import styled from 'styled-components';
|
|
21
20
|
import Toggle from '../../../../../Elements/Toggle/Toggle';
|
|
22
21
|
import { Group } from '../../../../../Elements/Icon/icons/Group';
|
|
23
22
|
import { isObject } from 'lodash';
|
|
24
23
|
import { H6 } from '../../../../../Elements/Typography/Typography';
|
|
24
|
+
import { i18n } from '@lingui/core';
|
|
25
25
|
var RowLayout = styled(x.div)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n height: 52px;\n border: 1px solid ", ";\n border-radius: 8px;\n margin-bottom: 15px;\n"], ["\n display: ", ";\n align-items: center;\n justify-content: space-between;\n padding: 16px;\n height: 52px;\n border: 1px solid ", ";\n border-radius: 8px;\n margin-bottom: 15px;\n"])), function (_a) {
|
|
26
26
|
var $isVisible = _a.$isVisible;
|
|
27
27
|
return ($isVisible ? 'flex' : 'none');
|
|
@@ -33,7 +33,7 @@ export var ActionRow = function (_a) {
|
|
|
33
33
|
var translatedValue = isObject(column === null || column === void 0 ? void 0 : column.title) &&
|
|
34
34
|
'props' in column.title &&
|
|
35
35
|
((_c = column.title) === null || _c === void 0 ? void 0 : _c.props) &&
|
|
36
|
-
|
|
36
|
+
i18n._({ id: (_e = (_d = column.title) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e.id, message: (_f = column.title) === null || _f === void 0 ? void 0 : _f.props.message });
|
|
37
37
|
var isVisible = translatedValue && translatedValue.toLocaleLowerCase().includes(searchedValue.toLocaleLowerCase());
|
|
38
38
|
var handleToggleChange = useCallback(function () {
|
|
39
39
|
setColumnsConfigOptions(function (prevOptions) {
|
|
@@ -22,33 +22,33 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { useCallback, useState } from 'react';
|
|
25
|
-
import { t } from '@lingui/macro';
|
|
26
25
|
import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
|
|
27
26
|
import { Input } from '../../../../Forms/Input/Input';
|
|
28
27
|
import IconList from '../IconList';
|
|
28
|
+
import { i18n } from '@lingui/core';
|
|
29
29
|
var OverlayComponentDefault = function (_a) {
|
|
30
30
|
var children = _a.children;
|
|
31
31
|
return _jsx("div", { children: children });
|
|
32
32
|
};
|
|
33
33
|
var createNumberComparators = function () { return [
|
|
34
|
-
{ label:
|
|
35
|
-
{ label:
|
|
36
|
-
{ label:
|
|
34
|
+
{ label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
|
|
35
|
+
{ label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
|
|
36
|
+
{ label: i18n._({ id: 'dataGrid.comparator.lessThan', message: 'Less than' }), value: 'lt', icon: 'lessThen' },
|
|
37
37
|
{
|
|
38
|
-
label:
|
|
38
|
+
label: i18n._({ id: 'dataGrid.comparator.lessThanOrEquals', message: 'Less than or equals' }),
|
|
39
39
|
value: 'lte',
|
|
40
40
|
icon: 'lessThanEqual',
|
|
41
41
|
},
|
|
42
|
-
{ label:
|
|
42
|
+
{ label: i18n._({ id: 'dataGrid.comparator.greaterThan', message: 'Greater than' }), value: 'gt', icon: 'greaterThan' },
|
|
43
43
|
{
|
|
44
|
-
label:
|
|
44
|
+
label: i18n._({ id: 'dataGrid.comparator.greaterThanOrEquals', message: 'Greater than or equal' }),
|
|
45
45
|
value: 'gte',
|
|
46
46
|
icon: 'greaterThanEqual',
|
|
47
47
|
},
|
|
48
48
|
]; };
|
|
49
49
|
var createEqualComparators = [
|
|
50
|
-
{ label:
|
|
51
|
-
{ label:
|
|
50
|
+
{ label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
|
|
51
|
+
{ label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
|
|
52
52
|
];
|
|
53
53
|
var NumberRange = function (props) {
|
|
54
54
|
var numberComparators = createNumberComparators();
|
|
@@ -22,31 +22,31 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import { useCallback, useState } from 'react';
|
|
25
|
-
import { t } from '@lingui/macro';
|
|
26
25
|
import { Trans } from '@lingui/react';
|
|
27
26
|
import { useClickOutside } from '../../../Modal/hooks/useClickOutside';
|
|
28
27
|
import { Input } from '../../../../Forms/Input/Input';
|
|
29
28
|
import IconList from '../IconList/IconList';
|
|
29
|
+
import { i18n } from '@lingui/core';
|
|
30
30
|
var OverlayComponentDefault = function (_a) {
|
|
31
31
|
var children = _a.children;
|
|
32
32
|
return _jsx("div", { children: children });
|
|
33
33
|
};
|
|
34
34
|
export var ipv4 = /^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/;
|
|
35
35
|
var createTextComparators = function () { return [
|
|
36
|
-
{ label:
|
|
37
|
-
{ label:
|
|
38
|
-
{ label:
|
|
39
|
-
{ label:
|
|
40
|
-
{ label:
|
|
41
|
-
{ label:
|
|
36
|
+
{ label: i18n._({ id: 'dataGrid.comparator.contains', message: 'Contains' }), value: 'like', icon: 'check' },
|
|
37
|
+
{ label: i18n._({ id: 'dataGrid.comparator.notContains', message: 'Not contains' }), value: 'notLike', icon: 'false' },
|
|
38
|
+
{ label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
|
|
39
|
+
{ label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
|
|
40
|
+
{ label: i18n._({ id: 'dataGrid.comparator.startsWith', message: 'Starts with' }), value: 'startsWith', icon: 'startsWith' },
|
|
41
|
+
{ label: i18n._({ id: 'dataGrid.comparator.endsWith', message: 'Ends with' }), value: 'endsWith', icon: 'endsWith' },
|
|
42
42
|
]; };
|
|
43
43
|
var createPresentTextComparators = function () { return [
|
|
44
|
-
{ label:
|
|
45
|
-
{ label:
|
|
44
|
+
{ label: i18n._({ id: 'dataGrid.comparator.contains', message: 'Contains' }), value: 'like', icon: 'check' },
|
|
45
|
+
{ label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'in', icon: 'equals' },
|
|
46
46
|
]; };
|
|
47
47
|
var createEqualComparators = function () { return [
|
|
48
|
-
{ label:
|
|
49
|
-
{ label:
|
|
48
|
+
{ label: i18n._({ id: 'dataGrid.comparator.equals', message: 'Equals' }), value: 'eq', icon: 'equals' },
|
|
49
|
+
{ label: i18n._({ id: 'dataGrid.comparator.notEquals', message: 'Not equal' }), value: 'neq', icon: 'notEqual' },
|
|
50
50
|
]; };
|
|
51
51
|
var validations = {
|
|
52
52
|
ip: {
|
|
@@ -56,7 +56,7 @@ var validations = {
|
|
|
56
56
|
};
|
|
57
57
|
var TextRange = function (props) {
|
|
58
58
|
var name = props.name, _a = props.value, value = _a === void 0 ? {} : _a, label = props.label, onChange = props.onChange, className = props.className, _b = props.OverlayComponent, OverlayComponent = _b === void 0 ? OverlayComponentDefault : _b, eqOnly = props.eqOnly, isPresent = props.isPresent, isEqual = props.isEqual, defaultComparator = props.defaultComparator, validationKey = props.validation, rest = __rest(props, ["name", "value", "label", "onChange", "className", "OverlayComponent", "eqOnly", "isPresent", "isEqual", "defaultComparator", "validation"]);
|
|
59
|
-
var eqOnlyTxt =
|
|
59
|
+
var eqOnlyTxt = i18n._({ id: 'dataGrid.filterTxtEqWarning', message: 'This filter can only do exact match' });
|
|
60
60
|
var _c = useState(false), isOpen = _c[0], setOpen = _c[1];
|
|
61
61
|
var textComparators = createTextComparators();
|
|
62
62
|
var presentTextComparators = createPresentTextComparators();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DataCellProps } from '../../types';
|
|
2
2
|
type Props = DataCellProps<{}>;
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
export default Image;
|
|
3
|
+
export declare const HoverBubble: ({ rowData, column }: Props) => JSX.Element | null;
|
|
4
|
+
export {};
|
|
@@ -6,8 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import styled from '@xstyled/styled-components';
|
|
7
7
|
import get from 'lodash/fp/get';
|
|
8
8
|
var Wrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n\n :hover {\n cursor: pointer;\n .tooltip {\n display: block;\n }\n }\n"], ["\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n\n :hover {\n cursor: pointer;\n .tooltip {\n display: block;\n }\n }\n"])));
|
|
9
|
-
|
|
10
|
-
var
|
|
9
|
+
var Tooltip = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n align-content: center;\n justify-content: center;\n margin-bottom: 2;\n\n div {\n display: none;\n position: absolute;\n background-color: white;\n color: gray;\n border-color: gray;\n border: 1px solid;\n border-radius: md;\n padding: 2 3;\n margin: 1;\n z-index: 1;\n box-shadow: tooltipBoxShadow;\n transform: translateY(-100%);\n\n max-width: 400px;\n line-break: anywhere;\n white-space: initial;\n }\n"], ["\n display: flex;\n align-content: center;\n justify-content: center;\n margin-bottom: 2;\n\n div {\n display: none;\n position: absolute;\n background-color: white;\n color: gray;\n border-color: gray;\n border: 1px solid;\n border-radius: md;\n padding: 2 3;\n margin: 1;\n z-index: 1;\n box-shadow: tooltipBoxShadow;\n transform: translateY(-100%);\n\n max-width: 400px;\n line-break: anywhere;\n white-space: initial;\n }\n"])));
|
|
10
|
+
export var HoverBubble = function (_a) {
|
|
11
11
|
var rowData = _a.rowData, column = _a.column;
|
|
12
12
|
var value = get(column.name, rowData);
|
|
13
13
|
if (value) {
|
|
@@ -15,5 +15,4 @@ var Image = function (_a) {
|
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
17
|
};
|
|
18
|
-
export default Image;
|
|
19
18
|
var templateObject_1, templateObject_2;
|