@microsoft/fast-foundation
Advanced tools
Comparing version 3.0.0-alpha.17 to 3.0.0-alpha.18
@@ -107,11 +107,2 @@ import { ARIAGlobalStatesAndProperties, StartEnd, StartEndOptions } from "../patterns/index.js"; | ||
/** | ||
* @internal | ||
*/ | ||
disconnectedCallback(): void; | ||
/** | ||
* Prevent events to propagate if disabled and has no slotted content wrapped in HTML elements | ||
* @internal | ||
*/ | ||
private handleClick; | ||
/** | ||
* Submits the parent form | ||
@@ -118,0 +109,0 @@ */ |
@@ -65,2 +65,8 @@ import { FASTElement, SyntheticViewTemplate } from "@microsoft/fast-element"; | ||
/** | ||
* Readonly property identifying the element as a tree item | ||
* | ||
* @internal | ||
*/ | ||
readonly isTreeItem: boolean; | ||
/** | ||
* Whether the item is focusable | ||
@@ -128,3 +134,3 @@ * | ||
*/ | ||
childItemLength(): number; | ||
get childItemLength(): number; | ||
} | ||
@@ -131,0 +137,0 @@ /** |
@@ -23,12 +23,2 @@ import { __decorate } from "tslib"; | ||
/** | ||
* Prevent events to propagate if disabled and has no slotted content wrapped in HTML elements | ||
* @internal | ||
*/ | ||
this.handleClick = (e) => { | ||
var _a; | ||
if (this.disabled && ((_a = this.defaultSlottedContent) === null || _a === void 0 ? void 0 : _a.length) <= 1) { | ||
e.stopPropagation(); | ||
} | ||
}; | ||
/** | ||
* Submits the parent form | ||
@@ -122,26 +112,6 @@ */ | ||
connectedCallback() { | ||
var _a; | ||
super.connectedCallback(); | ||
this.proxy.setAttribute("type", this.type); | ||
this.handleUnsupportedDelegatesFocus(); | ||
const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children); | ||
if (elements) { | ||
elements.forEach((span) => { | ||
span.addEventListener("click", this.handleClick); | ||
}); | ||
} | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
disconnectedCallback() { | ||
var _a; | ||
super.disconnectedCallback(); | ||
const elements = Array.from((_a = this.control) === null || _a === void 0 ? void 0 : _a.children); | ||
if (elements) { | ||
elements.forEach((span) => { | ||
span.removeEventListener("click", this.handleClick); | ||
}); | ||
} | ||
} | ||
} | ||
@@ -148,0 +118,0 @@ __decorate([ |
@@ -1,2 +0,2 @@ | ||
import { Observable, } from "@microsoft/fast-element"; | ||
import { Observable } from "@microsoft/fast-element"; | ||
class DerivedValueEvaluator { | ||
@@ -3,0 +3,0 @@ constructor(value) { |
@@ -13,4 +13,3 @@ import { __decorate } from "tslib"; | ||
export function isTreeItemElement(el) { | ||
return (isHTMLElement(el) && | ||
(el.getAttribute("role") === "treeitem" || el.tagName.includes("TREE-ITEM"))); | ||
return isHTMLElement(el) && el.isTreeItem; | ||
} | ||
@@ -45,2 +44,8 @@ /** | ||
/** | ||
* Readonly property identifying the element as a tree item | ||
* | ||
* @internal | ||
*/ | ||
this.isTreeItem = true; | ||
/** | ||
* Whether the item is focusable | ||
@@ -129,7 +134,8 @@ * | ||
*/ | ||
childItemLength() { | ||
const treeChildren = this.childItems.filter((item) => { | ||
return isTreeItemElement(item); | ||
}); | ||
return treeChildren ? treeChildren.length : 0; | ||
get childItemLength() { | ||
var _a; | ||
if (this.$fastController.isConnected) { | ||
return (_a = this.childItems) === null || _a === void 0 ? void 0 : _a.filter(item => isTreeItemElement(item)).length; | ||
} | ||
return 0; | ||
} | ||
@@ -136,0 +142,0 @@ } |
@@ -15,3 +15,3 @@ import { elements } from "@microsoft/fast-element"; | ||
tabindex="-1" | ||
aria-expanded="${x => x.childItems && x.childItemLength() > 0 ? x.expanded : void 0}" | ||
aria-expanded="${x => x.childItems && x.childItemLength > 0 ? x.expanded : void 0}" | ||
aria-selected="${x => x.selected}" | ||
@@ -28,3 +28,3 @@ aria-disabled="${x => x.disabled}" | ||
<div class="content-region" part="content-region"> | ||
${when(x => x.childItems && x.childItemLength(), html ` | ||
${when(x => x.childItems && x.childItemLength > 0, html ` | ||
<div | ||
@@ -47,3 +47,3 @@ aria-hidden="true" | ||
</div> | ||
${when(x => x.childItems && x.childItemLength() && x.expanded, html ` | ||
${when(x => x.childItems && x.childItemLength > 0 && x.expanded, html ` | ||
<div role="group" class="items" part="items"> | ||
@@ -50,0 +50,0 @@ <slot name="item" ${slotted("items")}></slot> |
@@ -85,3 +85,3 @@ import { __decorate } from "tslib"; | ||
if (item instanceof FASTTreeItem && | ||
item.childItemLength() > 0 && | ||
item.childItemLength > 0 && | ||
item.expanded) { | ||
@@ -100,8 +100,7 @@ item.expanded = false; | ||
if (item instanceof FASTTreeItem && | ||
item.childItemLength() > 0 && | ||
item.childItemLength > 0 && | ||
!item.expanded) { | ||
item.expanded = true; | ||
} | ||
else if (item instanceof FASTTreeItem && | ||
item.childItemLength() > 0) { | ||
else if (item instanceof FASTTreeItem && item.childItemLength > 0) { | ||
this.focusNextNode(1, e.target); | ||
@@ -108,0 +107,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"sideEffects": false, | ||
"version": "3.0.0-alpha.17", | ||
"version": "3.0.0-alpha.18", | ||
"author": { | ||
@@ -81,2 +81,3 @@ "name": "Microsoft", | ||
"express": "^4.18.1", | ||
"expect": "29.2.1", | ||
"prettier": "2.0.2", | ||
@@ -98,3 +99,3 @@ "qs": "^6.11.0", | ||
"dependencies": { | ||
"@microsoft/fast-element": "^2.0.0-beta.14", | ||
"@microsoft/fast-element": "^2.0.0-beta.15", | ||
"@microsoft/fast-web-utilities": "^6.0.0", | ||
@@ -101,0 +102,0 @@ "tabbable": "^5.2.0", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
466
5114873
31
131277