ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
95 lines • 6.51 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Pipe } from '@angular/core';
var NzFilterOptionPipe = /** @class */ (function () {
function NzFilterOptionPipe() {
}
/**
* @param {?} options
* @param {?} searchValue
* @param {?} filterOption
* @param {?} serverSearch
* @return {?}
*/
NzFilterOptionPipe.prototype.transform = /**
* @param {?} options
* @param {?} searchValue
* @param {?} filterOption
* @param {?} serverSearch
* @return {?}
*/
function (options, searchValue, filterOption, serverSearch) {
if (serverSearch || !searchValue) {
return options;
}
else {
return ((/** @type {?} */ (options))).filter((/**
* @param {?} o
* @return {?}
*/
function (o) { return filterOption(searchValue, o); }));
}
};
NzFilterOptionPipe.decorators = [
{ type: Pipe, args: [{ name: 'nzFilterOption' },] }
];
return NzFilterOptionPipe;
}());
export { NzFilterOptionPipe };
var NzFilterGroupOptionPipe = /** @class */ (function () {
function NzFilterGroupOptionPipe() {
}
/**
* @param {?} groups
* @param {?} searchValue
* @param {?} filterOption
* @param {?} serverSearch
* @return {?}
*/
NzFilterGroupOptionPipe.prototype.transform = /**
* @param {?} groups
* @param {?} searchValue
* @param {?} filterOption
* @param {?} serverSearch
* @return {?}
*/
function (groups, searchValue, filterOption, serverSearch) {
if (serverSearch || !searchValue) {
return groups;
}
else {
return ((/** @type {?} */ (groups))).filter((/**
* @param {?} g
* @return {?}
*/
function (g) {
return g.listOfNzOptionComponent.some((/**
* @param {?} o
* @return {?}
*/
function (o) { return filterOption(searchValue, o); }));
}));
}
};
NzFilterGroupOptionPipe.decorators = [
{ type: Pipe, args: [{ name: 'nzFilterGroupOption' },] }
];
return NzFilterGroupOptionPipe;
}());
export { NzFilterGroupOptionPipe };
/**
* @param {?} searchValue
* @param {?} option
* @return {?}
*/
export function defaultFilterOption(searchValue, option) {
if (option && option.nzLabel) {
return option.nzLabel.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