@operato/input
Advanced tools
Comparing version 0.2.45 to 0.2.46
@@ -6,2 +6,18 @@ # Change Log | ||
### [0.2.46](https://github.com/hatiolab/operato/compare/v0.2.45...v0.2.46) (2021-12-12) | ||
### :rocket: New Features | ||
* add operato/board modeller ([2acd6b3](https://github.com/hatiolab/operato/commit/2acd6b31a4d91317fa84ecee67874d2242968ec6)) | ||
### :bug: Bug Fix | ||
* ox-button-radio add mutation observer ([8e59f63](https://github.com/hatiolab/operato/commit/8e59f633b435113841850423d2bd72ff1389fa98)) | ||
* remove duplicated files ([215e60b](https://github.com/hatiolab/operato/commit/215e60b693983aae387fd23ea2f510eb411c7dac)) | ||
* upgrade @hatiolab/things-scene@2.7.27 ([961c586](https://github.com/hatiolab/operato/commit/961c586b067bed39c486fc4231b2a8abd3e8b1f7)) | ||
### [0.2.45](https://github.com/hatiolab/operato/compare/v0.2.44...v0.2.45) (2021-12-11) | ||
@@ -8,0 +24,0 @@ |
@@ -24,8 +24,11 @@ /** | ||
mandatory: boolean; | ||
_slotObserver: MutationObserver; | ||
render(): import("lit-html").TemplateResult<1>; | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
updated(changes: PropertyValues<this>): void; | ||
get buttons(): Element[]; | ||
_onValueChanged(value: Object | null): void; | ||
_onChanged(): void; | ||
_onTapButton(e: Event): void; | ||
protected appendFormData({ formData }: FormDataEvent): void; | ||
} |
@@ -6,3 +6,3 @@ /** | ||
import { css, html } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import { customElement, property, state } from 'lit/decorators.js'; | ||
import { OxFormField } from './ox-formfield'; | ||
@@ -27,2 +27,5 @@ /** | ||
this.value = null; | ||
this._slotObserver = new MutationObserver(mutations => { | ||
this._onChanged(); | ||
}); | ||
} | ||
@@ -32,4 +35,14 @@ render() { | ||
} | ||
connectedCallback() { | ||
var _a; | ||
super.connectedCallback(); | ||
(_a = this._slotObserver) === null || _a === void 0 ? void 0 : _a.observe(this, { childList: true }); | ||
} | ||
disconnectedCallback() { | ||
var _a; | ||
super.disconnectedCallback(); | ||
(_a = this._slotObserver) === null || _a === void 0 ? void 0 : _a.disconnect(); | ||
} | ||
updated(changes) { | ||
changes.has('value') && this._onValueChanged(this.value); | ||
changes.has('value') && this._onChanged(); | ||
} | ||
@@ -39,5 +52,5 @@ get buttons() { | ||
} | ||
_onValueChanged(value) { | ||
_onChanged() { | ||
this.buttons.forEach(button => { | ||
if (value === button.getAttribute('value')) { | ||
if (this.value === button.getAttribute('value')) { | ||
button.setAttribute('active', ''); | ||
@@ -52,5 +65,3 @@ } | ||
var target = e.target; | ||
while (!target.hasAttribute('value') && target !== this) { | ||
target = target.parentElement; | ||
} | ||
target = target.closest('[value]'); | ||
if (target === this) { | ||
@@ -99,2 +110,5 @@ return; | ||
], PropertyButtonsRadio.prototype, "mandatory", void 0); | ||
__decorate([ | ||
state() | ||
], PropertyButtonsRadio.prototype, "_slotObserver", void 0); | ||
PropertyButtonsRadio = __decorate([ | ||
@@ -101,0 +115,0 @@ customElement('ox-buttons-radio') |
@@ -6,3 +6,3 @@ { | ||
"author": "heartyoh@hatiolab.com", | ||
"version": "0.2.45", | ||
"version": "0.2.46", | ||
"main": "dist/src/index.js", | ||
@@ -36,3 +36,3 @@ "module": "dist/src/index.js", | ||
"@material/mwc-icon": "^0.25.3", | ||
"@operato/popup": "^0.2.45", | ||
"@operato/popup": "^0.2.46", | ||
"@zxing/library": "^0.18.6", | ||
@@ -73,3 +73,3 @@ "lit": "^2.0.2" | ||
}, | ||
"gitHead": "443daca83ed888a12671bc35f8298c400eaa8a43" | ||
"gitHead": "70591a39c0b794a2a7765e9fcddb3e716ae95ecf" | ||
} |
@@ -5,4 +5,4 @@ /** | ||
import { css, html, PropertyValues } from 'lit' | ||
import { customElement, property } from 'lit/decorators.js' | ||
import { PropertyValues, css, html } from 'lit' | ||
import { customElement, property, query, state } from 'lit/decorators.js' | ||
@@ -38,2 +38,6 @@ import { OxFormField } from './ox-formfield' | ||
@state() _slotObserver: MutationObserver = new MutationObserver(mutations => { | ||
this._onChanged() | ||
}) | ||
render() { | ||
@@ -43,4 +47,16 @@ return html` <slot @click=${(e: Event) => this._onTapButton(e)}></slot> ` | ||
connectedCallback() { | ||
super.connectedCallback() | ||
this._slotObserver?.observe(this, { childList: true }) | ||
} | ||
disconnectedCallback() { | ||
super.disconnectedCallback() | ||
this._slotObserver?.disconnect() | ||
} | ||
updated(changes: PropertyValues<this>) { | ||
changes.has('value') && this._onValueChanged(this.value) | ||
changes.has('value') && this._onChanged() | ||
} | ||
@@ -52,5 +68,5 @@ | ||
_onValueChanged(value: Object | null) { | ||
_onChanged() { | ||
this.buttons.forEach(button => { | ||
if (value === button.getAttribute('value')) { | ||
if (this.value === button.getAttribute('value')) { | ||
button.setAttribute('active', '') | ||
@@ -65,7 +81,4 @@ } else { | ||
var target = e.target as HTMLElement | ||
target = target.closest('[value]') as HTMLElement | ||
while (!target.hasAttribute('value') && target !== this) { | ||
target = target.parentElement! | ||
} | ||
if (target === this) { | ||
@@ -72,0 +85,0 @@ return |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238587
2153
Updated@operato/popup@^0.2.46