@equinor/echo-framework 0.8.1 → 0.8.2
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/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.d.ts +1 -3
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.d.ts +2 -1
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.d.ts +0 -3
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.d.ts +0 -4
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.d.ts +0 -2
- package/dist/components/contextualAppLinks/externalLinkButtons/index.d.ts +0 -1
- package/dist/components/externalLinkButton/externalLinkButton.d.ts +7 -16
- package/dist/components/panel/corePanelLeft.d.ts +4 -1
- package/dist/components/panel/corePanelRight.d.ts +4 -1
- package/dist/components/realTimeData/hooks/useSignalR.d.ts +2 -3
- package/dist/coreApplication/EchoBarComponent.d.ts +6 -0
- package/dist/coreApplication/EchoContent.d.ts +1 -0
- package/dist/coreApplication/index.d.ts +1 -0
- package/dist/hooks/hookLibrary.d.ts +8 -2
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useScreenOrientation.d.ts +1 -0
- package/dist/hooks/useSemi.d.ts +7 -11
- package/dist/hooks/useTagDetails.d.ts +3 -10
- package/dist/index.d.ts +7 -12
- package/dist/services/api/api-manager.d.ts +1 -1
- package/dist/services/api/index.d.ts +0 -1
- package/dist/src/components/containers/layout.module.css.js +3 -1
- package/dist/src/components/containers/layouts.js +5 -7
- package/dist/src/components/contextualAppLinks/externalAppsMenu.js +4 -4
- package/dist/src/components/contextualAppLinks/externalLinkButtons/allExternalLinks.js +11 -66
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +5 -60
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +11 -43
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSafeX.js +1 -1
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +11 -58
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.js +5 -16
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToStid.js +1 -1
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.js +16 -67
- package/dist/src/components/externalLinkButton/externalLinkButton.js +34 -89
- package/dist/src/components/externalLinkButton/externalLinkButton.module.css.js +2 -5
- package/dist/src/components/footer/footer.module.css.js +1 -1
- package/dist/src/components/panel/corePanelLeft.js +5 -2
- package/dist/src/components/panel/corePanelLeft.module.css.js +1 -1
- package/dist/src/components/panel/corePanelRight.js +5 -2
- package/dist/src/components/panel/corePanelRight.module.css.js +1 -1
- package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +2 -3
- package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +7 -32
- package/dist/src/components/realTimeData/hooks/useSignalR.js +2 -4
- package/dist/src/coreApplication/EchoBarComponent.js +190 -0
- package/dist/src/coreApplication/EchoContent.js +36 -2
- package/dist/src/coreApplication/EchoContent.module.css.js +21 -0
- package/dist/src/globalStyles.css.js +1 -1
- package/dist/src/hooks/hookLibrary.js +9 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/useScreenOrientation.js +50 -0
- package/dist/src/hooks/useSemi.js +14 -40
- package/dist/src/hooks/useTagDetails.js +45 -116
- package/dist/src/icons/common/Evision.svg.js +2 -3
- package/dist/src/icons/common/Fusion.svg.js +25 -30
- package/dist/src/icons/common/McApp.svg.js +6 -10
- package/dist/src/icons/common/ProCoSysIcon.svg.js +2 -3
- package/dist/src/icons/common/SapLogo.svg.js +4 -5
- package/dist/src/icons/common/SemiIcon.svg.js +11 -11
- package/dist/src/icons/common/Stid.svg.js +2 -3
- package/dist/src/icons/common/TR2000.svg.js +6 -8
- package/dist/src/icons/common/Yammer.svg.js +1 -2
- package/dist/src/index.js +13 -15
- package/dist/src/services/api/api-manager.js +2 -2
- package/dist/src/services/api/api-realtimedata.js +1 -3
- package/dist/src/types/pingableSources.js +0 -1
- package/dist/src/utils/plantInfo.js +0 -1
- package/dist/types/hookLibrary.d.ts +4 -0
- package/dist/types/pingableSources.d.ts +1 -2
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/plantInfo.d.ts +0 -6
- package/package.json +2 -2
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.d.ts +0 -47
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.test.d.ts +0 -1
- package/dist/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.d.ts +0 -14
- package/dist/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.d.ts +0 -18
- package/dist/services/api/api-tag-details.d.ts +0 -18
- package/dist/services/api/api-tag-details.test.d.ts +0 -1
- package/dist/services/api/api-tags.d.ts +0 -17
- package/dist/services/api/api-tags.test.d.ts +0 -1
- package/dist/services/echopediaAnalyticsModule/echopediaAnalyticsModule.d.ts +0 -1
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +0 -169
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +0 -93
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.js +0 -44
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.module.css.js +0 -15
- package/dist/src/icons/common/CommissionApp-icon.png.js +0 -7
- package/dist/src/icons/common/Notification.svg.js +0 -82
- package/dist/src/icons/common/WorkOrder.svg.js +0 -72
- package/dist/src/icons/common/satos-logo.png.js +0 -7
- package/dist/src/services/api/api-tag-details.js +0 -66
- package/dist/src/services/api/api-tags.js +0 -29
- package/dist/src/services/echopediaAnalyticsModule/echopediaAnalyticsModule.js +0 -10
- package/dist/src/utils/navigationUtils.js +0 -28
- package/dist/types/api-proCoSysTagResponse.d.ts +0 -8
- package/dist/utils/navigationUtils.d.ts +0 -7
- package/dist/utils/navigationUtils.test.d.ts +0 -1
- package/dist/utils/plantInfo.test.d.ts +0 -1
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
|
|
7
7
|
var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
8
8
|
|
|
9
|
-
var css_248z = ".footer-module_echoFooter__6xy2c{background:#fff;bottom:0;display:flex;left:0;position:fixed}@media screen and (min-width:360px){.footer-module_echoFooter__6xy2c{height:33px}}@media screen and (min-width:640px){.footer-module_echoFooter__6xy2c{height:56px;width:100%}}p.footer-module_footerDisclaimer__sJJ5f{font-size:10px;width:100%}.footer-module_footerLogo__ttZmv{display:none;float:right;margin:0 0 12px;max-height:2.5rem;padding:12px 16px;width:74px}.footer-module_tosFooter__9mGDz{background:#fff;bottom:0;height:33px;left:0;position:fixed;width:100%}@media screen and (min-width:640px){p.footer-module_footerDisclaimer__sJJ5f{line-height:32px;margin:0;padding:12px 16px}.footer-module_footerLogo__ttZmv{display:block}.footer-module_tosFooter__9mGDz{height:56px}}";
|
|
9
|
+
var css_248z = ".footer-module_echoFooter__6xy2c{background:#fff;bottom:0;display:flex;left:0;position:fixed}@media screen and (max-width:767px) and (orientation:portrait){.footer-module_echoFooter__6xy2c{bottom:48px}}@media screen and (max-width:927px) and (orientation:landscape){.footer-module_echoFooter__6xy2c{left:48px}}@media screen and (min-width:360px){.footer-module_echoFooter__6xy2c{height:33px}}@media screen and (min-width:640px){.footer-module_echoFooter__6xy2c{height:56px;width:100%}}p.footer-module_footerDisclaimer__sJJ5f{font-size:10px;width:100%}.footer-module_footerLogo__ttZmv{display:none;float:right;margin:0 0 12px;max-height:2.5rem;padding:12px 16px;width:74px}.footer-module_tosFooter__9mGDz{background:#fff;bottom:0;height:33px;left:0;position:fixed;width:100%}@media screen and (min-width:640px){p.footer-module_footerDisclaimer__sJJ5f{line-height:32px;margin:0;padding:12px 16px}.footer-module_footerLogo__ttZmv{display:block}.footer-module_tosFooter__9mGDz{height:56px}}";
|
|
10
10
|
var style = {
|
|
11
11
|
"echoFooter": "footer-module_echoFooter__6xy2c",
|
|
12
12
|
"footerDisclaimer": "footer-module_footerDisclaimer__sJJ5f",
|
|
@@ -40,7 +40,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
40
40
|
|
|
41
41
|
edsIons.edsIcons();
|
|
42
42
|
|
|
43
|
-
var CorePanelLeft = function CorePanelLeft() {
|
|
43
|
+
var CorePanelLeft = function CorePanelLeft(_ref) {
|
|
44
|
+
var isToggleButtonVisible = _ref.isToggleButtonVisible;
|
|
45
|
+
|
|
44
46
|
var _a;
|
|
45
47
|
|
|
46
48
|
var _EchoCore$usePanels = EchoCore.usePanels(),
|
|
@@ -72,7 +74,8 @@ var CorePanelLeft = function CorePanelLeft() {
|
|
|
72
74
|
style: panelUI.panelButton
|
|
73
75
|
}, panels.map(function (panel, i) {
|
|
74
76
|
var Icon = panel.icon;
|
|
75
|
-
|
|
77
|
+
var showPanel = isToggleButtonVisible || panel.key !== EchoCore.ECHO_CORE_SEARCH;
|
|
78
|
+
return showPanel && /*#__PURE__*/React__default["default"].createElement(panelButton["default"], {
|
|
76
79
|
key: i,
|
|
77
80
|
onClick: function onClick(e) {
|
|
78
81
|
e.stopPropagation();
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
|
|
7
7
|
var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
8
8
|
|
|
9
|
-
var css_248z = ".corePanelLeft-module_wrapper__d2Omx{height:100%;left:-550px;max-width:550px;position:fixed;top:0;transition:
|
|
9
|
+
var css_248z = ".corePanelLeft-module_wrapper__d2Omx{height:100%;left:-550px;max-width:550px;position:fixed;top:0;transition:all .4s ease-in-out;width:550px;z-index:2}@media screen and (max-width:550px){.corePanelLeft-module_wrapperClosed__Zd1CL{left:-75vw;max-width:75vw;width:75vw}.corePanelLeft-module_active__-A3TW{width:100%}}.corePanelLeft-module_active__-A3TW{left:0;z-index:var(--echo-framework-z-level-panel)}@media screen and (max-width:927px) and (orientation:landscape){.corePanelLeft-module_active__-A3TW{left:48px}}.corePanelLeft-module_drawer__Wdb3G{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:hidden;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelLeft-module_active__-A3TW .corePanelLeft-module_drawer__Wdb3G{opacity:1}.corePanelLeft-module_buttonContainer__bs-Uu{display:flex;flex-direction:column;position:absolute;right:-70px;top:0}@media screen and (max-width:927px) and (orientation:landscape){.corePanelLeft-module_buttonContainer__bs-Uu{right:-118px}}.corePanelLeft-module_button__SqyKk{margin-left:var(--medium);margin-top:var(--small)}";
|
|
10
10
|
var style = {
|
|
11
11
|
"wrapper": "corePanelLeft-module_wrapper__d2Omx",
|
|
12
12
|
"wrapperClosed": "corePanelLeft-module_wrapperClosed__Zd1CL",
|
|
@@ -42,7 +42,9 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
42
42
|
|
|
43
43
|
edsIons.edsIcons();
|
|
44
44
|
|
|
45
|
-
var CorePanelRight = function CorePanelRight() {
|
|
45
|
+
var CorePanelRight = function CorePanelRight(_ref) {
|
|
46
|
+
var isToggleButtonVisible = _ref.isToggleButtonVisible;
|
|
47
|
+
|
|
46
48
|
var _a;
|
|
47
49
|
|
|
48
50
|
var _EchoCore$usePanels = EchoCore.usePanels('right'),
|
|
@@ -74,7 +76,8 @@ var CorePanelRight = function CorePanelRight() {
|
|
|
74
76
|
style: panelUI.panelButton
|
|
75
77
|
}, panels.map(function (panel, i) {
|
|
76
78
|
var PanelIcon = panel.icon;
|
|
77
|
-
|
|
79
|
+
var showPanel = isToggleButtonVisible || panel.key !== EchoCore.ECHO_CORE_MAIN;
|
|
80
|
+
return showPanel && /*#__PURE__*/React__default["default"].createElement(panelButton["default"], {
|
|
78
81
|
key: i,
|
|
79
82
|
label: panel.label,
|
|
80
83
|
variant: panel.key === EchoCore.ECHO_CORE_MAIN ? panelButton.Variants.NotificationButton : panelButton.Variants.OpenCloseButton,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
|
|
7
7
|
var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
8
8
|
|
|
9
|
-
var css_248z = ".corePanelRight-module_wrapper__YN3Zr{height:100%;max-width:
|
|
9
|
+
var css_248z = ".corePanelRight-module_wrapper__YN3Zr{height:100%;max-width:550px;position:fixed;right:-352px;top:0;transition:all .4s ease-in-out;width:352px;z-index:2}@media screen and (max-width:550px){.corePanelRight-module_active__RIMQt{width:100%}}.corePanelRight-module_active__RIMQt{right:0;z-index:var(--echo-framework-z-level-panel)}@media screen and (max-width:927px) and (orientation:landscape){.corePanelRight-module_wrapper__YN3Zr{left:-352px}.corePanelRight-module_active__RIMQt{left:48px;z-index:var(--echo-framework-z-level-panel)}}.corePanelRight-module_drawer__1-ucH{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:auto;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelRight-module_active__RIMQt .corePanelRight-module_drawer__1-ucH{opacity:1}.corePanelRight-module_buttonContainer__62imJ{display:flex;flex-direction:column;left:-90px;position:absolute;top:0}.corePanelRight-module_button__WBdfZ{margin-left:var(--medium);margin-top:var(--small)}";
|
|
10
10
|
var style = {
|
|
11
11
|
"wrapper": "corePanelRight-module_wrapper__YN3Zr",
|
|
12
12
|
"active": "corePanelRight-module_active__RIMQt",
|
package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
|
|
7
7
|
var styleInject_es = require('../../../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
8
8
|
|
|
9
|
-
var css_248z = ".IMSConnector-module_wrapper__CvKvm{align-items:center;display:grid;gap:1rem;grid-row:1fr;grid-template-columns:1fr 1fr;justify-items:center;margin-top:1rem}.IMSConnector-module_experimentalWarning__7Vv3z{grid-template-columns:auto 1fr;margin-top:0}.IMSConnector-module_message__w8j1M{margin-top:1rem;width:100%}
|
|
9
|
+
var css_248z = ".IMSConnector-module_wrapper__CvKvm{align-items:center;display:grid;gap:1rem;grid-row:1fr;grid-template-columns:1fr 1fr;justify-items:center;margin-top:1rem}.IMSConnector-module_experimentalWarning__7Vv3z{grid-template-columns:auto 1fr;margin-top:0}.IMSConnector-module_message__w8j1M{margin-top:1rem;width:100%}";
|
|
10
10
|
var style = {
|
|
11
11
|
"wrapper": "IMSConnector-module_wrapper__CvKvm",
|
|
12
12
|
"experimentalWarning": "IMSConnector-module_experimentalWarning__7Vv3z IMSConnector-module_wrapper__CvKvm",
|
|
13
|
-
"message": "IMSConnector-module_message__w8j1M"
|
|
14
|
-
"requestAccess": "IMSConnector-module_requestAccess__YDOu9"
|
|
13
|
+
"message": "IMSConnector-module_message__w8j1M"
|
|
15
14
|
};
|
|
16
15
|
styleInject_es["default"](css_248z);
|
|
17
16
|
exports["default"] = style;
|
package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js
CHANGED
|
@@ -51,8 +51,7 @@ function RealTimeConnectorForIMSTag(_ref) {
|
|
|
51
51
|
present = _useRealTimeHub$useRe.present,
|
|
52
52
|
status = _useRealTimeHub$useRe.status,
|
|
53
53
|
message = _useRealTimeHub$useRe.message,
|
|
54
|
-
loading = _useRealTimeHub$useRe.loading
|
|
55
|
-
statusCode = _useRealTimeHub$useRe.statusCode;
|
|
54
|
+
loading = _useRealTimeHub$useRe.loading;
|
|
56
55
|
|
|
57
56
|
var _React$useMemo = React.useMemo(function () {
|
|
58
57
|
if (present && metadata) {
|
|
@@ -67,8 +66,6 @@ function RealTimeConnectorForIMSTag(_ref) {
|
|
|
67
66
|
|
|
68
67
|
if (status === 'error') {
|
|
69
68
|
return /*#__PURE__*/React__default["default"].createElement(ErrorMessage, {
|
|
70
|
-
instCode: instCode,
|
|
71
|
-
statusCode: statusCode,
|
|
72
69
|
message: message
|
|
73
70
|
});
|
|
74
71
|
}
|
|
@@ -93,43 +90,21 @@ function SensorValueProps(_ref2) {
|
|
|
93
90
|
var value = _ref2.value,
|
|
94
91
|
unit = _ref2.unit;
|
|
95
92
|
|
|
96
|
-
if (value
|
|
93
|
+
if (!value || !unit) {
|
|
97
94
|
return null;
|
|
98
|
-
}
|
|
99
|
-
// it usually means the value is related to open/closed, true/false
|
|
100
|
-
// but i'm not sure how to tell which one.
|
|
101
|
-
|
|
95
|
+
}
|
|
102
96
|
|
|
103
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", null, value), " ",
|
|
97
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", null, value), " ", /*#__PURE__*/React__default["default"].createElement("b", null, unit));
|
|
104
98
|
}
|
|
105
99
|
|
|
106
100
|
function ErrorMessage(_ref3) {
|
|
107
|
-
var
|
|
108
|
-
statusCode = _ref3.statusCode,
|
|
109
|
-
message = _ref3.message;
|
|
101
|
+
var message = _ref3.message;
|
|
110
102
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
111
103
|
className: IMSConnector_module["default"].message
|
|
112
|
-
}, statusCode && statusCode === 403 ? /*#__PURE__*/React__default["default"].createElement(RequestAccessMessage, {
|
|
113
|
-
instCode: instCode
|
|
114
|
-
}) : /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Typography, {
|
|
115
|
-
variant: "body_short",
|
|
116
|
-
color: echoComponents.themeConst.echoText
|
|
117
|
-
}, message !== null && message !== void 0 ? message : 'Something went wrong with RTD connection.'));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function RequestAccessMessage(_ref4) {
|
|
121
|
-
var instCode = _ref4.instCode;
|
|
122
|
-
var url = new URL('https://accessit.equinor.com');
|
|
123
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
124
|
-
className: IMSConnector_module["default"].requestAccess
|
|
125
104
|
}, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Typography, {
|
|
126
105
|
variant: "body_short",
|
|
127
|
-
color: echoComponents.themeConst.
|
|
128
|
-
},
|
|
129
|
-
as: "a",
|
|
130
|
-
href: url.href,
|
|
131
|
-
variant: "outlined"
|
|
132
|
-
}, "Go to AccessIT"));
|
|
106
|
+
color: echoComponents.themeConst.voided
|
|
107
|
+
}, message !== null && message !== void 0 ? message : 'Something went wrong with RTD connection.'));
|
|
133
108
|
}
|
|
134
109
|
|
|
135
110
|
exports.RealTimeConnectorForIMSTag = RealTimeConnectorForIMSTag;
|
|
@@ -76,7 +76,7 @@ function useSignalR(hubUrl) {
|
|
|
76
76
|
var _this = this;
|
|
77
77
|
|
|
78
78
|
var _React$useState = React.useState({
|
|
79
|
-
status: '
|
|
79
|
+
status: '',
|
|
80
80
|
loading: false
|
|
81
81
|
}),
|
|
82
82
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -89,8 +89,7 @@ function useSignalR(hubUrl) {
|
|
|
89
89
|
setState(function (state) {
|
|
90
90
|
return Object.assign(Object.assign({}, state), {
|
|
91
91
|
loading: false,
|
|
92
|
-
status: 'ok'
|
|
93
|
-
statusCode: status
|
|
92
|
+
status: 'ok'
|
|
94
93
|
});
|
|
95
94
|
});
|
|
96
95
|
} else {
|
|
@@ -98,7 +97,6 @@ function useSignalR(hubUrl) {
|
|
|
98
97
|
return Object.assign(Object.assign({}, state), {
|
|
99
98
|
loading: false,
|
|
100
99
|
status: 'error',
|
|
101
|
-
statusCode: status,
|
|
102
100
|
message: typeof payload === 'string' ? payload : ''
|
|
103
101
|
});
|
|
104
102
|
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, '__esModule', {
|
|
18
|
+
value: true
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
var echoBase = require('@equinor/echo-base');
|
|
22
|
+
|
|
23
|
+
var echoComponents = require('@equinor/echo-components');
|
|
24
|
+
|
|
25
|
+
var EchoCore = require('@equinor/echo-core');
|
|
26
|
+
|
|
27
|
+
var edsCoreReact = require('@equinor/eds-core-react');
|
|
28
|
+
|
|
29
|
+
var React = require('react');
|
|
30
|
+
|
|
31
|
+
var reactRouterDom = require('react-router-dom');
|
|
32
|
+
|
|
33
|
+
var logo_ee = require('../icons/logo_ee.js');
|
|
34
|
+
|
|
35
|
+
var EchoContent_module = require('./EchoContent.module.css.js');
|
|
36
|
+
|
|
37
|
+
function _interopDefaultLegacy(e) {
|
|
38
|
+
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
39
|
+
'default': e
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
44
|
+
|
|
45
|
+
var EchoBarComponent = function EchoBarComponent(_ref) {
|
|
46
|
+
var isLandscape = _ref.isLandscape;
|
|
47
|
+
|
|
48
|
+
var _React$useState = React.useState(false),
|
|
49
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
50
|
+
shouldRenderBar = _React$useState2[0],
|
|
51
|
+
setShouldRenderBar = _React$useState2[1];
|
|
52
|
+
|
|
53
|
+
var _React$useState3 = React.useState(''),
|
|
54
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
55
|
+
activeKey = _React$useState4[0],
|
|
56
|
+
setActiveKey = _React$useState4[1];
|
|
57
|
+
|
|
58
|
+
var _React$useState5 = React.useState(false),
|
|
59
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
60
|
+
isSyncing = _React$useState6[0],
|
|
61
|
+
setIsSyncing = _React$useState6[1];
|
|
62
|
+
|
|
63
|
+
var _EchoCore$usePanels = EchoCore.usePanels(),
|
|
64
|
+
setActivePanel = _EchoCore$usePanels.setActivePanel;
|
|
65
|
+
|
|
66
|
+
var goToInternalLink = EchoCore.useInternalLink();
|
|
67
|
+
|
|
68
|
+
var _EchoCore$usePlantSet = EchoCore.usePlantSettings(),
|
|
69
|
+
selectedInstCode = _EchoCore$usePlantSet.instCode;
|
|
70
|
+
|
|
71
|
+
var history = reactRouterDom.useHistory();
|
|
72
|
+
var shouldRenderBottomBar = React.useCallback(function () {
|
|
73
|
+
var isMounted = true;
|
|
74
|
+
|
|
75
|
+
if (window.innerWidth < 768 && !isLandscape || window.innerWidth < 927 && isLandscape && isMounted) {
|
|
76
|
+
setShouldRenderBar(true);
|
|
77
|
+
} else {
|
|
78
|
+
setShouldRenderBar(false);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return function () {
|
|
82
|
+
isMounted = false;
|
|
83
|
+
};
|
|
84
|
+
}, [isLandscape]);
|
|
85
|
+
React.useEffect(function () {
|
|
86
|
+
var isMounted = true;
|
|
87
|
+
var unSubscribeSyncing = echoBase.eventHub.subscribe('isSyncing', function (active) {
|
|
88
|
+
if (isMounted) {
|
|
89
|
+
setIsSyncing(active);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return function () {
|
|
93
|
+
isMounted = false;
|
|
94
|
+
unSubscribeSyncing();
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
var onClickButton = function onClickButton(key) {
|
|
99
|
+
setActivePanel('');
|
|
100
|
+
|
|
101
|
+
if (key === activeKey) {
|
|
102
|
+
if (key === 'menu' || key === 'search') {
|
|
103
|
+
setActivePanel('');
|
|
104
|
+
} else {
|
|
105
|
+
history.go(-1);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
setActiveKey('');
|
|
109
|
+
} else {
|
|
110
|
+
setActiveKey(key);
|
|
111
|
+
|
|
112
|
+
switch (key) {
|
|
113
|
+
case 'home':
|
|
114
|
+
return history.push("/?instCode=".concat(selectedInstCode));
|
|
115
|
+
|
|
116
|
+
case 'search':
|
|
117
|
+
return setActivePanel(EchoCore.ECHO_CORE_SEARCH);
|
|
118
|
+
|
|
119
|
+
case 'camera':
|
|
120
|
+
return goToInternalLink('/camera');
|
|
121
|
+
|
|
122
|
+
case 'menu':
|
|
123
|
+
return setActivePanel(EchoCore.ECHO_CORE_MAIN);
|
|
124
|
+
|
|
125
|
+
default:
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
setActiveKey('');
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
React.useEffect(function () {
|
|
134
|
+
shouldRenderBottomBar();
|
|
135
|
+
window.addEventListener('resize', shouldRenderBottomBar);
|
|
136
|
+
return function () {
|
|
137
|
+
window.removeEventListener('resize', shouldRenderBottomBar);
|
|
138
|
+
};
|
|
139
|
+
}, [shouldRenderBottomBar, shouldRenderBar]);
|
|
140
|
+
var EchoIcon = logo_ee.icon;
|
|
141
|
+
return shouldRenderBar ? /*#__PURE__*/React__default["default"].createElement(echoComponents.EchoBottomBar, {
|
|
142
|
+
style: {
|
|
143
|
+
zIndex: 'var( --echo-framework-z-level-bottom-bar)'
|
|
144
|
+
}
|
|
145
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
146
|
+
className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'home' ? EchoContent_module["default"].activeButton : '')
|
|
147
|
+
}, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
|
|
148
|
+
variant: "ghost_icon",
|
|
149
|
+
onClick: function onClick() {
|
|
150
|
+
return onClickButton('home');
|
|
151
|
+
}
|
|
152
|
+
}, /*#__PURE__*/React__default["default"].createElement(EchoIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
153
|
+
className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'search' ? EchoContent_module["default"].activeButton : '')
|
|
154
|
+
}, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
|
|
155
|
+
variant: "ghost_icon",
|
|
156
|
+
onClick: function onClick() {
|
|
157
|
+
return onClickButton('search');
|
|
158
|
+
}
|
|
159
|
+
}, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
|
|
160
|
+
name: 'search',
|
|
161
|
+
color: echoComponents.themeConst.echoText
|
|
162
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
163
|
+
className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'camera' ? EchoContent_module["default"].activeButton : '')
|
|
164
|
+
}, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
|
|
165
|
+
variant: "ghost_icon",
|
|
166
|
+
onClick: function onClick() {
|
|
167
|
+
return onClickButton('camera');
|
|
168
|
+
}
|
|
169
|
+
}, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
|
|
170
|
+
name: 'camera',
|
|
171
|
+
color: echoComponents.themeConst.echoText
|
|
172
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
173
|
+
className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'menu' ? EchoContent_module["default"].activeButton : '')
|
|
174
|
+
}, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
|
|
175
|
+
variant: "ghost_icon",
|
|
176
|
+
onClick: function onClick() {
|
|
177
|
+
return onClickButton('menu');
|
|
178
|
+
}
|
|
179
|
+
}, isSyncing ? /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
|
|
180
|
+
className: EchoContent_module["default"].spinningIcon,
|
|
181
|
+
color: echoComponents.themeConst.echoText,
|
|
182
|
+
name: 'sync'
|
|
183
|
+
}) : /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
|
|
184
|
+
name: 'menu',
|
|
185
|
+
color: echoComponents.themeConst.echoText
|
|
186
|
+
})))) : null;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
exports.EchoBarComponent = EchoBarComponent;
|
|
190
|
+
exports["default"] = EchoBarComponent;
|
|
@@ -14,6 +14,18 @@ var corePanelLeft = require('../components/panel/corePanelLeft.js');
|
|
|
14
14
|
|
|
15
15
|
var corePanelRight = require('../components/panel/corePanelRight.js');
|
|
16
16
|
|
|
17
|
+
require('react-router-dom');
|
|
18
|
+
|
|
19
|
+
var useScreenOrientation = require('../hooks/useScreenOrientation.js');
|
|
20
|
+
|
|
21
|
+
require('@equinor/echo-search');
|
|
22
|
+
|
|
23
|
+
var hookLibrary = require('../hooks/hookLibrary.js');
|
|
24
|
+
|
|
25
|
+
var EchoBarComponent = require('./EchoBarComponent.js');
|
|
26
|
+
|
|
27
|
+
var EchoContent_module = require('./EchoContent.module.css.js');
|
|
28
|
+
|
|
17
29
|
function _interopDefaultLegacy(e) {
|
|
18
30
|
return e && _typeof(e) === 'object' && 'default' in e ? e : {
|
|
19
31
|
'default': e
|
|
@@ -24,8 +36,30 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
36
|
|
|
25
37
|
var EchoContent = function EchoContent(_ref) {
|
|
26
38
|
var children = _ref.children,
|
|
27
|
-
Legend = _ref.Legend
|
|
28
|
-
|
|
39
|
+
Legend = _ref.Legend,
|
|
40
|
+
isToggleButtonVisible = _ref.isToggleButtonVisible;
|
|
41
|
+
var deviceOrientation = hookLibrary.HookLibrary.useDeviceOrientation();
|
|
42
|
+
var isLandscapeDevice = deviceOrientation.landscape;
|
|
43
|
+
var screenOrientation = useScreenOrientation.useScreenOrientation();
|
|
44
|
+
var isWeb = !deviceOrientation.landscape && !deviceOrientation.portrait;
|
|
45
|
+
var isLandscapeWeb = screenOrientation === 'landscape';
|
|
46
|
+
return /*#__PURE__*/React__default["default"].createElement(EchoCore.ModuleContextProvider, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
47
|
+
className: EchoContent_module["default"].echoContent
|
|
48
|
+
}, /*#__PURE__*/React__default["default"].createElement(corePanelLeft["default"], {
|
|
49
|
+
isToggleButtonVisible: isToggleButtonVisible
|
|
50
|
+
}), /*#__PURE__*/React__default["default"].createElement(corePanelRight["default"], {
|
|
51
|
+
isToggleButtonVisible: isToggleButtonVisible
|
|
52
|
+
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
53
|
+
className: EchoContent_module["default"].echoContentContainer
|
|
54
|
+
}, isWeb ? screenOrientation === 'landscape' && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
|
|
55
|
+
isLandscape: isLandscapeWeb
|
|
56
|
+
}) : deviceOrientation.landscape && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
|
|
57
|
+
isLandscape: isLandscapeDevice
|
|
58
|
+
}), children, isWeb ? screenOrientation === 'portrait' && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
|
|
59
|
+
isLandscape: isLandscapeWeb
|
|
60
|
+
}) : deviceOrientation.portrait && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
|
|
61
|
+
isLandscape: isLandscapeDevice
|
|
62
|
+
})), Legend && /*#__PURE__*/React__default["default"].createElement(Legend, null)));
|
|
29
63
|
};
|
|
30
64
|
|
|
31
65
|
exports.EchoContent = EchoContent;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var styleInject_es = require('../../node_modules/style-inject/dist/style-inject.es.js');
|
|
8
|
+
|
|
9
|
+
var css_248z = ".EchoContent-module_echoContent__DgKg-{height:100%;padding:env(safe-area-inset-top,20px) env(safe-area-inset-right,20px) env(safe-area-inset-bottom,20px) env(safe-area-inset-left,20px);width:100%}.EchoContent-module_mobileWrapper__I1UNf{height:calc(100% - 60px);position:relative}.EchoContent-module_echoContentContainer__-yhpr{height:100%}.EchoContent-module_echoModuleContainer__NsbOv{width:100%}.EchoContent-module_barButtons__F8xrV{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.EchoContent-module_activeButton__5xhQu{background-color:var(--equiGreen3);border-top:2px solid var(--equiGreen1)}@media screen and (max-width:927px) and (orientation:landscape){.EchoContent-module_activeButton__5xhQu{border-right:2px solid var(--equiGreen1);border-top:0}}@media screen and (orientation:landscape){.EchoContent-module_echoContentContainer__-yhpr{display:flex;flex-direction:row}}@media screen and (orientation:portrait){.EchoContent-module_echoModuleContainer__NsbOv{height:calc(100% - 48px);overflow:hidden}}@keyframes EchoContent-module_spinAnimation__gNXNq{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.EchoContent-module_spinningIcon__am10d{animation:EchoContent-module_spinAnimation__gNXNq 1.5s linear infinite reverse}";
|
|
10
|
+
var style = {
|
|
11
|
+
"echoContent": "EchoContent-module_echoContent__DgKg-",
|
|
12
|
+
"mobileWrapper": "EchoContent-module_mobileWrapper__I1UNf",
|
|
13
|
+
"echoContentContainer": "EchoContent-module_echoContentContainer__-yhpr",
|
|
14
|
+
"echoModuleContainer": "EchoContent-module_echoModuleContainer__NsbOv",
|
|
15
|
+
"barButtons": "EchoContent-module_barButtons__F8xrV",
|
|
16
|
+
"activeButton": "EchoContent-module_activeButton__5xhQu",
|
|
17
|
+
"spinningIcon": "EchoContent-module_spinningIcon__am10d",
|
|
18
|
+
"spinAnimation": "EchoContent-module_spinAnimation__gNXNq"
|
|
19
|
+
};
|
|
20
|
+
styleInject_es["default"](css_248z);
|
|
21
|
+
exports["default"] = style;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
var styleInject_es = require('../node_modules/style-inject/dist/style-inject.es.js');
|
|
4
4
|
|
|
5
|
-
var css_248z = ":root{--echo-framework-z-level-panel:500;--echo-framework-z-level-scrim:1450}[class^=Scrim__StyledScrim]{z-index:var(--echo-framework-z-level-scrim)!important}";
|
|
5
|
+
var css_248z = ":root{--echo-framework-z-level-panel:500;--echo-framework-z-level-bottom-bar:1000;--echo-framework-z-level-scrim:1450}[class^=Scrim__StyledScrim]{z-index:var(--echo-framework-z-level-scrim)!important}";
|
|
6
6
|
styleInject_es["default"](css_248z);
|
|
@@ -25,6 +25,7 @@ exports.RegisteredHookName = void 0;
|
|
|
25
25
|
RegisteredHookName["useIsContextMenuInfoLoading"] = "useIsContextMenuInfoLoading";
|
|
26
26
|
RegisteredHookName["useSetActiveCommPackNo"] = "useSetActiveCommPackNo";
|
|
27
27
|
RegisteredHookName["useSetActiveMcPackNo"] = "useSetActiveMcPackNo";
|
|
28
|
+
RegisteredHookName["useDeviceOrientation"] = "useDeviceOrientation";
|
|
28
29
|
})(exports.RegisteredHookName || (exports.RegisteredHookName = {}));
|
|
29
30
|
|
|
30
31
|
var HookLibrary = Object.freeze({
|
|
@@ -81,6 +82,14 @@ var HookLibrary = Object.freeze({
|
|
|
81
82
|
*/
|
|
82
83
|
useSetActiveMcPackNo: function useSetActiveMcPackNo() {
|
|
83
84
|
return EchoCore__default["default"].echoHookRegistry.getHookByName(exports.RegisteredHookName.useSetActiveMcPackNo)();
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Hook for detecting device orientation from native devices.
|
|
89
|
+
* @returns {DeviceOrientation}
|
|
90
|
+
*/
|
|
91
|
+
useDeviceOrientation: function useDeviceOrientation() {
|
|
92
|
+
return EchoCore__default["default"].echoHookRegistry.getHookByName(exports.RegisteredHookName.useDeviceOrientation)();
|
|
84
93
|
}
|
|
85
94
|
});
|
|
86
95
|
exports.HookLibrary = HookLibrary;
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -6,7 +6,10 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
6
6
|
|
|
7
7
|
var useEchoHistory = require('./useEchoHistory.js');
|
|
8
8
|
|
|
9
|
+
var useScreenOrientation = require('./useScreenOrientation.js');
|
|
10
|
+
|
|
9
11
|
var useTagDetails = require('./useTagDetails.js');
|
|
10
12
|
|
|
11
13
|
exports.useEchoHistory = useEchoHistory.useEchoHistory;
|
|
14
|
+
exports.useScreenOrientation = useScreenOrientation.useScreenOrientation;
|
|
12
15
|
exports.useTagDetails = useTagDetails.useTagDetails;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10
|
+
|
|
11
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
12
|
+
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, '__esModule', {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var React = require('react');
|
|
20
|
+
|
|
21
|
+
function useScreenOrientation() {
|
|
22
|
+
var _React$useState = React.useState(''),
|
|
23
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24
|
+
orientation = _React$useState2[0],
|
|
25
|
+
setOrientation = _React$useState2[1];
|
|
26
|
+
|
|
27
|
+
var updateOrientation = React.useCallback(function () {
|
|
28
|
+
var isMounted = true;
|
|
29
|
+
|
|
30
|
+
if (window.innerWidth > window.innerHeight && isMounted) {
|
|
31
|
+
setOrientation('landscape');
|
|
32
|
+
} else {
|
|
33
|
+
setOrientation('portrait');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return function () {
|
|
37
|
+
isMounted = false;
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
updateOrientation();
|
|
42
|
+
window.addEventListener('resize', updateOrientation);
|
|
43
|
+
return function () {
|
|
44
|
+
window.removeEventListener('resize', updateOrientation);
|
|
45
|
+
};
|
|
46
|
+
}, [updateOrientation]);
|
|
47
|
+
return orientation;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.useScreenOrientation = useScreenOrientation;
|