Dears,
please recommend the steps to create or-custom-component, as trial i want to create simple Hello world panel in or-asset-viewer (then to adjust it further to my needs).
the steps that i do:
- in file ui/component/or-asset-viewer/src/index.ts
import “@openremote/or-custom-component”;
export interface PanelConfig {
type: “info” | “setup” | “history” | “group” | “survey” | “survey-results” | “linkedUsers” | “alarm.linkedAlarms” | “custom-component”;
…
}
…
if (panelConfig.type === “ifc-viewer”) {
// Empty panel which just shows “hello world”
return html<or-custom-component></or-custom-component>;
}
- ui/component/or-custom-component/package.json -copied from other or-component
- ui/component/or-custom-component/tsconfig.json -copied from other or-component
- ui/component/or-custom-component/rspack.config.js -copied from other or-component
- ui/component/or-custom-component/src/index.ts
import { LitElement, html } from ‘lit’;
import { customElement } from ‘lit/decorators.js’;
import { customComponentStyles } from ‘./style’;@customElement(‘or-custom-component’)
export class OrCustomComponent extends LitElement {
static styles = customComponentStyles;render() {
return html<div class="hello-world">Hello World!</div>;
}
}
- ui/component/or-custom-component/src/style.ts
import {css, unsafeCSS} from “lit”;
import {DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5, DefaultColor6, DefaultHeaderHeight} from “@openremote/core”;export const customComponentStyles= css`
:host {
display: block;
contain: content;
–or-custom-component-font-size: 14px;
–or-custom-component-background-color: var(–or-app-color2, ${unsafeCSS(DefaultColor2)});
…
please advise the next steps? i tried different options but
./gradlew clean installDist
in root directory fails with error:
ERROR in …/…/component/or-asset-viewer/lib/index.js 77:0-35
Module not found: Error: Can’t resolve ‘@openremote/or-custom-component’ in ‘C:\Users.…\ui\component\or-asset-viewer\lib’