@mailstep/design-system 0.6.90-beta.4 → 0.6.90-beta.5
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/ColumnTitle.d.ts +1 -1
- package/ui/Blocks/CommonGrid/components/HeadRow.js +29 -6
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +1 -1
- package/ui/Blocks/CommonGrid/hooks/useSelectPreset.js +3 -1
- package/ui/Blocks/CommonGrid/types.d.ts +1 -1
- package/ui/index.es.js +6225 -6242
- package/ui/index.umd.js +342 -342
- package/ui/Blocks/CommonGrid/components/HeadCell.d.ts +0 -27
- package/ui/Blocks/CommonGrid/components/HeadCell.js +0 -42
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { SortingValueType } from '../types';
|
|
|
3
3
|
declare const _default: React.NamedExoticComponent<{
|
|
4
4
|
title?: string | JSX.Element | undefined;
|
|
5
5
|
isSortable: boolean;
|
|
6
|
-
onSetSort
|
|
6
|
+
onSetSort?: ((value: SortingValueType) => void) | undefined;
|
|
7
7
|
sortValue: SortingValueType;
|
|
8
8
|
}>;
|
|
9
9
|
export default _default;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
1
5
|
var __assign = (this && this.__assign) || function () {
|
|
2
6
|
__assign = Object.assign || function(t) {
|
|
3
7
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -12,12 +16,21 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
17
|
import React, { useEffect, useState } from 'react';
|
|
14
18
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
15
|
-
import { getActionCellSizeProps, getCellSizeProps, getSortName } from '../utils';
|
|
16
|
-
import
|
|
19
|
+
import { getActionCellSizeProps, getCellSizeProps, getGroupClassNames, getSortName, getStickyCollClassNames } from '../utils';
|
|
20
|
+
import styled from '@xstyled/styled-components';
|
|
21
|
+
import ColumnTitle from './ColumnTitle';
|
|
22
|
+
import Resize from './Resize';
|
|
17
23
|
import { Row, Cell } from './Table';
|
|
24
|
+
var DraggableCell = styled(Cell)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n"], ["\n background-color: ", ";\n"])), function (_a) {
|
|
25
|
+
var $isDragging = _a.$isDragging;
|
|
26
|
+
return ($isDragging ? 'transparentRed' : 'transparent');
|
|
27
|
+
});
|
|
18
28
|
var getStickyComponent = function (columns, stickyTo, displayColumnsWidth) {
|
|
19
29
|
var _a;
|
|
20
|
-
return (_a = columns === null || columns === void 0 ? void 0 : columns.filter(function (item) { return item.sticky && item.stickTo === stickyTo; })) === null || _a === void 0 ? void 0 : _a.map(function (column) {
|
|
30
|
+
return (_a = columns === null || columns === void 0 ? void 0 : columns.filter(function (item) { return item.sticky && item.stickTo === stickyTo; })) === null || _a === void 0 ? void 0 : _a.map(function (column) {
|
|
31
|
+
var cellClassName = "cell".concat(getStickyCollClassNames(!!column.sticky, column.stickTo), "}");
|
|
32
|
+
return (_jsx(DraggableCell, __assign({}, getCellSizeProps(column, displayColumnsWidth[column.name]), { "$isDragging": false, className: cellClassName, children: _jsx(ColumnTitle, { title: column === null || column === void 0 ? void 0 : column.title, isSortable: false, sortValue: null }) }), column.name));
|
|
33
|
+
});
|
|
21
34
|
};
|
|
22
35
|
var HeadRow = function (_a) {
|
|
23
36
|
var _b;
|
|
@@ -34,11 +47,21 @@ var HeadRow = function (_a) {
|
|
|
34
47
|
setIsDragDisabled(false);
|
|
35
48
|
}, [setIsDragDisabled]);
|
|
36
49
|
var displayReadEditCell = ((_b = actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.actionOptions) === null || _b === void 0 ? void 0 : _b.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);
|
|
50
|
+
var onResize = React.useCallback(function (name) { return function (width) {
|
|
51
|
+
handleResizeDrag === null || handleResizeDrag === void 0 ? void 0 : handleResizeDrag(name, width);
|
|
52
|
+
}; }, [handleResizeDrag]);
|
|
53
|
+
var onSetSort = React.useCallback(function (name, systemName) { return function (value) {
|
|
54
|
+
onAddSort && onAddSort(systemName || name, value);
|
|
55
|
+
}; }, [onAddSort]);
|
|
37
56
|
return (_jsx(_Fragment, { children: showUIElements && (_jsx(DragDropContext, { onDragEnd: handleDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "horizontal", isDropDisabled: isDragDisabled, isCombineEnabled: false, ignoreContainerClipping: true, children: function (droppableProvided) { return (_jsxs(Row, __assign({ className: "headRow", accountForScrollbar: false, ref: droppableProvided.innerRef }, droppableProvided.droppableProps, { children: [actionColumn && (_jsxs(_Fragment, { children: [displayReadEditCell && (_jsx(Cell, { className: "cell", style: Object.assign(__assign({}, getActionCellSizeProps(actionColumn))) })), (actionColumn === null || actionColumn === void 0 ? void 0 : actionColumn.addRowNumbers) && (_jsx(Cell, { className: "cell", style: Object.assign(__assign({}, getActionCellSizeProps(actionColumn))) }))] })), getStickyComponent(columns, 'left', displayColumnsWidth), columns
|
|
38
57
|
.filter(function (item) { return !item.sticky; })
|
|
39
|
-
.map(function (column, key) { return (_jsx(Draggable, { draggableId: column.name, index: key, isDragDisabled: isDragDisabled || column.sticky, children: function (
|
|
40
|
-
var
|
|
41
|
-
|
|
58
|
+
.map(function (column, key) { return (_jsx(Draggable, { draggableId: column.name, index: key, isDragDisabled: isDragDisabled || column.sticky, children: function (_a, snapshot) {
|
|
59
|
+
var _b;
|
|
60
|
+
var innerRef = _a.innerRef, draggableProps = _a.draggableProps, dragHandleProps = _a.dragHandleProps;
|
|
61
|
+
var hasResize = columnLayout == 'normal' || !!columns[key + 1];
|
|
62
|
+
var cellClassName = "cell".concat(getStickyCollClassNames(!!(column === null || column === void 0 ? void 0 : column.sticky), column === null || column === void 0 ? void 0 : column.stickTo), " ").concat(getGroupClassNames(groups[key]));
|
|
63
|
+
return (_jsxs(DraggableCell, __assign({}, draggableProps, (dragHandleProps || {}), getCellSizeProps(column, displayColumnsWidth[column.name]), { ref: innerRef, "$isDragging": snapshot.isDragging, className: cellClassName, children: [_jsx(ColumnTitle, { title: column === null || column === void 0 ? void 0 : column.title, isSortable: !!column.sorting, onSetSort: onSetSort(column.name, column.systemName), sortValue: ((_b = sortingValues.find(function (sorting) { return sorting.column == getSortName(column); })) === null || _b === void 0 ? void 0 : _b.direction) || null }), hasResize && onResizeOut && onResizeOver && (_jsx(Resize, { onResize: onResize(column.name), onResizeOver: onResizeOver, onResizeOut: onResizeOut }))] })));
|
|
42
64
|
} }, column.name)); }), getStickyComponent(columns, 'right', displayColumnsWidth), droppableProvided.placeholder] }))); } }) })) }));
|
|
43
65
|
};
|
|
44
66
|
export default HeadRow;
|
|
67
|
+
var templateObject_1;
|
|
@@ -25,7 +25,7 @@ var ManageColumnForm = function (_a) {
|
|
|
25
25
|
var clear = useCallback(function () {
|
|
26
26
|
setSearchedValue('');
|
|
27
27
|
}, [setSearchedValue]);
|
|
28
|
-
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(DragDropContext, { onDragEnd: handleDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "vertical", isCombineEnabled: false, ignoreContainerClipping: false, children: function (droppableProvided) { return (_jsx(x.div, __assign({ h: "400px", overflowY: "scroll", mt: "20px", ref: droppableProvided.innerRef }, droppableProvided.droppableProps, { children: columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
28
|
+
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(DragDropContext, { onDragEnd: handleDragEnd, children: _jsx(Droppable, { droppableId: "droppable", direction: "vertical", isCombineEnabled: false, ignoreContainerClipping: false, isDropDisabled: !!searchedValue, children: function (droppableProvided) { return (_jsx(x.div, __assign({ h: "400px", overflowY: "scroll", mt: "20px", ref: droppableProvided.innerRef }, droppableProvided.droppableProps, { children: columns === null || columns === void 0 ? void 0 : columns.map(function (column, index) {
|
|
29
29
|
return (_jsx(Draggable, { draggableId: column.name, index: index, isDragDisabled: !!searchedValue, children: function (draggableProvided, snapshot) { return (_jsx(ActionRow, { column: column, innerRef: draggableProvided.innerRef, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, searchedValue: searchedValue, draggableProps: draggableProvided.draggableProps, dragHandleProps: draggableProvided.dragHandleProps }, index)); } }, column.name));
|
|
30
30
|
}) }))); } }) })] }));
|
|
31
31
|
};
|
|
@@ -27,7 +27,9 @@ export var useSelectPreset = function (_a) {
|
|
|
27
27
|
}; }, [gridActions]);
|
|
28
28
|
useEffect(function () {
|
|
29
29
|
var _a;
|
|
30
|
-
if (!
|
|
30
|
+
if (!selectedPresetName || !gridName)
|
|
31
|
+
return;
|
|
32
|
+
if (!isFilterChangeFromButton) {
|
|
31
33
|
var activePreset = (_a = gridPresets[selectedPresetName]) !== null && _a !== void 0 ? _a : {};
|
|
32
34
|
var isSame = isEqual(activePreset, filters);
|
|
33
35
|
if (isSame)
|
|
@@ -46,7 +46,7 @@ export type FilterComponentProps<VT> = {
|
|
|
46
46
|
export type ColumnTitleComponentType = React.ComponentType<{
|
|
47
47
|
title?: string | JSX.Element;
|
|
48
48
|
isSortable: boolean;
|
|
49
|
-
onSetSort
|
|
49
|
+
onSetSort?: (value: SortingValueType) => void;
|
|
50
50
|
sortValue: SortingValueType;
|
|
51
51
|
}>;
|
|
52
52
|
export type ComponentsProps = {
|