ngx-easy-table
Version:
Angular easy table
57 lines • 4.47 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Pipe } from '@angular/core';
var GlobalSearchPipe = /** @class */ (function () {
function GlobalSearchPipe() {
}
/**
* @param {?} array
* @param {?} filter
* @param {?} filteredCountSubject
* @return {?}
*/
GlobalSearchPipe.prototype.transform = /**
* @param {?} array
* @param {?} filter
* @param {?} filteredCountSubject
* @return {?}
*/
function (array, filter, filteredCountSubject) {
filteredCountSubject.next(0);
if (typeof array === 'undefined') {
return;
}
if (typeof filter === 'undefined' || Object.keys(filter).length === 0 || filter === '') {
filteredCountSubject.next(array.length);
return array;
}
/** @type {?} */
var arr = array.filter((/**
* @param {?} row
* @return {?}
*/
function (row) {
/** @type {?} */
var element = JSON.stringify(Object.values(row));
/** @type {?} */
var strings = filter.split(',');
return strings.some((/**
* @param {?} string
* @return {?}
*/
function (string) { return element.toLocaleLowerCase().indexOf(string.trim().toLocaleLowerCase()) > -1; }));
}));
filteredCountSubject.next(arr.length);
return arr;
};
GlobalSearchPipe.decorators = [
{ type: Pipe, args: [{
name: 'global',
},] }
];
return GlobalSearchPipe;
}());
export { GlobalSearchPipe };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsLXNlYXJjaC1waXBlLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmd4LWVhc3ktdGFibGUvIiwic291cmNlcyI6WyJsaWIvcGlwZXMvZ2xvYmFsLXNlYXJjaC1waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFpQixNQUFNLGVBQWUsQ0FBQztBQUdwRDtJQUFBO0lBdUJBLENBQUM7Ozs7Ozs7SUFsQkMsb0NBQVM7Ozs7OztJQUFULFVBQVUsS0FBWSxFQUFFLE1B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