input-deep-search
Version:
1.Use npm to install the package
16 lines (14 loc) • 3.24 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("input-deep-search",["exports","@angular/core","@angular/common"],t):t((e=e||self)["input-deep-search"]={},e.ng.core,e.ng.common)}(this,(function(e,t,r){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function n(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function o(e){return void 0===e&&(e=700),function(t,r,n){var o=null,i=n.value;return n.value=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];clearTimeout(o),o=setTimeout((function(){return i.apply(t,r)}),e)},n}}var i=function(){function e(){this.filteredData=new t.EventEmitter}return Object.defineProperty(e.prototype,"searchText",{set:function(e){this.searchTextData=e.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"").toLowerCase()},enumerable:!0,configurable:!0}),e.prototype.onInputsearch=function(e){for(var t=[],r=0;r<this.jsonData.length;r++)this.getObject(this.jsonData[r],this.searchTextData,this.dataProperties)&&t.push(this.jsonData[r]);this.filteredData.emit(t)},e.prototype.getObject=function(e,t,r){if(e instanceof Array){for(var n=0;n<e.length;n++)if(this.getObject(e[n],t,r))return!0}else for(var o in e){if(e[o]instanceof Object||e[o]instanceof Array)return this.getObject(e[o],t,r);if((!(r.length>0)||r.includes(o))&&e[o].replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"").toLowerCase().includes(t))return!0}return null},n([t.Input("jsonData")],e.prototype,"jsonData",void 0),n([t.Input("dataProperties")],e.prototype,"dataProperties",void 0),n([t.Input("searchText")],e.prototype,"searchText",null),n([t.Output()],e.prototype,"filteredData",void 0),n([t.HostListener("window:keyup",["$event"]),o()],e.prototype,"onInputsearch",null),e=n([t.Directive({selector:"[appInputSearch]"})],e)}(),a=function(){function e(){}return e=n([t.NgModule({declarations:[i],imports:[r.CommonModule],exports:[i]})],e)}();e.InputSearchDirectiveModule=a,e.ɵa=i,e.ɵb=o,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=input-deep-search.umd.min.js.map