cozy-ui 127.3.0 → 127.5.0
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/CHANGELOG.md +14 -0
- package/dist/cozy-ui.min.css +1 -1
- package/package.json +1 -1
- package/react/GridList/Virtualized/Dnd/GridItem.jsx +86 -0
- package/react/GridList/Virtualized/Dnd/index.jsx +67 -0
- package/react/GridList/Virtualized/index.jsx +2 -1
- package/react/Layout/Layout.jsx +9 -19
- package/react/Layout/Layout.md +73 -23
- package/react/Table/Virtualized/Dnd/index.jsx +1 -1
- package/react/Table/Virtualized/Dnd/virtuosoComponents.jsx +1 -1
- package/react/utils/Dnd/CustomDrag/CustomDragLayer.jsx +45 -0
- package/react/utils/Dnd/CustomDrag/DragPreview.jsx +43 -0
- package/react/utils/Dnd/CustomDrag/DragPreviewWrapper.jsx +52 -0
- package/react/utils/Dnd/DnDConfigWrapper.jsx +48 -0
- package/scripts/screenshots/screenshotComponent.js +4 -8
- package/stylus/elements/defaults.styl +1 -11
- package/stylus/objects/layouts.styl +13 -47
- package/transpiled/react/GridList/Virtualized/Dnd/GridItem.d.ts +7 -0
- package/transpiled/react/GridList/Virtualized/Dnd/GridItem.js +139 -0
- package/transpiled/react/GridList/Virtualized/Dnd/index.d.ts +13 -0
- package/transpiled/react/GridList/Virtualized/Dnd/index.js +81 -0
- package/transpiled/react/GridList/Virtualized/index.js +3 -1
- package/transpiled/react/Layout/Layout.js +9 -9
- package/transpiled/react/Table/Virtualized/Dnd/index.js +1 -1
- package/transpiled/react/Table/Virtualized/Dnd/virtuosoComponents.js +1 -1
- package/transpiled/react/stylesheet.css +1 -1
- package/transpiled/react/utils/Dnd/CustomDrag/CustomDragLayer.d.ts +4 -0
- package/transpiled/react/utils/Dnd/CustomDrag/CustomDragLayer.js +47 -0
- package/transpiled/react/utils/Dnd/CustomDrag/DragPreview.d.ts +6 -0
- package/transpiled/react/utils/Dnd/CustomDrag/DragPreview.js +34 -0
- package/transpiled/react/utils/Dnd/CustomDrag/DragPreviewWrapper.d.ts +8 -0
- package/transpiled/react/utils/Dnd/CustomDrag/DragPreviewWrapper.js +63 -0
- package/transpiled/react/utils/Dnd/DnDConfigWrapper.d.ts +2 -0
- package/transpiled/react/utils/Dnd/DnDConfigWrapper.js +55 -0
|
@@ -59,87 +59,53 @@ $app-layout
|
|
|
59
59
|
background-color var(--paperBackgroundColor)
|
|
60
60
|
color var(--primaryTextColor)
|
|
61
61
|
|
|
62
|
-
+medium-screen() // mobile + tablet
|
|
63
|
-
display block
|
|
64
|
-
|
|
65
|
-
&-topbar
|
|
66
|
-
+medium-screen() // mobile + tablet
|
|
67
|
-
// this pseudo-element is "ghost" element replacing bar
|
|
68
|
-
&:before
|
|
69
|
-
content ''
|
|
70
|
-
display block
|
|
71
|
-
height barHeight
|
|
72
|
-
|
|
73
62
|
// When you want a sidebar
|
|
74
63
|
&-2panes
|
|
75
64
|
flex 0 0 100%
|
|
76
65
|
align-items stretch
|
|
77
66
|
|
|
78
|
-
+medium-screen() // mobile + tablet
|
|
79
|
-
// this pseudo-element is "ghost" element replacing nav
|
|
80
|
-
&:after
|
|
81
|
-
content ''
|
|
82
|
-
display block
|
|
83
|
-
height navHeight
|
|
84
|
-
|
|
85
67
|
$app-main
|
|
86
68
|
display flex
|
|
87
69
|
flex-direction column
|
|
88
70
|
position relative
|
|
89
71
|
flex 1 1 auto
|
|
90
72
|
box-sizing border-box
|
|
91
|
-
overflow
|
|
92
|
-
|
|
73
|
+
overflow hidden
|
|
74
|
+
height 100%
|
|
93
75
|
|
|
94
76
|
+medium-screen() // mobile + tablet
|
|
95
|
-
display block
|
|
96
|
-
overflow visible
|
|
97
77
|
// iPhone X environment tweak
|
|
98
78
|
padding-left env(safe-area-inset-left)
|
|
99
79
|
padding-right env(safe-area-inset-right)
|
|
100
80
|
padding-bottom env(safe-area-inset-bottom)
|
|
101
81
|
|
|
102
|
-
&-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
min-height 'calc(100vh - %s)' % barHeight
|
|
82
|
+
&-topbar
|
|
83
|
+
// this pseudo-element is "ghost" element replacing bar
|
|
84
|
+
&:before
|
|
85
|
+
content ''
|
|
86
|
+
display block
|
|
87
|
+
height barHeight
|
|
88
|
+
width 100%
|
|
89
|
+
background-color var(--paperBackgroundColor)
|
|
111
90
|
|
|
112
91
|
&-2panes
|
|
113
|
-
height auto
|
|
114
92
|
background-color var(--defaultBackgroundColor)
|
|
115
93
|
|
|
116
94
|
+medium-screen() // mobile + tablet
|
|
117
|
-
|
|
95
|
+
height calc(100vh - var(--sidebarHeight))
|
|
118
96
|
background-color transparent
|
|
119
97
|
|
|
120
|
-
&--topbar
|
|
121
|
-
+medium-screen() // mobile + tablet
|
|
122
|
-
min-height 'calc(100vh - var(--sidebarHeight) - %s)' % barHeight
|
|
123
|
-
|
|
124
98
|
$app-content
|
|
125
99
|
position relative
|
|
126
100
|
display flex
|
|
127
101
|
flex-direction column
|
|
128
102
|
flex 1 1 auto
|
|
129
103
|
box-sizing border-box
|
|
130
|
-
overflow
|
|
131
|
-
overflow-y auto
|
|
104
|
+
overflow hidden auto
|
|
132
105
|
background-color var(--paperBackgroundColor)
|
|
133
|
-
|
|
134
|
-
+medium-screen() // mobile + tablet
|
|
135
|
-
display block
|
|
136
|
-
overflow visible
|
|
137
|
-
|
|
138
|
-
&-monocolumn
|
|
139
|
-
height 100%
|
|
106
|
+
height 100%
|
|
140
107
|
|
|
141
108
|
&-2panes
|
|
142
|
-
height auto
|
|
143
109
|
margin 1rem 1rem 1rem 0
|
|
144
110
|
border-radius 1rem
|
|
145
111
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import cx from 'classnames';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
|
+
import { useDrag, useDrop } from 'react-dnd';
|
|
7
|
+
import { getEmptyImage } from 'react-dnd-html5-backend';
|
|
8
|
+
|
|
9
|
+
var GridItem = function GridItem(_ref) {
|
|
10
|
+
var _context$isSelectedIt;
|
|
11
|
+
|
|
12
|
+
var item = _ref.item,
|
|
13
|
+
context = _ref.context,
|
|
14
|
+
renderItem = _ref.renderItem,
|
|
15
|
+
className = _ref.className;
|
|
16
|
+
|
|
17
|
+
var _ref2 = context || {},
|
|
18
|
+
_ref2$selectedItems = _ref2.selectedItems,
|
|
19
|
+
selectedItems = _ref2$selectedItems === void 0 ? [] : _ref2$selectedItems,
|
|
20
|
+
_ref2$itemsInDropProc = _ref2.itemsInDropProcess,
|
|
21
|
+
itemsInDropProcess = _ref2$itemsInDropProc === void 0 ? [] : _ref2$itemsInDropProc,
|
|
22
|
+
_ref2$setItemsInDropP = _ref2.setItemsInDropProcess,
|
|
23
|
+
setItemsInDropProcess = _ref2$setItemsInDropP === void 0 ? function () {} : _ref2$setItemsInDropP,
|
|
24
|
+
dragProps = _ref2.dragProps;
|
|
25
|
+
|
|
26
|
+
var onDrop = dragProps.onDrop,
|
|
27
|
+
canDropProps = dragProps.canDrop,
|
|
28
|
+
canDragProps = dragProps.canDrag,
|
|
29
|
+
dragId = dragProps.dragId;
|
|
30
|
+
var isSelected = context === null || context === void 0 ? void 0 : (_context$isSelectedIt = context.isSelectedItem) === null || _context$isSelectedIt === void 0 ? void 0 : _context$isSelectedIt.call(context, item);
|
|
31
|
+
var isDisabled = itemsInDropProcess.includes(item._id);
|
|
32
|
+
|
|
33
|
+
var _useDrag = useDrag(function () {
|
|
34
|
+
return {
|
|
35
|
+
type: dragId,
|
|
36
|
+
isDragging: function isDragging(monitor) {
|
|
37
|
+
var _monitor$getItem$drag;
|
|
38
|
+
|
|
39
|
+
if (selectedItems.length > 0) {
|
|
40
|
+
return selectedItems.some(function (sel) {
|
|
41
|
+
return sel._id === item._id;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return item._id === ((_monitor$getItem$drag = monitor.getItem().draggedItems) === null || _monitor$getItem$drag === void 0 ? void 0 : _monitor$getItem$drag[0]._id);
|
|
46
|
+
},
|
|
47
|
+
item: {
|
|
48
|
+
draggedItems: selectedItems.length > 0 ? selectedItems : [item]
|
|
49
|
+
},
|
|
50
|
+
canDrag: function canDrag() {
|
|
51
|
+
var _canDragProps;
|
|
52
|
+
|
|
53
|
+
var defaultCanDrag = (_canDragProps = canDragProps === null || canDragProps === void 0 ? void 0 : canDragProps(item)) !== null && _canDragProps !== void 0 ? _canDragProps : true;
|
|
54
|
+
|
|
55
|
+
if (selectedItems.length > 0) {
|
|
56
|
+
return defaultCanDrag && isSelected;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return defaultCanDrag;
|
|
60
|
+
},
|
|
61
|
+
collect: function collect(monitor) {
|
|
62
|
+
return {
|
|
63
|
+
isDragging: monitor.isDragging()
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}, [item, selectedItems]),
|
|
68
|
+
_useDrag2 = _slicedToArray(_useDrag, 3),
|
|
69
|
+
isDragging = _useDrag2[0].isDragging,
|
|
70
|
+
dragRef = _useDrag2[1],
|
|
71
|
+
dragPreview = _useDrag2[2];
|
|
72
|
+
|
|
73
|
+
var _useDrop = useDrop(function () {
|
|
74
|
+
return {
|
|
75
|
+
accept: dragId,
|
|
76
|
+
canDrop: function canDrop() {
|
|
77
|
+
return canDropProps ? canDropProps(item) : true;
|
|
78
|
+
},
|
|
79
|
+
drop: function () {
|
|
80
|
+
var _drop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(draggedItem) {
|
|
81
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
|
+
while (1) {
|
|
83
|
+
switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
setItemsInDropProcess(draggedItem.draggedItems.map(function (dragged) {
|
|
86
|
+
return dragged._id;
|
|
87
|
+
}));
|
|
88
|
+
_context.next = 3;
|
|
89
|
+
return onDrop(draggedItem.draggedItems, item, selectedItems);
|
|
90
|
+
|
|
91
|
+
case 3:
|
|
92
|
+
setItemsInDropProcess([]);
|
|
93
|
+
|
|
94
|
+
case 4:
|
|
95
|
+
case "end":
|
|
96
|
+
return _context.stop();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, _callee);
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
function drop(_x) {
|
|
103
|
+
return _drop.apply(this, arguments);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return drop;
|
|
107
|
+
}(),
|
|
108
|
+
collect: function collect(monitor) {
|
|
109
|
+
return {
|
|
110
|
+
isOver: monitor.isOver()
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}, [item._id, selectedItems]),
|
|
115
|
+
_useDrop2 = _slicedToArray(_useDrop, 2),
|
|
116
|
+
isOver = _useDrop2[0].isOver,
|
|
117
|
+
dropRef = _useDrop2[1];
|
|
118
|
+
|
|
119
|
+
useEffect(function () {
|
|
120
|
+
dragPreview(getEmptyImage(), {
|
|
121
|
+
captureDraggingState: true
|
|
122
|
+
});
|
|
123
|
+
}, [dragPreview]);
|
|
124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
ref: function ref(node) {
|
|
126
|
+
return dragRef(dropRef(node));
|
|
127
|
+
},
|
|
128
|
+
className: cx(className, isDragging ? 'virtualized u-o-50' : 'virtualized'),
|
|
129
|
+
style: {
|
|
130
|
+
opacity: isDisabled ? 0.5 : 1
|
|
131
|
+
}
|
|
132
|
+
}, renderItem(item, {
|
|
133
|
+
isDragging: isDragging,
|
|
134
|
+
isOver: isOver,
|
|
135
|
+
isDisabled: isDisabled
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default GridItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default VirtualizedGridListDnd;
|
|
2
|
+
declare function VirtualizedGridListDnd({ dragProps, context, itemRenderer, children, componentProps, components, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
dragProps: any;
|
|
5
|
+
context: any;
|
|
6
|
+
itemRenderer: any;
|
|
7
|
+
children: any;
|
|
8
|
+
componentProps?: {
|
|
9
|
+
List: {};
|
|
10
|
+
Item: {};
|
|
11
|
+
} | undefined;
|
|
12
|
+
components: any;
|
|
13
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["dragProps", "context", "itemRenderer", "children", "componentProps", "components"],
|
|
6
|
+
_excluded2 = ["context", "children"];
|
|
7
|
+
|
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
+
|
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
+
|
|
12
|
+
import React, { forwardRef, useState, useMemo } from 'react';
|
|
13
|
+
import GridItem from "cozy-ui/transpiled/react/GridList/Virtualized/Dnd/GridItem";
|
|
14
|
+
import VirtualizedGridList from "cozy-ui/transpiled/react/GridList/Virtualized";
|
|
15
|
+
import CustomDragLayer from "cozy-ui/transpiled/react/utils/Dnd/CustomDrag/CustomDragLayer";
|
|
16
|
+
import DnDConfigWrapper from "cozy-ui/transpiled/react/utils/Dnd/DnDConfigWrapper";
|
|
17
|
+
|
|
18
|
+
var VirtualizedGridListDnd = function VirtualizedGridListDnd(_ref) {
|
|
19
|
+
var dragProps = _ref.dragProps,
|
|
20
|
+
context = _ref.context,
|
|
21
|
+
itemRenderer = _ref.itemRenderer,
|
|
22
|
+
children = _ref.children,
|
|
23
|
+
_ref$componentProps = _ref.componentProps,
|
|
24
|
+
componentProps = _ref$componentProps === void 0 ? {
|
|
25
|
+
List: {},
|
|
26
|
+
Item: {}
|
|
27
|
+
} : _ref$componentProps,
|
|
28
|
+
components = _ref.components,
|
|
29
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
|
|
31
|
+
var _useState = useState([]),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
itemsInDropProcess = _useState2[0],
|
|
34
|
+
setItemsInDropProcess = _useState2[1];
|
|
35
|
+
|
|
36
|
+
var _context = useMemo(function () {
|
|
37
|
+
return _objectSpread(_objectSpread({}, context), {}, {
|
|
38
|
+
dragProps: dragProps,
|
|
39
|
+
itemRenderer: itemRenderer,
|
|
40
|
+
itemsInDropProcess: itemsInDropProcess,
|
|
41
|
+
setItemsInDropProcess: setItemsInDropProcess,
|
|
42
|
+
items: props.items
|
|
43
|
+
});
|
|
44
|
+
}, [context, dragProps, itemRenderer, itemsInDropProcess, props.items]);
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CustomDragLayer, {
|
|
47
|
+
dragId: dragProps.dragId
|
|
48
|
+
}), /*#__PURE__*/React.createElement(VirtualizedGridList, _extends({
|
|
49
|
+
components: _objectSpread({
|
|
50
|
+
Scroller: /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
51
|
+
var scrollerProps = _extends({}, _ref2);
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/React.createElement(DnDConfigWrapper, {
|
|
54
|
+
ref: ref
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, scrollerProps, {
|
|
56
|
+
ref: ref
|
|
57
|
+
})));
|
|
58
|
+
}),
|
|
59
|
+
Item: function Item(_ref3) {
|
|
60
|
+
var _context$items;
|
|
61
|
+
|
|
62
|
+
var context = _ref3.context,
|
|
63
|
+
children = _ref3.children,
|
|
64
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
65
|
+
|
|
66
|
+
var item = context === null || context === void 0 ? void 0 : (_context$items = context.items) === null || _context$items === void 0 ? void 0 : _context$items[props['data-index']];
|
|
67
|
+
return /*#__PURE__*/React.createElement(GridItem, _extends({
|
|
68
|
+
item: item,
|
|
69
|
+
context: context,
|
|
70
|
+
renderItem: function renderItem() {
|
|
71
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
72
|
+
}
|
|
73
|
+
}, componentProps.Item));
|
|
74
|
+
}
|
|
75
|
+
}, components),
|
|
76
|
+
context: _context,
|
|
77
|
+
itemRenderer: itemRenderer
|
|
78
|
+
}, props), children));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default VirtualizedGridListDnd;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["items", "itemRenderer", "components"];
|
|
3
|
+
var _excluded = ["items", "itemRenderer", "components", "context"];
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { VirtuosoGrid } from 'react-virtuoso';
|
|
6
6
|
var VirtualizedGridList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -8,11 +8,13 @@ var VirtualizedGridList = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
8
8
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
9
9
|
itemRenderer = _ref.itemRenderer,
|
|
10
10
|
components = _ref.components,
|
|
11
|
+
context = _ref.context,
|
|
11
12
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
12
13
|
|
|
13
14
|
return /*#__PURE__*/React.createElement(VirtuosoGrid, _extends({
|
|
14
15
|
ref: ref,
|
|
15
16
|
components: components,
|
|
17
|
+
context: context,
|
|
16
18
|
style: {
|
|
17
19
|
height: '100%'
|
|
18
20
|
},
|
|
@@ -9,17 +9,14 @@ import PropTypes from 'prop-types';
|
|
|
9
9
|
import React, { createContext, forwardRef, useContext, useMemo } from 'react';
|
|
10
10
|
var styles = {
|
|
11
11
|
"o-layout": "styles__o-layout___3TSz9",
|
|
12
|
-
"o-layout-topbar": "styles__o-layout-topbar___2SHWi",
|
|
13
12
|
"o-layout-2panes": "styles__o-layout-2panes___1CDQw",
|
|
14
13
|
"o-layout-main": "styles__o-layout-main___3mPxz",
|
|
15
|
-
"o-layout-main-
|
|
16
|
-
"o-layout-main-monocolumn--topbar": "styles__o-layout-main-monocolumn--topbar___9_4Xd",
|
|
14
|
+
"o-layout-main-topbar": "styles__o-layout-main-topbar___3FSE_",
|
|
17
15
|
"o-layout-main-2panes": "styles__o-layout-main-2panes___3ickD",
|
|
18
|
-
"o-layout-main-2panes--topbar": "styles__o-layout-main-2panes--topbar___cGi-H",
|
|
19
16
|
"o-layout-content": "styles__o-layout-content___3D5gN",
|
|
20
|
-
"o-layout-content-monocolumn": "styles__o-layout-content-monocolumn___1rpxp",
|
|
21
17
|
"o-layout-content-2panes": "styles__o-layout-content-2panes___2Hotr"
|
|
22
18
|
};
|
|
19
|
+
import { useBreakpoints } from "cozy-ui/transpiled/react/providers/Breakpoints";
|
|
23
20
|
export var LayoutContext = /*#__PURE__*/createContext();
|
|
24
21
|
export var useLayout = function useLayout() {
|
|
25
22
|
var context = useContext(LayoutContext);
|
|
@@ -52,29 +49,32 @@ export var Layout = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
52
49
|
withTopBar = _ref2.withTopBar,
|
|
53
50
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
54
51
|
|
|
55
|
-
var variant = monoColumn ? 'monocolumn' : '2panes';
|
|
56
52
|
return /*#__PURE__*/React.createElement(LayoutProvider, {
|
|
57
53
|
monoColumn: monoColumn,
|
|
58
54
|
withTopBar: withTopBar
|
|
59
55
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
60
56
|
ref: ref,
|
|
61
|
-
className: cx(className, styles['o-layout'],
|
|
57
|
+
className: cx(className, styles['o-layout'], _defineProperty({}, styles['o-layout-main-2panes'], !monoColumn))
|
|
62
58
|
}, props), children));
|
|
63
59
|
});
|
|
64
60
|
Layout.displayName = 'Layout';
|
|
65
61
|
export var Main = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
62
|
+
var _cx2;
|
|
63
|
+
|
|
66
64
|
var className = _ref3.className,
|
|
67
65
|
children = _ref3.children,
|
|
68
66
|
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
69
67
|
|
|
68
|
+
var _useBreakpoints = useBreakpoints(),
|
|
69
|
+
isDesktop = _useBreakpoints.isDesktop;
|
|
70
|
+
|
|
70
71
|
var _useLayout = useLayout(),
|
|
71
72
|
monoColumn = _useLayout.monoColumn,
|
|
72
73
|
withTopBar = _useLayout.withTopBar;
|
|
73
74
|
|
|
74
|
-
var variant = monoColumn ? 'monocolumn' : '2panes';
|
|
75
75
|
return /*#__PURE__*/React.createElement("main", _extends({
|
|
76
76
|
ref: ref,
|
|
77
|
-
className: cx(className, styles['o-layout-main'], styles[
|
|
77
|
+
className: cx(className, styles['o-layout-main'], (_cx2 = {}, _defineProperty(_cx2, styles['o-layout-main-2panes'], !monoColumn), _defineProperty(_cx2, styles["o-layout-main-topbar"], withTopBar && !isDesktop), _cx2))
|
|
78
78
|
}, props), children);
|
|
79
79
|
});
|
|
80
80
|
Main.displayName = 'Main';
|
|
@@ -9,8 +9,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
10
|
|
|
11
11
|
import React, { useState, useMemo } from 'react';
|
|
12
|
-
import CustomDragLayer from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/CustomDrag/CustomDragLayer";
|
|
13
12
|
import virtuosoComponentsDnd from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/virtuosoComponents";
|
|
13
|
+
import CustomDragLayer from "cozy-ui/transpiled/react/utils/Dnd/CustomDrag/CustomDragLayer";
|
|
14
14
|
import VirtualizedTable from "cozy-ui/transpiled/react/Table/Virtualized/index";
|
|
15
15
|
import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
|
|
16
16
|
|
|
@@ -8,9 +8,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
9
|
|
|
10
10
|
import React, { forwardRef } from 'react';
|
|
11
|
-
import DnDConfigWrapper from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/DnDConfigWrapper";
|
|
12
11
|
import TableRowDnD from "cozy-ui/transpiled/react/Table/Virtualized/Dnd/TableRow";
|
|
13
12
|
import TableContainer from "cozy-ui/transpiled/react/TableContainer";
|
|
13
|
+
import DnDConfigWrapper from "cozy-ui/transpiled/react/utils/Dnd/DnDConfigWrapper";
|
|
14
14
|
import virtuosoComponents from "cozy-ui/transpiled/react/Table/Virtualized/virtuosoComponents";
|
|
15
15
|
/**
|
|
16
16
|
Be aware that context is spread to every components but should not be spread to Table components
|