Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Adds hideOnMobile property for panels to or-asset-viewer

robindekkersa3dfbc24e2df
diff --git a/ui/component/or-asset-tree/src/style.ts b/ui/component/or-asset-tree/src/style.ts
index 2221e84b4..b35ded0e6 100644
--- a/ui/component/or-asset-tree/src/style.ts
+++ b/ui/component/or-asset-tree/src/style.ts
@@ -284,7 +284,7 @@ export const style = css`
margin: 0 auto;
}
- @media only screen and (min-width: 768px){
+ @media only screen and (min-width: 769px){
.expander {
width: 26px;
}
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index b826f7143..bb9f8fe03 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -25,6 +25,7 @@ import {
import {style} from "./style";
import i18next from "i18next";
import {styleMap} from "lit-html/directives/style-map";
+import {classMap} from "lit-html/directives/class-map";
export type PanelType = "property" | "location" | "attribute" | "history";
@@ -32,6 +33,7 @@ export interface PanelConfig {
type?: PanelType;
scrollable?: boolean;
hide?: boolean;
+ hideOnMobile?: boolean;
include?: string[];
exclude?: string[];
readonly?: string[];
@@ -134,7 +136,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
gridRowStart: "4",
gridRowEnd: "5",
},
- scrollable: false,
+ scrollable: false
}
}
};
@@ -251,7 +253,6 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
}
public static getPanel(name: string, asset: Asset, attributes: AssetAttribute[], viewerConfig: AssetViewerConfig, panelConfig: PanelConfig, shadowRoot: ShadowRoot | null) {
-
const content = OrAssetViewer.getPanelContent(name, asset, attributes, viewerConfig, panelConfig, shadowRoot);
if (!content) {
@@ -259,7 +260,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
}
return html`
- <div class="panel" id="${name}-panel" style="${panelConfig && panelConfig.panelStyles ? styleMap(panelConfig.panelStyles) : ""}">
+ <div class=${classMap({"panel": true, mobileHidden: panelConfig.hideOnMobile === true})} id="${name}-panel" style="${panelConfig && panelConfig.panelStyles ? styleMap(panelConfig.panelStyles) : ""}">
<div class="panel-title">
<or-translate value="${name}"></or-translate>
</div>
diff --git a/ui/component/or-asset-viewer/src/style.ts b/ui/component/or-asset-viewer/src/style.ts
index 99ddea0e6..66adc57c9 100644
--- a/ui/component/or-asset-viewer/src/style.ts
+++ b/ui/component/or-asset-viewer/src/style.ts
@@ -143,8 +143,12 @@ export const style = css`
height: 100%;
}
- /* TODO move this to mobilePanelStyle */
- @media screen and (max-width: 768px) {
+ @media screen and (max-width: 769px) {
+
+ .mobileHidden {
+ display: none;
+ }
+
.panel,
#asset-header {
grid-area: auto!important;