ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
444 lines • 33.5 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import * as tslib_1 from "tslib";
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, QueryList, Renderer2, TemplateRef, ViewChildren, ViewEncapsulation } from '@angular/core';
import { of, Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { InputBoolean } from '../core/util/convert';
import { NzI18nService } from '../i18n/nz-i18n.service';
import { NzTransferListComponent } from './nz-transfer-list.component';
var NzTransferComponent = /** @class */ (function () {
// #endregion
function NzTransferComponent(cdr, i18n, renderer, elementRef) {
var _this = this;
this.cdr = cdr;
this.i18n = i18n;
this.unsubscribe$ = new Subject();
// tslint:disable-next-line:no-any
this.locale = {};
this.leftFilter = '';
this.rightFilter = '';
// #region fields
this.nzDisabled = false;
this.nzDataSource = [];
this.nzTitles = ['', ''];
this.nzOperations = [];
this.nzCanMove = (/**
* @param {?} arg
* @return {?}
*/
function (arg) { return of(arg.list); });
this.nzShowSearch = false;
// events
this.nzChange = new EventEmitter();
this.nzSearchChange = new EventEmitter();
this.nzSelectChange = new EventEmitter();
// #endregion
// #region process data
// left
this.leftDataSource = [];
// right
this.rightDataSource = [];
this.handleLeftSelectAll = (/**
* @param {?} checked
* @return {?}
*/
function (checked) { return _this.handleSelect('left', checked); });
this.handleRightSelectAll = (/**
* @param {?} checked
* @return {?}
*/
function (checked) { return _this.handleSelect('right', checked); });
this.handleLeftSelect = (/**
* @param {?} item
* @return {?}
*/
function (item) { return _this.handleSelect('left', !!item.checked, item); });
this.handleRightSelect = (/**
* @param {?} item
* @return {?}
*/
function (item) { return _this.handleSelect('right', !!item.checked, item); });
// #endregion
// #region operation
this.leftActive = false;
this.rightActive = false;
this.moveToLeft = (/**
* @return {?}
*/
function () { return _this.moveTo('left'); });
this.moveToRight = (/**
* @return {?}
*/
function () { return _this.moveTo('right'); });
renderer.addClass(elementRef.nativeElement, 'ant-transfer');
}
/**
* @private
* @return {?}
*/
NzTransferComponent.prototype.splitDataSource = /**
* @private
* @return {?}
*/
function () {
var _this = this;
this.leftDataSource = [];
this.rightDataSource = [];
this.nzDataSource.forEach((/**
* @param {?} record
* @return {?}
*/
function (record) {
if (record.direction === 'right') {
_this.rightDataSource.push(record);
}
else {
_this.leftDataSource.push(record);
}
}));
};
/**
* @private
* @param {?} direction
* @return {?}
*/
NzTransferComponent.prototype.getCheckedData = /**
* @private
* @param {?} direction
* @return {?}
*/
function (direction) {
return this[direction === 'left' ? 'leftDataSource' : 'rightDataSource'].filter((/**
* @param {?} w
* @return {?}
*/
function (w) { return w.checked; }));
};
/**
* @param {?} direction
* @param {?} checked
* @param {?=} item
* @return {?}
*/
NzTransferComponent.prototype.handleSelect = /**
* @param {?} direction
* @param {?} checked
* @param {?=} item
* @return {?}
*/
function (direction, checked, item) {
/** @type {?} */
var list = this.getCheckedData(direction);
this.updateOperationStatus(direction, list.length);
this.nzSelectChange.emit({ direction: direction, checked: checked, list: list, item: item });
};
/**
* @param {?} ret
* @return {?}
*/
NzTransferComponent.prototype.handleFilterChange = /**
* @param {?} ret
* @return {?}
*/
function (ret) {
this.nzSearchChange.emit(ret);
};
/**
* @private
* @param {?} direction
* @param {?=} count
* @return {?}
*/
NzTransferComponent.prototype.updateOperationStatus = /**
* @private
* @param {?} direction
* @param {?=} count
* @return {?}
*/
function (direction, count) {
this[direction === 'right' ? 'leftActive' : 'rightActive'] =
(typeof count === 'undefined' ? this.getCheckedData(direction).filter((/**
* @param {?} w
* @return {?}
*/
function (w) { return !w.disabled; })).length : count) > 0;
};
/**
* @param {?} direction
* @return {?}
*/
NzTransferComponent.prototype.moveTo = /**
* @param {?} direction
* @return {?}
*/
function (direction) {
var _this = this;
/** @type {?} */
var oppositeDirection = direction === 'left' ? 'right' : 'left';
this.updateOperationStatus(oppositeDirection, 0);
/** @type {?} */
var datasource = direction === 'left' ? this.rightDataSource : this.leftDataSource;
/** @type {?} */
var moveList = datasource.filter((/**
* @param {?} item
* @return {?}
*/
function (item) { return item.checked === true && !item.disabled; }));
this.nzCanMove({ direction: direction, list: moveList }).subscribe((/**
* @param {?} newMoveList
* @return {?}
*/
function (newMoveList) { return _this.truthMoveTo(direction, newMoveList.filter((/**
* @param {?} i
* @return {?}
*/
function (i) { return !!i; }))); }), (/**
* @return {?}
*/
function () { return moveList.forEach((/**
* @param {?} i
* @return {?}
*/
function (i) { return (i.checked = false); })); }));
};
/**
* @private
* @param {?} direction
* @param {?} list
* @return {?}
*/
NzTransferComponent.prototype.truthMoveTo = /**
* @private
* @param {?} direction
* @param {?} list
* @return {?}
*/
function (direction, list) {
var e_1, _a;
/** @type {?} */
var oppositeDirection = direction === 'left' ? 'right' : 'left';
/** @type {?} */
var datasource = direction === 'left' ? this.rightDataSource : this.leftDataSource;
/** @type {?} */
var targetDatasource = direction === 'left' ? this.leftDataSource : this.rightDataSource;
try {
for (var list_1 = tslib_1.__values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) {
var item = list_1_1.value;
item.checked = false;
item._hiden = false;
datasource.splice(datasource.indexOf(item), 1);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (list_1_1 && !list_1_1.done && (_a = list_1.return)) _a.call(list_1);
}
finally { if (e_1) throw e_1.error; }
}
targetDatasource.splice.apply(targetDatasource, tslib_1.__spread([0, 0], list));
this.updateOperationStatus(oppositeDirection);
this.nzChange.emit({
from: oppositeDirection,
to: direction,
list: list
});
this.markForCheckAllList();
};
/**
* @private
* @return {?}
*/
NzTransferComponent.prototype.markForCheckAllList = /**
* @private
* @return {?}
*/
function () {
if (!this.lists) {
return;
}
this.lists.forEach((/**
* @param {?} i
* @return {?}
*/
function (i) { return i.markForCheck(); }));
};
/**
* @return {?}
*/
NzTransferComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
var _this = this;
this.i18n.localeChange.pipe(takeUntil(this.unsubscribe$)).subscribe((/**
* @return {?}
*/
function () {
_this.locale = _this.i18n.getLocaleData('Transfer');
_this.markForCheckAllList();
}));
};
/**
* @param {?} changes
* @return {?}
*/
NzTransferComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if ('nzDataSource' in changes) {
this.splitDataSource();
this.updateOperationStatus('left');
this.updateOperationStatus('right');
this.cdr.detectChanges();
this.markForCheckAllList();
}
};
/**
* @return {?}
*/
NzTransferComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
this.unsubscribe$.next();
this.unsubscribe$.complete();
};
NzTransferComponent.decorators = [
{ type: Component, args: [{
selector: 'nz-transfer',
preserveWhitespaces: false,
template: "<nz-transfer-list class=\"ant-transfer-list\" [ngStyle]=\"nzListStyle\" data-direction=\"left\"\n [titleText]=\"nzTitles[0]\"\n [dataSource]=\"leftDataSource\"\n [filter]=\"leftFilter\"\n [filterOption]=\"nzFilterOption\"\n (filterChange)=\"handleFilterChange($event)\"\n [render]=\"nzRender\"\n [disabled]=\"nzDisabled\"\n [showSearch]=\"nzShowSearch\"\n [searchPlaceholder]=\"nzSearchPlaceholder || locale.searchPlaceholder\"\n [notFoundContent]=\"nzNotFoundContent\"\n [itemUnit]=\"nzItemUnit || locale.itemUnit\"\n [itemsUnit]=\"nzItemsUnit || locale.itemsUnit\"\n [footer]=\"nzFooter\"\n (handleSelect)=\"handleLeftSelect($event)\"\n (handleSelectAll)=\"handleLeftSelectAll($event)\">\n</nz-transfer-list>\n<div class=\"ant-transfer-operation\">\n <button nz-button (click)=\"moveToLeft()\" [disabled]=\"nzDisabled || !leftActive\" [nzType]=\"'primary'\" [nzSize]=\"'small'\">\n <i nz-icon type=\"left\"></i><span *ngIf=\"nzOperations[1]\">{{ nzOperations[1] }}</span>\n </button>\n <button nz-button (click)=\"moveToRight()\" [disabled]=\"nzDisabled || !rightActive\" [nzType]=\"'primary'\" [nzSize]=\"'small'\">\n <i nz-icon type=\"right\"></i><span *ngIf=\"nzOperations[0]\">{{ nzOperations[0] }}</span>\n </button>\n</div>\n<nz-transfer-list class=\"ant-transfer-list\" [ngStyle]=\"nzListStyle\" data-direction=\"right\"\n [titleText]=\"nzTitles[1]\"\n [dataSource]=\"rightDataSource\"\n [filter]=\"rightFilter\"\n [filterOption]=\"nzFilterOption\"\n (filterChange)=\"handleFilterChange($event)\"\n [render]=\"nzRender\"\n [disabled]=\"nzDisabled\"\n [showSearch]=\"nzShowSearch\"\n [searchPlaceholder]=\"nzSearchPlaceholder || locale.searchPlaceholder\"\n [notFoundContent]=\"nzNotFoundContent\"\n [itemUnit]=\"nzItemUnit || locale.itemUnit\"\n [itemsUnit]=\"nzItemsUnit || locale.itemsUnit\"\n [footer]=\"nzFooter\"\n (handleSelect)=\"handleRightSelect($event)\"\n (handleSelectAll)=\"handleRightSelectAll($event)\">\n</nz-transfer-list>",
host: {
'[class.ant-transfer-disabled]': 'nzDisabled'
},
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
}] }
];
/** @nocollapse */
NzTransferComponent.ctorParameters = function () { return [
{ type: ChangeDetectorRef },
{ type: NzI18nService },
{ type: Renderer2 },
{ type: ElementRef }
]; };
NzTransferComponent.propDecorators = {
lists: [{ type: ViewChildren, args: [NzTransferListComponent,] }],
nzDisabled: [{ type: Input }],
nzDataSource: [{ type: Input }],
nzTitles: [{ type: Input }],
nzOperations: [{ type: Input }],
nzListStyle: [{ type: Input }],
nzItemUnit: [{ type: Input }],
nzItemsUnit: [{ type: Input }],
nzCanMove: [{ type: Input }],
nzRender: [{ type: Input }],
nzFooter: [{ type: Input }],
nzShowSearch: [{ type: Input }],
nzFilterOption: [{ type: Input }],
nzSearchPlaceholder: [{ type: Input }],
nzNotFoundContent: [{ type: Input }],
nzChange: [{ type: Output }],
nzSearchChange: [{ type: Output }],
nzSelectChange: [{ type: Output }]
};
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzTransferComponent.prototype, "nzDisabled", void 0);
tslib_1.__decorate([
InputBoolean(),
tslib_1.__metadata("design:type", Object)
], NzTransferComponent.prototype, "nzShowSearch", void 0);
return NzTransferComponent;
}());
export { NzTransferComponent };
if (false) {
/**
* @type {?}
* @private
*/
NzTransferComponent.prototype.unsubscribe$;
/**
* @type {?}
* @private
*/
NzTransferComponent.prototype.lists;
/** @type {?} */
NzTransferComponent.prototype.locale;
/** @type {?} */
NzTransferComponent.prototype.leftFilter;
/** @type {?} */
NzTransferComponent.prototype.rightFilter;
/** @type {?} */
NzTransferComponent.prototype.nzDisabled;
/** @type {?} */
NzTransferComponent.prototype.nzDataSource;
/** @type {?} */
NzTransferComponent.prototype.nzTitles;
/** @type {?} */
NzTransferComponent.prototype.nzOperations;
/** @type {?} */
NzTransferComponent.prototype.nzListStyle;
/** @type {?} */
NzTransferComponent.prototype.nzItemUnit;
/** @type {?} */
NzTransferComponent.prototype.nzItemsUnit;
/** @type {?} */
NzTransferComponent.prototype.nzCanMove;
/** @type {?} */
NzTransferComponent.prototype.nzRender;
/** @type {?} */
NzTransferComponent.prototype.nzFooter;
/** @type {?} */
NzTransferComponent.prototype.nzShowSearch;
/** @type {?} */
NzTransferComponent.prototype.nzFilterOption;
/** @type {?} */
NzTransferComponent.prototype.nzSearchPlaceholder;
/** @type {?} */
NzTransferComponent.prototype.nzNotFoundContent;
/** @type {?} */
NzTransferComponent.prototype.nzChange;
/** @type {?} */
NzTransferComponent.prototype.nzSearchChange;
/** @type {?} */
NzTransferComponent.prototype.nzSelectChange;
/** @type {?} */
NzTransferComponent.prototype.leftDataSource;
/** @type {?} */
NzTransferComponent.prototype.rightDataSource;
/** @type {?} */
NzTransferComponent.prototype.handleLeftSelectAll;
/** @type {?} */
NzTransferComponent.prototype.handleRightSelectAll;
/** @type {?} */
NzTransferComponent.prototype.handleLeftSelect;
/** @type {?} */
NzTransferComponent.prototype.handleRightSelect;
/** @type {?} */
NzTransferComponent.prototype.leftActive;
/** @type {?} */
NzTransferComponent.prototype.rightActive;
/** @type {?} */
NzTransferComponent.prototype.moveToLeft;
/** @type {?} */
NzTransferComponent.prototype.moveToRight;
/**
* @type {?}
* @private
*/
NzTransferComponent.prototype.cdr;
/**
* @type {?}
* @private
*/
NzTransferComponent.prototype.i18n;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnotdHJhbnNmZXIuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbInRyYW5zZmVyL256LXRyYW5zZmVyLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFDTCx1QkFBdUIsRUFDdkIsaUJBQWlCLEVBQ2pCLFNBQVMsRUFDVCxVQUFVLEVBQ1YsWUFBWSxFQUNaLEtBQUssRUFJTCxNQUFNLEVBQ04sU0FBUyxFQUNULFNBQVMsRUFFVCxXQUFXLEVBQ1gsWUFBWSxFQUNaLGlCQUFpQixFQUNsQixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUUsRUFBRSxFQUFjLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUMvQyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFFM0MsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3BELE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUd4RCxPQUFPLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSw4QkFBOEIsQ0FBQztBQUV2RTtJQWlJRSxhQUFhO0lBRWIsNkJBQ1UsR0FBc0IsRUFDdEIsSUFBbUIsRUFDM0IsUUFBbUIsRUFDbkIsVUFBc0I7UUFKeEIsaUJBT0M7UUFOUyxRQUFHLEd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