@umbraco-ui/uui-base
Advanced tools
Comparing version 1.12.0 to 1.12.1
@@ -170,2 +170,5 @@ import { css, unsafeCSS, html } from 'lit'; | ||
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor; | ||
var __typeError$2 = (msg) => { | ||
throw TypeError(msg); | ||
}; | ||
var __decorateClass$3 = (decorators, target, key, kind) => { | ||
@@ -179,6 +182,12 @@ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target; | ||
}; | ||
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg); | ||
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); | ||
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); | ||
var __privateMethod$1 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method); | ||
const SelectableMixin = (superClass) => { | ||
var _onKeydown, _onClick, _SelectableMixinClass_instances, toggleSelect_fn, select_fn, deselect_fn; | ||
class SelectableMixinClass extends superClass { | ||
constructor(...args) { | ||
super(...args); | ||
__privateAdd$2(this, _SelectableMixinClass_instances); | ||
this._selectable = false; | ||
@@ -188,3 +197,3 @@ this.deselectable = true; | ||
this.selectableTarget = this; | ||
this.handleSelectKeydown = (e) => { | ||
__privateAdd$2(this, _onKeydown, (e) => { | ||
const composePath = e.composedPath(); | ||
@@ -194,9 +203,15 @@ if ((this._selectable || this.deselectable && this.selected) && composePath.indexOf(this.selectableTarget) === 0) { | ||
if (e.code !== "Space" && e.code !== "Enter") return; | ||
this._toggleSelect(); | ||
__privateMethod$1(this, _SelectableMixinClass_instances, toggleSelect_fn).call(this); | ||
e.preventDefault(); | ||
} | ||
} | ||
}; | ||
this.addEventListener("click", this._handleClick); | ||
this.addEventListener("keydown", this.handleSelectKeydown); | ||
}); | ||
__privateAdd$2(this, _onClick, (e) => { | ||
const composePath = e.composedPath(); | ||
if ((this._selectable || this.deselectable && this.selected) && composePath.indexOf(this.selectableTarget) === 0) { | ||
__privateMethod$1(this, _SelectableMixinClass_instances, toggleSelect_fn).call(this); | ||
} | ||
}); | ||
this.addEventListener("click", __privateGet$2(this, _onClick)); | ||
this.addEventListener("keydown", __privateGet$2(this, _onKeydown)); | ||
} | ||
@@ -214,30 +229,28 @@ get selectable() { | ||
} | ||
_select() { | ||
if (!this.selectable) return; | ||
const selectEvent = new UUISelectableEvent(UUISelectableEvent.SELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = true; | ||
} | ||
_onKeydown = new WeakMap(); | ||
_onClick = new WeakMap(); | ||
_SelectableMixinClass_instances = new WeakSet(); | ||
toggleSelect_fn = function() { | ||
if (!this.selectable) return; | ||
if (this.deselectable === false) { | ||
__privateMethod$1(this, _SelectableMixinClass_instances, select_fn).call(this); | ||
} else { | ||
this.selected ? __privateMethod$1(this, _SelectableMixinClass_instances, deselect_fn).call(this) : __privateMethod$1(this, _SelectableMixinClass_instances, select_fn).call(this); | ||
} | ||
_deselect() { | ||
if (!this.deselectable) return; | ||
const selectEvent = new UUISelectableEvent(UUISelectableEvent.DESELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = false; | ||
} | ||
_handleClick(e) { | ||
if (e.composedPath().indexOf(this.selectableTarget) !== -1) { | ||
this._toggleSelect(); | ||
} | ||
} | ||
_toggleSelect() { | ||
if (!this.selectable) return; | ||
if (this.deselectable === false) { | ||
this._select(); | ||
} else { | ||
this.selected ? this._deselect() : this._select(); | ||
} | ||
} | ||
} | ||
}; | ||
select_fn = function() { | ||
if (!this.selectable) return; | ||
const selectEvent = new UUISelectableEvent(UUISelectableEvent.SELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = true; | ||
}; | ||
deselect_fn = function() { | ||
if (!this.deselectable) return; | ||
const selectEvent = new UUISelectableEvent(UUISelectableEvent.DESELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = false; | ||
}; | ||
__decorateClass$3([ | ||
@@ -244,0 +257,0 @@ property({ type: Boolean, reflect: true }) |
@@ -95,2 +95,5 @@ import { property, state } from 'lit/decorators.js'; | ||
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor; | ||
var __typeError$2 = (msg) => { | ||
throw TypeError(msg); | ||
}; | ||
var __decorateClass$3 = (decorators, target, key, kind) => { | ||
@@ -104,6 +107,12 @@ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target; | ||
}; | ||
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg); | ||
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); | ||
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); | ||
var __privateMethod$1 = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method); | ||
const SelectableMixin = (superClass) => { | ||
var _onKeydown, _onClick, _SelectableMixinClass_instances, toggleSelect_fn, select_fn, deselect_fn; | ||
class SelectableMixinClass extends superClass { | ||
constructor(...args) { | ||
super(...args); | ||
__privateAdd$2(this, _SelectableMixinClass_instances); | ||
this._selectable = false; | ||
@@ -113,3 +122,3 @@ this.deselectable = true; | ||
this.selectableTarget = this; | ||
this.handleSelectKeydown = (e) => { | ||
__privateAdd$2(this, _onKeydown, (e) => { | ||
const composePath = e.composedPath(); | ||
@@ -119,9 +128,15 @@ if ((this._selectable || this.deselectable && this.selected) && composePath.indexOf(this.selectableTarget) === 0) { | ||
if (e.code !== "Space" && e.code !== "Enter") return; | ||
this._toggleSelect(); | ||
__privateMethod$1(this, _SelectableMixinClass_instances, toggleSelect_fn).call(this); | ||
e.preventDefault(); | ||
} | ||
} | ||
}; | ||
this.addEventListener("click", this._handleClick); | ||
this.addEventListener("keydown", this.handleSelectKeydown); | ||
}); | ||
__privateAdd$2(this, _onClick, (e) => { | ||
const composePath = e.composedPath(); | ||
if ((this._selectable || this.deselectable && this.selected) && composePath.indexOf(this.selectableTarget) === 0) { | ||
__privateMethod$1(this, _SelectableMixinClass_instances, toggleSelect_fn).call(this); | ||
} | ||
}); | ||
this.addEventListener("click", __privateGet$2(this, _onClick)); | ||
this.addEventListener("keydown", __privateGet$2(this, _onKeydown)); | ||
} | ||
@@ -139,30 +154,28 @@ get selectable() { | ||
} | ||
_select() { | ||
if (!this.selectable) return; | ||
const selectEvent = new UUISelectableEvent$1(UUISelectableEvent$1.SELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = true; | ||
} | ||
_onKeydown = new WeakMap(); | ||
_onClick = new WeakMap(); | ||
_SelectableMixinClass_instances = new WeakSet(); | ||
toggleSelect_fn = function() { | ||
if (!this.selectable) return; | ||
if (this.deselectable === false) { | ||
__privateMethod$1(this, _SelectableMixinClass_instances, select_fn).call(this); | ||
} else { | ||
this.selected ? __privateMethod$1(this, _SelectableMixinClass_instances, deselect_fn).call(this) : __privateMethod$1(this, _SelectableMixinClass_instances, select_fn).call(this); | ||
} | ||
_deselect() { | ||
if (!this.deselectable) return; | ||
const selectEvent = new UUISelectableEvent$1(UUISelectableEvent$1.DESELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = false; | ||
} | ||
_handleClick(e) { | ||
if (e.composedPath().indexOf(this.selectableTarget) !== -1) { | ||
this._toggleSelect(); | ||
} | ||
} | ||
_toggleSelect() { | ||
if (!this.selectable) return; | ||
if (this.deselectable === false) { | ||
this._select(); | ||
} else { | ||
this.selected ? this._deselect() : this._select(); | ||
} | ||
} | ||
} | ||
}; | ||
select_fn = function() { | ||
if (!this.selectable) return; | ||
const selectEvent = new UUISelectableEvent$1(UUISelectableEvent$1.SELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = true; | ||
}; | ||
deselect_fn = function() { | ||
if (!this.deselectable) return; | ||
const selectEvent = new UUISelectableEvent$1(UUISelectableEvent$1.DESELECTED); | ||
this.dispatchEvent(selectEvent); | ||
if (selectEvent.defaultPrevented) return; | ||
this.selected = false; | ||
}; | ||
__decorateClass$3([ | ||
@@ -169,0 +182,0 @@ property({ type: Boolean, reflect: true }) |
{ | ||
"name": "@umbraco-ui/uui-base", | ||
"version": "1.12.0", | ||
"version": "1.12.1", | ||
"license": "MIT", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"homepage": "https://uui.umbraco.com/?path=/story/uui-base", | ||
"gitHead": "0ac5219b2765bf6c90fe4943a6620b46a7fced4e" | ||
"gitHead": "a7d67a9f6b60b8c0b351b21d5dac49cdfc764f44" | ||
} |
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
76912
2012