@mailstep/design-system 0.7.53-beta.3 → 0.7.53-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 -3
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.d.ts +3 -2
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/ManageColumnForm.js +4 -2
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ManageColumnRow.d.ts +1 -3
- package/ui/Blocks/CommonGrid/components/ManageColumnForm/components/ManageColumnRow.js +2 -2
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +6 -10
- package/ui/Blocks/CommonGrid/storybook/utils/columnDefinition.js +21 -13
- package/ui/Blocks/CommonGrid/storybook/utils/withRedux.d.ts +1 -0
- package/ui/Blocks/CommonGrid/storybook/utils/withRedux.js +5 -3
- package/ui/index.es.js +10040 -10040
- package/ui/index.umd.js +390 -390
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.7.53-beta.
|
|
3
|
+
"version": "0.7.53-beta.5",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"moment": "^2.30.1",
|
|
85
85
|
"prettier": "2.8.8",
|
|
86
86
|
"react": "^18.2.0",
|
|
87
|
-
"react-beautiful-dnd": "^13.0.0",
|
|
88
87
|
"react-dom": "^18.2.0",
|
|
89
88
|
"react-helmet": "^6.1.0",
|
|
90
89
|
"react-image": "^4.1.0",
|
|
@@ -127,7 +126,6 @@
|
|
|
127
126
|
"luxon": "^3.4.4",
|
|
128
127
|
"moment": "^2.30.1",
|
|
129
128
|
"react": "^18.2.0",
|
|
130
|
-
"react-beautiful-dnd": "^13.0.0",
|
|
131
129
|
"react-dom": "^18.2.0",
|
|
132
130
|
"react-helmet": "^6.1.0",
|
|
133
131
|
"react-image": "^4.1.0",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { FC } from 'react';
|
|
2
3
|
import type { ColumnConfig, CommonGridProps } from '../../types';
|
|
3
4
|
import type { DragEndEvent } from '@dnd-kit/core';
|
|
4
5
|
type ManageColumnProps = {
|
|
5
|
-
columns
|
|
6
|
+
columns: CommonGridProps['columnsDefinitions'];
|
|
6
7
|
columnsConfigValues?: string[];
|
|
7
8
|
setColumnsConfigOptions: (value: React.SetStateAction<Record<string, ColumnConfig>>) => void;
|
|
8
9
|
handleDragEnd: (item: DragEndEvent) => void;
|
|
9
10
|
};
|
|
10
|
-
declare const ManageColumnForm:
|
|
11
|
+
declare const ManageColumnForm: FC<ManageColumnProps>;
|
|
11
12
|
export default ManageColumnForm;
|
|
@@ -3,9 +3,11 @@ import { useCallback, useState } from 'react';
|
|
|
3
3
|
import { Input } from '../../../../Forms/Input/Input';
|
|
4
4
|
import { ManageColumnRow } from './components/ManageColumnRow';
|
|
5
5
|
import { closestCenter, useSensor, useSensors, DndContext, PointerSensor } from '@dnd-kit/core';
|
|
6
|
+
import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
6
7
|
import { SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
|
7
8
|
import { i18n } from '@lingui/core';
|
|
8
9
|
import { x } from '@xstyled/styled-components';
|
|
10
|
+
var modifiers = [restrictToVerticalAxis];
|
|
9
11
|
var ManageColumnForm = function (_a) {
|
|
10
12
|
var columns = _a.columns, columnsConfigValues = _a.columnsConfigValues, setColumnsConfigOptions = _a.setColumnsConfigOptions, handleDragEnd = _a.handleDragEnd;
|
|
11
13
|
var _b = useState(''), searchedValue = _b[0], setSearchedValue = _b[1];
|
|
@@ -16,9 +18,9 @@ var ManageColumnForm = function (_a) {
|
|
|
16
18
|
setSearchedValue('');
|
|
17
19
|
}, [setSearchedValue]);
|
|
18
20
|
var sensors = useSensors(useSensor(PointerSensor));
|
|
19
|
-
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(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items:
|
|
21
|
+
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(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, modifiers: modifiers, children: _jsx(SortableContext, { items: columns.map(function (_a) {
|
|
20
22
|
var name = _a.name;
|
|
21
23
|
return name;
|
|
22
|
-
})
|
|
24
|
+
}), strategy: verticalListSortingStrategy, children: _jsx(x.div, { h: "400px", overflowY: "scroll", mt: "20px", children: columns.map(function (column) { return (_jsx(ManageColumnRow, { column: column, columnsConfigValues: columnsConfigValues, setColumnsConfigOptions: setColumnsConfigOptions, searchedValue: searchedValue }, column.name)); }) }) }) })] }));
|
|
23
25
|
};
|
|
24
26
|
export default ManageColumnForm;
|
|
@@ -4,9 +4,7 @@ import type { ColumnConfig, ColumnDefinition } from '../../../types';
|
|
|
4
4
|
type ActionRowProps = {
|
|
5
5
|
column: ColumnDefinition;
|
|
6
6
|
columnsConfigValues: string[] | undefined;
|
|
7
|
-
setColumnsConfigOptions: (value: React.SetStateAction<{
|
|
8
|
-
[x: string]: ColumnConfig | {};
|
|
9
|
-
}>) => void;
|
|
7
|
+
setColumnsConfigOptions: (value: React.SetStateAction<Record<string, ColumnConfig | {}>>) => void;
|
|
10
8
|
searchedValue: string;
|
|
11
9
|
};
|
|
12
10
|
export declare const ManageColumnRow: FC<ActionRowProps>;
|
|
@@ -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
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useCallback, useState } from 'react';
|
|
14
14
|
import { Group } from '../../../../../Elements/Icon/icons/Group';
|
|
15
15
|
import Toggle from '../../../../../Elements/Toggle/Toggle';
|
|
@@ -37,5 +37,5 @@ export var ManageColumnRow = function (_a) {
|
|
|
37
37
|
disabled: !!searchedValue || !!column.sticky,
|
|
38
38
|
animateLayoutChanges: function () { return false; }
|
|
39
39
|
}), attributes = _d.attributes, listeners = _d.listeners, setNodeRef = _d.setNodeRef, transform = _d.transform, transition = _d.transition;
|
|
40
|
-
return (_jsx(RowLayout,
|
|
40
|
+
return (_jsx(RowLayout, { "$isVisible": isVisible, transition: transition, transform: CSS.Transform.toString(transform), ref: setNodeRef, children: _jsxs(x.div, { display: "flex", alignItems: "center", w: "100%", children: [_jsx(x.div, { w: "28px", children: _jsx(Toggle, { name: "", variant: "grid", onChange: handleToggleChange, spaceAround: false, checked: isSelected }) }), _jsxs(H6, __assign({ variant: "medium", ml: "8px", m: "0", w: "100%", p: "8px" }, attributes, listeners, { display: "flex", alignItems: "center", justifyContent: "space-between", children: [translatedValue, _jsx(Group, {})] }))] }) }));
|
|
41
41
|
};
|
|
@@ -70,24 +70,20 @@ var useManageColumn = function (_a) {
|
|
|
70
70
|
return sortedList;
|
|
71
71
|
}, [columnConfig, columnsConfigOptions, columns]);
|
|
72
72
|
var displayColumnsDefinitions = useMemo(function () { return getSortedColumns(columnsOrderValue, false); }, [columnsOrderValue, columns, columnsConfigOptions, getSortedColumns]);
|
|
73
|
+
// @TODO wtf
|
|
73
74
|
var manageColumnsFormDefinitions = useMemo(function () { return getSortedColumns(updatedColumnsOrder, true); }, [updatedColumnsOrder]);
|
|
74
75
|
var handleDragEnd = useCallback(function (isManageModal) {
|
|
75
76
|
if (isManageModal === void 0) { isManageModal = false; }
|
|
76
77
|
return function (event) {
|
|
77
|
-
var _a
|
|
78
|
-
var active = event.active, over = event.over;
|
|
78
|
+
var _a = event, active = _a.active, over = _a.over;
|
|
79
79
|
if (!over || active.id === over.id) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
|
-
var newOrderColumns = __spreadArray([],
|
|
83
|
-
var fromIndex = (
|
|
84
|
-
var toIndex = (
|
|
85
|
-
console.log('fromIndex', fromIndex);
|
|
86
|
-
console.log('toIndex', toIndex);
|
|
87
|
-
// move column from a position to the new position
|
|
88
|
-
var column = newOrderColumns[fromIndex];
|
|
82
|
+
var newOrderColumns = __spreadArray([], updatedColumnsOrder, true);
|
|
83
|
+
var fromIndex = updatedColumnsOrder.findIndex(function (column) { return column === active.id; });
|
|
84
|
+
var toIndex = updatedColumnsOrder.findIndex(function (column) { return column === over.id; });
|
|
89
85
|
newOrderColumns.splice(fromIndex, 1);
|
|
90
|
-
newOrderColumns.splice(toIndex === -1 ? 0 : toIndex, 0,
|
|
86
|
+
newOrderColumns.splice(toIndex === -1 ? 0 : toIndex, 0, active.id);
|
|
91
87
|
if (!isManageModal) {
|
|
92
88
|
setColumnsOrder === null || setColumnsOrder === void 0 ? void 0 : setColumnsOrder(newOrderColumns);
|
|
93
89
|
}
|
|
@@ -13,7 +13,7 @@ var ComplexCell = function (props) {
|
|
|
13
13
|
export var oversizedColumnDefinition = new Array(oversizedArrayColumns).fill(null).map(function (unused, index) { return ({
|
|
14
14
|
name: "column_".concat(index),
|
|
15
15
|
title: "column_".concat(index),
|
|
16
|
-
flexBasis: 120
|
|
16
|
+
flexBasis: 120
|
|
17
17
|
}); });
|
|
18
18
|
export var enumColumn = {
|
|
19
19
|
name: 'enumColumn',
|
|
@@ -22,15 +22,23 @@ export var enumColumn = {
|
|
|
22
22
|
filterOptions: enumValues.map(function (v) { return ({ value: v, label: v }); }),
|
|
23
23
|
filterExtraProps: { isMulti: true, checkAllButton: true },
|
|
24
24
|
filtering: true,
|
|
25
|
-
sorting: false
|
|
25
|
+
sorting: false
|
|
26
26
|
};
|
|
27
27
|
export var columnDefinitions = [
|
|
28
|
+
{
|
|
29
|
+
name: 'hiddenColumn',
|
|
30
|
+
title: 'Hidden column',
|
|
31
|
+
flexBasis: 160,
|
|
32
|
+
filtering: true,
|
|
33
|
+
sorting: true,
|
|
34
|
+
defaultHidden: true
|
|
35
|
+
},
|
|
28
36
|
{
|
|
29
37
|
name: 'textColumn',
|
|
30
38
|
title: 'Text column',
|
|
31
39
|
flexBasis: 160,
|
|
32
40
|
filtering: true,
|
|
33
|
-
sorting: true
|
|
41
|
+
sorting: true
|
|
34
42
|
},
|
|
35
43
|
enumColumn,
|
|
36
44
|
{
|
|
@@ -39,7 +47,7 @@ export var columnDefinitions = [
|
|
|
39
47
|
flexBasis: 160,
|
|
40
48
|
filtering: true,
|
|
41
49
|
filteringType: 'number',
|
|
42
|
-
sorting: true
|
|
50
|
+
sorting: true
|
|
43
51
|
},
|
|
44
52
|
{
|
|
45
53
|
name: 'numberFloatColumn',
|
|
@@ -49,8 +57,8 @@ export var columnDefinitions = [
|
|
|
49
57
|
filteringType: 'number',
|
|
50
58
|
sorting: true,
|
|
51
59
|
filterExtraProps: {
|
|
52
|
-
isFloat: true
|
|
53
|
-
}
|
|
60
|
+
isFloat: true
|
|
61
|
+
}
|
|
54
62
|
},
|
|
55
63
|
{
|
|
56
64
|
name: 'dateColumn',
|
|
@@ -60,8 +68,8 @@ export var columnDefinitions = [
|
|
|
60
68
|
filteringType: 'date',
|
|
61
69
|
sorting: true,
|
|
62
70
|
filterExtraProps: {
|
|
63
|
-
filterTime: true
|
|
64
|
-
}
|
|
71
|
+
filterTime: true
|
|
72
|
+
}
|
|
65
73
|
},
|
|
66
74
|
{
|
|
67
75
|
name: 'boolColumn',
|
|
@@ -72,7 +80,7 @@ export var columnDefinitions = [
|
|
|
72
80
|
sorting: true,
|
|
73
81
|
formatRowValue: function (row) {
|
|
74
82
|
return row.boolColumn ? 'Yes' : 'No';
|
|
75
|
-
}
|
|
83
|
+
}
|
|
76
84
|
},
|
|
77
85
|
{
|
|
78
86
|
name: 'advancedColumn',
|
|
@@ -80,13 +88,13 @@ export var columnDefinitions = [
|
|
|
80
88
|
flexBasis: 160,
|
|
81
89
|
formatRowValue: function (row) {
|
|
82
90
|
return "".concat((row.numberColumn / 4) * row.textColumn.length);
|
|
83
|
-
}
|
|
91
|
+
}
|
|
84
92
|
},
|
|
85
93
|
{
|
|
86
94
|
name: 'complexColumn',
|
|
87
95
|
title: 'Complex Column',
|
|
88
96
|
flexBasis: 350,
|
|
89
|
-
cellComponent: ComplexCell
|
|
97
|
+
cellComponent: ComplexCell
|
|
90
98
|
},
|
|
91
99
|
{
|
|
92
100
|
name: 'stickyColumn',
|
|
@@ -94,6 +102,6 @@ export var columnDefinitions = [
|
|
|
94
102
|
flexBasis: 160,
|
|
95
103
|
alwaysOn: true,
|
|
96
104
|
sticky: true,
|
|
97
|
-
stickTo: 'right'
|
|
98
|
-
}
|
|
105
|
+
stickTo: 'right'
|
|
106
|
+
}
|
|
99
107
|
];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Provider } from 'react-redux';
|
|
3
|
-
import { combineReducers, createStore } from 'redux';
|
|
3
|
+
import { combineReducers, createStore, compose } from 'redux';
|
|
4
4
|
import commonGridReducer from '../../store';
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
export var reduxComposeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
|
5
7
|
export var withProvider = function (story) {
|
|
6
8
|
var reducers = combineReducers({
|
|
7
|
-
commonGrid: commonGridReducer
|
|
9
|
+
commonGrid: commonGridReducer
|
|
8
10
|
});
|
|
9
|
-
var store = createStore(reducers);
|
|
11
|
+
var store = createStore(reducers, {}, reduxComposeEnhancer());
|
|
10
12
|
return _jsx(Provider, { store: store, children: story() });
|
|
11
13
|
};
|
|
12
14
|
export default withProvider;
|