-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoscd-template-menu.ts
More file actions
71 lines (60 loc) · 1.95 KB
/
oscd-template-menu.ts
File metadata and controls
71 lines (60 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { LitElement, html, css } from 'lit';
import { property } from 'lit/decorators.js';
import { ScopedElementsMixin } from '@open-wc/scoped-elements/lit-element.js';
import { EditV2, Transactor } from '@omicronenergy/oscd-api';
export default class OscdTemplateMenu extends ScopedElementsMixin(LitElement) {
static scopedElements = {
/*
* add any web-components this component will reference here.
* E.g.
* "oscd-button": OscdButton,
*
* Important!
* Importing the web-component class should NOT result in the web-component being registered with the global customElements registry.
* Otherwise it will fail to render at all. You'll only get an empty tag, no web component.
*/
};
@property({ type: Object })
editor!: Transactor<EditV2>;
@property({ type: Object })
docs!: Record<string, XMLDocument>;
@property({ type: Object })
doc?: XMLDocument;
@property({ type: String })
docName?: string;
@property({ attribute: false })
docVersion?: unknown;
@property({ type: String })
locale?: string;
async run() {
// Implement the logic for the run method
if (this.docName) {
console.log(`Running with document: ${this.docName}`);
}
}
render() {
/* Anything rendered in here for a Menu plugin, will be hidden
* Typically you would render dialogs here, where the run method
* may set the dialogs state to open.
*/
return html`
<h1>OSCD Template Menu</h1>
<p>
Welcome to the OSCD Template Menu. Currently selected Document is:
${this.docName}.
</p>
`;
}
static styles = css`
:host {
/* Ideal place to set CSS to the root of the component */
background-color: var(--oscd-something);
}
* {
/* Ideal place to set CSS variables, which should be applied to all elements.
* typically done to set Material Component theme variables.
*/
--md-something: var(--oscd-something);
}
`;
}