ng-zorro-antd-mobile
Version:
An enterprise-class mobile UI components based on Ant Design and Angular
1,739 lines (1,712 loc) • 772 kB
JavaScript
import { Component, Input, HostBinding, NgModule, ViewEncapsulation, TemplateRef, ElementRef, Renderer2, EventEmitter, forwardRef, ViewChild, Output, InjectionToken, Injectable, Inject, Optional, SkipSelf, ApplicationRef, ComponentFactoryResolver, NgZone, HostListener, Pipe, ContentChildren, ChangeDetectionStrategy, ChangeDetectorRef, Injector, Directive, ViewContainerRef, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
import { BehaviorSubject, Subject, merge } from 'rxjs';
import { takeUntil, startWith } from 'rxjs/operators';
import { trigger, state, style, transition, animate } from '@angular/animations';
import { DomSanitizer } from '@angular/platform-browser';
import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
import { ComponentPortal } from '@angular/cdk/portal';
import { ObserversModule } from '@angular/cdk/observers';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class ActivityIndicatorComponent {
constructor() {
this.prefixCls = 'am-activity-indicator';
this.spinnerClass = {};
this._size = 'small';
this._toast = false;
this._animating = true;
this.clsActIndicator = true;
}
/**
* @return {?}
*/
get animating() {
return this._animating;
}
/**
* @param {?} v
* @return {?}
*/
set animating(v) {
this._animating = v;
this.setClass();
}
/**
* @param {?} v
* @return {?}
*/
set size(v) {
this._size = v;
this.setClass();
}
/**
* @return {?}
*/
get toast() {
return this._toast;
}
/**
* @param {?} v
* @return {?}
*/
set toast(v) {
this._toast = v;
this.setClass();
}
/**
* @return {?}
*/
get text() {
return this._text;
}
/**
* @param {?} v
* @return {?}
*/
set text(v) {
this._text = v;
}
/**
* @return {?}
*/
setClass() {
if (this._animating) {
this.clsActIndicator = true;
this.clsActIndicatorToast = !!this._toast;
this.clsActIndicatorLg = this._size === 'large';
this.clsActIndicatorSm = this._size === 'small';
this.spinnerClass = {
[`${this.prefixCls}-spinner`]: true,
[`${this.prefixCls}-spinner-lg`]: !!this._toast || this._size === 'large'
};
}
else {
this.clsActIndicator = false;
this.clsActIndicatorLg = false;
this.clsActIndicatorSm = false;
this.clsActIndicatorToast = false;
}
}
/**
* @return {?}
*/
ngOnInit() {
this.setClass();
}
}
ActivityIndicatorComponent.decorators = [
{ type: Component, args: [{
selector: 'ActivityIndicator , nzm-ctivity-indicator',
template: "<div *ngIf=\"animating && toast && text && text.length > 0\">\n <div class=\"{{ prefixCls }}-content\">\n <span [ngClass]=\"spinnerClass\" aria-hidden=\"'true'\"></span>\n <span class=\"{{ prefixCls }}-toast\">{{ text }}</span>\n </div>\n</div>\n<div *ngIf=\"animating && toast && !text\">\n <div class=\"{{ prefixCls }}-content\">\n <span [ngClass]=\"spinnerClass\" aria-label=\"'Loading'\"></span>\n </div>\n</div>\n<div *ngIf=\"animating && !toast && text && text.length > 0\">\n <span [ngClass]=\"spinnerClass\" aria-hidden=\"true\"></span>\n <span class=\"{{ prefixCls }}-tip\">{{ text }}</span>\n</div>\n<div *ngIf=\"animating && !toast && !text\">\n <span [ngClass]=\"spinnerClass\" aria-label=\"'loading'\"></span>\n</div>\n"
}] }
];
/** @nocollapse */
ActivityIndicatorComponent.ctorParameters = () => [];
ActivityIndicatorComponent.propDecorators = {
animating: [{ type: Input }],
size: [{ type: Input }],
toast: [{ type: Input }],
text: [{ type: Input }],
clsActIndicator: [{ type: HostBinding, args: ['class.am-activity-indicator',] }],
clsActIndicatorToast: [{ type: HostBinding, args: ['class.am-activity-indicator-toast',] }],
clsActIndicatorLg: [{ type: HostBinding, args: ['class.am-activity-indicator-lg',] }],
clsActIndicatorSm: [{ type: HostBinding, args: ['class.am-activity-indicator-sm',] }]
};
if (false) {
/** @type {?} */
ActivityIndicatorComponent.prototype.prefixCls;
/** @type {?} */
ActivityIndicatorComponent.prototype.spinnerClass;
/**
* @type {?}
* @private
*/
ActivityIndicatorComponent.prototype._text;
/**
* @type {?}
* @private
*/
ActivityIndicatorComponent.prototype._size;
/**
* @type {?}
* @private
*/
ActivityIndicatorComponent.prototype._toast;
/**
* @type {?}
* @private
*/
ActivityIndicatorComponent.prototype._animating;
/** @type {?} */
ActivityIndicatorComponent.prototype.clsActIndicator;
/** @type {?} */
ActivityIndicatorComponent.prototype.clsActIndicatorToast;
/** @type {?} */
ActivityIndicatorComponent.prototype.clsActIndicatorLg;
/** @type {?} */
ActivityIndicatorComponent.prototype.clsActIndicatorSm;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class ActivityIndicatorModule {
}
ActivityIndicatorModule.decorators = [
{ type: NgModule, args: [{
exports: [ActivityIndicatorComponent],
declarations: [ActivityIndicatorComponent],
imports: [CommonModule, FormsModule]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CardComponent {
constructor() {
this.full = false;
this.cardWrapper = true;
}
/**
* @return {?}
*/
get cardFull() {
return this.full;
}
}
CardComponent.decorators = [
{ type: Component, args: [{
selector: 'Card, nzm-card',
template: "<ng-content></ng-content>\n",
encapsulation: ViewEncapsulation.None
}] }
];
/** @nocollapse */
CardComponent.ctorParameters = () => [];
CardComponent.propDecorators = {
full: [{ type: Input }],
cardWrapper: [{ type: HostBinding, args: ['class.am-card',] }],
cardFull: [{ type: HostBinding, args: ['class.am-card-full',] }]
};
if (false) {
/** @type {?} */
CardComponent.prototype.full;
/** @type {?} */
CardComponent.prototype.cardWrapper;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CardHeaderComponent {
constructor() {
this.prefixCls = 'am-card-header';
this.thumb = null;
this.thumbStyle = null;
this.title = null;
this.extra = null;
this.cardBodyWrapper = true;
}
/**
* @param {?} value
* @return {?}
*/
isTemplateRef(value) {
return value instanceof TemplateRef;
}
}
CardHeaderComponent.decorators = [
{ type: Component, args: [{
selector: 'CardHeader, nzm-card-header',
template: "<div class=\"{{ prefixCls }}-content\">\n <img *ngIf=\"thumb && !isTemplateRef(thumb)\" src=\"{{ thumb }}\" [ngStyle]=\"thumbStyle\" />\n <ng-container *ngIf=\"thumb && isTemplateRef(thumb)\" [ngTemplateOutlet]=\"thumb\"></ng-container>\n <ng-container *ngIf=\"!isTemplateRef(title); else titleTemplate\">{{ title }}</ng-container>\n</div>\n<div *ngIf=\"extra\" class=\"{{ prefixCls }}-extra\">\n <ng-container *ngIf=\"!isTemplateRef(extra); else extraTemplate\">{{ extra }}</ng-container>\n</div>\n<ng-template #titleTemplate>\n <ng-template [ngTemplateOutlet]=\"title\"></ng-template>\n</ng-template>\n<ng-template #extraTemplate>\n <ng-template [ngTemplateOutlet]=\"extra\"></ng-template>\n</ng-template>\n",
encapsulation: ViewEncapsulation.None
}] }
];
/** @nocollapse */
CardHeaderComponent.ctorParameters = () => [];
CardHeaderComponent.propDecorators = {
thumb: [{ type: Input }],
thumbStyle: [{ type: Input }],
title: [{ type: Input }],
extra: [{ type: Input }],
cardBodyWrapper: [{ type: HostBinding, args: ['class.am-card-header',] }]
};
if (false) {
/** @type {?} */
CardHeaderComponent.prototype.prefixCls;
/** @type {?} */
CardHeaderComponent.prototype.thumb;
/** @type {?} */
CardHeaderComponent.prototype.thumbStyle;
/** @type {?} */
CardHeaderComponent.prototype.title;
/** @type {?} */
CardHeaderComponent.prototype.extra;
/** @type {?} */
CardHeaderComponent.prototype.cardBodyWrapper;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CardBodyComponent {
constructor() {
this.cardBodyWrapper = true;
}
}
CardBodyComponent.decorators = [
{ type: Component, args: [{
selector: 'CardBody, nzm-card-body',
template: `
<ng-content></ng-content>
`,
encapsulation: ViewEncapsulation.None
}] }
];
/** @nocollapse */
CardBodyComponent.ctorParameters = () => [];
CardBodyComponent.propDecorators = {
cardBodyWrapper: [{ type: HostBinding, args: ['class.am-card-body',] }]
};
if (false) {
/** @type {?} */
CardBodyComponent.prototype.cardBodyWrapper;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CardFooterComponent {
constructor() {
this.prefixCls = 'am-card-footer';
this.content = null;
this.extra = null;
this.cardFooterWrapper = true;
}
/**
* @param {?} value
* @return {?}
*/
isTemplateRef(value) {
return value instanceof TemplateRef;
}
}
CardFooterComponent.decorators = [
{ type: Component, args: [{
selector: 'CardFooter, nzm-card-footer',
template: "<div class=\"{{ prefixCls }}-content\">\n <ng-container *ngIf=\"!isTemplateRef(content); else contentTemplate\">{{ content }}</ng-container>\n</div>\n<div *ngIf=\"extra\" class=\"{{ prefixCls }}-extra\">\n <ng-container *ngIf=\"!isTemplateRef(extra); else extraTemplate\">{{ extra }}</ng-container>\n</div>\n<ng-template #contentTemplate>\n <ng-template [ngTemplateOutlet]=\"content\"></ng-template>\n</ng-template>\n<ng-template #extraTemplate>\n <ng-template [ngTemplateOutlet]=\"extra\"></ng-template>\n</ng-template>\n",
encapsulation: ViewEncapsulation.None
}] }
];
/** @nocollapse */
CardFooterComponent.ctorParameters = () => [];
CardFooterComponent.propDecorators = {
content: [{ type: Input }],
extra: [{ type: Input }],
cardFooterWrapper: [{ type: HostBinding, args: ['class.am-card-footer',] }]
};
if (false) {
/** @type {?} */
CardFooterComponent.prototype.prefixCls;
/** @type {?} */
CardFooterComponent.prototype.content;
/** @type {?} */
CardFooterComponent.prototype.extra;
/** @type {?} */
CardFooterComponent.prototype.cardFooterWrapper;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CardModule {
}
CardModule.decorators = [
{ type: NgModule, args: [{
imports: [CommonModule],
declarations: [CardComponent, CardHeaderComponent, CardBodyComponent, CardFooterComponent],
exports: [CardComponent, CardHeaderComponent, CardBodyComponent, CardFooterComponent]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class BadgeComponent {
/**
* @param {?} _ref
* @param {?} render
*/
constructor(_ref, render) {
this._ref = _ref;
this.render = render;
this.prefixCls = 'am-badge';
this.scrollNumberCls = {};
this.style = {};
this._size = 'small';
this._dot = false;
this._hot = false;
this._corner = false;
this._children = false;
this._overflowCount = 99;
this.clsBadge = true;
this.clsBadgeWrp = !this._children;
this.clsBadgeCornerWrp = this._corner;
this.clsBadgeHot = !!this._hot;
this.clsBadgeCornerWrpLg = this._corner && this._size === 'large';
}
/**
* @param {?} v
* @return {?}
*/
set size(v) {
this._size = v;
this.setCls();
}
/**
* @return {?}
*/
get text() {
return this._text;
}
/**
* @param {?} v
* @return {?}
*/
set text(v) {
this._text = v;
this.setCls();
}
/**
* @param {?} v
* @return {?}
*/
set corner(v) {
this._corner = v;
this.setCls();
}
/**
* @return {?}
*/
get dot() {
return this._dot;
}
/**
* @param {?} v
* @return {?}
*/
set dot(v) {
this._dot = v;
if (this._dot) {
this._text = '';
}
this.setCls();
}
/**
* @param {?} v
* @return {?}
*/
set overflowCount(v) {
this._overflowCount = v;
}
/**
* @param {?} v
* @return {?}
*/
set hot(v) {
this._hot = v;
this.setCls();
}
/**
* @param {?} v
* @return {?}
*/
set setStyle(v) {
this.style = v;
}
/**
* @param {?} v
* @return {?}
*/
set className(v) {
this._setClass = v;
/** @type {?} */
const clsArr = this._setClass.split(' ');
clsArr.forEach((/**
* @param {?} cls
* @return {?}
*/
cls => {
this.render.addClass(this._ref.nativeElement, cls);
}));
}
/**
* @return {?}
*/
setCls() {
this.scrollNumberCls = {
[`${this.prefixCls}-dot`]: this._dot,
[`${this.prefixCls}-dot-large`]: this._dot && this._size === 'large',
[`${this.prefixCls}-text`]: !this._dot && !this._corner,
[`${this.prefixCls}-corner`]: this._corner,
[`${this.prefixCls}-corner-large`]: this._corner && this._size === 'large'
};
this.clsBadgeWrp = !this._children;
this.clsBadgeCornerWrp = this._corner;
this.clsBadgeHot = !!this._hot;
this.clsBadgeCornerWrpLg = this._corner && this._size === 'large';
}
/**
* @return {?}
*/
ngOnChanges() {
if (typeof this._text === 'number' && this._text > this._overflowCount) {
this._text = this._overflowCount + '+';
}
}
/**
* @return {?}
*/
ngOnInit() {
this.setCls();
}
/**
* @return {?}
*/
ngAfterViewInit() {
setTimeout((/**
* @return {?}
*/
() => {
if (this._ref.nativeElement.children.length > 1 ||
(this._ref.nativeElement.children.length === 1 && !this.dot && !this.text)) {
this._children = true;
this.setCls();
}
}), 10);
}
}
BadgeComponent.decorators = [
{ type: Component, args: [{
selector: 'Badge, nzm-badge',
template: "<ng-content></ng-content>\n<sup *ngIf=\"dot || text\" [ngClass]=\"scrollNumberCls\" [ngStyle]=\"style\">\n <span>{{ text }}</span>\n</sup>\n"
}] }
];
/** @nocollapse */
BadgeComponent.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 }
];
BadgeComponent.propDecorators = {
size: [{ type: Input }],
text: [{ type: Input }],
corner: [{ type: Input }],
dot: [{ type: Input }],
overflowCount: [{ type: Input }],
hot: [{ type: Input }],
setStyle: [{ type: Input }],
className: [{ type: Input }],
clsBadge: [{ type: HostBinding, args: ['class.am-badge',] }],
clsBadgeWrp: [{ type: HostBinding, args: ['class.am-badge-not-a-wrapper',] }],
clsBadgeCornerWrp: [{ type: HostBinding, args: ['class.am-badge-corner-wrapper',] }],
clsBadgeHot: [{ type: HostBinding, args: ['class.am-badge-hot',] }],
clsBadgeCornerWrpLg: [{ type: HostBinding, args: ['class.am-badge-corner-wrapper-large',] }]
};
if (false) {
/** @type {?} */
BadgeComponent.prototype.prefixCls;
/** @type {?} */
BadgeComponent.prototype.scrollNumberCls;
/** @type {?} */
BadgeComponent.prototype.style;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._text;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._setClass;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._size;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._dot;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._hot;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._corner;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._children;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._overflowCount;
/** @type {?} */
BadgeComponent.prototype.clsBadge;
/** @type {?} */
BadgeComponent.prototype.clsBadgeWrp;
/** @type {?} */
BadgeComponent.prototype.clsBadgeCornerWrp;
/** @type {?} */
BadgeComponent.prototype.clsBadgeHot;
/** @type {?} */
BadgeComponent.prototype.clsBadgeCornerWrpLg;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype._ref;
/**
* @type {?}
* @private
*/
BadgeComponent.prototype.render;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class BadgeModule {
}
BadgeModule.decorators = [
{ type: NgModule, args: [{
exports: [BadgeComponent],
declarations: [BadgeComponent],
imports: [CommonModule, FormsModule]
},] }
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// tslint:disable-next-line:no-any
/**
* @param {?} value
* @return {?}
*/
function isTemplateRef(value) {
return value instanceof TemplateRef;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class InputItemComponent {
/**
* @param {?} element
* @param {?} render
*/
constructor(element, render) {
this.element = element;
this.render = render;
this.prefixCls = 'am-input';
this.setFocus = {};
this.pattern = '';
this.autoFocus = false;
this.inputType = 'text';
this.ngTemplate = false;
this.isTemplateRef = isTemplateRef;
this._type = 'text';
this._defaultValue = '';
this._placeholder = '';
this._editable = true;
this._disabled = false;
this._clear = false;
this._error = false;
this._extra = '';
this._labelNumber = 5;
this._updatePlaceholder = false;
this._prefixListCls = 'am-list';
this._moneyKeyboardAlign = 'right';
this._focus = false;
this._isClear = false;
this._content = '';
this._inputLock = false;
this.onChange = new EventEmitter();
this.onBlur = new EventEmitter();
this.onFocus = new EventEmitter();
this.onErrorClick = new EventEmitter();
this.onExtraClick = new EventEmitter();
this.clsItem = true;
this.clsDisabled = this._disabled;
this.clsError = this._error;
this.clsFocus = this._focus;
this.clsAndroid = this._focus;
this._onChange = (/**
* @param {?} _
* @return {?}
*/
(_) => { });
this._el = element.nativeElement;
}
/**
* @return {?}
*/
get type() {
return this._type;
}
/**
* @param {?} value
* @return {?}
*/
set type(value) {
if (value && value.length > 0) {
this.inputType = value;
if (value === 'bankCard' || value === 'phone') {
this._type = 'tel';
}
else if (value === 'password') {
this._type = 'password';
}
else if (value === 'digit') {
this._type = 'number';
}
else if (value !== 'text' && value !== 'number') {
this._type = value;
}
if (value === 'number') {
this.pattern = '[0-9]*';
}
}
}
/**
* @return {?}
*/
get value() {
return this._value;
}
/**
* @param {?} v
* @return {?}
*/
set value(v) {
if (typeof v === 'undefined' || v === null) {
this._value = '';
}
else {
this._value = v;
}
}
/**
* @return {?}
*/
get defaultValue() {
return this._defaultValue;
}
/**
* @param {?} value
* @return {?}
*/
set defaultValue(value) {
this._defaultValue = value;
if (!this._value) {
this._value = this._defaultValue;
}
}
/**
* @return {?}
*/
get placeholder() {
return this._placeholder;
}
/**
* @param {?} value
* @return {?}
*/
set placeholder(value) {
this._placeholder = value;
}
/**
* @return {?}
*/
get editable() {
return this._editable;
}
/**
* @param {?} value
* @return {?}
*/
set editable(value) {
this._editable = value;
}
/**
* @return {?}
*/
get disabled() {
return this._disabled;
}
/**
* @param {?} value
* @return {?}
*/
set disabled(value) {
this._disabled = value;
this.clsDisabled = value;
}
/**
* @return {?}
*/
get clear() {
return this._clear;
}
/**
* @param {?} value
* @return {?}
*/
set clear(value) {
this._clear = value;
}
/**
* @return {?}
*/
get maxLength() {
return this._maxLength;
}
/**
* @param {?} value
* @return {?}
*/
set maxLength(value) {
this._maxLength = value;
}
/**
* @return {?}
*/
get error() {
return this._error;
}
/**
* @param {?} value
* @return {?}
*/
set error(value) {
this._error = value;
this.clsError = value;
}
/**
* @return {?}
*/
get extra() {
return this._extra;
}
/**
* @param {?} value
* @return {?}
*/
set extra(value) {
if (value instanceof TemplateRef) {
this.ngTemplate = true;
}
else {
this.ngTemplate = false;
}
this._extra = value;
}
/**
* @param {?} value
* @return {?}
*/
set labelNumber(value) {
this._labelNumber = value;
this.setCls();
}
/**
* @param {?} value
* @return {?}
*/
set updatePlaceholder(value) {
this._updatePlaceholder = value;
}
/**
* @return {?}
*/
get prefixListCls() {
return this._prefixListCls;
}
/**
* @param {?} value
* @return {?}
*/
set prefixListCls(value) {
this._prefixListCls = value;
this.render.addClass(this._el, value + '-item');
this.render.addClass(this._el, value + '-item-middle');
}
/**
* @return {?}
*/
get name() {
return this._name;
}
/**
* @param {?} value
* @return {?}
*/
set name(value) {
this._name = value;
}
/**
* @return {?}
*/
get moneyKeyboardAlign() {
return this._moneyKeyboardAlign;
}
/**
* @param {?} value
* @return {?}
*/
set moneyKeyboardAlign(value) {
this._moneyKeyboardAlign = value;
}
/**
* @param {?} value
* @return {?}
*/
set locale(value) {
this._locale = value;
}
/**
* @return {?}
*/
get fontColor() {
return this._fontColor;
}
/**
* @param {?} value
* @return {?}
*/
set fontColor(value) {
this._fontColor = value;
}
/**
* @param {?} value
* @return {?}
*/
set focus(value) {
if (value && value.focus) {
this.autoFocus = value.focus;
if (this._type === 'money') {
this.setFocus = value;
}
else if (this.inputElementRef) {
this._focus = true;
this.inputElementRef.nativeElement.focus();
this.inputFocus('');
}
}
}
/**
* @return {?}
*/
get content() {
return this._content;
}
/**
* @param {?} value
* @return {?}
*/
set content(value) {
this._content = value;
this.setCls();
}
/**
* @return {?}
*/
setCls() {
if (this.lableRef.nativeElement.children.length > 0 ||
(this.lableRef.nativeElement && this.lableRef.nativeElement.innerText !== '') ||
this._content != undefined) {
this.labelCls = {
[`${this.prefixCls}-label`]: true,
[`${this.prefixCls}-label-2`]: this._labelNumber === 2,
[`${this.prefixCls}-label-3`]: this._labelNumber === 3,
[`${this.prefixCls}-label-4`]: this._labelNumber === 4,
[`${this.prefixCls}-label-5`]: this._labelNumber === 5,
[`${this.prefixCls}-label-6`]: this._labelNumber === 6,
[`${this.prefixCls}-label-7`]: this._labelNumber === 7
};
}
this.controlCls = { [`${this.prefixCls}-control`]: true };
}
/**
* @param {?} e
* @return {?}
*/
inputChange(e) {
setTimeout((/**
* @return {?}
*/
() => {
if (this._inputLock && this.inputType === 'text') {
return;
}
/** @type {?} */
let value = e;
switch (this.inputType) {
case 'text':
break;
case 'bankCard':
value = value.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ');
break;
case 'phone':
value = value.replace(/\D/g, '').substring(0, 11);
/** @type {?} */
const valueLen = value.length;
if (valueLen > 3 && valueLen < 8) {
value = `${value.substr(0, 3)} ${value.substr(3)}`;
}
else if (valueLen >= 8) {
value = `${value.substr(0, 3)} ${value.substr(3, 4)} ${value.substr(7)}`;
}
break;
case 'number':
value = value.replace(/\D/g, '');
break;
case 'password':
break;
default:
this._value = value;
break;
}
this._value = value;
this._onChange(this._value);
this.onChange.emit(this._value);
}), 0);
}
/**
* @return {?}
*/
compositionStart() {
this._inputLock = true;
}
/**
* @return {?}
*/
compositionEnd() {
this._inputLock = false;
}
/**
* @param {?} value
* @return {?}
*/
inputFocus(value) {
if (!this._editable && document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
setTimeout((/**
* @return {?}
*/
() => {
this._focus = true;
this.clsFocus = true;
this.clsAndroid = true;
}), 100);
this.onFocus.emit(value);
}
/**
* @param {?} value
* @return {?}
*/
inputBlur(value) {
setTimeout((/**
* @return {?}
*/
() => {
if (!this._isClear) {
this._focus = false;
this.clsFocus = false;
this.clsAndroid = false;
this.onBlur.emit(value);
}
this._isClear = false;
}), 100);
}
/**
* @return {?}
*/
clearInput() {
if (this._type !== 'password' && this._updatePlaceholder) {
this._placeholder = this._value;
}
this._value = '';
this.onChange.emit(this._value);
this._onChange(this._value);
this._isClear = true;
this.inputFocus(this._value);
}
/**
* @param {?} e
* @return {?}
*/
errorClick(e) {
if (this.onErrorClick) {
this.onErrorClick.emit(e);
}
}
/**
* @param {?} e
* @return {?}
*/
extraClick(e) {
if (this.onExtraClick) {
this.onExtraClick.emit(e);
}
}
/**
* @param {?} value
* @return {?}
*/
writeValue(value) {
if (typeof value === undefined || value === null) {
this._value = '';
}
else {
this._value = value;
}
}
/**
* @param {?} fn
* @return {?}
*/
registerOnChange(fn) {
this._onChange = fn;
}
/**
* @param {?} fn
* @return {?}
*/
registerOnTouched(fn) { }
/**
* @return {?}
*/
ngOnInit() {
this.setCls();
this.render.addClass(this._el, this._prefixListCls + '-item');
this.render.addClass(this._el, this._prefixListCls + '-item-middle');
}
/**
* @return {?}
*/
ngAfterViewInit() {
setTimeout((/**
* @return {?}
*/
() => {
this.setCls();
}), 0);
}
}
InputItemComponent.decorators = [
{ type: Component, args: [{
selector: 'InputItem, nzm-input-item',
template: "<div class=\"{{ prefixListCls }}-line\">\n <div #lableContent [ngClass]=\"labelCls\">\n <ng-template *ngIf=\"isTemplateRef(content)\" [ngTemplateOutlet]=\"content\"></ng-template>\n <ng-container *ngIf=\"!isTemplateRef(content)\">{{ content }}</ng-container>\n </div>\n <div [ngClass]=\"controlCls\">\n <CustomInput\n *ngIf=\"type === 'money'\"\n [value]=\"value\"\n [defaultValue]=\"defaultValue\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [editable]=\"editable\"\n [fontColor]=\"fontColor\"\n [moneyKeyboardAlign]=\"moneyKeyboardAlign\"\n [setFocus]=\"setFocus\"\n [maxLength]=\"maxLength\"\n (onChange)=\"inputChange($event)\"\n (onBlur)=\"inputBlur(value)\"\n (onFocus)=\"inputFocus(value)\"\n >\n </CustomInput>\n <div *ngIf=\"type !== 'money'\">\n <input\n #inputElement\n [type]=\"type\"\n [name]=\"name\"\n [(ngModel)]=\"value\"\n [defaultValue]=\"defaultValue\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [readOnly]=\"!editable\"\n [autofocus]=\"autoFocus\"\n [maxlength]=\"maxLength\"\n [pattern]=\"pattern\"\n [style.color]=\"fontColor\"\n (ngModelChange)=\"inputChange($event)\"\n (compositionstart)=\"compositionStart()\"\n (compositionend)=\"compositionEnd()\"\n (blur)=\"inputBlur(value)\"\n (focus)=\"inputFocus(value)\"\n style=\"outline:none\"\n />\n </div>\n </div>\n <div\n *ngIf=\"clear && editable && !disabled && (value && value.length > 0)\"\n class=\"{{ prefixCls }}-clear\"\n (click)=\"clearInput()\"\n ></div>\n <div *ngIf=\"error\" class=\"{{ prefixCls }}-error-extra\" (click)=\"errorClick($event)\"></div>\n <div *ngIf=\"extra !== ''\" class=\"{{ prefixCls }}-extra\" (click)=\"extraClick($event)\">\n <ng-container *ngIf=\"!ngTemplate\">{{ extra }}</ng-container>\n <ng-template *ngIf=\"ngTemplate\" [ngTemplateOutlet]=\"extra\"></ng-template>\n </div>\n</div>\n",
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef((/**
* @return {?}
*/
() => InputItemComponent)),
multi: true
}
]
}] }
];
/** @nocollapse */
InputItemComponent.ctorParameters = () => [
{ type: ElementRef },
{ type: Renderer2 }
];
InputItemComponent.propDecorators = {
lableRef: [{ type: ViewChild, args: ['lableContent', { static: true },] }],
inputElementRef: [{ type: ViewChild, args: ['inputElement', { static: false },] }],
type: [{ type: Input }],
value: [{ type: Input }],
defaultValue: [{ type: Input }],
placeholder: [{ type: Input }],
editable: [{ type: Input }],
disabled: [{ type: Input }],
clear: [{ type: Input }],
maxLength: [{ type: Input }],
error: [{ type: Input }],
extra: [{ type: Input }],
labelNumber: [{ type: Input }],
updatePlaceholder: [{ type: Input }],
prefixListCls: [{ type: Input }],
name: [{ type: Input }],
moneyKeyboardAlign: [{ type: Input }],
locale: [{ type: Input }],
fontColor: [{ type: Input }],
focus: [{ type: Input }],
content: [{ type: Input }],
onChange: [{ type: Output }],
onBlur: [{ type: Output }],
onFocus: [{ type: Output }],
onErrorClick: [{ type: Output }],
onExtraClick: [{ type: Output }],
clsItem: [{ type: HostBinding, args: ['class.am-input-item',] }],
clsDisabled: [{ type: HostBinding, args: ['class.am-input-disabled',] }],
clsError: [{ type: HostBinding, args: ['class.am-input-error',] }],
clsFocus: [{ type: HostBinding, args: ['class.am-input-focus',] }],
clsAndroid: [{ type: HostBinding, args: ['class.am-input-android,',] }]
};
if (false) {
/** @type {?} */
InputItemComponent.prototype.prefixCls;
/** @type {?} */
InputItemComponent.prototype.wrapCls;
/** @type {?} */
InputItemComponent.prototype.labelCls;
/** @type {?} */
InputItemComponent.prototype.controlCls;
/** @type {?} */
InputItemComponent.prototype.setFocus;
/** @type {?} */
InputItemComponent.prototype.pattern;
/** @type {?} */
InputItemComponent.prototype.autoFocus;
/** @type {?} */
InputItemComponent.prototype.inputType;
/** @type {?} */
InputItemComponent.prototype.ngTemplate;
/** @type {?} */
InputItemComponent.prototype.isTemplateRef;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._el;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._type;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._value;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._defaultValue;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._placeholder;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._editable;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._disabled;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._clear;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._maxLength;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._error;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._extra;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._labelNumber;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._updatePlaceholder;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._prefixListCls;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._name;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._moneyKeyboardAlign;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._locale;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._focus;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._isClear;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._fontColor;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._content;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype._inputLock;
/** @type {?} */
InputItemComponent.prototype.lableRef;
/** @type {?} */
InputItemComponent.prototype.inputElementRef;
/** @type {?} */
InputItemComponent.prototype.onChange;
/** @type {?} */
InputItemComponent.prototype.onBlur;
/** @type {?} */
InputItemComponent.prototype.onFocus;
/** @type {?} */
InputItemComponent.prototype.onErrorClick;
/** @type {?} */
InputItemComponent.prototype.onExtraClick;
/** @type {?} */
InputItemComponent.prototype.clsItem;
/** @type {?} */
InputItemComponent.prototype.clsDisabled;
/** @type {?} */
InputItemComponent.prototype.clsError;
/** @type {?} */
InputItemComponent.prototype.clsFocus;
/** @type {?} */
InputItemComponent.prototype.clsAndroid;
/** @type {?} */
InputItemComponent.prototype._onChange;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype.element;
/**
* @type {?}
* @private
*/
InputItemComponent.prototype.render;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
const LOCAL_PROVIDER_TOKEN = new InjectionToken('locale-provider-token');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Picker = {
okText: '确定',
dismissText: '取消',
extra: '请选择'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// import DatePickerLocale from 'rmc-date-picker/lib/locale/zh_CN';
var DatePicker = {
errorMessage: '当前时间与设定最大或最小日期格式不一致',
curTMorethanMax: '当前时间大于设定最大日期',
curTLessthanMin: '当前时间小于设定最最小日期',
okText: '确定',
dismissText: '取消',
extra: '请选择',
// DatePickerLocale,
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '分',
am: '上午',
pm: '下午'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// import DatePickerLocale from 'rmc-date-picker/lib/locale/zh_CN';
var DatePickerView = {
okText: '确定',
dismissText: '取消',
extra: '请选择',
// DatePickerLocale,
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '分',
am: '上午',
pm: '下午'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Menu = {
okText: '确定',
cancelText: '取消'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// 同步自 'rmc-calendar/lib/locale/zh_CN';
var zhCN = {
title: '日期选择',
today: '今天',
month: '月',
year: '年',
am: '上午',
pm: '下午',
dateTimeFormat: 'yyyy年MM月dd日 星期w hh:mm',
dateFormat: 'yyyy年MM月dd日 星期w',
noChoose: '未选择',
week: ['日', '一', '二', '三', '四', '五', '六'],
clear: '清除',
selectTime: '选择时间',
selectStartTime: '选择开始时间',
selectEndTime: '选择结束时间',
start: '开始',
end: '结束',
begin: '起',
over: '止',
begin_over: '起/止',
confirm: '确认',
monthTitle: 'yyyy年MM月',
loadPrevMonth: '加载上一个月',
yesterday: '昨天',
lastWeek: '近一周',
lastMonth: '近一个月'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var SearchBar = {
cancelText: '取消'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var InputItem = {
confirmLabel: '确定',
backspaceLabel: '退格',
cancelKeyboardLabel: '收起键盘'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Pagination = {
prevText: '上一页',
nextText: '下一页'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var PullToRefresh = {
activateText: '松开立即刷新',
deactivateText: '下拉可以刷新',
finishText: '完成刷新'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ActionSheet = {
dismissText: '取消'
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var zh_CN = {
locale: 'zh_CN',
Picker,
DatePicker,
DatePickerView,
Menu,
Calendar: zhCN,
SearchBar,
InputItem,
Pagination,
PullToRefresh,
ActionSheet
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class LocaleProviderService {
/**
* @param {?} locale
*/
constructor(locale) {
this._change = new BehaviorSubject(this._locale);
this.setLocale(locale || zh_CN);
}
/**
* @return {?}
*/
get localeChange() {
return this._change.asObservable();
}
/**
* @param {?} keyPath
* @return {?}
*/
getLocaleValue(keyPath) {
/** @type {?} */
const content = (/** @type {?} */ (this._getObjectPath(this._locale, keyPath)));
if (typeof content === 'string') {
return content;
}
return '';
}
/**
* @param {?} keyPath
* @return {?}
*/
getLocaleSubObj(keyPath) {
/** @type {?} */
const content = (/** @type {?} */ (this._getObjectPath(this._locale, keyPath)));
if (typeof content === 'object') {
return content;
}
return null;
}
/**
* @param {?} locale
* @return {?}
*/
setLocale(locale) {
if (!locale || (this._locale && this._locale.locale === locale.locale)) {
return;
}
this._locale = locale;
this._change.next(locale);
}
/**
* @return {?}
*/
getLocaleId() {
return this._locale && this._locale.locale ? this._locale.locale : '';
}
/**
* @return {?}
*/
getLocale() {
return this._locale;
}
/**
* @private
* @param {?} obj
* @param {?} path
* @return {?}
*/
_getObjectPath(obj, path) {
/** @type {?} */
let res = obj;
/** @type {?} */
const paths = path.split('.');
/** @type {?} */
const depth = paths.length;
/** @type {?} */
let index = 0;
while (res && index < depth) {
res = res[paths[index++]];
}
return index === depth ? res : null;
}
}
LocaleProviderService.decorators = [
{ type: Injectable }
];
/** @nocollapse */
LocaleProviderService.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [LOCAL_PROVIDER_TOKEN,] }] }
];
if (false) {
/**
* @type {?}
* @private
*/
LocaleProviderService.prototype._locale;
/**
* @type {?}
* @private
*/
LocaleProviderService.prototype._change;
}
/**
* @param {?} exist
* @param {?} locale
* @return {?}
*/
function LOCALE_PROVIDER_SERVICE_FACTORY(exist, locale) {
return exist || new LocaleProviderService(locale);
}
/** @type {?} */
const LOCALE_PROVIDER_SERVICE_PROVIDER = {
provide: LocaleProviderService,
useFactory: LOCALE_PROVIDER_SERVICE_FACTORY,
deps: [[new Optional(), new SkipSelf(), LocaleProviderService], LOCAL_PROVIDER_TOKEN]
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CustomKeyboardComponent {
/**
* @param {?} _localeProvider
*/
constructor(_localeProvider) {
this._localeProvider = _localeProvider;
this.prefixCls = 'am-number-keyboard';
this.okText = '';
this._locale = {};
this._unsubscribe$ = new Subject();
this.onClick = new EventEmitter();
}
/**
* @param {?} e
* @return {?}
*/
tdClick(e) {
this.onClick.emit(e);
}
/**
* @return {?}
*/
ngOnInit() {
this.wrapCls = {
[`${this.prefixCls}-item`]: true
};
this.wrapperCls = {
[`${this.prefixCls}-wrapper`]: true
};
this._localeProvider.localeChange.pipe(takeUntil(this._unsubscribe$)).subscribe((/**
* @param {?} _
* @return {?}
*/
_ => {
this._locale = this._localeProvider.getLocaleSubObj('InputItem');
this.okText = this._locale.confirmLabel;
}));
}
/**
* @return {?}
*/
ngOnDestroy() {
this._unsubscribe$.next();
this._unsubscribe$.complete();
}
}
CustomKeyboardComponent.decorators = [
{ type: Component, args: [{
selector: 'CustomKeyboard',
template: "<div [ngClass]=\"wrapperCls\">\n <table>\n <tbody>\n <tr>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(1)\">1</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(2)\">2</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(3)\">3</td>\n <td class=\"keyboard-delete\" [rowSpan]=\"2\" [ngClass]=\"wrapCls\" (click)=\"tdClick('delete')\"></td>\n </tr>\n <tr>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(4)\">4</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(5)\">5</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(6)\">6</td>\n </tr>\n <tr>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(7)\">7</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(8)\">8</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(9)\">9</td>\n <td class=\"keyboard-confirm\" [rowSpan]=\"2\" [ngClass]=\"wrapCls\" (click)=\"tdClick('confirm')\">{{ okText }}</td>\n </tr>\n <tr>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick('.')\">.</td>\n <td [ngClass]=\"wrapCls\" (click)=\"tdClick(0)\">0</td>\n <td class=\"keyboard-hide\" [ngClass]=\"wrapCls\" (click)=\"tdClick('hide')\"></td>\n </tr>\n </tbody>\n </table>\n</div>\n",
encapsulation: ViewEncapsulation.None,
providers: [LocaleProviderService]
}] }
];
/** @nocollapse */
CustomKeyboardComponent.ctorParameters = () => [
{ type: LocaleProviderService }
];
CustomKeyboardComponent.propDecorators = {
onClick: [{ type: Output }]
};
if (false) {
/** @type {?} */
CustomKeyboardComponent.prototype.prefixCls;
/** @type {?} */
CustomKeyboardComponent.prototype.wrapCls;
/** @type {?} */
CustomKeyboardComponent.prototype.okText;
/** @type {?} */
CustomKeyboardComponent.prototype.wrapperCls;
/**
* @type {?}
* @private
*/
CustomKeyboardComponent.prototype._locale;
/**
* @type {?}
* @private
*/
CustomKeyboardComponent.prototype._unsubscribe$;
/** @type {?} */
CustomKeyboardComponent.prototype.onClick;
/**
* @type {?}
* @private
*/
CustomKeyboardComponent.prototype._localeProvider;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
class CustomInputService {
/**
* @param {?} _appRef