@openremote/or-mwc-components 1.8.0-snapshot.20250723203453 → 1.8.0-snapshot.20250725070921
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/lib/or-mwc-dialog.js +14 -14
- package/lib/or-mwc-drawer.js +4 -4
- package/lib/or-mwc-input.js +85 -85
- package/lib/or-mwc-list.js +25 -25
- package/lib/or-mwc-menu.js +13 -13
- package/lib/or-mwc-snackbar.d.ts +1 -1
- package/lib/or-mwc-snackbar.js +5 -5
- package/lib/or-mwc-table.js +56 -56
- package/lib/or-mwc-table.js.map +1 -1
- package/lib/or-mwc-tabs.js +15 -15
- package/lib/style.js +2 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- /package/{webpack.config.js → rspack.config.js} +0 -0
package/lib/or-mwc-dialog.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,o,i){var n,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(a=(s<3?n(a):s>3?n(e,o,a):n(e,o))||a);return s>3&&a&&Object.defineProperty(e,o,a),a},__awaiter=this&&this.__awaiter||function(t,e,o,i){return new(o||(o=Promise))(
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var n,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,i);else for(var r=t.length-1;r>=0;r--)(n=t[r])&&(a=(s<3?n(a):s>3?n(e,o,a):n(e,o))||a);return s>3&&a&&Object.defineProperty(e,o,a),a},__awaiter=this&&this.__awaiter||function(t,e,o,i){return new(o||(o=Promise))(function(n,s){function a(t){try{c(i.next(t))}catch(t){s(t)}}function r(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?n(t.value):((e=t.value)instanceof o?e:new o(function(t){t(e)})).then(a,r)}c((i=i.apply(t,e||[])).next())})};import{css as t,html as e,LitElement as o,unsafeCSS as i}from"lit";import{customElement as n,property as s,query as a}from"lit/decorators.js";import{MDCDialog as r}from"@material/dialog";import"@openremote/or-translate";import"./or-mwc-input";import{InputType as c}from"./or-mwc-input";import{i18next as d}from"@openremote/or-translate";import{Util as l}from"@openremote/core";let dialogStyle=require("@material/dialog/dist/mdc.dialog.css"),listStyle=require("@material/list/dist/mdc.list.css");export class OrMwcDialogOpenedEvent extends CustomEvent{constructor(){super(OrMwcDialogOpenedEvent.NAME,{bubbles:!0,composed:!0})}}OrMwcDialogOpenedEvent.NAME="or-mwc-dialog-opened";export class OrMwcDialogClosedEvent extends CustomEvent{constructor(t){super(OrMwcDialogClosedEvent.NAME,{detail:t,bubbles:!0,composed:!0})}}OrMwcDialogClosedEvent.NAME="or-mwc-dialog-closed";export function showErrorDialog(t,o){return __awaiter(this,void 0,void 0,function*(){return showOkDialog("error",e`
|
|
2
2
|
<div>
|
|
3
3
|
<p><or-translate value="errorOccurred"></or-translate>
|
|
4
|
-
${t?
|
|
4
|
+
${t?e`
|
|
5
5
|
:</p>
|
|
6
6
|
<p>
|
|
7
7
|
<or-translate value="error"></or-translate>
|
|
@@ -9,13 +9,13 @@ var __decorate=this&&this.__decorate||function(t,e,o,i){var n,s=arguments.length
|
|
|
9
9
|
<or-translate .value="${t}"></or-translate>
|
|
10
10
|
`:""}
|
|
11
11
|
</p>
|
|
12
|
-
</div>`,void 0,
|
|
12
|
+
</div>`,void 0,o)})}export function showOkCancelDialog(t,o,i,n){return __awaiter(this,void 0,void 0,function*(){let s=new l.Deferred;return showDialog(new OrMwcDialog().setContent("string"==typeof o?e`<p>${o}</p>`:o).setActions([{actionName:"cancel",content:"cancel",default:!0,action:()=>s.resolve(!1)},{actionName:"ok",content:i||d.t("ok"),action:()=>s.resolve(!0)}]).setHeading(t).setStyles(e`
|
|
13
13
|
<style>
|
|
14
14
|
.mdc-dialog__content {
|
|
15
15
|
white-space: pre-wrap
|
|
16
16
|
}
|
|
17
17
|
</style>
|
|
18
|
-
`),
|
|
18
|
+
`),n),yield s.promise})}export function showOkDialog(t,o,i,n){return __awaiter(this,void 0,void 0,function*(){let s=new l.Deferred;return showDialog(new OrMwcDialog().setContent("string"==typeof o?e`<p>${o}</p>`:o).setActions([{actionName:"ok",default:!0,content:i||d.t("ok"),action:()=>s.resolve(!0)}]).setHeading(t),n),yield s.promise})}export function showDialog(t,e){return e||(e=OrMwcDialog.DialogHostElement||document.body),t.setOpen(!0),t.addEventListener(OrMwcDialogOpenedEvent.NAME,t=>{t.stopPropagation()}),t.addEventListener(OrMwcDialogClosedEvent.NAME,e=>{e.stopPropagation(),window.setTimeout(()=>{t.parentElement&&t.parentElement.removeChild(t)},0)}),e.append(t),t}let style=t`
|
|
19
19
|
:host {
|
|
20
20
|
position: relative;
|
|
21
21
|
}
|
|
@@ -42,8 +42,8 @@ var __decorate=this&&this.__decorate||function(t,e,o,i){var n,s=arguments.length
|
|
|
42
42
|
max-width: 1024px;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
${"string"==typeof this.styles?
|
|
45
|
+
`,OrMwcDialog=class extends o{constructor(){super(...arguments),this._open=!1,this._popstateEventBind=t=>this._onBrowserNavigate(t)}static get styles(){return[t`${i(dialogStyle)}`,t`${i(listStyle)}`,style]}get isOpen(){return!!this._mdcComponent&&this._mdcComponent.isOpen}setOpen(t){return this._open=!0,this}setHeading(t){return this.heading=t,this}setContent(t){return this.content=t,this}setActions(t){return this.actions=t,this}setDismissAction(t){return this.dismissAction=t,this}setStyles(t){return this.styles=t,this}setAvatar(t){return this.avatar=t,this}open(){this._mdcElem&&!this._mdcComponent&&(this._mdcComponent=new r(this._mdcElem),this._mdcComponent.scrimClickAction=this.dismissAction||null===this.dismissAction?"close":""),this._mdcComponent&&this._mdcComponent.open()}close(t){this._mdcComponent&&this._mdcComponent.close(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._popstateEventBind)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._popstateEventBind),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0)}render(){return e`
|
|
46
|
+
${"string"==typeof this.styles?e`<style>${this.styles}</style>`:this.styles||""}
|
|
47
47
|
|
|
48
48
|
<div id="dialog"
|
|
49
49
|
class="mdc-dialog"
|
|
@@ -55,24 +55,24 @@ var __decorate=this&&this.__decorate||function(t,e,o,i){var n,s=arguments.length
|
|
|
55
55
|
@MDCDialog:closed="${t=>this._onDialogClosed(t.detail.action)}">
|
|
56
56
|
<div class="mdc-dialog__container">
|
|
57
57
|
<div class="mdc-dialog__surface" tabindex="0">
|
|
58
|
-
${"string"==typeof this.heading?
|
|
59
|
-
${this.content?
|
|
58
|
+
${"string"==typeof this.heading?e`<h2 class="mdc-dialog__title" id="dialog-title"><or-translate value="${this.heading}"></or-translate></h2>`:this.heading?e`<span class="mdc-dialog__title" id="dialog-title">${this.heading}</span>`:""}
|
|
59
|
+
${this.content?e`
|
|
60
60
|
<div class="dialog-container mdc-dialog__content" id="dialog-content">
|
|
61
61
|
${"function"==typeof this.content?this.content():this.content}
|
|
62
62
|
</div>
|
|
63
63
|
<footer class="mdc-dialog__actions">
|
|
64
|
-
${this.actions?this.actions.map(
|
|
64
|
+
${this.actions?this.actions.map(t=>e`
|
|
65
65
|
<div class="mdc-button mdc-dialog__button" ?data-mdc-dialog-button-default="${t.default}" data-mdc-dialog-action="${t.disabled?void 0:t.actionName}">
|
|
66
|
-
${"string"==typeof t.content?
|
|
67
|
-
</div>`)
|
|
66
|
+
${"string"==typeof t.content?e`<or-mwc-input .type="${c.BUTTON}" @or-mwc-input-changed="${t=>{t.currentTarget.disabled&&t.stopPropagation()}}" .disabled="${t.disabled}" .label="${t.content}"></or-mwc-input>`:t.content}
|
|
67
|
+
</div>`):""}
|
|
68
68
|
</footer>
|
|
69
|
-
`:
|
|
69
|
+
`:e`
|
|
70
70
|
<ul class="mdc-list ${this.avatar?"mdc-list--avatar-list":""}">
|
|
71
|
-
${this.actions?this.actions.map((
|
|
71
|
+
${!this.actions?"":this.actions.map((t,o)=>e`<li class="mdc-list-item" data-mdc-dialog-action="${t.actionName}"><span class="mdc-list-item__text">${t.content}</span></li>`)}
|
|
72
72
|
</ul>
|
|
73
73
|
`}
|
|
74
74
|
</div>
|
|
75
75
|
</div>
|
|
76
76
|
<div class="mdc-dialog__scrim"></div>
|
|
77
77
|
</div>
|
|
78
|
-
`}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}_onDialogOpened(){this.dispatchEvent(new OrMwcDialogOpenedEvent)}_onDialogClosed(t){if("close"===t&&this.dismissAction&&this.dismissAction.action)this.dismissAction.action(this);else if(t&&this.actions){
|
|
78
|
+
`}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}_onDialogOpened(){this.dispatchEvent(new OrMwcDialogOpenedEvent)}_onDialogClosed(t){if("close"===t&&this.dismissAction&&this.dismissAction.action)this.dismissAction.action(this);else if(t&&this.actions){let e=this.actions.find(e=>e.actionName===t);e&&e.action&&e.action(this)}this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0),this.dispatchEvent(new OrMwcDialogClosedEvent(t))}_onBrowserNavigate(t){this.close("close")}};__decorate([s({type:String})],OrMwcDialog.prototype,"heading",void 0),__decorate([s({type:Object,attribute:!1})],OrMwcDialog.prototype,"content",void 0),__decorate([s({type:Array,attribute:!1})],OrMwcDialog.prototype,"actions",void 0),__decorate([s({type:Object,attribute:!1})],OrMwcDialog.prototype,"dismissAction",void 0),__decorate([s({type:Boolean})],OrMwcDialog.prototype,"avatar",void 0),__decorate([s()],OrMwcDialog.prototype,"styles",void 0),__decorate([s({attribute:!1})],OrMwcDialog.prototype,"_open",void 0),__decorate([a("#dialog")],OrMwcDialog.prototype,"_mdcElem",void 0),OrMwcDialog=__decorate([n("or-mwc-dialog")],OrMwcDialog);export{OrMwcDialog};
|
package/lib/or-mwc-drawer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,r,t,a){var
|
|
1
|
+
var __decorate=this&&this.__decorate||function(e,r,t,a){var d,o=arguments.length,s=o<3?r:null===a?a=Object.getOwnPropertyDescriptor(r,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,r,t,a);else for(var i=e.length-1;i>=0;i--)(d=e[i])&&(s=(o<3?d(s):o>3?d(r,t,s):d(r,t))||s);return o>3&&s&&Object.defineProperty(r,t,s),s};import{css as e,html as r,LitElement as t,unsafeCSS as a}from"lit";import{customElement as d,property as o,query as s}from"lit/decorators.js";import{MDCDrawer as i}from"@material/drawer";import{classMap as c}from"lit/directives/class-map.js";let drawerStyle=require("@material/drawer/dist/mdc.drawer.css");export class OrMwcDrawerChangedEvent extends CustomEvent{constructor(e){super(OrMwcDrawerChangedEvent.NAME,{detail:e,bubbles:!0,composed:!0})}}OrMwcDrawerChangedEvent.NAME="or-mwc-drawer-changed";let OrMwcDrawer=class extends t{constructor(){super(...arguments),this.dismissible=!1,this.rightSided=!1,this.transparent=!1,this.open=!1}static get styles(){return[e`${a(drawerStyle)}`,e`
|
|
2
2
|
.transparent{
|
|
3
3
|
background: none;
|
|
4
|
-
}`]}toggle(){this.open=!this.open}disconnectedCallback(){super.disconnectedCallback(),this.drawer&&(this.drawer.destroy(),this.drawer=void 0)}render(){
|
|
5
|
-
<aside class="mdc-drawer ${
|
|
4
|
+
}`]}toggle(){this.open=!this.open}disconnectedCallback(){super.disconnectedCallback(),this.drawer&&(this.drawer.destroy(),this.drawer=void 0)}render(){let e=!this.dismissible,t={"mdc-drawer--dismissible":this.dismissible,"mdc-drawer--modal":e,transparent:this.transparent};return r`
|
|
5
|
+
<aside class="mdc-drawer ${c(t)}" dir="${this.rightSided?"rtl":"ltr"}">
|
|
6
6
|
${this.header}
|
|
7
7
|
<div class="mdc-drawer__content" dir="ltr">
|
|
8
8
|
<slot></slot>
|
|
9
9
|
</div>
|
|
10
|
-
</aside>`}updated(){this.drawer.open!==this.open&&(this.drawer.open=this.open)}dispatchChangedEvent(e){this.dispatchEvent(new OrMwcDrawerChangedEvent(e))}firstUpdated(){this.drawer=
|
|
10
|
+
</aside>`}updated(){this.drawer.open!==this.open&&(this.drawer.open=this.open)}dispatchChangedEvent(e){this.dispatchEvent(new OrMwcDrawerChangedEvent(e))}firstUpdated(){this.drawer=i.attachTo(this.drawerElement),this.drawer.listen("MDCDrawer:opened",()=>{this.dispatchChangedEvent(!0)}),this.drawer.listen("MDCDrawer:closed",()=>{this.dispatchChangedEvent(!1)}),this.appContent&&this.appContent.classList.add("mdc-drawer-app-content"),this.topBar&&this.topBar.classList.add("mdc-top-app-bar")}};__decorate([o({attribute:!1})],OrMwcDrawer.prototype,"header",void 0),__decorate([o({type:Boolean})],OrMwcDrawer.prototype,"dismissible",void 0),__decorate([o({type:Boolean})],OrMwcDrawer.prototype,"rightSided",void 0),__decorate([o({type:Boolean})],OrMwcDrawer.prototype,"transparent",void 0),__decorate([o({type:Boolean})],OrMwcDrawer.prototype,"open",void 0),__decorate([o({attribute:!1})],OrMwcDrawer.prototype,"appContent",void 0),__decorate([o({attribute:!1})],OrMwcDrawer.prototype,"topBar",void 0),__decorate([s(".mdc-drawer")],OrMwcDrawer.prototype,"drawerElement",void 0),OrMwcDrawer=__decorate([d("or-mwc-drawer")],OrMwcDrawer);export{OrMwcDrawer};
|