@openremote/or-components 1.8.0-snapshot.20250725120002 → 1.8.0-snapshot.20250728102340
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/README.md +31 -31
- package/lib/or-ace-editor.js +22 -165
- package/lib/or-collapsible-panel.js +91 -161
- package/lib/or-file-uploader.js +76 -186
- package/lib/or-form.js +12 -77
- package/lib/or-loading-indicator.js +72 -122
- package/lib/or-loading-wrapper.js +32 -77
- package/lib/or-panel.js +56 -96
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
# @openremote/or-components
|
|
2
|
-
[![NPM Version][npm-image]][npm-url]
|
|
3
|
-
[![Linux Build][travis-image]][travis-url]
|
|
4
|
-
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
5
|
-
|
|
6
|
-
Contains basic UI components
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
```bash
|
|
10
|
-
npm i @openremote/or-components
|
|
11
|
-
yarn add @openremote/or-components
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
## Supported Browsers
|
|
19
|
-
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
|
|
20
|
-
Internet Explorer 11 is also supported.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## License
|
|
24
|
-
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
25
|
-
|
|
26
|
-
[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
|
|
27
|
-
[npm-url]: https://npmjs.org/package/@openremote/or-components
|
|
28
|
-
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
|
|
29
|
-
[travis-url]: https://travis-ci.org/live-js/live-xxx
|
|
30
|
-
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
|
|
31
|
-
[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
|
|
1
|
+
# @openremote/or-components
|
|
2
|
+
[![NPM Version][npm-image]][npm-url]
|
|
3
|
+
[![Linux Build][travis-image]][travis-url]
|
|
4
|
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
|
5
|
+
|
|
6
|
+
Contains basic UI components
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
```bash
|
|
10
|
+
npm i @openremote/or-components
|
|
11
|
+
yarn add @openremote/or-components
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
For a full list of properties, methods and options refer to the TypeDoc generated [documentation]().
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## Supported Browsers
|
|
19
|
+
The last 2 versions of all modern browsers are supported, including Chrome, Safari, Opera, Firefox, Edge. In addition,
|
|
20
|
+
Internet Explorer 11 is also supported.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
[GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
|
|
25
|
+
|
|
26
|
+
[npm-image]: https://img.shields.io/npm/v/live-xxx.svg
|
|
27
|
+
[npm-url]: https://npmjs.org/package/@openremote/or-components
|
|
28
|
+
[travis-image]: https://img.shields.io/travis/live-js/live-xxx/master.svg
|
|
29
|
+
[travis-url]: https://travis-ci.org/live-js/live-xxx
|
|
30
|
+
[coveralls-image]: https://img.shields.io/coveralls/live-js/live-xxx/master.svg
|
|
31
|
+
[coveralls-url]: https://coveralls.io/r/live-js/live-xxx?branch=master
|
package/lib/or-ace-editor.js
CHANGED
|
@@ -1,168 +1,25 @@
|
|
|
1
|
-
var __decorate =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
import { css, html, LitElement } from "lit";
|
|
8
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
9
|
-
import ace from "ace-builds";
|
|
10
|
-
import "ace-builds/src-noconflict/mode-javascript";
|
|
11
|
-
import "ace-builds/src-noconflict/mode-json";
|
|
12
|
-
import "ace-builds/src-noconflict/mode-groovy";
|
|
13
|
-
export class OrAceEditorChangedEvent extends CustomEvent {
|
|
14
|
-
constructor(value, valid) {
|
|
15
|
-
super(OrAceEditorChangedEvent.NAME, {
|
|
16
|
-
bubbles: true,
|
|
17
|
-
composed: true,
|
|
18
|
-
detail: {
|
|
19
|
-
value: value,
|
|
20
|
-
valid: valid
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,o){var r,d=arguments.length,s=d<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var a=t.length-1;a>=0;a--)(r=t[a])&&(s=(d<3?r(s):d>3?r(e,i,s):r(e,i))||s);return d>3&&s&&Object.defineProperty(e,i,s),s};import{css as t,html as e,LitElement as i}from"lit";import{customElement as o,property as r,query as d}from"lit/decorators.js";import s from"ace-builds";import"ace-builds/src-noconflict/mode-javascript";import"ace-builds/src-noconflict/mode-json";import"ace-builds/src-noconflict/mode-groovy";export class OrAceEditorChangedEvent extends CustomEvent{constructor(t,e){super(OrAceEditorChangedEvent.NAME,{bubbles:!0,composed:!0,detail:{value:t,valid:e}})}}OrAceEditorChangedEvent.NAME="or-ace-editor-changed";export class OrAceEditorEditEvent extends CustomEvent{constructor(){super(OrAceEditorEditEvent.NAME,{bubbles:!0,composed:!0})}}OrAceEditorEditEvent.NAME="or-ace-editor-edit";let OrAceEditor=class extends i{constructor(){super(...arguments),this.mode="ace/mode/json",this._lastValue="",this._editing=!1}static get styles(){return t`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100%;
|
|
21
6
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor() {
|
|
28
|
-
super(OrAceEditorEditEvent.NAME, {
|
|
29
|
-
bubbles: true,
|
|
30
|
-
composed: true
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
OrAceEditorEditEvent.NAME = "or-ace-editor-edit";
|
|
35
|
-
let OrAceEditor = class OrAceEditor extends LitElement {
|
|
36
|
-
constructor() {
|
|
37
|
-
super(...arguments);
|
|
38
|
-
this.mode = "ace/mode/json";
|
|
39
|
-
this._lastValue = "";
|
|
40
|
-
this._editing = false;
|
|
41
|
-
}
|
|
42
|
-
// language=CSS
|
|
43
|
-
static get styles() {
|
|
44
|
-
return css `
|
|
45
|
-
:host {
|
|
46
|
-
display: block;
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: 100%;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#ace-editor {
|
|
52
|
-
position: relative;
|
|
53
|
-
height: 100%;
|
|
54
|
-
width: 100%;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@media screen and (max-width: 1400px) {
|
|
58
|
-
:host > * {
|
|
59
|
-
flex-grow: 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
:host {
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
|
-
}
|
|
68
|
-
disconnectedCallback() {
|
|
69
|
-
this.destroyEditor();
|
|
70
|
-
super.disconnectedCallback();
|
|
71
|
-
}
|
|
72
|
-
updated(_changedProperties) {
|
|
73
|
-
super.updated(_changedProperties);
|
|
74
|
-
if (_changedProperties.has("mode")) {
|
|
75
|
-
this.destroyEditor();
|
|
76
|
-
this.initEditor();
|
|
77
|
-
}
|
|
78
|
-
if (_changedProperties.has("value")) {
|
|
79
|
-
if (this._aceEditor) {
|
|
80
|
-
this._lastValue = this.value !== undefined ? typeof this.value === "string" ? this.value : JSON.stringify(this.value, null, 2) : "";
|
|
81
|
-
this._aceEditor.setValue(this._lastValue);
|
|
7
|
+
|
|
8
|
+
#ace-editor {
|
|
9
|
+
position: relative;
|
|
10
|
+
height: 100%;
|
|
11
|
+
width: 100%;
|
|
82
12
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this._aceEditor.destroy();
|
|
93
|
-
this._aceEditor = undefined;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
initEditor() {
|
|
97
|
-
if (this._aceElem) {
|
|
98
|
-
this._aceEditor = ace.edit(this._aceElem, {
|
|
99
|
-
mode: this.mode,
|
|
100
|
-
value: this._lastValue,
|
|
101
|
-
useSoftTabs: true,
|
|
102
|
-
tabSize: 2,
|
|
103
|
-
readOnly: this.readonly,
|
|
104
|
-
showPrintMargin: false
|
|
105
|
-
});
|
|
106
|
-
this._aceEditor.renderer.attachToShadowRoot();
|
|
107
|
-
// Use the changeAnnotation event instead of change event so we have up to date validation info
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
this._aceEditor.getSession().on("changeAnnotation", () => this._onEditorChange());
|
|
110
|
-
this._aceEditor.on("change", () => this._onEditorEdit());
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
_onEditorEdit() {
|
|
114
|
-
if (!this._editing) {
|
|
115
|
-
this.dispatchEvent(new OrAceEditorEditEvent());
|
|
116
|
-
this._editing = true;
|
|
117
|
-
}
|
|
118
|
-
if (this._changeTimer) {
|
|
119
|
-
window.clearTimeout(this._changeTimer);
|
|
120
|
-
}
|
|
121
|
-
// Set change timer to expire after annotation web worker
|
|
122
|
-
this._changeTimer = window.setTimeout(() => {
|
|
123
|
-
this._changeTimer = undefined;
|
|
124
|
-
if (this._editing) {
|
|
125
|
-
this._onEditorChange();
|
|
13
|
+
|
|
14
|
+
@media screen and (max-width: 1400px) {
|
|
15
|
+
:host > * {
|
|
16
|
+
flex-grow: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host {
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
126
22
|
}
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
this._editing = false;
|
|
131
|
-
const newValue = this.getValue() || "";
|
|
132
|
-
if (this._lastValue !== newValue) {
|
|
133
|
-
this._lastValue = newValue;
|
|
134
|
-
const valid = this.validate();
|
|
135
|
-
this.dispatchEvent(new OrAceEditorChangedEvent(newValue, valid));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
getValue() {
|
|
139
|
-
if (!this._aceEditor) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
return this._aceEditor.getValue();
|
|
143
|
-
}
|
|
144
|
-
validate() {
|
|
145
|
-
if (!this._aceEditor) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
const annotations = this._aceEditor.getSession().getAnnotations();
|
|
149
|
-
return !annotations || annotations.length === 0;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
__decorate([
|
|
153
|
-
property({ type: Boolean, attribute: false })
|
|
154
|
-
], OrAceEditor.prototype, "readonly", void 0);
|
|
155
|
-
__decorate([
|
|
156
|
-
property({ attribute: false })
|
|
157
|
-
], OrAceEditor.prototype, "value", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
property({ type: String, attribute: false })
|
|
160
|
-
], OrAceEditor.prototype, "mode", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
query("#ace-editor")
|
|
163
|
-
], OrAceEditor.prototype, "_aceElem", void 0);
|
|
164
|
-
OrAceEditor = __decorate([
|
|
165
|
-
customElement("or-ace-editor")
|
|
166
|
-
], OrAceEditor);
|
|
167
|
-
export { OrAceEditor };
|
|
168
|
-
//# sourceMappingURL=or-ace-editor.js.map
|
|
23
|
+
`}disconnectedCallback(){this.destroyEditor(),super.disconnectedCallback()}updated(t){super.updated(t),t.has("mode")&&(this.destroyEditor(),this.initEditor()),t.has("value")&&this._aceEditor&&(this._lastValue=void 0!==this.value?"string"==typeof this.value?this.value:JSON.stringify(this.value,null,2):"",this._aceEditor.setValue(this._lastValue))}render(){return e`
|
|
24
|
+
<div id="ace-editor"></div>
|
|
25
|
+
`}destroyEditor(){this._aceEditor&&(this._aceEditor.destroy(),this._aceEditor=void 0)}initEditor(){this._aceElem&&(this._aceEditor=s.edit(this._aceElem,{mode:this.mode,value:this._lastValue,useSoftTabs:!0,tabSize:2,readOnly:this.readonly,showPrintMargin:!1}),this._aceEditor.renderer.attachToShadowRoot(),this._aceEditor.getSession().on("changeAnnotation",()=>this._onEditorChange()),this._aceEditor.on("change",()=>this._onEditorEdit()))}_onEditorEdit(){this._editing||(this.dispatchEvent(new OrAceEditorEditEvent),this._editing=!0),this._changeTimer&&window.clearTimeout(this._changeTimer),this._changeTimer=window.setTimeout(()=>{this._changeTimer=void 0,this._editing&&this._onEditorChange()},600)}_onEditorChange(){this._editing=!1;let t=this.getValue()||"";if(this._lastValue!==t){this._lastValue=t;let e=this.validate();this.dispatchEvent(new OrAceEditorChangedEvent(t,e))}}getValue(){if(this._aceEditor)return this._aceEditor.getValue()}validate(){if(!this._aceEditor)return!1;let t=this._aceEditor.getSession().getAnnotations();return!t||0===t.length}};__decorate([r({type:Boolean,attribute:!1})],OrAceEditor.prototype,"readonly",void 0),__decorate([r({attribute:!1})],OrAceEditor.prototype,"value",void 0),__decorate([r({type:String,attribute:!1})],OrAceEditor.prototype,"mode",void 0),__decorate([d("#ace-editor")],OrAceEditor.prototype,"_aceElem",void 0),OrAceEditor=__decorate([o("or-ace-editor")],OrAceEditor);export{OrAceEditor};
|
|
@@ -1,165 +1,95 @@
|
|
|
1
|
-
var __decorate
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* published by the Free Software Foundation, either version 3 of the
|
|
16
|
-
* License, or (at your option) any later version.
|
|
17
|
-
*
|
|
18
|
-
* This program is distributed in the hope that it will be useful,
|
|
19
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21
|
-
* GNU Affero General Public License for more details.
|
|
22
|
-
*
|
|
23
|
-
* You should have received a copy of the GNU Affero General Public License
|
|
24
|
-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
25
|
-
*/
|
|
26
|
-
import { css, html, LitElement, unsafeCSS } from "lit";
|
|
27
|
-
import { customElement, property, query } from "lit/decorators.js";
|
|
28
|
-
import { i18next } from "@openremote/or-translate";
|
|
29
|
-
import { DefaultColor5 } from "@openremote/core";
|
|
30
|
-
import { until } from 'lit/directives/until.js';
|
|
31
|
-
// language=CSS
|
|
32
|
-
const style = css `
|
|
33
|
-
|
|
34
|
-
:host {
|
|
35
|
-
display: block;
|
|
36
|
-
box-sizing: content-box;
|
|
37
|
-
margin: 0;
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
transition: margin 225ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
40
|
-
position: relative;
|
|
41
|
-
border-color: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});
|
|
42
|
-
background-color: var(--or-collapisble-panel-background-color);
|
|
43
|
-
border-radius: 4px;
|
|
44
|
-
border-width: 1px;
|
|
45
|
-
border-style: solid;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([hidden]) {
|
|
49
|
-
display: none;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
#header {
|
|
53
|
-
display: flex;
|
|
54
|
-
height: 48px;
|
|
55
|
-
flex-direction: row;
|
|
56
|
-
font-family: Roboto,Helvetica Neue,sans-serif;
|
|
57
|
-
font-size: 15px;
|
|
58
|
-
font-weight: 400;
|
|
59
|
-
align-items: center;
|
|
60
|
-
padding: 0 24px 0 16px;
|
|
61
|
-
border-radius: inherit;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#header.expandable {
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
transition: height 225ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
#header.expanded {
|
|
70
|
-
height: 64px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
#header.expanded > #indicator {
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#header-content {
|
|
77
|
-
flex: 1;
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: row;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
#header-title, #header-description {
|
|
84
|
-
display: inline-flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
#header-description {
|
|
89
|
-
flex-grow: 2;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
#indicator {
|
|
93
|
-
align-self: center;
|
|
94
|
-
margin-right: 6px;
|
|
95
|
-
margin-left: -5px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
#content {
|
|
99
|
-
height: 0;
|
|
100
|
-
visibility: hidden;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
#content.expanded {
|
|
104
|
-
height: unset;
|
|
105
|
-
visibility: visible;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
or-icon {
|
|
109
|
-
vertical-align: middle;
|
|
110
|
-
--or-icon-width: 20px;
|
|
111
|
-
--or-icon-height: 20px;
|
|
112
|
-
margin-right: 2px;
|
|
113
|
-
margin-left: -5px;
|
|
114
|
-
}
|
|
115
|
-
`;
|
|
116
|
-
let OrCollapsiblePanel = class OrCollapsiblePanel extends LitElement {
|
|
117
|
-
constructor() {
|
|
118
|
-
super(...arguments);
|
|
119
|
-
this.expanded = false;
|
|
120
|
-
this.expandable = true;
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n<3?r(a):n>3?r(t,i,a):r(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a};import{css as e,html as t,LitElement as i,unsafeCSS as o}from"lit";import{customElement as r,property as n,query as a}from"lit/decorators.js";import{i18next as l}from"@openremote/or-translate";import{DefaultColor5 as d}from"@openremote/core";import{until as s}from"lit/directives/until.js";let style=e`
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
box-sizing: content-box;
|
|
6
|
+
margin: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
transition: margin 225ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
9
|
+
position: relative;
|
|
10
|
+
border-color: var(--or-app-color5, ${o(d)});
|
|
11
|
+
background-color: var(--or-collapisble-panel-background-color);
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
border-width: 1px;
|
|
14
|
+
border-style: solid;
|
|
121
15
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
];
|
|
16
|
+
|
|
17
|
+
:host([hidden]) {
|
|
18
|
+
display: none;
|
|
126
19
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
20
|
+
|
|
21
|
+
#header {
|
|
22
|
+
display: flex;
|
|
23
|
+
height: 48px;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
font-family: Roboto,Helvetica Neue,sans-serif;
|
|
26
|
+
font-size: 15px;
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
align-items: center;
|
|
29
|
+
padding: 0 24px 0 16px;
|
|
30
|
+
border-radius: inherit;
|
|
133
31
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<span id="header-content">
|
|
139
|
-
<span id="header-title"><slot name="header"></slot></span>
|
|
140
|
-
<span id="header-description"><slot name="header-description"></slot></span>
|
|
141
|
-
</span>
|
|
142
|
-
</div>
|
|
143
|
-
<div id="content" class="${this.expandable && this.expanded ? "expanded" : ""}">
|
|
144
|
-
${this.lazycontent ? this.expanded && until(this.lazycontent, html `${i18next.t('loading')}`) : html `<slot name="content"></slot>`}
|
|
145
|
-
</div>
|
|
146
|
-
`;
|
|
32
|
+
|
|
33
|
+
#header.expandable {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
transition: height 225ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
147
36
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
37
|
+
|
|
38
|
+
#header.expanded {
|
|
39
|
+
height: 64px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#header.expanded > #indicator {
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#header-content {
|
|
46
|
+
flex: 1;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#header-title, #header-description {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#header-description {
|
|
58
|
+
flex-grow: 2;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#indicator {
|
|
62
|
+
align-self: center;
|
|
63
|
+
margin-right: 6px;
|
|
64
|
+
margin-left: -5px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
#content {
|
|
68
|
+
height: 0;
|
|
69
|
+
visibility: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
#content.expanded {
|
|
73
|
+
height: unset;
|
|
74
|
+
visibility: visible;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
or-icon {
|
|
78
|
+
vertical-align: middle;
|
|
79
|
+
--or-icon-width: 20px;
|
|
80
|
+
--or-icon-height: 20px;
|
|
81
|
+
margin-right: 2px;
|
|
82
|
+
margin-left: -5px;
|
|
83
|
+
}
|
|
84
|
+
`,OrCollapsiblePanel=class extends i{constructor(){super(...arguments),this.expanded=!1,this.expandable=!0}static get styles(){return[style]}_onHeaderClicked(e){this.expandable&&(e.preventDefault(),this.expanded=!this.expanded)}render(){return t`
|
|
85
|
+
<div id="header" class="${this.expandable?"expandable":""} ${this.expandable&&this.expanded?"expanded":""}" @click="${e=>this._onHeaderClicked(e)}">
|
|
86
|
+
${this.expandable?t`<or-icon icon="chevron-${this.expanded?"down":"right"}"></or-icon>`:""}
|
|
87
|
+
<span id="header-content">
|
|
88
|
+
<span id="header-title"><slot name="header"></slot></span>
|
|
89
|
+
<span id="header-description"><slot name="header-description"></slot></span>
|
|
90
|
+
</span>
|
|
91
|
+
</div>
|
|
92
|
+
<div id="content" class="${this.expandable&&this.expanded?"expanded":""}">
|
|
93
|
+
${this.lazycontent?this.expanded&&s(this.lazycontent,t`${l.t("loading")}`):t`<slot name="content"></slot>`}
|
|
94
|
+
</div>
|
|
95
|
+
`}};__decorate([n({type:Promise})],OrCollapsiblePanel.prototype,"lazycontent",void 0),__decorate([n({type:Boolean})],OrCollapsiblePanel.prototype,"expanded",void 0),__decorate([n({type:Boolean})],OrCollapsiblePanel.prototype,"expandable",void 0),__decorate([a("#header")],OrCollapsiblePanel.prototype,"headerElem",void 0),OrCollapsiblePanel=__decorate([r("or-collapsible-panel")],OrCollapsiblePanel);export{OrCollapsiblePanel};
|