@mailstep/design-system 0.7.53-beta.3 → 0.7.53-beta.4
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/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 +1 -1
- package/ui/Blocks/CommonGrid/hooks/useManageColumn.js +5 -1
- 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 +7065 -7054
- package/ui/index.umd.js +351 -351
package/package.json
CHANGED
|
@@ -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>;
|
|
@@ -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(_Fragment, { children: [_jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsx(x.div, { w: "28px", children: _jsx(Toggle, { name: "", variant: "grid", onChange: handleToggleChange, spaceAround: false, checked: isSelected }) }), _jsx(H6, { variant: "medium", ml: "8px", children: translatedValue })] }), _jsx(Group, __assign({}, attributes, listeners, { cursor: "grab" }))] }) }));
|
|
41
41
|
};
|
|
@@ -31,6 +31,7 @@ var useManageColumn = function (_a) {
|
|
|
31
31
|
var _b = useState(__assign({}, (columnConfig !== null && columnConfig !== void 0 ? columnConfig : {}))), columnsConfigOptions = _b[0], setColumnsConfigOptions = _b[1];
|
|
32
32
|
var _c = useState(columnsOrderValue), updatedColumnsOrder = _c[0], setUpdatedColumnsOrder = _c[1];
|
|
33
33
|
var columnsConfigValues = useMemo(function () {
|
|
34
|
+
console.log('columnsConfigOptions changed', columnsConfigOptions);
|
|
34
35
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (column) {
|
|
35
36
|
var _a;
|
|
36
37
|
var isHidden = (_a = columnsConfigOptions === null || columnsConfigOptions === void 0 ? void 0 : columnsConfigOptions[column.name]) === null || _a === void 0 ? void 0 : _a.isHidden;
|
|
@@ -79,15 +80,17 @@ var useManageColumn = function (_a) {
|
|
|
79
80
|
if (!over || active.id === over.id) {
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
|
-
var newOrderColumns = __spreadArray([],
|
|
83
|
+
var newOrderColumns = __spreadArray([], updatedColumnsOrder, true);
|
|
83
84
|
var fromIndex = (_c = (_b = (_a = active === null || active === void 0 ? void 0 : active.data) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.sortable) === null || _c === void 0 ? void 0 : _c.index;
|
|
84
85
|
var toIndex = (_f = (_e = (_d = over === null || over === void 0 ? void 0 : over.data) === null || _d === void 0 ? void 0 : _d.current) === null || _e === void 0 ? void 0 : _e.sortable) === null || _f === void 0 ? void 0 : _f.index;
|
|
86
|
+
console.log('updatedColumnsOrder', updatedColumnsOrder);
|
|
85
87
|
console.log('fromIndex', fromIndex);
|
|
86
88
|
console.log('toIndex', toIndex);
|
|
87
89
|
// move column from a position to the new position
|
|
88
90
|
var column = newOrderColumns[fromIndex];
|
|
89
91
|
newOrderColumns.splice(fromIndex, 1);
|
|
90
92
|
newOrderColumns.splice(toIndex === -1 ? 0 : toIndex, 0, column);
|
|
93
|
+
console.log('newOrderColumns', newOrderColumns);
|
|
91
94
|
if (!isManageModal) {
|
|
92
95
|
setColumnsOrder === null || setColumnsOrder === void 0 ? void 0 : setColumnsOrder(newOrderColumns);
|
|
93
96
|
}
|
|
@@ -97,6 +100,7 @@ var useManageColumn = function (_a) {
|
|
|
97
100
|
useEffect(function () {
|
|
98
101
|
checksColumnsOrder(columnsOrderValue, columns);
|
|
99
102
|
}, []);
|
|
103
|
+
console.log('columnsConfigValues', columnsConfigValues);
|
|
100
104
|
return {
|
|
101
105
|
columnsConfigValues: columnsConfigValues,
|
|
102
106
|
setColumnsConfigOptions: setColumnsConfigOptions,
|
|
@@ -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;
|