@mailstep/design-system 0.7.79-beta.8 → 0.7.80-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/ui/Blocks/CommonGrid/CommonGrid.js +2 -2
- package/ui/Blocks/CommonGrid/components/ColumnFilterCell.d.ts +0 -1
- package/ui/Blocks/CommonGrid/components/ColumnFilterCell.js +2 -2
- package/ui/Blocks/CommonGrid/components/FilterRow.d.ts +0 -1
- package/ui/Blocks/CommonGrid/components/FilterRow.js +2 -2
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.d.ts +3 -6
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.js +9 -74
- package/ui/Blocks/CommonGrid/storybook/stories/complexWithPaginationAndRedux.stories.js +2 -2
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +0 -9
- package/ui/Blocks/CommonGrid/storybook/utils/utils.d.ts +0 -1
- package/ui/Blocks/CommonGrid/storybook/utils/utils.js +0 -19
- package/ui/Blocks/CommonGrid/types.d.ts +0 -2
- package/ui/Blocks/CommonGrid/utils/index.d.ts +4 -1
- package/ui/Blocks/CommonGrid/utils/index.js +1 -1
- package/ui/Blocks/SideMenu/styles.js +2 -2
- package/ui/Elements/MultiSelect/MultiSelect.d.ts +8 -0
- package/ui/Elements/MultiSelect/MultiSelect.js +29 -0
- package/ui/Elements/MultiSelect/index.d.ts +3 -0
- package/ui/Elements/MultiSelect/index.js +2 -0
- package/ui/Elements/Select/Select.js +3 -4
- package/ui/Elements/Select/components/ConnectedMenu.js +2 -2
- package/ui/Elements/Select/components/SelectAll.d.ts +3 -5
- package/ui/Elements/Select/components/SelectAll.js +4 -7
- package/ui/Elements/Select/themes/index.js +1 -1
- package/ui/Elements/Select/themes/selectStyles.js +1 -4
- package/ui/Elements/SingleSelect/SingleSelect.js +6 -5
- package/ui/index.d.ts +3 -1
- package/ui/index.es.js +9078 -9144
- package/ui/index.js +3 -1
- package/ui/index.umd.js +388 -388
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/guards.d.ts +0 -3
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/guards.js +0 -3
package/package.json
CHANGED
|
@@ -39,7 +39,7 @@ var CommonGrid = function (_a) {
|
|
|
39
39
|
// redux props
|
|
40
40
|
gridSelectors = _a.gridSelectors, gridActions = _a.gridActions,
|
|
41
41
|
// input props
|
|
42
|
-
isLoading = _a.isLoading, rowsData = _a.rowsData, hasColouredRows = _a.hasColouredRows, actionColumnDefinition = _a.actionColumnDefinition, allowRowSelect = _a.allowRowSelect, allowRowSelectOnAction = _a.allowRowSelectOnAction, onRowAction = _a.onRowAction, onRowClick = _a.onRowClick,
|
|
42
|
+
isLoading = _a.isLoading, rowsData = _a.rowsData, hasColouredRows = _a.hasColouredRows, actionColumnDefinition = _a.actionColumnDefinition, allowRowSelect = _a.allowRowSelect, allowRowSelectOnAction = _a.allowRowSelectOnAction, onRowAction = _a.onRowAction, onRowClick = _a.onRowClick, _b = _a.columnLayout, columnLayout = _b === void 0 ? 'normal' : _b, displayColumnsDefinitions = _a.displayColumnsDefinitions, className = _a.className, minColumnWidth = _a.minColumnWidth, errorMessage = _a.errorMessage, floatingButtonProps = _a.floatingButtonProps, hasGroups = _a.hasGroups, hasFilters = _a.hasFilters, isSortTerminated = _a.isSortTerminated;
|
|
43
43
|
var _c = gridSelectors.uxState, uxState = _c === void 0 ? defaultUxState : _c, _d = gridSelectors.columnsWidth, columnsWidth = _d === void 0 ? defaultColumnsWidth : _d, columnsWidthVariant = gridSelectors.columnsWidthVariant, _e = gridSelectors.page, page = _e === void 0 ? 1 : _e, filter = gridSelectors.filter, sorting = gridSelectors.sorting, _f = gridSelectors.rowsPerPage, rowsPerPage = _f === void 0 ? 10 : _f;
|
|
44
44
|
var clearUxState = gridActions.clearUxState, handleUxChange = gridActions.handleUxChange, _g = gridActions.addFilter, addFilter = _g === void 0 ? defaultVoidFunction : _g, _h = gridActions.addSorting, addSorting = _h === void 0 ? defaultVoidFunction : _h, _j = gridActions.setColumnWidth, setColumnWidth = _j === void 0 ? defaultVoidFunction : _j;
|
|
45
45
|
var handleRowsKeyDown = useRowsKeyControls(rowsData, uxState, handleUxChange);
|
|
@@ -53,7 +53,7 @@ var CommonGrid = function (_a) {
|
|
|
53
53
|
}, []);
|
|
54
54
|
var isEmpty = !isLoading && !errorMessage && (!rowsData || rowsData.length < 1);
|
|
55
55
|
var hasFloatingChildren = isLoading || errorMessage || isEmpty;
|
|
56
|
-
return (_jsxs(_Fragment, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout, totalColumnsWidth: totalColumnsWidth, floatingChildren: hasFloatingChildren && _jsx(GridStatus, { isLoading: isLoading, isEmpty: isEmpty, errorMessage: errorMessage }), ref: commonGridRef, children: [_jsxs("div", { className: "gridHead", children: [hasGroups && (_jsx(GroupRow, { actionColumn: actionColumnDefinition, columns: displayColumnsDefinitions, displayColumnsWidth: displayColumnsWidth, groups: groups })), _jsx(HeadRow, { columns: displayColumnsDefinitions, onAddSort: addSorting, columnLayout: columnLayout, sortingValues: sorting, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag, groups: groups, handleDragEnd: handleDragEnd, isSortTerminated: isSortTerminated }), hasFilters && (_jsx(FilterRow, { filters: filters, comparators: comparators, columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onChange: addFilter, filterValues: filter, displayColumnsWidth: displayColumnsWidth, groups: groups, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange
|
|
56
|
+
return (_jsxs(_Fragment, { children: [_jsx(x.div, { className: className || '', children: _jsxs(OversizedScroll, { columnLayout: columnLayout, totalColumnsWidth: totalColumnsWidth, floatingChildren: hasFloatingChildren && _jsx(GridStatus, { isLoading: isLoading, isEmpty: isEmpty, errorMessage: errorMessage }), ref: commonGridRef, children: [_jsxs("div", { className: "gridHead", children: [hasGroups && (_jsx(GroupRow, { actionColumn: actionColumnDefinition, columns: displayColumnsDefinitions, displayColumnsWidth: displayColumnsWidth, groups: groups })), _jsx(HeadRow, { columns: displayColumnsDefinitions, onAddSort: addSorting, columnLayout: columnLayout, sortingValues: sorting, displayColumnsWidth: displayColumnsWidth, handleResizeDrag: handleResizeDrag, groups: groups, handleDragEnd: handleDragEnd, isSortTerminated: isSortTerminated }), hasFilters && (_jsx(FilterRow, { filters: filters, comparators: comparators, columns: displayColumnsDefinitions, actionColumn: actionColumnDefinition, onChange: addFilter, filterValues: filter, displayColumnsWidth: displayColumnsWidth, groups: groups, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange }))] }), _jsx("div", { className: "body flx_1", style: rowsStyles, tabIndex: -1, onKeyDown: handleRowsKeyDown, children: !isLoading &&
|
|
57
57
|
rowsData &&
|
|
58
58
|
displayColumnsDefinitions &&
|
|
59
59
|
rowsData.map(function (row, index) {
|
|
@@ -14,7 +14,6 @@ type Props = {
|
|
|
14
14
|
rowsData: RowProps[];
|
|
15
15
|
uxState: UxState;
|
|
16
16
|
handleUxChange: GridActionsType['handleUxChange'];
|
|
17
|
-
onAsyncLoadFilterOptions?: (key: string, value: string) => void;
|
|
18
17
|
};
|
|
19
18
|
declare const ColumnFilterCell: FC<Props>;
|
|
20
19
|
export default ColumnFilterCell;
|
|
@@ -17,7 +17,7 @@ import { x } from '@xstyled/styled-components';
|
|
|
17
17
|
import OverlayComponent from './FilterDropdown';
|
|
18
18
|
import { Cell } from './Table';
|
|
19
19
|
var ColumnFilterCell = function (_a) {
|
|
20
|
-
var onChange = _a.onChange, value = _a.value, others = _a.others, displayColumnWidth = _a.displayColumnWidth, filters = _a.filters, columnDefinition = _a.column, group = _a.group, comparators = _a.comparators, actionColumn = _a.actionColumn, rowsData = _a.rowsData, uxState = _a.uxState, handleUxChange = _a.handleUxChange
|
|
20
|
+
var onChange = _a.onChange, value = _a.value, others = _a.others, displayColumnWidth = _a.displayColumnWidth, filters = _a.filters, columnDefinition = _a.column, group = _a.group, comparators = _a.comparators, actionColumn = _a.actionColumn, rowsData = _a.rowsData, uxState = _a.uxState, handleUxChange = _a.handleUxChange;
|
|
21
21
|
var cellSizeProps = getCellSizeProps(columnDefinition, displayColumnWidth);
|
|
22
22
|
var handleAddFilter = useAddFilter(onChange);
|
|
23
23
|
var handleChange = React.useCallback(function (event, others) {
|
|
@@ -35,6 +35,6 @@ var ColumnFilterCell = function (_a) {
|
|
|
35
35
|
console.error("ERROR, using unknown filter type ".concat(filterType));
|
|
36
36
|
return (_jsx(x.div, { children: _jsx("span", { children: "".concat(filterType, " filter") }) }));
|
|
37
37
|
}
|
|
38
|
-
return (_jsx(Cell, __assign({ className: cellClassName }, cellSizeProps, { children: _jsx(x.div, { children: _jsx(RenderComponent, __assign({
|
|
38
|
+
return (_jsx(Cell, __assign({ className: cellClassName }, cellSizeProps, { children: _jsx(x.div, { children: _jsx(RenderComponent, __assign({ "data-test": columnDefinition.name, name: columnDefinition.name, onChange: handleChange, value: value, others: others, OverlayComponent: OverlayComponent, comparators: defaultComparators, actionColumn: actionColumn, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange }, filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.defaultExtraProps, columnDefinition.filterExtraProps, (filterType == 'options' && { options: columnDefinition.filterOptions }))) }) })));
|
|
39
39
|
};
|
|
40
40
|
export default ColumnFilterCell;
|
|
@@ -5,8 +5,8 @@ import throttle from 'lodash/throttle';
|
|
|
5
5
|
import ColumnFilterCell from './ColumnFilterCell';
|
|
6
6
|
import { Row } from './Table';
|
|
7
7
|
var FilterRow = function (_a) {
|
|
8
|
-
var columns = _a.columns, groups = _a.groups, actionColumn = _a.actionColumn, onChange = _a.onChange, _b = _a.filterValues, filterValues = _b === void 0 ? {} : _b, displayColumnsWidth = _a.displayColumnsWidth, filters = _a.filters, comparators = _a.comparators, handleUxChange = _a.handleUxChange,
|
|
8
|
+
var columns = _a.columns, groups = _a.groups, actionColumn = _a.actionColumn, onChange = _a.onChange, _b = _a.filterValues, filterValues = _b === void 0 ? {} : _b, displayColumnsWidth = _a.displayColumnsWidth, filters = _a.filters, comparators = _a.comparators, handleUxChange = _a.handleUxChange, rowsData = _a.rowsData, uxState = _a.uxState;
|
|
9
9
|
var handleOnChange = throttle(onChange, 500);
|
|
10
|
-
return (_jsx(Row, { className: "filterRow", children: columns.map(function (column, index) { return (_jsx(ColumnFilterCell, { column: column, actionColumn: actionColumn, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange, onChange: handleOnChange, value: get([getFilterName(column), 'value'], filterValues), others: get([getFilterName(column), 'others'], filterValues), displayColumnWidth: displayColumnsWidth[column.name], filters: filters, comparators: comparators, group: groups === null || groups === void 0 ? void 0 : groups[index]
|
|
10
|
+
return (_jsx(Row, { className: "filterRow", children: columns.map(function (column, index) { return (_jsx(ColumnFilterCell, { column: column, actionColumn: actionColumn, rowsData: rowsData, uxState: uxState, handleUxChange: handleUxChange, onChange: handleOnChange, value: get([getFilterName(column), 'value'], filterValues), others: get([getFilterName(column), 'others'], filterValues), displayColumnWidth: displayColumnsWidth[column.name], filters: filters, comparators: comparators, group: groups === null || groups === void 0 ? void 0 : groups[index] }, index)); }) }));
|
|
11
11
|
};
|
|
12
12
|
export default FilterRow;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { CommonGridProps } from '../../../types';
|
|
2
|
+
import { ColumnDefinition } from '../../../types';
|
|
4
3
|
|
|
5
4
|
type Props = {
|
|
6
5
|
onChange: (data: any) => void;
|
|
7
|
-
onAsyncLoadFilterOptions?: CommonGridProps['onAsyncLoadFilterOptions'];
|
|
8
6
|
isMulti?: boolean;
|
|
9
|
-
options?:
|
|
10
|
-
value?: string | string[]
|
|
7
|
+
options?: ColumnDefinition['filterOptions'];
|
|
8
|
+
value?: string | string[];
|
|
11
9
|
checkAllButton?: boolean;
|
|
12
|
-
asyncLoadKey?: string;
|
|
13
10
|
};
|
|
14
11
|
declare const SelectFilter: FC<Props>;
|
|
15
12
|
export default SelectFilter;
|
|
@@ -1,84 +1,19 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
-
if (ar || !(i in from)) {
|
|
40
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
-
ar[i] = from[i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
-
};
|
|
46
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
47
|
-
import { useCallback
|
|
48
|
-
import
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import MultiSelect from '../../../../../Elements/MultiSelect';
|
|
49
4
|
import SingleSelect from '../../../../../Elements/SingleSelect';
|
|
50
|
-
import { i18n } from '@lingui/core';
|
|
51
5
|
import isArray from 'lodash/isArray';
|
|
52
|
-
|
|
53
|
-
import uniqBy from 'lodash/uniqBy';
|
|
6
|
+
var emptyValue = [];
|
|
54
7
|
var SelectFilter = function (_a) {
|
|
55
|
-
var onChange = _a.onChange, isMulti = _a.isMulti, value = _a.value, options = _a.options, checkAllButton = _a.checkAllButton
|
|
56
|
-
var _b = useState([]), loadedOptions = _b[0], setLoadedOptions = _b[1];
|
|
8
|
+
var onChange = _a.onChange, isMulti = _a.isMulti, value = _a.value, options = _a.options, checkAllButton = _a.checkAllButton;
|
|
57
9
|
var handleOnMultiChange = useCallback(function (options) {
|
|
58
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(!isArray(options) || !(options === null || options === void 0 ? void 0 : options.length) ? null : options);
|
|
10
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isArray(options) || !(options === null || options === void 0 ? void 0 : options.length) ? null : options.map(function (option) { return option.value; }));
|
|
59
11
|
}, [onChange]);
|
|
60
|
-
var isAsync = !!asyncLoadKey;
|
|
61
|
-
var handleLoadOptions = useCallback(function (fulltext) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
-
var data;
|
|
63
|
-
return __generator(this, function (_a) {
|
|
64
|
-
switch (_a.label) {
|
|
65
|
-
case 0:
|
|
66
|
-
data = [];
|
|
67
|
-
if (!asyncLoadKey) return [3 /*break*/, 2];
|
|
68
|
-
return [4 /*yield*/, (onAsyncLoadFilterOptions === null || onAsyncLoadFilterOptions === void 0 ? void 0 : onAsyncLoadFilterOptions(asyncLoadKey, fulltext))];
|
|
69
|
-
case 1:
|
|
70
|
-
data = (_a.sent()) || [];
|
|
71
|
-
_a.label = 2;
|
|
72
|
-
case 2:
|
|
73
|
-
setLoadedOptions(data);
|
|
74
|
-
return [2 /*return*/, data];
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}); }, [options]);
|
|
78
12
|
if (isMulti) {
|
|
79
|
-
|
|
80
|
-
|
|
13
|
+
return (_jsx(MultiSelect, { maxMenuHeight: 250, onChange: handleOnMultiChange, value: value || emptyValue, options: options, checkAllButton: checkAllButton, style: "gridFilter" }));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return _jsx(SingleSelect, { maxMenuHeight: 250, onChange: onChange, value: value, options: options, style: "gridFilter" });
|
|
81
17
|
}
|
|
82
|
-
return (_jsx(SingleSelect, { maxMenuHeight: 250, onChange: onChange, value: value, options: options, style: "gridFilter", loadOptions: isAsync ? handleLoadOptions : undefined, placeholder: isAsync ? i18n._({ id: 'dataGrid.filterCell', message: 'Type to filter' }) : undefined, isClearable: true }));
|
|
83
18
|
};
|
|
84
19
|
export default SelectFilter;
|
|
@@ -6,7 +6,7 @@ import { useAddFilter } from '../../hooks/useAddFilter';
|
|
|
6
6
|
import { ExtraControlButtonPosition } from '../../types';
|
|
7
7
|
import { onRowEditClick, onRowReadClick, onRowAction, onRowClick, onBatchAction } from '../utils/actions';
|
|
8
8
|
import { columnDefinitions, enumColumn } from '../utils/columnDefinition';
|
|
9
|
-
import { ReduxGrid, createRandomData, enumValues, gridDummyActions
|
|
9
|
+
import { ReduxGrid, createRandomData, enumValues, gridDummyActions } from '../utils/utils';
|
|
10
10
|
import withRedux from '../utils/withRedux';
|
|
11
11
|
var ActionColumnButtons = {
|
|
12
12
|
flexBasis: 80,
|
|
@@ -47,7 +47,7 @@ export default {
|
|
|
47
47
|
title: 'Blocks/CommonGrid',
|
|
48
48
|
decorators: [withRedux]
|
|
49
49
|
};
|
|
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,
|
|
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, quickFilter: "textColumn", extraControlButtons: extraControlButtons, comparators: comparators, gridName: "gridName" })] })); };
|
|
51
51
|
ComplexWithPaginationAndRedux.story = {
|
|
52
52
|
name: 'Complex, with pagination and redux'
|
|
53
53
|
};
|
|
@@ -34,15 +34,6 @@ export var columnDefinitions = [
|
|
|
34
34
|
sorting: true
|
|
35
35
|
},
|
|
36
36
|
enumColumn,
|
|
37
|
-
{
|
|
38
|
-
name: 'enumColumnAsync',
|
|
39
|
-
title: 'Enum Column Async',
|
|
40
|
-
flexBasis: 160,
|
|
41
|
-
filterExtraProps: { isMulti: true, checkAllButton: true },
|
|
42
|
-
filtering: true,
|
|
43
|
-
sorting: true,
|
|
44
|
-
asyncLoadKey: 'enumColumnAsync'
|
|
45
|
-
},
|
|
46
37
|
{
|
|
47
38
|
name: 'numberColumn',
|
|
48
39
|
title: 'Number Column',
|
|
@@ -18,4 +18,3 @@ export declare const gridDummyActions: Required<GridActionsType>;
|
|
|
18
18
|
export declare const createOversizedRandomData: (count: number) => any[];
|
|
19
19
|
export declare const ReduxGrid: FC<any>;
|
|
20
20
|
export declare const extraControlButtons: ExtraControlButton[];
|
|
21
|
-
export declare const onAsyncLoadFilterOptions: (key: string, value: string) => Promise<unknown>;
|
|
@@ -72,22 +72,3 @@ export var extraControlButtons = [
|
|
|
72
72
|
{ label: 'Reload', position: ExtraControlButtonPosition.TopLeft },
|
|
73
73
|
{ label: 'Export all', position: ExtraControlButtonPosition.TopRight }
|
|
74
74
|
];
|
|
75
|
-
export var onAsyncLoadFilterOptions = function (key, value) {
|
|
76
|
-
return new Promise(function (resolve) {
|
|
77
|
-
setTimeout(function () {
|
|
78
|
-
resolve([
|
|
79
|
-
{ label: 'Apple', value: 'apple' },
|
|
80
|
-
{ label: 'Banana', value: 'banana' },
|
|
81
|
-
{ label: 'Cherry', value: 'cherry' },
|
|
82
|
-
{ label: 'Date', value: 'date' },
|
|
83
|
-
{ label: 'Elderberry', value: 'elderberry' },
|
|
84
|
-
{ label: 'Fig', value: 'fig' },
|
|
85
|
-
{ label: 'Grape', value: 'grape' },
|
|
86
|
-
{ label: 'Honeydew', value: 'honeydew' },
|
|
87
|
-
{ label: 'Kiwi', value: 'kiwi' },
|
|
88
|
-
{ label: 'Lemon', value: 'lemon' },
|
|
89
|
-
{ label: 'Lime', value: 'lime' },
|
|
90
|
-
]);
|
|
91
|
-
}, 1000);
|
|
92
|
-
});
|
|
93
|
-
};
|
|
@@ -92,7 +92,6 @@ type ColumnBaseProps = {
|
|
|
92
92
|
};
|
|
93
93
|
export type RowValueType = string | React.ReactNode | number | void;
|
|
94
94
|
export type ColumnDefinition<ColumnName extends string = string> = ColumnBaseProps & {
|
|
95
|
-
asyncLoadKey?: string;
|
|
96
95
|
name: ColumnName;
|
|
97
96
|
group?: Group['name'];
|
|
98
97
|
systemName?: string;
|
|
@@ -249,7 +248,6 @@ export type CommonGridProps<TData extends RowProps = RowProps> = {
|
|
|
249
248
|
onRowReadClick?: (id: string, props: TData) => void;
|
|
250
249
|
onRowClick?: (id: string, props: TData) => void;
|
|
251
250
|
onBatchAction?: OnBatchActionFn;
|
|
252
|
-
onAsyncLoadFilterOptions?: (key: string, value: string) => Promise<Option[]>;
|
|
253
251
|
columnLayout?: ColumnLayout;
|
|
254
252
|
quickFilter?: string;
|
|
255
253
|
confirmOnReset?: () => boolean;
|
|
@@ -8,7 +8,10 @@ export declare const calculatePaginator: (page: number, rowsPerPage: number) =>
|
|
|
8
8
|
offset: number;
|
|
9
9
|
limit: number;
|
|
10
10
|
};
|
|
11
|
-
export declare const createFilterType: (columnDefinition:
|
|
11
|
+
export declare const createFilterType: (columnDefinition: {
|
|
12
|
+
filterOptions?: ColumnDefinition["filterOptions"];
|
|
13
|
+
filteringType?: ColumnDefinition["filteringType"];
|
|
14
|
+
}) => FilterProps["type"];
|
|
12
15
|
export declare const getGroups: (columns: ColumnDefinition[]) => Group[];
|
|
13
16
|
export declare const getGroupClassNames: (group?: Group) => string;
|
|
14
17
|
export declare const getStickyCollClassNames: (sticky: boolean, stickTo?: StickTo) => string;
|
|
@@ -39,7 +39,7 @@ export var calculatePaginator = function (page, rowsPerPage) { return ({
|
|
|
39
39
|
limit: rowsPerPage
|
|
40
40
|
}); };
|
|
41
41
|
export var createFilterType = function (columnDefinition) {
|
|
42
|
-
if (columnDefinition.filterOptions
|
|
42
|
+
if (columnDefinition.filterOptions)
|
|
43
43
|
return 'options';
|
|
44
44
|
else
|
|
45
45
|
return columnDefinition.filteringType || 'text';
|
|
@@ -140,7 +140,7 @@ export var TooltipWrap = styled.div(templateObject_16 || (templateObject_16 = __
|
|
|
140
140
|
return ($lightMode ? th.color('red20') : th.color('blue2'));
|
|
141
141
|
});
|
|
142
142
|
export var OverflowWithEllipsis = styled.span(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n max-width: 140px;\n overflow: hidden;\n text-overflow: ellipsis;\n"], ["\n max-width: 140px;\n overflow: hidden;\n text-overflow: ellipsis;\n"])));
|
|
143
|
-
export var TopLevelWrap = styled.div(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background-color: ", ";\n border-right: 1px solid ", ";\n height: -webkit-fill-available;\n transition: width 0.5s ease;\n width: ", ";\n\n z-index:
|
|
143
|
+
export var TopLevelWrap = styled.div(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n background-color: ", ";\n border-right: 1px solid ", ";\n height: -webkit-fill-available;\n transition: width 0.5s ease;\n width: ", ";\n\n z-index: 6;\n position: absolute;\n top: ", ";\n height: ", ";\n\n display: flex;\n flex-direction: column;\n\n @media (min-width: 1024px) {\n top: inherit;\n z-index: 2;\n }\n"], ["\n background-color: ", ";\n border-right: 1px solid ", ";\n height: -webkit-fill-available;\n transition: width 0.5s ease;\n width: ", ";\n\n z-index: 6;\n position: absolute;\n top: ", ";\n height: ", ";\n\n display: flex;\n flex-direction: column;\n\n @media (min-width: 1024px) {\n top: inherit;\n z-index: 2;\n }\n"])), function (_a) {
|
|
144
144
|
var lightMode = _a.lightMode;
|
|
145
145
|
return (lightMode ? 'white' : th('colors.blue3'));
|
|
146
146
|
}, th('colors.lightGray6'), function (_a) {
|
|
@@ -158,5 +158,5 @@ export var BodyWrap = styled.div(templateObject_20 || (templateObject_20 = __mak
|
|
|
158
158
|
var isCompact = _a.isCompact;
|
|
159
159
|
return (isCompact ? '24px 9px' : '24px 22px');
|
|
160
160
|
});
|
|
161
|
-
export var Overlay = styled.div(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n z-index:
|
|
161
|
+
export var Overlay = styled.div(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n z-index: 6;\n height: 100%;\n width: 100%;\n background-color: ", ";\n @media (min-width: 1024px) {\n display: none;\n }\n"], ["\n position: fixed;\n top: 0;\n z-index: 6;\n height: 100%;\n width: 100%;\n background-color: ", ";\n @media (min-width: 1024px) {\n display: none;\n }\n"])), createRgba('blue2', 0.6));
|
|
162
162
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import Select from '../Select';
|
|
25
|
+
var SelectFilter = function (_a) {
|
|
26
|
+
var checkAllButton = _a.checkAllButton, restProps = __rest(_a, ["checkAllButton"]);
|
|
27
|
+
return (_jsx(Select, __assign({}, restProps, { optionVariant: "checkbox", multiLabelVariant: "count", isMulti: true, showSelectAllButton: checkAllButton })));
|
|
28
|
+
};
|
|
29
|
+
export default SelectFilter;
|
|
@@ -71,11 +71,10 @@ var loadingMessage = function () { return i18n._({ id: 'components.dropdown.load
|
|
|
71
71
|
var Select = function (_a) {
|
|
72
72
|
var label = _a.label, name = _a.name, _b = _a.value, value = _b === void 0 ? '' : _b, _c = _a.options, options = _c === void 0 ? emptyOptions : _c, defaultOptions = _a.defaultOptions, loadOptions = _a.loadOptions, onChange = _a.onChange, onBlur = _a.onBlur, error = _a.error, isInvalid = _a.isInvalid, isLoading = _a.isLoading, isDarkPlaceholderText = _a.isDarkPlaceholderText, _d = _a.spaceAround, spaceAround = _d === void 0 ? false : _d, disabled = _a.disabled, onInputChange = _a.onInputChange, isSearchable = _a.isSearchable, isMulti = _a.isMulti, className = _a.className, _e = _a.useSimplifiedOptions, useSimplifiedOptions = _e === void 0 ? false : _e, _f = _a.showSelectAllButton, showSelectAllButton = _f === void 0 ? false : _f, _g = _a.showResetGridButton, showResetGridButton = _g === void 0 ? false : _g, _h = _a.shortValues, shortValues = _h === void 0 ? true : _h, style = _a.style, optionVariant = _a.optionVariant, multiLabelVariant = _a.multiLabelVariant, containerVariant = _a.containerVariant, placeholder = _a.placeholder, placeholderIcon = _a.placeholderIcon, innerRef = _a.innerRef, maxMenuHeight = _a.maxMenuHeight, getOptionValue = _a.getOptionValue, resetGrid = _a.resetGrid, passTroughProps = __rest(_a, ["label", "name", "value", "options", "defaultOptions", "loadOptions", "onChange", "onBlur", "error", "isInvalid", "isLoading", "isDarkPlaceholderText", "spaceAround", "disabled", "onInputChange", "isSearchable", "isMulti", "className", "useSimplifiedOptions", "showSelectAllButton", "showResetGridButton", "shortValues", "style", "optionVariant", "multiLabelVariant", "containerVariant", "placeholder", "placeholderIcon", "innerRef", "maxMenuHeight", "getOptionValue", "resetGrid"]);
|
|
73
73
|
var isAsync = !!loadOptions;
|
|
74
|
-
if (showSelectAllButton && !isMulti) {
|
|
74
|
+
if (showSelectAllButton && (loadOptions || !isMulti)) {
|
|
75
75
|
console.error('CheckboxSelect incompatible props');
|
|
76
76
|
}
|
|
77
|
-
var setAllOptions = useCallback(function (
|
|
78
|
-
var options = _a.options;
|
|
77
|
+
var setAllOptions = useCallback(function () {
|
|
79
78
|
onChange === null || onChange === void 0 ? void 0 : onChange((options || []));
|
|
80
79
|
}, [onChange, options]);
|
|
81
80
|
var unsetAllOptions = useCallback(function () {
|
|
@@ -106,6 +105,6 @@ var Select = function (_a) {
|
|
|
106
105
|
}
|
|
107
106
|
}); }); } : undefined;
|
|
108
107
|
}, [loadOptions]);
|
|
109
|
-
return (_jsxs(SpaceAroundWrap, { spaceAround: spaceAround, className: className, children: [_jsxs(Wrapper, { children: [label && _jsx(FieldLabel, { htmlFor: name, children: label }), _jsx(RenderComponent, __assign({ id: name, name: name, options: options, loadOptions: handleLoadOptions, defaultOptions: defaultOptions, value: selectedOption, onChange: onChange, onBlur: onBlur, isDisabled: disabled || isLoading, isLoading: isLoading, isInvalid: isInvalid !== undefined ? isInvalid : !!error, isDarkPlaceholderText: isDarkPlaceholderText, placeholder: placeholder || i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }), styles: customStyles, theme: customTheme, icon: icon, hideSelectedOptions: !!(isMulti && multiLabelVariant != 'count'), onInputChange: onInputChange, isSearchable: isAsync || isSearchable, isMulti: isMulti, classNamePrefix: "react-select", components: customComponents, closeMenuOnSelect: isMulti ? false : undefined
|
|
108
|
+
return (_jsxs(SpaceAroundWrap, { spaceAround: spaceAround, className: className, children: [_jsxs(Wrapper, { children: [label && _jsx(FieldLabel, { htmlFor: name, children: label }), _jsx(RenderComponent, __assign({ id: name, name: name, options: options, loadOptions: handleLoadOptions, defaultOptions: defaultOptions, value: selectedOption, onChange: onChange, onBlur: onBlur, isDisabled: disabled || isLoading, isLoading: isLoading, isInvalid: isInvalid !== undefined ? isInvalid : !!error, isDarkPlaceholderText: isDarkPlaceholderText, placeholder: placeholder || i18n._({ id: 'components.dropdown.placeholder', message: 'Select...' }), styles: customStyles, theme: customTheme, icon: icon, hideSelectedOptions: !!(isMulti && multiLabelVariant != 'count'), onInputChange: onInputChange, isSearchable: isAsync || isSearchable, isMulti: isMulti, classNamePrefix: "react-select", components: customComponents, closeMenuOnSelect: isMulti ? false : undefined }, passTroughProps, { ref: innerRef, tabIndex: null, systemTheme: theme, resetGrid: resetGrid, onCustomSelectAll: setAllOptions, onCustomDeselectAll: unsetAllOptions, selectAllButton: showSelectAllButton, resetGridButton: showResetGridButton, maxMenuHeight: modifiedMaxMenuHeight, getOptionValue: getOptionValue, noOptionsMessage: noOptionsMessage, loadingMessage: loadingMessage, shortValues: shortValues }))] }), error && _jsx(ErrorMessage, { children: error })] }));
|
|
110
109
|
};
|
|
111
110
|
export default Select;
|
|
@@ -15,7 +15,7 @@ import SelectAll from '../components/SelectAll';
|
|
|
15
15
|
import ResetAll from '../components/ResetAll';
|
|
16
16
|
var ConnectedMenu = function (props) {
|
|
17
17
|
var theme = props.theme;
|
|
18
|
-
var _a = props.selectProps, resetGrid = _a.resetGrid, onCustomSelectAll = _a.onCustomSelectAll, onCustomDeselectAll = _a.onCustomDeselectAll, value = _a.value, options = _a.options, resetGridButton = _a.resetGridButton, selectAllButton = _a.selectAllButton, maxMenuHeight = _a.maxMenuHeight
|
|
19
|
-
return (_jsxs(selectComponents.MenuList, __assign({}, props, { children: [selectAllButton &&
|
|
18
|
+
var _a = props.selectProps, resetGrid = _a.resetGrid, onCustomSelectAll = _a.onCustomSelectAll, onCustomDeselectAll = _a.onCustomDeselectAll, value = _a.value, options = _a.options, resetGridButton = _a.resetGridButton, selectAllButton = _a.selectAllButton, maxMenuHeight = _a.maxMenuHeight;
|
|
19
|
+
return (_jsxs(selectComponents.MenuList, __assign({}, props, { children: [selectAllButton && (_jsx(SelectAll, { theme: theme, onCustomSelectAll: onCustomSelectAll, onCustomDeselectAll: onCustomDeselectAll, value: value, options: options, maxMenuHeight: maxMenuHeight })), props.children, resetGridButton && _jsx(ResetAll, { onReset: resetGrid })] })));
|
|
20
20
|
};
|
|
21
21
|
export default ConnectedMenu;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { SelectProps, CustomTheme
|
|
1
|
+
import { SelectProps, CustomTheme } from '../types';
|
|
2
2
|
|
|
3
3
|
type Props = {
|
|
4
|
-
onCustomSelectAll: (
|
|
5
|
-
options?: Option[];
|
|
6
|
-
}) => void;
|
|
4
|
+
onCustomSelectAll: () => void;
|
|
7
5
|
onCustomDeselectAll: () => void;
|
|
8
6
|
value: SelectProps['value'];
|
|
9
7
|
options: SelectProps['options'];
|
|
10
8
|
maxMenuHeight: number;
|
|
11
9
|
theme: CustomTheme;
|
|
12
10
|
};
|
|
13
|
-
declare const SelectAll: ({ onCustomSelectAll, onCustomDeselectAll, value, options, maxMenuHeight, theme }: Props) => import("react/jsx-runtime").JSX.Element
|
|
11
|
+
declare const SelectAll: ({ onCustomSelectAll, onCustomDeselectAll, value, options, maxMenuHeight, theme }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
export default SelectAll;
|
|
@@ -4,11 +4,11 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useCallback, useState, useEffect, useRef } from 'react';
|
|
7
|
+
import styled, { th } from '@xstyled/styled-components';
|
|
8
|
+
import { Trans } from '@lingui/react';
|
|
7
9
|
import Checkbox from '../../../Forms/Checkbox/Checkbox';
|
|
8
10
|
import Toggle from '../../Toggle/Toggle';
|
|
9
11
|
import SelectedIndicator from '../components/SelectedIndicator';
|
|
10
|
-
import { Trans } from '@lingui/react';
|
|
11
|
-
import styled, { th } from '@xstyled/styled-components';
|
|
12
12
|
var SelectAllWrap = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n margin: 0px 2px 1px 0px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n cursor: pointer;\n\n :hover {\n background-color: ", ";\n }\n"], ["\n display: flex;\n margin: 0px 2px 1px 0px;\n padding: ", ";\n font-weight: 400;\n background-color: ", ";\n color: ", ";\n border-radius: 6px;\n height: 36px;\n cursor: pointer;\n\n :hover {\n background-color: ", ";\n }\n"])), function (_a) {
|
|
13
13
|
var additionalPadding = _a.additionalPadding;
|
|
14
14
|
return (additionalPadding ? '8px 27px 8px 10px' : '10px 10px');
|
|
@@ -32,7 +32,7 @@ var SelectAll = function (_a) {
|
|
|
32
32
|
var handleSelectAll = useCallback(function () {
|
|
33
33
|
if (!isSelected) {
|
|
34
34
|
setIsSelected(true);
|
|
35
|
-
onCustomSelectAll(
|
|
35
|
+
onCustomSelectAll();
|
|
36
36
|
}
|
|
37
37
|
else if (isSelected) {
|
|
38
38
|
setIsSelected(false);
|
|
@@ -50,10 +50,7 @@ var SelectAll = function (_a) {
|
|
|
50
50
|
(options === null || options === void 0 ? void 0 : options.length) !== value.length && setIsSelected(false);
|
|
51
51
|
}
|
|
52
52
|
}, [maxMenuHeight, options === null || options === void 0 ? void 0 : options.length, value]);
|
|
53
|
-
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return (_jsxs(SelectAllWrap, { isSelected: isSelected, onClick: handleSelectAll, ref: ref, additionalPadding: additionalPadding, children: [(showCheckbox || showToggle) && (_jsxs(SelectedIndicator, { children: [showCheckbox && _jsx(Checkbox, { checked: isSelected, size: 2, readOnly: true }), showToggle && _jsx(Toggle, { name: "", checked: isSelected, spaceAround: false, variant: 'grid' })] })), _jsx(Trans, { id: "datagrid.filterCell.selectAllLabel", message: 'select all' }), " (", options === null || options === void 0 ? void 0 : options.length, ")"] }));
|
|
53
|
+
return (_jsxs(SelectAllWrap, { isSelected: isSelected, onClick: handleSelectAll, ref: ref, additionalPadding: additionalPadding, children: [(showCheckbox || showToggle) && (_jsxs(SelectedIndicator, { children: [showCheckbox && _jsx(Checkbox, { checked: isSelected, size: 2, readOnly: true }), showToggle && _jsx(Toggle, { name: "", checked: isSelected, spaceAround: false, variant: 'grid' })] })), _jsx(Trans, { id: "datagrid.filterCell.selectAllLabel", message: 'select all' })] }));
|
|
57
54
|
};
|
|
58
55
|
export default SelectAll;
|
|
59
56
|
var templateObject_1;
|
|
@@ -21,7 +21,6 @@ export var useStylesAndComponents = function (style, optionVariant, multiLabelVa
|
|
|
21
21
|
var components = {
|
|
22
22
|
ValueContainer: IconValueContainer
|
|
23
23
|
};
|
|
24
|
-
components.DropdownIndicator = DropdownIndicator;
|
|
25
24
|
if (multiLabelVariant === 'count') {
|
|
26
25
|
components.MultiValue = CountMultiValue;
|
|
27
26
|
}
|
|
@@ -35,6 +34,7 @@ export var useStylesAndComponents = function (style, optionVariant, multiLabelVa
|
|
|
35
34
|
var themes = getFormCustomTheme(systemTheme, optionVariant, style == 'gridFilter');
|
|
36
35
|
var styles = SelectCustomStyles;
|
|
37
36
|
components.Option = ChevronOption;
|
|
37
|
+
components.DropdownIndicator = DropdownIndicator;
|
|
38
38
|
// performance reasons
|
|
39
39
|
if (useSimplifiedOptions)
|
|
40
40
|
components.Option = SimplifiedOption;
|
|
@@ -122,11 +122,8 @@ export var CustomStyles = {
|
|
|
122
122
|
},
|
|
123
123
|
clearIndicator: function (styles, state) {
|
|
124
124
|
var theme = state.theme;
|
|
125
|
-
return __assign(__assign({}, styles), { justifyContent: 'center', alignItems: 'center', padding: theme.narrowIndicators ? '0px
|
|
125
|
+
return __assign(__assign({}, styles), { justifyContent: 'center', alignItems: 'center', padding: theme.narrowIndicators ? '0px 0px 0px 2px' : '0px 4px', color: theme.colors.dropdownIndicatorColor });
|
|
126
126
|
},
|
|
127
|
-
indicatorSeparator: function () { return ({
|
|
128
|
-
display: 'none',
|
|
129
|
-
}); }
|
|
130
127
|
};
|
|
131
128
|
export var getCustomTheme = function (theme, optionVariant, useFilterSubvariant) {
|
|
132
129
|
var inputTextColor = th.color('blue2')({ theme: theme });
|
|
@@ -85,11 +85,12 @@ var SingleSelect = function (props) {
|
|
|
85
85
|
var _e = useState(false), isCreating = _e[0], setIsCreating = _e[1];
|
|
86
86
|
var asAsync = !!loadOptions || !!onCreateOption;
|
|
87
87
|
var noOptionsMessage = useCallback(function (inputValue) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
return loadOptions && inputValue.length < asyncLoadMinChars
|
|
89
|
+
? i18n._({
|
|
90
|
+
id: 'components.dropdown.writeMoreChars',
|
|
91
|
+
message: 'Write at least ${asyncLoadMinChars} characters.'
|
|
92
|
+
})
|
|
93
|
+
: i18n._({ id: 'components.dropdown.noOptions', message: 'No options' });
|
|
93
94
|
}, [loadOptions, asyncLoadMinChars]);
|
|
94
95
|
var handleLoadOptions = useCallback(function (inputValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
96
|
return __generator(this, function (_a) {
|
package/ui/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { default as Label } from './Elements/Label';
|
|
|
27
27
|
import { default as Line } from './Elements/Line';
|
|
28
28
|
import { default as Link } from './Elements/Link';
|
|
29
29
|
import { default as Logo } from './Elements/Logo';
|
|
30
|
+
import { default as MultiSelect } from './Elements/MultiSelect';
|
|
30
31
|
import { default as Pagination } from './Elements/Pagination';
|
|
31
32
|
import { default as Portal } from './Elements/Portal';
|
|
32
33
|
import { default as ProgressBar } from './Elements/ProgressBar';
|
|
@@ -46,7 +47,7 @@ import { default as TextArea } from './Forms/TextArea';
|
|
|
46
47
|
import { default as ThemeProvider } from './ThemeProvider';
|
|
47
48
|
import { default as utils } from './utils';
|
|
48
49
|
|
|
49
|
-
export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, AsyncSelect, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper, Scheduler };
|
|
50
|
+
export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, AsyncSelect, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, LoginPage, LanguageSwitch, SideMenu, Stepper, Scheduler };
|
|
50
51
|
export * from './Blocks/CornerDialog';
|
|
51
52
|
export * from './Blocks/ImageList';
|
|
52
53
|
export * from './Blocks/LightBox';
|
|
@@ -86,6 +87,7 @@ export * from './Elements/DatePicker';
|
|
|
86
87
|
export * from './Blocks/CommonGrid';
|
|
87
88
|
export * from './Blocks/Popover';
|
|
88
89
|
export * from './Elements/SingleSelect';
|
|
90
|
+
export * from './Elements/MultiSelect';
|
|
89
91
|
export * from './Elements/Select';
|
|
90
92
|
export * from './Elements/DropdownSelect';
|
|
91
93
|
export * from './Forms/TextArea';
|