@ni/nimble-components 8.0.0 → 8.1.3
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/dist/all-components-bundle.js +73 -53
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2585 -107
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/nimble-components/src/text-field/types.d.ts +2 -1
- package/dist/esm/nimble-components/src/tree-item/index.d.ts +0 -4
- package/dist/esm/nimble-components/src/tree-view/index.d.ts +3 -0
- package/dist/esm/text-field/styles.js +34 -9
- package/dist/esm/text-field/styles.js.map +1 -1
- package/dist/esm/text-field/types.d.ts +2 -1
- package/dist/esm/text-field/types.js +1 -0
- package/dist/esm/text-field/types.js.map +1 -1
- package/dist/esm/tree-item/index.d.ts +0 -4
- package/dist/esm/tree-item/index.js +2 -45
- package/dist/esm/tree-item/index.js.map +1 -1
- package/dist/esm/tree-view/index.d.ts +3 -0
- package/dist/esm/tree-view/index.js +38 -1
- package/dist/esm/tree-view/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -18129,6 +18129,7 @@
|
|
|
18129
18129
|
TextFieldAppearance["Underline"] = "underline";
|
|
18130
18130
|
TextFieldAppearance["Outline"] = "outline";
|
|
18131
18131
|
TextFieldAppearance["Block"] = "block";
|
|
18132
|
+
TextFieldAppearance["Frameless"] = "frameless";
|
|
18132
18133
|
})(TextFieldAppearance || (TextFieldAppearance = {}));
|
|
18133
18134
|
|
|
18134
18135
|
const styles$4 = css `
|
|
@@ -18185,11 +18186,8 @@
|
|
|
18185
18186
|
border-bottom-color: ${failColor};
|
|
18186
18187
|
}
|
|
18187
18188
|
|
|
18188
|
-
:host([readonly]
|
|
18189
|
-
border:
|
|
18190
|
-
padding: 0px;
|
|
18191
|
-
padding-bottom: 1px;
|
|
18192
|
-
background-color: transparent;
|
|
18189
|
+
:host([readonly]) .root {
|
|
18190
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
18193
18191
|
}
|
|
18194
18192
|
|
|
18195
18193
|
:host([disabled]) .root {
|
|
@@ -18203,6 +18201,10 @@
|
|
|
18203
18201
|
border-bottom-color: ${borderHoverColor};
|
|
18204
18202
|
}
|
|
18205
18203
|
|
|
18204
|
+
:host([readonly]) .root:hover {
|
|
18205
|
+
--ni-private-bottom-border-width: 1px;
|
|
18206
|
+
}
|
|
18207
|
+
|
|
18206
18208
|
:host([disabled]) .root:hover {
|
|
18207
18209
|
--ni-private-bottom-border-width: 1px;
|
|
18208
18210
|
}
|
|
@@ -18302,10 +18304,6 @@
|
|
|
18302
18304
|
white-space: nowrap;
|
|
18303
18305
|
}
|
|
18304
18306
|
|
|
18305
|
-
:host(.invalid[readonly]:not([disabled])) .errortext {
|
|
18306
|
-
top: calc(${controlHeight} - ${borderWidth});
|
|
18307
|
-
}
|
|
18308
|
-
|
|
18309
18307
|
:host(.invalid) .error-text:empty {
|
|
18310
18308
|
display: none;
|
|
18311
18309
|
}
|
|
@@ -18329,6 +18327,14 @@
|
|
|
18329
18327
|
padding-left: ${borderWidth};
|
|
18330
18328
|
padding-right: ${borderWidth};
|
|
18331
18329
|
}
|
|
18330
|
+
|
|
18331
|
+
:host([disabled]) .root {
|
|
18332
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
18333
|
+
}
|
|
18334
|
+
|
|
18335
|
+
:host([disabled]) .root:hover {
|
|
18336
|
+
--ni-private-bottom-border-width: 1px;
|
|
18337
|
+
}
|
|
18332
18338
|
`), appearanceBehavior(TextFieldAppearance.Block, css `
|
|
18333
18339
|
.root {
|
|
18334
18340
|
background-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
@@ -18358,6 +18364,11 @@
|
|
|
18358
18364
|
);
|
|
18359
18365
|
}
|
|
18360
18366
|
|
|
18367
|
+
:host([readonly]) .root {
|
|
18368
|
+
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
18369
|
+
border-color: transparent;
|
|
18370
|
+
}
|
|
18371
|
+
|
|
18361
18372
|
:host([disabled]) .root {
|
|
18362
18373
|
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
18363
18374
|
}
|
|
@@ -18379,6 +18390,21 @@
|
|
|
18379
18390
|
:host(.invalid) .errortext {
|
|
18380
18391
|
top: calc(${controlHeight} - ${borderWidth});
|
|
18381
18392
|
}
|
|
18393
|
+
`), appearanceBehavior(TextFieldAppearance.Frameless, css `
|
|
18394
|
+
.root {
|
|
18395
|
+
--ni-private-bottom-border-width: 0px;
|
|
18396
|
+
padding-top: ${borderWidth};
|
|
18397
|
+
padding-left: ${borderWidth};
|
|
18398
|
+
padding-right: ${borderWidth};
|
|
18399
|
+
}
|
|
18400
|
+
|
|
18401
|
+
:host([readonly]) .root {
|
|
18402
|
+
border-color: transparent;
|
|
18403
|
+
}
|
|
18404
|
+
|
|
18405
|
+
.root:hover {
|
|
18406
|
+
--ni-private-bottom-border-width: 0px;
|
|
18407
|
+
}
|
|
18382
18408
|
`), themeBehavior(css `
|
|
18383
18409
|
${'' /* Light theme */}
|
|
18384
18410
|
.control::-ms-reveal {
|
|
@@ -18866,37 +18892,8 @@
|
|
|
18866
18892
|
*/
|
|
18867
18893
|
class TreeItem extends TreeItem$1 {
|
|
18868
18894
|
constructor() {
|
|
18869
|
-
super();
|
|
18895
|
+
super(...arguments);
|
|
18870
18896
|
this.treeView = null;
|
|
18871
|
-
this.handleClickOverride = (event) => {
|
|
18872
|
-
if (event.composedPath().includes(this.expandCollapseButton)) {
|
|
18873
|
-
// just have base class handle click event for glyph
|
|
18874
|
-
return;
|
|
18875
|
-
}
|
|
18876
|
-
const treeItem = this.getImmediateTreeItem(event.target);
|
|
18877
|
-
if (treeItem?.disabled || treeItem !== this) {
|
|
18878
|
-
// don't allow base TreeItem to emit a 'selected-change' event when a disabled item is clicked
|
|
18879
|
-
event.stopImmediatePropagation();
|
|
18880
|
-
return;
|
|
18881
|
-
}
|
|
18882
|
-
const leavesOnly = this.treeView?.selectionMode === TreeViewSelectionMode.LeavesOnly;
|
|
18883
|
-
const all = this.treeView?.selectionMode === TreeViewSelectionMode.All;
|
|
18884
|
-
const hasChildren = this.hasChildTreeItems();
|
|
18885
|
-
if ((leavesOnly && !hasChildren) || all) {
|
|
18886
|
-
const selectedTreeItem = this.getImmediateTreeItem(this.treeView?.currentSelected);
|
|
18887
|
-
// deselect currently selected item if different than this instance
|
|
18888
|
-
if (selectedTreeItem && this !== this.treeView?.currentSelected) {
|
|
18889
|
-
selectedTreeItem.selected = false;
|
|
18890
|
-
}
|
|
18891
|
-
this.selected = true;
|
|
18892
|
-
}
|
|
18893
|
-
else {
|
|
18894
|
-
// implicit (hasChildren && leavesOnly) || none, so only allow expand/collapse, not select
|
|
18895
|
-
this.expanded = !this.expanded;
|
|
18896
|
-
}
|
|
18897
|
-
// don't allow base class to process click event
|
|
18898
|
-
event.stopImmediatePropagation();
|
|
18899
|
-
};
|
|
18900
18897
|
// This prevents the toggling of selected state when a TreeItem is clicked multiple times,
|
|
18901
18898
|
// which is what the FAST TreeItem allows
|
|
18902
18899
|
this.handleSelectedChange = (event) => {
|
|
@@ -18905,7 +18902,6 @@
|
|
|
18905
18902
|
this.setGroupSelectionOnRootParentTreeItem(this);
|
|
18906
18903
|
}
|
|
18907
18904
|
};
|
|
18908
|
-
this.addEventListener('click', this.handleClickOverride);
|
|
18909
18905
|
}
|
|
18910
18906
|
connectedCallback() {
|
|
18911
18907
|
super.connectedCallback();
|
|
@@ -18917,14 +18913,9 @@
|
|
|
18917
18913
|
}
|
|
18918
18914
|
disconnectedCallback() {
|
|
18919
18915
|
super.disconnectedCallback();
|
|
18920
|
-
this.removeEventListener('click', this.handleClickOverride);
|
|
18921
18916
|
this.removeEventListener('selected-change', this.handleSelectedChange);
|
|
18922
18917
|
this.treeView = null;
|
|
18923
18918
|
}
|
|
18924
|
-
hasChildTreeItems() {
|
|
18925
|
-
const treeItemChild = this.querySelector('[role="treeitem"]');
|
|
18926
|
-
return treeItemChild !== null;
|
|
18927
|
-
}
|
|
18928
18919
|
clearTreeGroupSelection() {
|
|
18929
18920
|
const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
|
|
18930
18921
|
currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
|
|
@@ -18939,14 +18930,6 @@
|
|
|
18939
18930
|
currentItem.setAttribute(groupSelectedAttribute, 'true');
|
|
18940
18931
|
}
|
|
18941
18932
|
}
|
|
18942
|
-
getImmediateTreeItem(element) {
|
|
18943
|
-
let foundElement = element;
|
|
18944
|
-
while (foundElement
|
|
18945
|
-
&& !(foundElement?.getAttribute('role') === 'treeitem')) {
|
|
18946
|
-
foundElement = foundElement?.parentElement;
|
|
18947
|
-
}
|
|
18948
|
-
return foundElement;
|
|
18949
|
-
}
|
|
18950
18933
|
/**
|
|
18951
18934
|
* This was copied directly from the FAST TreeItem implementation
|
|
18952
18935
|
* @returns the root tree view
|
|
@@ -18994,6 +18977,43 @@
|
|
|
18994
18977
|
super(...arguments);
|
|
18995
18978
|
this.selectionMode = TreeViewSelectionMode.All;
|
|
18996
18979
|
}
|
|
18980
|
+
handleClick(e) {
|
|
18981
|
+
if (e.defaultPrevented) {
|
|
18982
|
+
// handled, do nothing
|
|
18983
|
+
return false;
|
|
18984
|
+
}
|
|
18985
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
18986
|
+
// not a tree item, ignore
|
|
18987
|
+
return true;
|
|
18988
|
+
}
|
|
18989
|
+
const item = e.target;
|
|
18990
|
+
if (item.disabled) {
|
|
18991
|
+
return false;
|
|
18992
|
+
}
|
|
18993
|
+
if (this.canSelect(item)) {
|
|
18994
|
+
item.selected = true;
|
|
18995
|
+
}
|
|
18996
|
+
else if (this.itemHasChildren(item)) {
|
|
18997
|
+
item.expanded = !item.expanded;
|
|
18998
|
+
}
|
|
18999
|
+
return true;
|
|
19000
|
+
}
|
|
19001
|
+
canSelect(item) {
|
|
19002
|
+
switch (this.selectionMode) {
|
|
19003
|
+
case TreeViewSelectionMode.All:
|
|
19004
|
+
return true;
|
|
19005
|
+
case TreeViewSelectionMode.None:
|
|
19006
|
+
return false;
|
|
19007
|
+
case TreeViewSelectionMode.LeavesOnly:
|
|
19008
|
+
return !this.itemHasChildren(item);
|
|
19009
|
+
default:
|
|
19010
|
+
return true;
|
|
19011
|
+
}
|
|
19012
|
+
}
|
|
19013
|
+
itemHasChildren(item) {
|
|
19014
|
+
const treeItemChild = item.querySelector('[role="treeitem"]');
|
|
19015
|
+
return treeItemChild !== null;
|
|
19016
|
+
}
|
|
18997
19017
|
}
|
|
18998
19018
|
__decorate([
|
|
18999
19019
|
attr({ attribute: 'selection-mode' })
|