@mailstep/design-system 0.8.8-beta.2 → 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 +1 -0
- package/ui/Blocks/CommonGrid/components/Filters/GridSelect/GridSelect.js +6 -3
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +2 -4
- 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 +13937 -13310
- package/ui/index.umd.js +437 -437
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,8 +62,9 @@ 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, _c = _a.showValue, showValue = _c === void 0 ? true : _c, 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;
|
|
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;
|
|
67
68
|
var _e = useState([]), loadedOptions = _e[0], setLoadedOptions = _e[1];
|
|
68
69
|
var _f = useState(false), isNotEqNoValue = _f[0], setIsNotEqNoValue = _f[1];
|
|
69
70
|
var isAsync = !!asyncLoadKey;
|
|
@@ -99,11 +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;
|
|
105
|
-
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:
|
|
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 }));
|
|
106
109
|
}
|
|
107
|
-
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 }));
|
|
108
111
|
};
|
|
109
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,9 +42,6 @@ export var columnDefinitions = [
|
|
|
41
42
|
filterExtraProps: {
|
|
42
43
|
isMulti: true,
|
|
43
44
|
checkAllButton: true,
|
|
44
|
-
disabled: true,
|
|
45
|
-
placeholder: 'test',
|
|
46
|
-
showValue: false,
|
|
47
45
|
},
|
|
48
46
|
filtering: true,
|
|
49
47
|
sorting: true,
|
|
@@ -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;
|