Skip to content
Permalink
Browse files

UI updates: Added initial version of or-asset-tree component

  • Loading branch information...
richturner committed Sep 6, 2019
1 parent 161b834 commit dbb7ecd57dd5a7f9ba11acc973610156b68453e5
@@ -0,0 +1,3 @@
build/
build.gradle
test/
@@ -0,0 +1,31 @@
# @openremote/or-asset-tree \<or-asset-tree\>
[![NPM Version][npm-image]][npm-url]
[![Linux Build][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]

Web Component for displaying an asset tree. This component requires an OpenRemote Manager to retrieve, save and query assets.

## Install
```bash
npm i @openremote/or-asset-list
yarn add @openremote/or-asset-list
```

## Usage
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().


## Supported Browsers
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
Internet Explorer 11 is also supported.


## License
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)

[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
[npm-url]: https://npmjs.org/package/@openremote/or-asset-list
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
[travis-url]: https://travis-ci.org/live-js/live-xxx
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
@@ -0,0 +1,13 @@
buildDir = "dist"

task clean() {
doLast {
delete "dist"
}
}

npmBuild.dependsOn resolveTask(":ui:component:or-translate:build"), resolveTask(":ui:component:or-select:build"), resolveTask(":ui:component:or-input:build")

task build() {
dependsOn npmBuild
}
@@ -0,0 +1,27 @@
{
"name": "@openremote/or-asset-tree",
"version": "1.0.0",
"description": "OpenRemote Asset Tree",
"main": "dist/index.js",
"types": "src/index.ts",
"scripts": {
"build": "npx tsc",
"test": "echo \"No tests\" && exit 0"
},
"author": "OpenRemote",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@openremote/core": "^1.0.2",
"@openremote/model": "^1.0.2",
"@openremote/or-icon": "^1.0.0",
"@openremote/or-select": "^1.0.0",
"@openremote/or-translate": "^1.0.0",
"@openremote/rest": "^1.0.2",
"lit-element": "^2.1.0",
"moment": "^2.24.0"
},
"devDependencies": {
"tslint": "^5.11.0",
"typescript": "^3.4.5"
}
}
@@ -0,0 +1,56 @@
import {customElement, html, LitElement, property, PropertyValues, TemplateResult, css} from "lit-element";
import "@openremote/or-select";
import "@openremote/or-icon";
import "@openremote/or-translate";
import "@openremote/or-icon";


@customElement("or-modal")
export class OrModal extends LitElement {

@property({type: Boolean, reflect: true})
public show: boolean = false;

@property({type: Boolean})
public dismissible: boolean = true;

public static get styles() {
return css`
:host {
position: relative;
}
div[hidden] {
height: 0px;
}
div {
transition: all 0.8s ease-in;
position: absolute;
height: auto;
}
`;
}

protected updated(_changedProperties: PropertyValues): void {
super.updated(_changedProperties);

if (_changedProperties.has("show") && this.dismissible) {
if (this.show) {
document.body.addEventListener("click", this._onMouseClick);
} else {
document.body.removeEventListener("click", this._onMouseClick)
}
}
}

protected _onMouseClick(evt: MouseEvent) {
if (!this.contains(evt.target as Node)) {
this.show = false;
}
}

protected render(): TemplateResult | void {
return html`<div ?hidden="${!this.show}">TEST</div>`;
}
}

0 comments on commit dbb7ecd

Please sign in to comment.
You can’t perform that action at this time.