@openremote/or-attribute-picker 1.13.1 → 1.14.0-snapshot

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.
@@ -21,4 +21,4 @@ var __decorate=this&&this.__decorate||function(t,e,s,i){var r,o=arguments.length
21
21
  </div>
22
22
  </div>
23
23
  `}_setDialogActions(){this.actions=[{actionName:"cancel",content:"cancel"},{actionName:"add",content:o`
24
- <or-mwc-input id="add-btn" class="button" label="add" .type="${u.BUTTON}"></or-mwc-input>`,action:()=>{this.addBtn.disabled||this.dispatchEvent(new OrAssetTypeAttributePickerPickedEvent(this.selectedAttributes))}}]}_onAssetTypeItemClick(t){this._selectedAssetType=t.data.name}_onAttributesSelect(t){var e;return this._selectedAssetType?this._loadedAttributeTypes?void this.selectedAttributes.set(this._selectedAssetType,null==(e=this._loadedAttributeTypes)?void 0:e.filter(e=>t.includes(e.name))):void console.warn("Could not select attribute, since the attribute list seems to be empty?"):void console.warn("Could not select attribute, since no asset type seemed to be selected.")}_getAssetTypeDescriptors(t,e,s){let i=null==t?void 0:t.map(t=>({styleMap:{"--or-icon-fill":t.colour?"#"+t.colour:"unset"},icon:t.icon,trailingIcon:(null==e?void 0:e.includes(t))?"cloud-upload-outline":void 0,text:d.getAssetTypeLabel(t),value:t.name,data:t})).sort((t,e)=>("agent"!==t.data.descriptorType)-("agent"!==e.data.descriptorType)||t.text.localeCompare(e.text));return s&&(null==i||i.splice(0,0,s)),i}_getAssetDescriptorByName(t){var e;return t?null==(e=this._loadedAssetTypes)?void 0:e.find(e=>e.name===t):void 0}};__decorate([e()],OrAssetTypeAttributePicker.prototype,"assetTypeFilter",void 0),__decorate([e()],OrAssetTypeAttributePicker.prototype,"attributeFilter",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_selectedAssetType",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_loadedAttributeTypes",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_loadedAssetTypes",void 0),OrAssetTypeAttributePicker=__decorate([t("or-assettype-attribute-picker")],OrAssetTypeAttributePicker);export{OrAssetTypeAttributePicker};
24
+ <or-mwc-input id="add-btn" class="button" label="add" .type="${u.BUTTON}"></or-mwc-input>`,action:()=>{this.addBtn.disabled||this.dispatchEvent(new OrAssetTypeAttributePickerPickedEvent(this.selectedAttributes))}}]}_onAssetTypeItemClick(t){this._selectedAssetType=t.data.name}_onAttributesSelect(t){var e;this._selectedAssetType?this._loadedAttributeTypes?this.selectedAttributes.set(this._selectedAssetType,null==(e=this._loadedAttributeTypes)?void 0:e.filter(e=>t.includes(e.name))):console.warn("Could not select attribute, since the attribute list seems to be empty?"):console.warn("Could not select attribute, since no asset type seemed to be selected.")}_getAssetTypeDescriptors(t,e,s){let i=null==t?void 0:t.map(t=>({styleMap:{"--or-icon-fill":t.colour?"#"+t.colour:"unset"},icon:t.icon,trailingIcon:(null==e?void 0:e.includes(t))?"cloud-upload-outline":void 0,text:d.getAssetTypeLabel(t),value:t.name,data:t})).sort((t,e)=>("agent"!==t.data.descriptorType)-("agent"!==e.data.descriptorType)||t.text.localeCompare(e.text));return s&&(null==i||i.splice(0,0,s)),i}_getAssetDescriptorByName(t){var e;return t?null==(e=this._loadedAssetTypes)?void 0:e.find(e=>e.name===t):void 0}};__decorate([e()],OrAssetTypeAttributePicker.prototype,"assetTypeFilter",void 0),__decorate([e()],OrAssetTypeAttributePicker.prototype,"attributeFilter",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_selectedAssetType",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_loadedAttributeTypes",void 0),__decorate([s()],OrAssetTypeAttributePicker.prototype,"_loadedAssetTypes",void 0),OrAssetTypeAttributePicker=__decorate([t("or-assettype-attribute-picker")],OrAssetTypeAttributePicker);export{OrAssetTypeAttributePicker};
@@ -1,27 +1,27 @@
1
- var __decorate=this&&this.__decorate||function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s},__awaiter=this&&this.__awaiter||function(t,e,o,r){return new(o||(o=Promise))(function(i,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?i(t.value):((e=t.value)instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((r=r.apply(t,e||[])).next())})};import{html as t,unsafeCSS as e}from"lit";import{property as o,query as r}from"lit/decorators.js";import"@openremote/or-asset-tree";import"@openremote/or-translate";import"@openremote/or-mwc-components/or-mwc-input";import"@openremote/or-mwc-components/or-mwc-list";import{InputType as i}from"@openremote/or-mwc-components/or-mwc-input";import{i18next as n}from"@openremote/or-translate";import{DefaultColor2 as s,DefaultColor4 as a,DefaultColor5 as l,Util as c}from"@openremote/core";import{OrMwcDialog as p}from"@openremote/or-mwc-components/or-mwc-dialog";import{when as u}from"lit/directives/when.js";import{ListType as m}from"@openremote/or-mwc-components/or-mwc-list";export class AttributePickerPickedEvent extends CustomEvent{}export class AttributePicker extends p{constructor(){super(...arguments),this.multiSelect=!1,this.showOnlyDatapointAttrs=!1,this.showOnlyRuleStateAttrs=!1}connectedCallback(){super.connectedCallback(),this.heading=n.t("selectAttributes"),this._setDialogContent(),this._setDialogActions(),this.dismissAction=null,this.styles=this._getStyles()}setShowOnlyDatapointAttrs(t){return this.showOnlyDatapointAttrs=t,this}setShowOnlyRuleStateAttrs(t){return this.showOnlyRuleStateAttrs=t,this}setMultiSelect(t){return this.multiSelect=t,this}setOpen(t){return super.setOpen(t),this}setHeading(t){return super.setHeading(t),this}setContent(t){throw Error("Cannot modify attribute picker content")}setActions(t){throw Error("Cannot modify attribute picker actions")}setDismissAction(t){throw Error("Cannot modify attribute picker dismiss action")}setStyles(t){throw Error("Cannot modify attribute picker styles")}setAvatar(t){throw Error("Cannot modify attribute picker avatar setting")}_updateDialogContent(){this._setDialogContent()}_updateDialogActions(){this._setDialogActions()}_getAttributesTemplate(e,o,r){return __awaiter(this,arguments,void 0,function*(e,o,r,s=!1,a){let l=Math.max((null==e?void 0:e.length)||0,(null==o?void 0:o.length)||0),p=[];for(let t=0;t<l;t++)p.push({text:c.getAttributeLabel(null==e?void 0:e[t],null==o?void 0:o[t],void 0,!0),value:(null==e?void 0:e[t].name)||(null==o?void 0:o[t].name)});return t`
2
- ${u(s,()=>t`
3
- <or-mwc-list id="attribute-selector" .type="${m.MULTI_CHECKBOX}" .listItems="${p}" .values="${r}"
4
- @or-mwc-list-changed="${t=>null==a?void 0:a(t.detail.map(t=>t.value))}"
1
+ var __decorate=this&&this.__decorate||function(t,e,o,r){var i,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(n<3?i(s):n>3?i(e,o,s):i(e,o))||s);return n>3&&s&&Object.defineProperty(e,o,s),s},__awaiter=this&&this.__awaiter||function(t,e,o,r){return new(o||(o=Promise))(function(i,n){function s(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?i(t.value):((e=t.value)instanceof o?e:new o(function(t){t(e)})).then(s,a)}l((r=r.apply(t,e||[])).next())})};import{html as t,unsafeCSS as e}from"lit";import{property as o,query as r}from"lit/decorators.js";import"@openremote/or-asset-tree";import{i18next as i}from"@openremote/or-translate";import{InputType as n}from"@openremote/or-mwc-components/or-mwc-input";import{ListType as s}from"@openremote/or-mwc-components/or-mwc-list";import{DefaultColor2 as a,DefaultColor4 as l,DefaultColor5 as c,Util as u}from"@openremote/core";import{OrMwcDialog as p}from"@openremote/or-mwc-components/or-mwc-dialog";import{when as d}from"lit/directives/when.js";export class AttributePickerPickedEvent extends CustomEvent{}export class AttributePicker extends p{constructor(){super(...arguments),this.multiSelect=!1,this.showOnlyDatapointAttrs=!1,this.showOnlyRuleStateAttrs=!1}connectedCallback(){super.connectedCallback(),this.heading=i.t("selectAttributes"),this._setDialogContent(),this._setDialogActions(),this.dismissAction=null,this.styles=this._getStyles()}setShowOnlyDatapointAttrs(t){return this.showOnlyDatapointAttrs=t,this}setShowOnlyRuleStateAttrs(t){return this.showOnlyRuleStateAttrs=t,this}setMultiSelect(t){return this.multiSelect=t,this}setOpen(t){return super.setOpen(t),this}setHeading(t){return super.setHeading(t),this}setContent(t){throw Error("Cannot modify attribute picker content")}setActions(t){throw Error("Cannot modify attribute picker actions")}setDismissAction(t){throw Error("Cannot modify attribute picker dismiss action")}setStyles(t){throw Error("Cannot modify attribute picker styles")}setAvatar(t){throw Error("Cannot modify attribute picker avatar setting")}_updateDialogContent(){this._setDialogContent()}_updateDialogActions(){this._setDialogActions()}_getAttributesTemplate(e,o,r){return __awaiter(this,arguments,void 0,function*(e,o,r,a=!1,l){let c=Math.max((null==e?void 0:e.length)||0,(null==o?void 0:o.length)||0),p=[];for(let t=0;t<c;t++)p.push({text:u.getAttributeLabel(null==e?void 0:e[t],null==o?void 0:o[t],void 0,!0),value:(null==e?void 0:e[t].name)||(null==o?void 0:o[t].name)});return t`
2
+ ${d(a,()=>t`
3
+ <or-mwc-list id="attribute-selector" .type="${s.MULTI_CHECKBOX}" .listItems="${p}" .values="${r}"
4
+ @or-mwc-list-changed="${t=>null==l?void 0:l(t.detail.map(t=>t.value))}"
5
5
  </or-mwc-list>
6
6
  `,()=>t`
7
- <or-mwc-input id="attribute-selector" .type="${i.LIST}" .options="${null==p?void 0:p.map(t=>[t,t.text])}"
8
- style="display:flex;" .label="${n.t("attribute")}"
9
- @or-mwc-input-changed="${t=>null==a?void 0:a([t.detail.value.value])}"
7
+ <or-mwc-input id="attribute-selector" .type="${n.LIST}" .options="${null==p?void 0:p.map(t=>[t,t.text])}"
8
+ style="display:flex;" .label="${i.t("attribute")}"
9
+ @or-mwc-input-changed="${t=>null==l?void 0:l([t.detail.value.value])}"
10
10
  ></or-mwc-input>
11
11
  `)}
12
12
  `})}_getStyles(){return`
13
13
  .attributes-header {
14
14
  line-height: 48px;
15
15
  padding: 0 15px;
16
- background-color: ${e(s)};
16
+ background-color: ${e(a)};
17
17
  font-weight: bold;
18
- border-bottom: 1px solid ${e(s)};
18
+ border-bottom: 1px solid ${e(a)};
19
19
  }
20
20
  footer.mdc-dialog__actions {
21
- border-top: 1px solid ${e(l)};
21
+ border-top: 1px solid ${e(c)};
22
22
  }
23
23
  #header {
24
- background-color: ${e(a)} !important;
24
+ background-color: ${e(l)} !important;
25
25
  }
26
26
  #dialog-content {
27
27
  padding: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openremote/or-attribute-picker",
3
- "version": "1.13.1",
3
+ "version": "1.14.0-snapshot",
4
4
  "description": "OpenRemote attribute picker dialog",
5
5
  "customElements": "custom-elements.json",
6
6
  "main": "dist/umd/index.bundle.js",
@@ -21,13 +21,16 @@
21
21
  "author": "OpenRemote",
22
22
  "license": "AGPL-3.0-or-later",
23
23
  "dependencies": {
24
- "@openremote/core": "1.13.1",
25
- "@openremote/model": "1.13.1",
26
- "@openremote/or-asset-tree": "1.13.1",
27
- "@openremote/or-mwc-components": "1.13.1",
28
- "@openremote/or-translate": "1.13.1",
24
+ "@openremote/core": "1.14.0-snapshot",
25
+ "@openremote/model": "1.14.0-snapshot",
26
+ "@openremote/or-asset-tree": "1.14.0-snapshot",
27
+ "@openremote/or-mwc-components": "1.14.0-snapshot",
28
+ "@openremote/or-translate": "1.14.0-snapshot",
29
29
  "lit": "^3.3.1"
30
30
  },
31
+ "devDependencies": {
32
+ "@openremote/util": "1.14.0-snapshot"
33
+ },
31
34
  "publishConfig": {
32
35
  "access": "public"
33
36
  }