@digital-realty/ix-search-bar 2.1.36 → 2.1.37
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{css,LitElement,html}from"lit";import{property}from"lit/decorators.js";import"@digital-realty/ix-textbox";
|
|
1
|
+
import{__decorate}from"tslib";import{css,LitElement,html}from"lit";import{property}from"lit/decorators.js";import"@digital-realty/ix-textbox";let IxSearchBarStyle=css`:host{display:flex;justify-content:space-between;align-items:center;border:1px solid #d3d3d3;border-width:1px 0;padding:1rem 0;flex-wrap:wrap;margin-bottom:1.5rem}html{color:#333}ix-textbox{color:#333;flex:1 0 min(280px,100%)}.items-count{flex:1000 0 7em;text-align:right;padding:.5em 0}`;class IxSearchBar extends LitElement{constructor(){super(...arguments),this.value="",this.items=[],this.searchFields=[],this.foundItems=[]}static get styles(){return[IxSearchBarStyle]}connectedCallback(){super.connectedCallback(),this.resetResults()}resetResults(){this.foundItems=this.items}get itemsCount(){return Array.isArray(this.foundItems)&&this.foundItems.length?this.foundItems.length:0}get itemsLabel(){return 1===this.itemsCount?"item":"items"}_dispatchEvent(t){t=new CustomEvent("onResultsFound",{detail:{items:t},composed:!0});this.dispatchEvent(t)}filterItems(t){if(""===(this.value=t))this.resetResults(),this._dispatchEvent(this.items);else{var e,s=[];for(e of this.items)for(var r of this.searchFields)if(r in e&&e[r].toLocaleLowerCase().includes(this.value.toLocaleLowerCase())){s.push(e);break}this.foundItems=s,this._dispatchEvent(s)}}render(){return html`<ix-textbox type="search" @textChange="${t=>this.filterItems(t.detail.value)}"></ix-textbox><div class="items-count">${this.itemsCount} ${this.itemsLabel}</div>`}}__decorate([property({type:String})],IxSearchBar.prototype,"value",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"items",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"searchFields",void 0),__decorate([property({type:Array})],IxSearchBar.prototype,"foundItems",void 0),window.customElements.define("ix-search-bar",IxSearchBar);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent ix-search-bar following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Digital Realty",
|
|
6
|
-
"version": "2.1.
|
|
6
|
+
"version": "2.1.37",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@digital-realty/ix-textbox": "^2.1.
|
|
30
|
+
"@digital-realty/ix-textbox": "^2.1.38",
|
|
31
31
|
"@lit/react": "^1.0.2",
|
|
32
32
|
"lit": "^2.0.2",
|
|
33
33
|
"react": "^18.2.0"
|
|
@@ -104,5 +104,5 @@
|
|
|
104
104
|
"README.md",
|
|
105
105
|
"LICENSE"
|
|
106
106
|
],
|
|
107
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "024e4b85148c7a248e9f283e35085f512e7c3b1e"
|
|
108
108
|
}
|