@mailstep/design-system 0.8.8-beta.1 → 0.8.8-beta.3
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/components/ColumnFilterCell.js +1 -1
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.d.ts +2 -0
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.js +9 -5
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +2 -3
- package/ui/Blocks/CommonGrid/types.d.ts +1 -0
- package/ui/Blocks/CommonGrid/utils/index.d.ts +8 -1
- package/ui/Elements/Select/Select.js +1 -1
- package/ui/Elements/Select/types.d.ts +1 -1
- package/ui/index.es.js +7535 -7533
- package/ui/index.umd.js +354 -354
package/package.json
CHANGED
|
@@ -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({ asyncLoadKey: columnDefinition.asyncLoadKey, "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, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions }, filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.defaultExtraProps, columnDefinition.filterExtraProps, (filterType == 'options' && { options: columnDefinition.filterOptions }))) }) })));
|
|
38
|
+
return (_jsx(Cell, __assign({ className: cellClassName }, cellSizeProps, { children: _jsx(x.div, { children: _jsx(RenderComponent, __assign({ asyncLoadKey: columnDefinition.asyncLoadKey, "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, onAsyncLoadFilterOptions: onAsyncLoadFilterOptions }, filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.defaultExtraProps, columnDefinition.filterExtraProps, (filterType == 'options' && { options: columnDefinition.filterOptions }), { columnWidth: cellSizeProps === null || cellSizeProps === void 0 ? void 0 : cellSizeProps.flexBasis })) }) })));
|
|
39
39
|
};
|
|
40
40
|
export default ColumnFilterCell;
|
|
@@ -62,10 +62,11 @@ import { i18n } from '@lingui/core';
|
|
|
62
62
|
import isArray from 'lodash/isArray';
|
|
63
63
|
import uniqBy from 'lodash/uniqBy';
|
|
64
64
|
import { isOptionArray } from './guards';
|
|
65
|
+
var minColumnWidth = 120;
|
|
65
66
|
var SelectFilter = function (_a) {
|
|
66
|
-
var onChange = _a.onChange, _b = _a.isClearable, isClearable = _b === void 0 ? true : _b, disabled = _a.disabled, placeholder = _a.placeholder, isMulti = _a.isMulti, value = _a.value, options = _a.options, checkAllButton = _a.checkAllButton, asyncLoadKey = _a.asyncLoadKey, onAsyncLoadFilterOptions = _a.onAsyncLoadFilterOptions,
|
|
67
|
-
var
|
|
68
|
-
var
|
|
67
|
+
var onChange = _a.onChange, _b = _a.isClearable, isClearable = _b === void 0 ? true : _b, disabled = _a.disabled, placeholder = _a.placeholder, _c = _a.showValue, showValue = _c === void 0 ? true : _c, columnWidth = _a.columnWidth, isMulti = _a.isMulti, value = _a.value, options = _a.options, checkAllButton = _a.checkAllButton, asyncLoadKey = _a.asyncLoadKey, onAsyncLoadFilterOptions = _a.onAsyncLoadFilterOptions, _d = _a.onlyInComparator, onlyInComparator = _d === void 0 ? false : _d;
|
|
68
|
+
var _e = useState([]), loadedOptions = _e[0], setLoadedOptions = _e[1];
|
|
69
|
+
var _f = useState(false), isNotEqNoValue = _f[0], setIsNotEqNoValue = _f[1];
|
|
69
70
|
var isAsync = !!asyncLoadKey;
|
|
70
71
|
var isNotEq = useMemo(function () { return (isOptionArray(value) ? value.some(function (option) { return option.isNotEq; }) : isNotEqNoValue); }, [value, isNotEqNoValue]);
|
|
71
72
|
var handleOnMultiChange = useCallback(function (options) {
|
|
@@ -99,10 +100,13 @@ var SelectFilter = function (_a) {
|
|
|
99
100
|
onChange(newOptions);
|
|
100
101
|
}, [value, isNotEq, onChange]);
|
|
101
102
|
var defaultOptions = useMemo(function () { return (isMulti && isAsync && isOptionArray(value) ? uniqBy(__spreadArray(__spreadArray([], loadedOptions, true), value, true), 'value') : undefined); }, [isAsync, value, loadedOptions]);
|
|
103
|
+
var isSelectClearable = columnWidth && columnWidth > minColumnWidth ? isClearable : false;
|
|
102
104
|
if (isMulti) {
|
|
105
|
+
var placeholderIcon = columnWidth && columnWidth > minColumnWidth ? (isNotEq ? 'notEqual' : 'equals') : null;
|
|
103
106
|
var placerholderValue = placeholder || (isAsync ? i18n._({ id: 'dataGrid.filterCell', message: 'Type to filter' }) : undefined);
|
|
104
|
-
|
|
107
|
+
var selectValue = showValue ? (isOptionArray(value) ? value.map(function (option) { return String(option.value); }) : value) : undefined;
|
|
108
|
+
return (_jsx(Select, { maxMenuHeight: 250, onChange: handleOnMultiChange, value: selectValue, options: defaultOptions || options, showSelectAllButton: checkAllButton, style: "gridFilter", loadOptions: isAsync ? handleLoadOptions : undefined, defaultOptions: defaultOptions, placeholder: placerholderValue, noOptionsMessage: function () { return null; }, containerVariant: isAsync ? 'search' : undefined, placeholderIcon: placeholderIcon, onIconClick: !onlyInComparator ? handleIconClick : undefined, optionVariant: "checkbox", multiLabelVariant: "count", isMulti: true, disabled: disabled, isClearable: isSelectClearable }));
|
|
105
109
|
}
|
|
106
|
-
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,
|
|
110
|
+
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, placeholderIcon: columnWidth && columnWidth < minColumnWidth ? null : undefined, isClearable: isSelectClearable }));
|
|
107
111
|
};
|
|
108
112
|
export default SelectFilter;
|
|
@@ -15,7 +15,8 @@ export var enumColumn = {
|
|
|
15
15
|
filterExtraProps: { isMulti: true, checkAllButton: true },
|
|
16
16
|
filtering: true,
|
|
17
17
|
sorting: false,
|
|
18
|
-
cellComponent: EnumCellExample
|
|
18
|
+
cellComponent: EnumCellExample,
|
|
19
|
+
asyncLoadKey: 'enumColumnAsync'
|
|
19
20
|
};
|
|
20
21
|
export var columnDefinitions = [
|
|
21
22
|
{
|
|
@@ -41,8 +42,6 @@ export var columnDefinitions = [
|
|
|
41
42
|
filterExtraProps: {
|
|
42
43
|
isMulti: true,
|
|
43
44
|
checkAllButton: true,
|
|
44
|
-
disabled: true,
|
|
45
|
-
placeholder: 'test',
|
|
46
45
|
},
|
|
47
46
|
filtering: true,
|
|
48
47
|
sorting: true,
|
|
@@ -108,6 +108,7 @@ export type ColumnDefinition<ColumnName extends string = string> = ColumnBasePro
|
|
|
108
108
|
isMulti?: boolean;
|
|
109
109
|
disabled?: boolean;
|
|
110
110
|
placeholder?: string;
|
|
111
|
+
showValue?: boolean;
|
|
111
112
|
comparators?: Comparator[];
|
|
112
113
|
filterTime?: boolean;
|
|
113
114
|
decimals?: number;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { ColumnDefinition, ColumnConfig, FilterProps, Group, StickTo, FiltersConfig } from '../types';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type CellSizePropsResult = {
|
|
4
|
+
flexBasis?: number;
|
|
5
|
+
flexGrow?: number;
|
|
6
|
+
flexShrink?: number;
|
|
7
|
+
maxWidth?: string | number;
|
|
8
|
+
};
|
|
9
|
+
export declare const getCellSizeProps: (column: ColumnDefinition, columnWidth: number) => CellSizePropsResult;
|
|
4
10
|
export declare const getSortName: (column: ColumnDefinition) => string;
|
|
5
11
|
export declare const getFilterName: (column: ColumnDefinition) => string;
|
|
6
12
|
export declare const isColumnOn: (column: ColumnDefinition, columnConfig?: ColumnConfig) => boolean;
|
|
@@ -14,3 +20,4 @@ export declare const getGroupClassNames: (group?: Group) => string;
|
|
|
14
20
|
export declare const getStickyCollClassNames: (sticky: boolean, stickTo?: StickTo) => string;
|
|
15
21
|
export declare const getFilters: (optimizeFilters: boolean) => FiltersConfig;
|
|
16
22
|
export declare const checksColumnsOrder: (colsOrder: string[], columnsDefinitions: ColumnDefinition[]) => void;
|
|
23
|
+
export {};
|
|
@@ -83,7 +83,7 @@ var Select = function (_a) {
|
|
|
83
83
|
onChange === null || onChange === void 0 ? void 0 : onChange(emptyOptions);
|
|
84
84
|
}
|
|
85
85
|
}, [onChange]);
|
|
86
|
-
var icon = containerVariant === 'search' && !placeholderIcon ? 'search' : placeholderIcon || undefined;
|
|
86
|
+
var icon = containerVariant === 'search' && !placeholderIcon && placeholderIcon !== null ? 'search' : placeholderIcon || undefined;
|
|
87
87
|
var modifiedMaxMenuHeight = showResetGridButton && showSelectAllButton && maxMenuHeight ? maxMenuHeight - 30 : maxMenuHeight;
|
|
88
88
|
var _j = useStylesAndComponents(style, optionVariant, multiLabelVariant, containerVariant, useSimplifiedOptions, showSelectAllButton, showResetGridButton), customComponents = _j[0], customTheme = _j[1], customStyles = _j[2];
|
|
89
89
|
var RenderComponent = isAsync ? StyledAsyncSelect : StyledReactSelect;
|
|
@@ -47,7 +47,7 @@ export type SelectProps = {
|
|
|
47
47
|
optionVariant?: 'default' | 'checkbox' | 'toggle';
|
|
48
48
|
multiLabelVariant?: 'default' | 'count';
|
|
49
49
|
containerVariant?: 'default' | 'search';
|
|
50
|
-
placeholderIcon?: string;
|
|
50
|
+
placeholderIcon?: string | null;
|
|
51
51
|
innerRef?: RefObject<HTMLElement>;
|
|
52
52
|
className?: string;
|
|
53
53
|
maxMenuHeight?: number;
|