@reltio/components 1.4.840 → 1.4.844
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/components/BasicView/styles.js +14 -9
- package/components/ReltioGridLayout/ReltioGridLayout.d.ts +6 -1
- package/components/ReltioGridLayout/ReltioGridLayout.js +43 -5
- package/components/ReltioGridLayout/helpers.d.ts +3 -0
- package/components/ReltioGridLayout/helpers.js +14 -1
- package/hooks/useCollaboration.js +1 -1
- package/package.json +3 -3
- package/types/index.d.ts +2 -0
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.useStyles = void 0;
|
|
4
15
|
var styles_1 = require("@material-ui/core/styles");
|
|
5
|
-
exports.useStyles = styles_1.makeStyles({
|
|
6
|
-
'basic-view__paper': {
|
|
7
|
-
|
|
8
|
-
flexDirection: 'column',
|
|
9
|
-
boxShadow: '0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2)',
|
|
10
|
-
borderRadius: '3px',
|
|
11
|
-
backgroundColor: '#FFFFFF'
|
|
12
|
-
}
|
|
13
|
-
});
|
|
16
|
+
exports.useStyles = styles_1.makeStyles(function (theme) { return ({
|
|
17
|
+
'basic-view__paper': __assign({ display: 'flex', flexDirection: 'column' }, theme.basicView)
|
|
18
|
+
}); });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare var _default: React.MemoExoticComponent<{
|
|
2
|
-
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable }: {
|
|
2
|
+
({ views, layout, layoutOptions, onLayoutChanged, draggableHandle, LayoutItem, onRemove, onDrop, droppingItem, isDroppable, classes }: {
|
|
3
3
|
views: any;
|
|
4
4
|
layout: any;
|
|
5
5
|
layoutOptions: any;
|
|
@@ -10,6 +10,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
10
10
|
onDrop: any;
|
|
11
11
|
droppingItem: any;
|
|
12
12
|
isDroppable: any;
|
|
13
|
+
classes: any;
|
|
13
14
|
}): JSX.Element;
|
|
14
15
|
defaultProps: {
|
|
15
16
|
layoutOptions: {
|
|
@@ -19,6 +20,7 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
19
20
|
};
|
|
20
21
|
onConfigChanged: any;
|
|
21
22
|
onLayoutChanged: any;
|
|
23
|
+
classes: {};
|
|
22
24
|
};
|
|
23
25
|
propTypes: {
|
|
24
26
|
views: PropTypes.Requireable<any[]>;
|
|
@@ -32,6 +34,9 @@ declare var _default: React.MemoExoticComponent<{
|
|
|
32
34
|
draggableHandle: PropTypes.Requireable<string>;
|
|
33
35
|
isDroppable: PropTypes.Requireable<boolean>;
|
|
34
36
|
droppingItem: PropTypes.Requireable<object>;
|
|
37
|
+
classes: PropTypes.Requireable<PropTypes.InferProps<{
|
|
38
|
+
item: PropTypes.Requireable<string>;
|
|
39
|
+
}>>;
|
|
35
40
|
};
|
|
36
41
|
}>;
|
|
37
42
|
export default _default;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
14
|
if (k2 === undefined) k2 = k;
|
|
4
15
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -32,14 +43,14 @@ var helpers_1 = require("./helpers");
|
|
|
32
43
|
var styles_1 = require("./styles");
|
|
33
44
|
var ReltioGridLayout = function (_a) {
|
|
34
45
|
var _b;
|
|
35
|
-
var views = _a.views, layout = _a.layout, layoutOptions = _a.layoutOptions, onLayoutChanged = _a.onLayoutChanged, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable;
|
|
46
|
+
var views = _a.views, layout = _a.layout, layoutOptions = _a.layoutOptions, onLayoutChanged = _a.onLayoutChanged, draggableHandle = _a.draggableHandle, LayoutItem = _a.LayoutItem, onRemove = _a.onRemove, onDrop = _a.onDrop, droppingItem = _a.droppingItem, isDroppable = _a.isDroppable, classes = _a.classes;
|
|
36
47
|
var ref = react_1.useRef();
|
|
37
48
|
var styles = styles_1.useStyles();
|
|
38
49
|
var _c = react_1.useState(null), fullscreenItemId = _c[0], setFullscreenItemId = _c[1];
|
|
39
50
|
var _d = react_1.useState(0), width = _d[0], setWidth = _d[1];
|
|
40
51
|
var cols = layoutOptions.cols, rowHeight = layoutOptions.rowHeight, margin = layoutOptions.margin;
|
|
41
52
|
var processedLayout = react_1.useMemo(function () { return helpers_1.reltioLayoutToReactGridLayout(layout); }, [layout]);
|
|
42
|
-
var onReltioLayoutChanged = ramda_1.pipe(helpers_1.reactGridLayoutToReltioLayout, onLayoutChanged);
|
|
53
|
+
var onReltioLayoutChanged = ramda_1.pipe(helpers_1.reactGridLayoutToReltioLayout, helpers_1.copyPropsFromPreviousLayout(['autosizing'], layout), onLayoutChanged);
|
|
43
54
|
var handleDrop = function (layout, layoutItem, e) {
|
|
44
55
|
if (onDrop) {
|
|
45
56
|
onDrop(helpers_1.reactGridLayoutToReltioLayout(layout), helpers_1.reactGridLayoutItemToReltioLayoutItem(layoutItem), e);
|
|
@@ -47,11 +58,34 @@ var ReltioGridLayout = function (_a) {
|
|
|
47
58
|
};
|
|
48
59
|
var onToggleFullscreen = react_1.useCallback(function (id) { return setFullscreenItemId(function (prevId) { return (prevId ? null : id); }); }, []);
|
|
49
60
|
var isFullscreenEnabled = fullscreenItemId !== null;
|
|
61
|
+
var onItemHeightResize = react_1.useCallback(function (height, layoutId) {
|
|
62
|
+
var isLayoutChanged = false;
|
|
63
|
+
var newLayout = layout.map(function (layoutItem) {
|
|
64
|
+
if (layoutItem.id === layoutId && height) {
|
|
65
|
+
var newHeight = helpers_1.calcHeight(height, layoutOptions);
|
|
66
|
+
if (layoutItem.height !== newHeight) {
|
|
67
|
+
isLayoutChanged = true;
|
|
68
|
+
return __assign(__assign({}, layoutItem), { minHeight: newHeight, maxHeight: newHeight, height: newHeight });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return layoutItem;
|
|
72
|
+
});
|
|
73
|
+
if (isLayoutChanged) {
|
|
74
|
+
onLayoutChanged(newLayout);
|
|
75
|
+
}
|
|
76
|
+
}, [layout, layoutOptions, onLayoutChanged]);
|
|
77
|
+
var getAutosizeComponent = function (layoutItemId) {
|
|
78
|
+
return (react_1.default.createElement(react_resize_detector_1.default, { handleHeight: true, onResize: function (width, height) {
|
|
79
|
+
onItemHeightResize(height, layoutItemId);
|
|
80
|
+
} }));
|
|
81
|
+
};
|
|
50
82
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
51
83
|
react_1.default.createElement(react_resize_detector_1.default, { refreshMode: "debounce", refreshRate: 50, handleWidth: true, onResize: function (width) { return setWidth(width); } }),
|
|
52
84
|
react_1.default.createElement(react_grid_layout_1.default, { innerRef: ref, layout: processedLayout, cols: cols, draggableHandle: draggableHandle, autoSize: true, rowHeight: rowHeight, width: width, margin: margin, onLayoutChange: onReltioLayoutChanged, isResizable: !isFullscreenEnabled, isDraggable: !isFullscreenEnabled, className: classnames_1.default(styles.gridLayout, (_b = {}, _b[styles.gridFullscreen] = isFullscreenEnabled, _b)), onDrop: handleDrop, droppingItem: droppingItem, isDroppable: isDroppable }, processedLayout.map(function (layoutItem) {
|
|
53
85
|
var isItemFullscreen = fullscreenItemId === layoutItem.i;
|
|
54
|
-
|
|
86
|
+
var isAutosize = (helpers_1.getReltioLayoutItemById(layout, layoutItem.i) || {}).autosizing;
|
|
87
|
+
var autosizeComponent = isAutosize ? { AutosizeComponent: getAutosizeComponent(layoutItem.i) } : {};
|
|
88
|
+
return (react_1.default.createElement(LayoutItem, __assign({ key: layoutItem.i, layoutItemConfig: layoutItem, views: views, onToggleFullscreen: onToggleFullscreen, onRemove: onRemove, className: classnames_1.default({ fullscreen: isItemFullscreen }, classes.item), isFullscreen: isItemFullscreen }, autosizeComponent)));
|
|
55
89
|
}))));
|
|
56
90
|
};
|
|
57
91
|
ReltioGridLayout.defaultProps = {
|
|
@@ -61,7 +95,8 @@ ReltioGridLayout.defaultProps = {
|
|
|
61
95
|
margin: [15, 15]
|
|
62
96
|
},
|
|
63
97
|
onConfigChanged: ramda_1.identity,
|
|
64
|
-
onLayoutChanged: ramda_1.identity
|
|
98
|
+
onLayoutChanged: ramda_1.identity,
|
|
99
|
+
classes: {}
|
|
65
100
|
};
|
|
66
101
|
ReltioGridLayout.propTypes = {
|
|
67
102
|
views: prop_types_1.default.array,
|
|
@@ -74,6 +109,9 @@ ReltioGridLayout.propTypes = {
|
|
|
74
109
|
LayoutItem: prop_types_1.default.elementType,
|
|
75
110
|
draggableHandle: prop_types_1.default.string,
|
|
76
111
|
isDroppable: prop_types_1.default.bool,
|
|
77
|
-
droppingItem: prop_types_1.default.object
|
|
112
|
+
droppingItem: prop_types_1.default.object,
|
|
113
|
+
classes: prop_types_1.default.shape({
|
|
114
|
+
item: prop_types_1.default.string
|
|
115
|
+
})
|
|
78
116
|
};
|
|
79
117
|
exports.default = react_1.memo(ReltioGridLayout);
|
|
@@ -47,3 +47,6 @@ export function reactGridLayoutItemToReltioLayoutItem({ x, y, w, h, maxW, minW,
|
|
|
47
47
|
};
|
|
48
48
|
export function reltioLayoutToReactGridLayout(layout: any): any;
|
|
49
49
|
export function reactGridLayoutToReltioLayout(layout: any): any;
|
|
50
|
+
export const getReltioLayoutItemById: any;
|
|
51
|
+
export const copyPropsFromPreviousLayout: any;
|
|
52
|
+
export function calcHeight(height: any, options: any): number;
|
|
@@ -11,7 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.reactGridLayoutToReltioLayout = exports.reltioLayoutToReactGridLayout = exports.reactGridLayoutItemToReltioLayoutItem = exports.reltioLayoutItemToReactGridLayoutItem = exports.getReltioViewId = void 0;
|
|
14
|
+
exports.calcHeight = exports.copyPropsFromPreviousLayout = exports.getReltioLayoutItemById = exports.reactGridLayoutToReltioLayout = exports.reltioLayoutToReactGridLayout = exports.reactGridLayoutItemToReltioLayoutItem = exports.reltioLayoutItemToReactGridLayoutItem = exports.getReltioViewId = void 0;
|
|
15
|
+
var ramda_1 = require("ramda");
|
|
15
16
|
var getReltioViewId = function (id) { return id.split(/\d+_/)[1]; };
|
|
16
17
|
exports.getReltioViewId = getReltioViewId;
|
|
17
18
|
var reltioLayoutItemToReactGridLayoutItem = function (_a) {
|
|
@@ -50,3 +51,15 @@ var reltioLayoutToReactGridLayout = function (layout) { return (layout || []).ma
|
|
|
50
51
|
exports.reltioLayoutToReactGridLayout = reltioLayoutToReactGridLayout;
|
|
51
52
|
var reactGridLayoutToReltioLayout = function (layout) { return (layout || []).map(exports.reactGridLayoutItemToReltioLayoutItem); };
|
|
52
53
|
exports.reactGridLayoutToReltioLayout = reactGridLayoutToReltioLayout;
|
|
54
|
+
exports.getReltioLayoutItemById = ramda_1.curry(function (layout, id) { return (layout || []).find(ramda_1.propEq('id', id)); });
|
|
55
|
+
var updateExtraPropsInLayoutItem = ramda_1.curry(function (props, from, to) { return ramda_1.mergeAll([to, ramda_1.pick(props, from)]); });
|
|
56
|
+
exports.copyPropsFromPreviousLayout = ramda_1.curry(function (props, oldReltioLayout, reltioLayout) {
|
|
57
|
+
return (reltioLayout || []).map(function (layoutItem) {
|
|
58
|
+
return ramda_1.pipe(ramda_1.prop('id'), exports.getReltioLayoutItemById(oldReltioLayout), ramda_1.defaultTo({}), updateExtraPropsInLayoutItem(props, ramda_1.__, layoutItem))(layoutItem);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
var calcHeight = function (height, options) {
|
|
62
|
+
var margin = options.margin, rowHeight = options.rowHeight;
|
|
63
|
+
return Math.ceil((height + margin[1]) / (rowHeight + margin[1]));
|
|
64
|
+
};
|
|
65
|
+
exports.calcHeight = calcHeight;
|
|
@@ -40,7 +40,7 @@ var useCollaboration = function (objectIds, objectTypes) {
|
|
|
40
40
|
var _e = react_1.useState(false), sending = _e[0], setSending = _e[1];
|
|
41
41
|
var _f = react_1.useState(false), loading = _f[0], setLoading = _f[1];
|
|
42
42
|
react_1.useEffect(function () {
|
|
43
|
-
if (isCollaborationEnabled && entity) {
|
|
43
|
+
if (isCollaborationEnabled && entity && !mdm_sdk_1.isTempUri(entity.uri)) {
|
|
44
44
|
var onError = function (e) {
|
|
45
45
|
console.warn('Collaboration error', e);
|
|
46
46
|
setCommentsMap(null);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reltio/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.844",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE FILE",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@date-io/moment": "^1.3.5",
|
|
8
8
|
"@react-google-maps/api": "^2.7.0",
|
|
9
|
-
"@reltio/mdm-module": "^1.4.
|
|
10
|
-
"@reltio/mdm-sdk": "^1.4.
|
|
9
|
+
"@reltio/mdm-module": "^1.4.844",
|
|
10
|
+
"@reltio/mdm-sdk": "^1.4.844",
|
|
11
11
|
"classnames": "^2.2.5",
|
|
12
12
|
"frontend-collective-react-dnd-scrollzone": "^1.0.2",
|
|
13
13
|
"nanoid": "^2.0.0",
|