@selfcommunity/react-ui 0.8.0-alpha.28 → 0.8.0-alpha.29
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/lib/cjs/components/NavigationMenuIconButton/NavigationMenuDrawer.js +8 -3
- package/lib/cjs/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/cjs/constants/PubSub.d.ts +3 -1
- package/lib/cjs/constants/PubSub.js +2 -0
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuDrawer.js +8 -3
- package/lib/esm/components/NavigationMenuIconButton/NavigationMenuIconButton.js +1 -1
- package/lib/esm/constants/PubSub.d.ts +3 -1
- package/lib/esm/constants/PubSub.js +2 -0
- package/lib/umd/react-ui.js +1 -1
- package/package.json +2 -2
|
@@ -47,8 +47,13 @@ function NavigationMenuDrawer(inProps) {
|
|
|
47
47
|
}, [open]);
|
|
48
48
|
// Subscriber for pubsub callback
|
|
49
49
|
const subscriber = (0, react_1.useCallback)((msg, data) => {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.TOGGLE_DRAWER}`) {
|
|
51
|
+
setOpen(!open);
|
|
52
|
+
}
|
|
53
|
+
else if (msg === `${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.SET_DRAWER}`) {
|
|
54
|
+
setOpen(data.open);
|
|
55
|
+
}
|
|
56
|
+
}, [open]);
|
|
52
57
|
/**
|
|
53
58
|
* When a ws notification arrives, update data
|
|
54
59
|
*/
|
|
@@ -57,7 +62,7 @@ function NavigationMenuDrawer(inProps) {
|
|
|
57
62
|
return () => {
|
|
58
63
|
pubsub_js_1.default.unsubscribe(refreshSubscription.current);
|
|
59
64
|
};
|
|
60
|
-
}, []);
|
|
65
|
+
}, [subscriber]);
|
|
61
66
|
return ((0, jsx_runtime_1.jsxs)(Root, Object.assign({ anchor: "left", className: (0, classnames_1.default)(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: (0, jsx_runtime_1.jsx)(material_1.Icon, { children: "close" }) }))] })), (0, jsx_runtime_1.jsx)(material_1.Divider, {})] })), (0, jsx_runtime_1.jsx)(ScrollContainer_1.default, Object.assign({}, ScrollContainerProps, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
62
67
|
}
|
|
63
68
|
exports.default = NavigationMenuDrawer;
|
|
@@ -55,7 +55,7 @@ function NavigationMenuIconButton(inProps) {
|
|
|
55
55
|
const scUserContext = (0, react_core_1.useSCUser)();
|
|
56
56
|
// HANDLERS
|
|
57
57
|
const handleOpen = (0, react_1.useCallback)(() => {
|
|
58
|
-
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.
|
|
58
|
+
pubsub_js_1.default.publish(`${PubSub_1.SCTopicType.LAYOUT}.${PubSub_1.SCLayoutEventType.TOGGLE_DRAWER}`);
|
|
59
59
|
}, []);
|
|
60
60
|
if (!preferences[react_core_1.SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value && !((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
61
61
|
return null;
|
|
@@ -31,7 +31,9 @@ export interface SCEventMembersEventType {
|
|
|
31
31
|
* Layout event types
|
|
32
32
|
*/
|
|
33
33
|
export declare enum SCLayoutEventType {
|
|
34
|
-
DRAWER = "drawer"
|
|
34
|
+
DRAWER = "drawer",
|
|
35
|
+
SET_DRAWER = "drawer.set",
|
|
36
|
+
TOGGLE_DRAWER = "drawer.toggle"
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Layout event types
|
|
@@ -29,4 +29,6 @@ var SCGroupEventType;
|
|
|
29
29
|
var SCLayoutEventType;
|
|
30
30
|
(function (SCLayoutEventType) {
|
|
31
31
|
SCLayoutEventType["DRAWER"] = "drawer";
|
|
32
|
+
SCLayoutEventType["SET_DRAWER"] = "drawer.set";
|
|
33
|
+
SCLayoutEventType["TOGGLE_DRAWER"] = "drawer.toggle";
|
|
32
34
|
})(SCLayoutEventType = exports.SCLayoutEventType || (exports.SCLayoutEventType = {}));
|
|
@@ -45,8 +45,13 @@ export default function NavigationMenuDrawer(inProps) {
|
|
|
45
45
|
}, [open]);
|
|
46
46
|
// Subscriber for pubsub callback
|
|
47
47
|
const subscriber = useCallback((msg, data) => {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (msg === `${SCTopicType.LAYOUT}.${SCLayoutEventType.TOGGLE_DRAWER}`) {
|
|
49
|
+
setOpen(!open);
|
|
50
|
+
}
|
|
51
|
+
else if (msg === `${SCTopicType.LAYOUT}.${SCLayoutEventType.SET_DRAWER}`) {
|
|
52
|
+
setOpen(data.open);
|
|
53
|
+
}
|
|
54
|
+
}, [open]);
|
|
50
55
|
/**
|
|
51
56
|
* When a ws notification arrives, update data
|
|
52
57
|
*/
|
|
@@ -55,6 +60,6 @@ export default function NavigationMenuDrawer(inProps) {
|
|
|
55
60
|
return () => {
|
|
56
61
|
PubSub.unsubscribe(refreshSubscription.current);
|
|
57
62
|
};
|
|
58
|
-
}, []);
|
|
63
|
+
}, [subscriber]);
|
|
59
64
|
return (_jsxs(Root, Object.assign({ anchor: "left", className: classNames(classes.root, className), open: open, onClose: onClose }, rest, { children: [showDrawerHeader && (_jsxs(_Fragment, { children: [_jsxs(Box, Object.assign({ className: classes.drawerHeader }, { children: [drawerHeaderContent, _jsx(IconButton, Object.assign({ className: classes.drawerHeaderAction, onClick: onClose }, { children: _jsx(Icon, { children: "close" }) }))] })), _jsx(Divider, {})] })), _jsx(ScrollContainer, Object.assign({}, ScrollContainerProps, { children: _jsx(List, Object.assign({ className: classes.drawerContent, onClick: onClose }, { children: drawerContent })) }))] })));
|
|
60
65
|
}
|
|
@@ -53,7 +53,7 @@ export default function NavigationMenuIconButton(inProps) {
|
|
|
53
53
|
const scUserContext = useSCUser();
|
|
54
54
|
// HANDLERS
|
|
55
55
|
const handleOpen = useCallback(() => {
|
|
56
|
-
PubSub.publish(`${SCTopicType.LAYOUT}.${SCLayoutEventType.
|
|
56
|
+
PubSub.publish(`${SCTopicType.LAYOUT}.${SCLayoutEventType.TOGGLE_DRAWER}`);
|
|
57
57
|
}, []);
|
|
58
58
|
if (!preferences[SCPreferences.CONFIGURATIONS_CONTENT_AVAILABILITY].value && !((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
59
59
|
return null;
|
|
@@ -31,7 +31,9 @@ export interface SCEventMembersEventType {
|
|
|
31
31
|
* Layout event types
|
|
32
32
|
*/
|
|
33
33
|
export declare enum SCLayoutEventType {
|
|
34
|
-
DRAWER = "drawer"
|
|
34
|
+
DRAWER = "drawer",
|
|
35
|
+
SET_DRAWER = "drawer.set",
|
|
36
|
+
TOGGLE_DRAWER = "drawer.toggle"
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Layout event types
|
|
@@ -26,4 +26,6 @@ export var SCGroupEventType;
|
|
|
26
26
|
export var SCLayoutEventType;
|
|
27
27
|
(function (SCLayoutEventType) {
|
|
28
28
|
SCLayoutEventType["DRAWER"] = "drawer";
|
|
29
|
+
SCLayoutEventType["SET_DRAWER"] = "drawer.set";
|
|
30
|
+
SCLayoutEventType["TOGGLE_DRAWER"] = "drawer.toggle";
|
|
29
31
|
})(SCLayoutEventType || (SCLayoutEventType = {}));
|