ng-zorro-antd-mobile
Version:
An enterprise-class mobile UI components based on Ant Design and Angular
94 lines (93 loc) • 9.72 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
import { Component, TemplateRef, ViewEncapsulation } from '@angular/core';
var ActionSheetComponent = /** @class */ (function () {
function ActionSheetComponent() {
this.props = {
prefixCls: 'am-action-sheet',
cancelButtonText: '取消'
};
this.flag = '';
this.title = '';
this.message = '';
this.transitionName = '';
this.maskTransitionName = '';
this.activeClassName = [this.props.prefixCls + "-button-list-item-active"];
}
/**
* @param {?} flag
* @return {?}
*/
ActionSheetComponent.prototype.showShare = /**
* @param {?} flag
* @return {?}
*/
function (flag) {
var _a;
/** @type {?} */
var cls = (_a = {}, _a[this.props.prefixCls + "-share"] = flag === 'SHARE', _a);
return cls;
};
/**
* @param {?} value
* @return {?}
*/
ActionSheetComponent.prototype.isTemplateRef = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value) {
return value instanceof TemplateRef;
}
return false;
};
/**
* @param {?} options
* @param {?} value
* @return {?}
*/
ActionSheetComponent.prototype.isArray = /**
* @param {?} options
* @param {?} value
* @return {?}
*/
function (options, value) {
if (options.length > 0 && value) {
return value instanceof Array;
}
return false;
};
ActionSheetComponent.decorators = [
{ type: Component, args: [{
selector: 'ActionSheet',
template: "<div class=\"{{props.prefixCls}}-mask {{maskTransitionName}}\"></div>\n<div class=\"{{props.prefixCls}}-wrap {{transitionName}}\" (click)=\"onPress(-1, 0, $event)\">\n <div role=\"document\"\n class=\"{{props.prefixCls}}\"\n [ngClass]=\"showShare(flag)\">\n <div class=\"{{props.prefixCls}}-content\">\n <button aria-label=\"Close\" class=\"{{props.prefixCls}}-close\">\n <span class=\"{{props.prefixCls}}-close-x\"></span>\n </button>\n <div class=\"{{props.prefixCls}}-body\">\n <div>\n <ng-template *ngIf=\"isTemplateRef(title)\" [ngTemplateOutlet]=\"title\"></ng-template>\n <h3 *ngIf=\"!isTemplateRef(title)\" class=\"{{props.prefixCls}}-title\">{{title}}</h3>\n <ng-template *ngIf=\"isTemplateRef(message)\" [ngTemplateOutlet]=\"message\"></ng-template>\n <div *ngIf=\"!isTemplateRef(message)\" class=\"{{props.prefixCls}}-message\">{{message}}</div>\n <ng-container [ngSwitch]=\"flag\">\n <div *ngSwitchCase=\"'NORMAL'\" class=\"{{props.prefixCls}}-button-list\" role=\"group\">\n <ng-container *ngFor=\"let item of options; let i = index;\">\n <TouchFeedBack class=\"{{props.prefixCls}}-button-list-item\" [activeClassName]=\"activeClassName\" >\n <div *ngIf=\"destructiveButtonIndex !== i && cancelButtonIndex !== i\"\n class=\"{{props.prefixCls}}-button-list-item\"\n (click)=\"onPress(i, 0, $event)\"\n >\n {{item}}\n </div>\n <div *ngIf=\"destructiveButtonIndex === i\"\n class=\"{{props.prefixCls}}-button-list-item {{props.prefixCls}}-destructive-button\"\n (click)=\"onPress(i, 0, $event)\"\n >\n {{item}}\n </div>\n <div *ngIf=\"cancelButtonIndex === i\"\n class=\"{{props.prefixCls}}-button-list-item {{props.prefixCls}}-cancel-button\"\n (click)=\"onPress(i, 0, $event)\"\n >\n {{item}}\n <span class=\"{{props.prefixCls}}-cancel-button-mask\"></span>\n </div>\n </TouchFeedBack>\n </ng-container>\n </div>\n <div *ngSwitchCase=\"'SHARE'\" class=\"{{props.prefixCls}}-share {{props.prefixCls}}-share-content\">\n <div *ngIf=\"!isArray(options, options[0])\" class=\"{{props.prefixCls}}-share-list\">\n <ng-container *ngFor=\"let item of options; let i = index;\">\n <div class=\"{{props.prefixCls}}-share-list-item\" (click)=\"onPress(i, 0, $event)\">\n <div class=\"{{props.prefixCls}}-share-list-item-icon\">\n <ng-template *ngIf=\"isTemplateRef(item.icon)\" [ngTemplateOutlet]=\"item.icon\"></ng-template>\n <div *ngIf=\"!isTemplateRef(item.icon)\" [innerHTML]=\"item.icon | safeHTML\"></div>\n </div>\n <div class=\"{{props.prefixCls}}-share-list-item-title\">{{item.title}}</div>\n </div>\n </ng-container>\n </div>\n <ng-container *ngIf=\"isArray(options, options[0])\">\n <div *ngFor=\"let items of options; let rowIndex = index\" class=\"{{props.prefixCls}}-share-list\">\n <ng-container *ngFor=\"let item of items; let i = index;\">\n <div class=\"{{props.prefixCls}}-share-list-item\" (click)=\"onPress(i, rowIndex, $event)\">\n <div class=\"{{props.prefixCls}}-share-list-item-icon\">\n <ng-template *ngIf=\"isTemplateRef(item.icon)\" [ngTemplateOutlet]=\"item.icon\"></ng-template>\n <div *ngIf=\"!isTemplateRef(item.icon)\" [innerHTML]=\"item.icon | safeHTML\"></div>\n </div>\n <div class=\"{{props.prefixCls}}-share-list-item-title\">{{item.title}}</div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n <div class=\"{{props.prefixCls}}-share-cancel-button\">{{props.cancelButtonText}}</div>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n </div>\n</div>",
encapsulation: ViewEncapsulation.None
}] }
];
/** @nocollapse */
ActionSheetComponent.ctorParameters = function () { return []; };
return ActionSheetComponent;
}());
export { ActionSheetComponent };
if (false) {
/** @type {?} */
ActionSheetComponent.prototype.props;
/** @type {?} */
ActionSheetComponent.prototype.flag;
/** @type {?} */
ActionSheetComponent.prototype.title;
/** @type {?} */
ActionSheetComponent.prototype.message;
/** @type {?} */
ActionSheetComponent.prototype.transitionName;
/** @type {?} */
ActionSheetComponent.prototype.maskTransitionName;
/** @type {?} */
ActionSheetComponent.prototype.activeClassName;
/** @type {?} */
ActionSheetComponent.prototype.onPress;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWN0aW9uLXNoZWV0LmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLXpvcnJvLWFudGQtbW9iaWxlLyIsInNvdXJjZXMiOlsiYWN0aW9uLXNoZWV0L2FjdGlvbi1zaGVldC5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7OztBQUFBLE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